⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sqliteint.h

📁 调用sqlite开源数据的小程序
💻 H
📖 第 1 页 / 共 5 页
字号:
  u32 writeMask;       /* Start a write transaction on these databases */  u32 cookieMask;      /* Bitmask of schema verified databases */  int cookieGoto;      /* Address of OP_Goto to cookie verifier subroutine */  int cookieValue[MAX_ATTACHED+2];  /* Values of cookies to verify */  /* Above is constant between recursions.  Below is reset before and after  ** each recursion */  int nVar;            /* Number of '?' variables seen in the SQL so far */  int nVarExpr;        /* Number of used slots in apVarExpr[] */  int nVarExprAlloc;   /* Number of allocated slots in apVarExpr[] */  Expr **apVarExpr;    /* Pointers to :aaa and $aaaa wildcard expressions */  u8 explain;          /* True if the EXPLAIN flag is found on the query */  Token sErrToken;     /* The token at which the error occurred */  Token sNameToken;    /* Token with unqualified schema object name */  Token sLastToken;    /* The last token parsed */  const char *zSql;    /* All SQL text */  const char *zTail;   /* All SQL text past the last semicolon parsed */  Table *pNewTable;    /* A table being constructed by CREATE TABLE */  Trigger *pNewTrigger;     /* Trigger under construct by a CREATE TRIGGER */  TriggerStack *trigStack;  /* Trigger actions being coded */  const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */};/*** An instance of the following structure can be declared on a stack and used** to save the Parse.zAuthContext value so that it can be restored later.*/struct AuthContext {  const char *zAuthContext;   /* Put saved Parse.zAuthContext here */  Parse *pParse;              /* The Parse structure */};/*** Bitfield flags for P2 value in OP_Insert and OP_Delete*/#define OPFLAG_NCHANGE   1    /* Set to update db->nChange */#define OPFLAG_LASTROWID 2    /* Set to update db->lastRowid *//* * Each trigger present in the database schema is stored as an instance of * struct Trigger.  * * Pointers to instances of struct Trigger are stored in two ways. * 1. In the "trigHash" hash table (part of the sqlite3* that represents the  *    database). This allows Trigger structures to be retrieved by name. * 2. All triggers associated with a single table form a linked list, using the *    pNext member of struct Trigger. A pointer to the first element of the *    linked list is stored as the "pTrigger" member of the associated *    struct Table. * * The "step_list" member points to the first element of a linked list * containing the SQL statements specified as the trigger program. */struct Trigger {  char *name;             /* The name of the trigger                        */  char *table;            /* The table or view to which the trigger applies */  u8 iDb;                 /* Database containing this trigger               */  u8 iTabDb;              /* Database containing Trigger.table              */  u8 op;                  /* One of TK_DELETE, TK_UPDATE, TK_INSERT         */  u8 tr_tm;               /* One of TRIGGER_BEFORE, TRIGGER_AFTER */  Expr *pWhen;            /* The WHEN clause of the expresion (may be NULL) */  IdList *pColumns;       /* If this is an UPDATE OF <column-list> trigger,                             the <column-list> is stored here */  int foreach;            /* One of TK_ROW or TK_STATEMENT */  Token nameToken;        /* Token containing zName. Use during parsing only */  TriggerStep *step_list; /* Link list of trigger program steps             */  Trigger *pNext;         /* Next trigger associated with the table */};/*** A trigger is either a BEFORE or an AFTER trigger.  The following constants** determine which. **** If there are multiple triggers, you might of some BEFORE and some AFTER.** In that cases, the constants below can be ORed together.*/#define TRIGGER_BEFORE  1#define TRIGGER_AFTER   2/* * An instance of struct TriggerStep is used to store a single SQL statement * that is a part of a trigger-program.  * * Instances of struct TriggerStep are stored in a singly linked list (linked * using the "pNext" member) referenced by the "step_list" member of the  * associated struct Trigger instance. The first element of the linked list is * the first step of the trigger-program. *  * The "op" member indicates whether this is a "DELETE", "INSERT", "UPDATE" or * "SELECT" statement. The meanings of the other members is determined by the  * value of "op" as follows: * * (op == TK_INSERT) * orconf    -> stores the ON CONFLICT algorithm * pSelect   -> If this is an INSERT INTO ... SELECT ... statement, then *              this stores a pointer to the SELECT statement. Otherwise NULL. * target    -> A token holding the name of the table to insert into. * pExprList -> If this is an INSERT INTO ... VALUES ... statement, then *              this stores values to be inserted. Otherwise NULL. * pIdList   -> If this is an INSERT INTO ... (<column-names>) VALUES ...  *              statement, then this stores the column-names to be *              inserted into. * * (op == TK_DELETE) * target    -> A token holding the name of the table to delete from. * pWhere    -> The WHERE clause of the DELETE statement if one is specified. *              Otherwise NULL. *  * (op == TK_UPDATE) * target    -> A token holding the name of the table to update rows of. * pWhere    -> The WHERE clause of the UPDATE statement if one is specified. *              Otherwise NULL. * pExprList -> A list of the columns to update and the expressions to update *              them to. See sqlite3Update() documentation of "pChanges" *              argument. *  */struct TriggerStep {  int op;              /* One of TK_DELETE, TK_UPDATE, TK_INSERT, TK_SELECT */  int orconf;          /* OE_Rollback etc. */  Trigger *pTrig;      /* The trigger that this step is a part of */  Select *pSelect;     /* Valid for SELECT and sometimes 			  INSERT steps (when pExprList == 0) */  Token target;        /* Valid for DELETE, UPDATE, INSERT steps */  Expr *pWhere;        /* Valid for DELETE, UPDATE steps */  ExprList *pExprList; /* Valid for UPDATE statements and sometimes 			   INSERT steps (when pSelect == 0)         */  IdList *pIdList;     /* Valid for INSERT statements only */  TriggerStep * pNext; /* Next in the link-list */};/* * An instance of struct TriggerStack stores information required during code * generation of a single trigger program. While the trigger program is being * coded, its associated TriggerStack instance is pointed to by the * "pTriggerStack" member of the Parse structure. * * The pTab member points to the table that triggers are being coded on. The  * newIdx member contains the index of the vdbe cursor that points at the temp * table that stores the new.* references. If new.* references are not valid * for the trigger being coded (for example an ON DELETE trigger), then newIdx * is set to -1. The oldIdx member is analogous to newIdx, for old.* references. * * The ON CONFLICT policy to be used for the trigger program steps is stored  * as the orconf member. If this is OE_Default, then the ON CONFLICT clause  * specified for individual triggers steps is used. * * struct TriggerStack has a "pNext" member, to allow linked lists to be * constructed. When coding nested triggers (triggers fired by other triggers) * each nested trigger stores its parent trigger's TriggerStack as the "pNext"  * pointer. Once the nested trigger has been coded, the pNext value is restored * to the pTriggerStack member of the Parse stucture and coding of the parent * trigger continues. * * Before a nested trigger is coded, the linked list pointed to by the  * pTriggerStack is scanned to ensure that the trigger is not about to be coded * recursively. If this condition is detected, the nested trigger is not coded. */struct TriggerStack {  Table *pTab;         /* Table that triggers are currently being coded on */  int newIdx;          /* Index of vdbe cursor to "new" temp table */  int oldIdx;          /* Index of vdbe cursor to "old" temp table */  int orconf;          /* Current orconf policy */  int ignoreJump;      /* where to jump to for a RAISE(IGNORE) */  Trigger *pTrigger;   /* The trigger currently being coded */  TriggerStack *pNext; /* Next trigger down on the trigger stack */};/*** The following structure contains information used by the sqliteFix...** routines as they walk the parse tree to make database references** explicit.  */typedef struct DbFixer DbFixer;struct DbFixer {  Parse *pParse;      /* The parsing context.  Error messages written here */  const char *zDb;    /* Make sure all objects are contained in this database */  const char *zType;  /* Type of the container - used for error messages */  const Token *pName; /* Name of the container - used for error messages */};/*** A pointer to this structure is used to communicate information** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback.*/typedef struct {  sqlite3 *db;        /* The database being initialized */  char **pzErrMsg;    /* Error message stored here */} InitData;/* * This global flag is set for performance testing of triggers. When it is set * SQLite will perform the overhead of building new and old trigger references  * even when no triggers exist */extern int sqlite3_always_code_trigger_setup;/*** The SQLITE_CORRUPT_BKPT macro can be either a constant (for production** builds) or a function call (for debugging).  If it is a function call,** it allows the operator to set a breakpoint at the spot where database** corruption is first detected.*/#ifdef SQLITE_DEBUG  extern int sqlite3Corrupt(void);# define SQLITE_CORRUPT_BKPT sqlite3Corrupt()#else# define SQLITE_CORRUPT_BKPT SQLITE_CORRUPT#endif/*** Internal function prototypes*/int sqlite3StrICmp(const char *, const char *);int sqlite3StrNICmp(const char *, const char *, int);int sqlite3HashNoCase(const char *, int);int sqlite3IsNumber(const char*, int*, u8);int sqlite3Compare(const char *, const char *);int sqlite3SortCompare(const char *, const char *);void sqlite3RealToSortable(double r, char *);#ifdef SQLITE_MEMDEBUG  void *sqlite3Malloc_(int,int,char*,int);  void sqlite3Free_(void*,char*,int);  void *sqlite3Realloc_(void*,int,char*,int);  char *sqlite3StrDup_(const char*,char*,int);  char *sqlite3StrNDup_(const char*, int,char*,int);  void sqlite3CheckMemory(void*,int);#else  void *sqlite3Malloc(int);  void *sqlite3MallocRaw(int);  void sqlite3Free(void*);  void *sqlite3Realloc(void*,int);  char *sqlite3StrDup(const char*);  char *sqlite3StrNDup(const char*, int);# define sqlite3CheckMemory(a,b)# define sqlite3MallocX sqlite3Malloc#endifvoid sqlite3ReallocOrFree(void**,int);void sqlite3FreeX(void*);void *sqlite3MallocX(int);char *sqlite3MPrintf(const char*, ...);char *sqlite3VMPrintf(const char*, va_list);void sqlite3DebugPrintf(const char*, ...);void *sqlite3TextToPtr(const char*);void sqlite3SetString(char **, ...);void sqlite3ErrorMsg(Parse*, const char*, ...);void sqlite3Dequote(char*);void sqlite3DequoteExpr(Expr*);int sqlite3KeywordCode(const char*, int);int sqlite3RunParser(Parse*, const char*, char **);void sqlite3FinishCoding(Parse*);Expr *sqlite3Expr(int, Expr*, Expr*, const Token*);Expr *sqlite3RegisterExpr(Parse*,Token*);Expr *sqlite3ExprAnd(Expr*, Expr*);void sqlite3ExprSpan(Expr*,Token*,Token*);Expr *sqlite3ExprFunction(ExprList*, Token*);void sqlite3ExprAssignVarNumber(Parse*, Expr*);void sqlite3ExprDelete(Expr*);ExprList *sqlite3ExprListAppend(ExprList*,Expr*,Token*);void sqlite3ExprListDelete(ExprList*);int sqlite3Init(sqlite3*, char**);int sqlite3InitCallback(void*, int, char**, char**);void sqlite3Pragma(Parse*,Token*,Token*,Token*,int);void sqlite3ResetInternalSchema(sqlite3*, int);void sqlite3BeginParse(Parse*,int);void sqlite3RollbackInternalChanges(sqlite3*);void sqlite3CommitInternalChanges(sqlite3*);Table *sqlite3ResultSetOfSelect(Parse*,char*,Select*);void sqlite3OpenMasterTable(Vdbe *v, int);void sqlite3StartTable(Parse*,Token*,Token*,Token*,int,int);void sqlite3AddColumn(Parse*,Token*);void sqlite3AddNotNull(Parse*, int);void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int);void sqlite3AddColumnType(Parse*,Token*);void sqlite3AddDefaultValue(Parse*,Expr*);void sqlite3AddCollateType(Parse*, const char*, int);void sqlite3EndTable(Parse*,Token*,Token*,Select*);#ifndef SQLITE_OMIT_VIEW  void sqlite3CreateView(Parse*,Token*,Token*,Token*,Select*,int);  int sqlite3ViewGetColumnNames(Parse*,Table*);#else# define sqlite3ViewGetColumnNames(A,B) 0#endifvoid sqlite3DropTable(Parse*, SrcList*, int);void sqlite3DeleteTable(sqlite3*, Table*);void sqlite3Insert(Parse*, SrcList*, ExprList*, Select*, IdList*, int);int sqlit

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -