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

📄 sqliteint.h

📁 sqlite的最新源码 This ZIP archive contains preprocessed C code for the SQLite library as individual sour
💻 H
📖 第 1 页 / 共 5 页
字号:
#endif/*** GCC does not define the offsetof() macro so we'll have to do it** ourselves.*/#ifndef offsetof#define offsetof(STRUCTURE,FIELD) ((int)((char*)&((STRUCTURE*)0)->FIELD))#endif/*** Check to see if this machine uses EBCDIC.  (Yes, believe it or** not, there are still machines out there that use EBCDIC.)*/#if 'A' == '\301'# define SQLITE_EBCDIC 1#else# define SQLITE_ASCII 1#endif/*** Integers of known sizes.  These typedefs might change for architectures** where the sizes very.  Preprocessor macros are available so that the** types can be conveniently redefined at compile-type.  Like this:****         cc '-DUINTPTR_TYPE=long long int' ...*/#ifndef UINT32_TYPE# ifdef HAVE_UINT32_T#  define UINT32_TYPE uint32_t# else#  define UINT32_TYPE unsigned int# endif#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 INT8_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)\                             || defined(__x86_64) || defined(__x86_64__)# 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/*** Constants for the largest and smallest possible 64-bit signed integers.** These macros are designed to work correctly on both 32-bit and 64-bit** compilers.*/#define LARGEST_INT64  (0xffffffff|(((i64)0x7fffffff)<<32))#define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64)/*** 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)    ((int)(sizeof(X)/sizeof(X[0])))/*** The following value as a destructor means to use sqlite3DbFree().** This is an internal extension to SQLITE_STATIC and SQLITE_TRANSIENT.*/#define SQLITE_DYNAMIC   ((sqlite3_destructor_type)sqlite3DbFree)/*** When SQLITE_OMIT_WSD is defined, it means that the target platform does** not support Writable Static Data (WSD) such as global and static variables.** All variables must either be on the stack or dynamically allocated from** the heap.  When WSD is unsupported, the variable declarations scattered** throughout the SQLite code must become constants instead.  The SQLITE_WSD** macro is used for this purpose.  And instead of referencing the variable** directly, we use its constant as a key to lookup the run-time allocated** buffer that holds real variable.  The constant is also the initializer** for the run-time allocated buffer.**** In the usual case where WSD is supported, the SQLITE_WSD and GLOBAL** macros become no-ops and have zero performance impact.*/#ifdef SQLITE_OMIT_WSD  #define SQLITE_WSD const  #define GLOBAL(t,v) (*(t*)sqlite3_wsd_find((void*)&(v), sizeof(v)))  #define sqlite3GlobalConfig GLOBAL(struct Sqlite3Config, sqlite3Config)  int sqlite3_wsd_init(int N, int J);  void *sqlite3_wsd_find(void *K, int L);#else  #define SQLITE_WSD   #define GLOBAL(t,v) v  #define sqlite3GlobalConfig sqlite3Config#endif/*** The following macros are used to suppress compiler warnings and to** make it clear to human readers when a function parameter is deliberately ** left unused within the body of a function. This usually happens when** a function is called via a function pointer. For example the ** implementation of an SQL aggregate step callback may not use the** parameter indicating the number of arguments passed to the aggregate,** if it knows that this is enforced elsewhere.**** When a function parameter is not used at all within the body of a function,** it is generally named "NotUsed" or "NotUsed2" to make things even clearer.** However, these macros may also be used to suppress warnings related to** parameters that may or may not be used depending on compilation options.** For example those parameters only used in assert() statements. In these** cases the parameters are named as per the usual conventions.*/#define UNUSED_PARAMETER(x) (void)(x)#define UNUSED_PARAMETER2(x,y) UNUSED_PARAMETER(x),UNUSED_PARAMETER(y)/*** 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 FuncDefHash FuncDefHash;typedef struct IdList IdList;typedef struct Index Index;typedef struct KeyClass KeyClass;typedef struct KeyInfo KeyInfo;typedef struct Lookaside Lookaside;typedef struct LookasideSlot LookasideSlot;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 UnpackedRecord UnpackedRecord;typedef struct Walker Walker;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 "pcache.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.*/

⌨️ 快捷键说明

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