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

📄 sqliteint.h

📁 sqlite-3.4.1,嵌入式数据库.是一个功能强大的开源数据库,给学习和研发以及小型公司的发展带来了全所未有的好处.
💻 H
📖 第 1 页 / 共 5 页
字号:
/*** 2001 September 15**** The author disclaims copyright to this source code.  In place of** a legal notice, here is a blessing:****    May you do good and not evil.**    May you find forgiveness for yourself and forgive others.**    May you share freely, never taking more than you give.***************************************************************************** Internal interface definitions for SQLite.**** @(#) $Id: sqliteInt.h,v 1.578 2007/06/26 10:38:55 danielk1977 Exp $*/#ifndef _SQLITEINT_H_#define _SQLITEINT_H_#include "sqliteLimit.h"#if defined(SQLITE_TCL) || defined(TCLSH)# include <tcl.h>#endif/*** Many people are failing to set -DNDEBUG=1 when compiling SQLite.** Setting NDEBUG makes the code smaller and run faster.  So the following** lines are added to automatically set NDEBUG unless the -DSQLITE_DEBUG=1** option is set.  Thus NDEBUG becomes an opt-in rather than an opt-out** feature.*/#if !defined(NDEBUG) && !defined(SQLITE_DEBUG) # define NDEBUG 1#endif/*** These #defines should enable >2GB file support on Posix if the** underlying operating system supports it.  If the OS lacks** large file support, or if the OS is windows, these should be no-ops.**** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch** on the compiler command line.  This is necessary if you are compiling** on a recent machine (ex: RedHat 7.2) but you want your code to work** on an older machine (ex: RedHat 6.0).  If you compile on RedHat 7.2** without this option, LFS is enable.  But LFS does not exist in the kernel** in RedHat 6.0, so the code won't work.  Hence, for maximum binary** portability you should omit LFS.**** Similar is true for MacOS.  LFS is only supported on MacOS 9 and later.*/#ifndef SQLITE_DISABLE_LFS# define _LARGE_FILE       1# ifndef _FILE_OFFSET_BITS#   define _FILE_OFFSET_BITS 64# endif# define _LARGEFILE_SOURCE 1#endif#include "sqlite3.h"#include "hash.h"#include "parse.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <assert.h>#include <stddef.h>#define sqlite3_isnan(X)  ((X)!=(X))/*** If compiling for a processor that lacks floating point support,** substitute integer for floating-point*/#ifdef SQLITE_OMIT_FLOATING_POINT# define double sqlite_int64# define LONGDOUBLE_TYPE sqlite_int64# ifndef SQLITE_BIG_DBL#   define SQLITE_BIG_DBL (0x7fffffffffffffff)# endif# define SQLITE_OMIT_DATETIME_FUNCS 1# define SQLITE_OMIT_TRACE 1# undef SQLITE_MIXED_ENDIAN_64BIT_FLOAT#endif#ifndef SQLITE_BIG_DBL# define SQLITE_BIG_DBL (1e99)#endif/*** OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0** afterward. Having this macro allows us to cause the C compiler ** to omit code used by TEMP tables without messy #ifndef statements.*/#ifdef SQLITE_OMIT_TEMPDB#define OMIT_TEMPDB 1#else#define OMIT_TEMPDB 0#endif/*** If the following macro is set to 1, then NULL values are considered** distinct when determining whether or not two entries are the same** in a UNIQUE index.  This is the way PostgreSQL, Oracle, DB2, MySQL,** OCELOT, and Firebird all work.  The SQL92 spec explicitly says this** is the way things are suppose to work.**** If the following macro is set to 0, the NULLs are indistinct for** a UNIQUE index.  In this mode, you can only have a single NULL entry** for a column declared UNIQUE.  This is the way Informix and SQL Server** work.*/#define NULL_DISTINCT_FOR_UNIQUE 1/*** The "file format" number is an integer that is incremented whenever** the VDBE-level file format changes.  The following macros define the** the default file format for new databases and the maximum file format** that the library can read.*/#define SQLITE_MAX_FILE_FORMAT 4#ifndef SQLITE_DEFAULT_FILE_FORMAT# define SQLITE_DEFAULT_FILE_FORMAT 1#endif/*** Provide a default value for TEMP_STORE in case it is not specified** on the command-line*/#ifndef TEMP_STORE# define TEMP_STORE 1#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# define UINT32_TYPE unsigned int#endif#ifndef UINT16_TYPE# define UINT16_TYPE unsigned short int#endif#ifndef INT16_TYPE# define INT16_TYPE short int#endif#ifndef UINT8_TYPE# define UINT8_TYPE unsigned char#endif#ifndef INT8_TYPE# define INT8_TYPE signed char#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.*/extern const int sqlite3one;#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 */};/*** Defer sourcing vdbe.h and btree.h until after the "u8" and ** "BusyHandler typedefs.*/#include "vdbe.h"#include "btree.h"#include "pager.h"#ifdef SQLITE_MEMDEBUG/*** The following global variables are used for testing and debugging** only.  They only work if SQLITE_MEMDEBUG is defined.*/extern int sqlite3_nMalloc;      /* Number of sqliteMalloc() calls */extern int sqlite3_nFree;        /* Number of sqliteFree() calls */extern int sqlite3_iMallocFail;  /* Fail sqliteMalloc() after this many calls */extern int sqlite3_iMallocReset; /* Set iMallocFail to this when it reaches 0 */extern void *sqlite3_pFirst;         /* Pointer to linked list of allocations */extern int sqlite3_nMaxAlloc;        /* High water mark of ThreadData.nAlloc */extern int sqlite3_mallocDisallowed; /* assert() in sqlite3Malloc() if set */extern int sqlite3_isFail;           /* True if all malloc calls should fail */extern const char *sqlite3_zFile;    /* Filename to associate debug info with */extern int sqlite3_iLine;            /* Line number for debug info */#define ENTER_MALLOC (sqlite3_zFile = __FILE__, sqlite3_iLine = __LINE__)#define sqliteMalloc(x)          (ENTER_MALLOC, sqlite3Malloc(x,1))#define sqliteMallocRaw(x)       (ENTER_MALLOC, sqlite3MallocRaw(x,1))#define sqliteRealloc(x,y)       (ENTER_MALLOC, sqlite3Realloc(x,y))#define sqliteStrDup(x)          (ENTER_MALLOC, sqlite3StrDup(x))#define sqliteStrNDup(x,y)       (ENTER_MALLOC, sqlite3StrNDup(x,y))#define sqliteReallocOrFree(x,y) (ENTER_MALLOC, sqlite3ReallocOrFree(x,y))#else#define ENTER_MALLOC 0#define sqliteMalloc(x)          sqlite3Malloc(x,1)#define sqliteMallocRaw(x)       sqlite3MallocRaw(x,1)#define sqliteRealloc(x,y)       sqlite3Realloc(x,y)#define sqliteStrDup(x)          sqlite3StrDup(x)#define sqliteStrNDup(x,y)       sqlite3StrNDup(x,y)#define sqliteReallocOrFree(x,y) sqlite3ReallocOrFree(x,y)#endif/* Variable sqlite3_mallocHasFailed is set to true after a malloc() ** failure occurs. **** The sqlite3MallocFailed() macro returns true if a malloc has failed** in this thread since the last call to sqlite3ApiExit(), or false ** otherwise.*/extern int sqlite3_mallocHasFailed;#define sqlite3MallocFailed() (sqlite3_mallocHasFailed && sqlite3OsInMutex(1))#define sqliteFree(x)          sqlite3FreeX(x)#define sqliteAllocSize(x)     sqlite3AllocSize(x)/*** An instance of this structure might be allocated to store information** specific to a single thread.*/struct ThreadData {  int dummy;               /* So that this structure is never empty */#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT  int nSoftHeapLimit;      /* Suggested max mem allocation.  No limit if <0 */  int nAlloc;              /* Number of bytes currently allocated */  Pager *pPager;           /* Linked list of all pagers in this thread */#endif#ifndef SQLITE_OMIT_SHARED_CACHE  u8 useSharedData;        /* True if shared pagers and schemas are enabled */  BtShared *pBtree;        /* Linked list of all currently open BTrees */#endif};/*

⌨️ 快捷键说明

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