ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
shell.c File Reference
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "sqlite3.h"
#include <ctype.h>
#include <stdarg.h>
#include <signal.h>
#include <pwd.h>
#include <unistd.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <fcntl.h>
#include <utime.h>
#include <time.h>
#include <errno.h>
Include dependency graph for shell.c:

Go to the source code of this file.

Classes

struct  ShellText
 
struct  SHA3Context
 
struct  FsdirLevel
 
struct  fsdir_cursor
 
struct  fsdir_tab
 
struct  completion_vtab
 
struct  completion_cursor
 
struct  ApndFile
 
struct  IdxConstraint
 
struct  IdxScan
 
struct  IdxColumn
 
struct  IdxTable
 
struct  IdxWrite
 
struct  IdxStatement
 
struct  IdxHashEntry
 
struct  IdxHash
 
struct  sqlite3expert
 
struct  ExpertVtab
 
struct  ExpertCsr
 
struct  IdxSampleCtx
 
struct  IdxRemCtx
 
struct  IdxRemCtx::IdxRemSlot
 
struct  SavedModeInfo
 
struct  ExpertInfo
 
struct  EQPGraphRow
 
struct  EQPGraph
 
struct  ShellState
 
struct  ImportCtx
 

Macros

#define SQLITE_OS_WINRT   0
 
#define _LARGE_FILE   1
 
#define _FILE_OFFSET_BITS   64
 
#define _LARGEFILE_SOURCE   1
 
#define GETPID   getpid
 
#define shell_read_history(X)
 
#define shell_write_history(X)
 
#define shell_stifle_history(X)
 
#define SHELL_USE_LOCAL_GETLINE   1
 
#define IsSpace(X)   isspace((unsigned char)X)
 
#define IsDigit(X)   isdigit((unsigned char)X)
 
#define ToLower(X)   (char)tolower((unsigned char)X)
 
#define setBinaryMode(X, Y)
 
#define setTextMode(X, Y)
 
#define BEGIN_TIMER   beginTimer()
 
#define END_TIMER   endTimer()
 
#define HAS_TIMER   1
 
#define UNUSED_PARAMETER(x)   (void)(x)
 
#define ArraySize(X)   (int)(sizeof(X)/sizeof(X[0]))
 
#define utf8_printf   fprintf
 
#define raw_printf   fprintf
 
#define SQLITE_EXTENSION_INIT1
 
#define SQLITE_EXTENSION_INIT2(X)   (void)(X)
 
#define SHA3_BYTEORDER   0
 
#define a00   (p->u.s[0])
 
#define a01   (p->u.s[1])
 
#define a02   (p->u.s[2])
 
#define a03   (p->u.s[3])
 
#define a04   (p->u.s[4])
 
#define a10   (p->u.s[5])
 
#define a11   (p->u.s[6])
 
#define a12   (p->u.s[7])
 
#define a13   (p->u.s[8])
 
#define a14   (p->u.s[9])
 
#define a20   (p->u.s[10])
 
#define a21   (p->u.s[11])
 
#define a22   (p->u.s[12])
 
#define a23   (p->u.s[13])
 
#define a24   (p->u.s[14])
 
#define a30   (p->u.s[15])
 
#define a31   (p->u.s[16])
 
#define a32   (p->u.s[17])
 
#define a33   (p->u.s[18])
 
#define a34   (p->u.s[19])
 
#define a40   (p->u.s[20])
 
#define a41   (p->u.s[21])
 
#define a42   (p->u.s[22])
 
#define a43   (p->u.s[23])
 
#define a44   (p->u.s[24])
 
#define ROL64(a, x)   ((a<<x)|(a>>(64-x)))
 
#define FSDIR_SCHEMA   "(name,mode,mtime,data,path HIDDEN,dir HIDDEN)"
 
#define FSDIR_COLUMN_NAME   0 /* Name of the file */
 
#define FSDIR_COLUMN_MODE   1 /* Access mode */
 
#define FSDIR_COLUMN_MTIME   2 /* Last modification time */
 
#define FSDIR_COLUMN_DATA   3 /* File content */
 
#define FSDIR_COLUMN_PATH   4 /* Path to top of search */
 
#define FSDIR_COLUMN_DIR   5 /* Path is relative to this directory */
 
#define COMPLETION_FIRST_PHASE   1
 
#define COMPLETION_KEYWORDS   1
 
#define COMPLETION_PRAGMAS   2
 
#define COMPLETION_FUNCTIONS   3
 
#define COMPLETION_COLLATIONS   4
 
#define COMPLETION_INDEXES   5
 
#define COMPLETION_TRIGGERS   6
 
#define COMPLETION_DATABASES   7
 
#define COMPLETION_TABLES   8 /* Also VIEWs and TRIGGERs */
 
#define COMPLETION_COLUMNS   9
 
#define COMPLETION_MODULES   10
 
#define COMPLETION_EOF   11
 
#define COMPLETION_COLUMN_CANDIDATE   0 /* Suggested completion of the input */
 
#define COMPLETION_COLUMN_PREFIX   1 /* Prefix of the word to be completed */
 
#define COMPLETION_COLUMN_WHOLELINE   2 /* Entire line seen so far */
 
#define COMPLETION_COLUMN_PHASE   3 /* ePhase - used for debugging only */
 
#define APND_MARK_PREFIX   "Start-Of-SQLite3-"
 
#define APND_MARK_PREFIX_SZ   17
 
#define APND_MARK_SIZE   25
 
#define APND_MAX_SIZE   (65536*15259)
 
#define ORIGVFS(p)   ((sqlite3_vfs*)((p)->pAppData))
 
#define ORIGFILE(p)   ((sqlite3_file*)(((ApndFile*)(p))+1))
 
#define SQLITEEXPERT_H   1
 
#define EXPERT_CONFIG_SAMPLE   1 /* int */
 
#define EXPERT_REPORT_SQL   1
 
#define EXPERT_REPORT_INDEXES   2
 
#define EXPERT_REPORT_PLAN   3
 
#define EXPERT_REPORT_CANDIDATES   4
 
#define STRLEN   (int)strlen
 
#define UNIQUE_TABLE_NAME   "t592690916721053953805701627921227776"
 
#define IDX_HASH_SIZE   1023
 
#define AUTOEQP_off   0 /* Automatic EXPLAIN QUERY PLAN is off */
 
#define AUTOEQP_on   1 /* Automatic EQP is on */
 
#define AUTOEQP_trigger   2 /* On and also show plans for triggers */
 
#define AUTOEQP_full   3 /* Show full EXPLAIN */
 
#define SHELL_OPEN_UNSPEC   0 /* No open-mode specified */
 
#define SHELL_OPEN_NORMAL   1 /* Normal database file */
 
#define SHELL_OPEN_APPENDVFS   2 /* Use appendvfs */
 
#define SHELL_OPEN_ZIPFILE   3 /* Use the zipfile virtual table */
 
#define SHELL_OPEN_READONLY   4 /* Open a normal database read-only */
 
#define SHELL_OPEN_DESERIALIZE   5 /* Open using sqlite3_deserialize() */
 
#define SHELL_OPEN_HEXDB   6 /* Use "dbtotxt" output as data source */
 
#define SHELL_TRACE_PLAIN   0 /* Show input SQL text */
 
#define SHELL_TRACE_EXPANDED   1 /* Show expanded SQL text */
 
#define SHELL_TRACE_NORMALIZED   2 /* Show normalized SQL text */
 
#define SHELL_PROGRESS_QUIET   0x01 /* Omit announcing every progress callback */
 
#define SHELL_PROGRESS_RESET
 
#define SHELL_PROGRESS_ONCE   0x04 /* Cancel the --limit after firing once */
 
#define SHFLG_Pagecache   0x00000001 /* The --pagecache option is used */
 
#define SHFLG_Lookaside   0x00000002 /* Lookaside memory is used */
 
#define SHFLG_Backslash   0x00000004 /* The --backslash option is used */
 
#define SHFLG_PreserveRowid   0x00000008 /* .dump preserves rowid values */
 
#define SHFLG_Newlines   0x00000010 /* .dump --newline flag */
 
#define SHFLG_CountChanges   0x00000020 /* .changes setting */
 
#define SHFLG_Echo   0x00000040 /* .echo or --echo setting */
 
#define ShellHasFlag(P, X)   (((P)->shellFlgs & (X))!=0)
 
#define ShellSetFlag(P, X)   ((P)->shellFlgs|=(X))
 
#define ShellClearFlag(P, X)   ((P)->shellFlgs&=(~(X)))
 
#define MODE_Line   0 /* One column per line. Blank line between records */
 
#define MODE_Column   1 /* One record per line in neat columns */
 
#define MODE_List   2 /* One record per line with a separator */
 
#define MODE_Semi   3 /* Same as MODE_List but append ";" to each line */
 
#define MODE_Html   4 /* Generate an XHTML table */
 
#define MODE_Insert   5 /* Generate SQL "insert" statements */
 
#define MODE_Quote   6 /* Quote values as for SQL */
 
#define MODE_Tcl   7 /* Generate ANSI-C or TCL quoted elements */
 
#define MODE_Csv   8 /* Quote strings, numbers are plain */
 
#define MODE_Explain   9 /* Like MODE_Column, but do not truncate data */
 
#define MODE_Ascii   10 /* Use ASCII unit and record separators (0x1F/0x1E) */
 
#define MODE_Pretty   11 /* Pretty-print schemas */
 
#define MODE_EQP   12 /* Converts EXPLAIN QUERY PLAN output into a graph */
 
#define SEP_Column   "|"
 
#define SEP_Row   "\n"
 
#define SEP_Tab   "\t"
 
#define SEP_Space   " "
 
#define SEP_Comma   ","
 
#define SEP_CrLf   "\r\n"
 
#define SEP_Unit   "\x1F"
 
#define SEP_Record   "\x1E"
 
#define session_close_all(X)
 
#define OPEN_DB_KEEPALIVE   0x001 /* Return after error if true */
 
#define OPEN_DB_ZIPFILE   0x002 /* Open as ZIP if name matches *.zip */
 
#define CTIMEOPT_VAL_(opt)   #opt
 
#define CTIMEOPT_VAL(opt)   CTIMEOPT_VAL_(opt)
 
#define SQLITE_SHELL_IS_UTF8   (1)
 

Typedefs

typedef sqlite3_int64 i64
 
typedef sqlite3_uint64 u64
 
typedef unsigned char u8
 
typedef struct ShellText ShellText
 
typedef struct SHA3Context SHA3Context
 
typedef struct fsdir_cursor fsdir_cursor
 
typedef struct FsdirLevel FsdirLevel
 
typedef struct fsdir_tab fsdir_tab
 
typedef struct completion_vtab completion_vtab
 
typedef struct completion_cursor completion_cursor
 
typedef struct sqlite3_vfs ApndVfs
 
typedef struct ApndFile ApndFile
 
typedef struct sqlite3expert sqlite3expert
 
typedef struct IdxColumn IdxColumn
 
typedef struct IdxConstraint IdxConstraint
 
typedef struct IdxScan IdxScan
 
typedef struct IdxStatement IdxStatement
 
typedef struct IdxTable IdxTable
 
typedef struct IdxWrite IdxWrite
 
typedef struct IdxHashEntry IdxHashEntry
 
typedef struct IdxHash IdxHash
 
typedef struct ExpertVtab ExpertVtab
 
typedef struct ExpertCsr ExpertCsr
 
typedef struct SavedModeInfo SavedModeInfo
 
typedef struct ExpertInfo ExpertInfo
 
typedef struct EQPGraphRow EQPGraphRow
 
typedef struct EQPGraph EQPGraph
 
typedef struct ShellState ShellState
 
typedef struct ImportCtx ImportCtx
 

Functions

int isatty (int)
 
FILE * popen (const char *, const char *)
 
int pclose (FILE *)
 
static sqlite3_int64 timeOfDay (void)
 
static void beginTimer (void)
 
static double timeDiff (struct timeval *pStart, struct timeval *pEnd)
 
static void endTimer (void)
 
static void shell_out_of_memory (void)
 
static void utf8_width_print (FILE *pOut, int w, const char *zUtf)
 
static int isNumber (const char *z, int *realnum)
 
static int strlen30 (const char *z)
 
static int strlenChar (const char *z)
 
static char * local_getline (char *zLine, FILE *in)
 
static char * one_input_line (FILE *in, char *zPrior, int isContinuation)
 
static int hexDigitValue (char c)
 
static sqlite3_int64 integerValue (const char *zArg)
 
static void initText (ShellText *p)
 
static void freeText (ShellText *p)
 
static void appendText (ShellText *p, char const *zAppend, char quote)
 
static char quoteChar (const char *zName)
 
static char * shellFakeSchema (sqlite3 *db, const char *zSchema, const char *zName)
 
static void shellModuleSchema (sqlite3_context *pCtx, int nVal, sqlite3_value **apVal)
 
static void shellAddSchemaName (sqlite3_context *pCtx, int nVal, sqlite3_value **apVal)
 
static void KeccakF1600Step (SHA3Context *p)
 
static void SHA3Init (SHA3Context *p, int iSize)
 
static void SHA3Update (SHA3Context *p, const unsigned char *aData, unsigned int nData)
 
static unsigned char * SHA3Final (SHA3Context *p)
 
static void sha3Func (sqlite3_context *context, int argc, sqlite3_value **argv)
 
static void hash_step_vformat (SHA3Context *p, const char *zFormat,...)
 
static void sha3QueryFunc (sqlite3_context *context, int argc, sqlite3_value **argv)
 
int sqlite3_shathree_init (sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi)
 
static void readFileContents (sqlite3_context *ctx, const char *zName)
 
static void readfileFunc (sqlite3_context *context, int argc, sqlite3_value **argv)
 
static void ctxErrorMsg (sqlite3_context *ctx, const char *zFmt,...)
 
static int fileStat (const char *zPath, struct stat *pStatBuf)
 
static int fileLinkStat (const char *zPath, struct stat *pStatBuf)
 
static int makeDirectory (const char *zFile)
 
static int writeFile (sqlite3_context *pCtx, const char *zFile, sqlite3_value *pData, mode_t mode, sqlite3_int64 mtime)
 
static void writefileFunc (sqlite3_context *context, int argc, sqlite3_value **argv)
 
static void lsModeFunc (sqlite3_context *context, int argc, sqlite3_value **argv)
 
static int fsdirConnect (sqlite3 *db, void *pAux, int argc, const char *const *argv, sqlite3_vtab **ppVtab, char **pzErr)
 
static int fsdirDisconnect (sqlite3_vtab *pVtab)
 
static int fsdirOpen (sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor)
 
static void fsdirResetCursor (fsdir_cursor *pCur)
 
static int fsdirClose (sqlite3_vtab_cursor *cur)
 
static void fsdirSetErrmsg (fsdir_cursor *pCur, const char *zFmt,...)
 
static int fsdirNext (sqlite3_vtab_cursor *cur)
 
static int fsdirColumn (sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i)
 
static int fsdirRowid (sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid)
 
static int fsdirEof (sqlite3_vtab_cursor *cur)
 
static int fsdirFilter (sqlite3_vtab_cursor *cur, int idxNum, const char *idxStr, int argc, sqlite3_value **argv)
 
static int fsdirBestIndex (sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo)
 
static int fsdirRegister (sqlite3 *db)
 
int sqlite3_fileio_init (sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi)
 
static int completionConnect (sqlite3 *db, void *pAux, int argc, const char *const *argv, sqlite3_vtab **ppVtab, char **pzErr)
 
static int completionDisconnect (sqlite3_vtab *pVtab)
 
static int completionOpen (sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor)
 
static void completionCursorReset (completion_cursor *pCur)
 
static int completionClose (sqlite3_vtab_cursor *cur)
 
static int completionNext (sqlite3_vtab_cursor *cur)
 
static int completionColumn (sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i)
 
static int completionRowid (sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid)
 
static int completionEof (sqlite3_vtab_cursor *cur)
 
static int completionFilter (sqlite3_vtab_cursor *pVtabCursor, int idxNum, const char *idxStr, int argc, sqlite3_value **argv)
 
static int completionBestIndex (sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo)
 
int sqlite3CompletionVtabInit (sqlite3 *db)
 
int sqlite3_completion_init (sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi)
 
static int apndClose (sqlite3_file *)
 
static int apndRead (sqlite3_file *, void *, int iAmt, sqlite3_int64 iOfst)
 
static int apndWrite (sqlite3_file *, const void *, int iAmt, sqlite3_int64 iOfst)
 
static int apndTruncate (sqlite3_file *, sqlite3_int64 size)
 
static int apndSync (sqlite3_file *, int flags)
 
static int apndFileSize (sqlite3_file *, sqlite3_int64 *pSize)
 
static int apndLock (sqlite3_file *, int)
 
static int apndUnlock (sqlite3_file *, int)
 
static int apndCheckReservedLock (sqlite3_file *, int *pResOut)
 
static int apndFileControl (sqlite3_file *, int op, void *pArg)
 
static int apndSectorSize (sqlite3_file *)
 
static int apndDeviceCharacteristics (sqlite3_file *)
 
static int apndShmMap (sqlite3_file *, int iPg, int pgsz, int, void volatile **)
 
static int apndShmLock (sqlite3_file *, int offset, int n, int flags)
 
static void apndShmBarrier (sqlite3_file *)
 
static int apndShmUnmap (sqlite3_file *, int deleteFlag)
 
static int apndFetch (sqlite3_file *, sqlite3_int64 iOfst, int iAmt, void **pp)
 
static int apndUnfetch (sqlite3_file *, sqlite3_int64 iOfst, void *p)
 
static int apndOpen (sqlite3_vfs *, const char *, sqlite3_file *, int, int *)
 
static int apndDelete (sqlite3_vfs *, const char *zName, int syncDir)
 
static int apndAccess (sqlite3_vfs *, const char *zName, int flags, int *)
 
static int apndFullPathname (sqlite3_vfs *, const char *zName, int, char *zOut)
 
static void * apndDlOpen (sqlite3_vfs *, const char *zFilename)
 
static void apndDlError (sqlite3_vfs *, int nByte, char *zErrMsg)
 
static void apndDlClose (sqlite3_vfs *, void *)
 
static int apndRandomness (sqlite3_vfs *, int nByte, char *zOut)
 
static int apndSleep (sqlite3_vfs *, int microseconds)
 
static int apndCurrentTime (sqlite3_vfs *, double *)
 
static int apndGetLastError (sqlite3_vfs *, int, char *)
 
static int apndCurrentTimeInt64 (sqlite3_vfs *, sqlite3_int64 *)
 
static int apndSetSystemCall (sqlite3_vfs *, const char *, sqlite3_syscall_ptr)
 
static sqlite3_syscall_ptr apndGetSystemCall (sqlite3_vfs *, const char *z)
 
static const char * apndNextSystemCall (sqlite3_vfs *, const char *zName)
 
static int apndWriteMark (ApndFile *p, sqlite3_file *pFile)
 
static int apndIsOrdinaryDatabaseFile (sqlite3_int64 sz, sqlite3_file *pFile)
 
static sqlite3_int64 apndReadMark (sqlite3_int64 sz, sqlite3_file *pFile)
 
int sqlite3_appendvfs_init (sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi)
 
static void * memtraceMalloc (int n)
 
static void memtraceFree (void *p)
 
static void * memtraceRealloc (void *p, int n)
 
static int memtraceSize (void *p)
 
static int memtraceRoundup (int n)
 
static int memtraceInit (void *p)
 
static void memtraceShutdown (void *p)
 
int sqlite3MemTraceActivate (FILE *out)
 
int sqlite3MemTraceDeactivate (void)
 
static int uintCollFunc (void *notUsed, int nKey1, const void *pKey1, int nKey2, const void *pKey2)
 
int sqlite3_uint_init (sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi)
 
sqlite3expertsqlite3_expert_new (sqlite3 *db, char **pzErr)
 
int sqlite3_expert_config (sqlite3expert *p, int op,...)
 
int sqlite3_expert_sql (sqlite3expert *p, const char *zSql, char **pzErr)
 
int sqlite3_expert_analyze (sqlite3expert *p, char **pzErr)
 
int sqlite3_expert_count (sqlite3expert *)
 
const char * sqlite3_expert_report (sqlite3expert *, int iStmt, int eReport)
 
void sqlite3_expert_destroy (sqlite3expert *)
 
static void * idxMalloc (int *pRc, int nByte)
 
static void idxHashInit (IdxHash *pHash)
 
static void idxHashClear (IdxHash *pHash)
 
static int idxHashString (const char *z, int n)
 
static int idxHashAdd (int *pRc, IdxHash *pHash, const char *zKey, const char *zVal)
 
static IdxHashEntryidxHashFind (IdxHash *pHash, const char *zKey, int nKey)
 
static const char * idxHashSearch (IdxHash *pHash, const char *zKey, int nKey)
 
static IdxConstraintidxNewConstraint (int *pRc, const char *zColl)
 
static void idxDatabaseError (sqlite3 *db, char **pzErrmsg)
 
static int idxPrepareStmt (sqlite3 *db, sqlite3_stmt **ppStmt, char **pzErrmsg, const char *zSql)
 
static int idxPrintfPrepareStmt (sqlite3 *db, sqlite3_stmt **ppStmt, char **pzErrmsg, const char *zFmt,...)
 
static char * expertDequote (const char *zIn)
 
static int expertConnect (sqlite3 *db, void *pAux, int argc, const char *const *argv, sqlite3_vtab **ppVtab, char **pzErr)
 
static int expertDisconnect (sqlite3_vtab *pVtab)
 
static int expertBestIndex (sqlite3_vtab *pVtab, sqlite3_index_info *pIdxInfo)
 
static int expertUpdate (sqlite3_vtab *pVtab, int nData, sqlite3_value **azData, sqlite_int64 *pRowid)
 
static int expertOpen (sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor)
 
static int expertClose (sqlite3_vtab_cursor *cur)
 
static int expertEof (sqlite3_vtab_cursor *cur)
 
static int expertNext (sqlite3_vtab_cursor *cur)
 
static int expertRowid (sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid)
 
static int expertColumn (sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i)
 
static int expertFilter (sqlite3_vtab_cursor *cur, int idxNum, const char *idxStr, int argc, sqlite3_value **argv)
 
static int idxRegisterVtab (sqlite3expert *p)
 
static void idxFinalize (int *pRc, sqlite3_stmt *pStmt)
 
static int idxGetTableInfo (sqlite3 *db, const char *zTab, IdxTable **ppOut, char **pzErrmsg)
 
static char * idxAppendText (int *pRc, char *zIn, const char *zFmt,...)
 
static int idxIdentifierRequiresQuotes (const char *zId)
 
static char * idxAppendColDefn (int *pRc, char *zIn, IdxTable *pTab, IdxConstraint *pCons)
 
static int idxFindCompatible (int *pRc, sqlite3 *dbm, IdxScan *pScan, IdxConstraint *pEq, IdxConstraint *pTail)
 
static int idxCreateFromCons (sqlite3expert *p, IdxScan *pScan, IdxConstraint *pEq, IdxConstraint *pTail)
 
static int idxFindConstraint (IdxConstraint *pList, IdxConstraint *p)
 
static int idxCreateFromWhere (sqlite3expert *p, IdxScan *pScan, IdxConstraint *pTail)
 
static int idxCreateCandidates (sqlite3expert *p)
 
static void idxConstraintFree (IdxConstraint *pConstraint)
 
static void idxScanFree (IdxScan *pScan, IdxScan *pLast)
 
static void idxStatementFree (IdxStatement *pStatement, IdxStatement *pLast)
 
static void idxTableFree (IdxTable *pTab)
 
static void idxWriteFree (IdxWrite *pTab)
 
int idxFindIndexes (sqlite3expert *p, char **pzErr)
 
static int idxAuthCallback (void *pCtx, int eOp, const char *z3, const char *z4, const char *zDb, const char *zTrigger)
 
static int idxProcessOneTrigger (sqlite3expert *p, IdxWrite *pWrite, char **pzErr)
 
static int idxProcessTriggers (sqlite3expert *p, char **pzErr)
 
static int idxCreateVtabSchema (sqlite3expert *p, char **pzErrmsg)
 
static void idxSampleFunc (sqlite3_context *pCtx, int argc, sqlite3_value **argv)
 
static void idxRemFunc (sqlite3_context *pCtx, int argc, sqlite3_value **argv)
 
static int idxLargestIndex (sqlite3 *db, int *pnMax, char **pzErr)
 
static int idxPopulateOneStat1 (sqlite3expert *p, sqlite3_stmt *pIndexXInfo, sqlite3_stmt *pWriteStat, const char *zTab, const char *zIdx, char **pzErr)
 
static int idxBuildSampleTable (sqlite3expert *p, const char *zTab)
 
static int idxPopulateStat1 (sqlite3expert *p, char **pzErr)
 
static void shellLog (void *pArg, int iErrCode, const char *zMsg)
 
static void shellPutsFunc (sqlite3_context *pCtx, int nVal, sqlite3_value **apVal)
 
static void editFunc (sqlite3_context *context, int argc, sqlite3_value **argv)
 
static void outputModePush (ShellState *p)
 
static void outputModePop (ShellState *p)
 
static void output_hex_blob (FILE *out, const void *pBlob, int nBlob)
 
static const char * unused_string (const char *z, const char *zA, const char *zB, char *zBuf)
 
static void output_quoted_string (FILE *out, const char *z)
 
static void output_quoted_escaped_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 (ShellState *p, const char *z, int bSep)
 
static void interrupt_handler (int NotUsed)
 
static int shellAuth (void *pClientData, int op, const char *zA1, const char *zA2, const char *zA3, const char *zA4)
 
static void printSchemaLine (FILE *out, const char *z, const char *zTail)
 
static void printSchemaLineN (FILE *out, char *z, int n, const char *zTail)
 
static int wsToEol (const char *z)
 
static void eqp_append (ShellState *p, int iEqpId, int p2, const char *zText)
 
static void eqp_reset (ShellState *p)
 
static EQPGraphRoweqp_next_row (ShellState *p, int iEqpId, EQPGraphRow *pOld)
 
static void eqp_render_level (ShellState *p, int iEqpId)
 
static void eqp_render (ShellState *p)
 
static int progress_handler (void *pClientData)
 
static int shell_callback (void *pArg, int nArg, char **azArg, char **azCol, int *aiType)
 
static int callback (void *pArg, int nArg, char **azArg, char **azCol)
 
static int captureOutputCallback (void *pArg, int nArg, char **azArg, char **az)
 
static void createSelftestTable (ShellState *p)
 
static void set_table_name (ShellState *p, const char *zName)
 
static int run_table_dump_query (ShellState *p, const char *zSelect)
 
static char * save_err_msg (sqlite3 *db)
 
static void displayStatLine (ShellState *p, char *zLabel, char *zFormat, int iStatusCtrl, int bReset)
 
static int display_stats (sqlite3 *db, ShellState *pArg, int bReset)
 
static void display_scanstats (sqlite3 *db, ShellState *pArg)
 
static int str_in_array (const char *zStr, const char **azArray)
 
static void explain_data_prepare (ShellState *p, sqlite3_stmt *pSql)
 
static void explain_data_delete (ShellState *p)
 
static void disable_debug_trace_modes (void)
 
static void restore_debug_trace_modes (void)
 
static void bind_table_init (ShellState *p)
 
static void bind_prepared_stmt (ShellState *pArg, sqlite3_stmt *pStmt)
 
static void exec_prepared_stmt (ShellState *pArg, sqlite3_stmt *pStmt)
 
static int expertHandleSQL (ShellState *pState, const char *zSql, char **pzErr)
 
static int expertFinish (ShellState *pState, int bCancel, char **pzErr)
 
static int expertDotCommand (ShellState *pState, char **azArg, int nArg)
 
static int shell_exec (ShellState *pArg, const char *zSql, char **pzErrMsg)
 
static void freeColumnList (char **azCol)
 
static char ** tableColumnList (ShellState *p, const char *zTab)
 
static void toggleSelectOrder (sqlite3 *db)
 
static int dump_callback (void *pArg, int nArg, char **azArg, char **azNotUsed)
 
static int run_schema_dump_query (ShellState *p, const char *zQuery)
 
static int showHelp (FILE *out, const char *zPattern)
 
static int process_input (ShellState *p)
 
static char * readFile (const char *zName, int *pnByte)
 
int deduceDatabaseType (const char *zName, int dfltZip)
 
static void shellInt32 (sqlite3_context *context, int argc, sqlite3_value **argv)
 
static void shellIdQuote (sqlite3_context *context, int argc, sqlite3_value **argv)
 
static void shellEscapeCrnl (sqlite3_context *context, int argc, sqlite3_value **argv)
 
static void open_db (ShellState *p, int openFlags)
 
void close_db (sqlite3 *db)
 
static void resolve_backslashes (char *z)
 
static int booleanValue (const char *zArg)
 
static void setOrClearFlag (ShellState *p, unsigned mFlag, const char *zArg)
 
static void output_file_close (FILE *f)
 
static FILE * output_file_open (const char *zFile, int bTextMode)
 
static int sql_trace_callback (unsigned mType, void *pArg, void *pP, void *pX)
 
static void test_breakpoint (void)
 
static void import_append_char (ImportCtx *p, int c)
 
static char * csv_read_one_field (ImportCtx *p)
 
static char * ascii_read_one_field (ImportCtx *p)
 
static void tryToCloneData (ShellState *p, sqlite3 *newDb, const char *zTable)
 
static void tryToCloneSchema (ShellState *p, sqlite3 *newDb, const char *zWhere, void(*xForEach)(ShellState *, sqlite3 *, const char *))
 
static void tryToClone (ShellState *p, const char *zNewDb)
 
static void output_reset (ShellState *p)
 
static int db_int (ShellState *p, const char *zSql)
 
static unsigned int get2byteInt (unsigned char *a)
 
static unsigned int get4byteInt (unsigned char *a)
 
static int shell_dbinfo_command (ShellState *p, int nArg, char **azArg)
 
static int shellDatabaseError (sqlite3 *db)
 
static int testcase_glob (const char *zGlob, const char *z)
 
static int optionMatch (const char *zStr, const char *zOpt)
 
int shellDeleteFile (const char *zFilename)
 
static void clearTempFile (ShellState *p)
 
static void newTempFile (ShellState *p, const char *zSuffix)
 
static void shellFkeyCollateClause (sqlite3_context *pCtx, int nVal, sqlite3_value **apVal)
 
static int lintFkeyIndexes (ShellState *pState, char **azArg, int nArg)
 
static int lintDotCommand (ShellState *pState, char **azArg, int nArg)
 
static void shellPrepare (sqlite3 *db, int *pRc, const char *zSql, sqlite3_stmt **ppStmt)
 
void shellPreparePrintf (sqlite3 *db, int *pRc, sqlite3_stmt **ppStmt, const char *zFmt,...)
 
void shellFinalize (int *pRc, sqlite3_stmt *pStmt)
 
void shellReset (int *pRc, sqlite3_stmt *pStmt)
 
static int do_meta_command (char *zLine, ShellState *p)
 
static int line_contains_semicolon (const char *z, int N)
 
static int _all_whitespace (const char *z)
 
static int line_is_command_terminator (const char *zLine)
 
static int line_is_complete (char *zSql, int nSql)
 
static int runOneSqlLine (ShellState *p, char *zSql, FILE *in, int startline)
 
static char * find_home_dir (int clearFlag)
 
static void process_sqliterc (ShellState *p, const char *sqliterc_override)
 
static void usage (int showDetail)
 
static void verify_uninitialized (void)
 
static void main_init (ShellState *data)
 
static void printBold (const char *zText)
 
static char * cmdline_option_value (int argc, char **argv, int i)
 
int main (int argc, char **argv)
 

Variables

static int enableTimer = 0
 
static struct rusage sBegin
 
static sqlite3_int64 iBegin
 
static int bail_on_error = 0
 
static int stdin_is_interactive = 1
 
static int stdout_is_console = 1
 
static sqlite3globalDb = 0
 
static volatile int seenInterrupt = 0
 
static char * Argv0
 
static char mainPrompt [20]
 
static char continuePrompt [20]
 
static sqlite3_module completionModule
 
static void(*)(void) apndDlSym (sqlite3_vfs *pVfs, void *p, const char *zSym)
 
static sqlite3_vfs apnd_vfs
 
static const sqlite3_io_methods apnd_io_methods
 
static sqlite3_mem_methods memtraceBase
 
static FILE * memtraceOut
 
static sqlite3_mem_methods ersaztMethods
 
static const char * modeDescr []
 
static const char needCsvQuote []
 
static const char * azHelp []
 
static const char zOptions []
 

Macro Definition Documentation

◆ _FILE_OFFSET_BITS

#define _FILE_OFFSET_BITS   64

Definition at line 80 of file shell.c.

◆ _LARGE_FILE

#define _LARGE_FILE   1

Definition at line 78 of file shell.c.

◆ _LARGEFILE_SOURCE

#define _LARGEFILE_SOURCE   1

Definition at line 82 of file shell.c.

◆ a00

#define a00   (p->u.s[0])

◆ a01

#define a01   (p->u.s[1])

◆ a02

#define a02   (p->u.s[2])

◆ a03

#define a03   (p->u.s[3])

◆ a04

#define a04   (p->u.s[4])

◆ a10

#define a10   (p->u.s[5])

◆ a11

#define a11   (p->u.s[6])

◆ a12

#define a12   (p->u.s[7])

◆ a13

#define a13   (p->u.s[8])

◆ a14

#define a14   (p->u.s[9])

◆ a20

#define a20   (p->u.s[10])

◆ a21

#define a21   (p->u.s[11])

◆ a22

#define a22   (p->u.s[12])

◆ a23

#define a23   (p->u.s[13])

◆ a24

#define a24   (p->u.s[14])

◆ a30

#define a30   (p->u.s[15])

◆ a31

#define a31   (p->u.s[16])

◆ a32

#define a32   (p->u.s[17])

◆ a33

#define a33   (p->u.s[18])

◆ a34

#define a34   (p->u.s[19])

◆ a40

#define a40   (p->u.s[20])

◆ a41

#define a41   (p->u.s[21])

◆ a42

#define a42   (p->u.s[22])

◆ a43

#define a43   (p->u.s[23])

◆ a44

#define a44   (p->u.s[24])

◆ APND_MARK_PREFIX

#define APND_MARK_PREFIX   "Start-Of-SQLite3-"

Definition at line 3671 of file shell.c.

◆ APND_MARK_PREFIX_SZ

#define APND_MARK_PREFIX_SZ   17

Definition at line 3672 of file shell.c.

◆ APND_MARK_SIZE

#define APND_MARK_SIZE   25

Definition at line 3673 of file shell.c.

◆ APND_MAX_SIZE

#define APND_MAX_SIZE   (65536*15259)

Definition at line 3679 of file shell.c.

◆ ArraySize

#define ArraySize (   X)    (int)(sizeof(X)/sizeof(X[0]))

Definition at line 402 of file shell.c.

◆ AUTOEQP_full

#define AUTOEQP_full   3 /* Show full EXPLAIN */

Definition at line 9813 of file shell.c.

◆ AUTOEQP_off

#define AUTOEQP_off   0 /* Automatic EXPLAIN QUERY PLAN is off */

Definition at line 9810 of file shell.c.

◆ AUTOEQP_on

#define AUTOEQP_on   1 /* Automatic EQP is on */

Definition at line 9811 of file shell.c.

◆ AUTOEQP_trigger

#define AUTOEQP_trigger   2 /* On and also show plans for triggers */

Definition at line 9812 of file shell.c.

◆ BEGIN_TIMER

#define BEGIN_TIMER   beginTimer()

Definition at line 305 of file shell.c.

◆ COMPLETION_COLLATIONS

#define COMPLETION_COLLATIONS   4

Definition at line 3182 of file shell.c.

◆ COMPLETION_COLUMN_CANDIDATE

#define COMPLETION_COLUMN_CANDIDATE   0 /* Suggested completion of the input */

◆ COMPLETION_COLUMN_PHASE

#define COMPLETION_COLUMN_PHASE   3 /* ePhase - used for debugging only */

◆ COMPLETION_COLUMN_PREFIX

#define COMPLETION_COLUMN_PREFIX   1 /* Prefix of the word to be completed */

◆ COMPLETION_COLUMN_WHOLELINE

#define COMPLETION_COLUMN_WHOLELINE   2 /* Entire line seen so far */

◆ COMPLETION_COLUMNS

#define COMPLETION_COLUMNS   9

Definition at line 3187 of file shell.c.

◆ COMPLETION_DATABASES

#define COMPLETION_DATABASES   7

Definition at line 3185 of file shell.c.

◆ COMPLETION_EOF

#define COMPLETION_EOF   11

Definition at line 3189 of file shell.c.

◆ COMPLETION_FIRST_PHASE

#define COMPLETION_FIRST_PHASE   1

Definition at line 3178 of file shell.c.

◆ COMPLETION_FUNCTIONS

#define COMPLETION_FUNCTIONS   3

Definition at line 3181 of file shell.c.

◆ COMPLETION_INDEXES

#define COMPLETION_INDEXES   5

Definition at line 3183 of file shell.c.

◆ COMPLETION_KEYWORDS

#define COMPLETION_KEYWORDS   1

Definition at line 3179 of file shell.c.

◆ COMPLETION_MODULES

#define COMPLETION_MODULES   10

Definition at line 3188 of file shell.c.

◆ COMPLETION_PRAGMAS

#define COMPLETION_PRAGMAS   2

Definition at line 3180 of file shell.c.

◆ COMPLETION_TABLES

#define COMPLETION_TABLES   8 /* Also VIEWs and TRIGGERs */

Definition at line 3186 of file shell.c.

◆ COMPLETION_TRIGGERS

#define COMPLETION_TRIGGERS   6

Definition at line 3184 of file shell.c.

◆ CTIMEOPT_VAL

#define CTIMEOPT_VAL (   opt)    CTIMEOPT_VAL_(opt)

◆ CTIMEOPT_VAL_

#define CTIMEOPT_VAL_ (   opt)    #opt

◆ END_TIMER

#define END_TIMER   endTimer()

Definition at line 306 of file shell.c.

◆ EXPERT_CONFIG_SAMPLE

#define EXPERT_CONFIG_SAMPLE   1 /* int */

Definition at line 6762 of file shell.c.

◆ EXPERT_REPORT_CANDIDATES

#define EXPERT_REPORT_CANDIDATES   4

Definition at line 6861 of file shell.c.

◆ EXPERT_REPORT_INDEXES

#define EXPERT_REPORT_INDEXES   2

Definition at line 6859 of file shell.c.

◆ EXPERT_REPORT_PLAN

#define EXPERT_REPORT_PLAN   3

Definition at line 6860 of file shell.c.

◆ EXPERT_REPORT_SQL

#define EXPERT_REPORT_SQL   1

Definition at line 6858 of file shell.c.

◆ FSDIR_COLUMN_DATA

#define FSDIR_COLUMN_DATA   3 /* File content */

Definition at line 2218 of file shell.c.

◆ FSDIR_COLUMN_DIR

#define FSDIR_COLUMN_DIR   5 /* Path is relative to this directory */

Definition at line 2220 of file shell.c.

◆ FSDIR_COLUMN_MODE

#define FSDIR_COLUMN_MODE   1 /* Access mode */

Definition at line 2216 of file shell.c.

◆ FSDIR_COLUMN_MTIME

#define FSDIR_COLUMN_MTIME   2 /* Last modification time */

Definition at line 2217 of file shell.c.

◆ FSDIR_COLUMN_NAME

#define FSDIR_COLUMN_NAME   0 /* Name of the file */

Definition at line 2215 of file shell.c.

◆ FSDIR_COLUMN_PATH

#define FSDIR_COLUMN_PATH   4 /* Path to top of search */

Definition at line 2219 of file shell.c.

◆ FSDIR_SCHEMA

#define FSDIR_SCHEMA   "(name,mode,mtime,data,path HIDDEN,dir HIDDEN)"

Definition at line 2214 of file shell.c.

◆ GETPID

#define GETPID   getpid

Definition at line 108 of file shell.c.

◆ HAS_TIMER

#define HAS_TIMER   1

Definition at line 307 of file shell.c.

◆ IDX_HASH_SIZE

#define IDX_HASH_SIZE   1023

Definition at line 6992 of file shell.c.

◆ IsDigit

#define IsDigit (   X)    isdigit((unsigned char)X)

Definition at line 202 of file shell.c.

◆ IsSpace

#define IsSpace (   X)    isspace((unsigned char)X)

Definition at line 201 of file shell.c.

◆ MODE_Ascii

#define MODE_Ascii   10 /* Use ASCII unit and record separators (0x1F/0x1E) */

Definition at line 9867 of file shell.c.

◆ MODE_Column

#define MODE_Column   1 /* One record per line in neat columns */

Definition at line 9858 of file shell.c.

◆ MODE_Csv

#define MODE_Csv   8 /* Quote strings, numbers are plain */

Definition at line 9865 of file shell.c.

◆ MODE_EQP

#define MODE_EQP   12 /* Converts EXPLAIN QUERY PLAN output into a graph */

Definition at line 9869 of file shell.c.

◆ MODE_Explain

#define MODE_Explain   9 /* Like MODE_Column, but do not truncate data */

Definition at line 9866 of file shell.c.

◆ MODE_Html

#define MODE_Html   4 /* Generate an XHTML table */

Definition at line 9861 of file shell.c.

◆ MODE_Insert

#define MODE_Insert   5 /* Generate SQL "insert" statements */

Definition at line 9862 of file shell.c.

◆ MODE_Line

#define MODE_Line   0 /* One column per line. Blank line between records */

Definition at line 9857 of file shell.c.

◆ MODE_List

#define MODE_List   2 /* One record per line with a separator */

Definition at line 9859 of file shell.c.

◆ MODE_Pretty

#define MODE_Pretty   11 /* Pretty-print schemas */

Definition at line 9868 of file shell.c.

◆ MODE_Quote

#define MODE_Quote   6 /* Quote values as for SQL */

Definition at line 9863 of file shell.c.

◆ MODE_Semi

#define MODE_Semi   3 /* Same as MODE_List but append ";" to each line */

Definition at line 9860 of file shell.c.

◆ MODE_Tcl

#define MODE_Tcl   7 /* Generate ANSI-C or TCL quoted elements */

Definition at line 9864 of file shell.c.

◆ OPEN_DB_KEEPALIVE

#define OPEN_DB_KEEPALIVE   0x001 /* Return after error if true */

Definition at line 12872 of file shell.c.

◆ OPEN_DB_ZIPFILE

#define OPEN_DB_ZIPFILE   0x002 /* Open as ZIP if name matches *.zip */

Definition at line 12873 of file shell.c.

◆ ORIGFILE

#define ORIGFILE (   p)    ((sqlite3_file*)(((ApndFile*)(p))+1))

Definition at line 3691 of file shell.c.

◆ ORIGVFS

#define ORIGVFS (   p)    ((sqlite3_vfs*)((p)->pAppData))

Definition at line 3690 of file shell.c.

◆ raw_printf

#define raw_printf   fprintf

Definition at line 486 of file shell.c.

◆ ROL64

#define ROL64 (   a,
 
)    ((a<<x)|(a>>(64-x)))

◆ SEP_Column

#define SEP_Column   "|"

Definition at line 9891 of file shell.c.

◆ SEP_Comma

#define SEP_Comma   ","

Definition at line 9895 of file shell.c.

◆ SEP_CrLf

#define SEP_CrLf   "\r\n"

Definition at line 9896 of file shell.c.

◆ SEP_Record

#define SEP_Record   "\x1E"

Definition at line 9898 of file shell.c.

◆ SEP_Row

#define SEP_Row   "\n"

Definition at line 9892 of file shell.c.

◆ SEP_Space

#define SEP_Space   " "

Definition at line 9894 of file shell.c.

◆ SEP_Tab

#define SEP_Tab   "\t"

Definition at line 9893 of file shell.c.

◆ SEP_Unit

#define SEP_Unit   "\x1F"

Definition at line 9897 of file shell.c.

◆ session_close_all

#define session_close_all (   X)

Definition at line 12571 of file shell.c.

◆ setBinaryMode

#define setBinaryMode (   X,
 
)

Definition at line 234 of file shell.c.

◆ setTextMode

#define setTextMode (   X,
 
)

Definition at line 235 of file shell.c.

◆ SHA3_BYTEORDER

#define SHA3_BYTEORDER   0

Definition at line 1437 of file shell.c.

◆ SHELL_OPEN_APPENDVFS

#define SHELL_OPEN_APPENDVFS   2 /* Use appendvfs */

Definition at line 9819 of file shell.c.

◆ SHELL_OPEN_DESERIALIZE

#define SHELL_OPEN_DESERIALIZE   5 /* Open using sqlite3_deserialize() */

Definition at line 9822 of file shell.c.

◆ SHELL_OPEN_HEXDB

#define SHELL_OPEN_HEXDB   6 /* Use "dbtotxt" output as data source */

Definition at line 9823 of file shell.c.

◆ SHELL_OPEN_NORMAL

#define SHELL_OPEN_NORMAL   1 /* Normal database file */

Definition at line 9818 of file shell.c.

◆ SHELL_OPEN_READONLY

#define SHELL_OPEN_READONLY   4 /* Open a normal database read-only */

Definition at line 9821 of file shell.c.

◆ SHELL_OPEN_UNSPEC

#define SHELL_OPEN_UNSPEC   0 /* No open-mode specified */

Definition at line 9817 of file shell.c.

◆ SHELL_OPEN_ZIPFILE

#define SHELL_OPEN_ZIPFILE   3 /* Use the zipfile virtual table */

Definition at line 9820 of file shell.c.

◆ SHELL_PROGRESS_ONCE

#define SHELL_PROGRESS_ONCE   0x04 /* Cancel the --limit after firing once */

Definition at line 9834 of file shell.c.

◆ SHELL_PROGRESS_QUIET

#define SHELL_PROGRESS_QUIET   0x01 /* Omit announcing every progress callback */

Definition at line 9832 of file shell.c.

◆ SHELL_PROGRESS_RESET

#define SHELL_PROGRESS_RESET
Value:
0x02 /* Reset the count when the progres
** callback limit is reached, and for each
** top-level SQL statement */

Definition at line 9833 of file shell.c.

◆ shell_read_history

#define shell_read_history (   X)

Definition at line 149 of file shell.c.

◆ shell_stifle_history

#define shell_stifle_history (   X)

Definition at line 151 of file shell.c.

◆ SHELL_TRACE_EXPANDED

#define SHELL_TRACE_EXPANDED   1 /* Show expanded SQL text */

Definition at line 9828 of file shell.c.

◆ SHELL_TRACE_NORMALIZED

#define SHELL_TRACE_NORMALIZED   2 /* Show normalized SQL text */

Definition at line 9829 of file shell.c.

◆ SHELL_TRACE_PLAIN

#define SHELL_TRACE_PLAIN   0 /* Show input SQL text */

Definition at line 9827 of file shell.c.

◆ SHELL_USE_LOCAL_GETLINE

#define SHELL_USE_LOCAL_GETLINE   1

Definition at line 153 of file shell.c.

◆ shell_write_history

#define shell_write_history (   X)

Definition at line 150 of file shell.c.

◆ ShellClearFlag

#define ShellClearFlag (   P,
  X 
)    ((P)->shellFlgs&=(~(X)))

Definition at line 9852 of file shell.c.

◆ ShellHasFlag

#define ShellHasFlag (   P,
  X 
)    (((P)->shellFlgs & (X))!=0)

Definition at line 9850 of file shell.c.

◆ ShellSetFlag

#define ShellSetFlag (   P,
  X 
)    ((P)->shellFlgs|=(X))

Definition at line 9851 of file shell.c.

◆ SHFLG_Backslash

#define SHFLG_Backslash   0x00000004 /* The --backslash option is used */

Definition at line 9841 of file shell.c.

◆ SHFLG_CountChanges

#define SHFLG_CountChanges   0x00000020 /* .changes setting */

Definition at line 9844 of file shell.c.

◆ SHFLG_Echo

#define SHFLG_Echo   0x00000040 /* .echo or --echo setting */

Definition at line 9845 of file shell.c.

◆ SHFLG_Lookaside

#define SHFLG_Lookaside   0x00000002 /* Lookaside memory is used */

Definition at line 9840 of file shell.c.

◆ SHFLG_Newlines

#define SHFLG_Newlines   0x00000010 /* .dump --newline flag */

Definition at line 9843 of file shell.c.

◆ SHFLG_Pagecache

#define SHFLG_Pagecache   0x00000001 /* The --pagecache option is used */

Definition at line 9839 of file shell.c.

◆ SHFLG_PreserveRowid

#define SHFLG_PreserveRowid   0x00000008 /* .dump preserves rowid values */

Definition at line 9842 of file shell.c.

◆ SQLITE_EXTENSION_INIT1

#define SQLITE_EXTENSION_INIT1

Definition at line 1018 of file shell.c.

◆ SQLITE_EXTENSION_INIT2

#define SQLITE_EXTENSION_INIT2 (   X)    (void)(X)

Definition at line 1019 of file shell.c.

◆ SQLITE_OS_WINRT

#define SQLITE_OS_WINRT   0

Definition at line 43 of file shell.c.

◆ SQLITE_SHELL_IS_UTF8

#define SQLITE_SHELL_IS_UTF8   (1)

Definition at line 19019 of file shell.c.

◆ SQLITEEXPERT_H

#define SQLITEEXPERT_H   1

Definition at line 6716 of file shell.c.

◆ STRLEN

#define STRLEN   (int)strlen

Definition at line 6903 of file shell.c.

◆ ToLower

#define ToLower (   X)    (char)tolower((unsigned char)X)

Definition at line 203 of file shell.c.

◆ UNIQUE_TABLE_NAME

#define UNIQUE_TABLE_NAME   "t592690916721053953805701627921227776"

Definition at line 6910 of file shell.c.

◆ UNUSED_PARAMETER

#define UNUSED_PARAMETER (   x)    (void)(x)

Definition at line 397 of file shell.c.

◆ utf8_printf

#define utf8_printf   fprintf

Definition at line 478 of file shell.c.

Typedef Documentation

◆ ApndFile

typedef struct ApndFile ApndFile

Definition at line 3593 of file shell.c.

◆ ApndVfs

typedef struct sqlite3_vfs ApndVfs

Definition at line 3593 of file shell.c.

◆ completion_cursor

Definition at line 3077 of file shell.c.

◆ completion_vtab

Definition at line 3077 of file shell.c.

◆ EQPGraph

typedef struct EQPGraph EQPGraph

Definition at line 8817 of file shell.c.

◆ EQPGraphRow

typedef struct EQPGraphRow EQPGraphRow

Definition at line 8817 of file shell.c.

◆ ExpertCsr

typedef struct ExpertCsr ExpertCsr

Definition at line 7197 of file shell.c.

◆ ExpertInfo

typedef struct ExpertInfo ExpertInfo

Definition at line 8817 of file shell.c.

◆ ExpertVtab

typedef struct ExpertVtab ExpertVtab

Definition at line 7197 of file shell.c.

◆ fsdir_cursor

typedef struct fsdir_cursor fsdir_cursor

Definition at line 2608 of file shell.c.

◆ fsdir_tab

typedef struct fsdir_tab fsdir_tab

Definition at line 2608 of file shell.c.

◆ FsdirLevel

typedef struct FsdirLevel FsdirLevel

Definition at line 2608 of file shell.c.

◆ i64

typedef sqlite3_int64 i64

Definition at line 90 of file shell.c.

◆ IdxColumn

typedef struct IdxColumn IdxColumn

Definition at line 6868 of file shell.c.

◆ IdxConstraint

typedef struct IdxConstraint IdxConstraint

Definition at line 6868 of file shell.c.

◆ IdxHash

typedef struct IdxHash IdxHash

Definition at line 6868 of file shell.c.

◆ IdxHashEntry

typedef struct IdxHashEntry IdxHashEntry

Definition at line 6868 of file shell.c.

◆ IdxScan

typedef struct IdxScan IdxScan

Definition at line 6868 of file shell.c.

◆ IdxStatement

typedef struct IdxStatement IdxStatement

Definition at line 6868 of file shell.c.

◆ IdxTable

typedef struct IdxTable IdxTable

Definition at line 6868 of file shell.c.

◆ IdxWrite

typedef struct IdxWrite IdxWrite

Definition at line 6868 of file shell.c.

◆ ImportCtx

typedef struct ImportCtx ImportCtx

Definition at line 13253 of file shell.c.

◆ SavedModeInfo

typedef struct SavedModeInfo SavedModeInfo

Definition at line 8817 of file shell.c.

◆ SHA3Context

typedef struct SHA3Context SHA3Context

Definition at line 958 of file shell.c.

◆ ShellState

typedef struct ShellState ShellState

Definition at line 8817 of file shell.c.

◆ ShellText

typedef struct ShellText ShellText

Definition at line 747 of file shell.c.

◆ sqlite3expert

typedef struct sqlite3expert sqlite3expert

Definition at line 4371 of file shell.c.

◆ u64

Definition at line 91 of file shell.c.

◆ u8

typedef unsigned char u8

Definition at line 92 of file shell.c.

Function Documentation

◆ _all_whitespace()

static int _all_whitespace ( const char *  z)
static

Definition at line 18576 of file shell.c.

References IsSpace.

Referenced by line_is_command_terminator(), and process_input().

◆ apndAccess()

static int apndAccess ( sqlite3_vfs pVfs,
const char *  zName,
int  flags,
int *  pResOut 
)
static

Definition at line 4083 of file shell.c.

References ORIGVFS.

◆ apndCheckReservedLock()

static int apndCheckReservedLock ( sqlite3_file pFile,
int *  pResOut 
)
static

◆ apndClose()

static int apndClose ( sqlite3_file pFile)
static

Definition at line 3794 of file shell.c.

References ORIGFILE, sqlite3_file::pMethods, and sqlite3_io_methods::xClose.

◆ apndCurrentTime()

static int apndCurrentTime ( sqlite3_vfs pVfs,
double *  pTimeOut 
)
static

Definition at line 4117 of file shell.c.

References ORIGVFS.

◆ apndCurrentTimeInt64()

static int apndCurrentTimeInt64 ( sqlite3_vfs pVfs,
sqlite3_int64 p 
)
static

Definition at line 4123 of file shell.c.

References ORIGVFS.

◆ apndDelete()

static int apndDelete ( sqlite3_vfs pVfs,
const char *  zName,
int  syncDir 
)
static

Definition at line 4080 of file shell.c.

References ORIGVFS.

◆ apndDeviceCharacteristics()

static int apndDeviceCharacteristics ( sqlite3_file pFile)
static

◆ apndDlClose()

static void apndDlClose ( sqlite3_vfs pVfs,
void *  pHandle 
)
static

Definition at line 4108 of file shell.c.

References ORIGVFS.

◆ apndDlError()

static void apndDlError ( sqlite3_vfs pVfs,
int  nByte,
char *  zErrMsg 
)
static

Definition at line 4102 of file shell.c.

References ORIGVFS.

◆ apndDlOpen()

static void * apndDlOpen ( sqlite3_vfs pVfs,
const char *  zFilename 
)
static

Definition at line 4099 of file shell.c.

References ORIGVFS.

◆ apndFetch()

static int apndFetch ( sqlite3_file pFile,
sqlite3_int64  iOfst,
int  iAmt,
void **  pp 
)
static

◆ apndFileControl()

static int apndFileControl ( sqlite3_file pFile,
int  op,
void *  pArg 
)
static

◆ apndFileSize()

static int apndFileSize ( sqlite3_file pFile,
sqlite3_int64 pSize 
)
static

◆ apndFullPathname()

static int apndFullPathname ( sqlite3_vfs pVfs,
const char *  zName,
int  nOut,
char *  zOut 
)
static

Definition at line 4091 of file shell.c.

References ORIGVFS.

◆ apndGetLastError()

static int apndGetLastError ( sqlite3_vfs pVfs,
int  a,
char *  b 
)
static

Definition at line 4120 of file shell.c.

References ORIGVFS.

◆ apndGetSystemCall()

static sqlite3_syscall_ptr apndGetSystemCall ( sqlite3_vfs pVfs,
const char *  z 
)
static

Definition at line 4133 of file shell.c.

References ORIGVFS, and zName.

◆ apndIsOrdinaryDatabaseFile()

static int apndIsOrdinaryDatabaseFile ( sqlite3_int64  sz,
sqlite3_file pFile 
)
static

Definition at line 3997 of file shell.c.

References sqlite3_file::pMethods, and sqlite3_io_methods::xRead.

Referenced by apndOpen().

◆ apndLock()

static int apndLock ( sqlite3_file pFile,
int  eLock 
)
static

Definition at line 3894 of file shell.c.

References ORIGFILE, sqlite3_file::pMethods, and sqlite3_io_methods::xLock.

◆ apndNextSystemCall()

static const char * apndNextSystemCall ( sqlite3_vfs pVfs,
const char *  zName 
)
static

Definition at line 4139 of file shell.c.

References ORIGVFS, and zName.

◆ apndOpen()

◆ apndRandomness()

static int apndRandomness ( sqlite3_vfs pVfs,
int  nByte,
char *  zOut 
)
static

Definition at line 4111 of file shell.c.

References ORIGVFS.

◆ apndRead()

static int apndRead ( sqlite3_file pFile,
void *  zBuf,
int  iAmt,
sqlite3_int64  iOfst 
)
static

◆ apndReadMark()

static sqlite3_int64 apndReadMark ( sqlite3_int64  sz,
sqlite3_file pFile 
)
static

◆ apndSectorSize()

static int apndSectorSize ( sqlite3_file pFile)
static

Definition at line 3932 of file shell.c.

References ORIGFILE, sqlite3_file::pMethods, and sqlite3_io_methods::xSectorSize.

◆ apndSetSystemCall()

static int apndSetSystemCall ( sqlite3_vfs pVfs,
const char *  zName,
sqlite3_syscall_ptr  pCall 
)
static

Definition at line 4126 of file shell.c.

References ORIGVFS, and zName.

◆ apndShmBarrier()

static void apndShmBarrier ( sqlite3_file pFile)
static

Definition at line 3964 of file shell.c.

References ORIGFILE, sqlite3_file::pMethods, and sqlite3_io_methods::xShmBarrier.

◆ apndShmLock()

static int apndShmLock ( sqlite3_file pFile,
int  offset,
int  n,
int  flags 
)
static

Definition at line 3958 of file shell.c.

References offset, ORIGFILE, sqlite3_file::pMethods, and sqlite3_io_methods::xShmLock.

◆ apndShmMap()

static int apndShmMap ( sqlite3_file pFile,
int  iPg,
int  pgsz,
int  bExtend,
void volatile **  pp 
)
static

Definition at line 3946 of file shell.c.

References ORIGFILE, sqlite3_file::pMethods, and sqlite3_io_methods::xShmMap.

◆ apndShmUnmap()

static int apndShmUnmap ( sqlite3_file pFile,
int  deleteFlag 
)
static

Definition at line 3970 of file shell.c.

References ORIGFILE, sqlite3_file::pMethods, and sqlite3_io_methods::xShmUnmap.

◆ apndSleep()

static int apndSleep ( sqlite3_vfs pVfs,
int  microseconds 
)
static

Definition at line 4114 of file shell.c.

References ORIGVFS.

◆ apndSync()

static int apndSync ( sqlite3_file pFile,
int  flags 
)
static

Definition at line 3872 of file shell.c.

References ORIGFILE, sqlite3_file::pMethods, and sqlite3_io_methods::xSync.

◆ apndTruncate()

static int apndTruncate ( sqlite3_file pFile,
sqlite3_int64  size 
)
static

◆ apndUnfetch()

static int apndUnfetch ( sqlite3_file pFile,
sqlite3_int64  iOfst,
void *  p 
)
static

◆ apndUnlock()

static int apndUnlock ( sqlite3_file pFile,
int  eLock 
)
static

Definition at line 3902 of file shell.c.

References ORIGFILE, sqlite3_file::pMethods, and sqlite3_io_methods::xUnlock.

◆ apndWrite()

static int apndWrite ( sqlite3_file pFile,
const void *  zBuf,
int  iAmt,
sqlite3_int64  iOfst 
)
static

◆ apndWriteMark()

static int apndWriteMark ( ApndFile p,
sqlite3_file pFile 
)
static

◆ appendText()

static void appendText ( ShellText p,
char const *  zAppend,
char  quote 
)
static

◆ ascii_read_one_field()

static char* ascii_read_one_field ( ImportCtx p)
static

◆ beginTimer()

static void beginTimer ( void  )
static

Definition at line 277 of file shell.c.

References enableTimer, iBegin, sBegin, and timeOfDay().

◆ bind_prepared_stmt()

◆ bind_table_init()

static void bind_table_init ( ShellState p)
static

◆ booleanValue()

static int booleanValue ( const char *  zArg)
static

Definition at line 13131 of file shell.c.

References hexDigitValue(), integerValue(), sqlite3_stricmp, and utf8_printf.

Referenced by do_meta_command(), and setOrClearFlag().

◆ callback()

static int callback ( void *  pArg,
int  nArg,
char **  azArg,
char **  azCol 
)
static

Definition at line 10933 of file shell.c.

References NULL, and shell_callback().

Referenced by do_meta_command().

◆ captureOutputCallback()

static int captureOutputCallback ( void *  pArg,
int  nArg,
char **  azArg,
char **  az 
)
static

Definition at line 10942 of file shell.c.

References appendText(), ShellText::n, and UNUSED_PARAMETER.

◆ clearTempFile()

static void clearTempFile ( ShellState p)
static

◆ close_db()

void close_db ( sqlite3 db)

Definition at line 12995 of file shell.c.

References sqlite3_close, sqlite3_errmsg, and utf8_printf.

Referenced by do_meta_command(), main(), and tryToClone().

◆ cmdline_option_value()

static char* cmdline_option_value ( int  argc,
char **  argv,
int  i 
)
static

Definition at line 19006 of file shell.c.

References utf8_printf.

Referenced by main().

◆ completionBestIndex()

◆ completionClose()

static int completionClose ( sqlite3_vtab_cursor cur)
static

Definition at line 3277 of file shell.c.

References completionCursorReset(), sqlite3_free, and SQLITE_OK.

◆ completionColumn()

◆ completionConnect()

static int completionConnect ( sqlite3 db,
void *  pAux,
int  argc,
const char *const *  argv,
sqlite3_vtab **  ppVtab,
char **  pzErr 
)
static

◆ completionCursorReset()

◆ completionDisconnect()

static int completionDisconnect ( sqlite3_vtab pVtab)
static

Definition at line 3246 of file shell.c.

References sqlite3_free, and SQLITE_OK.

◆ completionEof()

static int completionEof ( sqlite3_vtab_cursor cur)
static

Definition at line 3446 of file shell.c.

References COMPLETION_EOF, and completion_cursor::ePhase.

◆ completionFilter()

◆ completionNext()

◆ completionOpen()

static int completionOpen ( sqlite3_vtab p,
sqlite3_vtab_cursor **  ppCursor 
)
static

◆ completionRowid()

static int completionRowid ( sqlite3_vtab_cursor cur,
sqlite_int64 pRowid 
)
static

Definition at line 3436 of file shell.c.

References completion_cursor::iRowid, and SQLITE_OK.

◆ createSelftestTable()

static void createSelftestTable ( ShellState p)
static

Definition at line 10958 of file shell.c.

References ShellState::db, sqlite3_exec, sqlite3_free, and utf8_printf.

◆ csv_read_one_field()

◆ ctxErrorMsg()

static void ctxErrorMsg ( sqlite3_context ctx,
const char *  zFmt,
  ... 
)
static

Definition at line 2292 of file shell.c.

References sqlite3_free, sqlite3_result_error, and sqlite3_vmprintf.

Referenced by writefileFunc().

◆ db_int()

static int db_int ( ShellState p,
const char *  zSql 
)
static

◆ deduceDatabaseType()

int deduceDatabaseType ( const char *  zName,
int  dfltZip 
)

◆ disable_debug_trace_modes()

static void disable_debug_trace_modes ( void  )
static

Definition at line 11475 of file shell.c.

Referenced by shell_exec().

◆ display_scanstats()

◆ display_stats()

static int display_stats ( sqlite3 db,
ShellState pArg,
int  bReset 
)
static

Definition at line 11166 of file shell.c.

Referenced by shell_exec().

◆ displayStatLine()

static void displayStatLine ( ShellState p,
char *  zLabel,
char *  zFormat,
int  iStatusCtrl,
int  bReset 
)
static

Definition at line 11140 of file shell.c.

References ShellState::out, raw_printf, sqlite3_snprintf, and sqlite3_status64.

◆ do_meta_command()

static int do_meta_command ( char *  zLine,
ShellState p 
)
static

Definition at line 15687 of file shell.c.

References appendText(), ArraySize, ascii_read_one_field(), ShellState::autoEQP, AUTOEQP_full, AUTOEQP_on, AUTOEQP_trigger, ShellState::autoEQPtest, ShellState::autoEQPtrace, ShellState::autoExplain, bail_on_error, bind_table_init(), booleanValue(), callback(), ImportCtx::cColSep, clearTempFile(), close_db(), ShellState::cMode, ShellState::cnt, ShellState::colSeparator, continuePrompt, ImportCtx::cRowSep, csv_read_one_field(), ImportCtx::cTerm, ShellState::db, ShellState::doXdgOpen, ShellState::expert, expertDotCommand(), expertFinish(), ShellState::flgProgress, freeText(), import_append_char(), ShellState::in, ImportCtx::in, initText(), integerValue(), IsDigit, IsSpace, ShellState::lineno, lintDotCommand(), mainPrompt, ShellState::mode, MODE_Ascii, MODE_Column, MODE_Csv, MODE_Explain, MODE_Html, MODE_Insert, MODE_Line, MODE_List, MODE_Pretty, MODE_Quote, MODE_Semi, MODE_Tcl, modeDescr, ShellState::mxProgress, ShellState::nCheck, ShellState::nErr, ImportCtx::nErr, newTempFile(), ImportCtx::nLine, ShellState::normalMode, ShellState::nProgress, ImportCtx::nRow, NULL, ShellState::nullValue, open_db(), OPEN_DB_KEEPALIVE, ShellState::openFlags, ShellState::openMode, optionMatch(), ShellState::out, ShellState::outCount, ShellState::outfile, output_c_string(), output_file_close(), output_file_open(), output_reset(), outputModePush(), pclose(), ExpertInfo::pExpert, ShellState::pLog, popen(), process_input(), progress_handler(), quoteChar(), raw_printf, readFile(), resolve_backslashes(), ShellState::rowSeparator, run_schema_dump_query(), run_table_dump_query(), ShellState::scanstatsOn, seenInterrupt, SEP_Column, SEP_Comma, SEP_CrLf, SEP_Record, SEP_Row, SEP_Space, SEP_Tab, SEP_Unit, session_close_all, set_table_name(), setBinaryMode, setOrClearFlag(), setTextMode, shell_dbinfo_command(), shell_exec(), SHELL_OPEN_APPENDVFS, SHELL_OPEN_DESERIALIZE, SHELL_OPEN_HEXDB, SHELL_OPEN_READONLY, SHELL_OPEN_UNSPEC, SHELL_OPEN_ZIPFILE, shell_out_of_memory(), SHELL_PROGRESS_ONCE, SHELL_PROGRESS_QUIET, SHELL_PROGRESS_RESET, shellAuth(), ShellClearFlag, shellDeleteFile(), ShellState::shellFlgs, ShellSetFlag, SHFLG_CountChanges, SHFLG_Echo, SHFLG_Newlines, SHFLG_PreserveRowid, ShellState::showHeader, showHelp(), sqlite3_backup_finish, sqlite3_backup_init, sqlite3_backup_step, sqlite3_bind_null, sqlite3_bind_text, sqlite3_column_count, sqlite3_column_int, sqlite3_column_text, sqlite3_db_config, sqlite3_errmsg, sqlite3_exec, sqlite3_file_control, sqlite3_finalize, sqlite3_free, sqlite3_get_autocommit, sqlite3_limit, sqlite3_load_extension, sqlite3_malloc64, sqlite3_mprintf, sqlite3_open, sqlite3_open_v2, sqlite3_prepare_v2, sqlite3_progress_handler, sqlite3_reset, sqlite3_set_authorizer, sqlite3_sleep, sqlite3_snprintf, sqlite3_step, sqlite3_strglob, sqlite3_stricmp, sqlite3_strlike, sqlite3_strnicmp, sqlite3_test_control, SQLITE_API, SQLITE_BUSY, SQLITE_CDECL, SQLITE_DBCONFIG_DEFENSIVE, SQLITE_DBCONFIG_DQS_DDL, SQLITE_DBCONFIG_DQS_DML, SQLITE_DBCONFIG_ENABLE_FKEY, SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, SQLITE_DBCONFIG_ENABLE_QPSG, SQLITE_DBCONFIG_ENABLE_TRIGGER, SQLITE_DBCONFIG_ENABLE_VIEW, SQLITE_DBCONFIG_LEGACY_ALTER_TABLE, SQLITE_DBCONFIG_LEGACY_FILE_FORMAT, SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE, SQLITE_DBCONFIG_RESET_DATABASE, SQLITE_DBCONFIG_TRIGGER_EQP, SQLITE_DBCONFIG_TRUSTED_SCHEMA, SQLITE_DBCONFIG_WRITABLE_SCHEMA, SQLITE_DONE, SQLITE_FCNTL_CHUNK_SIZE, SQLITE_FCNTL_HAS_MOVED, SQLITE_FCNTL_LOCK_TIMEOUT, SQLITE_FCNTL_PERSIST_WAL, SQLITE_FCNTL_POWERSAFE_OVERWRITE, SQLITE_FCNTL_RESERVE_BYTES, SQLITE_FCNTL_SIZE_LIMIT, SQLITE_FCNTL_TEMPFILENAME, SQLITE_LIMIT_ATTACHED, SQLITE_LIMIT_COLUMN, SQLITE_LIMIT_COMPOUND_SELECT, SQLITE_LIMIT_EXPR_DEPTH, SQLITE_LIMIT_FUNCTION_ARG, SQLITE_LIMIT_LENGTH, SQLITE_LIMIT_LIKE_PATTERN_LENGTH, SQLITE_LIMIT_SQL_LENGTH, SQLITE_LIMIT_TRIGGER_DEPTH, SQLITE_LIMIT_VARIABLE_NUMBER, SQLITE_LIMIT_VDBE_OP, SQLITE_LIMIT_WORKER_THREADS, SQLITE_LOCKED, SQLITE_OK, SQLITE_OPEN_CREATE, SQLITE_OPEN_NOFOLLOW, SQLITE_OPEN_READWRITE, SQLITE_ROW, SQLITE_TESTCTRL_IMPOSTER, SQLITE_TRANSIENT, strlen30(), ShellState::szMax, test_breakpoint(), testcase_glob(), tryToClone(), utf8_printf, ShellState::writableSchema, ShellText::z, ImportCtx::z, ShellState::zDbFilename, ShellState::zDestTable, ImportCtx::zFile, ShellState::zFreeOnClose, zName, ShellState::zTempFile, and ShellState::zTestcase.

Referenced by main(), and process_input().

◆ dump_callback()

◆ editFunc()

◆ endTimer()

static void endTimer ( void  )
static

Definition at line 293 of file shell.c.

References enableTimer, iBegin, sBegin, timeDiff(), and timeOfDay().

◆ eqp_append()

static void eqp_append ( ShellState p,
int  iEqpId,
int  p2,
const char *  zText 
)
static

◆ eqp_next_row()

static EQPGraphRow* eqp_next_row ( ShellState p,
int  iEqpId,
EQPGraphRow pOld 
)
static

Definition at line 10492 of file shell.c.

References EQPGraphRow::iParentId, EQPGraphRow::pNext, EQPGraph::pRow, and ShellState::sGraph.

Referenced by eqp_render_level().

◆ eqp_render()

◆ eqp_render_level()

static void eqp_render_level ( ShellState p,
int  iEqpId 
)
static

◆ eqp_reset()

static void eqp_reset ( ShellState p)
static

Definition at line 10480 of file shell.c.

References EQPGraphRow::pNext, EQPGraph::pRow, ShellState::sGraph, and sqlite3_free.

Referenced by eqp_render().

◆ exec_prepared_stmt()

◆ expertBestIndex()

◆ expertClose()

static int expertClose ( sqlite3_vtab_cursor cur)
static

Definition at line 7405 of file shell.c.

References ExpertCsr::pData, sqlite3_finalize, sqlite3_free, and SQLITE_OK.

Referenced by idxRegisterVtab().

◆ expertColumn()

static int expertColumn ( sqlite3_vtab_cursor cur,
sqlite3_context ctx,
int  i 
)
static

Definition at line 7454 of file shell.c.

References ExpertCsr::pData, sqlite3_column_value, sqlite3_result_value, and SQLITE_OK.

Referenced by idxRegisterVtab().

◆ expertConnect()

static int expertConnect ( sqlite3 db,
void *  pAux,
int  argc,
const char *const *  argv,
sqlite3_vtab **  ppVtab,
char **  pzErr 
)
static

◆ expertDequote()

static char* expertDequote ( const char *  zIn)
static

Definition at line 7236 of file shell.c.

References sqlite3_malloc, and STRLEN.

Referenced by expertConnect().

◆ expertDisconnect()

static int expertDisconnect ( sqlite3_vtab pVtab)
static

Definition at line 7304 of file shell.c.

References sqlite3_free, and SQLITE_OK.

Referenced by idxRegisterVtab().

◆ expertDotCommand()

static int expertDotCommand ( ShellState pState,
char **  azArg,
int  nArg 
)
static

◆ expertEof()

static int expertEof ( sqlite3_vtab_cursor cur)
static

Definition at line 7418 of file shell.c.

References ExpertCsr::pData.

Referenced by idxRegisterVtab().

◆ expertFilter()

static int expertFilter ( sqlite3_vtab_cursor cur,
int  idxNum,
const char *  idxStr,
int  argc,
sqlite3_value **  argv 
)
static

◆ expertFinish()

static int expertFinish ( ShellState pState,
int  bCancel,
char **  pzErr 
)
static

Definition at line 11649 of file shell.c.

References ShellState::expert, ExpertInfo::pExpert, and SQLITE_OK.

Referenced by do_meta_command(), and shell_exec().

◆ expertHandleSQL()

static int expertHandleSQL ( ShellState pState,
const char *  zSql,
char **  pzErr 
)
static

Definition at line 11629 of file shell.c.

References ShellState::expert, ExpertInfo::pExpert, and sqlite3_expert_sql().

Referenced by shell_exec().

◆ expertNext()

static int expertNext ( sqlite3_vtab_cursor cur)
static

Definition at line 7426 of file shell.c.

References ExpertCsr::pData, sqlite3_finalize, sqlite3_step, SQLITE_OK, and SQLITE_ROW.

Referenced by expertFilter(), and idxRegisterVtab().

◆ expertOpen()

static int expertOpen ( sqlite3_vtab pVTab,
sqlite3_vtab_cursor **  ppCursor 
)
static

Definition at line 7393 of file shell.c.

References idxMalloc(), and SQLITE_OK.

Referenced by idxRegisterVtab().

◆ expertRowid()

static int expertRowid ( sqlite3_vtab_cursor cur,
sqlite_int64 pRowid 
)
static

Definition at line 7445 of file shell.c.

References SQLITE_OK.

Referenced by idxRegisterVtab().

◆ expertUpdate()

static int expertUpdate ( sqlite3_vtab pVtab,
int  nData,
sqlite3_value **  azData,
sqlite_int64 pRowid 
)
static

Definition at line 7377 of file shell.c.

References SQLITE_OK.

Referenced by idxRegisterVtab().

◆ explain_data_delete()

static void explain_data_delete ( ShellState p)
static

Definition at line 11457 of file shell.c.

References ShellState::aiIndent, ShellState::iIndent, ShellState::nIndent, and sqlite3_free.

Referenced by shell_exec().

◆ explain_data_prepare()

◆ fileLinkStat()

static int fileLinkStat ( const char *  zPath,
struct stat *  pStatBuf 
)
static

Definition at line 2380 of file shell.c.

Referenced by fsdirFilter(), and fsdirNext().

◆ fileStat()

static int fileStat ( const char *  zPath,
struct stat *  pStatBuf 
)
static

Definition at line 2362 of file shell.c.

Referenced by makeDirectory(), and writeFile().

◆ find_home_dir()

static char* find_home_dir ( int  clearFlag)
static

Definition at line 18774 of file shell.c.

References NULL, sqlite3_snprintf, and strlen30().

Referenced by main(), and process_sqliterc().

◆ freeColumnList()

static void freeColumnList ( char **  azCol)
static

Definition at line 11915 of file shell.c.

References sqlite3_free.

Referenced by dump_callback(), and tableColumnList().

◆ freeText()

static void freeText ( ShellText p)
static

Definition at line 806 of file shell.c.

References initText(), and ShellText::z.

Referenced by do_meta_command(), dump_callback(), and shellFakeSchema().

◆ fsdirBestIndex()

◆ fsdirClose()

static int fsdirClose ( sqlite3_vtab_cursor cur)
static

Definition at line 2744 of file shell.c.

References fsdirResetCursor(), sqlite3_free, and SQLITE_OK.

Referenced by fsdirRegister().

◆ fsdirColumn()

◆ fsdirConnect()

static int fsdirConnect ( sqlite3 db,
void *  pAux,
int  argc,
const char *const *  argv,
sqlite3_vtab **  ppVtab,
char **  pzErr 
)
static

◆ fsdirDisconnect()

static int fsdirDisconnect ( sqlite3_vtab pVtab)
static

Definition at line 2700 of file shell.c.

References sqlite3_free, and SQLITE_OK.

Referenced by fsdirRegister().

◆ fsdirEof()

static int fsdirEof ( sqlite3_vtab_cursor cur)
static

Definition at line 2906 of file shell.c.

References fsdir_cursor::zPath.

Referenced by fsdirRegister().

◆ fsdirFilter()

static int fsdirFilter ( sqlite3_vtab_cursor cur,
int  idxNum,
const char *  idxStr,
int  argc,
sqlite3_value **  argv 
)
static

◆ fsdirNext()

◆ fsdirOpen()

static int fsdirOpen ( sqlite3_vtab p,
sqlite3_vtab_cursor **  ppCursor 
)
static

Definition at line 2708 of file shell.c.

References fsdir_cursor::base, fsdir_cursor::iLvl, sqlite3_malloc, SQLITE_NOMEM, and SQLITE_OK.

Referenced by fsdirRegister().

◆ fsdirRegister()

◆ fsdirResetCursor()

◆ fsdirRowid()

static int fsdirRowid ( sqlite3_vtab_cursor cur,
sqlite_int64 pRowid 
)
static

Definition at line 2896 of file shell.c.

References fsdir_cursor::iRowid, and SQLITE_OK.

Referenced by fsdirRegister().

◆ fsdirSetErrmsg()

static void fsdirSetErrmsg ( fsdir_cursor pCur,
const char *  zFmt,
  ... 
)
static

◆ get2byteInt()

static unsigned int get2byteInt ( unsigned char *  a)
static

Definition at line 13685 of file shell.c.

Referenced by shell_dbinfo_command().

◆ get4byteInt()

static unsigned int get4byteInt ( unsigned char *  a)
static

Definition at line 13688 of file shell.c.

Referenced by shell_dbinfo_command().

◆ hash_step_vformat()

static void hash_step_vformat ( SHA3Context p,
const char *  zFormat,
  ... 
)
static

Definition at line 1910 of file shell.c.

References SHA3Update(), and sqlite3_vsnprintf.

Referenced by sha3QueryFunc().

◆ hexDigitValue()

static int hexDigitValue ( char  c)
static

Definition at line 737 of file shell.c.

Referenced by booleanValue(), and integerValue().

◆ idxAppendColDefn()

static char* idxAppendColDefn ( int *  pRc,
char *  zIn,
IdxTable pTab,
IdxConstraint pCons 
)
static

◆ idxAppendText()

static char* idxAppendText ( int *  pRc,
char *  zIn,
const char *  zFmt,
  ... 
)
static

◆ idxAuthCallback()

static int idxAuthCallback ( void *  pCtx,
int  eOp,
const char *  z3,
const char *  z4,
const char *  zDb,
const char *  zTrigger 
)
static

◆ idxBuildSampleTable()

static int idxBuildSampleTable ( sqlite3expert p,
const char *  zTab 
)
static

◆ idxConstraintFree()

static void idxConstraintFree ( IdxConstraint pConstraint)
static

Definition at line 7909 of file shell.c.

References IdxConstraint::pNext, and sqlite3_free.

Referenced by idxScanFree().

◆ idxCreateCandidates()

static int idxCreateCandidates ( sqlite3expert p)
static

◆ idxCreateFromCons()

◆ idxCreateFromWhere()

static int idxCreateFromWhere ( sqlite3expert p,
IdxScan pScan,
IdxConstraint pTail 
)
static

◆ idxCreateVtabSchema()

◆ idxDatabaseError()

static void idxDatabaseError ( sqlite3 db,
char **  pzErrmsg 
)
static

Definition at line 7170 of file shell.c.

References sqlite3_errmsg, and sqlite3_mprintf.

Referenced by idxPrepareStmt(), idxProcessOneTrigger(), and sqlite3_expert_sql().

◆ idxFinalize()

static void idxFinalize ( int *  pRc,
sqlite3_stmt pStmt 
)
static

◆ idxFindCompatible()

◆ idxFindConstraint()

static int idxFindConstraint ( IdxConstraint pList,
IdxConstraint p 
)
static

Definition at line 7845 of file shell.c.

References IdxConstraint::iCol, and IdxConstraint::pLink.

Referenced by idxCreateFromWhere().

◆ idxFindIndexes()

◆ idxGetTableInfo()

◆ idxHashAdd()

static int idxHashAdd ( int *  pRc,
IdxHash pHash,
const char *  zKey,
const char *  zVal 
)
static

◆ idxHashClear()

static void idxHashClear ( IdxHash pHash)
static

Definition at line 7054 of file shell.c.

References IdxHash::aHash, IDX_HASH_SIZE, IdxHashEntry::pHashNext, sqlite3_free, and IdxHashEntry::zVal2.

Referenced by idxFindIndexes().

◆ idxHashFind()

static IdxHashEntry* idxHashFind ( IdxHash pHash,
const char *  zKey,
int  nKey 
)
static

◆ idxHashInit()

static void idxHashInit ( IdxHash pHash)
static

Definition at line 7047 of file shell.c.

Referenced by idxFindIndexes().

◆ idxHashSearch()

static const char* idxHashSearch ( IdxHash pHash,
const char *  zKey,
int  nKey 
)
static

Definition at line 7143 of file shell.c.

References idxHashFind(), and IdxHashEntry::zVal.

Referenced by idxFindIndexes().

◆ idxHashString()

static int idxHashString ( const char *  z,
int  n 
)
static

Definition at line 7072 of file shell.c.

References IDX_HASH_SIZE.

Referenced by idxHashAdd(), and idxHashFind().

◆ idxIdentifierRequiresQuotes()

static int idxIdentifierRequiresQuotes ( const char *  zId)
static

Definition at line 7661 of file shell.c.

Referenced by idxAppendColDefn(), and idxCreateFromCons().

◆ idxLargestIndex()

static int idxLargestIndex ( sqlite3 db,
int *  pnMax,
char **  pzErr 
)
static

Definition at line 8370 of file shell.c.

References idxFinalize(), idxPrepareStmt(), sqlite3_column_int, sqlite3_step, SQLITE_OK, and SQLITE_ROW.

Referenced by idxPopulateStat1().

◆ idxMalloc()

◆ idxNewConstraint()

static IdxConstraint* idxNewConstraint ( int *  pRc,
const char *  zColl 
)
static

Definition at line 7153 of file shell.c.

References idxMalloc(), SQLITE_OK, STRLEN, and IdxConstraint::zColl.

Referenced by expertBestIndex().

◆ idxPopulateOneStat1()

◆ idxPopulateStat1()

◆ idxPrepareStmt()

static int idxPrepareStmt ( sqlite3 db,
sqlite3_stmt **  ppStmt,
char **  pzErrmsg,
const char *  zSql 
)
static

◆ idxPrintfPrepareStmt()

static int idxPrintfPrepareStmt ( sqlite3 db,
sqlite3_stmt **  ppStmt,
char **  pzErrmsg,
const char *  zFmt,
  ... 
)
static

◆ idxProcessOneTrigger()

◆ idxProcessTriggers()

static int idxProcessTriggers ( sqlite3expert p,
char **  pzErr 
)
static

Definition at line 8171 of file shell.c.

References idxProcessOneTrigger(), IdxWrite::pNext, sqlite3expert::pWrite, and SQLITE_OK.

Referenced by sqlite3_expert_analyze().

◆ idxRegisterVtab()

◆ idxRemFunc()

◆ idxSampleFunc()

static void idxSampleFunc ( sqlite3_context pCtx,
int  argc,
sqlite3_value **  argv 
)
static

◆ idxScanFree()

static void idxScanFree ( IdxScan pScan,
IdxScan pLast 
)
static

◆ idxStatementFree()

static void idxStatementFree ( IdxStatement pStatement,
IdxStatement pLast 
)
static

Definition at line 7939 of file shell.c.

References IdxStatement::pNext, sqlite3_free, IdxStatement::zEQP, and IdxStatement::zIdx.

Referenced by sqlite3_expert_sql().

◆ idxTableFree()

static void idxTableFree ( IdxTable pTab)
static

Definition at line 7953 of file shell.c.

References IdxTable::pNext, and sqlite3_free.

◆ idxWriteFree()

static void idxWriteFree ( IdxWrite pTab)
static

Definition at line 7965 of file shell.c.

References IdxWrite::pNext, and sqlite3_free.

◆ import_append_char()

static void import_append_char ( ImportCtx p,
int  c 
)
static

◆ initText()

static void initText ( ShellText p)
static

Definition at line 803 of file shell.c.

Referenced by do_meta_command(), dump_callback(), freeText(), and shellFakeSchema().

◆ integerValue()

static sqlite3_int64 integerValue ( const char *  zArg)
static

Definition at line 747 of file shell.c.

References ArraySize, hexDigitValue(), IsDigit, and sqlite3_stricmp.

Referenced by booleanValue(), do_meta_command(), expertDotCommand(), and main().

◆ interrupt_handler()

static void interrupt_handler ( int  NotUsed)
static

Definition at line 10347 of file shell.c.

References globalDb, seenInterrupt, sqlite3_interrupt, and UNUSED_PARAMETER.

Referenced by main().

◆ isatty()

int isatty ( int  )

Referenced by main().

◆ isNumber()

static int isNumber ( const char *  z,
int *  realnum 
)
static

Definition at line 598 of file shell.c.

References IsDigit.

Referenced by shell_callback().

◆ KeccakF1600Step()

static void KeccakF1600Step ( SHA3Context p)
static

Definition at line 1459 of file shell.c.

References a00, a01, a02, a03, a04, a10, a11, a12, a13, a14, a20, a21, a22, a23, a24, a30, a31, a32, a33, a34, a40, a41, a42, a43, a44, and ROL64.

Referenced by SHA3Update().

◆ line_contains_semicolon()

static int line_contains_semicolon ( const char *  z,
int  N 
)
static

Definition at line 18567 of file shell.c.

Referenced by process_input().

◆ line_is_command_terminator()

static int line_is_command_terminator ( const char *  zLine)
static

Definition at line 18602 of file shell.c.

References _all_whitespace(), IsSpace, and ToLower.

Referenced by process_input().

◆ line_is_complete()

static int line_is_complete ( char *  zSql,
int  nSql 
)
static

Definition at line 18628 of file shell.c.

References sqlite3_complete.

Referenced by process_input().

◆ lintDotCommand()

static int lintDotCommand ( ShellState pState,
char **  azArg,
int  nArg 
)
static

Definition at line 14202 of file shell.c.

References lintFkeyIndexes(), raw_printf, sqlite3_strnicmp, SQLITE_ERROR, strlen30(), and usage().

Referenced by do_meta_command().

◆ lintFkeyIndexes()

static int lintFkeyIndexes ( ShellState pState,
char **  azArg,
int  nArg 
)
static

Definition at line 14026 of file shell.c.

References ShellState::db.

Referenced by lintDotCommand().

◆ local_getline()

static char* local_getline ( char *  zLine,
FILE *  in 
)
static

Definition at line 653 of file shell.c.

◆ lsModeFunc()

static void lsModeFunc ( sqlite3_context context,
int  argc,
sqlite3_value **  argv 
)
static

Definition at line 2608 of file shell.c.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 19024 of file shell.c.

References Argv0, ShellState::autoEQP, AUTOEQP_full, AUTOEQP_on, bail_on_error, clearTempFile(), close_db(), cmdline_option_value(), ShellState::cMode, ShellState::colSeparator, ShellState::db, do_meta_command(), ShellState::doXdgOpen, find_home_dir(), GETPID, ShellState::in, integerValue(), interrupt_handler(), isatty(), main_init(), ShellState::mode, MODE_Ascii, MODE_Column, MODE_Csv, MODE_Html, MODE_Line, MODE_List, MODE_Quote, ShellState::nullValue, open_db(), OPEN_DB_ZIPFILE, ShellState::openFlags, ShellState::openMode, ShellState::out, output_reset(), printBold(), process_input(), process_sqliterc(), raw_printf, ShellState::rowSeparator, ShellState::scanstatsOn, SEP_Record, SEP_Unit, session_close_all, set_table_name(), setBinaryMode, shell_exec(), SHELL_OPEN_APPENDVFS, SHELL_OPEN_DESERIALIZE, SHELL_OPEN_READONLY, SHELL_OPEN_ZIPFILE, shell_out_of_memory(), shell_read_history, shell_stifle_history, shell_write_history, ShellState::shellFlgs, ShellSetFlag, SHFLG_Backslash, SHFLG_Echo, SHFLG_Lookaside, SHFLG_Pagecache, ShellState::showHeader, sqlite3_appendvfs_init(), sqlite3_config(), sqlite3_free, sqlite3_initialize(), sqlite3_libversion, sqlite3_shutdown(), sqlite3_snprintf, sqlite3_sourceid, sqlite3_vfs_find, sqlite3_vfs_register, sqlite3MemTraceActivate(), SQLITE_CDECL, SQLITE_CONFIG_HEAP, SQLITE_CONFIG_LOOKASIDE, SQLITE_CONFIG_MMAP_SIZE, SQLITE_CONFIG_PAGECACHE, SQLITE_CONFIG_SORTERREF_SIZE, SQLITE_OPEN_NOFOLLOW, SQLITE_SOURCE_ID, ShellState::statsOn, stdin_is_interactive, stdout_is_console, strlen30(), ShellState::szMax, TRUE, usage(), utf8_printf, verify_uninitialized(), ShellState::zDbFilename, and ShellState::zFreeOnClose.

◆ main_init()

◆ makeDirectory()

static int makeDirectory ( const char *  zFile)
static

Definition at line 2404 of file shell.c.

References fileStat(), sqlite3_free, sqlite3_mprintf, SQLITE_ERROR, SQLITE_NOMEM, and SQLITE_OK.

Referenced by writefileFunc().

◆ memtraceFree()

static void memtraceFree ( void *  p)
static

Definition at line 4216 of file shell.c.

References memtraceBase, memtraceOut, sqlite3_mem_methods::xFree, and sqlite3_mem_methods::xSize.

Referenced by memtraceRealloc().

◆ memtraceInit()

static int memtraceInit ( void *  p)
static

Definition at line 4241 of file shell.c.

References memtraceBase, and sqlite3_mem_methods::xInit.

◆ memtraceMalloc()

static void* memtraceMalloc ( int  n)
static

◆ memtraceRealloc()

static void* memtraceRealloc ( void *  p,
int  n 
)
static

◆ memtraceRoundup()

static int memtraceRoundup ( int  n)
static

Definition at line 4238 of file shell.c.

References memtraceBase, and sqlite3_mem_methods::xRoundup.

◆ memtraceShutdown()

static void memtraceShutdown ( void *  p)
static

Definition at line 4244 of file shell.c.

References memtraceBase, and sqlite3_mem_methods::xShutdown.

◆ memtraceSize()

static int memtraceSize ( void *  p)
static

Definition at line 4235 of file shell.c.

References memtraceBase, and sqlite3_mem_methods::xSize.

◆ newTempFile()

static void newTempFile ( ShellState p,
const char *  zSuffix 
)
static

◆ one_input_line()

static char* one_input_line ( FILE *  in,
char *  zPrior,
int  isContinuation 
)
static

Definition at line 712 of file shell.c.

Referenced by process_input().

◆ open_db()

◆ optionMatch()

static int optionMatch ( const char *  zStr,
const char *  zOpt 
)
static

Definition at line 13900 of file shell.c.

Referenced by do_meta_command().

◆ output_c_string()

static void output_c_string ( FILE *  out,
const char *  z 
)
static

Definition at line 10224 of file shell.c.

Referenced by do_meta_command(), shell_callback(), and shellAuth().

◆ output_csv()

static void output_csv ( ShellState p,
const char *  z,
int  bSep 
)
static

Definition at line 10316 of file shell.c.

Referenced by shell_callback().

◆ output_file_close()

static void output_file_close ( FILE *  f)
static

Definition at line 13164 of file shell.c.

Referenced by do_meta_command(), and output_reset().

◆ output_file_open()

static FILE* output_file_open ( const char *  zFile,
int  bTextMode 
)
static

Definition at line 13173 of file shell.c.

References utf8_printf.

Referenced by do_meta_command().

◆ output_hex_blob()

static void output_hex_blob ( FILE *  out,
const void *  pBlob,
int  nBlob 
)
static

Definition at line 10090 of file shell.c.

Referenced by shell_callback().

◆ output_html_string()

static void output_html_string ( FILE *  out,
const char *  z 
)
static

Definition at line 10256 of file shell.c.

Referenced by shell_callback().

◆ output_quoted_escaped_string()

static void output_quoted_escaped_string ( FILE *  out,
const char *  z 
)
static

Definition at line 10163 of file shell.c.

Referenced by shell_callback().

◆ output_quoted_string()

static void output_quoted_string ( FILE *  out,
const char *  z 
)
static

Definition at line 10124 of file shell.c.

Referenced by shell_callback().

◆ output_reset()

◆ outputModePop()

static void outputModePop ( ShellState p)
static

Definition at line 10080 of file shell.c.

Referenced by output_reset().

◆ outputModePush()

static void outputModePush ( ShellState p)
static

◆ pclose()

int pclose ( FILE *  )

Referenced by do_meta_command(), and output_reset().

◆ popen()

FILE* popen ( const char *  ,
const char *   
)

Referenced by do_meta_command().

◆ printBold()

static void printBold ( const char *  zText)
static

Definition at line 18997 of file shell.c.

Referenced by main().

◆ printSchemaLine()

static void printSchemaLine ( FILE *  out,
const char *  z,
const char *  zTail 
)
static

Definition at line 10422 of file shell.c.

Referenced by dump_callback(), and shell_callback().

◆ printSchemaLineN()

static void printSchemaLineN ( FILE *  out,
char *  z,
int  n,
const char *  zTail 
)
static

Definition at line 10431 of file shell.c.

Referenced by shell_callback().

◆ process_input()

◆ process_sqliterc()

static void process_sqliterc ( ShellState p,
const char *  sqliterc_override 
)
static

◆ progress_handler()

static int progress_handler ( void *  pClientData)
static

◆ quoteChar()

static char quoteChar ( const char *  zName)
static

Definition at line 863 of file shell.c.

References sqlite3_keyword_check, and zName.

Referenced by do_meta_command(), dump_callback(), set_table_name(), shell_callback(), and shellFakeSchema().

◆ readFile()

static char* readFile ( const char *  zName,
int *  pnByte 
)
static

Definition at line 12520 of file shell.c.

Referenced by do_meta_command(), and open_db().

◆ readFileContents()

static void readFileContents ( sqlite3_context ctx,
const char *  zName 
)
static

Definition at line 2234 of file shell.c.

Referenced by fsdirColumn(), and readfileFunc().

◆ readfileFunc()

static void readfileFunc ( sqlite3_context context,
int  argc,
sqlite3_value **  argv 
)
static

Definition at line 2276 of file shell.c.

References context, readFileContents(), sqlite3_value_text, and zName.

◆ resolve_backslashes()

static void resolve_backslashes ( char *  z)
static

Definition at line 13083 of file shell.c.

Referenced by do_meta_command().

◆ restore_debug_trace_modes()

static void restore_debug_trace_modes ( void  )
static

Definition at line 11485 of file shell.c.

Referenced by shell_exec().

◆ run_schema_dump_query()

static int run_schema_dump_query ( ShellState p,
const char *  zQuery 
)
static

◆ run_table_dump_query()

static int run_table_dump_query ( ShellState p,
const char *  zSelect 
)
static

◆ runOneSqlLine()

static int runOneSqlLine ( ShellState p,
char *  zSql,
FILE *  in,
int  startline 
)
static

Definition at line 18641 of file shell.c.

Referenced by process_input().

◆ save_err_msg()

static char* save_err_msg ( sqlite3 db)
static

Definition at line 11090 of file shell.c.

References sqlite3_errmsg, sqlite3_malloc64, and strlen30().

Referenced by shell_exec().

◆ set_table_name()

static void set_table_name ( ShellState p,
const char *  zName 
)
static

Definition at line 11009 of file shell.c.

References quoteChar(), shell_out_of_memory(), strlen30(), ShellState::zDestTable, and zName.

Referenced by do_meta_command(), and main().

◆ setOrClearFlag()

static void setOrClearFlag ( ShellState p,
unsigned  mFlag,
const char *  zArg 
)
static

Definition at line 13153 of file shell.c.

References booleanValue(), ShellClearFlag, and ShellSetFlag.

Referenced by do_meta_command().

◆ SHA3Final()

static unsigned char* SHA3Final ( SHA3Context p)
static

◆ sha3Func()

◆ SHA3Init()

static void SHA3Init ( SHA3Context p,
int  iSize 
)
static

Definition at line 1781 of file shell.c.

References SHA3Context::ixMask, and SHA3Context::nRate.

Referenced by sha3Func(), and sha3QueryFunc().

◆ sha3QueryFunc()

◆ SHA3Update()

static void SHA3Update ( SHA3Context p,
const unsigned char *  aData,
unsigned int  nData 
)
static

◆ shell_callback()

◆ shell_dbinfo_command()

◆ shell_exec()

◆ shell_out_of_memory()

static void shell_out_of_memory ( void  )
static

◆ shellAddSchemaName()

static void shellAddSchemaName ( sqlite3_context pCtx,
int  nVal,
sqlite3_value **  apVal 
)
static

Definition at line 958 of file shell.c.

Referenced by open_db().

◆ shellAuth()

static int shellAuth ( void *  pClientData,
int  op,
const char *  zA1,
const char *  zA2,
const char *  zA3,
const char *  zA4 
)
static

Definition at line 10374 of file shell.c.

References ShellState::out, output_c_string(), raw_printf, SQLITE_OK, and utf8_printf.

Referenced by do_meta_command().

◆ shellDatabaseError()

static int shellDatabaseError ( sqlite3 db)
static

Definition at line 13792 of file shell.c.

References sqlite3_errmsg, and utf8_printf.

◆ shellDeleteFile()

int shellDeleteFile ( const char *  zFilename)

Definition at line 13910 of file shell.c.

References sqlite3_free.

Referenced by clearTempFile(), and do_meta_command().

◆ shellEscapeCrnl()

static void shellEscapeCrnl ( sqlite3_context context,
int  argc,
sqlite3_value **  argv 
)
static

◆ shellFakeSchema()

static char* shellFakeSchema ( sqlite3 db,
const char *  zSchema,
const char *  zName 
)
static

◆ shellFinalize()

void shellFinalize ( int *  pRc,
sqlite3_stmt pStmt 
)

Definition at line 14274 of file shell.c.

References raw_printf, sqlite3_db_handle, sqlite3_errmsg, sqlite3_finalize, and SQLITE_OK.

◆ shellFkeyCollateClause()

static void shellFkeyCollateClause ( sqlite3_context pCtx,
int  nVal,
sqlite3_value **  apVal 
)
static

◆ shellIdQuote()

static void shellIdQuote ( sqlite3_context context,
int  argc,
sqlite3_value **  argv 
)
static

Definition at line 12758 of file shell.c.

References context, sqlite3_free, sqlite3_mprintf, sqlite3_result_text, sqlite3_value_text, UNUSED_PARAMETER, and zName.

Referenced by open_db().

◆ shellInt32()

static void shellInt32 ( sqlite3_context context,
int  argc,
sqlite3_value **  argv 
)
static

◆ shellLog()

static void shellLog ( void *  pArg,
int  iErrCode,
const char *  zMsg 
)
static

Definition at line 9903 of file shell.c.

References ShellState::pLog, and utf8_printf.

Referenced by main_init().

◆ shellModuleSchema()

static void shellModuleSchema ( sqlite3_context pCtx,
int  nVal,
sqlite3_value **  apVal 
)
static

◆ shellPrepare()

static void shellPrepare ( sqlite3 db,
int *  pRc,
const char *  zSql,
sqlite3_stmt **  ppStmt 
)
static

Definition at line 14220 of file shell.c.

References raw_printf, sqlite3_errcode, sqlite3_errmsg, sqlite3_prepare_v2, and SQLITE_OK.

Referenced by shellPreparePrintf().

◆ shellPreparePrintf()

void shellPreparePrintf ( sqlite3 db,
int *  pRc,
sqlite3_stmt **  ppStmt,
const char *  zFmt,
  ... 
)

Definition at line 14245 of file shell.c.

References shellPrepare(), sqlite3_free, sqlite3_vmprintf, SQLITE_NOMEM, and SQLITE_OK.

◆ shellPutsFunc()

static void shellPutsFunc ( sqlite3_context pCtx,
int  nVal,
sqlite3_value **  apVal 
)
static

Definition at line 9916 of file shell.c.

References ShellState::out, sqlite3_result_value, sqlite3_user_data, sqlite3_value_text, and utf8_printf.

Referenced by open_db().

◆ shellReset()

void shellReset ( int *  pRc,
sqlite3_stmt pStmt 
)

Definition at line 14296 of file shell.c.

References raw_printf, sqlite3_db_handle, sqlite3_errmsg, sqlite3_reset, and SQLITE_OK.

◆ showHelp()

static int showHelp ( FILE *  out,
const char *  zPattern 
)
static

Definition at line 12441 of file shell.c.

Referenced by do_meta_command().

◆ sql_trace_callback()

static int sql_trace_callback ( unsigned  mType,
void *  pArg,
void *  pP,
void *  pX 
)
static

◆ sqlite3_appendvfs_init()

int sqlite3_appendvfs_init ( sqlite3 db,
char **  pzErrMsg,
const sqlite3_api_routines pApi 
)

◆ sqlite3_completion_init()

int sqlite3_completion_init ( sqlite3 db,
char **  pzErrMsg,
const sqlite3_api_routines pApi 
)

Definition at line 3593 of file shell.c.

Referenced by open_db().

◆ sqlite3_expert_analyze()

◆ sqlite3_expert_config()

int sqlite3_expert_config ( sqlite3expert p,
int  op,
  ... 
)

Definition at line 8672 of file shell.c.

References EXPERT_CONFIG_SAMPLE, sqlite3expert::iSample, SQLITE_NOTFOUND, and SQLITE_OK.

Referenced by expertDotCommand().

◆ sqlite3_expert_count()

int sqlite3_expert_count ( sqlite3expert p)

Definition at line 8782 of file shell.c.

References IdxStatement::iId, and sqlite3expert::pStatement.

◆ sqlite3_expert_destroy()

void sqlite3_expert_destroy ( sqlite3expert p)

Definition at line 8817 of file shell.c.

Referenced by sqlite3_expert_new().

◆ sqlite3_expert_new()

◆ sqlite3_expert_report()

◆ sqlite3_expert_sql()

◆ sqlite3_fileio_init()

int sqlite3_fileio_init ( sqlite3 db,
char **  pzErrMsg,
const sqlite3_api_routines pApi 
)

Definition at line 3077 of file shell.c.

Referenced by open_db().

◆ sqlite3_shathree_init()

int sqlite3_shathree_init ( sqlite3 db,
char **  pzErrMsg,
const sqlite3_api_routines pApi 
)

◆ sqlite3_uint_init()

int sqlite3_uint_init ( sqlite3 db,
char **  pzErrMsg,
const sqlite3_api_routines pApi 
)

Definition at line 4371 of file shell.c.

References sqlite3_create_collation, SQLITE_EXTENSION_INIT2, SQLITE_UTF8, and uintCollFunc().

Referenced by open_db().

◆ sqlite3CompletionVtabInit()

int sqlite3CompletionVtabInit ( sqlite3 db)

Definition at line 3582 of file shell.c.

References completionModule, sqlite3_create_module, and SQLITE_OK.

◆ sqlite3MemTraceActivate()

int sqlite3MemTraceActivate ( FILE *  out)

Definition at line 4261 of file shell.c.

Referenced by main().

◆ sqlite3MemTraceDeactivate()

int sqlite3MemTraceDeactivate ( void  )

◆ str_in_array()

static int str_in_array ( const char *  zStr,
const char **  azArray 
)
static

Definition at line 11348 of file shell.c.

Referenced by explain_data_prepare().

◆ strlen30()

◆ strlenChar()

static int strlenChar ( const char *  z)
static

Definition at line 636 of file shell.c.

Referenced by shell_callback().

◆ tableColumnList()

◆ test_breakpoint()

static void test_breakpoint ( void  )
static

Definition at line 13253 of file shell.c.

Referenced by do_meta_command().

◆ testcase_glob()

static int testcase_glob ( const char *  zGlob,
const char *  z 
)
static

Definition at line 13821 of file shell.c.

References IsDigit, and IsSpace.

Referenced by do_meta_command().

◆ timeDiff()

static double timeDiff ( struct timeval *  pStart,
struct timeval *  pEnd 
)
static

Definition at line 285 of file shell.c.

Referenced by endTimer().

◆ timeOfDay()

static sqlite3_int64 timeOfDay ( void  )
static

Definition at line 243 of file shell.c.

Referenced by beginTimer(), and endTimer().

◆ toggleSelectOrder()

static void toggleSelectOrder ( sqlite3 db)
static

◆ tryToClone()

static void tryToClone ( ShellState p,
const char *  zNewDb 
)
static

◆ tryToCloneData()

◆ tryToCloneSchema()

static void tryToCloneSchema ( ShellState p,
sqlite3 newDb,
const char *  zWhere,
void(*)(ShellState *, sqlite3 *, const char *)  xForEach 
)
static

◆ uintCollFunc()

static int uintCollFunc ( void *  notUsed,
int  nKey1,
const void *  pKey1,
int  nKey2,
const void *  pKey2 
)
static

Definition at line 4327 of file shell.c.

Referenced by sqlite3_uint_init().

◆ unused_string()

static const char* unused_string ( const char *  z,
const char *  zA,
const char *  zB,
char *  zBuf 
)
static

Definition at line 10105 of file shell.c.

References sqlite3_snprintf.

Referenced by shellEscapeCrnl().

◆ usage()

static void usage ( int  showDetail)
static

Definition at line 18935 of file shell.c.

References Argv0, raw_printf, utf8_printf, and zOptions.

Referenced by lintDotCommand(), and main().

◆ utf8_width_print()

static void utf8_width_print ( FILE *  pOut,
int  w,
const char *  zUtf 
)
static

Definition at line 570 of file shell.c.

References utf8_printf.

Referenced by shell_callback().

◆ verify_uninitialized()

static void verify_uninitialized ( void  )
static

Definition at line 18952 of file shell.c.

References sqlite3_config(), SQLITE_MISUSE, and utf8_printf.

Referenced by main(), and main_init().

◆ writeFile()

static int writeFile ( sqlite3_context pCtx,
const char *  zFile,
sqlite3_value pData,
mode_t  mode,
sqlite3_int64  mtime 
)
static

Definition at line 2444 of file shell.c.

References fileStat(), and sqlite3_value_text.

Referenced by writefileFunc().

◆ writefileFunc()

static void writefileFunc ( sqlite3_context context,
int  argc,
sqlite3_value **  argv 
)
static

◆ wsToEol()

static int wsToEol ( const char *  z)
static

Definition at line 10442 of file shell.c.

References IsSpace.

Referenced by shell_callback().

Variable Documentation

◆ apnd_io_methods

const sqlite3_io_methods apnd_io_methods
static
Initial value:
= {
3,
}
static int apndShmMap(sqlite3_file *, int iPg, int pgsz, int, void volatile **)
Definition: shell.c:3946
static int apndSectorSize(sqlite3_file *)
Definition: shell.c:3932
static int apndDeviceCharacteristics(sqlite3_file *)
Definition: shell.c:3940
static void apndShmBarrier(sqlite3_file *)
Definition: shell.c:3964
static int apndSync(sqlite3_file *, int flags)
Definition: shell.c:3872
static int apndFileControl(sqlite3_file *, int op, void *pArg)
Definition: shell.c:3918
static int apndShmUnmap(sqlite3_file *, int deleteFlag)
Definition: shell.c:3970
static int apndShmLock(sqlite3_file *, int offset, int n, int flags)
Definition: shell.c:3958
static int apndUnfetch(sqlite3_file *, sqlite3_int64 iOfst, void *p)
Definition: shell.c:3988
static int apndLock(sqlite3_file *, int)
Definition: shell.c:3894
static int apndRead(sqlite3_file *, void *, int iAmt, sqlite3_int64 iOfst)
Definition: shell.c:3802
static int apndWrite(sqlite3_file *, const void *, int iAmt, sqlite3_int64 iOfst)
Definition: shell.c:3829
static int apndClose(sqlite3_file *)
Definition: shell.c:3794
static int apndTruncate(sqlite3_file *, sqlite3_int64 size)
Definition: shell.c:3857
static int apndCheckReservedLock(sqlite3_file *, int *pResOut)
Definition: shell.c:3910
static int apndUnlock(sqlite3_file *, int)
Definition: shell.c:3902
static int apndFetch(sqlite3_file *, sqlite3_int64 iOfst, int iAmt, void **pp)
Definition: shell.c:3976
static int apndFileSize(sqlite3_file *, sqlite3_int64 *pSize)
Definition: shell.c:3880

Definition at line 3767 of file shell.c.

Referenced by apndOpen().

◆ apnd_vfs

sqlite3_vfs apnd_vfs
static
Initial value:
= {
3,
0,
1024,
0,
"apndvfs",
0,
}
static int apndOpen(sqlite3_vfs *, const char *, sqlite3_file *, int, int *)
Definition: shell.c:4031
static int apndFullPathname(sqlite3_vfs *, const char *zName, int, char *zOut)
Definition: shell.c:4091
static int apndCurrentTimeInt64(sqlite3_vfs *, sqlite3_int64 *)
Definition: shell.c:4123
static int apndAccess(sqlite3_vfs *, const char *zName, int flags, int *)
Definition: shell.c:4083
static int apndDelete(sqlite3_vfs *, const char *zName, int syncDir)
Definition: shell.c:4080
static void apndDlError(sqlite3_vfs *, int nByte, char *zErrMsg)
Definition: shell.c:4102
static int apndRandomness(sqlite3_vfs *, int nByte, char *zOut)
Definition: shell.c:4111
static int apndSleep(sqlite3_vfs *, int microseconds)
Definition: shell.c:4114
static int apndSetSystemCall(sqlite3_vfs *, const char *, sqlite3_syscall_ptr)
Definition: shell.c:4126
static const char * apndNextSystemCall(sqlite3_vfs *, const char *zName)
Definition: shell.c:4139
static void * apndDlOpen(sqlite3_vfs *, const char *zFilename)
Definition: shell.c:4099
static void(*)(void) apndDlSym(sqlite3_vfs *pVfs, void *p, const char *zSym)
Definition: shell.c:3731
static int apndGetLastError(sqlite3_vfs *, int, char *)
Definition: shell.c:4120
static int apndCurrentTime(sqlite3_vfs *, double *)
Definition: shell.c:4117
static sqlite3_syscall_ptr apndGetSystemCall(sqlite3_vfs *, const char *z)
Definition: shell.c:4133
static void apndDlClose(sqlite3_vfs *, void *)
Definition: shell.c:4108

Definition at line 3742 of file shell.c.

Referenced by sqlite3_appendvfs_init().

◆ apndDlSym

void(*)(void) apndDlSym(sqlite3_vfs *pVfs, void *p, const char *zSym) ( sqlite3_vfs pVfs,
void *  p,
const char *  zSym 
)
static

Definition at line 3731 of file shell.c.

◆ Argv0

char* Argv0
static

Definition at line 448 of file shell.c.

Referenced by main(), and usage().

◆ azHelp

const char* azHelp[]
static

Definition at line 12200 of file shell.c.

◆ bail_on_error

int bail_on_error = 0
static

Definition at line 408 of file shell.c.

Referenced by do_meta_command(), main(), and process_input().

◆ completionModule

sqlite3_module completionModule
static
Initial value:
= {
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
}
static int completionNext(sqlite3_vtab_cursor *cur)
Definition: shell.c:3297
static int completionClose(sqlite3_vtab_cursor *cur)
Definition: shell.c:3277
static int completionFilter(sqlite3_vtab_cursor *pVtabCursor, int idxNum, const char *idxStr, int argc, sqlite3_value **argv)
Definition: shell.c:3457
static int completionRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid)
Definition: shell.c:3436
static int completionColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i)
Definition: shell.c:3405
static int completionDisconnect(sqlite3_vtab *pVtab)
Definition: shell.c:3246
static int completionConnect(sqlite3 *db, void *pAux, int argc, const char *const *argv, sqlite3_vtab **ppVtab, char **pzErr)
Definition: shell.c:3204
static int completionEof(sqlite3_vtab_cursor *cur)
Definition: shell.c:3446
static int completionOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor)
Definition: shell.c:3254
static int completionBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo)
Definition: shell.c:3508

Definition at line 3553 of file shell.c.

Referenced by sqlite3CompletionVtabInit().

◆ continuePrompt

char continuePrompt[20]
static

Definition at line 455 of file shell.c.

Referenced by do_meta_command(), and main_init().

◆ enableTimer

int enableTimer = 0
static

Definition at line 240 of file shell.c.

Referenced by beginTimer(), and endTimer().

◆ ersaztMethods

sqlite3_mem_methods ersaztMethods
static
Initial value:
= {
0
}
static void * memtraceRealloc(void *p, int n)
Definition: shell.c:4223
static void memtraceFree(void *p)
Definition: shell.c:4216
static int memtraceInit(void *p)
Definition: shell.c:4241
static int memtraceSize(void *p)
Definition: shell.c:4235
static int memtraceRoundup(int n)
Definition: shell.c:4238
static void * memtraceMalloc(int n)
Definition: shell.c:4209
static void memtraceShutdown(void *p)
Definition: shell.c:4244

Definition at line 4249 of file shell.c.

◆ globalDb

sqlite3* globalDb = 0
static

Definition at line 428 of file shell.c.

Referenced by interrupt_handler(), and open_db().

◆ iBegin

sqlite3_int64 iBegin
static

Definition at line 272 of file shell.c.

Referenced by beginTimer(), and endTimer().

◆ mainPrompt

char mainPrompt[20]
static

Definition at line 454 of file shell.c.

Referenced by do_meta_command(), and main_init().

◆ memtraceBase

◆ memtraceOut

FILE* memtraceOut
static

Definition at line 4206 of file shell.c.

Referenced by memtraceFree(), memtraceMalloc(), memtraceRealloc(), and sqlite3MemTraceDeactivate().

◆ modeDescr

const char* modeDescr[]
static
Initial value:
= {
"line",
"column",
"list",
"semi",
"html",
"insert",
"quote",
"tcl",
"csv",
"explain",
"ascii",
"prettyprint",
"eqp"
}

Definition at line 9871 of file shell.c.

Referenced by do_meta_command().

◆ needCsvQuote

const char needCsvQuote[]
static
Initial value:
= {
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 10291 of file shell.c.

◆ sBegin

struct rusage sBegin
static

Definition at line 243 of file shell.c.

Referenced by beginTimer(), and endTimer().

◆ seenInterrupt

volatile int seenInterrupt = 0
static

◆ stdin_is_interactive

int stdin_is_interactive = 1
static

Definition at line 414 of file shell.c.

Referenced by main(), process_input(), and process_sqliterc().

◆ stdout_is_console

int stdout_is_console = 1
static

Definition at line 421 of file shell.c.

Referenced by main().

◆ zOptions

const char zOptions[]
static

Definition at line 18881 of file shell.c.

Referenced by usage().