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

📄 sqliteint.h

📁 最新的sqlite3.6.2源代码
💻 H
📖 第 1 页 / 共 5 页
字号:
** exits.  Upon entering a before or instead of trigger, lastRowid is no** longer (since after version 2.8.12) reset to -1.**** The sqlite.nChange does not count changes within triggers and keeps no** context.  It is reset at start of sqlite3_exec.** The sqlite.lsChange represents the number of changes made by the last** insert, update, or delete statement.  It remains constant throughout the** length of a statement and is then updated by OP_SetCounts.  It keeps a** context stack just like lastRowid so that the count of changes** within a trigger is not seen outside the trigger.  Changes to views do not** affect the value of lsChange.** The sqlite.csChange keeps track of the number of current changes (since** the last statement) and is used to update sqlite_lsChange.**** The member variables sqlite.errCode, sqlite.zErrMsg and sqlite.zErrMsg16** store the most recent error code and, if applicable, string. The** internal function sqlite3Error() is used to set these variables** consistently.*/struct sqlite3 {  sqlite3_vfs *pVfs;            /* OS Interface */  int nDb;                      /* Number of backends currently in use */  Db *aDb;                      /* All backends */  int flags;                    /* Miscellanous flags. See below */  int openFlags;                /* Flags passed to sqlite3_vfs.xOpen() */  int errCode;                  /* Most recent error code (SQLITE_*) */  int errMask;                  /* & result codes with this before returning */  u8 autoCommit;                /* The auto-commit flag. */  u8 temp_store;                /* 1: file 2: memory 0: default */  u8 mallocFailed;              /* True if we have seen a malloc failure */  u8 dfltLockMode;              /* Default locking-mode for attached dbs */  u8 dfltJournalMode;           /* Default journal mode for attached dbs */  signed char nextAutovac;      /* Autovac setting after VACUUM if >=0 */  int nextPagesize;             /* Pagesize after VACUUM if >0 */  int nTable;                   /* Number of tables in the database */  CollSeq *pDfltColl;           /* The default collating sequence (BINARY) */  i64 lastRowid;                /* ROWID of most recent insert (see above) */  i64 priorNewRowid;            /* Last randomly generated ROWID */  int magic;                    /* Magic number for detect library misuse */  int nChange;                  /* Value returned by sqlite3_changes() */  int nTotalChange;             /* Value returned by sqlite3_total_changes() */  sqlite3_mutex *mutex;         /* Connection mutex */  int aLimit[SQLITE_N_LIMIT];   /* Limits */  struct sqlite3InitInfo {      /* Information used during initialization */    int iDb;                    /* When back is being initialized */    int newTnum;                /* Rootpage of table being initialized */    u8 busy;                    /* TRUE if currently initializing */  } init;  int nExtension;               /* Number of loaded extensions */  void **aExtension;            /* Array of shared libraray handles */  struct Vdbe *pVdbe;           /* List of active virtual machines */  int activeVdbeCnt;            /* Number of vdbes currently executing */  void (*xTrace)(void*,const char*);        /* Trace function */  void *pTraceArg;                          /* Argument to the trace function */  void (*xProfile)(void*,const char*,u64);  /* Profiling function */  void *pProfileArg;                        /* Argument to profile function */  void *pCommitArg;                 /* Argument to xCommitCallback() */     int (*xCommitCallback)(void*);    /* Invoked at every commit. */  void *pRollbackArg;               /* Argument to xRollbackCallback() */     void (*xRollbackCallback)(void*); /* Invoked at every commit. */  void *pUpdateArg;  void (*xUpdateCallback)(void*,int, const char*,const char*,sqlite_int64);  void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*);  void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*);  void *pCollNeededArg;  sqlite3_value *pErr;          /* Most recent error message */  char *zErrMsg;                /* Most recent error message (UTF-8 encoded) */  char *zErrMsg16;              /* Most recent error message (UTF-16 encoded) */  union {    int isInterrupted;          /* True if sqlite3_interrupt has been called */    double notUsed1;            /* Spacer */  } u1;  Lookaside lookaside;          /* Lookaside malloc configuration */#ifndef SQLITE_OMIT_AUTHORIZATION  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*);                                /* Access authorization function */  void *pAuthArg;               /* 1st argument to the access auth function */#endif#ifndef SQLITE_OMIT_PROGRESS_CALLBACK  int (*xProgress)(void *);     /* The progress callback */  void *pProgressArg;           /* Argument to the progress callback */  int nProgressOps;             /* Number of opcodes for progress callback */#endif#ifndef SQLITE_OMIT_VIRTUALTABLE  Hash aModule;                 /* populated by sqlite3_create_module() */  Table *pVTab;                 /* vtab with active Connect/Create method */  sqlite3_vtab **aVTrans;       /* Virtual tables with open transactions */  int nVTrans;                  /* Allocated size of aVTrans */#endif  FuncDefHash aFunc;            /* Hash table of connection functions */  Hash aCollSeq;                /* All collating sequences */  BusyHandler busyHandler;      /* Busy callback */  int busyTimeout;              /* Busy handler timeout, in msec */  Db aDbStatic[2];              /* Static space for the 2 default backends */#ifdef SQLITE_SSE  sqlite3_stmt *pFetch;         /* Used by SSE to fetch stored statements */#endif};/*** A macro to discover the encoding of a database.*/#define ENC(db) ((db)->aDb[0].pSchema->enc)/*** Possible values for the sqlite.flags and or Db.flags fields.**** On sqlite.flags, the SQLITE_InTrans value means that we have** executed a BEGIN.  On Db.flags, SQLITE_InTrans means a statement** transaction is active on that particular database file.*/#define SQLITE_VdbeTrace      0x00000001  /* True to trace VDBE execution */#define SQLITE_InTrans        0x00000008  /* True if in a transaction */#define SQLITE_InternChanges  0x00000010  /* Uncommitted Hash table changes */#define SQLITE_FullColNames   0x00000020  /* Show full column names on SELECT */#define SQLITE_ShortColNames  0x00000040  /* Show short columns names */#define SQLITE_CountRows      0x00000080  /* Count rows changed by INSERT, */                                          /*   DELETE, or UPDATE and return */                                          /*   the count using a callback. */#define SQLITE_NullCallback   0x00000100  /* Invoke the callback once if the */                                          /*   result set is empty */#define SQLITE_SqlTrace       0x00000200  /* Debug print SQL as it executes */#define SQLITE_VdbeListing    0x00000400  /* Debug listings of VDBE programs */#define SQLITE_WriteSchema    0x00000800  /* OK to update SQLITE_MASTER */#define SQLITE_NoReadlock     0x00001000  /* Readlocks are omitted when                                           ** accessing read-only databases */#define SQLITE_IgnoreChecks   0x00002000  /* Do not enforce check constraints */#define SQLITE_ReadUncommitted 0x00004000 /* For shared-cache mode */#define SQLITE_LegacyFileFmt  0x00008000  /* Create new databases in format 1 */#define SQLITE_FullFSync      0x00010000  /* Use full fsync on the backend */#define SQLITE_LoadExtension  0x00020000  /* Enable load_extension */#define SQLITE_RecoveryMode   0x00040000  /* Ignore schema errors */#define SQLITE_SharedCache    0x00080000  /* Cache sharing is enabled */#define SQLITE_Vtab           0x00100000  /* There exists a virtual table *//*** Possible values for the sqlite.magic field.** The numbers are obtained at random and have no special meaning, other** than being distinct from one another.*/#define SQLITE_MAGIC_OPEN     0xa029a697  /* Database is open */#define SQLITE_MAGIC_CLOSED   0x9f3c2d33  /* Database is closed */#define SQLITE_MAGIC_SICK     0x4b771290  /* Error and awaiting close */#define SQLITE_MAGIC_BUSY     0xf03b7906  /* Database currently in use */#define SQLITE_MAGIC_ERROR    0xb5357930  /* An SQLITE_MISUSE error occurred *//*** Each SQL function is defined by an instance of the following** structure.  A pointer to this structure is stored in the sqlite.aFunc** hash table.  When multiple functions have the same name, the hash table** points to a linked list of these structures.*/struct FuncDef {  i8 nArg;             /* Number of arguments.  -1 means unlimited */  u8 iPrefEnc;         /* Preferred text encoding (SQLITE_UTF8, 16LE, 16BE) */  u8 needCollSeq;      /* True if sqlite3GetFuncCollSeq() might be called */  u8 flags;            /* Some combination of SQLITE_FUNC_* */  void *pUserData;     /* User data parameter */  FuncDef *pNext;      /* Next function with same name */  void (*xFunc)(sqlite3_context*,int,sqlite3_value**); /* Regular function */  void (*xStep)(sqlite3_context*,int,sqlite3_value**); /* Aggregate step */  void (*xFinalize)(sqlite3_context*);                /* Aggregate finializer */  char *zName;         /* SQL name of the function. */  FuncDef *pHash;      /* Next with a different name but the same hash */};/*** Possible values for FuncDef.flags*/#define SQLITE_FUNC_LIKE     0x01  /* Candidate for the LIKE optimization */#define SQLITE_FUNC_CASE     0x02  /* Case-sensitive LIKE-type function */#define SQLITE_FUNC_EPHEM    0x04  /* Ephermeral.  Delete with VDBE *//*** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are** used to create the initializers for the FuncDef structures.****   FUNCTION(zName, nArg, iArg, bNC, xFunc)**     Used to create a scalar function definition of a function zName **     implemented by C function xFunc that accepts nArg arguments. The**     value passed as iArg is cast to a (void*) and made available**     as the user-data (sqlite3_user_data()) for the function. If **     argument bNC is true, then the FuncDef.needCollate flag is set.****   AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal)**     Used to create an aggregate function definition implemented by**     the C functions xStep and xFinal. The first four parameters**     are interpreted in the same way as the first 4 parameters to**     FUNCTION().****   LIKEFUNC(zName, nArg, pArg, flags)**     Used to create a scalar function definition of a function zName **     that accepts nArg arguments and is implemented by a call to C **     function likeFunc. Argument pArg is cast to a (void *) and made**     available as the function user-data (sqlite3_user_data()). The**     FuncDef.flags variable is set to the value passed as the flags**     parameter.*/#define FUNCTION(zName, nArg, iArg, bNC, xFunc) \  {nArg, SQLITE_UTF8, bNC, 0, SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName}#define LIKEFUNC(zName, nArg, arg, flags) \  {nArg, SQLITE_UTF8, 0, flags, (void *)arg, 0, likeFunc, 0, 0, #zName}#define AGGREGATE(zName, nArg, arg, nc, xStep, xFinal) \  {nArg, SQLITE_UTF8, nc, 0, SQLITE_INT_TO_PTR(arg), 0, 0, xStep,xFinal, #zName}/*** Each SQLite module (virtual table definition) is defined by an** instance of the following structure, stored in the sqlite3.aModule** hash table.*/struct Module {  const sqlite3_module *pModule;       /* Callback pointers */  const char *zName;                   /* Name passed to create_module() */  void *pAux;                          /* pAux passed to create_module() */  void (*xDestroy)(void *);            /* Module destructor function */};/*** information about each column of an SQL table is held in an instance** of this structure.*/struct Column {  char *zName;     /* Name of this column */  Expr *pDflt;     /* Default value of this column */  char *zType;     /* Data type for this column */  char *zColl;     /* Collating sequence.  If NULL, use the default */  u8 notNull;      /* True if there is a NOT NULL constraint */  u8 isPrimKey;    /* True if this column is part of the PRIMARY KEY */  char affinity;   /* One of the SQLITE_AFF_... values */#ifndef SQLITE_OMIT_VIRTUALTABLE  u8 isHidden;     /* True if this column is 'hidden' */#endif};/*** A "Collating Sequence" is defined by an instance of the following** structure. Conceptually, a collating sequence consists of a name and** a comparison routine that defines the order of that sequence.**** There may two seperate implementations of the collation function, one** that processes text in UTF-8 encoding (CollSeq.xCmp) and another that** processes text encoded in UTF-16 (CollSeq.xCmp16), using the machine** native byte order. When a collation sequence is invoked, SQLite selects** the version that will require the least expensive encoding** translations, if any.**** The CollSeq.pUser member variable is an extra parameter that passed in** as the first argument to the UTF-8 comparison function, xCmp.** CollSeq.pUser16 is the equivalent for the UTF-16 comparison function,** xCmp16.**** If both CollSeq.xCmp and CollSeq.xCmp16 are NULL, it means that the** collating sequence is undefined.  Indices built on an undefined** collating sequence may not be read or written.*/struct CollSeq {  char *zName;          /* Name of the collating sequence, UTF-8 encoded */  u8 enc;               /* Text encoding handled by xCmp() */  u8 type;              /* One of the SQLITE_COLL_... values below */  void *pUser;          /* First argument to xCmp() */  int (*xCmp)(void*,int, const void*, int, const void*);  void (*xDel)(void*);  /* Destructor for pUser */};/*** Allowed values of CollSeq.type:*/#define SQLITE_COLL_BINARY  1  /* The default memcmp() collating sequence */#define SQLITE_COLL_NOCASE  2  /* The built-in NOCASE collating sequence */#define SQLITE_COLL_REVERSE 3  /* The built-in REVERSE collating sequence */#define SQLITE_COLL_USER    0  /* Any other user-defined collating sequence *//*** A sort order can be either ASC or DESC.*/#define SQLITE_SO_ASC       0  /* Sort in ascending order */#define SQLITE_SO_DESC      1  /* Sort in ascending order *//*** Column affinity types.**** These used to have mnemonic name like 'i' for SQLITE_AFF_INTEGER and** 't' for SQLITE_AFF_TEXT.  But we can save a little space and improve** the speed a little by numbering the values consecutively.  **** But rather than start with 0 or 1, we begin with 'a'.  That way,** when multiple affinity types are concatenated into a string and** used as the P4 operand, they will be more readable.**** Note also that the numeric types are grouped together so that testing** for a numeric type is a single comparison.*/#define SQLITE_AFF_TEXT     'a'#define SQLITE_AFF_NONE     'b'#define SQLITE_AFF_NUMERIC  'c'#define SQLITE_AFF_INTEGER  'd'#define SQLITE_AFF_REAL     'e'#define sqlite3IsNumericAffinity(X)  ((X)>=SQLITE_AFF_NUMERIC)/*** The SQLITE_AFF_MASK values masks off the significant bits of an** affinity value. */

⌨️ 快捷键说明

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