lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | #ifndef _SQLITE3_H_ |
| 2 | #define _SQLITE3_H_ |
| 3 | #include <stdarg.h> |
| 4 | |
| 5 | #ifdef __cplusplus |
| 6 | extern "C" { |
| 7 | #endif |
| 8 | |
| 9 | |
| 10 | #ifndef SQLITE_EXTERN |
| 11 | # define SQLITE_EXTERN extern |
| 12 | #endif |
| 13 | |
| 14 | #ifndef SQLITE_API |
| 15 | # define SQLITE_API |
| 16 | #endif |
| 17 | |
| 18 | |
| 19 | #define SQLITE_DEPRECATED |
| 20 | #define SQLITE_EXPERIMENTAL |
| 21 | |
| 22 | |
| 23 | #ifdef SQLITE_VERSION |
| 24 | # undef SQLITE_VERSION |
| 25 | #endif |
| 26 | #ifdef SQLITE_VERSION_NUMBER |
| 27 | # undef SQLITE_VERSION_NUMBER |
| 28 | #endif |
| 29 | |
| 30 | #define SQLITE_VERSION "3.7.10" |
| 31 | #define SQLITE_VERSION_NUMBER 3007010 |
| 32 | #define SQLITE_SOURCE_ID "2012-01-16 13:28:40 ebd01a8deffb5024a5d7494eef800d2366d97204" |
| 33 | |
| 34 | SQLITE_API SQLITE_EXTERN const char sqlite3_version[]; |
| 35 | SQLITE_API const char *sqlite3_libversion(void); |
| 36 | SQLITE_API const char *sqlite3_sourceid(void); |
| 37 | SQLITE_API int sqlite3_libversion_number(void); |
| 38 | |
| 39 | #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS |
| 40 | SQLITE_API int sqlite3_compileoption_used(const char *zOptName); |
| 41 | SQLITE_API const char *sqlite3_compileoption_get(int N); |
| 42 | #endif |
| 43 | |
| 44 | SQLITE_API int sqlite3_threadsafe(void); |
| 45 | |
| 46 | typedef struct sqlite3 sqlite3; |
| 47 | |
| 48 | #ifdef SQLITE_INT64_TYPE |
| 49 | typedef SQLITE_INT64_TYPE sqlite_int64; |
| 50 | typedef unsigned SQLITE_INT64_TYPE sqlite_uint64; |
| 51 | #elif defined(_MSC_VER) || defined(__BORLANDC__) |
| 52 | typedef __int64 sqlite_int64; |
| 53 | typedef unsigned __int64 sqlite_uint64; |
| 54 | #else |
| 55 | typedef long long int sqlite_int64; |
| 56 | typedef unsigned long long int sqlite_uint64; |
| 57 | #endif |
| 58 | typedef sqlite_int64 sqlite3_int64; |
| 59 | typedef sqlite_uint64 sqlite3_uint64; |
| 60 | |
| 61 | |
| 62 | #ifdef SQLITE_OMIT_FLOATING_POINT |
| 63 | # define double sqlite3_int64 |
| 64 | #endif |
| 65 | |
| 66 | SQLITE_API int sqlite3_close(sqlite3 *); |
| 67 | |
| 68 | typedef int (*sqlite3_callback)(void*,int,char**, char**); |
| 69 | |
| 70 | SQLITE_API int sqlite3_exec( |
| 71 | sqlite3*, /* An open database */ |
| 72 | const char *sql, /* SQL to be evaluated */ |
| 73 | int (*callback)(void*,int,char**,char**), /* Callback function */ |
| 74 | void *, /* 1st argument to callback */ |
| 75 | char **errmsg /* Error msg written here */ |
| 76 | ); |
| 77 | |
| 78 | |
| 79 | typedef struct sqlite3_file sqlite3_file; |
| 80 | struct sqlite3_file { |
| 81 | const struct sqlite3_io_methods *pMethods; /* Methods for an open file */ |
| 82 | }; |
| 83 | |
| 84 | #define SQLITE_OK 0 /* Successful result */ |
| 85 | /* beginning-of-error-codes */ |
| 86 | #define SQLITE_ERROR 1 /* SQL error or missing database */ |
| 87 | #define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */ |
| 88 | #define SQLITE_PERM 3 /* Access permission denied */ |
| 89 | #define SQLITE_ABORT 4 /* Callback routine requested an abort */ |
| 90 | #define SQLITE_BUSY 5 /* The database file is locked */ |
| 91 | #define SQLITE_LOCKED 6 /* A table in the database is locked */ |
| 92 | #define SQLITE_NOMEM 7 /* A malloc() failed */ |
| 93 | #define SQLITE_READONLY 8 /* Attempt to write a readonly database */ |
| 94 | #define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/ |
| 95 | #define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */ |
| 96 | #define SQLITE_CORRUPT 11 /* The database disk image is malformed */ |
| 97 | #define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */ |
| 98 | #define SQLITE_FULL 13 /* Insertion failed because database is full */ |
| 99 | #define SQLITE_CANTOPEN 14 /* Unable to open the database file */ |
| 100 | #define SQLITE_PROTOCOL 15 /* Database lock protocol error */ |
| 101 | #define SQLITE_EMPTY 16 /* Database is empty */ |
| 102 | #define SQLITE_SCHEMA 17 /* The database schema changed */ |
| 103 | #define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */ |
| 104 | #define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */ |
| 105 | #define SQLITE_MISMATCH 20 /* Data type mismatch */ |
| 106 | #define SQLITE_MISUSE 21 /* Library used incorrectly */ |
| 107 | #define SQLITE_NOLFS 22 /* Uses OS features not supported on host */ |
| 108 | #define SQLITE_AUTH 23 /* Authorization denied */ |
| 109 | #define SQLITE_FORMAT 24 /* Auxiliary database format error */ |
| 110 | #define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */ |
| 111 | #define SQLITE_NOTADB 26 /* File opened that is not a database file */ |
| 112 | |
| 113 | #define SQLITE_ROW 100 /* sqlite3_step() has another row ready */ |
| 114 | #define SQLITE_DONE 101 /* sqlite3_step() has finished executing */ |
| 115 | /* end-of-error-codes */ |
| 116 | |
| 117 | #define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */ |
| 118 | #define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */ |
| 119 | #define SQLITE_OPEN_CREATE 0x00000004 /* Ok for sqlite3_open_v2() */ |
| 120 | #define SQLITE_OPEN_DELETEONCLOSE 0x00000008 /* VFS only */ |
| 121 | #define SQLITE_OPEN_EXCLUSIVE 0x00000010 /* VFS only */ |
| 122 | #define SQLITE_OPEN_AUTOPROXY 0x00000020 /* VFS only */ |
| 123 | #define SQLITE_OPEN_URI 0x00000040 /* Ok for sqlite3_open_v2() */ |
| 124 | #define SQLITE_OPEN_MAIN_DB 0x00000100 /* VFS only */ |
| 125 | #define SQLITE_OPEN_TEMP_DB 0x00000200 /* VFS only */ |
| 126 | #define SQLITE_OPEN_TRANSIENT_DB 0x00000400 /* VFS only */ |
| 127 | #define SQLITE_OPEN_MAIN_JOURNAL 0x00000800 /* VFS only */ |
| 128 | #define SQLITE_OPEN_TEMP_JOURNAL 0x00001000 /* VFS only */ |
| 129 | #define SQLITE_OPEN_SUBJOURNAL 0x00002000 /* VFS only */ |
| 130 | #define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 /* VFS only */ |
| 131 | #define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */ |
| 132 | #define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */ |
| 133 | #define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */ |
| 134 | #define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */ |
| 135 | #define SQLITE_OPEN_WAL 0x00080000 /* VFS only */ |
| 136 | |
| 137 | #define SQLITE_IOCAP_ATOMIC 0x00000001 |
| 138 | #define SQLITE_IOCAP_ATOMIC512 0x00000002 |
| 139 | #define SQLITE_IOCAP_ATOMIC1K 0x00000004 |
| 140 | #define SQLITE_IOCAP_ATOMIC2K 0x00000008 |
| 141 | #define SQLITE_IOCAP_ATOMIC4K 0x00000010 |
| 142 | #define SQLITE_IOCAP_ATOMIC8K 0x00000020 |
| 143 | #define SQLITE_IOCAP_ATOMIC16K 0x00000040 |
| 144 | #define SQLITE_IOCAP_ATOMIC32K 0x00000080 |
| 145 | #define SQLITE_IOCAP_ATOMIC64K 0x00000100 |
| 146 | #define SQLITE_IOCAP_SAFE_APPEND 0x00000200 |
| 147 | #define SQLITE_IOCAP_SEQUENTIAL 0x00000400 |
| 148 | #define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800 |
| 149 | #define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000 |
| 150 | |
| 151 | #define SQLITE_LOCK_NONE 0 |
| 152 | #define SQLITE_LOCK_SHARED 1 |
| 153 | #define SQLITE_LOCK_RESERVED 2 |
| 154 | #define SQLITE_LOCK_PENDING 3 |
| 155 | #define SQLITE_LOCK_EXCLUSIVE 4 |
| 156 | |
| 157 | #define SQLITE_SYNC_NORMAL 0x00002 |
| 158 | #define SQLITE_SYNC_FULL 0x00003 |
| 159 | #define SQLITE_SYNC_DATAONLY 0x00010 |
| 160 | |
| 161 | |
| 162 | #define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8)) |
| 163 | #define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8)) |
| 164 | #define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8)) |
| 165 | #define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8)) |
| 166 | #define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8)) |
| 167 | #define SQLITE_IOERR_TRUNCATE (SQLITE_IOERR | (6<<8)) |
| 168 | #define SQLITE_IOERR_FSTAT (SQLITE_IOERR | (7<<8)) |
| 169 | #define SQLITE_IOERR_UNLOCK (SQLITE_IOERR | (8<<8)) |
| 170 | #define SQLITE_IOERR_RDLOCK (SQLITE_IOERR | (9<<8)) |
| 171 | #define SQLITE_IOERR_DELETE (SQLITE_IOERR | (10<<8)) |
| 172 | #define SQLITE_IOERR_BLOCKED (SQLITE_IOERR | (11<<8)) |
| 173 | #define SQLITE_IOERR_NOMEM (SQLITE_IOERR | (12<<8)) |
| 174 | #define SQLITE_IOERR_ACCESS (SQLITE_IOERR | (13<<8)) |
| 175 | #define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8)) |
| 176 | #define SQLITE_IOERR_LOCK (SQLITE_IOERR | (15<<8)) |
| 177 | #define SQLITE_IOERR_CLOSE (SQLITE_IOERR | (16<<8)) |
| 178 | #define SQLITE_IOERR_DIR_CLOSE (SQLITE_IOERR | (17<<8)) |
| 179 | #define SQLITE_IOERR_SHMOPEN (SQLITE_IOERR | (18<<8)) |
| 180 | #define SQLITE_IOERR_SHMSIZE (SQLITE_IOERR | (19<<8)) |
| 181 | #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) |
| 182 | #define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8)) |
| 183 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 184 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 185 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 186 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 187 | #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) |
| 188 | #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) |
| 189 | #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) |
| 190 | |
| 191 | |
| 192 | typedef struct sqlite3_io_methods sqlite3_io_methods; |
| 193 | struct sqlite3_io_methods { |
| 194 | int iVersion; |
| 195 | int (*xClose)(sqlite3_file*); |
| 196 | int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst); |
| 197 | int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst); |
| 198 | int (*xTruncate)(sqlite3_file*, sqlite3_int64 size); |
| 199 | int (*xSync)(sqlite3_file*, int flags); |
| 200 | int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize); |
| 201 | int (*xLock)(sqlite3_file*, int); |
| 202 | int (*xUnlock)(sqlite3_file*, int); |
| 203 | int (*xCheckReservedLock)(sqlite3_file*, int *pResOut); |
| 204 | int (*xFileControl)(sqlite3_file*, int op, void *pArg); |
| 205 | int (*xSectorSize)(sqlite3_file*); |
| 206 | int (*xDeviceCharacteristics)(sqlite3_file*); |
| 207 | /* Methods above are valid for version 1 */ |
| 208 | int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**); |
| 209 | int (*xShmLock)(sqlite3_file*, int offset, int n, int flags); |
| 210 | void (*xShmBarrier)(sqlite3_file*); |
| 211 | int (*xShmUnmap)(sqlite3_file*, int deleteFlag); |
| 212 | /* Methods above are valid for version 2 */ |
| 213 | /* Additional methods may be added in future releases */ |
| 214 | }; |
| 215 | |
| 216 | typedef struct sqlite3_mutex sqlite3_mutex; |
| 217 | |
| 218 | #define SQLITE_FCNTL_LOCKSTATE 1 |
| 219 | #define SQLITE_GET_LOCKPROXYFILE 2 |
| 220 | #define SQLITE_SET_LOCKPROXYFILE 3 |
| 221 | #define SQLITE_LAST_ERRNO 4 |
| 222 | #define SQLITE_FCNTL_SIZE_HINT 5 |
| 223 | #define SQLITE_FCNTL_CHUNK_SIZE 6 |
| 224 | #define SQLITE_FCNTL_FILE_POINTER 7 |
| 225 | #define SQLITE_FCNTL_SYNC_OMITTED 8 |
| 226 | #define SQLITE_FCNTL_WIN32_AV_RETRY 9 |
| 227 | #define SQLITE_FCNTL_PERSIST_WAL 10 |
| 228 | #define SQLITE_FCNTL_OVERWRITE 11 |
| 229 | #define SQLITE_FCNTL_VFSNAME 12 |
| 230 | #define SQLITE_FCNTL_POWERSAFE_OVERWRITE 13 |
| 231 | |
| 232 | |
| 233 | typedef struct sqlite3_vfs sqlite3_vfs; |
| 234 | typedef void (*sqlite3_syscall_ptr)(void); |
| 235 | struct sqlite3_vfs { |
| 236 | int iVersion; /* Structure version number (currently 3) */ |
| 237 | int szOsFile; /* Size of subclassed sqlite3_file */ |
| 238 | int mxPathname; /* Maximum file pathname length */ |
| 239 | sqlite3_vfs *pNext; /* Next registered VFS */ |
| 240 | const char *zName; /* Name of this virtual file system */ |
| 241 | void *pAppData; /* Pointer to application-specific data */ |
| 242 | int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*, |
| 243 | int flags, int *pOutFlags); |
| 244 | int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir); |
| 245 | int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut); |
| 246 | int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut); |
| 247 | void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename); |
| 248 | void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg); |
| 249 | void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void); |
| 250 | void (*xDlClose)(sqlite3_vfs*, void*); |
| 251 | int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut); |
| 252 | int (*xSleep)(sqlite3_vfs*, int microseconds); |
| 253 | int (*xCurrentTime)(sqlite3_vfs*, double*); |
| 254 | int (*xGetLastError)(sqlite3_vfs*, int, char *); |
| 255 | /* |
| 256 | ** The methods above are in version 1 of the sqlite_vfs object |
| 257 | ** definition. Those that follow are added in version 2 or later |
| 258 | */ |
| 259 | int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*); |
| 260 | /* |
| 261 | ** The methods above are in versions 1 and 2 of the sqlite_vfs object. |
| 262 | ** Those below are for version 3 and greater. |
| 263 | */ |
| 264 | int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, sqlite3_syscall_ptr); |
| 265 | sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char *zName); |
| 266 | const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName); |
| 267 | /* |
| 268 | ** The methods above are in versions 1 through 3 of the sqlite_vfs object. |
| 269 | ** New fields may be appended in figure versions. The iVersion |
| 270 | ** value will increment whenever this happens. |
| 271 | */ |
| 272 | }; |
| 273 | |
| 274 | |
| 275 | #define SQLITE_ACCESS_EXISTS 0 |
| 276 | #define SQLITE_ACCESS_READWRITE 1 /* Used by PRAGMA temp_store_directory */ |
| 277 | #define SQLITE_ACCESS_READ 2 /* Unused */ |
| 278 | |
| 279 | #define SQLITE_SHM_UNLOCK 1 |
| 280 | #define SQLITE_SHM_LOCK 2 |
| 281 | #define SQLITE_SHM_SHARED 4 |
| 282 | #define SQLITE_SHM_EXCLUSIVE 8 |
| 283 | |
| 284 | #define SQLITE_SHM_NLOCK 8 |
| 285 | |
| 286 | typedef struct sqlite3_mem_methods sqlite3_mem_methods; |
| 287 | struct sqlite3_mem_methods { |
| 288 | void *(*xMalloc)(int); /* Memory allocation function */ |
| 289 | void (*xFree)(void*); /* Free a prior allocation */ |
| 290 | void *(*xRealloc)(void*,int); /* Resize an allocation */ |
| 291 | int (*xSize)(void*); /* Return the size of an allocation */ |
| 292 | int (*xRoundup)(int); /* Round up request size to allocation size */ |
| 293 | int (*xInit)(void*); /* Initialize the memory allocator */ |
| 294 | void (*xShutdown)(void*); /* Deinitialize the memory allocator */ |
| 295 | void *pAppData; /* Argument to xInit() and xShutdown() */ |
| 296 | }; |
| 297 | |
| 298 | SQLITE_API int sqlite3_initialize(void); |
| 299 | SQLITE_API int sqlite3_shutdown(void); |
| 300 | SQLITE_API int sqlite3_os_init(void); |
| 301 | SQLITE_API int sqlite3_os_end(void); |
| 302 | SQLITE_API int sqlite3_config(int, ...); |
| 303 | SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...); |
| 304 | |
| 305 | |
| 306 | #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ |
| 307 | #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */ |
| 308 | #define SQLITE_CONFIG_SERIALIZED 3 /* nil */ |
| 309 | #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ |
| 310 | #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ |
| 311 | #define SQLITE_CONFIG_SCRATCH 6 /* void*, int sz, int N */ |
| 312 | #define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */ |
| 313 | #define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */ |
| 314 | #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */ |
| 315 | #define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */ |
| 316 | #define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */ |
| 317 | /* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ |
| 318 | #define SQLITE_CONFIG_LOOKASIDE 13 /* int int */ |
| 319 | #define SQLITE_CONFIG_PCACHE 14 /* no-op */ |
| 320 | #define SQLITE_CONFIG_GETPCACHE 15 /* no-op */ |
| 321 | #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */ |
| 322 | #define SQLITE_CONFIG_URI 17 /* int */ |
| 323 | #define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */ |
| 324 | #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */ |
| 325 | |
| 326 | #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ |
| 327 | #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ |
| 328 | #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ |
| 329 | |
| 330 | #define SQLITE_DENY 1 /* Abort the SQL statement with an error */ |
| 331 | #define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error */ |
| 332 | |
| 333 | SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff); |
| 334 | SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*); |
| 335 | SQLITE_API int sqlite3_changes(sqlite3*); |
| 336 | SQLITE_API int sqlite3_total_changes(sqlite3*); |
| 337 | SQLITE_API void sqlite3_interrupt(sqlite3*); |
| 338 | SQLITE_API int sqlite3_complete(const char *sql); |
| 339 | SQLITE_API int sqlite3_complete16(const void *sql); |
| 340 | SQLITE_API int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*); |
| 341 | SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms); |
| 342 | SQLITE_API int sqlite3_get_table( |
| 343 | sqlite3 *db, /* An open database */ |
| 344 | const char *zSql, /* SQL to be evaluated */ |
| 345 | char ***pazResult, /* Results of the query */ |
| 346 | int *pnRow, /* Number of result rows written here */ |
| 347 | int *pnColumn, /* Number of result columns written here */ |
| 348 | char **pzErrmsg /* Error msg written here */ |
| 349 | ); |
| 350 | SQLITE_API void sqlite3_free_table(char **result); |
| 351 | SQLITE_API char *sqlite3_mprintf(const char*,...); |
| 352 | SQLITE_API char *sqlite3_vmprintf(const char*, va_list); |
| 353 | SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...); |
| 354 | SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list); |
| 355 | |
| 356 | SQLITE_API void *sqlite3_malloc(int); |
| 357 | SQLITE_API void *sqlite3_realloc(void*, int); |
| 358 | SQLITE_API void sqlite3_free(void*); |
| 359 | SQLITE_API sqlite3_int64 sqlite3_memory_used(void); |
| 360 | SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag); |
| 361 | SQLITE_API void sqlite3_randomness(int N, void *P); |
| 362 | |
| 363 | SQLITE_API int sqlite3_set_authorizer( |
| 364 | sqlite3*, |
| 365 | int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), |
| 366 | void *pUserData |
| 367 | ); |
| 368 | |
| 369 | #define SQLITE_CREATE_INDEX 1 /* Index Name Table Name */ |
| 370 | #define SQLITE_CREATE_TABLE 2 /* Table Name NULL */ |
| 371 | #define SQLITE_CREATE_TEMP_INDEX 3 /* Index Name Table Name */ |
| 372 | #define SQLITE_CREATE_TEMP_TABLE 4 /* Table Name NULL */ |
| 373 | #define SQLITE_CREATE_TEMP_TRIGGER 5 /* Trigger Name Table Name */ |
| 374 | #define SQLITE_CREATE_TEMP_VIEW 6 /* View Name NULL */ |
| 375 | #define SQLITE_CREATE_TRIGGER 7 /* Trigger Name Table Name */ |
| 376 | #define SQLITE_CREATE_VIEW 8 /* View Name NULL */ |
| 377 | #define SQLITE_DELETE 9 /* Table Name NULL */ |
| 378 | #define SQLITE_DROP_INDEX 10 /* Index Name Table Name */ |
| 379 | #define SQLITE_DROP_TABLE 11 /* Table Name NULL */ |
| 380 | #define SQLITE_DROP_TEMP_INDEX 12 /* Index Name Table Name */ |
| 381 | #define SQLITE_DROP_TEMP_TABLE 13 /* Table Name NULL */ |
| 382 | #define SQLITE_DROP_TEMP_TRIGGER 14 /* Trigger Name Table Name */ |
| 383 | #define SQLITE_DROP_TEMP_VIEW 15 /* View Name NULL */ |
| 384 | #define SQLITE_DROP_TRIGGER 16 /* Trigger Name Table Name */ |
| 385 | #define SQLITE_DROP_VIEW 17 /* View Name NULL */ |
| 386 | #define SQLITE_INSERT 18 /* Table Name NULL */ |
| 387 | #define SQLITE_PRAGMA 19 /* Pragma Name 1st arg or NULL */ |
| 388 | #define SQLITE_READ 20 /* Table Name Column Name */ |
| 389 | #define SQLITE_SELECT 21 /* NULL NULL */ |
| 390 | #define SQLITE_TRANSACTION 22 /* Operation NULL */ |
| 391 | #define SQLITE_UPDATE 23 /* Table Name Column Name */ |
| 392 | #define SQLITE_ATTACH 24 /* Filename NULL */ |
| 393 | #define SQLITE_DETACH 25 /* Database Name NULL */ |
| 394 | #define SQLITE_ALTER_TABLE 26 /* Database Name Table Name */ |
| 395 | #define SQLITE_REINDEX 27 /* Index Name NULL */ |
| 396 | #define SQLITE_ANALYZE 28 /* Table Name NULL */ |
| 397 | #define SQLITE_CREATE_VTABLE 29 /* Table Name Module Name */ |
| 398 | #define SQLITE_DROP_VTABLE 30 /* Table Name Module Name */ |
| 399 | #define SQLITE_FUNCTION 31 /* NULL Function Name */ |
| 400 | #define SQLITE_SAVEPOINT 32 /* Operation Savepoint Name */ |
| 401 | #define SQLITE_COPY 0 /* No longer used */ |
| 402 | |
| 403 | typedef struct sqlite3_stmt sqlite3_stmt; |
| 404 | |
| 405 | SQLITE_API void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); |
| 406 | SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*, |
| 407 | void(*xProfile)(void*,const char*,sqlite3_uint64), void*); |
| 408 | SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); |
| 409 | |
| 410 | SQLITE_API int sqlite3_open( |
| 411 | const char *filename, /* Database filename (UTF-8) */ |
| 412 | sqlite3 **ppDb /* OUT: SQLite db handle */ |
| 413 | ); |
| 414 | SQLITE_API int sqlite3_open16( |
| 415 | const void *filename, /* Database filename (UTF-16) */ |
| 416 | sqlite3 **ppDb /* OUT: SQLite db handle */ |
| 417 | ); |
| 418 | SQLITE_API int sqlite3_open_v2( |
| 419 | const char *filename, /* Database filename (UTF-8) */ |
| 420 | sqlite3 **ppDb, /* OUT: SQLite db handle */ |
| 421 | int flags, /* Flags */ |
| 422 | const char *zVfs /* Name of VFS module to use */ |
| 423 | ); |
| 424 | |
| 425 | SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam); |
| 426 | SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault); |
| 427 | SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64); |
| 428 | |
| 429 | SQLITE_API int sqlite3_errcode(sqlite3 *db); |
| 430 | SQLITE_API int sqlite3_extended_errcode(sqlite3 *db); |
| 431 | SQLITE_API const char *sqlite3_errmsg(sqlite3*); |
| 432 | SQLITE_API const void *sqlite3_errmsg16(sqlite3*); |
| 433 | |
| 434 | SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); |
| 435 | |
| 436 | #define SQLITE_LIMIT_LENGTH 0 |
| 437 | #define SQLITE_LIMIT_SQL_LENGTH 1 |
| 438 | #define SQLITE_LIMIT_COLUMN 2 |
| 439 | #define SQLITE_LIMIT_EXPR_DEPTH 3 |
| 440 | #define SQLITE_LIMIT_COMPOUND_SELECT 4 |
| 441 | #define SQLITE_LIMIT_VDBE_OP 5 |
| 442 | #define SQLITE_LIMIT_FUNCTION_ARG 6 |
| 443 | #define SQLITE_LIMIT_ATTACHED 7 |
| 444 | #define SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8 |
| 445 | #define SQLITE_LIMIT_VARIABLE_NUMBER 9 |
| 446 | #define SQLITE_LIMIT_TRIGGER_DEPTH 10 |
| 447 | |
| 448 | SQLITE_API int sqlite3_prepare( |
| 449 | sqlite3 *db, /* Database handle */ |
| 450 | const char *zSql, /* SQL statement, UTF-8 encoded */ |
| 451 | int nByte, /* Maximum length of zSql in bytes. */ |
| 452 | sqlite3_stmt **ppStmt, /* OUT: Statement handle */ |
| 453 | const char **pzTail /* OUT: Pointer to unused portion of zSql */ |
| 454 | ); |
| 455 | SQLITE_API int sqlite3_prepare_v2( |
| 456 | sqlite3 *db, /* Database handle */ |
| 457 | const char *zSql, /* SQL statement, UTF-8 encoded */ |
| 458 | int nByte, /* Maximum length of zSql in bytes. */ |
| 459 | sqlite3_stmt **ppStmt, /* OUT: Statement handle */ |
| 460 | const char **pzTail /* OUT: Pointer to unused portion of zSql */ |
| 461 | ); |
| 462 | SQLITE_API int sqlite3_prepare16( |
| 463 | sqlite3 *db, /* Database handle */ |
| 464 | const void *zSql, /* SQL statement, UTF-16 encoded */ |
| 465 | int nByte, /* Maximum length of zSql in bytes. */ |
| 466 | sqlite3_stmt **ppStmt, /* OUT: Statement handle */ |
| 467 | const void **pzTail /* OUT: Pointer to unused portion of zSql */ |
| 468 | ); |
| 469 | SQLITE_API int sqlite3_prepare16_v2( |
| 470 | sqlite3 *db, /* Database handle */ |
| 471 | const void *zSql, /* SQL statement, UTF-16 encoded */ |
| 472 | int nByte, /* Maximum length of zSql in bytes. */ |
| 473 | sqlite3_stmt **ppStmt, /* OUT: Statement handle */ |
| 474 | const void **pzTail /* OUT: Pointer to unused portion of zSql */ |
| 475 | ); |
| 476 | |
| 477 | typedef struct Mem sqlite3_value; |
| 478 | typedef struct sqlite3_context sqlite3_context; |
| 479 | |
| 480 | SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt); |
| 481 | SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); |
| 482 | SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*); |
| 483 | |
| 484 | SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*)); |
| 485 | SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double); |
| 486 | SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int); |
| 487 | SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64); |
| 488 | SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int); |
| 489 | SQLITE_API int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*)); |
| 490 | SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*)); |
| 491 | SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*); |
| 492 | SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n); |
| 493 | |
| 494 | SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*); |
| 495 | SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int); |
| 496 | SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName); |
| 497 | SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*); |
| 498 | SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt); |
| 499 | SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N); |
| 500 | SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N); |
| 501 | SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int); |
| 502 | SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int); |
| 503 | SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int); |
| 504 | SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int); |
| 505 | SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int); |
| 506 | SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int); |
| 507 | SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int); |
| 508 | SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int); |
| 509 | |
| 510 | SQLITE_API int sqlite3_step(sqlite3_stmt*); |
| 511 | SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); |
| 512 | |
| 513 | #define SQLITE_INTEGER 1 |
| 514 | #define SQLITE_FLOAT 2 |
| 515 | #define SQLITE_BLOB 4 |
| 516 | #define SQLITE_NULL 5 |
| 517 | #ifdef SQLITE_TEXT |
| 518 | # undef SQLITE_TEXT |
| 519 | #else |
| 520 | # define SQLITE_TEXT 3 |
| 521 | #endif |
| 522 | #define SQLITE3_TEXT 3 |
| 523 | |
| 524 | #define SQLITE_UTF8 1 |
| 525 | #define SQLITE_UTF16LE 2 |
| 526 | #define SQLITE_UTF16BE 3 |
| 527 | #define SQLITE_UTF16 4 /* Use native byte order */ |
| 528 | #define SQLITE_ANY 5 /* sqlite3_create_function only */ |
| 529 | #define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */ |
| 530 | |
| 531 | SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol); |
| 532 | SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol); |
| 533 | SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol); |
| 534 | SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol); |
| 535 | SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol); |
| 536 | SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol); |
| 537 | SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol); |
| 538 | SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol); |
| 539 | SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol); |
| 540 | SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol); |
| 541 | SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt); |
| 542 | SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); |
| 543 | |
| 544 | SQLITE_API int sqlite3_create_function( |
| 545 | sqlite3 *db, |
| 546 | const char *zFunctionName, |
| 547 | int nArg, |
| 548 | int eTextRep, |
| 549 | void *pApp, |
| 550 | void (*xFunc)(sqlite3_context*,int,sqlite3_value**), |
| 551 | void (*xStep)(sqlite3_context*,int,sqlite3_value**), |
| 552 | void (*xFinal)(sqlite3_context*) |
| 553 | ); |
| 554 | SQLITE_API int sqlite3_create_function16( |
| 555 | sqlite3 *db, |
| 556 | const void *zFunctionName, |
| 557 | int nArg, |
| 558 | int eTextRep, |
| 559 | void *pApp, |
| 560 | void (*xFunc)(sqlite3_context*,int,sqlite3_value**), |
| 561 | void (*xStep)(sqlite3_context*,int,sqlite3_value**), |
| 562 | void (*xFinal)(sqlite3_context*) |
| 563 | ); |
| 564 | SQLITE_API int sqlite3_create_function_v2( |
| 565 | sqlite3 *db, |
| 566 | const char *zFunctionName, |
| 567 | int nArg, |
| 568 | int eTextRep, |
| 569 | void *pApp, |
| 570 | void (*xFunc)(sqlite3_context*,int,sqlite3_value**), |
| 571 | void (*xStep)(sqlite3_context*,int,sqlite3_value**), |
| 572 | void (*xFinal)(sqlite3_context*), |
| 573 | void(*xDestroy)(void*) |
| 574 | ); |
| 575 | |
| 576 | #ifndef SQLITE_OMIT_DEPRECATED |
| 577 | SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*); |
| 578 | SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*); |
| 579 | SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*); |
| 580 | SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void); |
| 581 | SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void); |
| 582 | SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),void*,sqlite3_int64); |
| 583 | #endif |
| 584 | |
| 585 | |
| 586 | typedef void (*sqlite3_destructor_type)(void*); |
| 587 | #define SQLITE_STATIC ((sqlite3_destructor_type)0) |
| 588 | #define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1) |
| 589 | |
| 590 | SQLITE_API const void *sqlite3_value_blob(sqlite3_value*); |
| 591 | SQLITE_API int sqlite3_value_bytes(sqlite3_value*); |
| 592 | SQLITE_API int sqlite3_value_bytes16(sqlite3_value*); |
| 593 | SQLITE_API double sqlite3_value_double(sqlite3_value*); |
| 594 | SQLITE_API int sqlite3_value_int(sqlite3_value*); |
| 595 | SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*); |
| 596 | SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*); |
| 597 | SQLITE_API const void *sqlite3_value_text16(sqlite3_value*); |
| 598 | SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*); |
| 599 | SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*); |
| 600 | SQLITE_API int sqlite3_value_type(sqlite3_value*); |
| 601 | SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); |
| 602 | |
| 603 | SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes); |
| 604 | SQLITE_API void *sqlite3_user_data(sqlite3_context*); |
| 605 | SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); |
| 606 | SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N); |
| 607 | SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*)); |
| 608 | |
| 609 | SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*)); |
| 610 | SQLITE_API void sqlite3_result_double(sqlite3_context*, double); |
| 611 | SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int); |
| 612 | SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int); |
| 613 | SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*); |
| 614 | SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*); |
| 615 | SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int); |
| 616 | SQLITE_API void sqlite3_result_int(sqlite3_context*, int); |
| 617 | SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64); |
| 618 | SQLITE_API void sqlite3_result_null(sqlite3_context*); |
| 619 | SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*)); |
| 620 | SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*)); |
| 621 | SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*)); |
| 622 | SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*)); |
| 623 | SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*); |
| 624 | SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n); |
| 625 | |
| 626 | |
| 627 | SQLITE_API int sqlite3_create_collation( |
| 628 | sqlite3*, |
| 629 | const char *zName, |
| 630 | int eTextRep, |
| 631 | void *pArg, |
| 632 | int(*xCompare)(void*,int,const void*,int,const void*) |
| 633 | ); |
| 634 | SQLITE_API int sqlite3_create_collation_v2( |
| 635 | sqlite3*, |
| 636 | const char *zName, |
| 637 | int eTextRep, |
| 638 | void *pArg, |
| 639 | int(*xCompare)(void*,int,const void*,int,const void*), |
| 640 | void(*xDestroy)(void*) |
| 641 | ); |
| 642 | SQLITE_API int sqlite3_create_collation16( |
| 643 | sqlite3*, |
| 644 | const void *zName, |
| 645 | int eTextRep, |
| 646 | void *pArg, |
| 647 | int(*xCompare)(void*,int,const void*,int,const void*) |
| 648 | ); |
| 649 | |
| 650 | SQLITE_API int sqlite3_collation_needed( |
| 651 | sqlite3*, |
| 652 | void*, |
| 653 | void(*)(void*,sqlite3*,int eTextRep,const char*) |
| 654 | ); |
| 655 | SQLITE_API int sqlite3_collation_needed16( |
| 656 | sqlite3*, |
| 657 | void*, |
| 658 | void(*)(void*,sqlite3*,int eTextRep,const void*) |
| 659 | ); |
| 660 | |
| 661 | #ifdef SQLITE_ENABLE_CEROD |
| 662 | SQLITE_API void sqlite3_activate_cerod( |
| 663 | const char *zPassPhrase /* Activation phrase */ |
| 664 | ); |
| 665 | #endif |
| 666 | |
| 667 | #ifdef SQLITE_HAS_CODEC |
| 668 | SQLITE_API int sqlite3_key( |
| 669 | sqlite3 *db, /* Database to be rekeyed */ |
| 670 | const void *pKey, int nKey /* The key */ |
| 671 | ); |
| 672 | |
| 673 | SQLITE_API int sqlite3_rekey( |
| 674 | sqlite3 *db, /* Database to be rekeyed */ |
| 675 | const void *pKey, int nKey /* The new key */ |
| 676 | ); |
| 677 | |
| 678 | SQLITE_API void sqlite3_activate_see( |
| 679 | const char *zPassPhrase /* Activation phrase */ |
| 680 | ); |
| 681 | #endif |
| 682 | |
| 683 | SQLITE_API SQLITE_EXTERN char *sqlite3_temp_directory; |
| 684 | |
| 685 | SQLITE_API int sqlite3_sleep(int); |
| 686 | SQLITE_API int sqlite3_get_autocommit(sqlite3*); |
| 687 | SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*); |
| 688 | SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName); |
| 689 | SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt); |
| 690 | SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*); |
| 691 | SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); |
| 692 | SQLITE_API int sqlite3_enable_shared_cache(int); |
| 693 | |
| 694 | SQLITE_API void *sqlite3_update_hook( |
| 695 | sqlite3*, |
| 696 | void(*)(void *,int ,char const *,char const *,sqlite3_int64), |
| 697 | void* |
| 698 | ); |
| 699 | |
| 700 | SQLITE_API int sqlite3_release_memory(int); |
| 701 | SQLITE_API int sqlite3_db_release_memory(sqlite3*); |
| 702 | |
| 703 | SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N); |
| 704 | SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N); |
| 705 | |
| 706 | SQLITE_API int sqlite3_table_column_metadata( |
| 707 | sqlite3 *db, /* Connection handle */ |
| 708 | const char *zDbName, /* Database name or NULL */ |
| 709 | const char *zTableName, /* Table name */ |
| 710 | const char *zColumnName, /* Column name */ |
| 711 | char const **pzDataType, /* OUTPUT: Declared data type */ |
| 712 | char const **pzCollSeq, /* OUTPUT: Collation sequence name */ |
| 713 | int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */ |
| 714 | int *pPrimaryKey, /* OUTPUT: True if column part of PK */ |
| 715 | int *pAutoinc /* OUTPUT: True if column is auto-increment */ |
| 716 | ); |
| 717 | |
| 718 | SQLITE_API int sqlite3_load_extension( |
| 719 | sqlite3 *db, /* Load the extension into this database connection */ |
| 720 | const char *zFile, /* Name of the shared library containing extension */ |
| 721 | const char *zProc, /* Entry point. Derived from zFile if 0 */ |
| 722 | char **pzErrMsg /* Put error message here if not 0 */ |
| 723 | ); |
| 724 | |
| 725 | typedef struct sqlite3_vtab sqlite3_vtab; |
| 726 | typedef struct sqlite3_index_info sqlite3_index_info; |
| 727 | typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor; |
| 728 | typedef struct sqlite3_module sqlite3_module; |
| 729 | |
| 730 | SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff); |
| 731 | SQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void)); |
| 732 | SQLITE_API void sqlite3_reset_auto_extension(void); |
| 733 | |
| 734 | |
| 735 | #define SQLITE_INDEX_CONSTRAINT_EQ 2 |
| 736 | #define SQLITE_INDEX_CONSTRAINT_GT 4 |
| 737 | #define SQLITE_INDEX_CONSTRAINT_LE 8 |
| 738 | #define SQLITE_INDEX_CONSTRAINT_LT 16 |
| 739 | #define SQLITE_INDEX_CONSTRAINT_GE 32 |
| 740 | #define SQLITE_INDEX_CONSTRAINT_MATCH 64 |
| 741 | |
| 742 | |
| 743 | struct sqlite3_module { |
| 744 | int iVersion; |
| 745 | int (*xCreate)(sqlite3*, void *pAux, |
| 746 | int argc, const char *const*argv, |
| 747 | sqlite3_vtab **ppVTab, char**); |
| 748 | int (*xConnect)(sqlite3*, void *pAux, |
| 749 | int argc, const char *const*argv, |
| 750 | sqlite3_vtab **ppVTab, char**); |
| 751 | int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*); |
| 752 | int (*xDisconnect)(sqlite3_vtab *pVTab); |
| 753 | int (*xDestroy)(sqlite3_vtab *pVTab); |
| 754 | int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor); |
| 755 | int (*xClose)(sqlite3_vtab_cursor*); |
| 756 | int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr, |
| 757 | int argc, sqlite3_value **argv); |
| 758 | int (*xNext)(sqlite3_vtab_cursor*); |
| 759 | int (*xEof)(sqlite3_vtab_cursor*); |
| 760 | int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int); |
| 761 | int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid); |
| 762 | int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *); |
| 763 | int (*xBegin)(sqlite3_vtab *pVTab); |
| 764 | int (*xSync)(sqlite3_vtab *pVTab); |
| 765 | int (*xCommit)(sqlite3_vtab *pVTab); |
| 766 | int (*xRollback)(sqlite3_vtab *pVTab); |
| 767 | int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName, |
| 768 | void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), |
| 769 | void **ppArg); |
| 770 | int (*xRename)(sqlite3_vtab *pVtab, const char *zNew); |
| 771 | /* The methods above are in version 1 of the sqlite_module object. Those |
| 772 | ** below are for version 2 and greater. */ |
| 773 | int (*xSavepoint)(sqlite3_vtab *pVTab, int); |
| 774 | int (*xRelease)(sqlite3_vtab *pVTab, int); |
| 775 | int (*xRollbackTo)(sqlite3_vtab *pVTab, int); |
| 776 | }; |
| 777 | |
| 778 | struct sqlite3_index_info { |
| 779 | /* Inputs */ |
| 780 | int nConstraint; /* Number of entries in aConstraint */ |
| 781 | struct sqlite3_index_constraint { |
| 782 | int iColumn; /* Column on left-hand side of constraint */ |
| 783 | unsigned char op; /* Constraint operator */ |
| 784 | unsigned char usable; /* True if this constraint is usable */ |
| 785 | int iTermOffset; /* Used internally - xBestIndex should ignore */ |
| 786 | } *aConstraint; /* Table of WHERE clause constraints */ |
| 787 | int nOrderBy; /* Number of terms in the ORDER BY clause */ |
| 788 | struct sqlite3_index_orderby { |
| 789 | int iColumn; /* Column number */ |
| 790 | unsigned char desc; /* True for DESC. False for ASC. */ |
| 791 | } *aOrderBy; /* The ORDER BY clause */ |
| 792 | /* Outputs */ |
| 793 | struct sqlite3_index_constraint_usage { |
| 794 | int argvIndex; /* if >0, constraint is part of argv to xFilter */ |
| 795 | unsigned char omit; /* Do not code a test for this constraint */ |
| 796 | } *aConstraintUsage; |
| 797 | int idxNum; /* Number used to identify the index */ |
| 798 | char *idxStr; /* String, possibly obtained from sqlite3_malloc */ |
| 799 | int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */ |
| 800 | int orderByConsumed; /* True if output is already ordered */ |
| 801 | double estimatedCost; /* Estimated cost of using this index */ |
| 802 | }; |
| 803 | |
| 804 | typedef struct sqlite3_blob sqlite3_blob; |
| 805 | |
| 806 | SQLITE_API int sqlite3_create_module( |
| 807 | sqlite3 *db, /* SQLite connection to register module with */ |
| 808 | const char *zName, /* Name of the module */ |
| 809 | const sqlite3_module *p, /* Methods for the module */ |
| 810 | void *pClientData /* Client data for xCreate/xConnect */ |
| 811 | ); |
| 812 | SQLITE_API int sqlite3_create_module_v2( |
| 813 | sqlite3 *db, /* SQLite connection to register module with */ |
| 814 | const char *zName, /* Name of the module */ |
| 815 | const sqlite3_module *p, /* Methods for the module */ |
| 816 | void *pClientData, /* Client data for xCreate/xConnect */ |
| 817 | void(*xDestroy)(void*) /* Module destructor function */ |
| 818 | ); |
| 819 | |
| 820 | struct sqlite3_vtab { |
| 821 | const sqlite3_module *pModule; /* The module for this virtual table */ |
| 822 | int nRef; /* NO LONGER USED */ |
| 823 | char *zErrMsg; /* Error message from sqlite3_mprintf() */ |
| 824 | /* Virtual table implementations will typically add additional fields */ |
| 825 | }; |
| 826 | |
| 827 | struct sqlite3_vtab_cursor { |
| 828 | sqlite3_vtab *pVtab; /* Virtual table of this cursor */ |
| 829 | /* Virtual table implementations will typically add additional fields */ |
| 830 | }; |
| 831 | |
| 832 | SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL); |
| 833 | SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg); |
| 834 | |
| 835 | SQLITE_API int sqlite3_blob_open( |
| 836 | sqlite3*, |
| 837 | const char *zDb, |
| 838 | const char *zTable, |
| 839 | const char *zColumn, |
| 840 | sqlite3_int64 iRow, |
| 841 | int flags, |
| 842 | sqlite3_blob **ppBlob |
| 843 | ); |
| 844 | |
| 845 | SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64); |
| 846 | SQLITE_API int sqlite3_blob_close(sqlite3_blob *); |
| 847 | SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *); |
| 848 | SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset); |
| 849 | SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset); |
| 850 | |
| 851 | SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName); |
| 852 | SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt); |
| 853 | SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*); |
| 854 | |
| 855 | SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int); |
| 856 | SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*); |
| 857 | SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*); |
| 858 | SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*); |
| 859 | SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*); |
| 860 | |
| 861 | typedef struct sqlite3_mutex_methods sqlite3_mutex_methods; |
| 862 | struct sqlite3_mutex_methods { |
| 863 | int (*xMutexInit)(void); |
| 864 | int (*xMutexEnd)(void); |
| 865 | sqlite3_mutex *(*xMutexAlloc)(int); |
| 866 | void (*xMutexFree)(sqlite3_mutex *); |
| 867 | void (*xMutexEnter)(sqlite3_mutex *); |
| 868 | int (*xMutexTry)(sqlite3_mutex *); |
| 869 | void (*xMutexLeave)(sqlite3_mutex *); |
| 870 | int (*xMutexHeld)(sqlite3_mutex *); |
| 871 | int (*xMutexNotheld)(sqlite3_mutex *); |
| 872 | }; |
| 873 | |
| 874 | #ifndef NDEBUG |
| 875 | SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*); |
| 876 | SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*); |
| 877 | #endif |
| 878 | |
| 879 | |
| 880 | #define SQLITE_MUTEX_FAST 0 |
| 881 | #define SQLITE_MUTEX_RECURSIVE 1 |
| 882 | #define SQLITE_MUTEX_STATIC_MASTER 2 |
| 883 | #define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */ |
| 884 | #define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */ |
| 885 | #define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */ |
| 886 | #define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */ |
| 887 | #define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */ |
| 888 | #define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */ |
| 889 | #define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */ |
| 890 | |
| 891 | |
| 892 | SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*); |
| 893 | |
| 894 | SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*); |
| 895 | |
| 896 | SQLITE_API int sqlite3_test_control(int op, ...); |
| 897 | |
| 898 | #define SQLITE_TESTCTRL_FIRST 5 |
| 899 | #define SQLITE_TESTCTRL_PRNG_SAVE 5 |
| 900 | #define SQLITE_TESTCTRL_PRNG_RESTORE 6 |
| 901 | #define SQLITE_TESTCTRL_PRNG_RESET 7 |
| 902 | #define SQLITE_TESTCTRL_BITVEC_TEST 8 |
| 903 | #define SQLITE_TESTCTRL_FAULT_INSTALL 9 |
| 904 | #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 |
| 905 | #define SQLITE_TESTCTRL_PENDING_BYTE 11 |
| 906 | #define SQLITE_TESTCTRL_ASSERT 12 |
| 907 | #define SQLITE_TESTCTRL_ALWAYS 13 |
| 908 | #define SQLITE_TESTCTRL_RESERVE 14 |
| 909 | #define SQLITE_TESTCTRL_OPTIMIZATIONS 15 |
| 910 | #define SQLITE_TESTCTRL_ISKEYWORD 16 |
| 911 | #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 |
| 912 | #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18 |
| 913 | #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 |
| 914 | #define SQLITE_TESTCTRL_LAST 19 |
| 915 | |
| 916 | #define SQLITE_STATUS_MEMORY_USED 0 |
| 917 | #define SQLITE_STATUS_PAGECACHE_USED 1 |
| 918 | #define SQLITE_STATUS_PAGECACHE_OVERFLOW 2 |
| 919 | #define SQLITE_STATUS_SCRATCH_USED 3 |
| 920 | #define SQLITE_STATUS_SCRATCH_OVERFLOW 4 |
| 921 | #define SQLITE_STATUS_MALLOC_SIZE 5 |
| 922 | #define SQLITE_STATUS_PARSER_STACK 6 |
| 923 | #define SQLITE_STATUS_PAGECACHE_SIZE 7 |
| 924 | #define SQLITE_STATUS_SCRATCH_SIZE 8 |
| 925 | #define SQLITE_STATUS_MALLOC_COUNT 9 |
| 926 | |
| 927 | #define SQLITE_DBSTATUS_LOOKASIDE_USED 0 |
| 928 | #define SQLITE_DBSTATUS_CACHE_USED 1 |
| 929 | #define SQLITE_DBSTATUS_SCHEMA_USED 2 |
| 930 | #define SQLITE_DBSTATUS_STMT_USED 3 |
| 931 | #define SQLITE_DBSTATUS_LOOKASIDE_HIT 4 |
| 932 | #define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE 5 |
| 933 | #define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6 |
| 934 | #define SQLITE_DBSTATUS_CACHE_HIT 7 |
| 935 | #define SQLITE_DBSTATUS_CACHE_MISS 8 |
| 936 | #define SQLITE_DBSTATUS_MAX 8 /* Largest defined DBSTATUS */ |
| 937 | |
| 938 | |
| 939 | SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag); |
| 940 | |
| 941 | SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg); |
| 942 | |
| 943 | SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); |
| 944 | |
| 945 | #define SQLITE_STMTSTATUS_FULLSCAN_STEP 1 |
| 946 | #define SQLITE_STMTSTATUS_SORT 2 |
| 947 | #define SQLITE_STMTSTATUS_AUTOINDEX 3 |
| 948 | |
| 949 | typedef struct sqlite3_pcache sqlite3_pcache; |
| 950 | |
| 951 | typedef struct sqlite3_pcache_page sqlite3_pcache_page; |
| 952 | struct sqlite3_pcache_page { |
| 953 | void *pBuf; /* The content of the page */ |
| 954 | void *pExtra; /* Extra information associated with the page */ |
| 955 | }; |
| 956 | |
| 957 | typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2; |
| 958 | struct sqlite3_pcache_methods2 { |
| 959 | int iVersion; |
| 960 | void *pArg; |
| 961 | int (*xInit)(void*); |
| 962 | void (*xShutdown)(void*); |
| 963 | sqlite3_pcache *(*xCreate)(int szPage, int szExtra, int bPurgeable); |
| 964 | void (*xCachesize)(sqlite3_pcache*, int nCachesize); |
| 965 | int (*xPagecount)(sqlite3_pcache*); |
| 966 | sqlite3_pcache_page *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag); |
| 967 | void (*xUnpin)(sqlite3_pcache*, sqlite3_pcache_page*, int discard); |
| 968 | void (*xRekey)(sqlite3_pcache*, sqlite3_pcache_page*, |
| 969 | unsigned oldKey, unsigned newKey); |
| 970 | void (*xTruncate)(sqlite3_pcache*, unsigned iLimit); |
| 971 | void (*xDestroy)(sqlite3_pcache*); |
| 972 | void (*xShrink)(sqlite3_pcache*); |
| 973 | }; |
| 974 | |
| 975 | |
| 976 | typedef struct sqlite3_pcache_methods sqlite3_pcache_methods; |
| 977 | struct sqlite3_pcache_methods { |
| 978 | void *pArg; |
| 979 | int (*xInit)(void*); |
| 980 | void (*xShutdown)(void*); |
| 981 | sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable); |
| 982 | void (*xCachesize)(sqlite3_pcache*, int nCachesize); |
| 983 | int (*xPagecount)(sqlite3_pcache*); |
| 984 | void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag); |
| 985 | void (*xUnpin)(sqlite3_pcache*, void*, int discard); |
| 986 | void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey); |
| 987 | void (*xTruncate)(sqlite3_pcache*, unsigned iLimit); |
| 988 | void (*xDestroy)(sqlite3_pcache*); |
| 989 | }; |
| 990 | |
| 991 | |
| 992 | #define SQLITE_CHECKPOINT_PASSIVE 0 |
| 993 | #define SQLITE_CHECKPOINT_FULL 1 |
| 994 | #define SQLITE_CHECKPOINT_RESTART 2 |
| 995 | |
| 996 | typedef struct sqlite3_backup sqlite3_backup; |
| 997 | |
| 998 | SQLITE_API sqlite3_backup *sqlite3_backup_init( |
| 999 | sqlite3 *pDest, /* Destination database handle */ |
| 1000 | const char *zDestName, /* Destination database name */ |
| 1001 | sqlite3 *pSource, /* Source database handle */ |
| 1002 | const char *zSourceName /* Source database name */ |
| 1003 | ); |
| 1004 | SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage); |
| 1005 | SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p); |
| 1006 | SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p); |
| 1007 | SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); |
| 1008 | |
| 1009 | SQLITE_API int sqlite3_unlock_notify( |
| 1010 | sqlite3 *pBlocked, /* Waiting connection */ |
| 1011 | void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */ |
| 1012 | void *pNotifyArg /* Argument to pass to xNotify */ |
| 1013 | ); |
| 1014 | |
| 1015 | |
| 1016 | SQLITE_API int sqlite3_strnicmp(const char *, const char *, int); |
| 1017 | |
| 1018 | SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...); |
| 1019 | |
| 1020 | SQLITE_API void *sqlite3_wal_hook( |
| 1021 | sqlite3*, |
| 1022 | int(*)(void *,sqlite3*,const char*,int), |
| 1023 | void* |
| 1024 | ); |
| 1025 | |
| 1026 | SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N); |
| 1027 | |
| 1028 | SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb); |
| 1029 | |
| 1030 | SQLITE_API int sqlite3_wal_checkpoint_v2( |
| 1031 | sqlite3 *db, /* Database handle */ |
| 1032 | const char *zDb, /* Name of attached database (or NULL) */ |
| 1033 | int eMode, /* SQLITE_CHECKPOINT_* value */ |
| 1034 | int *pnLog, /* OUT: Size of WAL log in frames */ |
| 1035 | int *pnCkpt /* OUT: Total number of frames checkpointed */ |
| 1036 | ); |
| 1037 | |
| 1038 | SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...); |
| 1039 | |
| 1040 | #define SQLITE_VTAB_CONSTRAINT_SUPPORT 1 |
| 1041 | |
| 1042 | SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *); |
| 1043 | |
| 1044 | #define SQLITE_ROLLBACK 1 |
| 1045 | /* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */ |
| 1046 | #define SQLITE_FAIL 3 |
| 1047 | /* #define SQLITE_ABORT 4 // Also an error code */ |
| 1048 | #define SQLITE_REPLACE 5 |
| 1049 | |
| 1050 | #ifdef SQLITE_OMIT_FLOATING_POINT |
| 1051 | # undef double |
| 1052 | #endif |
| 1053 | |
| 1054 | #ifdef __cplusplus |
| 1055 | } /* End of the 'extern "C"' block */ |
| 1056 | #endif |
| 1057 | #endif |
| 1058 | |
| 1059 | |
| 1060 | #ifndef _SQLITE3RTREE_H_ |
| 1061 | #define _SQLITE3RTREE_H_ |
| 1062 | |
| 1063 | |
| 1064 | #ifdef __cplusplus |
| 1065 | extern "C" { |
| 1066 | #endif |
| 1067 | |
| 1068 | typedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry; |
| 1069 | |
| 1070 | struct sqlite3_rtree_geometry { |
| 1071 | void *pContext; |
| 1072 | int nParam; |
| 1073 | double *aParam; |
| 1074 | void *pUser; |
| 1075 | void (*xDelUser)(void *); |
| 1076 | }; |
| 1077 | |
| 1078 | SQLITE_API int sqlite3_rtree_geometry_callback( |
| 1079 | sqlite3 *db, |
| 1080 | const char *zGeom, |
| 1081 | int (*xGeom)(sqlite3_rtree_geometry *, int nCoord, double *aCoord, int *pRes), |
| 1082 | void *pContext |
| 1083 | ); |
| 1084 | |
| 1085 | #ifdef __cplusplus |
| 1086 | } /* end of the 'extern "C"' block */ |
| 1087 | #endif |
| 1088 | |
| 1089 | #endif /* ifndef _SQLITE3RTREE_H_ */ |
| 1090 | |