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

📄 sqliteint.h

📁 SQLite is a software library that implements a self-contained, serverless, zero-configuration, trans
💻 H
📖 第 1 页 / 共 5 页
字号:
#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  Hash aFunc;                   /* All functions that can be in SQL exprs */  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  u8 dfltLockMode;              /* Default locking-mode for attached dbs */};/*** 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 {  i16 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[1];       /* SQL name of the function.  MUST BE LAST */};/*** 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 */};/*** 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 *//*** 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 flags:*/#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 number 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. */#define SQLITE_AFF_MASK     0x67/*** Additional bit values that can be ORed with an affinity without** changing the affinity.*/#define SQLITE_JUMPIFNULL   0x08  /* jumps if either operand is NULL */#define SQLITE_NULLEQUAL    0x10  /* compare NULLs equal */#define SQLITE_STOREP2      0x80  /* Store result in reg[P2] rather than jump *//*** Each SQL table is represented in memory by an instance of the** following structure.**** Table.zName is the name of the table.  The case of the original** CREATE TABLE statement is stored, but case is not significant for** comparisons.**** Table.nCol is the number of columns in this table.  Table.aCol is a** pointer to an array of Column structures, one for each column.**** If the table has an INTEGER PRIMARY KEY, then Table.iPKey is the index of** the column that is that key.   Otherwise Table.iPKey is negative.  Note** that the datatype of the PRIMARY KEY must be INTEGER for this field to** be set.  An INTEGER PRIMARY KEY is used as the rowid for each row of** the table.  If a table has no INTEGER PRIMARY KEY, then a random rowid** is generated for each row of the table.  Table.hasPrimKey is true if** the table has any PRIMARY KEY, INTEGER or otherwise.**** Table.tnum is the page number for the root BTree page of the table in the** database file.  If Table.iDb is the index of the database table backend** in sqlite.aDb[].  0 is for the main database and 1 is for the file that** holds temporary tables and indices.  If Table.isEphem** is true, then the table is stored in a file that is automatically deleted** when the VDBE cursor to the table is closed.  In this case Table.tnum ** refers VDBE cursor number that holds the table open, not to the root** page number.  Transient tables are used to hold the results of a** sub-query that appears instead of a real table name in the FROM clause ** of a SELECT statement.*/struct Table {  char *zName;     /* Name of the table */  int nCol;        /* Number of columns in this table */  Column *aCol;    /* Information about each column */  int iPKey;       /* If not less then 0, use aCol[iPKey] as the primary key */  Index *pIndex;   /* List of SQL indexes on this table. */  int tnum;        /* Root BTree node for this table (see note above) */  Select *pSelect; /* NULL for tables.  Points to definition if a view. */  int nRef;          /* Number of pointers to this Table */  Trigger *pTrigger; /* List of SQL triggers on this table */  FKey *pFKey;       /* Linked list of all foreign keys in this table */  char *zColAff;     /* String defining the affinity of each column */#ifndef SQLITE_OMIT_CHECK  Expr *pCheck;      /* The AND of all CHECK constraints */#endif#ifndef SQLITE_OMIT_ALTERTABLE  int addColOffset;  /* Offset in CREATE TABLE statement to add a new column */#endif  u8 readOnly;     /* True if this table should not be written by the user */  u8 isEphem;      /* True if created using OP_OpenEphermeral */  u8 hasPrimKey;   /* True if there exists a primary key */  u8 keyConf;      /* What to do in case of uniqueness conflict on iPKey */  u8 autoInc;      /* True if the integer primary key is autoincrement */#ifndef SQLITE_OMIT_VIRTUALTABLE  u8 isVirtual;             /* True if this is a virtual table */  u8 isCommit;              /* True once the CREATE TABLE has been committed */  Module *pMod;             /* Pointer to the implementation of the module */  sqlite3_vtab *pVtab;      /* Pointer to the module instance */  int nModuleArg;           /* Number of arguments to the module */  char **azModuleArg;       /* Text of all module args. [0] is module name */#endif  Schema *pSchema;          /* Schema that contains this table */};/*** Test to see whether or not a table is a virtual table.  This is** done as a macro so that it will be optimized out when virtual** table support is omitted from the build.*/#ifndef SQLITE_OMIT_VIRTUALTABLE#  define IsVirtual(X)      ((X)->isVirtual)#  define IsHiddenColumn(X) ((X)->isHidden)#else#  define IsVirtual(X)      0#  define IsHiddenColumn(X) 0#endif/*** Each foreign key constraint is an instance of the following structure.**** A foreign key is associated with two tables.  The "from" table is** the table that contains the REFERENCES clause that creates the foreign** key.  The "to" table is the table that is named in the REFERENCES clause.** Consider this example:****     CREATE TABLE ex1(**       a INTEGER PRIMARY KEY,**       b INTEGER CONSTRAINT fk1 REFERENCES ex2(x)**     );**** For foreign key "fk1", the from-table is "ex1" and the to-table is "ex2".**** Each REFERENCES clause generates an instance of the following structure** which is attached to the from-table.  The to-table need not exist when** the from-table is created.  The existance of the to-table is not checked

⌨️ 快捷键说明

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