| OLD | NEW |
| 1 /* | 1 /* |
| 2 ** 2001 September 15 | 2 ** 2001 September 15 |
| 3 ** | 3 ** |
| 4 ** The author disclaims copyright to this source code. In place of | 4 ** The author disclaims copyright to this source code. In place of |
| 5 ** a legal notice, here is a blessing: | 5 ** a legal notice, here is a blessing: |
| 6 ** | 6 ** |
| 7 ** May you do good and not evil. | 7 ** May you do good and not evil. |
| 8 ** May you find forgiveness for yourself and forgive others. | 8 ** May you find forgiveness for yourself and forgive others. |
| 9 ** May you share freely, never taking more than you give. | 9 ** May you share freely, never taking more than you give. |
| 10 ** | 10 ** |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 /* | 69 /* |
| 70 ** Include standard header files as necessary | 70 ** Include standard header files as necessary |
| 71 */ | 71 */ |
| 72 #ifdef HAVE_STDINT_H | 72 #ifdef HAVE_STDINT_H |
| 73 #include <stdint.h> | 73 #include <stdint.h> |
| 74 #endif | 74 #endif |
| 75 #ifdef HAVE_INTTYPES_H | 75 #ifdef HAVE_INTTYPES_H |
| 76 #include <inttypes.h> | 76 #include <inttypes.h> |
| 77 #endif | 77 #endif |
| 78 | 78 |
| 79 /* |
| 80 ** The number of samples of an index that SQLite takes in order to |
| 81 ** construct a histogram of the table content when running ANALYZE |
| 82 ** and with SQLITE_ENABLE_STAT2 |
| 83 */ |
| 79 #define SQLITE_INDEX_SAMPLES 10 | 84 #define SQLITE_INDEX_SAMPLES 10 |
| 80 | 85 |
| 81 /* | 86 /* |
| 82 ** This macro is used to "hide" some ugliness in casting an int | 87 ** The following macros are used to cast pointers to integers and |
| 83 ** value to a ptr value under the MSVC 64-bit compiler. Casting | 88 ** integers to pointers. The way you do this varies from one compiler |
| 84 ** non 64-bit values to ptr types results in a "hard" error with | 89 ** to the next, so we have developed the following set of #if statements |
| 85 ** the MSVC 64-bit compiler which this attempts to avoid. | 90 ** to generate appropriate macros for a wide range of compilers. |
| 86 ** | 91 ** |
| 87 ** A simple compiler pragma or casting sequence could not be found | 92 ** The correct "ANSI" way to do this is to use the intptr_t type. |
| 88 ** to correct this in all situations, so this macro was introduced. | 93 ** Unfortunately, that typedef is not available on all compilers, or |
| 89 ** | 94 ** if it is available, it requires an #include of specific headers |
| 90 ** It could be argued that the intptr_t type could be used in this | 95 ** that vary from one machine to the next. |
| 91 ** case, but that type is not available on all compilers, or | |
| 92 ** requires the #include of specific headers which differs between | |
| 93 ** platforms. | |
| 94 ** | 96 ** |
| 95 ** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on | 97 ** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on |
| 96 ** the ((void*)&((char*)0)[X]) construct. But MSVC chokes on ((void*)(X)). | 98 ** the ((void*)&((char*)0)[X]) construct. But MSVC chokes on ((void*)(X)). |
| 97 ** So we have to define the macros in different ways depending on the | 99 ** So we have to define the macros in different ways depending on the |
| 98 ** compiler. | 100 ** compiler. |
| 99 */ | 101 */ |
| 100 #if defined(__GNUC__) | 102 #if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ |
| 101 # if defined(HAVE_STDINT_H) | 103 # define SQLITE_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X)) |
| 102 # define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X)) | 104 # define SQLITE_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X)) |
| 103 # define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X)) | 105 #elif !defined(__GNUC__) /* Works for compilers other than LLVM */ |
| 104 # else | 106 # define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X]) |
| 105 # define SQLITE_INT_TO_PTR(X) ((void*)(X)) | 107 # define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0)) |
| 106 # define SQLITE_PTR_TO_INT(X) ((int)(X)) | 108 #elif defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */ |
| 107 # endif | 109 # define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X)) |
| 108 #else | 110 # define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X)) |
| 109 # define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X]) | 111 #else /* Generates a warning - but it always works */ |
| 110 # define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0)) | 112 # define SQLITE_INT_TO_PTR(X) ((void*)(X)) |
| 113 # define SQLITE_PTR_TO_INT(X) ((int)(X)) |
| 111 #endif | 114 #endif |
| 112 | 115 |
| 113 | |
| 114 /* | 116 /* |
| 115 ** The SQLITE_THREADSAFE macro must be defined as either 0 or 1. | 117 ** The SQLITE_THREADSAFE macro must be defined as 0, 1, or 2. |
| 118 ** 0 means mutexes are permanently disable and the library is never |
| 119 ** threadsafe. 1 means the library is serialized which is the highest |
| 120 ** level of threadsafety. 2 means the libary is multithreaded - multiple |
| 121 ** threads can use SQLite as long as no two threads try to use the same |
| 122 ** database connection at the same time. |
| 123 ** |
| 116 ** Older versions of SQLite used an optional THREADSAFE macro. | 124 ** Older versions of SQLite used an optional THREADSAFE macro. |
| 117 ** We support that for legacy | 125 ** We support that for legacy. |
| 118 */ | 126 */ |
| 119 #if !defined(SQLITE_THREADSAFE) | 127 #if !defined(SQLITE_THREADSAFE) |
| 120 #if defined(THREADSAFE) | 128 #if defined(THREADSAFE) |
| 121 # define SQLITE_THREADSAFE THREADSAFE | 129 # define SQLITE_THREADSAFE THREADSAFE |
| 122 #else | 130 #else |
| 123 # define SQLITE_THREADSAFE 1 | 131 # define SQLITE_THREADSAFE 1 /* IMP: R-07272-22309 */ |
| 124 #endif | 132 #endif |
| 125 #endif | 133 #endif |
| 126 | 134 |
| 127 /* | 135 /* |
| 128 ** The SQLITE_DEFAULT_MEMSTATUS macro must be defined as either 0 or 1. | 136 ** The SQLITE_DEFAULT_MEMSTATUS macro must be defined as either 0 or 1. |
| 129 ** It determines whether or not the features related to | 137 ** It determines whether or not the features related to |
| 130 ** SQLITE_CONFIG_MEMSTATUS are available by default or not. This value can | 138 ** SQLITE_CONFIG_MEMSTATUS are available by default or not. This value can |
| 131 ** be overridden at runtime using the sqlite3_config() API. | 139 ** be overridden at runtime using the sqlite3_config() API. |
| 132 */ | 140 */ |
| 133 #if !defined(SQLITE_DEFAULT_MEMSTATUS) | 141 #if !defined(SQLITE_DEFAULT_MEMSTATUS) |
| 134 # define SQLITE_DEFAULT_MEMSTATUS 1 | 142 # define SQLITE_DEFAULT_MEMSTATUS 1 |
| 135 #endif | 143 #endif |
| 136 | 144 |
| 137 /* | 145 /* |
| 138 ** Exactly one of the following macros must be defined in order to | 146 ** Exactly one of the following macros must be defined in order to |
| 139 ** specify which memory allocation subsystem to use. | 147 ** specify which memory allocation subsystem to use. |
| 140 ** | 148 ** |
| 141 ** SQLITE_SYSTEM_MALLOC // Use normal system malloc() | 149 ** SQLITE_SYSTEM_MALLOC // Use normal system malloc() |
| 142 ** SQLITE_MEMDEBUG // Debugging version of system malloc() | 150 ** SQLITE_MEMDEBUG // Debugging version of system malloc() |
| 143 ** SQLITE_MEMORY_SIZE // internal allocator #1 | 151 ** |
| 144 ** SQLITE_MMAP_HEAP_SIZE // internal mmap() allocator | 152 ** (Historical note: There used to be several other options, but we've |
| 145 ** SQLITE_POW2_MEMORY_SIZE // internal power-of-two allocator | 153 ** pared it down to just these two.) |
| 146 ** | 154 ** |
| 147 ** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as | 155 ** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as |
| 148 ** the default. | 156 ** the default. |
| 149 */ | 157 */ |
| 150 #if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_MEMDEBUG)+\ | 158 #if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_MEMDEBUG)>1 |
| 151 defined(SQLITE_MEMORY_SIZE)+defined(SQLITE_MMAP_HEAP_SIZE)+\ | |
| 152 defined(SQLITE_POW2_MEMORY_SIZE)>1 | |
| 153 # error "At most one of the following compile-time configuration options\ | 159 # error "At most one of the following compile-time configuration options\ |
| 154 is allows: SQLITE_SYSTEM_MALLOC, SQLITE_MEMDEBUG, SQLITE_MEMORY_SIZE,\ | 160 is allows: SQLITE_SYSTEM_MALLOC, SQLITE_MEMDEBUG" |
| 155 SQLITE_MMAP_HEAP_SIZE, SQLITE_POW2_MEMORY_SIZE" | |
| 156 #endif | 161 #endif |
| 157 #if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_MEMDEBUG)+\ | 162 #if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_MEMDEBUG)==0 |
| 158 defined(SQLITE_MEMORY_SIZE)+defined(SQLITE_MMAP_HEAP_SIZE)+\ | |
| 159 defined(SQLITE_POW2_MEMORY_SIZE)==0 | |
| 160 # define SQLITE_SYSTEM_MALLOC 1 | 163 # define SQLITE_SYSTEM_MALLOC 1 |
| 161 #endif | 164 #endif |
| 162 | 165 |
| 163 /* | 166 /* |
| 164 ** If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the | 167 ** If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the |
| 165 ** sizes of memory allocations below this value where possible. | 168 ** sizes of memory allocations below this value where possible. |
| 166 */ | 169 */ |
| 167 #if !defined(SQLITE_MALLOC_SOFT_LIMIT) | 170 #if !defined(SQLITE_MALLOC_SOFT_LIMIT) |
| 168 # define SQLITE_MALLOC_SOFT_LIMIT 1024 | 171 # define SQLITE_MALLOC_SOFT_LIMIT 1024 |
| 169 #endif | 172 #endif |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 # define NEVER(X) (0) | 272 # define NEVER(X) (0) |
| 270 #elif !defined(NDEBUG) | 273 #elif !defined(NDEBUG) |
| 271 # define ALWAYS(X) ((X)?1:(assert(0),0)) | 274 # define ALWAYS(X) ((X)?1:(assert(0),0)) |
| 272 # define NEVER(X) ((X)?(assert(0),1):0) | 275 # define NEVER(X) ((X)?(assert(0),1):0) |
| 273 #else | 276 #else |
| 274 # define ALWAYS(X) (X) | 277 # define ALWAYS(X) (X) |
| 275 # define NEVER(X) (X) | 278 # define NEVER(X) (X) |
| 276 #endif | 279 #endif |
| 277 | 280 |
| 278 /* | 281 /* |
| 282 ** Return true (non-zero) if the input is a integer that is too large |
| 283 ** to fit in 32-bits. This macro is used inside of various testcase() |
| 284 ** macros to verify that we have tested SQLite for large-file support. |
| 285 */ |
| 286 #define IS_BIG_INT(X) (((X)&~(i64)0xffffffff)!=0) |
| 287 |
| 288 /* |
| 279 ** The macro unlikely() is a hint that surrounds a boolean | 289 ** The macro unlikely() is a hint that surrounds a boolean |
| 280 ** expression that is usually false. Macro likely() surrounds | 290 ** expression that is usually false. Macro likely() surrounds |
| 281 ** a boolean expression that is usually true. GCC is able to | 291 ** a boolean expression that is usually true. GCC is able to |
| 282 ** use these hints to generate better code, sometimes. | 292 ** use these hints to generate better code, sometimes. |
| 283 */ | 293 */ |
| 284 #if defined(__GNUC__) && 0 | 294 #if defined(__GNUC__) && 0 |
| 285 # define likely(X) __builtin_expect((X),1) | 295 # define likely(X) __builtin_expect((X),1) |
| 286 # define unlikely(X) __builtin_expect((X),0) | 296 # define unlikely(X) __builtin_expect((X),0) |
| 287 #else | 297 #else |
| 288 # define likely(X) !!(X) | 298 # define likely(X) !!(X) |
| 289 # define unlikely(X) !!(X) | 299 # define unlikely(X) !!(X) |
| 290 #endif | 300 #endif |
| 291 | 301 |
| 292 #include "sqlite3.h" | 302 #include "sqlite3.h" |
| 293 #include "hash.h" | 303 #include "hash.h" |
| 294 #include "parse.h" | 304 #include "parse.h" |
| 295 #include <stdio.h> | 305 #include <stdio.h> |
| 296 #include <stdlib.h> | 306 #include <stdlib.h> |
| 297 #include <string.h> | 307 #include <string.h> |
| 298 #include <assert.h> | 308 #include <assert.h> |
| 299 #include <stddef.h> | 309 #include <stddef.h> |
| 300 | 310 |
| 301 /* | 311 /* |
| 302 ** If compiling for a processor that lacks floating point support, | 312 ** If compiling for a processor that lacks floating point support, |
| 303 ** substitute integer for floating-point | 313 ** substitute integer for floating-point |
| 304 */ | 314 */ |
| 305 #ifdef SQLITE_OMIT_FLOATING_POINT | 315 #ifdef SQLITE_OMIT_FLOATING_POINT |
| 306 # define double sqlite_int64 | 316 # define double sqlite_int64 |
| 317 # define float sqlite_int64 |
| 307 # define LONGDOUBLE_TYPE sqlite_int64 | 318 # define LONGDOUBLE_TYPE sqlite_int64 |
| 308 # ifndef SQLITE_BIG_DBL | 319 # ifndef SQLITE_BIG_DBL |
| 309 # define SQLITE_BIG_DBL (((sqlite3_int64)1)<<50) | 320 # define SQLITE_BIG_DBL (((sqlite3_int64)1)<<50) |
| 310 # endif | 321 # endif |
| 311 # define SQLITE_OMIT_DATETIME_FUNCS 1 | 322 # define SQLITE_OMIT_DATETIME_FUNCS 1 |
| 312 # define SQLITE_OMIT_TRACE 1 | 323 # define SQLITE_OMIT_TRACE 1 |
| 313 # undef SQLITE_MIXED_ENDIAN_64BIT_FLOAT | 324 # undef SQLITE_MIXED_ENDIAN_64BIT_FLOAT |
| 314 # undef SQLITE_HAVE_ISNAN | 325 # undef SQLITE_HAVE_ISNAN |
| 315 #endif | 326 #endif |
| 316 #ifndef SQLITE_BIG_DBL | 327 #ifndef SQLITE_BIG_DBL |
| 317 # define SQLITE_BIG_DBL (1e99) | 328 # define SQLITE_BIG_DBL (1e99) |
| 318 #endif | 329 #endif |
| 319 | 330 |
| 320 /* | 331 /* |
| 321 ** OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0 | 332 ** OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0 |
| 322 ** afterward. Having this macro allows us to cause the C compiler | 333 ** afterward. Having this macro allows us to cause the C compiler |
| 323 ** to omit code used by TEMP tables without messy #ifndef statements. | 334 ** to omit code used by TEMP tables without messy #ifndef statements. |
| 324 */ | 335 */ |
| 325 #ifdef SQLITE_OMIT_TEMPDB | 336 #ifdef SQLITE_OMIT_TEMPDB |
| 326 #define OMIT_TEMPDB 1 | 337 #define OMIT_TEMPDB 1 |
| 327 #else | 338 #else |
| 328 #define OMIT_TEMPDB 0 | 339 #define OMIT_TEMPDB 0 |
| 329 #endif | 340 #endif |
| 330 | 341 |
| 331 /* | 342 /* |
| 332 ** If the following macro is set to 1, then NULL values are considered | |
| 333 ** distinct when determining whether or not two entries are the same | |
| 334 ** in a UNIQUE index. This is the way PostgreSQL, Oracle, DB2, MySQL, | |
| 335 ** OCELOT, and Firebird all work. The SQL92 spec explicitly says this | |
| 336 ** is the way things are suppose to work. | |
| 337 ** | |
| 338 ** If the following macro is set to 0, the NULLs are indistinct for | |
| 339 ** a UNIQUE index. In this mode, you can only have a single NULL entry | |
| 340 ** for a column declared UNIQUE. This is the way Informix and SQL Server | |
| 341 ** work. | |
| 342 */ | |
| 343 #define NULL_DISTINCT_FOR_UNIQUE 1 | |
| 344 | |
| 345 /* | |
| 346 ** The "file format" number is an integer that is incremented whenever | 343 ** The "file format" number is an integer that is incremented whenever |
| 347 ** the VDBE-level file format changes. The following macros define the | 344 ** the VDBE-level file format changes. The following macros define the |
| 348 ** the default file format for new databases and the maximum file format | 345 ** the default file format for new databases and the maximum file format |
| 349 ** that the library can read. | 346 ** that the library can read. |
| 350 */ | 347 */ |
| 351 #define SQLITE_MAX_FILE_FORMAT 4 | 348 #define SQLITE_MAX_FILE_FORMAT 4 |
| 352 #ifndef SQLITE_DEFAULT_FILE_FORMAT | 349 #ifndef SQLITE_DEFAULT_FILE_FORMAT |
| 353 # define SQLITE_DEFAULT_FILE_FORMAT 1 | 350 # define SQLITE_DEFAULT_FILE_FORMAT 1 |
| 354 #endif | 351 #endif |
| 355 | 352 |
| 353 /* |
| 354 ** Determine whether triggers are recursive by default. This can be |
| 355 ** changed at run-time using a pragma. |
| 356 */ |
| 356 #ifndef SQLITE_DEFAULT_RECURSIVE_TRIGGERS | 357 #ifndef SQLITE_DEFAULT_RECURSIVE_TRIGGERS |
| 357 # define SQLITE_DEFAULT_RECURSIVE_TRIGGERS 0 | 358 # define SQLITE_DEFAULT_RECURSIVE_TRIGGERS 0 |
| 358 #endif | 359 #endif |
| 359 | 360 |
| 360 /* | 361 /* |
| 361 ** Provide a default value for SQLITE_TEMP_STORE in case it is not specified | 362 ** Provide a default value for SQLITE_TEMP_STORE in case it is not specified |
| 362 ** on the command-line | 363 ** on the command-line |
| 363 */ | 364 */ |
| 364 #ifndef SQLITE_TEMP_STORE | 365 #ifndef SQLITE_TEMP_STORE |
| 365 # define SQLITE_TEMP_STORE 1 | 366 # define SQLITE_TEMP_STORE 1 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 ** to force 8-byte alignment on 64-bit architectures. | 478 ** to force 8-byte alignment on 64-bit architectures. |
| 478 */ | 479 */ |
| 479 #define ROUND8(x) (((x)+7)&~7) | 480 #define ROUND8(x) (((x)+7)&~7) |
| 480 | 481 |
| 481 /* | 482 /* |
| 482 ** Round down to the nearest multiple of 8 | 483 ** Round down to the nearest multiple of 8 |
| 483 */ | 484 */ |
| 484 #define ROUNDDOWN8(x) ((x)&~7) | 485 #define ROUNDDOWN8(x) ((x)&~7) |
| 485 | 486 |
| 486 /* | 487 /* |
| 487 ** Assert that the pointer X is aligned to an 8-byte boundary. | 488 ** Assert that the pointer X is aligned to an 8-byte boundary. This |
| 489 ** macro is used only within assert() to verify that the code gets |
| 490 ** all alignment restrictions correct. |
| 491 ** |
| 492 ** Except, if SQLITE_4_BYTE_ALIGNED_MALLOC is defined, then the |
| 493 ** underlying malloc() implemention might return us 4-byte aligned |
| 494 ** pointers. In that case, only verify 4-byte alignment. |
| 488 */ | 495 */ |
| 489 #define EIGHT_BYTE_ALIGNMENT(X) ((((char*)(X) - (char*)0)&7)==0) | 496 #ifdef SQLITE_4_BYTE_ALIGNED_MALLOC |
| 497 # define EIGHT_BYTE_ALIGNMENT(X) ((((char*)(X) - (char*)0)&3)==0) |
| 498 #else |
| 499 # define EIGHT_BYTE_ALIGNMENT(X) ((((char*)(X) - (char*)0)&7)==0) |
| 500 #endif |
| 490 | 501 |
| 491 | 502 |
| 492 /* | 503 /* |
| 493 ** An instance of the following structure is used to store the busy-handler | 504 ** An instance of the following structure is used to store the busy-handler |
| 494 ** callback for a given sqlite handle. | 505 ** callback for a given sqlite handle. |
| 495 ** | 506 ** |
| 496 ** The sqlite.busyHandler member of the sqlite struct contains the busy | 507 ** The sqlite.busyHandler member of the sqlite struct contains the busy |
| 497 ** callback for the database handle. Each pager opened via the sqlite | 508 ** callback for the database handle. Each pager opened via the sqlite |
| 498 ** handle is passed a pointer to sqlite.busyHandler. The busy-handler | 509 ** handle is passed a pointer to sqlite.busyHandler. The busy-handler |
| 499 ** callback is currently invoked only from within pager.c. | 510 ** callback is currently invoked only from within pager.c. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 #define UNUSED_PARAMETER(x) (void)(x) | 591 #define UNUSED_PARAMETER(x) (void)(x) |
| 581 #define UNUSED_PARAMETER2(x,y) UNUSED_PARAMETER(x),UNUSED_PARAMETER(y) | 592 #define UNUSED_PARAMETER2(x,y) UNUSED_PARAMETER(x),UNUSED_PARAMETER(y) |
| 582 | 593 |
| 583 /* | 594 /* |
| 584 ** Forward references to structures | 595 ** Forward references to structures |
| 585 */ | 596 */ |
| 586 typedef struct AggInfo AggInfo; | 597 typedef struct AggInfo AggInfo; |
| 587 typedef struct AuthContext AuthContext; | 598 typedef struct AuthContext AuthContext; |
| 588 typedef struct AutoincInfo AutoincInfo; | 599 typedef struct AutoincInfo AutoincInfo; |
| 589 typedef struct Bitvec Bitvec; | 600 typedef struct Bitvec Bitvec; |
| 590 typedef struct RowSet RowSet; | |
| 591 typedef struct CollSeq CollSeq; | 601 typedef struct CollSeq CollSeq; |
| 592 typedef struct Column Column; | 602 typedef struct Column Column; |
| 593 typedef struct Db Db; | 603 typedef struct Db Db; |
| 594 typedef struct Schema Schema; | 604 typedef struct Schema Schema; |
| 595 typedef struct Expr Expr; | 605 typedef struct Expr Expr; |
| 596 typedef struct ExprList ExprList; | 606 typedef struct ExprList ExprList; |
| 597 typedef struct ExprSpan ExprSpan; | 607 typedef struct ExprSpan ExprSpan; |
| 598 typedef struct FKey FKey; | 608 typedef struct FKey FKey; |
| 609 typedef struct FuncDestructor FuncDestructor; |
| 599 typedef struct FuncDef FuncDef; | 610 typedef struct FuncDef FuncDef; |
| 600 typedef struct FuncDefHash FuncDefHash; | 611 typedef struct FuncDefHash FuncDefHash; |
| 601 typedef struct IdList IdList; | 612 typedef struct IdList IdList; |
| 602 typedef struct Index Index; | 613 typedef struct Index Index; |
| 603 typedef struct IndexSample IndexSample; | 614 typedef struct IndexSample IndexSample; |
| 604 typedef struct KeyClass KeyClass; | 615 typedef struct KeyClass KeyClass; |
| 605 typedef struct KeyInfo KeyInfo; | 616 typedef struct KeyInfo KeyInfo; |
| 606 typedef struct Lookaside Lookaside; | 617 typedef struct Lookaside Lookaside; |
| 607 typedef struct LookasideSlot LookasideSlot; | 618 typedef struct LookasideSlot LookasideSlot; |
| 608 typedef struct Module Module; | 619 typedef struct Module Module; |
| 609 typedef struct NameContext NameContext; | 620 typedef struct NameContext NameContext; |
| 610 typedef struct Parse Parse; | 621 typedef struct Parse Parse; |
| 622 typedef struct RowSet RowSet; |
| 611 typedef struct Savepoint Savepoint; | 623 typedef struct Savepoint Savepoint; |
| 612 typedef struct Select Select; | 624 typedef struct Select Select; |
| 613 typedef struct SrcList SrcList; | 625 typedef struct SrcList SrcList; |
| 614 typedef struct StrAccum StrAccum; | 626 typedef struct StrAccum StrAccum; |
| 615 typedef struct Table Table; | 627 typedef struct Table Table; |
| 616 typedef struct TableLock TableLock; | 628 typedef struct TableLock TableLock; |
| 617 typedef struct Token Token; | 629 typedef struct Token Token; |
| 630 typedef struct Trigger Trigger; |
| 618 typedef struct TriggerPrg TriggerPrg; | 631 typedef struct TriggerPrg TriggerPrg; |
| 619 typedef struct TriggerStep TriggerStep; | 632 typedef struct TriggerStep TriggerStep; |
| 620 typedef struct Trigger Trigger; | |
| 621 typedef struct UnpackedRecord UnpackedRecord; | 633 typedef struct UnpackedRecord UnpackedRecord; |
| 622 typedef struct VTable VTable; | 634 typedef struct VTable VTable; |
| 623 typedef struct Walker Walker; | 635 typedef struct Walker Walker; |
| 624 typedef struct WherePlan WherePlan; | 636 typedef struct WherePlan WherePlan; |
| 625 typedef struct WhereInfo WhereInfo; | 637 typedef struct WhereInfo WhereInfo; |
| 626 typedef struct WhereLevel WhereLevel; | 638 typedef struct WhereLevel WhereLevel; |
| 627 | 639 |
| 628 /* | 640 /* |
| 629 ** Defer sourcing vdbe.h and btree.h until after the "u8" and | 641 ** Defer sourcing vdbe.h and btree.h until after the "u8" and |
| 630 ** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque | 642 ** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque |
| (...skipping 18 matching lines...) Expand all Loading... |
| 649 struct Db { | 661 struct Db { |
| 650 char *zName; /* Name of this database */ | 662 char *zName; /* Name of this database */ |
| 651 Btree *pBt; /* The B*Tree structure for this database file */ | 663 Btree *pBt; /* The B*Tree structure for this database file */ |
| 652 u8 inTrans; /* 0: not writable. 1: Transaction. 2: Checkpoint */ | 664 u8 inTrans; /* 0: not writable. 1: Transaction. 2: Checkpoint */ |
| 653 u8 safety_level; /* How aggressive at syncing data to disk */ | 665 u8 safety_level; /* How aggressive at syncing data to disk */ |
| 654 Schema *pSchema; /* Pointer to database schema (possibly shared) */ | 666 Schema *pSchema; /* Pointer to database schema (possibly shared) */ |
| 655 }; | 667 }; |
| 656 | 668 |
| 657 /* | 669 /* |
| 658 ** An instance of the following structure stores a database schema. | 670 ** An instance of the following structure stores a database schema. |
| 659 ** | |
| 660 ** If there are no virtual tables configured in this schema, the | |
| 661 ** Schema.db variable is set to NULL. After the first virtual table | |
| 662 ** has been added, it is set to point to the database connection | |
| 663 ** used to create the connection. Once a virtual table has been | |
| 664 ** added to the Schema structure and the Schema.db variable populated, | |
| 665 ** only that database connection may use the Schema to prepare | |
| 666 ** statements. | |
| 667 */ | 671 */ |
| 668 struct Schema { | 672 struct Schema { |
| 669 int schema_cookie; /* Database schema version number for this file */ | 673 int schema_cookie; /* Database schema version number for this file */ |
| 670 Hash tblHash; /* All tables indexed by name */ | 674 Hash tblHash; /* All tables indexed by name */ |
| 671 Hash idxHash; /* All (named) indices indexed by name */ | 675 Hash idxHash; /* All (named) indices indexed by name */ |
| 672 Hash trigHash; /* All triggers indexed by name */ | 676 Hash trigHash; /* All triggers indexed by name */ |
| 677 Hash fkeyHash; /* All foreign keys by referenced table name */ |
| 673 Table *pSeqTab; /* The sqlite_sequence table used by AUTOINCREMENT */ | 678 Table *pSeqTab; /* The sqlite_sequence table used by AUTOINCREMENT */ |
| 674 u8 file_format; /* Schema format version for this file */ | 679 u8 file_format; /* Schema format version for this file */ |
| 675 u8 enc; /* Text encoding used by this database */ | 680 u8 enc; /* Text encoding used by this database */ |
| 676 u16 flags; /* Flags associated with this schema */ | 681 u16 flags; /* Flags associated with this schema */ |
| 677 int cache_size; /* Number of pages to use in the cache */ | 682 int cache_size; /* Number of pages to use in the cache */ |
| 678 #ifndef SQLITE_OMIT_VIRTUALTABLE | |
| 679 sqlite3 *db; /* "Owner" connection. See comment above */ | |
| 680 #endif | |
| 681 }; | 683 }; |
| 682 | 684 |
| 683 /* | 685 /* |
| 684 ** These macros can be used to test, set, or clear bits in the | 686 ** These macros can be used to test, set, or clear bits in the |
| 685 ** Db.flags field. | 687 ** Db.pSchema->flags field. |
| 686 */ | 688 */ |
| 687 #define DbHasProperty(D,I,P) (((D)->aDb[I].pSchema->flags&(P))==(P)) | 689 #define DbHasProperty(D,I,P) (((D)->aDb[I].pSchema->flags&(P))==(P)) |
| 688 #define DbHasAnyProperty(D,I,P) (((D)->aDb[I].pSchema->flags&(P))!=0) | 690 #define DbHasAnyProperty(D,I,P) (((D)->aDb[I].pSchema->flags&(P))!=0) |
| 689 #define DbSetProperty(D,I,P) (D)->aDb[I].pSchema->flags|=(P) | 691 #define DbSetProperty(D,I,P) (D)->aDb[I].pSchema->flags|=(P) |
| 690 #define DbClearProperty(D,I,P) (D)->aDb[I].pSchema->flags&=~(P) | 692 #define DbClearProperty(D,I,P) (D)->aDb[I].pSchema->flags&=~(P) |
| 691 | 693 |
| 692 /* | 694 /* |
| 693 ** Allowed values for the DB.flags field. | 695 ** Allowed values for the DB.pSchema->flags field. |
| 694 ** | 696 ** |
| 695 ** The DB_SchemaLoaded flag is set after the database schema has been | 697 ** The DB_SchemaLoaded flag is set after the database schema has been |
| 696 ** read into internal hash tables. | 698 ** read into internal hash tables. |
| 697 ** | 699 ** |
| 698 ** DB_UnresetViews means that one or more views have column names that | 700 ** DB_UnresetViews means that one or more views have column names that |
| 699 ** have been filled out. If the schema changes, these column names might | 701 ** have been filled out. If the schema changes, these column names might |
| 700 ** changes and so the view will need to be reset. | 702 ** changes and so the view will need to be reset. |
| 701 */ | 703 */ |
| 702 #define DB_SchemaLoaded 0x0001 /* The schema has been loaded */ | 704 #define DB_SchemaLoaded 0x0001 /* The schema has been loaded */ |
| 703 #define DB_UnresetViews 0x0002 /* Some views have defined column names */ | 705 #define DB_UnresetViews 0x0002 /* Some views have defined column names */ |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 ** A hash table for function definitions. | 749 ** A hash table for function definitions. |
| 748 ** | 750 ** |
| 749 ** Hash each FuncDef structure into one of the FuncDefHash.a[] slots. | 751 ** Hash each FuncDef structure into one of the FuncDefHash.a[] slots. |
| 750 ** Collisions are on the FuncDef.pHash chain. | 752 ** Collisions are on the FuncDef.pHash chain. |
| 751 */ | 753 */ |
| 752 struct FuncDefHash { | 754 struct FuncDefHash { |
| 753 FuncDef *a[23]; /* Hash table for functions */ | 755 FuncDef *a[23]; /* Hash table for functions */ |
| 754 }; | 756 }; |
| 755 | 757 |
| 756 /* | 758 /* |
| 757 ** Each database is an instance of the following structure. | 759 ** Each database connection is an instance of the following structure. |
| 758 ** | 760 ** |
| 759 ** The sqlite.lastRowid records the last insert rowid generated by an | 761 ** The sqlite.lastRowid records the last insert rowid generated by an |
| 760 ** insert statement. Inserts on views do not affect its value. Each | 762 ** insert statement. Inserts on views do not affect its value. Each |
| 761 ** trigger has its own context, so that lastRowid can be updated inside | 763 ** trigger has its own context, so that lastRowid can be updated inside |
| 762 ** triggers as usual. The previous value will be restored once the trigger | 764 ** triggers as usual. The previous value will be restored once the trigger |
| 763 ** exits. Upon entering a before or instead of trigger, lastRowid is no | 765 ** exits. Upon entering a before or instead of trigger, lastRowid is no |
| 764 ** longer (since after version 2.8.12) reset to -1. | 766 ** longer (since after version 2.8.12) reset to -1. |
| 765 ** | 767 ** |
| 766 ** The sqlite.nChange does not count changes within triggers and keeps no | 768 ** The sqlite.nChange does not count changes within triggers and keeps no |
| 767 ** context. It is reset at start of sqlite3_exec. | 769 ** context. It is reset at start of sqlite3_exec. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 784 int nDb; /* Number of backends currently in use */ | 786 int nDb; /* Number of backends currently in use */ |
| 785 Db *aDb; /* All backends */ | 787 Db *aDb; /* All backends */ |
| 786 int flags; /* Miscellaneous flags. See below */ | 788 int flags; /* Miscellaneous flags. See below */ |
| 787 int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */ | 789 int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */ |
| 788 int errCode; /* Most recent error code (SQLITE_*) */ | 790 int errCode; /* Most recent error code (SQLITE_*) */ |
| 789 int errMask; /* & result codes with this before returning */ | 791 int errMask; /* & result codes with this before returning */ |
| 790 u8 autoCommit; /* The auto-commit flag. */ | 792 u8 autoCommit; /* The auto-commit flag. */ |
| 791 u8 temp_store; /* 1: file 2: memory 0: default */ | 793 u8 temp_store; /* 1: file 2: memory 0: default */ |
| 792 u8 mallocFailed; /* True if we have seen a malloc failure */ | 794 u8 mallocFailed; /* True if we have seen a malloc failure */ |
| 793 u8 dfltLockMode; /* Default locking-mode for attached dbs */ | 795 u8 dfltLockMode; /* Default locking-mode for attached dbs */ |
| 794 u8 dfltJournalMode; /* Default journal mode for attached dbs */ | |
| 795 signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */ | 796 signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */ |
| 797 u8 suppressErr; /* Do not issue error messages if true */ |
| 796 int nextPagesize; /* Pagesize after VACUUM if >0 */ | 798 int nextPagesize; /* Pagesize after VACUUM if >0 */ |
| 797 int nTable; /* Number of tables in the database */ | 799 int nTable; /* Number of tables in the database */ |
| 798 CollSeq *pDfltColl; /* The default collating sequence (BINARY) */ | 800 CollSeq *pDfltColl; /* The default collating sequence (BINARY) */ |
| 799 i64 lastRowid; /* ROWID of most recent insert (see above) */ | 801 i64 lastRowid; /* ROWID of most recent insert (see above) */ |
| 800 u32 magic; /* Magic number for detect library misuse */ | 802 u32 magic; /* Magic number for detect library misuse */ |
| 801 int nChange; /* Value returned by sqlite3_changes() */ | 803 int nChange; /* Value returned by sqlite3_changes() */ |
| 802 int nTotalChange; /* Value returned by sqlite3_total_changes() */ | 804 int nTotalChange; /* Value returned by sqlite3_total_changes() */ |
| 803 sqlite3_mutex *mutex; /* Connection mutex */ | 805 sqlite3_mutex *mutex; /* Connection mutex */ |
| 804 int aLimit[SQLITE_N_LIMIT]; /* Limits */ | 806 int aLimit[SQLITE_N_LIMIT]; /* Limits */ |
| 805 struct sqlite3InitInfo { /* Information used during initialization */ | 807 struct sqlite3InitInfo { /* Information used during initialization */ |
| (...skipping 10 matching lines...) Expand all Loading... |
| 816 void (*xTrace)(void*,const char*); /* Trace function */ | 818 void (*xTrace)(void*,const char*); /* Trace function */ |
| 817 void *pTraceArg; /* Argument to the trace function */ | 819 void *pTraceArg; /* Argument to the trace function */ |
| 818 void (*xProfile)(void*,const char*,u64); /* Profiling function */ | 820 void (*xProfile)(void*,const char*,u64); /* Profiling function */ |
| 819 void *pProfileArg; /* Argument to profile function */ | 821 void *pProfileArg; /* Argument to profile function */ |
| 820 void *pCommitArg; /* Argument to xCommitCallback() */ | 822 void *pCommitArg; /* Argument to xCommitCallback() */ |
| 821 int (*xCommitCallback)(void*); /* Invoked at every commit. */ | 823 int (*xCommitCallback)(void*); /* Invoked at every commit. */ |
| 822 void *pRollbackArg; /* Argument to xRollbackCallback() */ | 824 void *pRollbackArg; /* Argument to xRollbackCallback() */ |
| 823 void (*xRollbackCallback)(void*); /* Invoked at every commit. */ | 825 void (*xRollbackCallback)(void*); /* Invoked at every commit. */ |
| 824 void *pUpdateArg; | 826 void *pUpdateArg; |
| 825 void (*xUpdateCallback)(void*,int, const char*,const char*,sqlite_int64); | 827 void (*xUpdateCallback)(void*,int, const char*,const char*,sqlite_int64); |
| 828 #ifndef SQLITE_OMIT_WAL |
| 829 int (*xWalCallback)(void *, sqlite3 *, const char *, int); |
| 830 void *pWalArg; |
| 831 #endif |
| 826 void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*); | 832 void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*); |
| 827 void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*); | 833 void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*); |
| 828 void *pCollNeededArg; | 834 void *pCollNeededArg; |
| 829 sqlite3_value *pErr; /* Most recent error message */ | 835 sqlite3_value *pErr; /* Most recent error message */ |
| 830 char *zErrMsg; /* Most recent error message (UTF-8 encoded) */ | 836 char *zErrMsg; /* Most recent error message (UTF-8 encoded) */ |
| 831 char *zErrMsg16; /* Most recent error message (UTF-16 encoded) */ | 837 char *zErrMsg16; /* Most recent error message (UTF-16 encoded) */ |
| 832 union { | 838 union { |
| 833 volatile int isInterrupted; /* True if sqlite3_interrupt has been called */ | 839 volatile int isInterrupted; /* True if sqlite3_interrupt has been called */ |
| 834 double notUsed1; /* Spacer */ | 840 double notUsed1; /* Spacer */ |
| 835 } u1; | 841 } u1; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 853 #endif | 859 #endif |
| 854 FuncDefHash aFunc; /* Hash table of connection functions */ | 860 FuncDefHash aFunc; /* Hash table of connection functions */ |
| 855 Hash aCollSeq; /* All collating sequences */ | 861 Hash aCollSeq; /* All collating sequences */ |
| 856 BusyHandler busyHandler; /* Busy callback */ | 862 BusyHandler busyHandler; /* Busy callback */ |
| 857 int busyTimeout; /* Busy handler timeout, in msec */ | 863 int busyTimeout; /* Busy handler timeout, in msec */ |
| 858 Db aDbStatic[2]; /* Static space for the 2 default backends */ | 864 Db aDbStatic[2]; /* Static space for the 2 default backends */ |
| 859 Savepoint *pSavepoint; /* List of active savepoints */ | 865 Savepoint *pSavepoint; /* List of active savepoints */ |
| 860 int nSavepoint; /* Number of non-transaction savepoints */ | 866 int nSavepoint; /* Number of non-transaction savepoints */ |
| 861 int nStatement; /* Number of nested statement-transactions */ | 867 int nStatement; /* Number of nested statement-transactions */ |
| 862 u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */ | 868 u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */ |
| 869 i64 nDeferredCons; /* Net deferred constraints this transaction. */ |
| 870 int *pnBytesFreed; /* If not NULL, increment this in DbFree() */ |
| 863 | 871 |
| 864 #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY | 872 #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY |
| 865 /* The following variables are all protected by the STATIC_MASTER | 873 /* The following variables are all protected by the STATIC_MASTER |
| 866 ** mutex, not by sqlite3.mutex. They are used by code in notify.c. | 874 ** mutex, not by sqlite3.mutex. They are used by code in notify.c. |
| 867 ** | 875 ** |
| 868 ** When X.pUnlockConnection==Y, that means that X is waiting for Y to | 876 ** When X.pUnlockConnection==Y, that means that X is waiting for Y to |
| 869 ** unlock so that it can proceed. | 877 ** unlock so that it can proceed. |
| 870 ** | 878 ** |
| 871 ** When X.pBlockingConnection==Y, that means that something that X tried | 879 ** When X.pBlockingConnection==Y, that means that something that X tried |
| 872 ** tried to do recently failed with an SQLITE_LOCKED error due to locks | 880 ** tried to do recently failed with an SQLITE_LOCKED error due to locks |
| 873 ** held by Y. | 881 ** held by Y. |
| 874 */ | 882 */ |
| 875 sqlite3 *pBlockingConnection; /* Connection that caused SQLITE_LOCKED */ | 883 sqlite3 *pBlockingConnection; /* Connection that caused SQLITE_LOCKED */ |
| 876 sqlite3 *pUnlockConnection; /* Connection to watch for unlock */ | 884 sqlite3 *pUnlockConnection; /* Connection to watch for unlock */ |
| 877 void *pUnlockArg; /* Argument to xUnlockNotify */ | 885 void *pUnlockArg; /* Argument to xUnlockNotify */ |
| 878 void (*xUnlockNotify)(void **, int); /* Unlock notify callback */ | 886 void (*xUnlockNotify)(void **, int); /* Unlock notify callback */ |
| 879 sqlite3 *pNextBlocked; /* Next in list of all blocked connections */ | 887 sqlite3 *pNextBlocked; /* Next in list of all blocked connections */ |
| 880 #endif | 888 #endif |
| 881 }; | 889 }; |
| 882 | 890 |
| 883 /* | 891 /* |
| 884 ** A macro to discover the encoding of a database. | 892 ** A macro to discover the encoding of a database. |
| 885 */ | 893 */ |
| 886 #define ENC(db) ((db)->aDb[0].pSchema->enc) | 894 #define ENC(db) ((db)->aDb[0].pSchema->enc) |
| 887 | 895 |
| 888 /* | 896 /* |
| 889 ** Possible values for the sqlite.flags and or Db.flags fields. | 897 ** Possible values for the sqlite3.flags. |
| 890 ** | |
| 891 ** On sqlite.flags, the SQLITE_InTrans value means that we have | |
| 892 ** executed a BEGIN. On Db.flags, SQLITE_InTrans means a statement | |
| 893 ** transaction is active on that particular database file. | |
| 894 */ | 898 */ |
| 895 #define SQLITE_VdbeTrace 0x00000001 /* True to trace VDBE execution */ | 899 #define SQLITE_VdbeTrace 0x00000100 /* True to trace VDBE execution */ |
| 896 #define SQLITE_InTrans 0x00000008 /* True if in a transaction */ | 900 #define SQLITE_InternChanges 0x00000200 /* Uncommitted Hash table changes */ |
| 897 #define SQLITE_InternChanges 0x00000010 /* Uncommitted Hash table changes */ | 901 #define SQLITE_FullColNames 0x00000400 /* Show full column names on SELECT */ |
| 898 #define SQLITE_FullColNames 0x00000020 /* Show full column names on SELECT */ | 902 #define SQLITE_ShortColNames 0x00000800 /* Show short columns names */ |
| 899 #define SQLITE_ShortColNames 0x00000040 /* Show short columns names */ | 903 #define SQLITE_CountRows 0x00001000 /* Count rows changed by INSERT, */ |
| 900 #define SQLITE_CountRows 0x00000080 /* Count rows changed by INSERT, */ | |
| 901 /* DELETE, or UPDATE and return */ | 904 /* DELETE, or UPDATE and return */ |
| 902 /* the count using a callback. */ | 905 /* the count using a callback. */ |
| 903 #define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */ | 906 #define SQLITE_NullCallback 0x00002000 /* Invoke the callback once if the */ |
| 904 /* result set is empty */ | 907 /* result set is empty */ |
| 905 #define SQLITE_SqlTrace 0x00000200 /* Debug print SQL as it executes */ | 908 #define SQLITE_SqlTrace 0x00004000 /* Debug print SQL as it executes */ |
| 906 #define SQLITE_VdbeListing 0x00000400 /* Debug listings of VDBE programs */ | 909 #define SQLITE_VdbeListing 0x00008000 /* Debug listings of VDBE programs */ |
| 907 #define SQLITE_WriteSchema 0x00000800 /* OK to update SQLITE_MASTER */ | 910 #define SQLITE_WriteSchema 0x00010000 /* OK to update SQLITE_MASTER */ |
| 908 #define SQLITE_NoReadlock 0x00001000 /* Readlocks are omitted when | 911 #define SQLITE_NoReadlock 0x00020000 /* Readlocks are omitted when |
| 909 ** accessing read-only databases */ | 912 ** accessing read-only databases */ |
| 910 #define SQLITE_IgnoreChecks 0x00002000 /* Do not enforce check constraints */ | 913 #define SQLITE_IgnoreChecks 0x00040000 /* Do not enforce check constraints */ |
| 911 #define SQLITE_ReadUncommitted 0x00004000 /* For shared-cache mode */ | 914 #define SQLITE_ReadUncommitted 0x0080000 /* For shared-cache mode */ |
| 912 #define SQLITE_LegacyFileFmt 0x00008000 /* Create new databases in format 1 */ | 915 #define SQLITE_LegacyFileFmt 0x00100000 /* Create new databases in format 1 */ |
| 913 #define SQLITE_FullFSync 0x00010000 /* Use full fsync on the backend */ | 916 #define SQLITE_FullFSync 0x00200000 /* Use full fsync on the backend */ |
| 914 #define SQLITE_LoadExtension 0x00020000 /* Enable load_extension */ | 917 #define SQLITE_LoadExtension 0x00400000 /* Enable load_extension */ |
| 918 #define SQLITE_RecoveryMode 0x00800000 /* Ignore schema errors */ |
| 919 #define SQLITE_ReverseOrder 0x01000000 /* Reverse unordered SELECTs */ |
| 920 #define SQLITE_RecTriggers 0x02000000 /* Enable recursive triggers */ |
| 921 #define SQLITE_ForeignKeys 0x04000000 /* Enforce foreign key constraints */ |
| 922 #define SQLITE_AutoIndex 0x08000000 /* Enable automatic indexes */ |
| 923 #define SQLITE_PreferBuiltin 0x10000000 /* Preference to built-in funcs */ |
| 915 | 924 |
| 916 #define SQLITE_RecoveryMode 0x00040000 /* Ignore schema errors */ | 925 /* |
| 917 #define SQLITE_ReverseOrder 0x00100000 /* Reverse unordered SELECTs */ | 926 ** Bits of the sqlite3.flags field that are used by the |
| 918 #define SQLITE_RecTriggers 0x00200000 /* Enable recursive triggers */ | 927 ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface. |
| 928 ** These must be the low-order bits of the flags field. |
| 929 */ |
| 930 #define SQLITE_QueryFlattener 0x01 /* Disable query flattening */ |
| 931 #define SQLITE_ColumnCache 0x02 /* Disable the column cache */ |
| 932 #define SQLITE_IndexSort 0x04 /* Disable indexes for sorting */ |
| 933 #define SQLITE_IndexSearch 0x08 /* Disable indexes for searching */ |
| 934 #define SQLITE_IndexCover 0x10 /* Disable index covering table */ |
| 935 #define SQLITE_GroupByOrder 0x20 /* Disable GROUPBY cover of ORDERBY */ |
| 936 #define SQLITE_OptMask 0xff /* Mask of all disablable opts */ |
| 919 | 937 |
| 920 /* | 938 /* |
| 921 ** Possible values for the sqlite.magic field. | 939 ** Possible values for the sqlite.magic field. |
| 922 ** The numbers are obtained at random and have no special meaning, other | 940 ** The numbers are obtained at random and have no special meaning, other |
| 923 ** than being distinct from one another. | 941 ** than being distinct from one another. |
| 924 */ | 942 */ |
| 925 #define SQLITE_MAGIC_OPEN 0xa029a697 /* Database is open */ | 943 #define SQLITE_MAGIC_OPEN 0xa029a697 /* Database is open */ |
| 926 #define SQLITE_MAGIC_CLOSED 0x9f3c2d33 /* Database is closed */ | 944 #define SQLITE_MAGIC_CLOSED 0x9f3c2d33 /* Database is closed */ |
| 927 #define SQLITE_MAGIC_SICK 0x4b771290 /* Error and awaiting close */ | 945 #define SQLITE_MAGIC_SICK 0x4b771290 /* Error and awaiting close */ |
| 928 #define SQLITE_MAGIC_BUSY 0xf03b7906 /* Database currently in use */ | 946 #define SQLITE_MAGIC_BUSY 0xf03b7906 /* Database currently in use */ |
| 929 #define SQLITE_MAGIC_ERROR 0xb5357930 /* An SQLITE_MISUSE error occurred */ | 947 #define SQLITE_MAGIC_ERROR 0xb5357930 /* An SQLITE_MISUSE error occurred */ |
| 930 | 948 |
| 931 /* | 949 /* |
| 932 ** Each SQL function is defined by an instance of the following | 950 ** Each SQL function is defined by an instance of the following |
| 933 ** structure. A pointer to this structure is stored in the sqlite.aFunc | 951 ** structure. A pointer to this structure is stored in the sqlite.aFunc |
| 934 ** hash table. When multiple functions have the same name, the hash table | 952 ** hash table. When multiple functions have the same name, the hash table |
| 935 ** points to a linked list of these structures. | 953 ** points to a linked list of these structures. |
| 936 */ | 954 */ |
| 937 struct FuncDef { | 955 struct FuncDef { |
| 938 i16 nArg; /* Number of arguments. -1 means unlimited */ | 956 i16 nArg; /* Number of arguments. -1 means unlimited */ |
| 939 u8 iPrefEnc; /* Preferred text encoding (SQLITE_UTF8, 16LE, 16BE) */ | 957 u8 iPrefEnc; /* Preferred text encoding (SQLITE_UTF8, 16LE, 16BE) */ |
| 940 u8 flags; /* Some combination of SQLITE_FUNC_* */ | 958 u8 flags; /* Some combination of SQLITE_FUNC_* */ |
| 941 void *pUserData; /* User data parameter */ | 959 void *pUserData; /* User data parameter */ |
| 942 FuncDef *pNext; /* Next function with same name */ | 960 FuncDef *pNext; /* Next function with same name */ |
| 943 void (*xFunc)(sqlite3_context*,int,sqlite3_value**); /* Regular function */ | 961 void (*xFunc)(sqlite3_context*,int,sqlite3_value**); /* Regular function */ |
| 944 void (*xStep)(sqlite3_context*,int,sqlite3_value**); /* Aggregate step */ | 962 void (*xStep)(sqlite3_context*,int,sqlite3_value**); /* Aggregate step */ |
| 945 void (*xFinalize)(sqlite3_context*); /* Aggregate finalizer */ | 963 void (*xFinalize)(sqlite3_context*); /* Aggregate finalizer */ |
| 946 char *zName; /* SQL name of the function. */ | 964 char *zName; /* SQL name of the function. */ |
| 947 FuncDef *pHash; /* Next with a different name but the same hash */ | 965 FuncDef *pHash; /* Next with a different name but the same hash */ |
| 966 FuncDestructor *pDestructor; /* Reference counted destructor function */ |
| 948 }; | 967 }; |
| 949 | 968 |
| 950 /* | 969 /* |
| 970 ** This structure encapsulates a user-function destructor callback (as |
| 971 ** configured using create_function_v2()) and a reference counter. When |
| 972 ** create_function_v2() is called to create a function with a destructor, |
| 973 ** a single object of this type is allocated. FuncDestructor.nRef is set to |
| 974 ** the number of FuncDef objects created (either 1 or 3, depending on whether |
| 975 ** or not the specified encoding is SQLITE_ANY). The FuncDef.pDestructor |
| 976 ** member of each of the new FuncDef objects is set to point to the allocated |
| 977 ** FuncDestructor. |
| 978 ** |
| 979 ** Thereafter, when one of the FuncDef objects is deleted, the reference |
| 980 ** count on this object is decremented. When it reaches 0, the destructor |
| 981 ** is invoked and the FuncDestructor structure freed. |
| 982 */ |
| 983 struct FuncDestructor { |
| 984 int nRef; |
| 985 void (*xDestroy)(void *); |
| 986 void *pUserData; |
| 987 }; |
| 988 |
| 989 /* |
| 951 ** Possible values for FuncDef.flags | 990 ** Possible values for FuncDef.flags |
| 952 */ | 991 */ |
| 953 #define SQLITE_FUNC_LIKE 0x01 /* Candidate for the LIKE optimization */ | 992 #define SQLITE_FUNC_LIKE 0x01 /* Candidate for the LIKE optimization */ |
| 954 #define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */ | 993 #define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */ |
| 955 #define SQLITE_FUNC_EPHEM 0x04 /* Ephemeral. Delete with VDBE */ | 994 #define SQLITE_FUNC_EPHEM 0x04 /* Ephemeral. Delete with VDBE */ |
| 956 #define SQLITE_FUNC_NEEDCOLL 0x08 /* sqlite3GetFuncCollSeq() might be called */ | 995 #define SQLITE_FUNC_NEEDCOLL 0x08 /* sqlite3GetFuncCollSeq() might be called */ |
| 957 #define SQLITE_FUNC_PRIVATE 0x10 /* Allowed for internal use only */ | 996 #define SQLITE_FUNC_PRIVATE 0x10 /* Allowed for internal use only */ |
| 958 #define SQLITE_FUNC_COUNT 0x20 /* Built-in count(*) aggregate */ | 997 #define SQLITE_FUNC_COUNT 0x20 /* Built-in count(*) aggregate */ |
| 998 #define SQLITE_FUNC_COALESCE 0x40 /* Built-in coalesce() or ifnull() function */ |
| 959 | 999 |
| 960 /* | 1000 /* |
| 961 ** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are | 1001 ** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are |
| 962 ** used to create the initializers for the FuncDef structures. | 1002 ** used to create the initializers for the FuncDef structures. |
| 963 ** | 1003 ** |
| 964 ** FUNCTION(zName, nArg, iArg, bNC, xFunc) | 1004 ** FUNCTION(zName, nArg, iArg, bNC, xFunc) |
| 965 ** Used to create a scalar function definition of a function zName | 1005 ** Used to create a scalar function definition of a function zName |
| 966 ** implemented by C function xFunc that accepts nArg arguments. The | 1006 ** implemented by C function xFunc that accepts nArg arguments. The |
| 967 ** value passed as iArg is cast to a (void*) and made available | 1007 ** value passed as iArg is cast to a (void*) and made available |
| 968 ** as the user-data (sqlite3_user_data()) for the function. If | 1008 ** as the user-data (sqlite3_user_data()) for the function. If |
| 969 ** argument bNC is true, then the SQLITE_FUNC_NEEDCOLL flag is set. | 1009 ** argument bNC is true, then the SQLITE_FUNC_NEEDCOLL flag is set. |
| 970 ** | 1010 ** |
| 971 ** AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal) | 1011 ** AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal) |
| 972 ** Used to create an aggregate function definition implemented by | 1012 ** Used to create an aggregate function definition implemented by |
| 973 ** the C functions xStep and xFinal. The first four parameters | 1013 ** the C functions xStep and xFinal. The first four parameters |
| 974 ** are interpreted in the same way as the first 4 parameters to | 1014 ** are interpreted in the same way as the first 4 parameters to |
| 975 ** FUNCTION(). | 1015 ** FUNCTION(). |
| 976 ** | 1016 ** |
| 977 ** LIKEFUNC(zName, nArg, pArg, flags) | 1017 ** LIKEFUNC(zName, nArg, pArg, flags) |
| 978 ** Used to create a scalar function definition of a function zName | 1018 ** Used to create a scalar function definition of a function zName |
| 979 ** that accepts nArg arguments and is implemented by a call to C | 1019 ** that accepts nArg arguments and is implemented by a call to C |
| 980 ** function likeFunc. Argument pArg is cast to a (void *) and made | 1020 ** function likeFunc. Argument pArg is cast to a (void *) and made |
| 981 ** available as the function user-data (sqlite3_user_data()). The | 1021 ** available as the function user-data (sqlite3_user_data()). The |
| 982 ** FuncDef.flags variable is set to the value passed as the flags | 1022 ** FuncDef.flags variable is set to the value passed as the flags |
| 983 ** parameter. | 1023 ** parameter. |
| 984 */ | 1024 */ |
| 985 #define FUNCTION(zName, nArg, iArg, bNC, xFunc) \ | 1025 #define FUNCTION(zName, nArg, iArg, bNC, xFunc) \ |
| 986 {nArg, SQLITE_UTF8, bNC*SQLITE_FUNC_NEEDCOLL, \ | 1026 {nArg, SQLITE_UTF8, bNC*SQLITE_FUNC_NEEDCOLL, \ |
| 987 SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName, 0} | 1027 SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName, 0, 0} |
| 988 #define STR_FUNCTION(zName, nArg, pArg, bNC, xFunc) \ | 1028 #define STR_FUNCTION(zName, nArg, pArg, bNC, xFunc) \ |
| 989 {nArg, SQLITE_UTF8, bNC*SQLITE_FUNC_NEEDCOLL, \ | 1029 {nArg, SQLITE_UTF8, bNC*SQLITE_FUNC_NEEDCOLL, \ |
| 990 pArg, 0, xFunc, 0, 0, #zName, 0} | 1030 pArg, 0, xFunc, 0, 0, #zName, 0, 0} |
| 991 #define LIKEFUNC(zName, nArg, arg, flags) \ | 1031 #define LIKEFUNC(zName, nArg, arg, flags) \ |
| 992 {nArg, SQLITE_UTF8, flags, (void *)arg, 0, likeFunc, 0, 0, #zName, 0} | 1032 {nArg, SQLITE_UTF8, flags, (void *)arg, 0, likeFunc, 0, 0, #zName, 0, 0} |
| 993 #define AGGREGATE(zName, nArg, arg, nc, xStep, xFinal) \ | 1033 #define AGGREGATE(zName, nArg, arg, nc, xStep, xFinal) \ |
| 994 {nArg, SQLITE_UTF8, nc*SQLITE_FUNC_NEEDCOLL, \ | 1034 {nArg, SQLITE_UTF8, nc*SQLITE_FUNC_NEEDCOLL, \ |
| 995 SQLITE_INT_TO_PTR(arg), 0, 0, xStep,xFinal,#zName,0} | 1035 SQLITE_INT_TO_PTR(arg), 0, 0, xStep,xFinal,#zName,0,0} |
| 996 | 1036 |
| 997 /* | 1037 /* |
| 998 ** All current savepoints are stored in a linked list starting at | 1038 ** All current savepoints are stored in a linked list starting at |
| 999 ** sqlite3.pSavepoint. The first element in the list is the most recently | 1039 ** sqlite3.pSavepoint. The first element in the list is the most recently |
| 1000 ** opened savepoint. Savepoints are added to the list by the vdbe | 1040 ** opened savepoint. Savepoints are added to the list by the vdbe |
| 1001 ** OP_Savepoint instruction. | 1041 ** OP_Savepoint instruction. |
| 1002 */ | 1042 */ |
| 1003 struct Savepoint { | 1043 struct Savepoint { |
| 1004 char *zName; /* Savepoint name (nul-terminated) */ | 1044 char *zName; /* Savepoint name (nul-terminated) */ |
| 1045 i64 nDeferredCons; /* Number of deferred fk violations */ |
| 1005 Savepoint *pNext; /* Parent savepoint (if any) */ | 1046 Savepoint *pNext; /* Parent savepoint (if any) */ |
| 1006 }; | 1047 }; |
| 1007 | 1048 |
| 1008 /* | 1049 /* |
| 1009 ** The following are used as the second parameter to sqlite3Savepoint(), | 1050 ** The following are used as the second parameter to sqlite3Savepoint(), |
| 1010 ** and as the P1 argument to the OP_Savepoint instruction. | 1051 ** and as the P1 argument to the OP_Savepoint instruction. |
| 1011 */ | 1052 */ |
| 1012 #define SAVEPOINT_BEGIN 0 | 1053 #define SAVEPOINT_BEGIN 0 |
| 1013 #define SAVEPOINT_RELEASE 1 | 1054 #define SAVEPOINT_RELEASE 1 |
| 1014 #define SAVEPOINT_ROLLBACK 2 | 1055 #define SAVEPOINT_ROLLBACK 2 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 ** affinity value. | 1156 ** affinity value. |
| 1116 */ | 1157 */ |
| 1117 #define SQLITE_AFF_MASK 0x67 | 1158 #define SQLITE_AFF_MASK 0x67 |
| 1118 | 1159 |
| 1119 /* | 1160 /* |
| 1120 ** Additional bit values that can be ORed with an affinity without | 1161 ** Additional bit values that can be ORed with an affinity without |
| 1121 ** changing the affinity. | 1162 ** changing the affinity. |
| 1122 */ | 1163 */ |
| 1123 #define SQLITE_JUMPIFNULL 0x08 /* jumps if either operand is NULL */ | 1164 #define SQLITE_JUMPIFNULL 0x08 /* jumps if either operand is NULL */ |
| 1124 #define SQLITE_STOREP2 0x10 /* Store result in reg[P2] rather than jump */ | 1165 #define SQLITE_STOREP2 0x10 /* Store result in reg[P2] rather than jump */ |
| 1166 #define SQLITE_NULLEQ 0x80 /* NULL=NULL */ |
| 1125 | 1167 |
| 1126 /* | 1168 /* |
| 1127 ** An object of this type is created for each virtual table present in | 1169 ** An object of this type is created for each virtual table present in |
| 1128 ** the database schema. | 1170 ** the database schema. |
| 1129 ** | 1171 ** |
| 1130 ** If the database schema is shared, then there is one instance of this | 1172 ** If the database schema is shared, then there is one instance of this |
| 1131 ** structure for each database connection (sqlite3*) that uses the shared | 1173 ** structure for each database connection (sqlite3*) that uses the shared |
| 1132 ** schema. This is because each database connection requires its own unique | 1174 ** schema. This is because each database connection requires its own unique |
| 1133 ** instance of the sqlite3_vtab* handle used to access the virtual table | 1175 ** instance of the sqlite3_vtab* handle used to access the virtual table |
| 1134 ** implementation. sqlite3_vtab* handles can not be shared between | 1176 ** implementation. sqlite3_vtab* handles can not be shared between |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 ** in sqlite.aDb[]. 0 is for the main database and 1 is for the file that | 1239 ** in sqlite.aDb[]. 0 is for the main database and 1 is for the file that |
| 1198 ** holds temporary tables and indices. If TF_Ephemeral is set | 1240 ** holds temporary tables and indices. If TF_Ephemeral is set |
| 1199 ** then the table is stored in a file that is automatically deleted | 1241 ** then the table is stored in a file that is automatically deleted |
| 1200 ** when the VDBE cursor to the table is closed. In this case Table.tnum | 1242 ** when the VDBE cursor to the table is closed. In this case Table.tnum |
| 1201 ** refers VDBE cursor number that holds the table open, not to the root | 1243 ** refers VDBE cursor number that holds the table open, not to the root |
| 1202 ** page number. Transient tables are used to hold the results of a | 1244 ** page number. Transient tables are used to hold the results of a |
| 1203 ** sub-query that appears instead of a real table name in the FROM clause | 1245 ** sub-query that appears instead of a real table name in the FROM clause |
| 1204 ** of a SELECT statement. | 1246 ** of a SELECT statement. |
| 1205 */ | 1247 */ |
| 1206 struct Table { | 1248 struct Table { |
| 1207 sqlite3 *dbMem; /* DB connection used for lookaside allocations. */ | |
| 1208 char *zName; /* Name of the table or view */ | 1249 char *zName; /* Name of the table or view */ |
| 1209 int iPKey; /* If not negative, use aCol[iPKey] as the primary key */ | 1250 int iPKey; /* If not negative, use aCol[iPKey] as the primary key */ |
| 1210 int nCol; /* Number of columns in this table */ | 1251 int nCol; /* Number of columns in this table */ |
| 1211 Column *aCol; /* Information about each column */ | 1252 Column *aCol; /* Information about each column */ |
| 1212 Index *pIndex; /* List of SQL indexes on this table. */ | 1253 Index *pIndex; /* List of SQL indexes on this table. */ |
| 1213 int tnum; /* Root BTree node for this table (see note above) */ | 1254 int tnum; /* Root BTree node for this table (see note above) */ |
| 1255 unsigned nRowEst; /* Estimated rows in table - from sqlite_stat1 table */ |
| 1214 Select *pSelect; /* NULL for tables. Points to definition if a view. */ | 1256 Select *pSelect; /* NULL for tables. Points to definition if a view. */ |
| 1215 u16 nRef; /* Number of pointers to this Table */ | 1257 u16 nRef; /* Number of pointers to this Table */ |
| 1216 u8 tabFlags; /* Mask of TF_* values */ | 1258 u8 tabFlags; /* Mask of TF_* values */ |
| 1217 u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */ | 1259 u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */ |
| 1218 FKey *pFKey; /* Linked list of all foreign keys in this table */ | 1260 FKey *pFKey; /* Linked list of all foreign keys in this table */ |
| 1219 char *zColAff; /* String defining the affinity of each column */ | 1261 char *zColAff; /* String defining the affinity of each column */ |
| 1220 #ifndef SQLITE_OMIT_CHECK | 1262 #ifndef SQLITE_OMIT_CHECK |
| 1221 Expr *pCheck; /* The AND of all CHECK constraints */ | 1263 Expr *pCheck; /* The AND of all CHECK constraints */ |
| 1222 #endif | 1264 #endif |
| 1223 #ifndef SQLITE_OMIT_ALTERTABLE | 1265 #ifndef SQLITE_OMIT_ALTERTABLE |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1271 ** b INTEGER CONSTRAINT fk1 REFERENCES ex2(x) | 1313 ** b INTEGER CONSTRAINT fk1 REFERENCES ex2(x) |
| 1272 ** ); | 1314 ** ); |
| 1273 ** | 1315 ** |
| 1274 ** For foreign key "fk1", the from-table is "ex1" and the to-table is "ex2". | 1316 ** For foreign key "fk1", the from-table is "ex1" and the to-table is "ex2". |
| 1275 ** | 1317 ** |
| 1276 ** Each REFERENCES clause generates an instance of the following structure | 1318 ** Each REFERENCES clause generates an instance of the following structure |
| 1277 ** which is attached to the from-table. The to-table need not exist when | 1319 ** which is attached to the from-table. The to-table need not exist when |
| 1278 ** the from-table is created. The existence of the to-table is not checked. | 1320 ** the from-table is created. The existence of the to-table is not checked. |
| 1279 */ | 1321 */ |
| 1280 struct FKey { | 1322 struct FKey { |
| 1281 Table *pFrom; /* The table that contains the REFERENCES clause */ | 1323 Table *pFrom; /* Table containing the REFERENCES clause (aka: Child) */ |
| 1282 FKey *pNextFrom; /* Next foreign key in pFrom */ | 1324 FKey *pNextFrom; /* Next foreign key in pFrom */ |
| 1283 char *zTo; /* Name of table that the key points to */ | 1325 char *zTo; /* Name of table that the key points to (aka: Parent) */ |
| 1326 FKey *pNextTo; /* Next foreign key on table named zTo */ |
| 1327 FKey *pPrevTo; /* Previous foreign key on table named zTo */ |
| 1284 int nCol; /* Number of columns in this key */ | 1328 int nCol; /* Number of columns in this key */ |
| 1329 /* EV: R-30323-21917 */ |
| 1285 u8 isDeferred; /* True if constraint checking is deferred till COMMIT */ | 1330 u8 isDeferred; /* True if constraint checking is deferred till COMMIT */ |
| 1286 u8 updateConf; /* How to resolve conflicts that occur on UPDATE */ | 1331 u8 aAction[2]; /* ON DELETE and ON UPDATE actions, respectively */ |
| 1287 u8 deleteConf; /* How to resolve conflicts that occur on DELETE */ | 1332 Trigger *apTrigger[2]; /* Triggers for aAction[] actions */ |
| 1288 u8 insertConf; /* How to resolve conflicts that occur on INSERT */ | |
| 1289 struct sColMap { /* Mapping of columns in pFrom to columns in zTo */ | 1333 struct sColMap { /* Mapping of columns in pFrom to columns in zTo */ |
| 1290 int iFrom; /* Index of column in pFrom */ | 1334 int iFrom; /* Index of column in pFrom */ |
| 1291 char *zCol; /* Name of column in zTo. If 0 use PRIMARY KEY */ | 1335 char *zCol; /* Name of column in zTo. If 0 use PRIMARY KEY */ |
| 1292 } aCol[1]; /* One entry for each of nCol column s */ | 1336 } aCol[1]; /* One entry for each of nCol column s */ |
| 1293 }; | 1337 }; |
| 1294 | 1338 |
| 1295 /* | 1339 /* |
| 1296 ** SQLite supports many different ways to resolve a constraint | 1340 ** SQLite supports many different ways to resolve a constraint |
| 1297 ** error. ROLLBACK processing means that a constraint violation | 1341 ** error. ROLLBACK processing means that a constraint violation |
| 1298 ** causes the operation in process to fail and for the current transaction | 1342 ** causes the operation in process to fail and for the current transaction |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1332 #define OE_Default 99 /* Do whatever the default action is */ | 1376 #define OE_Default 99 /* Do whatever the default action is */ |
| 1333 | 1377 |
| 1334 | 1378 |
| 1335 /* | 1379 /* |
| 1336 ** An instance of the following structure is passed as the first | 1380 ** An instance of the following structure is passed as the first |
| 1337 ** argument to sqlite3VdbeKeyCompare and is used to control the | 1381 ** argument to sqlite3VdbeKeyCompare and is used to control the |
| 1338 ** comparison of the two index keys. | 1382 ** comparison of the two index keys. |
| 1339 */ | 1383 */ |
| 1340 struct KeyInfo { | 1384 struct KeyInfo { |
| 1341 sqlite3 *db; /* The database connection */ | 1385 sqlite3 *db; /* The database connection */ |
| 1342 u8 enc; /* Text encoding - one of the TEXT_Utf* values */ | 1386 u8 enc; /* Text encoding - one of the SQLITE_UTF* values */ |
| 1343 u16 nField; /* Number of entries in aColl[] */ | 1387 u16 nField; /* Number of entries in aColl[] */ |
| 1344 u8 *aSortOrder; /* If defined an aSortOrder[i] is true, sort DESC */ | 1388 u8 *aSortOrder; /* Sort order for each column. May be NULL */ |
| 1345 CollSeq *aColl[1]; /* Collating sequence for each term of the key */ | 1389 CollSeq *aColl[1]; /* Collating sequence for each term of the key */ |
| 1346 }; | 1390 }; |
| 1347 | 1391 |
| 1348 /* | 1392 /* |
| 1349 ** An instance of the following structure holds information about a | 1393 ** An instance of the following structure holds information about a |
| 1350 ** single index record that has already been parsed out into individual | 1394 ** single index record that has already been parsed out into individual |
| 1351 ** values. | 1395 ** values. |
| 1352 ** | 1396 ** |
| 1353 ** A record is an object that contains one or more fields of data. | 1397 ** A record is an object that contains one or more fields of data. |
| 1354 ** Records are used to store the content of a table row and to store | 1398 ** Records are used to store the content of a table row and to store |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1484 Expr *pExpr; /* Expression encoding the function */ | 1528 Expr *pExpr; /* Expression encoding the function */ |
| 1485 FuncDef *pFunc; /* The aggregate function implementation */ | 1529 FuncDef *pFunc; /* The aggregate function implementation */ |
| 1486 int iMem; /* Memory location that acts as accumulator */ | 1530 int iMem; /* Memory location that acts as accumulator */ |
| 1487 int iDistinct; /* Ephemeral table used to enforce DISTINCT */ | 1531 int iDistinct; /* Ephemeral table used to enforce DISTINCT */ |
| 1488 } *aFunc; | 1532 } *aFunc; |
| 1489 int nFunc; /* Number of entries in aFunc[] */ | 1533 int nFunc; /* Number of entries in aFunc[] */ |
| 1490 int nFuncAlloc; /* Number of slots allocated for aFunc[] */ | 1534 int nFuncAlloc; /* Number of slots allocated for aFunc[] */ |
| 1491 }; | 1535 }; |
| 1492 | 1536 |
| 1493 /* | 1537 /* |
| 1538 ** The datatype ynVar is a signed integer, either 16-bit or 32-bit. |
| 1539 ** Usually it is 16-bits. But if SQLITE_MAX_VARIABLE_NUMBER is greater |
| 1540 ** than 32767 we have to make it 32-bit. 16-bit is preferred because |
| 1541 ** it uses less memory in the Expr object, which is a big memory user |
| 1542 ** in systems with lots of prepared statements. And few applications |
| 1543 ** need more than about 10 or 20 variables. But some extreme users want |
| 1544 ** to have prepared statements with over 32767 variables, and for them |
| 1545 ** the option is available (at compile-time). |
| 1546 */ |
| 1547 #if SQLITE_MAX_VARIABLE_NUMBER<=32767 |
| 1548 typedef i16 ynVar; |
| 1549 #else |
| 1550 typedef int ynVar; |
| 1551 #endif |
| 1552 |
| 1553 /* |
| 1494 ** Each node of an expression in the parse tree is an instance | 1554 ** Each node of an expression in the parse tree is an instance |
| 1495 ** of this structure. | 1555 ** of this structure. |
| 1496 ** | 1556 ** |
| 1497 ** Expr.op is the opcode. The integer parser token codes are reused | 1557 ** Expr.op is the opcode. The integer parser token codes are reused |
| 1498 ** as opcodes here. For example, the parser defines TK_GE to be an integer | 1558 ** as opcodes here. For example, the parser defines TK_GE to be an integer |
| 1499 ** code representing the ">=" operator. This same integer code is reused | 1559 ** code representing the ">=" operator. This same integer code is reused |
| 1500 ** to represent the greater-than-or-equal-to operator in the expression | 1560 ** to represent the greater-than-or-equal-to operator in the expression |
| 1501 ** tree. | 1561 ** tree. |
| 1502 ** | 1562 ** |
| 1503 ** If the expression is an SQL literal (TK_INTEGER, TK_FLOAT, TK_BLOB, | 1563 ** If the expression is an SQL literal (TK_INTEGER, TK_FLOAT, TK_BLOB, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1576 CollSeq *pColl; /* The collation type of the column or 0 */ | 1636 CollSeq *pColl; /* The collation type of the column or 0 */ |
| 1577 | 1637 |
| 1578 /* If the EP_Reduced flag is set in the Expr.flags mask, then no | 1638 /* If the EP_Reduced flag is set in the Expr.flags mask, then no |
| 1579 ** space is allocated for the fields below this point. An attempt to | 1639 ** space is allocated for the fields below this point. An attempt to |
| 1580 ** access them will result in a segfault or malfunction. | 1640 ** access them will result in a segfault or malfunction. |
| 1581 *********************************************************************/ | 1641 *********************************************************************/ |
| 1582 | 1642 |
| 1583 int iTable; /* TK_COLUMN: cursor number of table holding column | 1643 int iTable; /* TK_COLUMN: cursor number of table holding column |
| 1584 ** TK_REGISTER: register number | 1644 ** TK_REGISTER: register number |
| 1585 ** TK_TRIGGER: 1 -> new, 0 -> old */ | 1645 ** TK_TRIGGER: 1 -> new, 0 -> old */ |
| 1586 i16 iColumn; /* TK_COLUMN: column index. -1 for rowid */ | 1646 ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid. |
| 1647 ** TK_VARIABLE: variable number (always >= 1). */ |
| 1587 i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */ | 1648 i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */ |
| 1588 i16 iRightJoinTable; /* If EP_FromJoin, the right table of the join */ | 1649 i16 iRightJoinTable; /* If EP_FromJoin, the right table of the join */ |
| 1589 u8 flags2; /* Second set of flags. EP2_... */ | 1650 u8 flags2; /* Second set of flags. EP2_... */ |
| 1590 u8 op2; /* If a TK_REGISTER, the original value of Expr.op */ | 1651 u8 op2; /* If a TK_REGISTER, the original value of Expr.op */ |
| 1591 AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */ | 1652 AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */ |
| 1592 Table *pTab; /* Table for TK_COLUMN expressions. */ | 1653 Table *pTab; /* Table for TK_COLUMN expressions. */ |
| 1593 #if SQLITE_MAX_EXPR_DEPTH>0 | 1654 #if SQLITE_MAX_EXPR_DEPTH>0 |
| 1594 int nHeight; /* Height of the tree headed by this node */ | 1655 int nHeight; /* Height of the tree headed by this node */ |
| 1595 #endif | 1656 #endif |
| 1596 }; | 1657 }; |
| 1597 | 1658 |
| 1598 /* | 1659 /* |
| 1599 ** The following are the meanings of bits in the Expr.flags field. | 1660 ** The following are the meanings of bits in the Expr.flags field. |
| 1600 */ | 1661 */ |
| 1601 #define EP_FromJoin 0x0001 /* Originated in ON or USING clause of a join */ | 1662 #define EP_FromJoin 0x0001 /* Originated in ON or USING clause of a join */ |
| 1602 #define EP_Agg 0x0002 /* Contains one or more aggregate functions */ | 1663 #define EP_Agg 0x0002 /* Contains one or more aggregate functions */ |
| 1603 #define EP_Resolved 0x0004 /* IDs have been resolved to COLUMNs */ | 1664 #define EP_Resolved 0x0004 /* IDs have been resolved to COLUMNs */ |
| 1604 #define EP_Error 0x0008 /* Expression contains one or more errors */ | 1665 #define EP_Error 0x0008 /* Expression contains one or more errors */ |
| 1605 #define EP_Distinct 0x0010 /* Aggregate function with DISTINCT keyword */ | 1666 #define EP_Distinct 0x0010 /* Aggregate function with DISTINCT keyword */ |
| 1606 #define EP_VarSelect 0x0020 /* pSelect is correlated, not constant */ | 1667 #define EP_VarSelect 0x0020 /* pSelect is correlated, not constant */ |
| 1607 #define EP_DblQuoted 0x0040 /* token.z was originally in "..." */ | 1668 #define EP_DblQuoted 0x0040 /* token.z was originally in "..." */ |
| 1608 #define EP_InfixFunc 0x0080 /* True for an infix function: LIKE, GLOB, etc */ | 1669 #define EP_InfixFunc 0x0080 /* True for an infix function: LIKE, GLOB, etc */ |
| 1609 #define EP_ExpCollate 0x0100 /* Collating sequence specified explicitly */ | 1670 #define EP_ExpCollate 0x0100 /* Collating sequence specified explicitly */ |
| 1610 #define EP_AnyAff 0x0200 /* Can take a cached column of any affinity */ | 1671 #define EP_FixedDest 0x0200 /* Result needed in a specific register */ |
| 1611 #define EP_FixedDest 0x0400 /* Result needed in a specific register */ | 1672 #define EP_IntValue 0x0400 /* Integer value contained in u.iValue */ |
| 1612 #define EP_IntValue 0x0800 /* Integer value contained in u.iValue */ | 1673 #define EP_xIsSelect 0x0800 /* x.pSelect is valid (otherwise x.pList is) */ |
| 1613 #define EP_xIsSelect 0x1000 /* x.pSelect is valid (otherwise x.pList is) */ | |
| 1614 | 1674 |
| 1615 #define EP_Reduced 0x2000 /* Expr struct is EXPR_REDUCEDSIZE bytes only */ | 1675 #define EP_Reduced 0x1000 /* Expr struct is EXPR_REDUCEDSIZE bytes only */ |
| 1616 #define EP_TokenOnly 0x4000 /* Expr struct is EXPR_TOKENONLYSIZE bytes only */ | 1676 #define EP_TokenOnly 0x2000 /* Expr struct is EXPR_TOKENONLYSIZE bytes only */ |
| 1617 #define EP_Static 0x8000 /* Held in memory not obtained from malloc() */ | 1677 #define EP_Static 0x4000 /* Held in memory not obtained from malloc() */ |
| 1618 | 1678 |
| 1619 /* | 1679 /* |
| 1620 ** The following are the meanings of bits in the Expr.flags2 field. | 1680 ** The following are the meanings of bits in the Expr.flags2 field. |
| 1621 */ | 1681 */ |
| 1622 #define EP2_MallocedToken 0x0001 /* Need to sqlite3DbFree() Expr.zToken */ | 1682 #define EP2_MallocedToken 0x0001 /* Need to sqlite3DbFree() Expr.zToken */ |
| 1623 #define EP2_Irreducible 0x0002 /* Cannot EXPRDUP_REDUCE this Expr */ | 1683 #define EP2_Irreducible 0x0002 /* Cannot EXPRDUP_REDUCE this Expr */ |
| 1624 | 1684 |
| 1625 /* | 1685 /* |
| 1626 ** The pseudo-routine sqlite3ExprSetIrreducible sets the EP2_Irreducible | 1686 ** The pseudo-routine sqlite3ExprSetIrreducible sets the EP2_Irreducible |
| 1627 ** flag on an expression structure. This flag is used for VV&A only. The | 1687 ** flag on an expression structure. This flag is used for VV&A only. The |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1738 ** With the addition of multiple database support, the following structure | 1798 ** With the addition of multiple database support, the following structure |
| 1739 ** can also be used to describe a particular table such as the table that | 1799 ** can also be used to describe a particular table such as the table that |
| 1740 ** is modified by an INSERT, DELETE, or UPDATE statement. In standard SQL, | 1800 ** is modified by an INSERT, DELETE, or UPDATE statement. In standard SQL, |
| 1741 ** such a table must be a simple name: ID. But in SQLite, the table can | 1801 ** such a table must be a simple name: ID. But in SQLite, the table can |
| 1742 ** now be identified by a database name, a dot, then the table name: ID.ID. | 1802 ** now be identified by a database name, a dot, then the table name: ID.ID. |
| 1743 ** | 1803 ** |
| 1744 ** The jointype starts out showing the join type between the current table | 1804 ** The jointype starts out showing the join type between the current table |
| 1745 ** and the next table on the list. The parser builds the list this way. | 1805 ** and the next table on the list. The parser builds the list this way. |
| 1746 ** But sqlite3SrcListShiftJoinType() later shifts the jointypes so that each | 1806 ** But sqlite3SrcListShiftJoinType() later shifts the jointypes so that each |
| 1747 ** jointype expresses the join between the table and the previous table. | 1807 ** jointype expresses the join between the table and the previous table. |
| 1808 ** |
| 1809 ** In the colUsed field, the high-order bit (bit 63) is set if the table |
| 1810 ** contains more than 63 columns and the 64-th or later column is used. |
| 1748 */ | 1811 */ |
| 1749 struct SrcList { | 1812 struct SrcList { |
| 1750 i16 nSrc; /* Number of tables or subqueries in the FROM clause */ | 1813 i16 nSrc; /* Number of tables or subqueries in the FROM clause */ |
| 1751 i16 nAlloc; /* Number of entries allocated in a[] below */ | 1814 i16 nAlloc; /* Number of entries allocated in a[] below */ |
| 1752 struct SrcList_item { | 1815 struct SrcList_item { |
| 1753 char *zDatabase; /* Name of database holding this table */ | 1816 char *zDatabase; /* Name of database holding this table */ |
| 1754 char *zName; /* Name of the table */ | 1817 char *zName; /* Name of the table */ |
| 1755 char *zAlias; /* The "B" part of a "A AS B" phrase. zName is the "A" */ | 1818 char *zAlias; /* The "B" part of a "A AS B" phrase. zName is the "A" */ |
| 1756 Table *pTab; /* An SQL table corresponding to zName */ | 1819 Table *pTab; /* An SQL table corresponding to zName */ |
| 1757 Select *pSelect; /* A SELECT statement used in place of a table name */ | 1820 Select *pSelect; /* A SELECT statement used in place of a table name */ |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1849 | 1912 |
| 1850 /* | 1913 /* |
| 1851 ** Flags appropriate for the wctrlFlags parameter of sqlite3WhereBegin() | 1914 ** Flags appropriate for the wctrlFlags parameter of sqlite3WhereBegin() |
| 1852 ** and the WhereInfo.wctrlFlags member. | 1915 ** and the WhereInfo.wctrlFlags member. |
| 1853 */ | 1916 */ |
| 1854 #define WHERE_ORDERBY_NORMAL 0x0000 /* No-op */ | 1917 #define WHERE_ORDERBY_NORMAL 0x0000 /* No-op */ |
| 1855 #define WHERE_ORDERBY_MIN 0x0001 /* ORDER BY processing for min() func */ | 1918 #define WHERE_ORDERBY_MIN 0x0001 /* ORDER BY processing for min() func */ |
| 1856 #define WHERE_ORDERBY_MAX 0x0002 /* ORDER BY processing for max() func */ | 1919 #define WHERE_ORDERBY_MAX 0x0002 /* ORDER BY processing for max() func */ |
| 1857 #define WHERE_ONEPASS_DESIRED 0x0004 /* Want to do one-pass UPDATE/DELETE */ | 1920 #define WHERE_ONEPASS_DESIRED 0x0004 /* Want to do one-pass UPDATE/DELETE */ |
| 1858 #define WHERE_DUPLICATES_OK 0x0008 /* Ok to return a row more than once */ | 1921 #define WHERE_DUPLICATES_OK 0x0008 /* Ok to return a row more than once */ |
| 1859 #define WHERE_OMIT_OPEN 0x0010 /* Table cursor are already open */ | 1922 #define WHERE_OMIT_OPEN 0x0010 /* Table cursors are already open */ |
| 1860 #define WHERE_OMIT_CLOSE 0x0020 /* Omit close of table & index cursors */ | 1923 #define WHERE_OMIT_CLOSE 0x0020 /* Omit close of table & index cursors */ |
| 1861 #define WHERE_FORCE_TABLE 0x0040 /* Do not use an index-only search */ | 1924 #define WHERE_FORCE_TABLE 0x0040 /* Do not use an index-only search */ |
| 1925 #define WHERE_ONETABLE_ONLY 0x0080 /* Only code the 1st table in pTabList */ |
| 1862 | 1926 |
| 1863 /* | 1927 /* |
| 1864 ** The WHERE clause processing routine has two halves. The | 1928 ** The WHERE clause processing routine has two halves. The |
| 1865 ** first part does the start of the WHERE loop and the second | 1929 ** first part does the start of the WHERE loop and the second |
| 1866 ** half does the tail of the WHERE loop. An instance of | 1930 ** half does the tail of the WHERE loop. An instance of |
| 1867 ** this structure is returned by the first half and passed | 1931 ** this structure is returned by the first half and passed |
| 1868 ** into the second half to give some continuity. | 1932 ** into the second half to give some continuity. |
| 1869 */ | 1933 */ |
| 1870 struct WhereInfo { | 1934 struct WhereInfo { |
| 1871 Parse *pParse; /* Parsing and code generating context */ | 1935 Parse *pParse; /* Parsing and code generating context */ |
| 1872 u16 wctrlFlags; /* Flags originally passed to sqlite3WhereBegin() */ | 1936 u16 wctrlFlags; /* Flags originally passed to sqlite3WhereBegin() */ |
| 1873 u8 okOnePass; /* Ok to use one-pass algorithm for UPDATE or DELETE */ | 1937 u8 okOnePass; /* Ok to use one-pass algorithm for UPDATE or DELETE */ |
| 1938 u8 untestedTerms; /* Not all WHERE terms resolved by outer loop */ |
| 1874 SrcList *pTabList; /* List of tables in the join */ | 1939 SrcList *pTabList; /* List of tables in the join */ |
| 1875 int iTop; /* The very beginning of the WHERE loop */ | 1940 int iTop; /* The very beginning of the WHERE loop */ |
| 1876 int iContinue; /* Jump here to continue with next record */ | 1941 int iContinue; /* Jump here to continue with next record */ |
| 1877 int iBreak; /* Jump here to break out of the loop */ | 1942 int iBreak; /* Jump here to break out of the loop */ |
| 1878 int nLevel; /* Number of nested loop */ | 1943 int nLevel; /* Number of nested loop */ |
| 1879 struct WhereClause *pWC; /* Decomposition of the WHERE clause */ | 1944 struct WhereClause *pWC; /* Decomposition of the WHERE clause */ |
| 1945 double savedNQueryLoop; /* pParse->nQueryLoop outside the WHERE loop */ |
| 1880 WhereLevel a[1]; /* Information about each nest loop in WHERE */ | 1946 WhereLevel a[1]; /* Information about each nest loop in WHERE */ |
| 1881 }; | 1947 }; |
| 1882 | 1948 |
| 1883 /* | 1949 /* |
| 1884 ** A NameContext defines a context in which to resolve table and column | 1950 ** A NameContext defines a context in which to resolve table and column |
| 1885 ** names. The context consists of a list of tables (the pSrcList) field and | 1951 ** names. The context consists of a list of tables (the pSrcList) field and |
| 1886 ** a list of named expression (pEList). The named expression list may | 1952 ** a list of named expression (pEList). The named expression list may |
| 1887 ** be NULL. The pSrc corresponds to the FROM clause of a SELECT or | 1953 ** be NULL. The pSrc corresponds to the FROM clause of a SELECT or |
| 1888 ** to the table being operated on by INSERT, UPDATE, or DELETE. The | 1954 ** to the table being operated on by INSERT, UPDATE, or DELETE. The |
| 1889 ** pEList corresponds to the result set of a SELECT and is NULL for | 1955 ** pEList corresponds to the result set of a SELECT and is NULL for |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2027 ** statement. All such objects are stored in the linked list headed at | 2093 ** statement. All such objects are stored in the linked list headed at |
| 2028 ** Parse.pTriggerPrg and deleted once statement compilation has been | 2094 ** Parse.pTriggerPrg and deleted once statement compilation has been |
| 2029 ** completed. | 2095 ** completed. |
| 2030 ** | 2096 ** |
| 2031 ** A Vdbe sub-program that implements the body and WHEN clause of trigger | 2097 ** A Vdbe sub-program that implements the body and WHEN clause of trigger |
| 2032 ** TriggerPrg.pTrigger, assuming a default ON CONFLICT clause of | 2098 ** TriggerPrg.pTrigger, assuming a default ON CONFLICT clause of |
| 2033 ** TriggerPrg.orconf, is stored in the TriggerPrg.pProgram variable. | 2099 ** TriggerPrg.orconf, is stored in the TriggerPrg.pProgram variable. |
| 2034 ** The Parse.pTriggerPrg list never contains two entries with the same | 2100 ** The Parse.pTriggerPrg list never contains two entries with the same |
| 2035 ** values for both pTrigger and orconf. | 2101 ** values for both pTrigger and orconf. |
| 2036 ** | 2102 ** |
| 2037 ** The TriggerPrg.oldmask variable is set to a mask of old.* columns | 2103 ** The TriggerPrg.aColmask[0] variable is set to a mask of old.* columns |
| 2038 ** accessed (or set to 0 for triggers fired as a result of INSERT | 2104 ** accessed (or set to 0 for triggers fired as a result of INSERT |
| 2039 ** statements). | 2105 ** statements). Similarly, the TriggerPrg.aColmask[1] variable is set to |
| 2106 ** a mask of new.* columns used by the program. |
| 2040 */ | 2107 */ |
| 2041 struct TriggerPrg { | 2108 struct TriggerPrg { |
| 2042 Trigger *pTrigger; /* Trigger this program was coded from */ | 2109 Trigger *pTrigger; /* Trigger this program was coded from */ |
| 2043 int orconf; /* Default ON CONFLICT policy */ | 2110 int orconf; /* Default ON CONFLICT policy */ |
| 2044 SubProgram *pProgram; /* Program implementing pTrigger/orconf */ | 2111 SubProgram *pProgram; /* Program implementing pTrigger/orconf */ |
| 2045 u32 oldmask; /* Mask of old.* columns accessed */ | 2112 u32 aColmask[2]; /* Masks of old.*, new.* columns accessed */ |
| 2046 TriggerPrg *pNext; /* Next entry in Parse.pTriggerPrg list */ | 2113 TriggerPrg *pNext; /* Next entry in Parse.pTriggerPrg list */ |
| 2047 }; | 2114 }; |
| 2048 | 2115 |
| 2049 /* | 2116 /* |
| 2050 ** An SQL parser context. A copy of this structure is passed through | 2117 ** An SQL parser context. A copy of this structure is passed through |
| 2051 ** the parser and down into all the parser action routine in order to | 2118 ** the parser and down into all the parser action routine in order to |
| 2052 ** carry around information that is global to the entire parse. | 2119 ** carry around information that is global to the entire parse. |
| 2053 ** | 2120 ** |
| 2054 ** The structure is divided into two parts. When the parser and code | 2121 ** The structure is divided into two parts. When the parser and code |
| 2055 ** generate call themselves recursively, the first part of the structure | 2122 ** generate call themselves recursively, the first part of the structure |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2082 int nMem; /* Number of memory cells used so far */ | 2149 int nMem; /* Number of memory cells used so far */ |
| 2083 int nSet; /* Number of sets used so far */ | 2150 int nSet; /* Number of sets used so far */ |
| 2084 int ckBase; /* Base register of data during check constraints */ | 2151 int ckBase; /* Base register of data during check constraints */ |
| 2085 int iCacheLevel; /* ColCache valid when aColCache[].iLevel<=iCacheLevel */ | 2152 int iCacheLevel; /* ColCache valid when aColCache[].iLevel<=iCacheLevel */ |
| 2086 int iCacheCnt; /* Counter used to generate aColCache[].lru values */ | 2153 int iCacheCnt; /* Counter used to generate aColCache[].lru values */ |
| 2087 u8 nColCache; /* Number of entries in the column cache */ | 2154 u8 nColCache; /* Number of entries in the column cache */ |
| 2088 u8 iColCache; /* Next entry of the cache to replace */ | 2155 u8 iColCache; /* Next entry of the cache to replace */ |
| 2089 struct yColCache { | 2156 struct yColCache { |
| 2090 int iTable; /* Table cursor number */ | 2157 int iTable; /* Table cursor number */ |
| 2091 int iColumn; /* Table column number */ | 2158 int iColumn; /* Table column number */ |
| 2092 u8 affChange; /* True if this register has had an affinity change */ | |
| 2093 u8 tempReg; /* iReg is a temp register that needs to be freed */ | 2159 u8 tempReg; /* iReg is a temp register that needs to be freed */ |
| 2094 int iLevel; /* Nesting level */ | 2160 int iLevel; /* Nesting level */ |
| 2095 int iReg; /* Reg with value of this column. 0 means none. */ | 2161 int iReg; /* Reg with value of this column. 0 means none. */ |
| 2096 int lru; /* Least recently used entry has the smallest value */ | 2162 int lru; /* Least recently used entry has the smallest value */ |
| 2097 } aColCache[SQLITE_N_COLCACHE]; /* One for each column cache entry */ | 2163 } aColCache[SQLITE_N_COLCACHE]; /* One for each column cache entry */ |
| 2098 u32 writeMask; /* Start a write transaction on these databases */ | 2164 u32 writeMask; /* Start a write transaction on these databases */ |
| 2099 u32 cookieMask; /* Bitmask of schema verified databases */ | 2165 u32 cookieMask; /* Bitmask of schema verified databases */ |
| 2100 u8 isMultiWrite; /* True if statement may affect/insert multiple rows */ | 2166 u8 isMultiWrite; /* True if statement may affect/insert multiple rows */ |
| 2101 u8 mayAbort; /* True if statement may throw an ABORT exception */ | 2167 u8 mayAbort; /* True if statement may throw an ABORT exception */ |
| 2102 int cookieGoto; /* Address of OP_Goto to cookie verifier subroutine */ | 2168 int cookieGoto; /* Address of OP_Goto to cookie verifier subroutine */ |
| 2103 int cookieValue[SQLITE_MAX_ATTACHED+2]; /* Values of cookies to verify */ | 2169 int cookieValue[SQLITE_MAX_ATTACHED+2]; /* Values of cookies to verify */ |
| 2104 #ifndef SQLITE_OMIT_SHARED_CACHE | 2170 #ifndef SQLITE_OMIT_SHARED_CACHE |
| 2105 int nTableLock; /* Number of locks in aTableLock */ | 2171 int nTableLock; /* Number of locks in aTableLock */ |
| 2106 TableLock *aTableLock; /* Required table locks for shared-cache mode */ | 2172 TableLock *aTableLock; /* Required table locks for shared-cache mode */ |
| 2107 #endif | 2173 #endif |
| 2108 int regRowid; /* Register holding rowid of CREATE TABLE entry */ | 2174 int regRowid; /* Register holding rowid of CREATE TABLE entry */ |
| 2109 int regRoot; /* Register holding root page number for new objects */ | 2175 int regRoot; /* Register holding root page number for new objects */ |
| 2110 AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */ | 2176 AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */ |
| 2111 int nMaxArg; /* Max args passed to user function by sub-program */ | 2177 int nMaxArg; /* Max args passed to user function by sub-program */ |
| 2112 | 2178 |
| 2113 /* Information used while coding trigger programs. */ | 2179 /* Information used while coding trigger programs. */ |
| 2114 Parse *pToplevel; /* Parse structure for main program (or NULL) */ | 2180 Parse *pToplevel; /* Parse structure for main program (or NULL) */ |
| 2115 Table *pTriggerTab; /* Table triggers are being coded for */ | 2181 Table *pTriggerTab; /* Table triggers are being coded for */ |
| 2116 u32 oldmask; /* Mask of old.* columns referenced */ | 2182 u32 oldmask; /* Mask of old.* columns referenced */ |
| 2183 u32 newmask; /* Mask of new.* columns referenced */ |
| 2117 u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */ | 2184 u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */ |
| 2118 u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */ | 2185 u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */ |
| 2186 u8 disableTriggers; /* True to disable triggers */ |
| 2187 double nQueryLoop; /* Estimated number of iterations of a query */ |
| 2119 | 2188 |
| 2120 /* Above is constant between recursions. Below is reset before and after | 2189 /* Above is constant between recursions. Below is reset before and after |
| 2121 ** each recursion */ | 2190 ** each recursion */ |
| 2122 | 2191 |
| 2123 int nVar; /* Number of '?' variables seen in the SQL so far */ | 2192 int nVar; /* Number of '?' variables seen in the SQL so far */ |
| 2124 int nVarExpr; /* Number of used slots in apVarExpr[] */ | 2193 int nVarExpr; /* Number of used slots in apVarExpr[] */ |
| 2125 int nVarExprAlloc; /* Number of allocated slots in apVarExpr[] */ | 2194 int nVarExprAlloc; /* Number of allocated slots in apVarExpr[] */ |
| 2126 Expr **apVarExpr; /* Pointers to :aaa and $aaaa wildcard expressions */ | 2195 Expr **apVarExpr; /* Pointers to :aaa and $aaaa wildcard expressions */ |
| 2196 Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */ |
| 2127 int nAlias; /* Number of aliased result set columns */ | 2197 int nAlias; /* Number of aliased result set columns */ |
| 2128 int nAliasAlloc; /* Number of allocated slots for aAlias[] */ | 2198 int nAliasAlloc; /* Number of allocated slots for aAlias[] */ |
| 2129 int *aAlias; /* Register used to hold aliased result */ | 2199 int *aAlias; /* Register used to hold aliased result */ |
| 2130 u8 explain; /* True if the EXPLAIN flag is found on the query */ | 2200 u8 explain; /* True if the EXPLAIN flag is found on the query */ |
| 2131 Token sNameToken; /* Token with unqualified schema object name */ | 2201 Token sNameToken; /* Token with unqualified schema object name */ |
| 2132 Token sLastToken; /* The last token parsed */ | 2202 Token sLastToken; /* The last token parsed */ |
| 2133 const char *zTail; /* All SQL text past the last semicolon parsed */ | 2203 const char *zTail; /* All SQL text past the last semicolon parsed */ |
| 2134 Table *pNewTable; /* A table being constructed by CREATE TABLE */ | 2204 Table *pNewTable; /* A table being constructed by CREATE TABLE */ |
| 2135 Trigger *pNewTrigger; /* Trigger under construct by a CREATE TRIGGER */ | 2205 Trigger *pNewTrigger; /* Trigger under construct by a CREATE TRIGGER */ |
| 2136 const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */ | 2206 const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */ |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2278 ** do not necessarily know how big the string will be in the end. | 2348 ** do not necessarily know how big the string will be in the end. |
| 2279 */ | 2349 */ |
| 2280 struct StrAccum { | 2350 struct StrAccum { |
| 2281 sqlite3 *db; /* Optional database for lookaside. Can be NULL */ | 2351 sqlite3 *db; /* Optional database for lookaside. Can be NULL */ |
| 2282 char *zBase; /* A base allocation. Not from malloc. */ | 2352 char *zBase; /* A base allocation. Not from malloc. */ |
| 2283 char *zText; /* The string collected so far */ | 2353 char *zText; /* The string collected so far */ |
| 2284 int nChar; /* Length of the string so far */ | 2354 int nChar; /* Length of the string so far */ |
| 2285 int nAlloc; /* Amount of space allocated in zText */ | 2355 int nAlloc; /* Amount of space allocated in zText */ |
| 2286 int mxAlloc; /* Maximum allowed string length */ | 2356 int mxAlloc; /* Maximum allowed string length */ |
| 2287 u8 mallocFailed; /* Becomes true if any memory allocation fails */ | 2357 u8 mallocFailed; /* Becomes true if any memory allocation fails */ |
| 2288 u8 useMalloc; /* True if zText is enlargeable using realloc */ | 2358 u8 useMalloc; /* 0: none, 1: sqlite3DbMalloc, 2: sqlite3_malloc */ |
| 2289 u8 tooBig; /* Becomes true if string size exceeds limits */ | 2359 u8 tooBig; /* Becomes true if string size exceeds limits */ |
| 2290 }; | 2360 }; |
| 2291 | 2361 |
| 2292 /* | 2362 /* |
| 2293 ** A pointer to this structure is used to communicate information | 2363 ** A pointer to this structure is used to communicate information |
| 2294 ** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback. | 2364 ** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback. |
| 2295 */ | 2365 */ |
| 2296 typedef struct { | 2366 typedef struct { |
| 2297 sqlite3 *db; /* The database being initialized */ | 2367 sqlite3 *db; /* The database being initialized */ |
| 2298 int iDb; /* 0 for main database. 1 for TEMP, 2.. for ATTACHed */ | 2368 int iDb; /* 0 for main database. 1 for TEMP, 2.. for ATTACHed */ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2328 int sharedCacheEnabled; /* true if shared-cache mode enabled */ | 2398 int sharedCacheEnabled; /* true if shared-cache mode enabled */ |
| 2329 /* The above might be initialized to non-zero. The following need to always | 2399 /* The above might be initialized to non-zero. The following need to always |
| 2330 ** initially be zero, however. */ | 2400 ** initially be zero, however. */ |
| 2331 int isInit; /* True after initialization has finished */ | 2401 int isInit; /* True after initialization has finished */ |
| 2332 int inProgress; /* True while initialization in progress */ | 2402 int inProgress; /* True while initialization in progress */ |
| 2333 int isMutexInit; /* True after mutexes are initialized */ | 2403 int isMutexInit; /* True after mutexes are initialized */ |
| 2334 int isMallocInit; /* True after malloc is initialized */ | 2404 int isMallocInit; /* True after malloc is initialized */ |
| 2335 int isPCacheInit; /* True after malloc is initialized */ | 2405 int isPCacheInit; /* True after malloc is initialized */ |
| 2336 sqlite3_mutex *pInitMutex; /* Mutex used by sqlite3_initialize() */ | 2406 sqlite3_mutex *pInitMutex; /* Mutex used by sqlite3_initialize() */ |
| 2337 int nRefInitMutex; /* Number of users of pInitMutex */ | 2407 int nRefInitMutex; /* Number of users of pInitMutex */ |
| 2408 void (*xLog)(void*,int,const char*); /* Function for logging */ |
| 2409 void *pLogArg; /* First argument to xLog() */ |
| 2338 }; | 2410 }; |
| 2339 | 2411 |
| 2340 /* | 2412 /* |
| 2341 ** Context pointer passed down through the tree-walk. | 2413 ** Context pointer passed down through the tree-walk. |
| 2342 */ | 2414 */ |
| 2343 struct Walker { | 2415 struct Walker { |
| 2344 int (*xExprCallback)(Walker*, Expr*); /* Callback for expressions */ | 2416 int (*xExprCallback)(Walker*, Expr*); /* Callback for expressions */ |
| 2345 int (*xSelectCallback)(Walker*,Select*); /* Callback for SELECTs */ | 2417 int (*xSelectCallback)(Walker*,Select*); /* Callback for SELECTs */ |
| 2346 Parse *pParse; /* Parser context. */ | 2418 Parse *pParse; /* Parser context. */ |
| 2347 union { /* Extra data for callback */ | 2419 union { /* Extra data for callback */ |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2369 ** Assuming zIn points to the first byte of a UTF-8 character, | 2441 ** Assuming zIn points to the first byte of a UTF-8 character, |
| 2370 ** advance zIn to point to the first byte of the next UTF-8 character. | 2442 ** advance zIn to point to the first byte of the next UTF-8 character. |
| 2371 */ | 2443 */ |
| 2372 #define SQLITE_SKIP_UTF8(zIn) { \ | 2444 #define SQLITE_SKIP_UTF8(zIn) { \ |
| 2373 if( (*(zIn++))>=0xc0 ){ \ | 2445 if( (*(zIn++))>=0xc0 ){ \ |
| 2374 while( (*zIn & 0xc0)==0x80 ){ zIn++; } \ | 2446 while( (*zIn & 0xc0)==0x80 ){ zIn++; } \ |
| 2375 } \ | 2447 } \ |
| 2376 } | 2448 } |
| 2377 | 2449 |
| 2378 /* | 2450 /* |
| 2379 ** The SQLITE_CORRUPT_BKPT macro can be either a constant (for production | 2451 ** The SQLITE_*_BKPT macros are substitutes for the error codes with |
| 2380 ** builds) or a function call (for debugging). If it is a function call, | 2452 ** the same name but without the _BKPT suffix. These macros invoke |
| 2381 ** it allows the operator to set a breakpoint at the spot where database | 2453 ** routines that report the line-number on which the error originated |
| 2382 ** corruption is first detected. | 2454 ** using sqlite3_log(). The routines also provide a convenient place |
| 2455 ** to set a debugger breakpoint. |
| 2383 */ | 2456 */ |
| 2384 #ifdef SQLITE_DEBUG | 2457 int sqlite3CorruptError(int); |
| 2385 int sqlite3Corrupt(void); | 2458 int sqlite3MisuseError(int); |
| 2386 # define SQLITE_CORRUPT_BKPT sqlite3Corrupt() | 2459 int sqlite3CantopenError(int); |
| 2387 #else | 2460 #define SQLITE_CORRUPT_BKPT sqlite3CorruptError(__LINE__) |
| 2388 # define SQLITE_CORRUPT_BKPT SQLITE_CORRUPT | 2461 #define SQLITE_MISUSE_BKPT sqlite3MisuseError(__LINE__) |
| 2462 #define SQLITE_CANTOPEN_BKPT sqlite3CantopenError(__LINE__) |
| 2463 |
| 2464 |
| 2465 /* |
| 2466 ** FTS4 is really an extension for FTS3. It is enabled using the |
| 2467 ** SQLITE_ENABLE_FTS3 macro. But to avoid confusion we also all |
| 2468 ** the SQLITE_ENABLE_FTS4 macro to serve as an alisse for SQLITE_ENABLE_FTS3. |
| 2469 */ |
| 2470 #if defined(SQLITE_ENABLE_FTS4) && !defined(SQLITE_ENABLE_FTS3) |
| 2471 # define SQLITE_ENABLE_FTS3 |
| 2389 #endif | 2472 #endif |
| 2390 | 2473 |
| 2391 /* | 2474 /* |
| 2392 ** The ctype.h header is needed for non-ASCII systems. It is also | 2475 ** The ctype.h header is needed for non-ASCII systems. It is also |
| 2393 ** needed by FTS3 when FTS3 is included in the amalgamation. | 2476 ** needed by FTS3 when FTS3 is included in the amalgamation. |
| 2394 */ | 2477 */ |
| 2395 #if !defined(SQLITE_ASCII) || \ | 2478 #if !defined(SQLITE_ASCII) || \ |
| 2396 (defined(SQLITE_ENABLE_FTS3) && defined(SQLITE_AMALGAMATION)) | 2479 (defined(SQLITE_ENABLE_FTS3) && defined(SQLITE_AMALGAMATION)) |
| 2397 # include <ctype.h> | 2480 # include <ctype.h> |
| 2398 #endif | 2481 #endif |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2417 # define sqlite3Isalpha(x) isalpha((unsigned char)(x)) | 2500 # define sqlite3Isalpha(x) isalpha((unsigned char)(x)) |
| 2418 # define sqlite3Isdigit(x) isdigit((unsigned char)(x)) | 2501 # define sqlite3Isdigit(x) isdigit((unsigned char)(x)) |
| 2419 # define sqlite3Isxdigit(x) isxdigit((unsigned char)(x)) | 2502 # define sqlite3Isxdigit(x) isxdigit((unsigned char)(x)) |
| 2420 # define sqlite3Tolower(x) tolower((unsigned char)(x)) | 2503 # define sqlite3Tolower(x) tolower((unsigned char)(x)) |
| 2421 #endif | 2504 #endif |
| 2422 | 2505 |
| 2423 /* | 2506 /* |
| 2424 ** Internal function prototypes | 2507 ** Internal function prototypes |
| 2425 */ | 2508 */ |
| 2426 int sqlite3StrICmp(const char *, const char *); | 2509 int sqlite3StrICmp(const char *, const char *); |
| 2427 int sqlite3IsNumber(const char*, int*, u8); | |
| 2428 int sqlite3Strlen30(const char*); | 2510 int sqlite3Strlen30(const char*); |
| 2429 #define sqlite3StrNICmp sqlite3_strnicmp | 2511 #define sqlite3StrNICmp sqlite3_strnicmp |
| 2430 | 2512 |
| 2431 int sqlite3MallocInit(void); | 2513 int sqlite3MallocInit(void); |
| 2432 void sqlite3MallocEnd(void); | 2514 void sqlite3MallocEnd(void); |
| 2433 void *sqlite3Malloc(int); | 2515 void *sqlite3Malloc(int); |
| 2434 void *sqlite3MallocZero(int); | 2516 void *sqlite3MallocZero(int); |
| 2435 void *sqlite3DbMallocZero(sqlite3*, int); | 2517 void *sqlite3DbMallocZero(sqlite3*, int); |
| 2436 void *sqlite3DbMallocRaw(sqlite3*, int); | 2518 void *sqlite3DbMallocRaw(sqlite3*, int); |
| 2437 char *sqlite3DbStrDup(sqlite3*,const char*); | 2519 char *sqlite3DbStrDup(sqlite3*,const char*); |
| 2438 char *sqlite3DbStrNDup(sqlite3*,const char*, int); | 2520 char *sqlite3DbStrNDup(sqlite3*,const char*, int); |
| 2439 void *sqlite3Realloc(void*, int); | 2521 void *sqlite3Realloc(void*, int); |
| 2440 void *sqlite3DbReallocOrFree(sqlite3 *, void *, int); | 2522 void *sqlite3DbReallocOrFree(sqlite3 *, void *, int); |
| 2441 void *sqlite3DbRealloc(sqlite3 *, void *, int); | 2523 void *sqlite3DbRealloc(sqlite3 *, void *, int); |
| 2442 void sqlite3DbFree(sqlite3*, void*); | 2524 void sqlite3DbFree(sqlite3*, void*); |
| 2443 int sqlite3MallocSize(void*); | 2525 int sqlite3MallocSize(void*); |
| 2444 int sqlite3DbMallocSize(sqlite3*, void*); | 2526 int sqlite3DbMallocSize(sqlite3*, void*); |
| 2445 void *sqlite3ScratchMalloc(int); | 2527 void *sqlite3ScratchMalloc(int); |
| 2446 void sqlite3ScratchFree(void*); | 2528 void sqlite3ScratchFree(void*); |
| 2447 void *sqlite3PageMalloc(int); | 2529 void *sqlite3PageMalloc(int); |
| 2448 void sqlite3PageFree(void*); | 2530 void sqlite3PageFree(void*); |
| 2449 void sqlite3MemSetDefault(void); | 2531 void sqlite3MemSetDefault(void); |
| 2450 void sqlite3BenignMallocHooks(void (*)(void), void (*)(void)); | 2532 void sqlite3BenignMallocHooks(void (*)(void), void (*)(void)); |
| 2451 int sqlite3MemoryAlarm(void (*)(void*, sqlite3_int64, int), void*, sqlite3_int64
); | 2533 int sqlite3HeapNearlyFull(void); |
| 2452 | 2534 |
| 2453 /* | 2535 /* |
| 2454 ** On systems with ample stack space and that support alloca(), make | 2536 ** On systems with ample stack space and that support alloca(), make |
| 2455 ** use of alloca() to obtain space for large automatic objects. By default, | 2537 ** use of alloca() to obtain space for large automatic objects. By default, |
| 2456 ** obtain space from malloc(). | 2538 ** obtain space from malloc(). |
| 2457 ** | 2539 ** |
| 2458 ** The alloca() routine never returns NULL. This will cause code paths | 2540 ** The alloca() routine never returns NULL. This will cause code paths |
| 2459 ** that deal with sqlite3StackAlloc() failures to be unreachable. | 2541 ** that deal with sqlite3StackAlloc() failures to be unreachable. |
| 2460 */ | 2542 */ |
| 2461 #ifdef SQLITE_USE_ALLOCA | 2543 #ifdef SQLITE_USE_ALLOCA |
| 2462 # define sqlite3StackAllocRaw(D,N) alloca(N) | 2544 # define sqlite3StackAllocRaw(D,N) alloca(N) |
| 2463 # define sqlite3StackAllocZero(D,N) memset(alloca(N), 0, N) | 2545 # define sqlite3StackAllocZero(D,N) memset(alloca(N), 0, N) |
| 2464 # define sqlite3StackFree(D,P) | 2546 # define sqlite3StackFree(D,P) |
| 2465 #else | 2547 #else |
| 2466 # define sqlite3StackAllocRaw(D,N) sqlite3DbMallocRaw(D,N) | 2548 # define sqlite3StackAllocRaw(D,N) sqlite3DbMallocRaw(D,N) |
| 2467 # define sqlite3StackAllocZero(D,N) sqlite3DbMallocZero(D,N) | 2549 # define sqlite3StackAllocZero(D,N) sqlite3DbMallocZero(D,N) |
| 2468 # define sqlite3StackFree(D,P) sqlite3DbFree(D,P) | 2550 # define sqlite3StackFree(D,P) sqlite3DbFree(D,P) |
| 2469 #endif | 2551 #endif |
| 2470 | 2552 |
| 2471 #ifdef SQLITE_ENABLE_MEMSYS3 | 2553 #ifdef SQLITE_ENABLE_MEMSYS3 |
| 2472 const sqlite3_mem_methods *sqlite3MemGetMemsys3(void); | 2554 const sqlite3_mem_methods *sqlite3MemGetMemsys3(void); |
| 2473 #endif | 2555 #endif |
| 2474 #ifdef SQLITE_ENABLE_MEMSYS5 | 2556 #ifdef SQLITE_ENABLE_MEMSYS5 |
| 2475 const sqlite3_mem_methods *sqlite3MemGetMemsys5(void); | 2557 const sqlite3_mem_methods *sqlite3MemGetMemsys5(void); |
| 2476 #endif | 2558 #endif |
| 2477 | 2559 |
| 2478 | 2560 |
| 2479 #ifndef SQLITE_MUTEX_OMIT | 2561 #ifndef SQLITE_MUTEX_OMIT |
| 2480 sqlite3_mutex_methods *sqlite3DefaultMutex(void); | 2562 sqlite3_mutex_methods const *sqlite3DefaultMutex(void); |
| 2563 sqlite3_mutex_methods const *sqlite3NoopMutex(void); |
| 2481 sqlite3_mutex *sqlite3MutexAlloc(int); | 2564 sqlite3_mutex *sqlite3MutexAlloc(int); |
| 2482 int sqlite3MutexInit(void); | 2565 int sqlite3MutexInit(void); |
| 2483 int sqlite3MutexEnd(void); | 2566 int sqlite3MutexEnd(void); |
| 2484 #endif | 2567 #endif |
| 2485 | 2568 |
| 2486 int sqlite3StatusValue(int); | 2569 int sqlite3StatusValue(int); |
| 2487 void sqlite3StatusAdd(int, int); | 2570 void sqlite3StatusAdd(int, int); |
| 2488 void sqlite3StatusSet(int, int); | 2571 void sqlite3StatusSet(int, int); |
| 2489 | 2572 |
| 2490 int sqlite3IsNaN(double); | 2573 #ifndef SQLITE_OMIT_FLOATING_POINT |
| 2574 int sqlite3IsNaN(double); |
| 2575 #else |
| 2576 # define sqlite3IsNaN(X) 0 |
| 2577 #endif |
| 2491 | 2578 |
| 2492 void sqlite3VXPrintf(StrAccum*, int, const char*, va_list); | 2579 void sqlite3VXPrintf(StrAccum*, int, const char*, va_list); |
| 2580 #ifndef SQLITE_OMIT_TRACE |
| 2581 void sqlite3XPrintf(StrAccum*, const char*, ...); |
| 2582 #endif |
| 2493 char *sqlite3MPrintf(sqlite3*,const char*, ...); | 2583 char *sqlite3MPrintf(sqlite3*,const char*, ...); |
| 2494 char *sqlite3VMPrintf(sqlite3*,const char*, va_list); | 2584 char *sqlite3VMPrintf(sqlite3*,const char*, va_list); |
| 2495 char *sqlite3MAppendf(sqlite3*,char*,const char*,...); | 2585 char *sqlite3MAppendf(sqlite3*,char*,const char*,...); |
| 2496 #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG) | 2586 #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG) |
| 2497 void sqlite3DebugPrintf(const char*, ...); | 2587 void sqlite3DebugPrintf(const char*, ...); |
| 2498 #endif | 2588 #endif |
| 2499 #if defined(SQLITE_TEST) | 2589 #if defined(SQLITE_TEST) |
| 2500 void *sqlite3TestTextToPtr(const char*); | 2590 void *sqlite3TestTextToPtr(const char*); |
| 2501 #endif | 2591 #endif |
| 2502 void sqlite3SetString(char **, sqlite3*, const char*, ...); | 2592 void sqlite3SetString(char **, sqlite3*, const char*, ...); |
| 2503 void sqlite3ErrorMsg(Parse*, const char*, ...); | 2593 void sqlite3ErrorMsg(Parse*, const char*, ...); |
| 2504 void sqlite3ErrorClear(Parse*); | |
| 2505 int sqlite3Dequote(char*); | 2594 int sqlite3Dequote(char*); |
| 2506 int sqlite3KeywordCode(const unsigned char*, int); | 2595 int sqlite3KeywordCode(const unsigned char*, int); |
| 2507 int sqlite3RunParser(Parse*, const char*, char **); | 2596 int sqlite3RunParser(Parse*, const char*, char **); |
| 2508 void sqlite3FinishCoding(Parse*); | 2597 void sqlite3FinishCoding(Parse*); |
| 2509 int sqlite3GetTempReg(Parse*); | 2598 int sqlite3GetTempReg(Parse*); |
| 2510 void sqlite3ReleaseTempReg(Parse*,int); | 2599 void sqlite3ReleaseTempReg(Parse*,int); |
| 2511 int sqlite3GetTempRange(Parse*,int); | 2600 int sqlite3GetTempRange(Parse*,int); |
| 2512 void sqlite3ReleaseTempRange(Parse*,int,int); | 2601 void sqlite3ReleaseTempRange(Parse*,int,int); |
| 2513 Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int); | 2602 Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int); |
| 2514 Expr *sqlite3Expr(sqlite3*,int,const char*); | 2603 Expr *sqlite3Expr(sqlite3*,int,const char*); |
| 2515 void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*); | 2604 void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*); |
| 2516 Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*, const Token*); | 2605 Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*, const Token*); |
| 2517 Expr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*); | 2606 Expr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*); |
| 2518 Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*); | 2607 Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*); |
| 2519 void sqlite3ExprAssignVarNumber(Parse*, Expr*); | 2608 void sqlite3ExprAssignVarNumber(Parse*, Expr*); |
| 2520 void sqlite3ExprClear(sqlite3*, Expr*); | |
| 2521 void sqlite3ExprDelete(sqlite3*, Expr*); | 2609 void sqlite3ExprDelete(sqlite3*, Expr*); |
| 2522 ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*); | 2610 ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*); |
| 2523 void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int); | 2611 void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int); |
| 2524 void sqlite3ExprListSetSpan(Parse*,ExprList*,ExprSpan*); | 2612 void sqlite3ExprListSetSpan(Parse*,ExprList*,ExprSpan*); |
| 2525 void sqlite3ExprListDelete(sqlite3*, ExprList*); | 2613 void sqlite3ExprListDelete(sqlite3*, ExprList*); |
| 2526 int sqlite3Init(sqlite3*, char**); | 2614 int sqlite3Init(sqlite3*, char**); |
| 2527 int sqlite3InitCallback(void*, int, char**, char**); | 2615 int sqlite3InitCallback(void*, int, char**, char**); |
| 2528 void sqlite3Pragma(Parse*,Token*,Token*,Token*,int); | 2616 void sqlite3Pragma(Parse*,Token*,Token*,Token*,int); |
| 2529 void sqlite3ResetInternalSchema(sqlite3*, int); | 2617 void sqlite3ResetInternalSchema(sqlite3*, int); |
| 2530 void sqlite3BeginParse(Parse*,int); | 2618 void sqlite3BeginParse(Parse*,int); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2557 | 2645 |
| 2558 void sqlite3CreateView(Parse*,Token*,Token*,Token*,Select*,int,int); | 2646 void sqlite3CreateView(Parse*,Token*,Token*,Token*,Select*,int,int); |
| 2559 | 2647 |
| 2560 #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) | 2648 #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) |
| 2561 int sqlite3ViewGetColumnNames(Parse*,Table*); | 2649 int sqlite3ViewGetColumnNames(Parse*,Table*); |
| 2562 #else | 2650 #else |
| 2563 # define sqlite3ViewGetColumnNames(A,B) 0 | 2651 # define sqlite3ViewGetColumnNames(A,B) 0 |
| 2564 #endif | 2652 #endif |
| 2565 | 2653 |
| 2566 void sqlite3DropTable(Parse*, SrcList*, int, int); | 2654 void sqlite3DropTable(Parse*, SrcList*, int, int); |
| 2567 void sqlite3DeleteTable(Table*); | 2655 void sqlite3DeleteTable(sqlite3*, Table*); |
| 2568 #ifndef SQLITE_OMIT_AUTOINCREMENT | 2656 #ifndef SQLITE_OMIT_AUTOINCREMENT |
| 2569 void sqlite3AutoincrementBegin(Parse *pParse); | 2657 void sqlite3AutoincrementBegin(Parse *pParse); |
| 2570 void sqlite3AutoincrementEnd(Parse *pParse); | 2658 void sqlite3AutoincrementEnd(Parse *pParse); |
| 2571 #else | 2659 #else |
| 2572 # define sqlite3AutoincrementBegin(X) | 2660 # define sqlite3AutoincrementBegin(X) |
| 2573 # define sqlite3AutoincrementEnd(X) | 2661 # define sqlite3AutoincrementEnd(X) |
| 2574 #endif | 2662 #endif |
| 2575 void sqlite3Insert(Parse*, SrcList*, ExprList*, Select*, IdList*, int); | 2663 void sqlite3Insert(Parse*, SrcList*, ExprList*, Select*, IdList*, int); |
| 2576 void *sqlite3ArrayAllocate(sqlite3*,void*,int,int,int*,int*,int*); | 2664 void *sqlite3ArrayAllocate(sqlite3*,void*,int,int,int*,int*,int*); |
| 2577 IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*); | 2665 IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*); |
| 2578 int sqlite3IdListIndex(IdList*,const char*); | 2666 int sqlite3IdListIndex(IdList*,const char*); |
| 2579 SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int); | 2667 SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int); |
| 2580 SrcList *sqlite3SrcListAppend(sqlite3*, SrcList*, Token*, Token*); | 2668 SrcList *sqlite3SrcListAppend(sqlite3*, SrcList*, Token*, Token*); |
| 2581 SrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*, | 2669 SrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*, |
| 2582 Token*, Select*, Expr*, IdList*); | 2670 Token*, Select*, Expr*, IdList*); |
| 2583 void sqlite3SrcListIndexedBy(Parse *, SrcList *, Token *); | 2671 void sqlite3SrcListIndexedBy(Parse *, SrcList *, Token *); |
| 2584 int sqlite3IndexedByLookup(Parse *, struct SrcList_item *); | 2672 int sqlite3IndexedByLookup(Parse *, struct SrcList_item *); |
| 2585 void sqlite3SrcListShiftJoinType(SrcList*); | 2673 void sqlite3SrcListShiftJoinType(SrcList*); |
| 2586 void sqlite3SrcListAssignCursors(Parse*, SrcList*); | 2674 void sqlite3SrcListAssignCursors(Parse*, SrcList*); |
| 2587 void sqlite3IdListDelete(sqlite3*, IdList*); | 2675 void sqlite3IdListDelete(sqlite3*, IdList*); |
| 2588 void sqlite3SrcListDelete(sqlite3*, SrcList*); | 2676 void sqlite3SrcListDelete(sqlite3*, SrcList*); |
| 2589 void sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*, | 2677 Index *sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*, |
| 2590 Token*, int, int); | 2678 Token*, int, int); |
| 2591 void sqlite3DropIndex(Parse*, SrcList*, int); | 2679 void sqlite3DropIndex(Parse*, SrcList*, int); |
| 2592 int sqlite3Select(Parse*, Select*, SelectDest*); | 2680 int sqlite3Select(Parse*, Select*, SelectDest*); |
| 2593 Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*, | 2681 Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*, |
| 2594 Expr*,ExprList*,int,Expr*,Expr*); | 2682 Expr*,ExprList*,int,Expr*,Expr*); |
| 2595 void sqlite3SelectDelete(sqlite3*, Select*); | 2683 void sqlite3SelectDelete(sqlite3*, Select*); |
| 2596 Table *sqlite3SrcListLookup(Parse*, SrcList*); | 2684 Table *sqlite3SrcListLookup(Parse*, SrcList*); |
| 2597 int sqlite3IsReadOnly(Parse*, Table*, int); | 2685 int sqlite3IsReadOnly(Parse*, Table*, int); |
| 2598 void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int); | 2686 void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int); |
| 2599 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) | 2687 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) |
| 2600 Expr *sqlite3LimitWhere(Parse *, SrcList *, Expr *, ExprList *, Expr *, Expr *,
char *); | 2688 Expr *sqlite3LimitWhere(Parse *, SrcList *, Expr *, ExprList *, Expr *, Expr *,
char *); |
| 2601 #endif | 2689 #endif |
| 2602 void sqlite3DeleteFrom(Parse*, SrcList*, Expr*); | 2690 void sqlite3DeleteFrom(Parse*, SrcList*, Expr*); |
| 2603 void sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int); | 2691 void sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int); |
| 2604 WhereInfo *sqlite3WhereBegin(Parse*, SrcList*, Expr*, ExprList**, u16); | 2692 WhereInfo *sqlite3WhereBegin(Parse*, SrcList*, Expr*, ExprList**, u16); |
| 2605 void sqlite3WhereEnd(WhereInfo*); | 2693 void sqlite3WhereEnd(WhereInfo*); |
| 2606 int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int, int); | 2694 int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int); |
| 2695 void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int); |
| 2607 void sqlite3ExprCodeMove(Parse*, int, int, int); | 2696 void sqlite3ExprCodeMove(Parse*, int, int, int); |
| 2608 void sqlite3ExprCodeCopy(Parse*, int, int, int); | 2697 void sqlite3ExprCodeCopy(Parse*, int, int, int); |
| 2609 void sqlite3ExprCacheStore(Parse*, int, int, int); | 2698 void sqlite3ExprCacheStore(Parse*, int, int, int); |
| 2610 void sqlite3ExprCachePush(Parse*); | 2699 void sqlite3ExprCachePush(Parse*); |
| 2611 void sqlite3ExprCachePop(Parse*, int); | 2700 void sqlite3ExprCachePop(Parse*, int); |
| 2612 void sqlite3ExprCacheRemove(Parse*, int); | 2701 void sqlite3ExprCacheRemove(Parse*, int, int); |
| 2613 void sqlite3ExprCacheClear(Parse*); | 2702 void sqlite3ExprCacheClear(Parse*); |
| 2614 void sqlite3ExprCacheAffinityChange(Parse*, int, int); | 2703 void sqlite3ExprCacheAffinityChange(Parse*, int, int); |
| 2615 void sqlite3ExprHardCopy(Parse*,int,int); | |
| 2616 int sqlite3ExprCode(Parse*, Expr*, int); | 2704 int sqlite3ExprCode(Parse*, Expr*, int); |
| 2617 int sqlite3ExprCodeTemp(Parse*, Expr*, int*); | 2705 int sqlite3ExprCodeTemp(Parse*, Expr*, int*); |
| 2618 int sqlite3ExprCodeTarget(Parse*, Expr*, int); | 2706 int sqlite3ExprCodeTarget(Parse*, Expr*, int); |
| 2619 int sqlite3ExprCodeAndCache(Parse*, Expr*, int); | 2707 int sqlite3ExprCodeAndCache(Parse*, Expr*, int); |
| 2620 void sqlite3ExprCodeConstants(Parse*, Expr*); | 2708 void sqlite3ExprCodeConstants(Parse*, Expr*); |
| 2621 int sqlite3ExprCodeExprList(Parse*, ExprList*, int, int); | 2709 int sqlite3ExprCodeExprList(Parse*, ExprList*, int, int); |
| 2622 void sqlite3ExprIfTrue(Parse*, Expr*, int, int); | 2710 void sqlite3ExprIfTrue(Parse*, Expr*, int, int); |
| 2623 void sqlite3ExprIfFalse(Parse*, Expr*, int, int); | 2711 void sqlite3ExprIfFalse(Parse*, Expr*, int, int); |
| 2624 Table *sqlite3FindTable(sqlite3*,const char*, const char*); | 2712 Table *sqlite3FindTable(sqlite3*,const char*, const char*); |
| 2625 Table *sqlite3LocateTable(Parse*,int isView,const char*, const char*); | 2713 Table *sqlite3LocateTable(Parse*,int isView,const char*, const char*); |
| 2626 Index *sqlite3FindIndex(sqlite3*,const char*, const char*); | 2714 Index *sqlite3FindIndex(sqlite3*,const char*, const char*); |
| 2627 void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*); | 2715 void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*); |
| 2628 void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*); | 2716 void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*); |
| 2629 void sqlite3Vacuum(Parse*); | 2717 void sqlite3Vacuum(Parse*); |
| 2630 int sqlite3RunVacuum(char**, sqlite3*); | 2718 int sqlite3RunVacuum(char**, sqlite3*); |
| 2631 char *sqlite3NameFromToken(sqlite3*, Token*); | 2719 char *sqlite3NameFromToken(sqlite3*, Token*); |
| 2632 int sqlite3ExprCompare(Expr*, Expr*); | 2720 int sqlite3ExprCompare(Expr*, Expr*); |
| 2721 int sqlite3ExprListCompare(ExprList*, ExprList*); |
| 2633 void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*); | 2722 void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*); |
| 2634 void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*); | 2723 void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*); |
| 2635 Vdbe *sqlite3GetVdbe(Parse*); | 2724 Vdbe *sqlite3GetVdbe(Parse*); |
| 2636 Expr *sqlite3CreateIdExpr(Parse *, const char*); | |
| 2637 void sqlite3PrngSaveState(void); | 2725 void sqlite3PrngSaveState(void); |
| 2638 void sqlite3PrngRestoreState(void); | 2726 void sqlite3PrngRestoreState(void); |
| 2639 void sqlite3PrngResetState(void); | 2727 void sqlite3PrngResetState(void); |
| 2640 void sqlite3RollbackAll(sqlite3*); | 2728 void sqlite3RollbackAll(sqlite3*); |
| 2641 void sqlite3CodeVerifySchema(Parse*, int); | 2729 void sqlite3CodeVerifySchema(Parse*, int); |
| 2642 void sqlite3BeginTransaction(Parse*, int); | 2730 void sqlite3BeginTransaction(Parse*, int); |
| 2643 void sqlite3CommitTransaction(Parse*); | 2731 void sqlite3CommitTransaction(Parse*); |
| 2644 void sqlite3RollbackTransaction(Parse*); | 2732 void sqlite3RollbackTransaction(Parse*); |
| 2645 void sqlite3Savepoint(Parse*, int, Token*); | 2733 void sqlite3Savepoint(Parse*, int, Token*); |
| 2646 void sqlite3CloseSavepoints(sqlite3 *); | 2734 void sqlite3CloseSavepoints(sqlite3 *); |
| 2647 int sqlite3ExprIsConstant(Expr*); | 2735 int sqlite3ExprIsConstant(Expr*); |
| 2648 int sqlite3ExprIsConstantNotJoin(Expr*); | 2736 int sqlite3ExprIsConstantNotJoin(Expr*); |
| 2649 int sqlite3ExprIsConstantOrFunction(Expr*); | 2737 int sqlite3ExprIsConstantOrFunction(Expr*); |
| 2650 int sqlite3ExprIsInteger(Expr*, int*); | 2738 int sqlite3ExprIsInteger(Expr*, int*); |
| 2739 int sqlite3ExprCanBeNull(const Expr*); |
| 2740 void sqlite3ExprCodeIsNullJump(Vdbe*, const Expr*, int, int); |
| 2741 int sqlite3ExprNeedsNoAffinityChange(const Expr*, char); |
| 2651 int sqlite3IsRowid(const char*); | 2742 int sqlite3IsRowid(const char*); |
| 2652 void sqlite3GenerateRowDelete(Parse*, Table*, int, int, int, Trigger *, int); | 2743 void sqlite3GenerateRowDelete(Parse*, Table*, int, int, int, Trigger *, int); |
| 2653 void sqlite3GenerateRowIndexDelete(Parse*, Table*, int, int*); | 2744 void sqlite3GenerateRowIndexDelete(Parse*, Table*, int, int*); |
| 2654 int sqlite3GenerateIndexKey(Parse*, Index*, int, int, int); | 2745 int sqlite3GenerateIndexKey(Parse*, Index*, int, int, int); |
| 2655 void sqlite3GenerateConstraintChecks(Parse*,Table*,int,int, | 2746 void sqlite3GenerateConstraintChecks(Parse*,Table*,int,int, |
| 2656 int*,int,int,int,int,int*); | 2747 int*,int,int,int,int,int*); |
| 2657 void sqlite3CompleteInsertion(Parse*, Table*, int, int, int*, int, int, int); | 2748 void sqlite3CompleteInsertion(Parse*, Table*, int, int, int*, int, int, int); |
| 2658 int sqlite3OpenTableAndIndices(Parse*, Table*, int, int); | 2749 int sqlite3OpenTableAndIndices(Parse*, Table*, int, int); |
| 2659 void sqlite3BeginWriteOperation(Parse*, int, int); | 2750 void sqlite3BeginWriteOperation(Parse*, int, int); |
| 2660 void sqlite3MayAbort(Parse *); | 2751 void sqlite3MultiWrite(Parse*); |
| 2752 void sqlite3MayAbort(Parse*); |
| 2661 void sqlite3HaltConstraint(Parse*, int, char*, int); | 2753 void sqlite3HaltConstraint(Parse*, int, char*, int); |
| 2662 Expr *sqlite3ExprDup(sqlite3*,Expr*,int); | 2754 Expr *sqlite3ExprDup(sqlite3*,Expr*,int); |
| 2663 ExprList *sqlite3ExprListDup(sqlite3*,ExprList*,int); | 2755 ExprList *sqlite3ExprListDup(sqlite3*,ExprList*,int); |
| 2664 SrcList *sqlite3SrcListDup(sqlite3*,SrcList*,int); | 2756 SrcList *sqlite3SrcListDup(sqlite3*,SrcList*,int); |
| 2665 IdList *sqlite3IdListDup(sqlite3*,IdList*); | 2757 IdList *sqlite3IdListDup(sqlite3*,IdList*); |
| 2666 Select *sqlite3SelectDup(sqlite3*,Select*,int); | 2758 Select *sqlite3SelectDup(sqlite3*,Select*,int); |
| 2667 void sqlite3FuncDefInsert(FuncDefHash*, FuncDef*); | 2759 void sqlite3FuncDefInsert(FuncDefHash*, FuncDef*); |
| 2668 FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,int,u8,int); | 2760 FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,int,u8,int); |
| 2669 void sqlite3RegisterBuiltinFunctions(sqlite3*); | 2761 void sqlite3RegisterBuiltinFunctions(sqlite3*); |
| 2670 void sqlite3RegisterDateTimeFunctions(void); | 2762 void sqlite3RegisterDateTimeFunctions(void); |
| 2671 void sqlite3RegisterGlobalFunctions(void); | 2763 void sqlite3RegisterGlobalFunctions(void); |
| 2672 #ifdef SQLITE_DEBUG | |
| 2673 int sqlite3SafetyOn(sqlite3*); | |
| 2674 int sqlite3SafetyOff(sqlite3*); | |
| 2675 #else | |
| 2676 # define sqlite3SafetyOn(A) 0 | |
| 2677 # define sqlite3SafetyOff(A) 0 | |
| 2678 #endif | |
| 2679 int sqlite3SafetyCheckOk(sqlite3*); | 2764 int sqlite3SafetyCheckOk(sqlite3*); |
| 2680 int sqlite3SafetyCheckSickOrOk(sqlite3*); | 2765 int sqlite3SafetyCheckSickOrOk(sqlite3*); |
| 2681 void sqlite3ChangeCookie(Parse*, int); | 2766 void sqlite3ChangeCookie(Parse*, int); |
| 2682 | 2767 |
| 2683 #if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) | 2768 #if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) |
| 2684 void sqlite3MaterializeView(Parse*, Table*, Expr*, int); | 2769 void sqlite3MaterializeView(Parse*, Table*, Expr*, int); |
| 2685 #endif | 2770 #endif |
| 2686 | 2771 |
| 2687 #ifndef SQLITE_OMIT_TRIGGER | 2772 #ifndef SQLITE_OMIT_TRIGGER |
| 2688 void sqlite3BeginTrigger(Parse*, Token*,Token*,int,int,IdList*,SrcList*, | 2773 void sqlite3BeginTrigger(Parse*, Token*,Token*,int,int,IdList*,SrcList*, |
| 2689 Expr*,int, int); | 2774 Expr*,int, int); |
| 2690 void sqlite3FinishTrigger(Parse*, TriggerStep*, Token*); | 2775 void sqlite3FinishTrigger(Parse*, TriggerStep*, Token*); |
| 2691 void sqlite3DropTrigger(Parse*, SrcList*, int); | 2776 void sqlite3DropTrigger(Parse*, SrcList*, int); |
| 2692 void sqlite3DropTriggerPtr(Parse*, Trigger*); | 2777 void sqlite3DropTriggerPtr(Parse*, Trigger*); |
| 2693 Trigger *sqlite3TriggersExist(Parse *, Table*, int, ExprList*, int *pMask); | 2778 Trigger *sqlite3TriggersExist(Parse *, Table*, int, ExprList*, int *pMask); |
| 2694 Trigger *sqlite3TriggerList(Parse *, Table *); | 2779 Trigger *sqlite3TriggerList(Parse *, Table *); |
| 2695 void sqlite3CodeRowTrigger(Parse*, Trigger *, int, ExprList*, int, Table *, | 2780 void sqlite3CodeRowTrigger(Parse*, Trigger *, int, ExprList*, int, Table *, |
| 2696 int, int, int, int); | 2781 int, int, int); |
| 2782 void sqlite3CodeRowTriggerDirect(Parse *, Trigger *, Table *, int, int, int); |
| 2697 void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*); | 2783 void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*); |
| 2698 void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*); | 2784 void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*); |
| 2699 TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*); | 2785 TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*); |
| 2700 TriggerStep *sqlite3TriggerInsertStep(sqlite3*,Token*, IdList*, | 2786 TriggerStep *sqlite3TriggerInsertStep(sqlite3*,Token*, IdList*, |
| 2701 ExprList*,Select*,u8); | 2787 ExprList*,Select*,u8); |
| 2702 TriggerStep *sqlite3TriggerUpdateStep(sqlite3*,Token*,ExprList*, Expr*, u8); | 2788 TriggerStep *sqlite3TriggerUpdateStep(sqlite3*,Token*,ExprList*, Expr*, u8); |
| 2703 TriggerStep *sqlite3TriggerDeleteStep(sqlite3*,Token*, Expr*); | 2789 TriggerStep *sqlite3TriggerDeleteStep(sqlite3*,Token*, Expr*); |
| 2704 void sqlite3DeleteTrigger(sqlite3*, Trigger*); | 2790 void sqlite3DeleteTrigger(sqlite3*, Trigger*); |
| 2705 void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*); | 2791 void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*); |
| 2706 u32 sqlite3TriggerOldmask(Parse*,Trigger*,int,ExprList*,Table*,int); | 2792 u32 sqlite3TriggerColmask(Parse*,Trigger*,ExprList*,int,int,Table*,int); |
| 2707 # define sqlite3ParseToplevel(p) ((p)->pToplevel ? (p)->pToplevel : (p)) | 2793 # define sqlite3ParseToplevel(p) ((p)->pToplevel ? (p)->pToplevel : (p)) |
| 2708 #else | 2794 #else |
| 2709 # define sqlite3TriggersExist(B,C,D,E,F) 0 | 2795 # define sqlite3TriggersExist(B,C,D,E,F) 0 |
| 2710 # define sqlite3DeleteTrigger(A,B) | 2796 # define sqlite3DeleteTrigger(A,B) |
| 2711 # define sqlite3DropTriggerPtr(A,B) | 2797 # define sqlite3DropTriggerPtr(A,B) |
| 2712 # define sqlite3UnlinkAndDeleteTrigger(A,B,C) | 2798 # define sqlite3UnlinkAndDeleteTrigger(A,B,C) |
| 2713 # define sqlite3CodeRowTrigger(A,B,C,D,E,F,G,H,I,J) | 2799 # define sqlite3CodeRowTrigger(A,B,C,D,E,F,G,H,I) |
| 2800 # define sqlite3CodeRowTriggerDirect(A,B,C,D,E,F) |
| 2714 # define sqlite3TriggerList(X, Y) 0 | 2801 # define sqlite3TriggerList(X, Y) 0 |
| 2715 # define sqlite3ParseToplevel(p) p | 2802 # define sqlite3ParseToplevel(p) p |
| 2716 # define sqlite3TriggerOldmask(A,B,C,D,E,F) 0 | 2803 # define sqlite3TriggerColmask(A,B,C,D,E,F,G) 0 |
| 2717 #endif | 2804 #endif |
| 2718 | 2805 |
| 2719 int sqlite3JoinType(Parse*, Token*, Token*, Token*); | 2806 int sqlite3JoinType(Parse*, Token*, Token*, Token*); |
| 2720 void sqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int); | 2807 void sqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int); |
| 2721 void sqlite3DeferForeignKey(Parse*, int); | 2808 void sqlite3DeferForeignKey(Parse*, int); |
| 2722 #ifndef SQLITE_OMIT_AUTHORIZATION | 2809 #ifndef SQLITE_OMIT_AUTHORIZATION |
| 2723 void sqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*); | 2810 void sqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*); |
| 2724 int sqlite3AuthCheck(Parse*,int, const char*, const char*, const char*); | 2811 int sqlite3AuthCheck(Parse*,int, const char*, const char*, const char*); |
| 2725 void sqlite3AuthContextPush(Parse*, AuthContext*, const char*); | 2812 void sqlite3AuthContextPush(Parse*, AuthContext*, const char*); |
| 2726 void sqlite3AuthContextPop(AuthContext*); | 2813 void sqlite3AuthContextPop(AuthContext*); |
| 2814 int sqlite3AuthReadCol(Parse*, const char *, const char *, int); |
| 2727 #else | 2815 #else |
| 2728 # define sqlite3AuthRead(a,b,c,d) | 2816 # define sqlite3AuthRead(a,b,c,d) |
| 2729 # define sqlite3AuthCheck(a,b,c,d,e) SQLITE_OK | 2817 # define sqlite3AuthCheck(a,b,c,d,e) SQLITE_OK |
| 2730 # define sqlite3AuthContextPush(a,b,c) | 2818 # define sqlite3AuthContextPush(a,b,c) |
| 2731 # define sqlite3AuthContextPop(a) ((void)(a)) | 2819 # define sqlite3AuthContextPop(a) ((void)(a)) |
| 2732 #endif | 2820 #endif |
| 2733 void sqlite3Attach(Parse*, Expr*, Expr*, Expr*); | 2821 void sqlite3Attach(Parse*, Expr*, Expr*, Expr*); |
| 2734 void sqlite3Detach(Parse*, Expr*); | 2822 void sqlite3Detach(Parse*, Expr*); |
| 2735 int sqlite3BtreeFactory(const sqlite3 *db, const char *zFilename, | |
| 2736 int omitJournal, int nCache, int flags, Btree **ppBtree); | |
| 2737 int sqlite3FixInit(DbFixer*, Parse*, int, const char*, const Token*); | 2823 int sqlite3FixInit(DbFixer*, Parse*, int, const char*, const Token*); |
| 2738 int sqlite3FixSrcList(DbFixer*, SrcList*); | 2824 int sqlite3FixSrcList(DbFixer*, SrcList*); |
| 2739 int sqlite3FixSelect(DbFixer*, Select*); | 2825 int sqlite3FixSelect(DbFixer*, Select*); |
| 2740 int sqlite3FixExpr(DbFixer*, Expr*); | 2826 int sqlite3FixExpr(DbFixer*, Expr*); |
| 2741 int sqlite3FixExprList(DbFixer*, ExprList*); | 2827 int sqlite3FixExprList(DbFixer*, ExprList*); |
| 2742 int sqlite3FixTriggerStep(DbFixer*, TriggerStep*); | 2828 int sqlite3FixTriggerStep(DbFixer*, TriggerStep*); |
| 2743 int sqlite3AtoF(const char *z, double*); | 2829 int sqlite3AtoF(const char *z, double*, int, u8); |
| 2744 int sqlite3GetInt32(const char *, int*); | 2830 int sqlite3GetInt32(const char *, int*); |
| 2745 int sqlite3FitsIn64Bits(const char *, int); | |
| 2746 int sqlite3Utf16ByteLen(const void *pData, int nChar); | 2831 int sqlite3Utf16ByteLen(const void *pData, int nChar); |
| 2747 int sqlite3Utf8CharLen(const char *pData, int nByte); | 2832 int sqlite3Utf8CharLen(const char *pData, int nByte); |
| 2748 int sqlite3Utf8Read(const u8*, const u8**); | 2833 int sqlite3Utf8Read(const u8*, const u8**); |
| 2749 | 2834 |
| 2750 /* | 2835 /* |
| 2751 ** Routines to read and write variable-length integers. These used to | 2836 ** Routines to read and write variable-length integers. These used to |
| 2752 ** be defined locally, but now we use the varint routines in the util.c | 2837 ** be defined locally, but now we use the varint routines in the util.c |
| 2753 ** file. Code should use the MACRO forms below, as the Varint32 versions | 2838 ** file. Code should use the MACRO forms below, as the Varint32 versions |
| 2754 ** are coded to assume the single byte case is already handled (which | 2839 ** are coded to assume the single byte case is already handled (which |
| 2755 ** the MACRO form does). | 2840 ** the MACRO form does). |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2781 #define putVarint32(A,B) (u8)(((u32)(B)<(u32)0x80) ? (*(A) = (unsigned char)(B)
),1 : sqlite3PutVarint32((A), (B))) | 2866 #define putVarint32(A,B) (u8)(((u32)(B)<(u32)0x80) ? (*(A) = (unsigned char)(B)
),1 : sqlite3PutVarint32((A), (B))) |
| 2782 #define getVarint sqlite3GetVarint | 2867 #define getVarint sqlite3GetVarint |
| 2783 #define putVarint sqlite3PutVarint | 2868 #define putVarint sqlite3PutVarint |
| 2784 | 2869 |
| 2785 | 2870 |
| 2786 const char *sqlite3IndexAffinityStr(Vdbe *, Index *); | 2871 const char *sqlite3IndexAffinityStr(Vdbe *, Index *); |
| 2787 void sqlite3TableAffinityStr(Vdbe *, Table *); | 2872 void sqlite3TableAffinityStr(Vdbe *, Table *); |
| 2788 char sqlite3CompareAffinity(Expr *pExpr, char aff2); | 2873 char sqlite3CompareAffinity(Expr *pExpr, char aff2); |
| 2789 int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity); | 2874 int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity); |
| 2790 char sqlite3ExprAffinity(Expr *pExpr); | 2875 char sqlite3ExprAffinity(Expr *pExpr); |
| 2791 int sqlite3Atoi64(const char*, i64*); | 2876 int sqlite3Atoi64(const char*, i64*, int, u8); |
| 2792 void sqlite3Error(sqlite3*, int, const char*,...); | 2877 void sqlite3Error(sqlite3*, int, const char*,...); |
| 2793 void *sqlite3HexToBlob(sqlite3*, const char *z, int n); | 2878 void *sqlite3HexToBlob(sqlite3*, const char *z, int n); |
| 2794 int sqlite3TwoPartName(Parse *, Token *, Token *, Token **); | 2879 int sqlite3TwoPartName(Parse *, Token *, Token *, Token **); |
| 2795 const char *sqlite3ErrStr(int); | 2880 const char *sqlite3ErrStr(int); |
| 2796 int sqlite3ReadSchema(Parse *pParse); | 2881 int sqlite3ReadSchema(Parse *pParse); |
| 2797 CollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char*,int); | 2882 CollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char*,int); |
| 2798 CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char*zName); | 2883 CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char*zName); |
| 2799 CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr); | 2884 CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr); |
| 2800 Expr *sqlite3ExprSetColl(Parse *pParse, Expr *, Token *); | 2885 Expr *sqlite3ExprSetColl(Expr*, CollSeq*); |
| 2886 Expr *sqlite3ExprSetCollByToken(Parse *pParse, Expr*, Token*); |
| 2801 int sqlite3CheckCollSeq(Parse *, CollSeq *); | 2887 int sqlite3CheckCollSeq(Parse *, CollSeq *); |
| 2802 int sqlite3CheckObjectName(Parse *, const char *); | 2888 int sqlite3CheckObjectName(Parse *, const char *); |
| 2803 void sqlite3VdbeSetChanges(sqlite3 *, int); | 2889 void sqlite3VdbeSetChanges(sqlite3 *, int); |
| 2804 | 2890 |
| 2805 const void *sqlite3ValueText(sqlite3_value*, u8); | 2891 const void *sqlite3ValueText(sqlite3_value*, u8); |
| 2806 int sqlite3ValueBytes(sqlite3_value*, u8); | 2892 int sqlite3ValueBytes(sqlite3_value*, u8); |
| 2807 void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8, | 2893 void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8, |
| 2808 void(*)(void*)); | 2894 void(*)(void*)); |
| 2809 void sqlite3ValueFree(sqlite3_value*); | 2895 void sqlite3ValueFree(sqlite3_value*); |
| 2810 sqlite3_value *sqlite3ValueNew(sqlite3 *); | 2896 sqlite3_value *sqlite3ValueNew(sqlite3 *); |
| 2811 char *sqlite3Utf16to8(sqlite3 *, const void*, int); | 2897 char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8); |
| 2812 #ifdef SQLITE_ENABLE_STAT2 | 2898 #ifdef SQLITE_ENABLE_STAT2 |
| 2813 char *sqlite3Utf8to16(sqlite3 *, u8, char *, int, int *); | 2899 char *sqlite3Utf8to16(sqlite3 *, u8, char *, int, int *); |
| 2814 #endif | 2900 #endif |
| 2815 int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **); | 2901 int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **); |
| 2816 void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8); | 2902 void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8); |
| 2817 #ifndef SQLITE_AMALGAMATION | 2903 #ifndef SQLITE_AMALGAMATION |
| 2904 extern const unsigned char sqlite3OpcodeProperty[]; |
| 2818 extern const unsigned char sqlite3UpperToLower[]; | 2905 extern const unsigned char sqlite3UpperToLower[]; |
| 2819 extern const unsigned char sqlite3CtypeMap[]; | 2906 extern const unsigned char sqlite3CtypeMap[]; |
| 2907 extern const Token sqlite3IntTokens[]; |
| 2820 extern SQLITE_WSD struct Sqlite3Config sqlite3Config; | 2908 extern SQLITE_WSD struct Sqlite3Config sqlite3Config; |
| 2821 extern SQLITE_WSD FuncDefHash sqlite3GlobalFunctions; | 2909 extern SQLITE_WSD FuncDefHash sqlite3GlobalFunctions; |
| 2910 #ifndef SQLITE_OMIT_WSD |
| 2822 extern int sqlite3PendingByte; | 2911 extern int sqlite3PendingByte; |
| 2823 #endif | 2912 #endif |
| 2913 #endif |
| 2824 void sqlite3RootPageMoved(Db*, int, int); | 2914 void sqlite3RootPageMoved(Db*, int, int); |
| 2825 void sqlite3Reindex(Parse*, Token*, Token*); | 2915 void sqlite3Reindex(Parse*, Token*, Token*); |
| 2826 void sqlite3AlterFunctions(sqlite3*); | 2916 void sqlite3AlterFunctions(void); |
| 2827 void sqlite3AlterRenameTable(Parse*, SrcList*, Token*); | 2917 void sqlite3AlterRenameTable(Parse*, SrcList*, Token*); |
| 2828 int sqlite3GetToken(const unsigned char *, int *); | 2918 int sqlite3GetToken(const unsigned char *, int *); |
| 2829 void sqlite3NestedParse(Parse*, const char*, ...); | 2919 void sqlite3NestedParse(Parse*, const char*, ...); |
| 2830 void sqlite3ExpirePreparedStatements(sqlite3*); | 2920 void sqlite3ExpirePreparedStatements(sqlite3*); |
| 2831 void sqlite3CodeSubselect(Parse *, Expr *, int, int); | 2921 int sqlite3CodeSubselect(Parse *, Expr *, int, int); |
| 2832 void sqlite3SelectPrep(Parse*, Select*, NameContext*); | 2922 void sqlite3SelectPrep(Parse*, Select*, NameContext*); |
| 2833 int sqlite3ResolveExprNames(NameContext*, Expr*); | 2923 int sqlite3ResolveExprNames(NameContext*, Expr*); |
| 2834 void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*); | 2924 void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*); |
| 2835 int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*); | 2925 int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*); |
| 2836 void sqlite3ColumnDefault(Vdbe *, Table *, int, int); | 2926 void sqlite3ColumnDefault(Vdbe *, Table *, int, int); |
| 2837 void sqlite3AlterFinishAddColumn(Parse *, Token *); | 2927 void sqlite3AlterFinishAddColumn(Parse *, Token *); |
| 2838 void sqlite3AlterBeginAddColumn(Parse *, SrcList *); | 2928 void sqlite3AlterBeginAddColumn(Parse *, SrcList *); |
| 2839 CollSeq *sqlite3GetCollSeq(sqlite3*, u8, CollSeq *, const char*); | 2929 CollSeq *sqlite3GetCollSeq(sqlite3*, u8, CollSeq *, const char*); |
| 2840 char sqlite3AffinityType(const char*); | 2930 char sqlite3AffinityType(const char*); |
| 2841 void sqlite3Analyze(Parse*, Token*, Token*); | 2931 void sqlite3Analyze(Parse*, Token*, Token*); |
| 2842 int sqlite3InvokeBusyHandler(BusyHandler*); | 2932 int sqlite3InvokeBusyHandler(BusyHandler*); |
| 2843 int sqlite3FindDb(sqlite3*, Token*); | 2933 int sqlite3FindDb(sqlite3*, Token*); |
| 2844 int sqlite3FindDbName(sqlite3 *, const char *); | 2934 int sqlite3FindDbName(sqlite3 *, const char *); |
| 2845 int sqlite3AnalysisLoad(sqlite3*,int iDB); | 2935 int sqlite3AnalysisLoad(sqlite3*,int iDB); |
| 2846 void sqlite3DeleteIndexSamples(Index*); | 2936 void sqlite3DeleteIndexSamples(sqlite3*,Index*); |
| 2847 void sqlite3DefaultRowEst(Index*); | 2937 void sqlite3DefaultRowEst(Index*); |
| 2848 void sqlite3RegisterLikeFunctions(sqlite3*, int); | 2938 void sqlite3RegisterLikeFunctions(sqlite3*, int); |
| 2849 int sqlite3IsLikeFunction(sqlite3*,Expr*,int*,char*); | 2939 int sqlite3IsLikeFunction(sqlite3*,Expr*,int*,char*); |
| 2850 void sqlite3MinimumFileFormat(Parse*, int, int); | 2940 void sqlite3MinimumFileFormat(Parse*, int, int); |
| 2851 void sqlite3SchemaFree(void *); | 2941 void sqlite3SchemaFree(void *); |
| 2852 Schema *sqlite3SchemaGet(sqlite3 *, Btree *); | 2942 Schema *sqlite3SchemaGet(sqlite3 *, Btree *); |
| 2853 int sqlite3SchemaToIndex(sqlite3 *db, Schema *); | 2943 int sqlite3SchemaToIndex(sqlite3 *db, Schema *); |
| 2854 KeyInfo *sqlite3IndexKeyinfo(Parse *, Index *); | 2944 KeyInfo *sqlite3IndexKeyinfo(Parse *, Index *); |
| 2855 int sqlite3CreateFunc(sqlite3 *, const char *, int, int, void *, | 2945 int sqlite3CreateFunc(sqlite3 *, const char *, int, int, void *, |
| 2856 void (*)(sqlite3_context*,int,sqlite3_value **), | 2946 void (*)(sqlite3_context*,int,sqlite3_value **), |
| 2857 void (*)(sqlite3_context*,int,sqlite3_value **), void (*)(sqlite3_context*)); | 2947 void (*)(sqlite3_context*,int,sqlite3_value **), void (*)(sqlite3_context*), |
| 2948 FuncDestructor *pDestructor |
| 2949 ); |
| 2858 int sqlite3ApiExit(sqlite3 *db, int); | 2950 int sqlite3ApiExit(sqlite3 *db, int); |
| 2859 int sqlite3OpenTempDatabase(Parse *); | 2951 int sqlite3OpenTempDatabase(Parse *); |
| 2860 | 2952 |
| 2861 void sqlite3StrAccumInit(StrAccum*, char*, int, int); | 2953 void sqlite3StrAccumInit(StrAccum*, char*, int, int); |
| 2862 void sqlite3StrAccumAppend(StrAccum*,const char*,int); | 2954 void sqlite3StrAccumAppend(StrAccum*,const char*,int); |
| 2863 char *sqlite3StrAccumFinish(StrAccum*); | 2955 char *sqlite3StrAccumFinish(StrAccum*); |
| 2864 void sqlite3StrAccumReset(StrAccum*); | 2956 void sqlite3StrAccumReset(StrAccum*); |
| 2865 void sqlite3SelectDestInit(SelectDest*,int,int); | 2957 void sqlite3SelectDestInit(SelectDest*,int,int); |
| 2958 Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int); |
| 2866 | 2959 |
| 2867 void sqlite3BackupRestart(sqlite3_backup *); | 2960 void sqlite3BackupRestart(sqlite3_backup *); |
| 2868 void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *); | 2961 void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *); |
| 2869 | 2962 |
| 2870 /* | 2963 /* |
| 2871 ** The interface to the LEMON-generated parser | 2964 ** The interface to the LEMON-generated parser |
| 2872 */ | 2965 */ |
| 2873 void *sqlite3ParserAlloc(void*(*)(size_t)); | 2966 void *sqlite3ParserAlloc(void*(*)(size_t)); |
| 2874 void sqlite3ParserFree(void*, void(*)(void*)); | 2967 void sqlite3ParserFree(void*, void(*)(void*)); |
| 2875 void sqlite3Parser(void*, int, Token, Parse*); | 2968 void sqlite3Parser(void*, int, Token, Parse*); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2897 #ifdef SQLITE_OMIT_VIRTUALTABLE | 2990 #ifdef SQLITE_OMIT_VIRTUALTABLE |
| 2898 # define sqlite3VtabClear(Y) | 2991 # define sqlite3VtabClear(Y) |
| 2899 # define sqlite3VtabSync(X,Y) SQLITE_OK | 2992 # define sqlite3VtabSync(X,Y) SQLITE_OK |
| 2900 # define sqlite3VtabRollback(X) | 2993 # define sqlite3VtabRollback(X) |
| 2901 # define sqlite3VtabCommit(X) | 2994 # define sqlite3VtabCommit(X) |
| 2902 # define sqlite3VtabInSync(db) 0 | 2995 # define sqlite3VtabInSync(db) 0 |
| 2903 # define sqlite3VtabLock(X) | 2996 # define sqlite3VtabLock(X) |
| 2904 # define sqlite3VtabUnlock(X) | 2997 # define sqlite3VtabUnlock(X) |
| 2905 # define sqlite3VtabUnlockList(X) | 2998 # define sqlite3VtabUnlockList(X) |
| 2906 #else | 2999 #else |
| 2907 void sqlite3VtabClear(Table*); | 3000 void sqlite3VtabClear(sqlite3 *db, Table*); |
| 2908 int sqlite3VtabSync(sqlite3 *db, char **); | 3001 int sqlite3VtabSync(sqlite3 *db, char **); |
| 2909 int sqlite3VtabRollback(sqlite3 *db); | 3002 int sqlite3VtabRollback(sqlite3 *db); |
| 2910 int sqlite3VtabCommit(sqlite3 *db); | 3003 int sqlite3VtabCommit(sqlite3 *db); |
| 2911 void sqlite3VtabLock(VTable *); | 3004 void sqlite3VtabLock(VTable *); |
| 2912 void sqlite3VtabUnlock(VTable *); | 3005 void sqlite3VtabUnlock(VTable *); |
| 2913 void sqlite3VtabUnlockList(sqlite3*); | 3006 void sqlite3VtabUnlockList(sqlite3*); |
| 2914 # define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0) | 3007 # define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0) |
| 2915 #endif | 3008 #endif |
| 2916 void sqlite3VtabMakeWritable(Parse*,Table*); | 3009 void sqlite3VtabMakeWritable(Parse*,Table*); |
| 2917 void sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*); | 3010 void sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*); |
| 2918 void sqlite3VtabFinishParse(Parse*, Token*); | 3011 void sqlite3VtabFinishParse(Parse*, Token*); |
| 2919 void sqlite3VtabArgInit(Parse*); | 3012 void sqlite3VtabArgInit(Parse*); |
| 2920 void sqlite3VtabArgExtend(Parse*, Token*); | 3013 void sqlite3VtabArgExtend(Parse*, Token*); |
| 2921 int sqlite3VtabCallCreate(sqlite3*, int, const char *, char **); | 3014 int sqlite3VtabCallCreate(sqlite3*, int, const char *, char **); |
| 2922 int sqlite3VtabCallConnect(Parse*, Table*); | 3015 int sqlite3VtabCallConnect(Parse*, Table*); |
| 2923 int sqlite3VtabCallDestroy(sqlite3*, int, const char *); | 3016 int sqlite3VtabCallDestroy(sqlite3*, int, const char *); |
| 2924 int sqlite3VtabBegin(sqlite3 *, VTable *); | 3017 int sqlite3VtabBegin(sqlite3 *, VTable *); |
| 2925 FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*); | 3018 FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*); |
| 2926 void sqlite3InvalidFunction(sqlite3_context*,int,sqlite3_value**); | 3019 void sqlite3InvalidFunction(sqlite3_context*,int,sqlite3_value**); |
| 3020 int sqlite3VdbeParameterIndex(Vdbe*, const char*, int); |
| 2927 int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *); | 3021 int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *); |
| 2928 int sqlite3Reprepare(Vdbe*); | 3022 int sqlite3Reprepare(Vdbe*); |
| 2929 void sqlite3ExprListCheckLength(Parse*, ExprList*, const char*); | 3023 void sqlite3ExprListCheckLength(Parse*, ExprList*, const char*); |
| 2930 CollSeq *sqlite3BinaryCompareCollSeq(Parse *, Expr *, Expr *); | 3024 CollSeq *sqlite3BinaryCompareCollSeq(Parse *, Expr *, Expr *); |
| 2931 int sqlite3TempInMemory(const sqlite3*); | 3025 int sqlite3TempInMemory(const sqlite3*); |
| 2932 VTable *sqlite3GetVTable(sqlite3*, Table*); | 3026 VTable *sqlite3GetVTable(sqlite3*, Table*); |
| 3027 const char *sqlite3JournalModename(int); |
| 3028 int sqlite3Checkpoint(sqlite3*, int); |
| 3029 int sqlite3WalDefaultHook(void*,sqlite3*,const char*,int); |
| 2933 | 3030 |
| 3031 /* Declarations for functions in fkey.c. All of these are replaced by |
| 3032 ** no-op macros if OMIT_FOREIGN_KEY is defined. In this case no foreign |
| 3033 ** key functionality is available. If OMIT_TRIGGER is defined but |
| 3034 ** OMIT_FOREIGN_KEY is not, only some of the functions are no-oped. In |
| 3035 ** this case foreign keys are parsed, but no other functionality is |
| 3036 ** provided (enforcement of FK constraints requires the triggers sub-system). |
| 3037 */ |
| 3038 #if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) |
| 3039 void sqlite3FkCheck(Parse*, Table*, int, int); |
| 3040 void sqlite3FkDropTable(Parse*, SrcList *, Table*); |
| 3041 void sqlite3FkActions(Parse*, Table*, ExprList*, int); |
| 3042 int sqlite3FkRequired(Parse*, Table*, int*, int); |
| 3043 u32 sqlite3FkOldmask(Parse*, Table*); |
| 3044 FKey *sqlite3FkReferences(Table *); |
| 3045 #else |
| 3046 #define sqlite3FkActions(a,b,c,d) |
| 3047 #define sqlite3FkCheck(a,b,c,d) |
| 3048 #define sqlite3FkDropTable(a,b,c) |
| 3049 #define sqlite3FkOldmask(a,b) 0 |
| 3050 #define sqlite3FkRequired(a,b,c,d) 0 |
| 3051 #endif |
| 3052 #ifndef SQLITE_OMIT_FOREIGN_KEY |
| 3053 void sqlite3FkDelete(sqlite3 *, Table*); |
| 3054 #else |
| 3055 #define sqlite3FkDelete(a,b) |
| 3056 #endif |
| 2934 | 3057 |
| 2935 | 3058 |
| 2936 /* | 3059 /* |
| 2937 ** Available fault injectors. Should be numbered beginning with 0. | 3060 ** Available fault injectors. Should be numbered beginning with 0. |
| 2938 */ | 3061 */ |
| 2939 #define SQLITE_FAULTINJECTOR_MALLOC 0 | 3062 #define SQLITE_FAULTINJECTOR_MALLOC 0 |
| 2940 #define SQLITE_FAULTINJECTOR_COUNT 1 | 3063 #define SQLITE_FAULTINJECTOR_COUNT 1 |
| 2941 | 3064 |
| 2942 /* | 3065 /* |
| 2943 ** The interface to the code in fault.c used for identifying "benign" | 3066 ** The interface to the code in fault.c used for identifying "benign" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3003 */ | 3126 */ |
| 3004 #ifdef SQLITE_ENABLE_IOTRACE | 3127 #ifdef SQLITE_ENABLE_IOTRACE |
| 3005 # define IOTRACE(A) if( sqlite3IoTrace ){ sqlite3IoTrace A; } | 3128 # define IOTRACE(A) if( sqlite3IoTrace ){ sqlite3IoTrace A; } |
| 3006 void sqlite3VdbeIOTraceSql(Vdbe*); | 3129 void sqlite3VdbeIOTraceSql(Vdbe*); |
| 3007 SQLITE_EXTERN void (*sqlite3IoTrace)(const char*,...); | 3130 SQLITE_EXTERN void (*sqlite3IoTrace)(const char*,...); |
| 3008 #else | 3131 #else |
| 3009 # define IOTRACE(A) | 3132 # define IOTRACE(A) |
| 3010 # define sqlite3VdbeIOTraceSql(X) | 3133 # define sqlite3VdbeIOTraceSql(X) |
| 3011 #endif | 3134 #endif |
| 3012 | 3135 |
| 3136 /* |
| 3137 ** These routines are available for the mem2.c debugging memory allocator |
| 3138 ** only. They are used to verify that different "types" of memory |
| 3139 ** allocations are properly tracked by the system. |
| 3140 ** |
| 3141 ** sqlite3MemdebugSetType() sets the "type" of an allocation to one of |
| 3142 ** the MEMTYPE_* macros defined below. The type must be a bitmask with |
| 3143 ** a single bit set. |
| 3144 ** |
| 3145 ** sqlite3MemdebugHasType() returns true if any of the bits in its second |
| 3146 ** argument match the type set by the previous sqlite3MemdebugSetType(). |
| 3147 ** sqlite3MemdebugHasType() is intended for use inside assert() statements. |
| 3148 ** |
| 3149 ** sqlite3MemdebugNoType() returns true if none of the bits in its second |
| 3150 ** argument match the type set by the previous sqlite3MemdebugSetType(). |
| 3151 ** |
| 3152 ** Perhaps the most important point is the difference between MEMTYPE_HEAP |
| 3153 ** and MEMTYPE_LOOKASIDE. If an allocation is MEMTYPE_LOOKASIDE, that means |
| 3154 ** it might have been allocated by lookaside, except the allocation was |
| 3155 ** too large or lookaside was already full. It is important to verify |
| 3156 ** that allocations that might have been satisfied by lookaside are not |
| 3157 ** passed back to non-lookaside free() routines. Asserts such as the |
| 3158 ** example above are placed on the non-lookaside free() routines to verify |
| 3159 ** this constraint. |
| 3160 ** |
| 3161 ** All of this is no-op for a production build. It only comes into |
| 3162 ** play when the SQLITE_MEMDEBUG compile-time option is used. |
| 3163 */ |
| 3164 #ifdef SQLITE_MEMDEBUG |
| 3165 void sqlite3MemdebugSetType(void*,u8); |
| 3166 int sqlite3MemdebugHasType(void*,u8); |
| 3167 int sqlite3MemdebugNoType(void*,u8); |
| 3168 #else |
| 3169 # define sqlite3MemdebugSetType(X,Y) /* no-op */ |
| 3170 # define sqlite3MemdebugHasType(X,Y) 1 |
| 3171 # define sqlite3MemdebugNoType(X,Y) 1 |
| 3013 #endif | 3172 #endif |
| 3173 #define MEMTYPE_HEAP 0x01 /* General heap allocations */ |
| 3174 #define MEMTYPE_LOOKASIDE 0x02 /* Might have been lookaside memory */ |
| 3175 #define MEMTYPE_SCRATCH 0x04 /* Scratch allocations */ |
| 3176 #define MEMTYPE_PCACHE 0x08 /* Page cache allocations */ |
| 3177 #define MEMTYPE_DB 0x10 /* Uses sqlite3DbMalloc, not sqlite_malloc */ |
| 3178 |
| 3179 #endif /* _SQLITEINT_H_ */ |
| OLD | NEW |