Fossil SCM

Update the built-in SQLite to the latest 3.8.1 beta that includes the "sqlite3.h" file text at the very beginning of the "sqlite3.c" amalgamation file.

drh 2013-10-11 13:29 trunk
Commit 7f5fbf95ebbf1caf0011c5916d0b85ec44870bb8
2 files changed +521 -523 +1 -1
+521 -523
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -23,531 +23,10 @@
2323
# define SQLITE_PRIVATE static
2424
#endif
2525
#ifndef SQLITE_API
2626
# define SQLITE_API
2727
#endif
28
-/************** Begin file sqliteInt.h ***************************************/
29
-/*
30
-** 2001 September 15
31
-**
32
-** The author disclaims copyright to this source code. In place of
33
-** a legal notice, here is a blessing:
34
-**
35
-** May you do good and not evil.
36
-** May you find forgiveness for yourself and forgive others.
37
-** May you share freely, never taking more than you give.
38
-**
39
-*************************************************************************
40
-** Internal interface definitions for SQLite.
41
-**
42
-*/
43
-#ifndef _SQLITEINT_H_
44
-#define _SQLITEINT_H_
45
-
46
-/*
47
-** These #defines should enable >2GB file support on POSIX if the
48
-** underlying operating system supports it. If the OS lacks
49
-** large file support, or if the OS is windows, these should be no-ops.
50
-**
51
-** Ticket #2739: The _LARGEFILE_SOURCE macro must appear before any
52
-** system #includes. Hence, this block of code must be the very first
53
-** code in all source files.
54
-**
55
-** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch
56
-** on the compiler command line. This is necessary if you are compiling
57
-** on a recent machine (ex: Red Hat 7.2) but you want your code to work
58
-** on an older machine (ex: Red Hat 6.0). If you compile on Red Hat 7.2
59
-** without this option, LFS is enable. But LFS does not exist in the kernel
60
-** in Red Hat 6.0, so the code won't work. Hence, for maximum binary
61
-** portability you should omit LFS.
62
-**
63
-** Similar is true for Mac OS X. LFS is only supported on Mac OS X 9 and later.
64
-*/
65
-#ifndef SQLITE_DISABLE_LFS
66
-# define _LARGE_FILE 1
67
-# ifndef _FILE_OFFSET_BITS
68
-# define _FILE_OFFSET_BITS 64
69
-# endif
70
-# define _LARGEFILE_SOURCE 1
71
-#endif
72
-
73
-/*
74
-** Include the configuration header output by 'configure' if we're using the
75
-** autoconf-based build
76
-*/
77
-#ifdef _HAVE_SQLITE_CONFIG_H
78
-#include "config.h"
79
-#endif
80
-
81
-/************** Include sqliteLimit.h in the middle of sqliteInt.h ***********/
82
-/************** Begin file sqliteLimit.h *************************************/
83
-/*
84
-** 2007 May 7
85
-**
86
-** The author disclaims copyright to this source code. In place of
87
-** a legal notice, here is a blessing:
88
-**
89
-** May you do good and not evil.
90
-** May you find forgiveness for yourself and forgive others.
91
-** May you share freely, never taking more than you give.
92
-**
93
-*************************************************************************
94
-**
95
-** This file defines various limits of what SQLite can process.
96
-*/
97
-
98
-/*
99
-** The maximum length of a TEXT or BLOB in bytes. This also
100
-** limits the size of a row in a table or index.
101
-**
102
-** The hard limit is the ability of a 32-bit signed integer
103
-** to count the size: 2^31-1 or 2147483647.
104
-*/
105
-#ifndef SQLITE_MAX_LENGTH
106
-# define SQLITE_MAX_LENGTH 1000000000
107
-#endif
108
-
109
-/*
110
-** This is the maximum number of
111
-**
112
-** * Columns in a table
113
-** * Columns in an index
114
-** * Columns in a view
115
-** * Terms in the SET clause of an UPDATE statement
116
-** * Terms in the result set of a SELECT statement
117
-** * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement.
118
-** * Terms in the VALUES clause of an INSERT statement
119
-**
120
-** The hard upper limit here is 32676. Most database people will
121
-** tell you that in a well-normalized database, you usually should
122
-** not have more than a dozen or so columns in any table. And if
123
-** that is the case, there is no point in having more than a few
124
-** dozen values in any of the other situations described above.
125
-*/
126
-#ifndef SQLITE_MAX_COLUMN
127
-# define SQLITE_MAX_COLUMN 2000
128
-#endif
129
-
130
-/*
131
-** The maximum length of a single SQL statement in bytes.
132
-**
133
-** It used to be the case that setting this value to zero would
134
-** turn the limit off. That is no longer true. It is not possible
135
-** to turn this limit off.
136
-*/
137
-#ifndef SQLITE_MAX_SQL_LENGTH
138
-# define SQLITE_MAX_SQL_LENGTH 1000000000
139
-#endif
140
-
141
-/*
142
-** The maximum depth of an expression tree. This is limited to
143
-** some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might
144
-** want to place more severe limits on the complexity of an
145
-** expression.
146
-**
147
-** A value of 0 used to mean that the limit was not enforced.
148
-** But that is no longer true. The limit is now strictly enforced
149
-** at all times.
150
-*/
151
-#ifndef SQLITE_MAX_EXPR_DEPTH
152
-# define SQLITE_MAX_EXPR_DEPTH 1000
153
-#endif
154
-
155
-/*
156
-** The maximum number of terms in a compound SELECT statement.
157
-** The code generator for compound SELECT statements does one
158
-** level of recursion for each term. A stack overflow can result
159
-** if the number of terms is too large. In practice, most SQL
160
-** never has more than 3 or 4 terms. Use a value of 0 to disable
161
-** any limit on the number of terms in a compount SELECT.
162
-*/
163
-#ifndef SQLITE_MAX_COMPOUND_SELECT
164
-# define SQLITE_MAX_COMPOUND_SELECT 500
165
-#endif
166
-
167
-/*
168
-** The maximum number of opcodes in a VDBE program.
169
-** Not currently enforced.
170
-*/
171
-#ifndef SQLITE_MAX_VDBE_OP
172
-# define SQLITE_MAX_VDBE_OP 25000
173
-#endif
174
-
175
-/*
176
-** The maximum number of arguments to an SQL function.
177
-*/
178
-#ifndef SQLITE_MAX_FUNCTION_ARG
179
-# define SQLITE_MAX_FUNCTION_ARG 127
180
-#endif
181
-
182
-/*
183
-** The maximum number of in-memory pages to use for the main database
184
-** table and for temporary tables. The SQLITE_DEFAULT_CACHE_SIZE
185
-*/
186
-#ifndef SQLITE_DEFAULT_CACHE_SIZE
187
-# define SQLITE_DEFAULT_CACHE_SIZE 2000
188
-#endif
189
-#ifndef SQLITE_DEFAULT_TEMP_CACHE_SIZE
190
-# define SQLITE_DEFAULT_TEMP_CACHE_SIZE 500
191
-#endif
192
-
193
-/*
194
-** The default number of frames to accumulate in the log file before
195
-** checkpointing the database in WAL mode.
196
-*/
197
-#ifndef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT
198
-# define SQLITE_DEFAULT_WAL_AUTOCHECKPOINT 1000
199
-#endif
200
-
201
-/*
202
-** The maximum number of attached databases. This must be between 0
203
-** and 62. The upper bound on 62 is because a 64-bit integer bitmap
204
-** is used internally to track attached databases.
205
-*/
206
-#ifndef SQLITE_MAX_ATTACHED
207
-# define SQLITE_MAX_ATTACHED 10
208
-#endif
209
-
210
-
211
-/*
212
-** The maximum value of a ?nnn wildcard that the parser will accept.
213
-*/
214
-#ifndef SQLITE_MAX_VARIABLE_NUMBER
215
-# define SQLITE_MAX_VARIABLE_NUMBER 999
216
-#endif
217
-
218
-/* Maximum page size. The upper bound on this value is 65536. This a limit
219
-** imposed by the use of 16-bit offsets within each page.
220
-**
221
-** Earlier versions of SQLite allowed the user to change this value at
222
-** compile time. This is no longer permitted, on the grounds that it creates
223
-** a library that is technically incompatible with an SQLite library
224
-** compiled with a different limit. If a process operating on a database
225
-** with a page-size of 65536 bytes crashes, then an instance of SQLite
226
-** compiled with the default page-size limit will not be able to rollback
227
-** the aborted transaction. This could lead to database corruption.
228
-*/
229
-#ifdef SQLITE_MAX_PAGE_SIZE
230
-# undef SQLITE_MAX_PAGE_SIZE
231
-#endif
232
-#define SQLITE_MAX_PAGE_SIZE 65536
233
-
234
-
235
-/*
236
-** The default size of a database page.
237
-*/
238
-#ifndef SQLITE_DEFAULT_PAGE_SIZE
239
-# define SQLITE_DEFAULT_PAGE_SIZE 1024
240
-#endif
241
-#if SQLITE_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
242
-# undef SQLITE_DEFAULT_PAGE_SIZE
243
-# define SQLITE_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
244
-#endif
245
-
246
-/*
247
-** Ordinarily, if no value is explicitly provided, SQLite creates databases
248
-** with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain
249
-** device characteristics (sector-size and atomic write() support),
250
-** SQLite may choose a larger value. This constant is the maximum value
251
-** SQLite will choose on its own.
252
-*/
253
-#ifndef SQLITE_MAX_DEFAULT_PAGE_SIZE
254
-# define SQLITE_MAX_DEFAULT_PAGE_SIZE 8192
255
-#endif
256
-#if SQLITE_MAX_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
257
-# undef SQLITE_MAX_DEFAULT_PAGE_SIZE
258
-# define SQLITE_MAX_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
259
-#endif
260
-
261
-
262
-/*
263
-** Maximum number of pages in one database file.
264
-**
265
-** This is really just the default value for the max_page_count pragma.
266
-** This value can be lowered (or raised) at run-time using that the
267
-** max_page_count macro.
268
-*/
269
-#ifndef SQLITE_MAX_PAGE_COUNT
270
-# define SQLITE_MAX_PAGE_COUNT 1073741823
271
-#endif
272
-
273
-/*
274
-** Maximum length (in bytes) of the pattern in a LIKE or GLOB
275
-** operator.
276
-*/
277
-#ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH
278
-# define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000
279
-#endif
280
-
281
-/*
282
-** Maximum depth of recursion for triggers.
283
-**
284
-** A value of 1 means that a trigger program will not be able to itself
285
-** fire any triggers. A value of 0 means that no trigger programs at all
286
-** may be executed.
287
-*/
288
-#ifndef SQLITE_MAX_TRIGGER_DEPTH
289
-# define SQLITE_MAX_TRIGGER_DEPTH 1000
290
-#endif
291
-
292
-/************** End of sqliteLimit.h *****************************************/
293
-/************** Continuing where we left off in sqliteInt.h ******************/
294
-
295
-/* Disable nuisance warnings on Borland compilers */
296
-#if defined(__BORLANDC__)
297
-#pragma warn -rch /* unreachable code */
298
-#pragma warn -ccc /* Condition is always true or false */
299
-#pragma warn -aus /* Assigned value is never used */
300
-#pragma warn -csu /* Comparing signed and unsigned */
301
-#pragma warn -spa /* Suspicious pointer arithmetic */
302
-#endif
303
-
304
-/* Needed for various definitions... */
305
-#ifndef _GNU_SOURCE
306
-# define _GNU_SOURCE
307
-#endif
308
-
309
-#if defined(__OpenBSD__) && !defined(_BSD_SOURCE)
310
-# define _BSD_SOURCE
311
-#endif
312
-
313
-/*
314
-** Include standard header files as necessary
315
-*/
316
-#ifdef HAVE_STDINT_H
317
-#include <stdint.h>
318
-#endif
319
-#ifdef HAVE_INTTYPES_H
320
-#include <inttypes.h>
321
-#endif
322
-
323
-/*
324
-** The following macros are used to cast pointers to integers and
325
-** integers to pointers. The way you do this varies from one compiler
326
-** to the next, so we have developed the following set of #if statements
327
-** to generate appropriate macros for a wide range of compilers.
328
-**
329
-** The correct "ANSI" way to do this is to use the intptr_t type.
330
-** Unfortunately, that typedef is not available on all compilers, or
331
-** if it is available, it requires an #include of specific headers
332
-** that vary from one machine to the next.
333
-**
334
-** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on
335
-** the ((void*)&((char*)0)[X]) construct. But MSVC chokes on ((void*)(X)).
336
-** So we have to define the macros in different ways depending on the
337
-** compiler.
338
-*/
339
-#if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */
340
-# define SQLITE_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X))
341
-# define SQLITE_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X))
342
-#elif !defined(__GNUC__) /* Works for compilers other than LLVM */
343
-# define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X])
344
-# define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0))
345
-#elif defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */
346
-# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X))
347
-# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X))
348
-#else /* Generates a warning - but it always works */
349
-# define SQLITE_INT_TO_PTR(X) ((void*)(X))
350
-# define SQLITE_PTR_TO_INT(X) ((int)(X))
351
-#endif
352
-
353
-/*
354
-** The SQLITE_THREADSAFE macro must be defined as 0, 1, or 2.
355
-** 0 means mutexes are permanently disable and the library is never
356
-** threadsafe. 1 means the library is serialized which is the highest
357
-** level of threadsafety. 2 means the library is multithreaded - multiple
358
-** threads can use SQLite as long as no two threads try to use the same
359
-** database connection at the same time.
360
-**
361
-** Older versions of SQLite used an optional THREADSAFE macro.
362
-** We support that for legacy.
363
-*/
364
-#if !defined(SQLITE_THREADSAFE)
365
-# if defined(THREADSAFE)
366
-# define SQLITE_THREADSAFE THREADSAFE
367
-# else
368
-# define SQLITE_THREADSAFE 1 /* IMP: R-07272-22309 */
369
-# endif
370
-#endif
371
-
372
-/*
373
-** Powersafe overwrite is on by default. But can be turned off using
374
-** the -DSQLITE_POWERSAFE_OVERWRITE=0 command-line option.
375
-*/
376
-#ifndef SQLITE_POWERSAFE_OVERWRITE
377
-# define SQLITE_POWERSAFE_OVERWRITE 1
378
-#endif
379
-
380
-/*
381
-** The SQLITE_DEFAULT_MEMSTATUS macro must be defined as either 0 or 1.
382
-** It determines whether or not the features related to
383
-** SQLITE_CONFIG_MEMSTATUS are available by default or not. This value can
384
-** be overridden at runtime using the sqlite3_config() API.
385
-*/
386
-#if !defined(SQLITE_DEFAULT_MEMSTATUS)
387
-# define SQLITE_DEFAULT_MEMSTATUS 1
388
-#endif
389
-
390
-/*
391
-** Exactly one of the following macros must be defined in order to
392
-** specify which memory allocation subsystem to use.
393
-**
394
-** SQLITE_SYSTEM_MALLOC // Use normal system malloc()
395
-** SQLITE_WIN32_MALLOC // Use Win32 native heap API
396
-** SQLITE_ZERO_MALLOC // Use a stub allocator that always fails
397
-** SQLITE_MEMDEBUG // Debugging version of system malloc()
398
-**
399
-** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the
400
-** assert() macro is enabled, each call into the Win32 native heap subsystem
401
-** will cause HeapValidate to be called. If heap validation should fail, an
402
-** assertion will be triggered.
403
-**
404
-** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as
405
-** the default.
406
-*/
407
-#if defined(SQLITE_SYSTEM_MALLOC) \
408
- + defined(SQLITE_WIN32_MALLOC) \
409
- + defined(SQLITE_ZERO_MALLOC) \
410
- + defined(SQLITE_MEMDEBUG)>1
411
-# error "Two or more of the following compile-time configuration options\
412
- are defined but at most one is allowed:\
413
- SQLITE_SYSTEM_MALLOC, SQLITE_WIN32_MALLOC, SQLITE_MEMDEBUG,\
414
- SQLITE_ZERO_MALLOC"
415
-#endif
416
-#if defined(SQLITE_SYSTEM_MALLOC) \
417
- + defined(SQLITE_WIN32_MALLOC) \
418
- + defined(SQLITE_ZERO_MALLOC) \
419
- + defined(SQLITE_MEMDEBUG)==0
420
-# define SQLITE_SYSTEM_MALLOC 1
421
-#endif
422
-
423
-/*
424
-** If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the
425
-** sizes of memory allocations below this value where possible.
426
-*/
427
-#if !defined(SQLITE_MALLOC_SOFT_LIMIT)
428
-# define SQLITE_MALLOC_SOFT_LIMIT 1024
429
-#endif
430
-
431
-/*
432
-** We need to define _XOPEN_SOURCE as follows in order to enable
433
-** recursive mutexes on most Unix systems and fchmod() on OpenBSD.
434
-** But _XOPEN_SOURCE define causes problems for Mac OS X, so omit
435
-** it.
436
-*/
437
-#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__)
438
-# define _XOPEN_SOURCE 600
439
-#endif
440
-
441
-/*
442
-** NDEBUG and SQLITE_DEBUG are opposites. It should always be true that
443
-** defined(NDEBUG)==!defined(SQLITE_DEBUG). If this is not currently true,
444
-** make it true by defining or undefining NDEBUG.
445
-**
446
-** Setting NDEBUG makes the code smaller and faster by disabling the
447
-** assert() statements in the code. So we want the default action
448
-** to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG
449
-** is set. Thus NDEBUG becomes an opt-in rather than an opt-out
450
-** feature.
451
-*/
452
-#if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
453
-# define NDEBUG 1
454
-#endif
455
-#if defined(NDEBUG) && defined(SQLITE_DEBUG)
456
-# undef NDEBUG
457
-#endif
458
-
459
-/*
460
-** The testcase() macro is used to aid in coverage testing. When
461
-** doing coverage testing, the condition inside the argument to
462
-** testcase() must be evaluated both true and false in order to
463
-** get full branch coverage. The testcase() macro is inserted
464
-** to help ensure adequate test coverage in places where simple
465
-** condition/decision coverage is inadequate. For example, testcase()
466
-** can be used to make sure boundary values are tested. For
467
-** bitmask tests, testcase() can be used to make sure each bit
468
-** is significant and used at least once. On switch statements
469
-** where multiple cases go to the same block of code, testcase()
470
-** can insure that all cases are evaluated.
471
-**
472
-*/
473
-#ifdef SQLITE_COVERAGE_TEST
474
-SQLITE_PRIVATE void sqlite3Coverage(int);
475
-# define testcase(X) if( X ){ sqlite3Coverage(__LINE__); }
476
-#else
477
-# define testcase(X)
478
-#endif
479
-
480
-/*
481
-** The TESTONLY macro is used to enclose variable declarations or
482
-** other bits of code that are needed to support the arguments
483
-** within testcase() and assert() macros.
484
-*/
485
-#if !defined(NDEBUG) || defined(SQLITE_COVERAGE_TEST)
486
-# define TESTONLY(X) X
487
-#else
488
-# define TESTONLY(X)
489
-#endif
490
-
491
-/*
492
-** Sometimes we need a small amount of code such as a variable initialization
493
-** to setup for a later assert() statement. We do not want this code to
494
-** appear when assert() is disabled. The following macro is therefore
495
-** used to contain that setup code. The "VVA" acronym stands for
496
-** "Verification, Validation, and Accreditation". In other words, the
497
-** code within VVA_ONLY() will only run during verification processes.
498
-*/
499
-#ifndef NDEBUG
500
-# define VVA_ONLY(X) X
501
-#else
502
-# define VVA_ONLY(X)
503
-#endif
504
-
505
-/*
506
-** The ALWAYS and NEVER macros surround boolean expressions which
507
-** are intended to always be true or false, respectively. Such
508
-** expressions could be omitted from the code completely. But they
509
-** are included in a few cases in order to enhance the resilience
510
-** of SQLite to unexpected behavior - to make the code "self-healing"
511
-** or "ductile" rather than being "brittle" and crashing at the first
512
-** hint of unplanned behavior.
513
-**
514
-** In other words, ALWAYS and NEVER are added for defensive code.
515
-**
516
-** When doing coverage testing ALWAYS and NEVER are hard-coded to
517
-** be true and false so that the unreachable code they specify will
518
-** not be counted as untested code.
519
-*/
520
-#if defined(SQLITE_COVERAGE_TEST)
521
-# define ALWAYS(X) (1)
522
-# define NEVER(X) (0)
523
-#elif !defined(NDEBUG)
524
-# define ALWAYS(X) ((X)?1:(assert(0),0))
525
-# define NEVER(X) ((X)?(assert(0),1):0)
526
-#else
527
-# define ALWAYS(X) (X)
528
-# define NEVER(X) (X)
529
-#endif
530
-
531
-/*
532
-** Return true (non-zero) if the input is a integer that is too large
533
-** to fit in 32-bits. This macro is used inside of various testcase()
534
-** macros to verify that we have tested SQLite for large-file support.
535
-*/
536
-#define IS_BIG_INT(X) (((X)&~(i64)0xffffffff)!=0)
537
-
538
-/*
539
-** The macro unlikely() is a hint that surrounds a boolean
540
-** expression that is usually false. Macro likely() surrounds
541
-** a boolean expression that is usually true. These hints could,
542
-** in theory, be used by the compiler to generate better code, but
543
-** currently they are just comments for human readers.
544
-*/
545
-#define likely(X) (X)
546
-#define unlikely(X) (X)
547
-
548
-/************** Include sqlite3.h in the middle of sqliteInt.h ***************/
54928
/************** Begin file sqlite3.h *****************************************/
55029
/*
55130
** 2001 September 15
55231
**
55332
** The author disclaims copyright to this source code. In place of
@@ -656,11 +135,11 @@
656135
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
657136
** [sqlite_version()] and [sqlite_source_id()].
658137
*/
659138
#define SQLITE_VERSION "3.8.1"
660139
#define SQLITE_VERSION_NUMBER 3008001
661
-#define SQLITE_SOURCE_ID "2013-10-10 15:04:52 af7abebeb1f70466833bc766d294d721eaef746f"
140
+#define SQLITE_SOURCE_ID "2013-10-11 13:27:26 03593817ab5abdd4bbaa5e47e2e4745eef025af9"
662141
663142
/*
664143
** CAPI3REF: Run-Time Library Version Numbers
665144
** KEYWORDS: sqlite3_version, sqlite3_sourceid
666145
**
@@ -7846,11 +7325,530 @@
78467325
78477326
#endif /* ifndef _SQLITE3RTREE_H_ */
78487327
78497328
78507329
/************** End of sqlite3.h *********************************************/
7330
+/************** Begin file sqliteInt.h ***************************************/
7331
+/*
7332
+** 2001 September 15
7333
+**
7334
+** The author disclaims copyright to this source code. In place of
7335
+** a legal notice, here is a blessing:
7336
+**
7337
+** May you do good and not evil.
7338
+** May you find forgiveness for yourself and forgive others.
7339
+** May you share freely, never taking more than you give.
7340
+**
7341
+*************************************************************************
7342
+** Internal interface definitions for SQLite.
7343
+**
7344
+*/
7345
+#ifndef _SQLITEINT_H_
7346
+#define _SQLITEINT_H_
7347
+
7348
+/*
7349
+** These #defines should enable >2GB file support on POSIX if the
7350
+** underlying operating system supports it. If the OS lacks
7351
+** large file support, or if the OS is windows, these should be no-ops.
7352
+**
7353
+** Ticket #2739: The _LARGEFILE_SOURCE macro must appear before any
7354
+** system #includes. Hence, this block of code must be the very first
7355
+** code in all source files.
7356
+**
7357
+** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch
7358
+** on the compiler command line. This is necessary if you are compiling
7359
+** on a recent machine (ex: Red Hat 7.2) but you want your code to work
7360
+** on an older machine (ex: Red Hat 6.0). If you compile on Red Hat 7.2
7361
+** without this option, LFS is enable. But LFS does not exist in the kernel
7362
+** in Red Hat 6.0, so the code won't work. Hence, for maximum binary
7363
+** portability you should omit LFS.
7364
+**
7365
+** Similar is true for Mac OS X. LFS is only supported on Mac OS X 9 and later.
7366
+*/
7367
+#ifndef SQLITE_DISABLE_LFS
7368
+# define _LARGE_FILE 1
7369
+# ifndef _FILE_OFFSET_BITS
7370
+# define _FILE_OFFSET_BITS 64
7371
+# endif
7372
+# define _LARGEFILE_SOURCE 1
7373
+#endif
7374
+
7375
+/*
7376
+** Include the configuration header output by 'configure' if we're using the
7377
+** autoconf-based build
7378
+*/
7379
+#ifdef _HAVE_SQLITE_CONFIG_H
7380
+#include "config.h"
7381
+#endif
7382
+
7383
+/************** Include sqliteLimit.h in the middle of sqliteInt.h ***********/
7384
+/************** Begin file sqliteLimit.h *************************************/
7385
+/*
7386
+** 2007 May 7
7387
+**
7388
+** The author disclaims copyright to this source code. In place of
7389
+** a legal notice, here is a blessing:
7390
+**
7391
+** May you do good and not evil.
7392
+** May you find forgiveness for yourself and forgive others.
7393
+** May you share freely, never taking more than you give.
7394
+**
7395
+*************************************************************************
7396
+**
7397
+** This file defines various limits of what SQLite can process.
7398
+*/
7399
+
7400
+/*
7401
+** The maximum length of a TEXT or BLOB in bytes. This also
7402
+** limits the size of a row in a table or index.
7403
+**
7404
+** The hard limit is the ability of a 32-bit signed integer
7405
+** to count the size: 2^31-1 or 2147483647.
7406
+*/
7407
+#ifndef SQLITE_MAX_LENGTH
7408
+# define SQLITE_MAX_LENGTH 1000000000
7409
+#endif
7410
+
7411
+/*
7412
+** This is the maximum number of
7413
+**
7414
+** * Columns in a table
7415
+** * Columns in an index
7416
+** * Columns in a view
7417
+** * Terms in the SET clause of an UPDATE statement
7418
+** * Terms in the result set of a SELECT statement
7419
+** * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement.
7420
+** * Terms in the VALUES clause of an INSERT statement
7421
+**
7422
+** The hard upper limit here is 32676. Most database people will
7423
+** tell you that in a well-normalized database, you usually should
7424
+** not have more than a dozen or so columns in any table. And if
7425
+** that is the case, there is no point in having more than a few
7426
+** dozen values in any of the other situations described above.
7427
+*/
7428
+#ifndef SQLITE_MAX_COLUMN
7429
+# define SQLITE_MAX_COLUMN 2000
7430
+#endif
7431
+
7432
+/*
7433
+** The maximum length of a single SQL statement in bytes.
7434
+**
7435
+** It used to be the case that setting this value to zero would
7436
+** turn the limit off. That is no longer true. It is not possible
7437
+** to turn this limit off.
7438
+*/
7439
+#ifndef SQLITE_MAX_SQL_LENGTH
7440
+# define SQLITE_MAX_SQL_LENGTH 1000000000
7441
+#endif
7442
+
7443
+/*
7444
+** The maximum depth of an expression tree. This is limited to
7445
+** some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might
7446
+** want to place more severe limits on the complexity of an
7447
+** expression.
7448
+**
7449
+** A value of 0 used to mean that the limit was not enforced.
7450
+** But that is no longer true. The limit is now strictly enforced
7451
+** at all times.
7452
+*/
7453
+#ifndef SQLITE_MAX_EXPR_DEPTH
7454
+# define SQLITE_MAX_EXPR_DEPTH 1000
7455
+#endif
7456
+
7457
+/*
7458
+** The maximum number of terms in a compound SELECT statement.
7459
+** The code generator for compound SELECT statements does one
7460
+** level of recursion for each term. A stack overflow can result
7461
+** if the number of terms is too large. In practice, most SQL
7462
+** never has more than 3 or 4 terms. Use a value of 0 to disable
7463
+** any limit on the number of terms in a compount SELECT.
7464
+*/
7465
+#ifndef SQLITE_MAX_COMPOUND_SELECT
7466
+# define SQLITE_MAX_COMPOUND_SELECT 500
7467
+#endif
7468
+
7469
+/*
7470
+** The maximum number of opcodes in a VDBE program.
7471
+** Not currently enforced.
7472
+*/
7473
+#ifndef SQLITE_MAX_VDBE_OP
7474
+# define SQLITE_MAX_VDBE_OP 25000
7475
+#endif
7476
+
7477
+/*
7478
+** The maximum number of arguments to an SQL function.
7479
+*/
7480
+#ifndef SQLITE_MAX_FUNCTION_ARG
7481
+# define SQLITE_MAX_FUNCTION_ARG 127
7482
+#endif
7483
+
7484
+/*
7485
+** The maximum number of in-memory pages to use for the main database
7486
+** table and for temporary tables. The SQLITE_DEFAULT_CACHE_SIZE
7487
+*/
7488
+#ifndef SQLITE_DEFAULT_CACHE_SIZE
7489
+# define SQLITE_DEFAULT_CACHE_SIZE 2000
7490
+#endif
7491
+#ifndef SQLITE_DEFAULT_TEMP_CACHE_SIZE
7492
+# define SQLITE_DEFAULT_TEMP_CACHE_SIZE 500
7493
+#endif
7494
+
7495
+/*
7496
+** The default number of frames to accumulate in the log file before
7497
+** checkpointing the database in WAL mode.
7498
+*/
7499
+#ifndef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT
7500
+# define SQLITE_DEFAULT_WAL_AUTOCHECKPOINT 1000
7501
+#endif
7502
+
7503
+/*
7504
+** The maximum number of attached databases. This must be between 0
7505
+** and 62. The upper bound on 62 is because a 64-bit integer bitmap
7506
+** is used internally to track attached databases.
7507
+*/
7508
+#ifndef SQLITE_MAX_ATTACHED
7509
+# define SQLITE_MAX_ATTACHED 10
7510
+#endif
7511
+
7512
+
7513
+/*
7514
+** The maximum value of a ?nnn wildcard that the parser will accept.
7515
+*/
7516
+#ifndef SQLITE_MAX_VARIABLE_NUMBER
7517
+# define SQLITE_MAX_VARIABLE_NUMBER 999
7518
+#endif
7519
+
7520
+/* Maximum page size. The upper bound on this value is 65536. This a limit
7521
+** imposed by the use of 16-bit offsets within each page.
7522
+**
7523
+** Earlier versions of SQLite allowed the user to change this value at
7524
+** compile time. This is no longer permitted, on the grounds that it creates
7525
+** a library that is technically incompatible with an SQLite library
7526
+** compiled with a different limit. If a process operating on a database
7527
+** with a page-size of 65536 bytes crashes, then an instance of SQLite
7528
+** compiled with the default page-size limit will not be able to rollback
7529
+** the aborted transaction. This could lead to database corruption.
7530
+*/
7531
+#ifdef SQLITE_MAX_PAGE_SIZE
7532
+# undef SQLITE_MAX_PAGE_SIZE
7533
+#endif
7534
+#define SQLITE_MAX_PAGE_SIZE 65536
7535
+
7536
+
7537
+/*
7538
+** The default size of a database page.
7539
+*/
7540
+#ifndef SQLITE_DEFAULT_PAGE_SIZE
7541
+# define SQLITE_DEFAULT_PAGE_SIZE 1024
7542
+#endif
7543
+#if SQLITE_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
7544
+# undef SQLITE_DEFAULT_PAGE_SIZE
7545
+# define SQLITE_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
7546
+#endif
7547
+
7548
+/*
7549
+** Ordinarily, if no value is explicitly provided, SQLite creates databases
7550
+** with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain
7551
+** device characteristics (sector-size and atomic write() support),
7552
+** SQLite may choose a larger value. This constant is the maximum value
7553
+** SQLite will choose on its own.
7554
+*/
7555
+#ifndef SQLITE_MAX_DEFAULT_PAGE_SIZE
7556
+# define SQLITE_MAX_DEFAULT_PAGE_SIZE 8192
7557
+#endif
7558
+#if SQLITE_MAX_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
7559
+# undef SQLITE_MAX_DEFAULT_PAGE_SIZE
7560
+# define SQLITE_MAX_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
7561
+#endif
7562
+
7563
+
7564
+/*
7565
+** Maximum number of pages in one database file.
7566
+**
7567
+** This is really just the default value for the max_page_count pragma.
7568
+** This value can be lowered (or raised) at run-time using that the
7569
+** max_page_count macro.
7570
+*/
7571
+#ifndef SQLITE_MAX_PAGE_COUNT
7572
+# define SQLITE_MAX_PAGE_COUNT 1073741823
7573
+#endif
7574
+
7575
+/*
7576
+** Maximum length (in bytes) of the pattern in a LIKE or GLOB
7577
+** operator.
7578
+*/
7579
+#ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH
7580
+# define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000
7581
+#endif
7582
+
7583
+/*
7584
+** Maximum depth of recursion for triggers.
7585
+**
7586
+** A value of 1 means that a trigger program will not be able to itself
7587
+** fire any triggers. A value of 0 means that no trigger programs at all
7588
+** may be executed.
7589
+*/
7590
+#ifndef SQLITE_MAX_TRIGGER_DEPTH
7591
+# define SQLITE_MAX_TRIGGER_DEPTH 1000
7592
+#endif
7593
+
7594
+/************** End of sqliteLimit.h *****************************************/
78517595
/************** Continuing where we left off in sqliteInt.h ******************/
7596
+
7597
+/* Disable nuisance warnings on Borland compilers */
7598
+#if defined(__BORLANDC__)
7599
+#pragma warn -rch /* unreachable code */
7600
+#pragma warn -ccc /* Condition is always true or false */
7601
+#pragma warn -aus /* Assigned value is never used */
7602
+#pragma warn -csu /* Comparing signed and unsigned */
7603
+#pragma warn -spa /* Suspicious pointer arithmetic */
7604
+#endif
7605
+
7606
+/* Needed for various definitions... */
7607
+#ifndef _GNU_SOURCE
7608
+# define _GNU_SOURCE
7609
+#endif
7610
+
7611
+#if defined(__OpenBSD__) && !defined(_BSD_SOURCE)
7612
+# define _BSD_SOURCE
7613
+#endif
7614
+
7615
+/*
7616
+** Include standard header files as necessary
7617
+*/
7618
+#ifdef HAVE_STDINT_H
7619
+#include <stdint.h>
7620
+#endif
7621
+#ifdef HAVE_INTTYPES_H
7622
+#include <inttypes.h>
7623
+#endif
7624
+
7625
+/*
7626
+** The following macros are used to cast pointers to integers and
7627
+** integers to pointers. The way you do this varies from one compiler
7628
+** to the next, so we have developed the following set of #if statements
7629
+** to generate appropriate macros for a wide range of compilers.
7630
+**
7631
+** The correct "ANSI" way to do this is to use the intptr_t type.
7632
+** Unfortunately, that typedef is not available on all compilers, or
7633
+** if it is available, it requires an #include of specific headers
7634
+** that vary from one machine to the next.
7635
+**
7636
+** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on
7637
+** the ((void*)&((char*)0)[X]) construct. But MSVC chokes on ((void*)(X)).
7638
+** So we have to define the macros in different ways depending on the
7639
+** compiler.
7640
+*/
7641
+#if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */
7642
+# define SQLITE_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X))
7643
+# define SQLITE_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X))
7644
+#elif !defined(__GNUC__) /* Works for compilers other than LLVM */
7645
+# define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X])
7646
+# define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0))
7647
+#elif defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */
7648
+# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X))
7649
+# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X))
7650
+#else /* Generates a warning - but it always works */
7651
+# define SQLITE_INT_TO_PTR(X) ((void*)(X))
7652
+# define SQLITE_PTR_TO_INT(X) ((int)(X))
7653
+#endif
7654
+
7655
+/*
7656
+** The SQLITE_THREADSAFE macro must be defined as 0, 1, or 2.
7657
+** 0 means mutexes are permanently disable and the library is never
7658
+** threadsafe. 1 means the library is serialized which is the highest
7659
+** level of threadsafety. 2 means the library is multithreaded - multiple
7660
+** threads can use SQLite as long as no two threads try to use the same
7661
+** database connection at the same time.
7662
+**
7663
+** Older versions of SQLite used an optional THREADSAFE macro.
7664
+** We support that for legacy.
7665
+*/
7666
+#if !defined(SQLITE_THREADSAFE)
7667
+# if defined(THREADSAFE)
7668
+# define SQLITE_THREADSAFE THREADSAFE
7669
+# else
7670
+# define SQLITE_THREADSAFE 1 /* IMP: R-07272-22309 */
7671
+# endif
7672
+#endif
7673
+
7674
+/*
7675
+** Powersafe overwrite is on by default. But can be turned off using
7676
+** the -DSQLITE_POWERSAFE_OVERWRITE=0 command-line option.
7677
+*/
7678
+#ifndef SQLITE_POWERSAFE_OVERWRITE
7679
+# define SQLITE_POWERSAFE_OVERWRITE 1
7680
+#endif
7681
+
7682
+/*
7683
+** The SQLITE_DEFAULT_MEMSTATUS macro must be defined as either 0 or 1.
7684
+** It determines whether or not the features related to
7685
+** SQLITE_CONFIG_MEMSTATUS are available by default or not. This value can
7686
+** be overridden at runtime using the sqlite3_config() API.
7687
+*/
7688
+#if !defined(SQLITE_DEFAULT_MEMSTATUS)
7689
+# define SQLITE_DEFAULT_MEMSTATUS 1
7690
+#endif
7691
+
7692
+/*
7693
+** Exactly one of the following macros must be defined in order to
7694
+** specify which memory allocation subsystem to use.
7695
+**
7696
+** SQLITE_SYSTEM_MALLOC // Use normal system malloc()
7697
+** SQLITE_WIN32_MALLOC // Use Win32 native heap API
7698
+** SQLITE_ZERO_MALLOC // Use a stub allocator that always fails
7699
+** SQLITE_MEMDEBUG // Debugging version of system malloc()
7700
+**
7701
+** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the
7702
+** assert() macro is enabled, each call into the Win32 native heap subsystem
7703
+** will cause HeapValidate to be called. If heap validation should fail, an
7704
+** assertion will be triggered.
7705
+**
7706
+** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as
7707
+** the default.
7708
+*/
7709
+#if defined(SQLITE_SYSTEM_MALLOC) \
7710
+ + defined(SQLITE_WIN32_MALLOC) \
7711
+ + defined(SQLITE_ZERO_MALLOC) \
7712
+ + defined(SQLITE_MEMDEBUG)>1
7713
+# error "Two or more of the following compile-time configuration options\
7714
+ are defined but at most one is allowed:\
7715
+ SQLITE_SYSTEM_MALLOC, SQLITE_WIN32_MALLOC, SQLITE_MEMDEBUG,\
7716
+ SQLITE_ZERO_MALLOC"
7717
+#endif
7718
+#if defined(SQLITE_SYSTEM_MALLOC) \
7719
+ + defined(SQLITE_WIN32_MALLOC) \
7720
+ + defined(SQLITE_ZERO_MALLOC) \
7721
+ + defined(SQLITE_MEMDEBUG)==0
7722
+# define SQLITE_SYSTEM_MALLOC 1
7723
+#endif
7724
+
7725
+/*
7726
+** If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the
7727
+** sizes of memory allocations below this value where possible.
7728
+*/
7729
+#if !defined(SQLITE_MALLOC_SOFT_LIMIT)
7730
+# define SQLITE_MALLOC_SOFT_LIMIT 1024
7731
+#endif
7732
+
7733
+/*
7734
+** We need to define _XOPEN_SOURCE as follows in order to enable
7735
+** recursive mutexes on most Unix systems and fchmod() on OpenBSD.
7736
+** But _XOPEN_SOURCE define causes problems for Mac OS X, so omit
7737
+** it.
7738
+*/
7739
+#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__)
7740
+# define _XOPEN_SOURCE 600
7741
+#endif
7742
+
7743
+/*
7744
+** NDEBUG and SQLITE_DEBUG are opposites. It should always be true that
7745
+** defined(NDEBUG)==!defined(SQLITE_DEBUG). If this is not currently true,
7746
+** make it true by defining or undefining NDEBUG.
7747
+**
7748
+** Setting NDEBUG makes the code smaller and faster by disabling the
7749
+** assert() statements in the code. So we want the default action
7750
+** to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG
7751
+** is set. Thus NDEBUG becomes an opt-in rather than an opt-out
7752
+** feature.
7753
+*/
7754
+#if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
7755
+# define NDEBUG 1
7756
+#endif
7757
+#if defined(NDEBUG) && defined(SQLITE_DEBUG)
7758
+# undef NDEBUG
7759
+#endif
7760
+
7761
+/*
7762
+** The testcase() macro is used to aid in coverage testing. When
7763
+** doing coverage testing, the condition inside the argument to
7764
+** testcase() must be evaluated both true and false in order to
7765
+** get full branch coverage. The testcase() macro is inserted
7766
+** to help ensure adequate test coverage in places where simple
7767
+** condition/decision coverage is inadequate. For example, testcase()
7768
+** can be used to make sure boundary values are tested. For
7769
+** bitmask tests, testcase() can be used to make sure each bit
7770
+** is significant and used at least once. On switch statements
7771
+** where multiple cases go to the same block of code, testcase()
7772
+** can insure that all cases are evaluated.
7773
+**
7774
+*/
7775
+#ifdef SQLITE_COVERAGE_TEST
7776
+SQLITE_PRIVATE void sqlite3Coverage(int);
7777
+# define testcase(X) if( X ){ sqlite3Coverage(__LINE__); }
7778
+#else
7779
+# define testcase(X)
7780
+#endif
7781
+
7782
+/*
7783
+** The TESTONLY macro is used to enclose variable declarations or
7784
+** other bits of code that are needed to support the arguments
7785
+** within testcase() and assert() macros.
7786
+*/
7787
+#if !defined(NDEBUG) || defined(SQLITE_COVERAGE_TEST)
7788
+# define TESTONLY(X) X
7789
+#else
7790
+# define TESTONLY(X)
7791
+#endif
7792
+
7793
+/*
7794
+** Sometimes we need a small amount of code such as a variable initialization
7795
+** to setup for a later assert() statement. We do not want this code to
7796
+** appear when assert() is disabled. The following macro is therefore
7797
+** used to contain that setup code. The "VVA" acronym stands for
7798
+** "Verification, Validation, and Accreditation". In other words, the
7799
+** code within VVA_ONLY() will only run during verification processes.
7800
+*/
7801
+#ifndef NDEBUG
7802
+# define VVA_ONLY(X) X
7803
+#else
7804
+# define VVA_ONLY(X)
7805
+#endif
7806
+
7807
+/*
7808
+** The ALWAYS and NEVER macros surround boolean expressions which
7809
+** are intended to always be true or false, respectively. Such
7810
+** expressions could be omitted from the code completely. But they
7811
+** are included in a few cases in order to enhance the resilience
7812
+** of SQLite to unexpected behavior - to make the code "self-healing"
7813
+** or "ductile" rather than being "brittle" and crashing at the first
7814
+** hint of unplanned behavior.
7815
+**
7816
+** In other words, ALWAYS and NEVER are added for defensive code.
7817
+**
7818
+** When doing coverage testing ALWAYS and NEVER are hard-coded to
7819
+** be true and false so that the unreachable code they specify will
7820
+** not be counted as untested code.
7821
+*/
7822
+#if defined(SQLITE_COVERAGE_TEST)
7823
+# define ALWAYS(X) (1)
7824
+# define NEVER(X) (0)
7825
+#elif !defined(NDEBUG)
7826
+# define ALWAYS(X) ((X)?1:(assert(0),0))
7827
+# define NEVER(X) ((X)?(assert(0),1):0)
7828
+#else
7829
+# define ALWAYS(X) (X)
7830
+# define NEVER(X) (X)
7831
+#endif
7832
+
7833
+/*
7834
+** Return true (non-zero) if the input is a integer that is too large
7835
+** to fit in 32-bits. This macro is used inside of various testcase()
7836
+** macros to verify that we have tested SQLite for large-file support.
7837
+*/
7838
+#define IS_BIG_INT(X) (((X)&~(i64)0xffffffff)!=0)
7839
+
7840
+/*
7841
+** The macro unlikely() is a hint that surrounds a boolean
7842
+** expression that is usually false. Macro likely() surrounds
7843
+** a boolean expression that is usually true. These hints could,
7844
+** in theory, be used by the compiler to generate better code, but
7845
+** currently they are just comments for human readers.
7846
+*/
7847
+#define likely(X) (X)
7848
+#define unlikely(X) (X)
7849
+
78527850
/************** Include hash.h in the middle of sqliteInt.h ******************/
78537851
/************** Begin file hash.h ********************************************/
78547852
/*
78557853
** 2001 September 22
78567854
**
@@ -31494,11 +31492,11 @@
3149431492
#endif
3149531493
3149631494
#define osGetVersionExA ((BOOL(WINAPI*)( \
3149731495
LPOSVERSIONINFOA))aSyscall[34].pCurrent)
3149831496
31499
-#if defined(SQLITE_WIN32_HAS_WIDE)
31497
+#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
3150031498
{ "GetVersionExW", (SYSCALL)GetVersionExW, 0 },
3150131499
#else
3150231500
{ "GetVersionExW", (SYSCALL)0, 0 },
3150331501
#endif
3150431502
3150531503
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -23,531 +23,10 @@
23 # define SQLITE_PRIVATE static
24 #endif
25 #ifndef SQLITE_API
26 # define SQLITE_API
27 #endif
28 /************** Begin file sqliteInt.h ***************************************/
29 /*
30 ** 2001 September 15
31 **
32 ** The author disclaims copyright to this source code. In place of
33 ** a legal notice, here is a blessing:
34 **
35 ** May you do good and not evil.
36 ** May you find forgiveness for yourself and forgive others.
37 ** May you share freely, never taking more than you give.
38 **
39 *************************************************************************
40 ** Internal interface definitions for SQLite.
41 **
42 */
43 #ifndef _SQLITEINT_H_
44 #define _SQLITEINT_H_
45
46 /*
47 ** These #defines should enable >2GB file support on POSIX if the
48 ** underlying operating system supports it. If the OS lacks
49 ** large file support, or if the OS is windows, these should be no-ops.
50 **
51 ** Ticket #2739: The _LARGEFILE_SOURCE macro must appear before any
52 ** system #includes. Hence, this block of code must be the very first
53 ** code in all source files.
54 **
55 ** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch
56 ** on the compiler command line. This is necessary if you are compiling
57 ** on a recent machine (ex: Red Hat 7.2) but you want your code to work
58 ** on an older machine (ex: Red Hat 6.0). If you compile on Red Hat 7.2
59 ** without this option, LFS is enable. But LFS does not exist in the kernel
60 ** in Red Hat 6.0, so the code won't work. Hence, for maximum binary
61 ** portability you should omit LFS.
62 **
63 ** Similar is true for Mac OS X. LFS is only supported on Mac OS X 9 and later.
64 */
65 #ifndef SQLITE_DISABLE_LFS
66 # define _LARGE_FILE 1
67 # ifndef _FILE_OFFSET_BITS
68 # define _FILE_OFFSET_BITS 64
69 # endif
70 # define _LARGEFILE_SOURCE 1
71 #endif
72
73 /*
74 ** Include the configuration header output by 'configure' if we're using the
75 ** autoconf-based build
76 */
77 #ifdef _HAVE_SQLITE_CONFIG_H
78 #include "config.h"
79 #endif
80
81 /************** Include sqliteLimit.h in the middle of sqliteInt.h ***********/
82 /************** Begin file sqliteLimit.h *************************************/
83 /*
84 ** 2007 May 7
85 **
86 ** The author disclaims copyright to this source code. In place of
87 ** a legal notice, here is a blessing:
88 **
89 ** May you do good and not evil.
90 ** May you find forgiveness for yourself and forgive others.
91 ** May you share freely, never taking more than you give.
92 **
93 *************************************************************************
94 **
95 ** This file defines various limits of what SQLite can process.
96 */
97
98 /*
99 ** The maximum length of a TEXT or BLOB in bytes. This also
100 ** limits the size of a row in a table or index.
101 **
102 ** The hard limit is the ability of a 32-bit signed integer
103 ** to count the size: 2^31-1 or 2147483647.
104 */
105 #ifndef SQLITE_MAX_LENGTH
106 # define SQLITE_MAX_LENGTH 1000000000
107 #endif
108
109 /*
110 ** This is the maximum number of
111 **
112 ** * Columns in a table
113 ** * Columns in an index
114 ** * Columns in a view
115 ** * Terms in the SET clause of an UPDATE statement
116 ** * Terms in the result set of a SELECT statement
117 ** * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement.
118 ** * Terms in the VALUES clause of an INSERT statement
119 **
120 ** The hard upper limit here is 32676. Most database people will
121 ** tell you that in a well-normalized database, you usually should
122 ** not have more than a dozen or so columns in any table. And if
123 ** that is the case, there is no point in having more than a few
124 ** dozen values in any of the other situations described above.
125 */
126 #ifndef SQLITE_MAX_COLUMN
127 # define SQLITE_MAX_COLUMN 2000
128 #endif
129
130 /*
131 ** The maximum length of a single SQL statement in bytes.
132 **
133 ** It used to be the case that setting this value to zero would
134 ** turn the limit off. That is no longer true. It is not possible
135 ** to turn this limit off.
136 */
137 #ifndef SQLITE_MAX_SQL_LENGTH
138 # define SQLITE_MAX_SQL_LENGTH 1000000000
139 #endif
140
141 /*
142 ** The maximum depth of an expression tree. This is limited to
143 ** some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might
144 ** want to place more severe limits on the complexity of an
145 ** expression.
146 **
147 ** A value of 0 used to mean that the limit was not enforced.
148 ** But that is no longer true. The limit is now strictly enforced
149 ** at all times.
150 */
151 #ifndef SQLITE_MAX_EXPR_DEPTH
152 # define SQLITE_MAX_EXPR_DEPTH 1000
153 #endif
154
155 /*
156 ** The maximum number of terms in a compound SELECT statement.
157 ** The code generator for compound SELECT statements does one
158 ** level of recursion for each term. A stack overflow can result
159 ** if the number of terms is too large. In practice, most SQL
160 ** never has more than 3 or 4 terms. Use a value of 0 to disable
161 ** any limit on the number of terms in a compount SELECT.
162 */
163 #ifndef SQLITE_MAX_COMPOUND_SELECT
164 # define SQLITE_MAX_COMPOUND_SELECT 500
165 #endif
166
167 /*
168 ** The maximum number of opcodes in a VDBE program.
169 ** Not currently enforced.
170 */
171 #ifndef SQLITE_MAX_VDBE_OP
172 # define SQLITE_MAX_VDBE_OP 25000
173 #endif
174
175 /*
176 ** The maximum number of arguments to an SQL function.
177 */
178 #ifndef SQLITE_MAX_FUNCTION_ARG
179 # define SQLITE_MAX_FUNCTION_ARG 127
180 #endif
181
182 /*
183 ** The maximum number of in-memory pages to use for the main database
184 ** table and for temporary tables. The SQLITE_DEFAULT_CACHE_SIZE
185 */
186 #ifndef SQLITE_DEFAULT_CACHE_SIZE
187 # define SQLITE_DEFAULT_CACHE_SIZE 2000
188 #endif
189 #ifndef SQLITE_DEFAULT_TEMP_CACHE_SIZE
190 # define SQLITE_DEFAULT_TEMP_CACHE_SIZE 500
191 #endif
192
193 /*
194 ** The default number of frames to accumulate in the log file before
195 ** checkpointing the database in WAL mode.
196 */
197 #ifndef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT
198 # define SQLITE_DEFAULT_WAL_AUTOCHECKPOINT 1000
199 #endif
200
201 /*
202 ** The maximum number of attached databases. This must be between 0
203 ** and 62. The upper bound on 62 is because a 64-bit integer bitmap
204 ** is used internally to track attached databases.
205 */
206 #ifndef SQLITE_MAX_ATTACHED
207 # define SQLITE_MAX_ATTACHED 10
208 #endif
209
210
211 /*
212 ** The maximum value of a ?nnn wildcard that the parser will accept.
213 */
214 #ifndef SQLITE_MAX_VARIABLE_NUMBER
215 # define SQLITE_MAX_VARIABLE_NUMBER 999
216 #endif
217
218 /* Maximum page size. The upper bound on this value is 65536. This a limit
219 ** imposed by the use of 16-bit offsets within each page.
220 **
221 ** Earlier versions of SQLite allowed the user to change this value at
222 ** compile time. This is no longer permitted, on the grounds that it creates
223 ** a library that is technically incompatible with an SQLite library
224 ** compiled with a different limit. If a process operating on a database
225 ** with a page-size of 65536 bytes crashes, then an instance of SQLite
226 ** compiled with the default page-size limit will not be able to rollback
227 ** the aborted transaction. This could lead to database corruption.
228 */
229 #ifdef SQLITE_MAX_PAGE_SIZE
230 # undef SQLITE_MAX_PAGE_SIZE
231 #endif
232 #define SQLITE_MAX_PAGE_SIZE 65536
233
234
235 /*
236 ** The default size of a database page.
237 */
238 #ifndef SQLITE_DEFAULT_PAGE_SIZE
239 # define SQLITE_DEFAULT_PAGE_SIZE 1024
240 #endif
241 #if SQLITE_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
242 # undef SQLITE_DEFAULT_PAGE_SIZE
243 # define SQLITE_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
244 #endif
245
246 /*
247 ** Ordinarily, if no value is explicitly provided, SQLite creates databases
248 ** with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain
249 ** device characteristics (sector-size and atomic write() support),
250 ** SQLite may choose a larger value. This constant is the maximum value
251 ** SQLite will choose on its own.
252 */
253 #ifndef SQLITE_MAX_DEFAULT_PAGE_SIZE
254 # define SQLITE_MAX_DEFAULT_PAGE_SIZE 8192
255 #endif
256 #if SQLITE_MAX_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
257 # undef SQLITE_MAX_DEFAULT_PAGE_SIZE
258 # define SQLITE_MAX_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
259 #endif
260
261
262 /*
263 ** Maximum number of pages in one database file.
264 **
265 ** This is really just the default value for the max_page_count pragma.
266 ** This value can be lowered (or raised) at run-time using that the
267 ** max_page_count macro.
268 */
269 #ifndef SQLITE_MAX_PAGE_COUNT
270 # define SQLITE_MAX_PAGE_COUNT 1073741823
271 #endif
272
273 /*
274 ** Maximum length (in bytes) of the pattern in a LIKE or GLOB
275 ** operator.
276 */
277 #ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH
278 # define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000
279 #endif
280
281 /*
282 ** Maximum depth of recursion for triggers.
283 **
284 ** A value of 1 means that a trigger program will not be able to itself
285 ** fire any triggers. A value of 0 means that no trigger programs at all
286 ** may be executed.
287 */
288 #ifndef SQLITE_MAX_TRIGGER_DEPTH
289 # define SQLITE_MAX_TRIGGER_DEPTH 1000
290 #endif
291
292 /************** End of sqliteLimit.h *****************************************/
293 /************** Continuing where we left off in sqliteInt.h ******************/
294
295 /* Disable nuisance warnings on Borland compilers */
296 #if defined(__BORLANDC__)
297 #pragma warn -rch /* unreachable code */
298 #pragma warn -ccc /* Condition is always true or false */
299 #pragma warn -aus /* Assigned value is never used */
300 #pragma warn -csu /* Comparing signed and unsigned */
301 #pragma warn -spa /* Suspicious pointer arithmetic */
302 #endif
303
304 /* Needed for various definitions... */
305 #ifndef _GNU_SOURCE
306 # define _GNU_SOURCE
307 #endif
308
309 #if defined(__OpenBSD__) && !defined(_BSD_SOURCE)
310 # define _BSD_SOURCE
311 #endif
312
313 /*
314 ** Include standard header files as necessary
315 */
316 #ifdef HAVE_STDINT_H
317 #include <stdint.h>
318 #endif
319 #ifdef HAVE_INTTYPES_H
320 #include <inttypes.h>
321 #endif
322
323 /*
324 ** The following macros are used to cast pointers to integers and
325 ** integers to pointers. The way you do this varies from one compiler
326 ** to the next, so we have developed the following set of #if statements
327 ** to generate appropriate macros for a wide range of compilers.
328 **
329 ** The correct "ANSI" way to do this is to use the intptr_t type.
330 ** Unfortunately, that typedef is not available on all compilers, or
331 ** if it is available, it requires an #include of specific headers
332 ** that vary from one machine to the next.
333 **
334 ** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on
335 ** the ((void*)&((char*)0)[X]) construct. But MSVC chokes on ((void*)(X)).
336 ** So we have to define the macros in different ways depending on the
337 ** compiler.
338 */
339 #if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */
340 # define SQLITE_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X))
341 # define SQLITE_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X))
342 #elif !defined(__GNUC__) /* Works for compilers other than LLVM */
343 # define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X])
344 # define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0))
345 #elif defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */
346 # define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X))
347 # define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X))
348 #else /* Generates a warning - but it always works */
349 # define SQLITE_INT_TO_PTR(X) ((void*)(X))
350 # define SQLITE_PTR_TO_INT(X) ((int)(X))
351 #endif
352
353 /*
354 ** The SQLITE_THREADSAFE macro must be defined as 0, 1, or 2.
355 ** 0 means mutexes are permanently disable and the library is never
356 ** threadsafe. 1 means the library is serialized which is the highest
357 ** level of threadsafety. 2 means the library is multithreaded - multiple
358 ** threads can use SQLite as long as no two threads try to use the same
359 ** database connection at the same time.
360 **
361 ** Older versions of SQLite used an optional THREADSAFE macro.
362 ** We support that for legacy.
363 */
364 #if !defined(SQLITE_THREADSAFE)
365 # if defined(THREADSAFE)
366 # define SQLITE_THREADSAFE THREADSAFE
367 # else
368 # define SQLITE_THREADSAFE 1 /* IMP: R-07272-22309 */
369 # endif
370 #endif
371
372 /*
373 ** Powersafe overwrite is on by default. But can be turned off using
374 ** the -DSQLITE_POWERSAFE_OVERWRITE=0 command-line option.
375 */
376 #ifndef SQLITE_POWERSAFE_OVERWRITE
377 # define SQLITE_POWERSAFE_OVERWRITE 1
378 #endif
379
380 /*
381 ** The SQLITE_DEFAULT_MEMSTATUS macro must be defined as either 0 or 1.
382 ** It determines whether or not the features related to
383 ** SQLITE_CONFIG_MEMSTATUS are available by default or not. This value can
384 ** be overridden at runtime using the sqlite3_config() API.
385 */
386 #if !defined(SQLITE_DEFAULT_MEMSTATUS)
387 # define SQLITE_DEFAULT_MEMSTATUS 1
388 #endif
389
390 /*
391 ** Exactly one of the following macros must be defined in order to
392 ** specify which memory allocation subsystem to use.
393 **
394 ** SQLITE_SYSTEM_MALLOC // Use normal system malloc()
395 ** SQLITE_WIN32_MALLOC // Use Win32 native heap API
396 ** SQLITE_ZERO_MALLOC // Use a stub allocator that always fails
397 ** SQLITE_MEMDEBUG // Debugging version of system malloc()
398 **
399 ** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the
400 ** assert() macro is enabled, each call into the Win32 native heap subsystem
401 ** will cause HeapValidate to be called. If heap validation should fail, an
402 ** assertion will be triggered.
403 **
404 ** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as
405 ** the default.
406 */
407 #if defined(SQLITE_SYSTEM_MALLOC) \
408 + defined(SQLITE_WIN32_MALLOC) \
409 + defined(SQLITE_ZERO_MALLOC) \
410 + defined(SQLITE_MEMDEBUG)>1
411 # error "Two or more of the following compile-time configuration options\
412 are defined but at most one is allowed:\
413 SQLITE_SYSTEM_MALLOC, SQLITE_WIN32_MALLOC, SQLITE_MEMDEBUG,\
414 SQLITE_ZERO_MALLOC"
415 #endif
416 #if defined(SQLITE_SYSTEM_MALLOC) \
417 + defined(SQLITE_WIN32_MALLOC) \
418 + defined(SQLITE_ZERO_MALLOC) \
419 + defined(SQLITE_MEMDEBUG)==0
420 # define SQLITE_SYSTEM_MALLOC 1
421 #endif
422
423 /*
424 ** If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the
425 ** sizes of memory allocations below this value where possible.
426 */
427 #if !defined(SQLITE_MALLOC_SOFT_LIMIT)
428 # define SQLITE_MALLOC_SOFT_LIMIT 1024
429 #endif
430
431 /*
432 ** We need to define _XOPEN_SOURCE as follows in order to enable
433 ** recursive mutexes on most Unix systems and fchmod() on OpenBSD.
434 ** But _XOPEN_SOURCE define causes problems for Mac OS X, so omit
435 ** it.
436 */
437 #if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__)
438 # define _XOPEN_SOURCE 600
439 #endif
440
441 /*
442 ** NDEBUG and SQLITE_DEBUG are opposites. It should always be true that
443 ** defined(NDEBUG)==!defined(SQLITE_DEBUG). If this is not currently true,
444 ** make it true by defining or undefining NDEBUG.
445 **
446 ** Setting NDEBUG makes the code smaller and faster by disabling the
447 ** assert() statements in the code. So we want the default action
448 ** to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG
449 ** is set. Thus NDEBUG becomes an opt-in rather than an opt-out
450 ** feature.
451 */
452 #if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
453 # define NDEBUG 1
454 #endif
455 #if defined(NDEBUG) && defined(SQLITE_DEBUG)
456 # undef NDEBUG
457 #endif
458
459 /*
460 ** The testcase() macro is used to aid in coverage testing. When
461 ** doing coverage testing, the condition inside the argument to
462 ** testcase() must be evaluated both true and false in order to
463 ** get full branch coverage. The testcase() macro is inserted
464 ** to help ensure adequate test coverage in places where simple
465 ** condition/decision coverage is inadequate. For example, testcase()
466 ** can be used to make sure boundary values are tested. For
467 ** bitmask tests, testcase() can be used to make sure each bit
468 ** is significant and used at least once. On switch statements
469 ** where multiple cases go to the same block of code, testcase()
470 ** can insure that all cases are evaluated.
471 **
472 */
473 #ifdef SQLITE_COVERAGE_TEST
474 SQLITE_PRIVATE void sqlite3Coverage(int);
475 # define testcase(X) if( X ){ sqlite3Coverage(__LINE__); }
476 #else
477 # define testcase(X)
478 #endif
479
480 /*
481 ** The TESTONLY macro is used to enclose variable declarations or
482 ** other bits of code that are needed to support the arguments
483 ** within testcase() and assert() macros.
484 */
485 #if !defined(NDEBUG) || defined(SQLITE_COVERAGE_TEST)
486 # define TESTONLY(X) X
487 #else
488 # define TESTONLY(X)
489 #endif
490
491 /*
492 ** Sometimes we need a small amount of code such as a variable initialization
493 ** to setup for a later assert() statement. We do not want this code to
494 ** appear when assert() is disabled. The following macro is therefore
495 ** used to contain that setup code. The "VVA" acronym stands for
496 ** "Verification, Validation, and Accreditation". In other words, the
497 ** code within VVA_ONLY() will only run during verification processes.
498 */
499 #ifndef NDEBUG
500 # define VVA_ONLY(X) X
501 #else
502 # define VVA_ONLY(X)
503 #endif
504
505 /*
506 ** The ALWAYS and NEVER macros surround boolean expressions which
507 ** are intended to always be true or false, respectively. Such
508 ** expressions could be omitted from the code completely. But they
509 ** are included in a few cases in order to enhance the resilience
510 ** of SQLite to unexpected behavior - to make the code "self-healing"
511 ** or "ductile" rather than being "brittle" and crashing at the first
512 ** hint of unplanned behavior.
513 **
514 ** In other words, ALWAYS and NEVER are added for defensive code.
515 **
516 ** When doing coverage testing ALWAYS and NEVER are hard-coded to
517 ** be true and false so that the unreachable code they specify will
518 ** not be counted as untested code.
519 */
520 #if defined(SQLITE_COVERAGE_TEST)
521 # define ALWAYS(X) (1)
522 # define NEVER(X) (0)
523 #elif !defined(NDEBUG)
524 # define ALWAYS(X) ((X)?1:(assert(0),0))
525 # define NEVER(X) ((X)?(assert(0),1):0)
526 #else
527 # define ALWAYS(X) (X)
528 # define NEVER(X) (X)
529 #endif
530
531 /*
532 ** Return true (non-zero) if the input is a integer that is too large
533 ** to fit in 32-bits. This macro is used inside of various testcase()
534 ** macros to verify that we have tested SQLite for large-file support.
535 */
536 #define IS_BIG_INT(X) (((X)&~(i64)0xffffffff)!=0)
537
538 /*
539 ** The macro unlikely() is a hint that surrounds a boolean
540 ** expression that is usually false. Macro likely() surrounds
541 ** a boolean expression that is usually true. These hints could,
542 ** in theory, be used by the compiler to generate better code, but
543 ** currently they are just comments for human readers.
544 */
545 #define likely(X) (X)
546 #define unlikely(X) (X)
547
548 /************** Include sqlite3.h in the middle of sqliteInt.h ***************/
549 /************** Begin file sqlite3.h *****************************************/
550 /*
551 ** 2001 September 15
552 **
553 ** The author disclaims copyright to this source code. In place of
@@ -656,11 +135,11 @@
656 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
657 ** [sqlite_version()] and [sqlite_source_id()].
658 */
659 #define SQLITE_VERSION "3.8.1"
660 #define SQLITE_VERSION_NUMBER 3008001
661 #define SQLITE_SOURCE_ID "2013-10-10 15:04:52 af7abebeb1f70466833bc766d294d721eaef746f"
662
663 /*
664 ** CAPI3REF: Run-Time Library Version Numbers
665 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
666 **
@@ -7846,11 +7325,530 @@
7846
7847 #endif /* ifndef _SQLITE3RTREE_H_ */
7848
7849
7850 /************** End of sqlite3.h *********************************************/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7851 /************** Continuing where we left off in sqliteInt.h ******************/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7852 /************** Include hash.h in the middle of sqliteInt.h ******************/
7853 /************** Begin file hash.h ********************************************/
7854 /*
7855 ** 2001 September 22
7856 **
@@ -31494,11 +31492,11 @@
31494 #endif
31495
31496 #define osGetVersionExA ((BOOL(WINAPI*)( \
31497 LPOSVERSIONINFOA))aSyscall[34].pCurrent)
31498
31499 #if defined(SQLITE_WIN32_HAS_WIDE)
31500 { "GetVersionExW", (SYSCALL)GetVersionExW, 0 },
31501 #else
31502 { "GetVersionExW", (SYSCALL)0, 0 },
31503 #endif
31504
31505
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -23,531 +23,10 @@
23 # define SQLITE_PRIVATE static
24 #endif
25 #ifndef SQLITE_API
26 # define SQLITE_API
27 #endif
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28 /************** Begin file sqlite3.h *****************************************/
29 /*
30 ** 2001 September 15
31 **
32 ** The author disclaims copyright to this source code. In place of
@@ -656,11 +135,11 @@
135 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
136 ** [sqlite_version()] and [sqlite_source_id()].
137 */
138 #define SQLITE_VERSION "3.8.1"
139 #define SQLITE_VERSION_NUMBER 3008001
140 #define SQLITE_SOURCE_ID "2013-10-11 13:27:26 03593817ab5abdd4bbaa5e47e2e4745eef025af9"
141
142 /*
143 ** CAPI3REF: Run-Time Library Version Numbers
144 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
145 **
@@ -7846,11 +7325,530 @@
7325
7326 #endif /* ifndef _SQLITE3RTREE_H_ */
7327
7328
7329 /************** End of sqlite3.h *********************************************/
7330 /************** Begin file sqliteInt.h ***************************************/
7331 /*
7332 ** 2001 September 15
7333 **
7334 ** The author disclaims copyright to this source code. In place of
7335 ** a legal notice, here is a blessing:
7336 **
7337 ** May you do good and not evil.
7338 ** May you find forgiveness for yourself and forgive others.
7339 ** May you share freely, never taking more than you give.
7340 **
7341 *************************************************************************
7342 ** Internal interface definitions for SQLite.
7343 **
7344 */
7345 #ifndef _SQLITEINT_H_
7346 #define _SQLITEINT_H_
7347
7348 /*
7349 ** These #defines should enable >2GB file support on POSIX if the
7350 ** underlying operating system supports it. If the OS lacks
7351 ** large file support, or if the OS is windows, these should be no-ops.
7352 **
7353 ** Ticket #2739: The _LARGEFILE_SOURCE macro must appear before any
7354 ** system #includes. Hence, this block of code must be the very first
7355 ** code in all source files.
7356 **
7357 ** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch
7358 ** on the compiler command line. This is necessary if you are compiling
7359 ** on a recent machine (ex: Red Hat 7.2) but you want your code to work
7360 ** on an older machine (ex: Red Hat 6.0). If you compile on Red Hat 7.2
7361 ** without this option, LFS is enable. But LFS does not exist in the kernel
7362 ** in Red Hat 6.0, so the code won't work. Hence, for maximum binary
7363 ** portability you should omit LFS.
7364 **
7365 ** Similar is true for Mac OS X. LFS is only supported on Mac OS X 9 and later.
7366 */
7367 #ifndef SQLITE_DISABLE_LFS
7368 # define _LARGE_FILE 1
7369 # ifndef _FILE_OFFSET_BITS
7370 # define _FILE_OFFSET_BITS 64
7371 # endif
7372 # define _LARGEFILE_SOURCE 1
7373 #endif
7374
7375 /*
7376 ** Include the configuration header output by 'configure' if we're using the
7377 ** autoconf-based build
7378 */
7379 #ifdef _HAVE_SQLITE_CONFIG_H
7380 #include "config.h"
7381 #endif
7382
7383 /************** Include sqliteLimit.h in the middle of sqliteInt.h ***********/
7384 /************** Begin file sqliteLimit.h *************************************/
7385 /*
7386 ** 2007 May 7
7387 **
7388 ** The author disclaims copyright to this source code. In place of
7389 ** a legal notice, here is a blessing:
7390 **
7391 ** May you do good and not evil.
7392 ** May you find forgiveness for yourself and forgive others.
7393 ** May you share freely, never taking more than you give.
7394 **
7395 *************************************************************************
7396 **
7397 ** This file defines various limits of what SQLite can process.
7398 */
7399
7400 /*
7401 ** The maximum length of a TEXT or BLOB in bytes. This also
7402 ** limits the size of a row in a table or index.
7403 **
7404 ** The hard limit is the ability of a 32-bit signed integer
7405 ** to count the size: 2^31-1 or 2147483647.
7406 */
7407 #ifndef SQLITE_MAX_LENGTH
7408 # define SQLITE_MAX_LENGTH 1000000000
7409 #endif
7410
7411 /*
7412 ** This is the maximum number of
7413 **
7414 ** * Columns in a table
7415 ** * Columns in an index
7416 ** * Columns in a view
7417 ** * Terms in the SET clause of an UPDATE statement
7418 ** * Terms in the result set of a SELECT statement
7419 ** * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement.
7420 ** * Terms in the VALUES clause of an INSERT statement
7421 **
7422 ** The hard upper limit here is 32676. Most database people will
7423 ** tell you that in a well-normalized database, you usually should
7424 ** not have more than a dozen or so columns in any table. And if
7425 ** that is the case, there is no point in having more than a few
7426 ** dozen values in any of the other situations described above.
7427 */
7428 #ifndef SQLITE_MAX_COLUMN
7429 # define SQLITE_MAX_COLUMN 2000
7430 #endif
7431
7432 /*
7433 ** The maximum length of a single SQL statement in bytes.
7434 **
7435 ** It used to be the case that setting this value to zero would
7436 ** turn the limit off. That is no longer true. It is not possible
7437 ** to turn this limit off.
7438 */
7439 #ifndef SQLITE_MAX_SQL_LENGTH
7440 # define SQLITE_MAX_SQL_LENGTH 1000000000
7441 #endif
7442
7443 /*
7444 ** The maximum depth of an expression tree. This is limited to
7445 ** some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might
7446 ** want to place more severe limits on the complexity of an
7447 ** expression.
7448 **
7449 ** A value of 0 used to mean that the limit was not enforced.
7450 ** But that is no longer true. The limit is now strictly enforced
7451 ** at all times.
7452 */
7453 #ifndef SQLITE_MAX_EXPR_DEPTH
7454 # define SQLITE_MAX_EXPR_DEPTH 1000
7455 #endif
7456
7457 /*
7458 ** The maximum number of terms in a compound SELECT statement.
7459 ** The code generator for compound SELECT statements does one
7460 ** level of recursion for each term. A stack overflow can result
7461 ** if the number of terms is too large. In practice, most SQL
7462 ** never has more than 3 or 4 terms. Use a value of 0 to disable
7463 ** any limit on the number of terms in a compount SELECT.
7464 */
7465 #ifndef SQLITE_MAX_COMPOUND_SELECT
7466 # define SQLITE_MAX_COMPOUND_SELECT 500
7467 #endif
7468
7469 /*
7470 ** The maximum number of opcodes in a VDBE program.
7471 ** Not currently enforced.
7472 */
7473 #ifndef SQLITE_MAX_VDBE_OP
7474 # define SQLITE_MAX_VDBE_OP 25000
7475 #endif
7476
7477 /*
7478 ** The maximum number of arguments to an SQL function.
7479 */
7480 #ifndef SQLITE_MAX_FUNCTION_ARG
7481 # define SQLITE_MAX_FUNCTION_ARG 127
7482 #endif
7483
7484 /*
7485 ** The maximum number of in-memory pages to use for the main database
7486 ** table and for temporary tables. The SQLITE_DEFAULT_CACHE_SIZE
7487 */
7488 #ifndef SQLITE_DEFAULT_CACHE_SIZE
7489 # define SQLITE_DEFAULT_CACHE_SIZE 2000
7490 #endif
7491 #ifndef SQLITE_DEFAULT_TEMP_CACHE_SIZE
7492 # define SQLITE_DEFAULT_TEMP_CACHE_SIZE 500
7493 #endif
7494
7495 /*
7496 ** The default number of frames to accumulate in the log file before
7497 ** checkpointing the database in WAL mode.
7498 */
7499 #ifndef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT
7500 # define SQLITE_DEFAULT_WAL_AUTOCHECKPOINT 1000
7501 #endif
7502
7503 /*
7504 ** The maximum number of attached databases. This must be between 0
7505 ** and 62. The upper bound on 62 is because a 64-bit integer bitmap
7506 ** is used internally to track attached databases.
7507 */
7508 #ifndef SQLITE_MAX_ATTACHED
7509 # define SQLITE_MAX_ATTACHED 10
7510 #endif
7511
7512
7513 /*
7514 ** The maximum value of a ?nnn wildcard that the parser will accept.
7515 */
7516 #ifndef SQLITE_MAX_VARIABLE_NUMBER
7517 # define SQLITE_MAX_VARIABLE_NUMBER 999
7518 #endif
7519
7520 /* Maximum page size. The upper bound on this value is 65536. This a limit
7521 ** imposed by the use of 16-bit offsets within each page.
7522 **
7523 ** Earlier versions of SQLite allowed the user to change this value at
7524 ** compile time. This is no longer permitted, on the grounds that it creates
7525 ** a library that is technically incompatible with an SQLite library
7526 ** compiled with a different limit. If a process operating on a database
7527 ** with a page-size of 65536 bytes crashes, then an instance of SQLite
7528 ** compiled with the default page-size limit will not be able to rollback
7529 ** the aborted transaction. This could lead to database corruption.
7530 */
7531 #ifdef SQLITE_MAX_PAGE_SIZE
7532 # undef SQLITE_MAX_PAGE_SIZE
7533 #endif
7534 #define SQLITE_MAX_PAGE_SIZE 65536
7535
7536
7537 /*
7538 ** The default size of a database page.
7539 */
7540 #ifndef SQLITE_DEFAULT_PAGE_SIZE
7541 # define SQLITE_DEFAULT_PAGE_SIZE 1024
7542 #endif
7543 #if SQLITE_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
7544 # undef SQLITE_DEFAULT_PAGE_SIZE
7545 # define SQLITE_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
7546 #endif
7547
7548 /*
7549 ** Ordinarily, if no value is explicitly provided, SQLite creates databases
7550 ** with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain
7551 ** device characteristics (sector-size and atomic write() support),
7552 ** SQLite may choose a larger value. This constant is the maximum value
7553 ** SQLite will choose on its own.
7554 */
7555 #ifndef SQLITE_MAX_DEFAULT_PAGE_SIZE
7556 # define SQLITE_MAX_DEFAULT_PAGE_SIZE 8192
7557 #endif
7558 #if SQLITE_MAX_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
7559 # undef SQLITE_MAX_DEFAULT_PAGE_SIZE
7560 # define SQLITE_MAX_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
7561 #endif
7562
7563
7564 /*
7565 ** Maximum number of pages in one database file.
7566 **
7567 ** This is really just the default value for the max_page_count pragma.
7568 ** This value can be lowered (or raised) at run-time using that the
7569 ** max_page_count macro.
7570 */
7571 #ifndef SQLITE_MAX_PAGE_COUNT
7572 # define SQLITE_MAX_PAGE_COUNT 1073741823
7573 #endif
7574
7575 /*
7576 ** Maximum length (in bytes) of the pattern in a LIKE or GLOB
7577 ** operator.
7578 */
7579 #ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH
7580 # define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000
7581 #endif
7582
7583 /*
7584 ** Maximum depth of recursion for triggers.
7585 **
7586 ** A value of 1 means that a trigger program will not be able to itself
7587 ** fire any triggers. A value of 0 means that no trigger programs at all
7588 ** may be executed.
7589 */
7590 #ifndef SQLITE_MAX_TRIGGER_DEPTH
7591 # define SQLITE_MAX_TRIGGER_DEPTH 1000
7592 #endif
7593
7594 /************** End of sqliteLimit.h *****************************************/
7595 /************** Continuing where we left off in sqliteInt.h ******************/
7596
7597 /* Disable nuisance warnings on Borland compilers */
7598 #if defined(__BORLANDC__)
7599 #pragma warn -rch /* unreachable code */
7600 #pragma warn -ccc /* Condition is always true or false */
7601 #pragma warn -aus /* Assigned value is never used */
7602 #pragma warn -csu /* Comparing signed and unsigned */
7603 #pragma warn -spa /* Suspicious pointer arithmetic */
7604 #endif
7605
7606 /* Needed for various definitions... */
7607 #ifndef _GNU_SOURCE
7608 # define _GNU_SOURCE
7609 #endif
7610
7611 #if defined(__OpenBSD__) && !defined(_BSD_SOURCE)
7612 # define _BSD_SOURCE
7613 #endif
7614
7615 /*
7616 ** Include standard header files as necessary
7617 */
7618 #ifdef HAVE_STDINT_H
7619 #include <stdint.h>
7620 #endif
7621 #ifdef HAVE_INTTYPES_H
7622 #include <inttypes.h>
7623 #endif
7624
7625 /*
7626 ** The following macros are used to cast pointers to integers and
7627 ** integers to pointers. The way you do this varies from one compiler
7628 ** to the next, so we have developed the following set of #if statements
7629 ** to generate appropriate macros for a wide range of compilers.
7630 **
7631 ** The correct "ANSI" way to do this is to use the intptr_t type.
7632 ** Unfortunately, that typedef is not available on all compilers, or
7633 ** if it is available, it requires an #include of specific headers
7634 ** that vary from one machine to the next.
7635 **
7636 ** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on
7637 ** the ((void*)&((char*)0)[X]) construct. But MSVC chokes on ((void*)(X)).
7638 ** So we have to define the macros in different ways depending on the
7639 ** compiler.
7640 */
7641 #if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */
7642 # define SQLITE_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X))
7643 # define SQLITE_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X))
7644 #elif !defined(__GNUC__) /* Works for compilers other than LLVM */
7645 # define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X])
7646 # define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0))
7647 #elif defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */
7648 # define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X))
7649 # define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X))
7650 #else /* Generates a warning - but it always works */
7651 # define SQLITE_INT_TO_PTR(X) ((void*)(X))
7652 # define SQLITE_PTR_TO_INT(X) ((int)(X))
7653 #endif
7654
7655 /*
7656 ** The SQLITE_THREADSAFE macro must be defined as 0, 1, or 2.
7657 ** 0 means mutexes are permanently disable and the library is never
7658 ** threadsafe. 1 means the library is serialized which is the highest
7659 ** level of threadsafety. 2 means the library is multithreaded - multiple
7660 ** threads can use SQLite as long as no two threads try to use the same
7661 ** database connection at the same time.
7662 **
7663 ** Older versions of SQLite used an optional THREADSAFE macro.
7664 ** We support that for legacy.
7665 */
7666 #if !defined(SQLITE_THREADSAFE)
7667 # if defined(THREADSAFE)
7668 # define SQLITE_THREADSAFE THREADSAFE
7669 # else
7670 # define SQLITE_THREADSAFE 1 /* IMP: R-07272-22309 */
7671 # endif
7672 #endif
7673
7674 /*
7675 ** Powersafe overwrite is on by default. But can be turned off using
7676 ** the -DSQLITE_POWERSAFE_OVERWRITE=0 command-line option.
7677 */
7678 #ifndef SQLITE_POWERSAFE_OVERWRITE
7679 # define SQLITE_POWERSAFE_OVERWRITE 1
7680 #endif
7681
7682 /*
7683 ** The SQLITE_DEFAULT_MEMSTATUS macro must be defined as either 0 or 1.
7684 ** It determines whether or not the features related to
7685 ** SQLITE_CONFIG_MEMSTATUS are available by default or not. This value can
7686 ** be overridden at runtime using the sqlite3_config() API.
7687 */
7688 #if !defined(SQLITE_DEFAULT_MEMSTATUS)
7689 # define SQLITE_DEFAULT_MEMSTATUS 1
7690 #endif
7691
7692 /*
7693 ** Exactly one of the following macros must be defined in order to
7694 ** specify which memory allocation subsystem to use.
7695 **
7696 ** SQLITE_SYSTEM_MALLOC // Use normal system malloc()
7697 ** SQLITE_WIN32_MALLOC // Use Win32 native heap API
7698 ** SQLITE_ZERO_MALLOC // Use a stub allocator that always fails
7699 ** SQLITE_MEMDEBUG // Debugging version of system malloc()
7700 **
7701 ** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the
7702 ** assert() macro is enabled, each call into the Win32 native heap subsystem
7703 ** will cause HeapValidate to be called. If heap validation should fail, an
7704 ** assertion will be triggered.
7705 **
7706 ** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as
7707 ** the default.
7708 */
7709 #if defined(SQLITE_SYSTEM_MALLOC) \
7710 + defined(SQLITE_WIN32_MALLOC) \
7711 + defined(SQLITE_ZERO_MALLOC) \
7712 + defined(SQLITE_MEMDEBUG)>1
7713 # error "Two or more of the following compile-time configuration options\
7714 are defined but at most one is allowed:\
7715 SQLITE_SYSTEM_MALLOC, SQLITE_WIN32_MALLOC, SQLITE_MEMDEBUG,\
7716 SQLITE_ZERO_MALLOC"
7717 #endif
7718 #if defined(SQLITE_SYSTEM_MALLOC) \
7719 + defined(SQLITE_WIN32_MALLOC) \
7720 + defined(SQLITE_ZERO_MALLOC) \
7721 + defined(SQLITE_MEMDEBUG)==0
7722 # define SQLITE_SYSTEM_MALLOC 1
7723 #endif
7724
7725 /*
7726 ** If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the
7727 ** sizes of memory allocations below this value where possible.
7728 */
7729 #if !defined(SQLITE_MALLOC_SOFT_LIMIT)
7730 # define SQLITE_MALLOC_SOFT_LIMIT 1024
7731 #endif
7732
7733 /*
7734 ** We need to define _XOPEN_SOURCE as follows in order to enable
7735 ** recursive mutexes on most Unix systems and fchmod() on OpenBSD.
7736 ** But _XOPEN_SOURCE define causes problems for Mac OS X, so omit
7737 ** it.
7738 */
7739 #if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__)
7740 # define _XOPEN_SOURCE 600
7741 #endif
7742
7743 /*
7744 ** NDEBUG and SQLITE_DEBUG are opposites. It should always be true that
7745 ** defined(NDEBUG)==!defined(SQLITE_DEBUG). If this is not currently true,
7746 ** make it true by defining or undefining NDEBUG.
7747 **
7748 ** Setting NDEBUG makes the code smaller and faster by disabling the
7749 ** assert() statements in the code. So we want the default action
7750 ** to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG
7751 ** is set. Thus NDEBUG becomes an opt-in rather than an opt-out
7752 ** feature.
7753 */
7754 #if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
7755 # define NDEBUG 1
7756 #endif
7757 #if defined(NDEBUG) && defined(SQLITE_DEBUG)
7758 # undef NDEBUG
7759 #endif
7760
7761 /*
7762 ** The testcase() macro is used to aid in coverage testing. When
7763 ** doing coverage testing, the condition inside the argument to
7764 ** testcase() must be evaluated both true and false in order to
7765 ** get full branch coverage. The testcase() macro is inserted
7766 ** to help ensure adequate test coverage in places where simple
7767 ** condition/decision coverage is inadequate. For example, testcase()
7768 ** can be used to make sure boundary values are tested. For
7769 ** bitmask tests, testcase() can be used to make sure each bit
7770 ** is significant and used at least once. On switch statements
7771 ** where multiple cases go to the same block of code, testcase()
7772 ** can insure that all cases are evaluated.
7773 **
7774 */
7775 #ifdef SQLITE_COVERAGE_TEST
7776 SQLITE_PRIVATE void sqlite3Coverage(int);
7777 # define testcase(X) if( X ){ sqlite3Coverage(__LINE__); }
7778 #else
7779 # define testcase(X)
7780 #endif
7781
7782 /*
7783 ** The TESTONLY macro is used to enclose variable declarations or
7784 ** other bits of code that are needed to support the arguments
7785 ** within testcase() and assert() macros.
7786 */
7787 #if !defined(NDEBUG) || defined(SQLITE_COVERAGE_TEST)
7788 # define TESTONLY(X) X
7789 #else
7790 # define TESTONLY(X)
7791 #endif
7792
7793 /*
7794 ** Sometimes we need a small amount of code such as a variable initialization
7795 ** to setup for a later assert() statement. We do not want this code to
7796 ** appear when assert() is disabled. The following macro is therefore
7797 ** used to contain that setup code. The "VVA" acronym stands for
7798 ** "Verification, Validation, and Accreditation". In other words, the
7799 ** code within VVA_ONLY() will only run during verification processes.
7800 */
7801 #ifndef NDEBUG
7802 # define VVA_ONLY(X) X
7803 #else
7804 # define VVA_ONLY(X)
7805 #endif
7806
7807 /*
7808 ** The ALWAYS and NEVER macros surround boolean expressions which
7809 ** are intended to always be true or false, respectively. Such
7810 ** expressions could be omitted from the code completely. But they
7811 ** are included in a few cases in order to enhance the resilience
7812 ** of SQLite to unexpected behavior - to make the code "self-healing"
7813 ** or "ductile" rather than being "brittle" and crashing at the first
7814 ** hint of unplanned behavior.
7815 **
7816 ** In other words, ALWAYS and NEVER are added for defensive code.
7817 **
7818 ** When doing coverage testing ALWAYS and NEVER are hard-coded to
7819 ** be true and false so that the unreachable code they specify will
7820 ** not be counted as untested code.
7821 */
7822 #if defined(SQLITE_COVERAGE_TEST)
7823 # define ALWAYS(X) (1)
7824 # define NEVER(X) (0)
7825 #elif !defined(NDEBUG)
7826 # define ALWAYS(X) ((X)?1:(assert(0),0))
7827 # define NEVER(X) ((X)?(assert(0),1):0)
7828 #else
7829 # define ALWAYS(X) (X)
7830 # define NEVER(X) (X)
7831 #endif
7832
7833 /*
7834 ** Return true (non-zero) if the input is a integer that is too large
7835 ** to fit in 32-bits. This macro is used inside of various testcase()
7836 ** macros to verify that we have tested SQLite for large-file support.
7837 */
7838 #define IS_BIG_INT(X) (((X)&~(i64)0xffffffff)!=0)
7839
7840 /*
7841 ** The macro unlikely() is a hint that surrounds a boolean
7842 ** expression that is usually false. Macro likely() surrounds
7843 ** a boolean expression that is usually true. These hints could,
7844 ** in theory, be used by the compiler to generate better code, but
7845 ** currently they are just comments for human readers.
7846 */
7847 #define likely(X) (X)
7848 #define unlikely(X) (X)
7849
7850 /************** Include hash.h in the middle of sqliteInt.h ******************/
7851 /************** Begin file hash.h ********************************************/
7852 /*
7853 ** 2001 September 22
7854 **
@@ -31494,11 +31492,11 @@
31492 #endif
31493
31494 #define osGetVersionExA ((BOOL(WINAPI*)( \
31495 LPOSVERSIONINFOA))aSyscall[34].pCurrent)
31496
31497 #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
31498 { "GetVersionExW", (SYSCALL)GetVersionExW, 0 },
31499 #else
31500 { "GetVersionExW", (SYSCALL)0, 0 },
31501 #endif
31502
31503
+1 -1
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107107
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108108
** [sqlite_version()] and [sqlite_source_id()].
109109
*/
110110
#define SQLITE_VERSION "3.8.1"
111111
#define SQLITE_VERSION_NUMBER 3008001
112
-#define SQLITE_SOURCE_ID "2013-10-10 15:04:52 af7abebeb1f70466833bc766d294d721eaef746f"
112
+#define SQLITE_SOURCE_ID "2013-10-11 13:27:26 03593817ab5abdd4bbaa5e47e2e4745eef025af9"
113113
114114
/*
115115
** CAPI3REF: Run-Time Library Version Numbers
116116
** KEYWORDS: sqlite3_version, sqlite3_sourceid
117117
**
118118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.8.1"
111 #define SQLITE_VERSION_NUMBER 3008001
112 #define SQLITE_SOURCE_ID "2013-10-10 15:04:52 af7abebeb1f70466833bc766d294d721eaef746f"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.8.1"
111 #define SQLITE_VERSION_NUMBER 3008001
112 #define SQLITE_SOURCE_ID "2013-10-11 13:27:26 03593817ab5abdd4bbaa5e47e2e4745eef025af9"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button