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

📄 sqliteint.h

📁 SQLite is a software library that implements a self-contained, serverless, zero-configuration, trans
💻 H
📖 第 1 页 / 共 5 页
字号:
#endif#ifndef UINT16_TYPE# ifdef HAVE_UINT16_T#  define UINT16_TYPE uint16_t# else#  define UINT16_TYPE unsigned short int# endif#endif#ifndef INT16_TYPE# ifdef HAVE_INT16_T#  define INT16_TYPE int16_t# else#  define INT16_TYPE short int# endif#endif#ifndef UINT8_TYPE# ifdef HAVE_UINT8_T#  define UINT8_TYPE uint8_t# else#  define UINT8_TYPE unsigned char# endif#endif#ifndef INT8_TYPE# ifdef HAVE_INT8_T#  define INT8_TYPE int8_t# else#  define INT8_TYPE signed char# endif#endif#ifndef LONGDOUBLE_TYPE# define LONGDOUBLE_TYPE long double#endiftypedef sqlite_int64 i64;          /* 8-byte signed integer */typedef sqlite_uint64 u64;         /* 8-byte unsigned integer */typedef UINT32_TYPE u32;           /* 4-byte unsigned integer */typedef UINT16_TYPE u16;           /* 2-byte unsigned integer */typedef INT16_TYPE i16;            /* 2-byte signed integer */typedef UINT8_TYPE u8;             /* 1-byte unsigned integer */typedef UINT8_TYPE i8;             /* 1-byte signed integer *//*** Macros to determine whether the machine is big or little endian,** evaluated at runtime.*/#ifdef SQLITE_AMALGAMATIONconst int sqlite3one;#elseextern const int sqlite3one;#endif#if defined(i386) || defined(__i386__) || defined(_M_IX86)# define SQLITE_BIGENDIAN    0# define SQLITE_LITTLEENDIAN 1# define SQLITE_UTF16NATIVE  SQLITE_UTF16LE#else# define SQLITE_BIGENDIAN    (*(char *)(&sqlite3one)==0)# define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)# define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)#endif/*** An instance of the following structure is used to store the busy-handler** callback for a given sqlite handle. **** The sqlite.busyHandler member of the sqlite struct contains the busy** callback for the database handle. Each pager opened via the sqlite** handle is passed a pointer to sqlite.busyHandler. The busy-handler** callback is currently invoked only from within pager.c.*/typedef struct BusyHandler BusyHandler;struct BusyHandler {  int (*xFunc)(void *,int);  /* The busy callback */  void *pArg;                /* First arg to busy callback */  int nBusy;                 /* Incremented with each busy call */};/*** Name of the master database table.  The master database table** is a special table that holds the names and attributes of all** user tables and indices.*/#define MASTER_NAME       "sqlite_master"#define TEMP_MASTER_NAME  "sqlite_temp_master"/*** The root-page of the master database table.*/#define MASTER_ROOT       1/*** The name of the schema table.*/#define SCHEMA_TABLE(x)  ((!OMIT_TEMPDB)&&(x==1)?TEMP_MASTER_NAME:MASTER_NAME)/*** A convenience macro that returns the number of elements in** an array.*/#define ArraySize(X)    (sizeof(X)/sizeof(X[0]))/*** Forward references to structures*/typedef struct AggInfo AggInfo;typedef struct AuthContext AuthContext;typedef struct Bitvec Bitvec;typedef struct CollSeq CollSeq;typedef struct Column Column;typedef struct Db Db;typedef struct Schema Schema;typedef struct Expr Expr;typedef struct ExprList ExprList;typedef struct FKey FKey;typedef struct FuncDef FuncDef;typedef struct IdList IdList;typedef struct Index Index;typedef struct KeyClass KeyClass;typedef struct KeyInfo KeyInfo;typedef struct Module Module;typedef struct NameContext NameContext;typedef struct Parse Parse;typedef struct Select Select;typedef struct SrcList SrcList;typedef struct StrAccum StrAccum;typedef struct Table Table;typedef struct TableLock TableLock;typedef struct Token Token;typedef struct TriggerStack TriggerStack;typedef struct TriggerStep TriggerStep;typedef struct Trigger Trigger;typedef struct WhereInfo WhereInfo;typedef struct WhereLevel WhereLevel;/*** Defer sourcing vdbe.h and btree.h until after the "u8" and ** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque** pointer types (i.e. FuncDef) defined above.*/#include "btree.h"#include "vdbe.h"#include "pager.h"#include "os.h"#include "mutex.h"/*** Each database file to be accessed by the system is an instance** of the following structure.  There are normally two of these structures** in the sqlite.aDb[] array.  aDb[0] is the main database file and** aDb[1] is the database file used to hold temporary tables.  Additional** databases may be attached.*/struct Db {  char *zName;         /* Name of this database */  Btree *pBt;          /* The B*Tree structure for this database file */  u8 inTrans;          /* 0: not writable.  1: Transaction.  2: Checkpoint */  u8 safety_level;     /* How aggressive at synching data to disk */  void *pAux;               /* Auxiliary data.  Usually NULL */  void (*xFreeAux)(void*);  /* Routine to free pAux */  Schema *pSchema;     /* Pointer to database schema (possibly shared) */};/*** An instance of the following structure stores a database schema.**** If there are no virtual tables configured in this schema, the** Schema.db variable is set to NULL. After the first virtual table** has been added, it is set to point to the database connection ** used to create the connection. Once a virtual table has been** added to the Schema structure and the Schema.db variable populated, ** only that database connection may use the Schema to prepare ** statements.*/struct Schema {  int schema_cookie;   /* Database schema version number for this file */  Hash tblHash;        /* All tables indexed by name */  Hash idxHash;        /* All (named) indices indexed by name */  Hash trigHash;       /* All triggers indexed by name */  Hash aFKey;          /* Foreign keys indexed by to-table */  Table *pSeqTab;      /* The sqlite_sequence table used by AUTOINCREMENT */  u8 file_format;      /* Schema format version for this file */  u8 enc;              /* Text encoding used by this database */  u16 flags;           /* Flags associated with this schema */  int cache_size;      /* Number of pages to use in the cache */#ifndef SQLITE_OMIT_VIRTUALTABLE  sqlite3 *db;         /* "Owner" connection. See comment above */#endif};/*** These macros can be used to test, set, or clear bits in the ** Db.flags field.*/#define DbHasProperty(D,I,P)     (((D)->aDb[I].pSchema->flags&(P))==(P))#define DbHasAnyProperty(D,I,P)  (((D)->aDb[I].pSchema->flags&(P))!=0)#define DbSetProperty(D,I,P)     (D)->aDb[I].pSchema->flags|=(P)#define DbClearProperty(D,I,P)   (D)->aDb[I].pSchema->flags&=~(P)/*** Allowed values for the DB.flags field.**** The DB_SchemaLoaded flag is set after the database schema has been** read into internal hash tables.**** DB_UnresetViews means that one or more views have column names that** have been filled out.  If the schema changes, these column names might** changes and so the view will need to be reset.*/#define DB_SchemaLoaded    0x0001  /* The schema has been loaded */#define DB_UnresetViews    0x0002  /* Some views have defined column names */#define DB_Empty           0x0004  /* The file is empty (length 0 bytes) *//*** The number of different kinds of things that can be limited** using the sqlite3_limit() interface.*/#define SQLITE_N_LIMIT (SQLITE_LIMIT_VARIABLE_NUMBER+1)/*** Each database is an instance of the following structure.**** The sqlite.lastRowid records the last insert rowid generated by an** insert statement.  Inserts on views do not affect its value.  Each** trigger has its own context, so that lastRowid can be updated inside** triggers as usual.  The previous value will be restored once the trigger** 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 */  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;#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

⌨️ 快捷键说明

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