Go to the source code of this file.
Classes | |
struct | previous_mode_data |
struct | callback_data |
Defines | |
#define | readline(p) local_getline(p,stdin) |
#define | add_history(X) |
#define | read_history(X) |
#define | write_history(X) |
#define | stifle_history(X) |
#define | BEGIN_TIMER beginTimer() |
#define | END_TIMER endTimer() |
#define | HAS_TIMER 1 |
#define | MODE_Line 0 |
#define | MODE_Column 1 |
#define | MODE_List 2 |
#define | MODE_Semi 3 |
#define | MODE_Html 4 |
#define | MODE_Insert 5 |
#define | MODE_Tcl 6 |
#define | MODE_Csv 7 |
#define | MODE_Explain 8 |
#define | ArraySize(X) (sizeof(X)/sizeof(X[0])) |
Functions | |
int | isatty () |
static void | beginTimer (void) |
static double | timeDiff (struct timeval *pStart, struct timeval *pEnd) |
static void | endTimer (void) |
static int | isNumber (const char *z, int *realnum) |
static void | shellstaticFunc (sqlite3_context *context, int argc, sqlite3_value **argv) |
static char * | local_getline (char *zPrompt, FILE *in) |
static char * | one_input_line (const char *zPrior, FILE *in) |
static void | output_quoted_string (FILE *out, const char *z) |
static void | output_c_string (FILE *out, const char *z) |
static void | output_html_string (FILE *out, const char *z) |
static void | output_csv (struct callback_data *p, const char *z, int bSep) |
static int | callback (void *pArg, int nArg, char **azArg, char **azCol) |
static void | set_table_name (struct callback_data *p, const char *zName) |
static char * | appendText (char *zIn, char const *zAppend, char quote) |
static int | run_table_dump_query (FILE *out, sqlite3 *db, const char *zSelect) |
static int | dump_callback (void *pArg, int nArg, char **azArg, char **azCol) |
static int | run_schema_dump_query (struct callback_data *p, const char *zQuery, char **pzErrMsg) |
static int | process_input (struct callback_data *p, FILE *in) |
static void | open_db (struct callback_data *p) |
static void | resolve_backslashes (char *z) |
static int | booleanValue (char *zArg) |
static int | do_meta_command (char *zLine, struct callback_data *p) |
static int | _contains_semicolon (const char *z, int N) |
static int | _all_whitespace (const char *z) |
static int | _is_command_terminator (const char *zLine) |
static char * | find_home_dir (void) |
static void | process_sqliterc (struct callback_data *p, const char *sqliterc_override) |
static void | usage (int showDetail) |
static void | main_init (struct callback_data *data) |
int | main (int argc, char **argv) |
Variables | |
static struct rusage | sBegin |
static int | enableTimer = 0 |
static int | bail_on_error = 0 |
static int | stdin_is_interactive = 1 |
static sqlite3 * | db = 0 |
static volatile int | seenInterrupt = 0 |
static char * | Argv0 |
static char | mainPrompt [20] |
static char | continuePrompt [20] |
static const char * | zShellStatic = 0 |
static const char * | modeDescr [] |
static const char | needCsvQuote [] |
static char | zHelp [] |
static const char | zOptions [] |
#define add_history | ( | X | ) |
Definition at line 41 of file shell.c.
Referenced by one_input_line().
#define ArraySize | ( | X | ) | (sizeof(X)/sizeof(X[0])) |
Definition at line 356 of file shell.c.
Referenced by callback(), createMask(), do_meta_command(), sqlite3_close(), sqlite3_status(), sqlite3DropTriggerPtr(), sqlite3ExprCodeGetColumn(), sqlite3FindFunction(), sqlite3FuncDefInsert(), sqlite3Pragma(), sqlite3RegisterDateTimeFunctions(), sqlite3RegisterGlobalFunctions(), sqlite3ReleaseTempReg(), sqlite3StatusAdd(), sqlite3StatusSet(), sqlite3StatusValue(), and whereClauseInit().
#define BEGIN_TIMER beginTimer() |
Definition at line 100 of file shell.c.
Referenced by process_input().
#define END_TIMER endTimer() |
Definition at line 101 of file shell.c.
Referenced by process_input().
#define MODE_Column 1 |
Definition at line 332 of file shell.c.
Referenced by callback(), do_meta_command(), and main().
#define MODE_Csv 7 |
Definition at line 338 of file shell.c.
Referenced by callback(), do_meta_command(), and main().
#define MODE_Explain 8 |
Definition at line 339 of file shell.c.
Referenced by callback(), and do_meta_command().
#define MODE_Html 4 |
Definition at line 335 of file shell.c.
Referenced by callback(), do_meta_command(), and main().
#define MODE_Insert 5 |
Definition at line 336 of file shell.c.
Referenced by callback(), and do_meta_command().
#define MODE_Line 0 |
Definition at line 331 of file shell.c.
Referenced by callback(), do_meta_command(), and main().
#define MODE_List 2 |
Definition at line 333 of file shell.c.
Referenced by callback(), do_meta_command(), main(), and main_init().
#define MODE_Semi 3 |
Definition at line 334 of file shell.c.
Referenced by callback(), and do_meta_command().
#define MODE_Tcl 6 |
Definition at line 337 of file shell.c.
Referenced by callback(), and do_meta_command().
#define readline | ( | p | ) | local_getline(p,stdin) |
Definition at line 40 of file shell.c.
Referenced by one_input_line().
static int _all_whitespace | ( | const char * | z | ) | [static] |
Definition at line 1623 of file shell.c.
Referenced by _is_command_terminator(), and process_input().
static int _contains_semicolon | ( | const char * | z, | |
int | N | |||
) | [static] |
Definition at line 1614 of file shell.c.
Referenced by process_input().
static int _is_command_terminator | ( | const char * | zLine | ) | [static] |
Definition at line 1649 of file shell.c.
References _all_whitespace().
Referenced by process_input().
static char* appendText | ( | char * | zIn, | |
char const * | zAppend, | |||
char | quote | |||
) | [static] |
Definition at line 720 of file shell.c.
Referenced by dump_callback().
static void beginTimer | ( | void | ) | [static] |
Definition at line 76 of file shell.c.
References enableTimer, and sBegin.
static int booleanValue | ( | char * | zArg | ) | [static] |
Definition at line 1013 of file shell.c.
Referenced by do_meta_command().
static int callback | ( | void * | pArg, | |
int | nArg, | |||
char ** | azArg, | |||
char ** | azCol | |||
) | [static] |
Definition at line 512 of file shell.c.
References callback_data::actualWidth, ArraySize, callback_data::cnt, callback_data::colWidth, isNumber(), callback_data::mode, MODE_Column, MODE_Csv, MODE_Explain, MODE_Html, MODE_Insert, MODE_Line, MODE_List, MODE_Semi, MODE_Tcl, callback_data::nullvalue, callback_data::out, output_c_string(), output_csv(), output_html_string(), output_quoted_string(), callback_data::separator, callback_data::showHeader, and callback_data::zDestTable.
Referenced by do_meta_command(), main(), and process_input().
static int do_meta_command | ( | char * | zLine, | |
struct callback_data * | p | |||
) | [static] |
Definition at line 1033 of file shell.c.
References ArraySize, bail_on_error, booleanValue(), callback(), callback_data::cnt, previous_mode_data::colWidth, callback_data::colWidth, continuePrompt, callback_data::db, callback_data::echoOn, enableTimer, callback_data::explainPrev, local_getline(), mainPrompt, previous_mode_data::mode, callback_data::mode, MODE_Column, MODE_Csv, MODE_Explain, MODE_Html, MODE_Insert, MODE_Line, MODE_List, MODE_Semi, MODE_Tcl, modeDescr, callback_data::nullvalue, open_db(), callback_data::out, callback_data::outfile, output_c_string(), process_input(), resolve_backslashes(), run_schema_dump_query(), run_table_dump_query(), callback_data::separator, set_table_name(), previous_mode_data::showHeader, callback_data::showHeader, sqlite3_bind_text(), sqlite3_busy_timeout(), sqlite3_column_count(), sqlite3_errmsg(), sqlite3_exec(), sqlite3_finalize(), sqlite3_free(), sqlite3_free_table(), sqlite3_get_table(), sqlite3_load_extension(), sqlite3_mprintf(), sqlite3_prepare(), sqlite3_reset(), sqlite3_snprintf(), sqlite3_step(), SQLITE_OK, SQLITE_STATIC, previous_mode_data::valid, callback_data::writableSchema, and zShellStatic.
Referenced by main(), and process_input().
static int dump_callback | ( | void * | pArg, | |
int | nArg, | |||
char ** | azArg, | |||
char ** | azCol | |||
) | [static] |
Definition at line 787 of file shell.c.
References appendText(), callback_data::db, callback_data::out, run_table_dump_query(), sqlite3_column_text(), sqlite3_finalize(), sqlite3_free(), sqlite3_mprintf(), sqlite3_prepare(), sqlite3_step(), SQLITE_CORRUPT, SQLITE_OK, SQLITE_ROW, and callback_data::writableSchema.
Referenced by run_schema_dump_query().
static void endTimer | ( | void | ) | [static] |
Definition at line 91 of file shell.c.
References enableTimer, sBegin, and timeDiff().
static char* find_home_dir | ( | void | ) | [static] |
Definition at line 1773 of file shell.c.
References sqlite3_snprintf().
Referenced by main(), and process_sqliterc().
int isatty | ( | ) |
Referenced by main().
static int isNumber | ( | const char * | z, | |
int * | realnum | |||
) | [static] |
Definition at line 177 of file shell.c.
Referenced by callback().
static char* local_getline | ( | char * | zPrompt, | |
FILE * | in | |||
) | [static] |
Definition at line 230 of file shell.c.
Referenced by do_meta_command(), and one_input_line().
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 1915 of file shell.c.
References Argv0, bail_on_error, callback(), callback_data::db, do_meta_command(), callback_data::echoOn, find_home_dir(), isatty(), main_init(), callback_data::mode, MODE_Column, MODE_Csv, MODE_Html, MODE_Line, MODE_List, callback_data::nullvalue, open_db(), callback_data::out, process_input(), process_sqliterc(), read_history, callback_data::separator, set_table_name(), callback_data::showHeader, sqlite3_close(), sqlite3_errmsg(), sqlite3_exec(), sqlite3_libversion(), sqlite3_snprintf(), SQLITE_OK, stdin_is_interactive, stifle_history, usage(), write_history, and callback_data::zDbFilename.
static void main_init | ( | struct callback_data * | data | ) | [static] |
Definition at line 1906 of file shell.c.
References continuePrompt, mainPrompt, callback_data::mode, MODE_List, callback_data::separator, callback_data::showHeader, and sqlite3_snprintf().
Referenced by main().
static char* one_input_line | ( | const char * | zPrior, | |
FILE * | in | |||
) | [static] |
Definition at line 277 of file shell.c.
References add_history, continuePrompt, local_getline(), mainPrompt, and readline.
Referenced by process_input().
static void open_db | ( | struct callback_data * | p | ) | [static] |
Definition at line 954 of file shell.c.
References callback_data::db, shellstaticFunc(), sqlite3_create_function(), sqlite3_enable_load_extension(), sqlite3_errcode(), sqlite3_errmsg(), sqlite3_open(), SQLITE_OK, SQLITE_UTF8, and callback_data::zDbFilename.
Referenced by do_meta_command(), main(), and process_input().
static void output_c_string | ( | FILE * | out, | |
const char * | z | |||
) | [static] |
Definition at line 391 of file shell.c.
Referenced by callback(), and do_meta_command().
static void output_csv | ( | struct callback_data * | p, | |
const char * | z, | |||
int | bSep | |||
) | [static] |
Definition at line 467 of file shell.c.
References needCsvQuote, callback_data::nullvalue, callback_data::out, and callback_data::separator.
Referenced by callback().
static void output_html_string | ( | FILE * | out, | |
const char * | z | |||
) | [static] |
Definition at line 420 of file shell.c.
Referenced by callback().
static void output_quoted_string | ( | FILE * | out, | |
const char * | z | |||
) | [static] |
Definition at line 361 of file shell.c.
Referenced by callback().
static int process_input | ( | struct callback_data * | p, | |
FILE * | in | |||
) | [static] |
Definition at line 1668 of file shell.c.
References _all_whitespace(), _contains_semicolon(), _is_command_terminator(), Argv0, bail_on_error, BEGIN_TIMER, callback(), callback_data::cnt, callback_data::db, do_meta_command(), callback_data::echoOn, END_TIMER, one_input_line(), open_db(), callback_data::out, seenInterrupt, sqlite3_complete(), sqlite3_errmsg(), sqlite3_exec(), sqlite3_free(), sqlite3_snprintf(), and stdin_is_interactive.
Referenced by do_meta_command(), main(), and process_sqliterc().
static void process_sqliterc | ( | struct callback_data * | p, | |
const char * | sqliterc_override | |||
) | [static] |
Definition at line 1833 of file shell.c.
References Argv0, find_home_dir(), process_input(), sqlite3_snprintf(), and stdin_is_interactive.
Referenced by main().
static void resolve_backslashes | ( | char * | z | ) | [static] |
Definition at line 982 of file shell.c.
Referenced by do_meta_command().
static int run_schema_dump_query | ( | struct callback_data * | p, | |
const char * | zQuery, | |||
char ** | pzErrMsg | |||
) | [static] |
Definition at line 881 of file shell.c.
References callback_data::db, dump_callback(), sqlite3_exec(), sqlite3_free(), sqlite3_snprintf(), and SQLITE_CORRUPT.
Referenced by do_meta_command().
static int run_table_dump_query | ( | FILE * | out, | |
sqlite3 * | db, | |||
const char * | zSelect | |||
) | [static] |
Definition at line 765 of file shell.c.
References sqlite3_column_text(), sqlite3_finalize(), sqlite3_prepare(), sqlite3_step(), SQLITE_OK, and SQLITE_ROW.
Referenced by do_meta_command(), and dump_callback().
static void set_table_name | ( | struct callback_data * | p, | |
const char * | zName | |||
) | [static] |
Definition at line 679 of file shell.c.
References callback_data::zDestTable.
Referenced by do_meta_command(), and main().
static void shellstaticFunc | ( | sqlite3_context * | context, | |
int | argc, | |||
sqlite3_value ** | argv | |||
) | [static] |
Definition at line 210 of file shell.c.
References sqlite3_result_text(), SQLITE_STATIC, and zShellStatic.
Referenced by open_db().
static double timeDiff | ( | struct timeval * | pStart, | |
struct timeval * | pEnd | |||
) | [static] |
Definition at line 83 of file shell.c.
Referenced by endTimer().
static void usage | ( | int | showDetail | ) | [static] |
char* Argv0 [static] |
Definition at line 138 of file shell.c.
Referenced by main(), process_input(), process_sqliterc(), and usage().
int bail_on_error = 0 [static] |
Definition at line 114 of file shell.c.
Referenced by do_meta_command(), main(), and process_input().
char continuePrompt[20] [static] |
Definition at line 145 of file shell.c.
Referenced by do_meta_command(), main_init(), and one_input_line().
Definition at line 127 of file shell.c.
Referenced by analyzeDatabase(), attachFunc(), blobReadWrite(), changes(), changeTempStorage(), checkReadLocks(), Cleanup(), codeAlias(), codeAttach(), codeTriggerProgram(), corruptSchema(), create_database(), createIncrblobChannel(), detachFunc(), exprAnalyze(), flagPragma(), flattenSubquery(), freeIndex(), FUNC(), func_callback_wrapper(), generateColumnNames(), groupConcatStep(), icuLoadCollation(), incrblobClose(), invalidateTempStorage(), isLikeOrGlob(), isSortingIndex(), keyInfoFromExprList(), last_insert_rowid(), likeFunc(), loadExt(), lookupName(), multiSelect(), multiSelectOrderBy(), openStatTable(), reindexDatabases(), releaseMemArray(), renameTableFunc(), renameTriggerFunc(), replaceFunc(), resolveAlias(), resolveAsName(), resolveCompoundOrderBy(), resolveSelectStep(), selectAddColumnTypeAndCollation(), selectColumnsFromExprList(), selectExpander(), setDateTimeToCurrent(), sqlite3_step(), sqlite3AddCheckConstraint(), sqlite3AddCollateType(), sqlite3AddColumn(), sqlite3AddColumnType(), sqlite3AddDefaultValue(), sqlite3AlterBeginAddColumn(), sqlite3AlterFinishAddColumn(), sqlite3AlterRenameTable(), sqlite3Analyze(), sqlite3BeginTransaction(), sqlite3BeginTrigger(), sqlite3ChangeCookie(), sqlite3CodeRowTrigger(), sqlite3CodeVerifySchema(), sqlite3CommitTransaction(), sqlite3CreateForeignKey(), sqlite3CreateIndex(), sqlite3CreateView(), sqlite3DeleteFrom(), sqlite3DeleteTable(), sqlite3DropIndex(), sqlite3DropTable(), sqlite3DropTrigger(), sqlite3DropTriggerPtr(), sqlite3EndTable(), sqlite3ErrorMsg(), sqlite3ExprAssignVarNumber(), sqlite3ExprCodeTarget(), sqlite3ExprCollSeq(), sqlite3ExprFunction(), sqlite3ExprListAppend(), sqlite3ExprSetColl(), sqlite3FindInIndex(), sqlite3FinishCoding(), sqlite3FinishTrigger(), sqlite3FixInit(), sqlite3IndexAffinityStr(), sqlite3IndexKeyinfo(), sqlite3InitCallback(), sqlite3Insert(), sqlite3LocateCollSeq(), sqlite3MaterializeView(), sqlite3NestedParse(), sqlite3OpenTempDatabase(), sqlite3Pragma(), sqlite3ReadSchema(), sqlite3RefillIndex(), sqlite3Reindex(), sqlite3Reprepare(), sqlite3ResolveOrderGroupBy(), sqlite3ResultSetOfSelect(), sqlite3RollbackTransaction(), sqlite3RunParser(), sqlite3Select(), sqlite3SelectNew(), sqlite3SelectPrep(), sqlite3SrcListAppendFromTerm(), sqlite3StartTable(), sqlite3Step(), sqlite3TableAffinityStr(), sqlite3TwoPartName(), sqlite3Update(), sqlite3ValueFree(), sqlite3VdbeChangeP4(), sqlite3VdbeChangeToNoop(), sqlite3VdbeExec(), sqlite3VdbeList(), sqlite3VdbeMakeReady(), sqlite3VdbeMemFromBtree(), sqlite3VdbeSetNumCols(), sqlite3VdbeUsesBtree(), sqlite3ViewGetColumnNames(), sqlite3WhereBegin(), sqlite3WhereEnd(), sqliteDefaultBusyCallback(), sqliteResetColumnNames(), strftimeFunc(), targetSrcList(), total_changes(), updateVirtualTable(), whereClauseClear(), whereClauseInsert(), whereTempTriggers(), xauth_callback_wrapper(), xbusy_callback_wrapper(), xcommit_callback_wrapper(), xcompare_callback_wrapper(), xneeded_callback_wrapper(), xprogress_callback_wrapper(), and xtrace_callback_wrapper().
int enableTimer = 0 [static] |
Definition at line 71 of file shell.c.
Referenced by beginTimer(), do_meta_command(), and endTimer().
char mainPrompt[20] [static] |
Definition at line 144 of file shell.c.
Referenced by do_meta_command(), main_init(), and one_input_line().
const char* modeDescr[] [static] |
{ "line", "column", "list", "semi", "html", "insert", "tcl", "csv", "explain", }
Definition at line 341 of file shell.c.
Referenced by do_meta_command().
const char needCsvQuote[] [static] |
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }
Definition at line 442 of file shell.c.
Referenced by output_csv().
struct rusage sBegin [static] |
Definition at line 68 of file shell.c.
Referenced by beginTimer(), and endTimer().
volatile int seenInterrupt = 0 [static] |
Definition at line 132 of file shell.c.
Referenced by process_input().
int stdin_is_interactive = 1 [static] |
Definition at line 120 of file shell.c.
Referenced by main(), process_input(), and process_sqliterc().
const char zOptions[] [static] |
" -init filename read/process named file\n" " -echo print commands before execution\n" " -[no]header turn headers on or off\n" " -bail stop after hitting an error\n" " -interactive force interactive I/O\n" " -batch force batch I/O\n" " -column set output mode to 'column'\n" " -csv set output mode to 'csv'\n" " -html set output mode to HTML\n" " -line set output mode to 'line'\n" " -list set output mode to 'list'\n" " -separator 'x' set output field separator (|)\n" " -nullvalue 'text' set text string for NULL values\n" " -version show SQLite version\n"
const char* zShellStatic = 0 [static] |
Definition at line 209 of file shell.c.
Referenced by do_meta_command(), and shellstaticFunc().
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:50:01 2011 by Doxygen 1.6.1