Fossil SCM

Update SQLite to fix the OR-clause query optimizer bug. That bug is probably harmless to SQLite, but it doesn't hurt to check in the fix.

drh 2009-01-14 01:09 trunk
Commit 037cae8ff699ce222b5338a66e197cf40e02ab1e
1 file changed +482 -424
+482 -424
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -15,11 +15,11 @@
1515
** needed if you want a wrapper to interface SQLite with your choice of
1616
** programming language. The code for the "sqlite3" command-line shell
1717
** is also in a separate file. This file contains only code for the core
1818
** SQLite library.
1919
**
20
-** This amalgamation was generated on 2009-01-10 13:14:08 UTC.
20
+** This amalgamation was generated on 2009-01-14 00:59:32 UTC.
2121
*/
2222
#define SQLITE_CORE 1
2323
#define SQLITE_AMALGAMATION 1
2424
#ifndef SQLITE_PRIVATE
2525
# define SQLITE_PRIVATE static
@@ -39,11 +39,11 @@
3939
** May you share freely, never taking more than you give.
4040
**
4141
*************************************************************************
4242
** Internal interface definitions for SQLite.
4343
**
44
-** @(#) $Id: sqliteInt.h,v 1.821 2009/01/09 14:11:05 drh Exp $
44
+** @(#) $Id: sqliteInt.h,v 1.823 2009/01/10 16:15:22 drh Exp $
4545
*/
4646
#ifndef _SQLITEINT_H_
4747
#define _SQLITEINT_H_
4848
4949
/*
@@ -68,11 +68,11 @@
6868
**
6969
*************************************************************************
7070
**
7171
** This file defines various limits of what SQLite can process.
7272
**
73
-** @(#) $Id: sqliteLimit.h,v 1.9 2009/01/07 16:15:43 danielk1977 Exp $
73
+** @(#) $Id: sqliteLimit.h,v 1.10 2009/01/10 16:15:09 danielk1977 Exp $
7474
*/
7575
7676
/*
7777
** The maximum length of a TEXT or BLOB in bytes. This also
7878
** limits the size of a row in a table or index.
@@ -186,10 +186,17 @@
186186
#endif
187187
188188
/* Maximum page size. The upper bound on this value is 32768. This a limit
189189
** imposed by the necessity of storing the value in a 2-byte unsigned integer
190190
** and the fact that the page size must be a power of 2.
191
+**
192
+** If this limit is changed, then the compiled library is technically
193
+** incompatible with an SQLite library compiled with a different limit. If
194
+** a process operating on a database with a page-size of 65536 bytes
195
+** crashes, then an instance of SQLite compiled with the default page-size
196
+** limit will not be able to rollback the aborted transaction. This could
197
+** lead to database corruption.
191198
*/
192199
#ifndef SQLITE_MAX_PAGE_SIZE
193200
# define SQLITE_MAX_PAGE_SIZE 32768
194201
#endif
195202
@@ -265,61 +272,10 @@
265272
#endif
266273
#ifdef HAVE_INTTYPES_H
267274
#include <inttypes.h>
268275
#endif
269276
270
-/*
271
-** A macro used to aid in coverage testing. When doing coverage
272
-** testing, the condition inside the argument must be evaluated
273
-** both true and false in order to get full branch coverage.
274
-** This macro can be inserted to ensure adequate test coverage
275
-** in places where simple condition/decision coverage is inadequate.
276
-*/
277
-#ifdef SQLITE_COVERAGE_TEST
278
-SQLITE_PRIVATE void sqlite3Coverage(int);
279
-# define testcase(X) if( X ){ sqlite3Coverage(__LINE__); }
280
-# define TESTONLY(X) X
281
-#else
282
-# define testcase(X)
283
-# define TESTONLY(X)
284
-#endif
285
-
286
-/*
287
-** The ALWAYS and NEVER macros surround boolean expressions which
288
-** are intended to always be true or false, respectively. Such
289
-** expressions could be omitted from the code completely. But they
290
-** are included in a few cases in order to enhance the resilience
291
-** of SQLite to unexpected behavior - to make the code "self-healing"
292
-** or "ductile" rather than being "brittle" and crashing at the first
293
-** hint of unplanned behavior.
294
-**
295
-** When doing coverage testing ALWAYS and NEVER are hard-coded to
296
-** be true and false so that the unreachable code then specify will
297
-** not be counted as untested code.
298
-*/
299
-#ifdef SQLITE_COVERAGE_TEST
300
-# define ALWAYS(X) (1)
301
-# define NEVER(X) (0)
302
-#else
303
-# define ALWAYS(X) (X)
304
-# define NEVER(X) (X)
305
-#endif
306
-
307
-/*
308
-** The macro unlikely() is a hint that surrounds a boolean
309
-** expression that is usually false. Macro likely() surrounds
310
-** a boolean expression that is usually true. GCC is able to
311
-** use these hints to generate better code, sometimes.
312
-*/
313
-#if defined(__GNUC__) && 0
314
-# define likely(X) __builtin_expect((X),1)
315
-# define unlikely(X) __builtin_expect((X),0)
316
-#else
317
-# define likely(X) !!(X)
318
-# define unlikely(X) !!(X)
319
-#endif
320
-
321277
/*
322278
* This macro is used to "hide" some ugliness in casting an int
323279
* value to a ptr value under the MSVC 64-bit compiler. Casting
324280
* non 64-bit values to ptr types results in a "hard" error with
325281
* the MSVC 64-bit compiler which this attempts to avoid.
@@ -453,10 +409,77 @@
453409
*/
454410
#if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
455411
# define NDEBUG 1
456412
#endif
457413
414
+/*
415
+** The testcase() macro is used to aid in coverage testing. When
416
+** doing coverage testing, the condition inside the argument to
417
+** testcase() must be evaluated both true and false in order to
418
+** get full branch coverage. The testcase() macro is inserted
419
+** to help ensure adequate test coverage in places where simple
420
+** condition/decision coverage is inadequate. For example, testcase()
421
+** can be used to make sure boundary values are tested. For
422
+** bitmask tests, testcase() can be used to make sure each bit
423
+** is significant and used at least once. On switch statements
424
+** where multiple cases go to the same block of code, testcase()
425
+** can insure that all cases are evaluated.
426
+**
427
+** The TESTONLY macro is used to enclose variable declarations or
428
+** other bits of code that are needed to support the arguments
429
+** within testcase() macros.
430
+*/
431
+#ifdef SQLITE_COVERAGE_TEST
432
+SQLITE_PRIVATE void sqlite3Coverage(int);
433
+# define testcase(X) if( X ){ sqlite3Coverage(__LINE__); }
434
+# define TESTONLY(X) X
435
+#else
436
+# define testcase(X)
437
+# define TESTONLY(X)
438
+#endif
439
+
440
+/*
441
+** The ALWAYS and NEVER macros surround boolean expressions which
442
+** are intended to always be true or false, respectively. Such
443
+** expressions could be omitted from the code completely. But they
444
+** are included in a few cases in order to enhance the resilience
445
+** of SQLite to unexpected behavior - to make the code "self-healing"
446
+** or "ductile" rather than being "brittle" and crashing at the first
447
+** hint of unplanned behavior.
448
+**
449
+** In other words, ALWAYS and NEVER are added for defensive code.
450
+**
451
+** When doing coverage testing ALWAYS and NEVER are hard-coded to
452
+** be true and false so that the unreachable code then specify will
453
+** not be counted as untested code.
454
+*/
455
+#if defined(SQLITE_COVERAGE_TEST)
456
+# define ALWAYS(X) (1)
457
+# define NEVER(X) (0)
458
+#elif !defined(NDEBUG)
459
+SQLITE_PRIVATE int sqlite3Assert(void);
460
+# define ALWAYS(X) ((X)?1:sqlite3Assert())
461
+# define NEVER(X) ((X)?sqlite3Assert():0)
462
+#else
463
+# define ALWAYS(X) (X)
464
+# define NEVER(X) (X)
465
+#endif
466
+
467
+/*
468
+** The macro unlikely() is a hint that surrounds a boolean
469
+** expression that is usually false. Macro likely() surrounds
470
+** a boolean expression that is usually true. GCC is able to
471
+** use these hints to generate better code, sometimes.
472
+*/
473
+#if defined(__GNUC__) && 0
474
+# define likely(X) __builtin_expect((X),1)
475
+# define unlikely(X) __builtin_expect((X),0)
476
+#else
477
+# define likely(X) !!(X)
478
+# define unlikely(X) !!(X)
479
+#endif
480
+
458481
/*
459482
** Sometimes we need a small amount of code such as a variable initialization
460483
** to setup for a later assert() statement. We do not want this code to
461484
** appear when assert() is disabled. The following macro is therefore
462485
** used to contain that setup code. The "VVA" acronym stands for
@@ -8144,146 +8167,146 @@
81448167
*/
81458168
/************** Include opcodes.h in the middle of vdbe.h ********************/
81468169
/************** Begin file opcodes.h *****************************************/
81478170
/* Automatically generated. Do not edit */
81488171
/* See the mkopcodeh.awk script for details */
8149
-#define OP_VCreate 1
8150
-#define OP_MemMax 2
8151
-#define OP_LoadAnalysis 3
8152
-#define OP_RowData 4
8153
-#define OP_CreateIndex 5
8154
-#define OP_Variable 6
8155
-#define OP_SeekGt 7
8156
-#define OP_SeekLe 8
8157
-#define OP_IfNeg 9
8158
-#define OP_Clear 10
8159
-#define OP_Last 11
8160
-#define OP_Add 81 /* same as TK_PLUS */
8161
-#define OP_Savepoint 12
8162
-#define OP_Sequence 13
8163
-#define OP_Int64 14
8164
-#define OP_VBegin 15
8165
-#define OP_RowKey 16
8166
-#define OP_Divide 84 /* same as TK_SLASH */
8167
-#define OP_SCopy 17
8168
-#define OP_ResetCount 18
8169
-#define OP_Delete 20
8170
-#define OP_Trace 21
8171
-#define OP_Rowid 22
8172
-#define OP_OpenRead 23
8173
-#define OP_Sort 24
8174
-#define OP_VerifyCookie 25
8175
-#define OP_VColumn 26
8176
-#define OP_Next 27
8177
-#define OP_Insert 28
8178
-#define OP_Prev 29
8179
-#define OP_IdxGE 30
8180
-#define OP_Not 19 /* same as TK_NOT */
8172
+#define OP_VNext 1
8173
+#define OP_Affinity 2
8174
+#define OP_Column 3
8175
+#define OP_SetCookie 4
8176
+#define OP_Seek 5
8177
+#define OP_Real 129 /* same as TK_FLOAT */
8178
+#define OP_Sequence 6
8179
+#define OP_Savepoint 7
81818180
#define OP_Ge 75 /* same as TK_GE */
8181
+#define OP_RowKey 8
8182
+#define OP_SCopy 9
8183
+#define OP_Eq 71 /* same as TK_EQ */
8184
+#define OP_OpenWrite 10
8185
+#define OP_NotNull 69 /* same as TK_NOTNULL */
8186
+#define OP_If 11
8187
+#define OP_ToInt 144 /* same as TK_TO_INT */
8188
+#define OP_String8 91 /* same as TK_STRING */
8189
+#define OP_VRowid 12
8190
+#define OP_CollSeq 13
8191
+#define OP_OpenRead 14
8192
+#define OP_Expire 15
8193
+#define OP_AutoCommit 16
8194
+#define OP_Gt 72 /* same as TK_GT */
8195
+#define OP_Pagecount 17
8196
+#define OP_IntegrityCk 18
8197
+#define OP_Sort 20
8198
+#define OP_Copy 21
8199
+#define OP_Trace 22
8200
+#define OP_Function 23
8201
+#define OP_IfNeg 24
8202
+#define OP_And 64 /* same as TK_AND */
8203
+#define OP_Subtract 82 /* same as TK_MINUS */
8204
+#define OP_Noop 25
8205
+#define OP_Return 26
8206
+#define OP_Remainder 85 /* same as TK_REM */
8207
+#define OP_NewRowid 27
8208
+#define OP_Multiply 83 /* same as TK_STAR */
8209
+#define OP_Variable 28
8210
+#define OP_String 29
8211
+#define OP_RealAffinity 30
81828212
#define OP_VRename 31
8183
-#define OP_DropTable 32
8184
-#define OP_MakeRecord 33
8185
-#define OP_Null 34
8186
-#define OP_IdxInsert 35
8187
-#define OP_SeekLt 36
8188
-#define OP_ReadCookie 37
8189
-#define OP_VDestroy 38
8190
-#define OP_DropIndex 39
8191
-#define OP_IsNull 68 /* same as TK_ISNULL */
8192
-#define OP_MustBeInt 40
8193
-#define OP_IntegrityCk 41
8194
-#define OP_CollSeq 42
8195
-#define OP_ResultRow 43
8196
-#define OP_Yield 44
8197
-#define OP_OpenEphemeral 45
8198
-#define OP_VNext 46
8199
-#define OP_Seek 47
8200
-#define OP_Eq 71 /* same as TK_EQ */
8201
-#define OP_String8 91 /* same as TK_STRING */
8202
-#define OP_Found 48
8203
-#define OP_If 49
8204
-#define OP_ToBlob 142 /* same as TK_TO_BLOB */
8205
-#define OP_Multiply 83 /* same as TK_STAR */
8206
-#define OP_IfZero 50
8207
-#define OP_ShiftRight 80 /* same as TK_RSHIFT */
8208
-#define OP_Goto 51
8209
-#define OP_Function 52
8210
-#define OP_Copy 53
8211
-#define OP_Jump 54
8212
-#define OP_Blob 55
8213
-#define OP_BitNot 90 /* same as TK_BITNOT */
8214
-#define OP_Gt 72 /* same as TK_GT */
8215
-#define OP_Le 73 /* same as TK_LE */
8216
-#define OP_NullRow 56
8217
-#define OP_Transaction 57
8218
-#define OP_VUpdate 58
8219
-#define OP_TableLock 59
8220
-#define OP_IdxRowid 60
8221
-#define OP_SetCookie 61
8222
-#define OP_And 64 /* same as TK_AND */
8213
+#define OP_ParseSchema 32
8214
+#define OP_VOpen 33
8215
+#define OP_Close 34
8216
+#define OP_CreateIndex 35
8217
+#define OP_IsUnique 36
8218
+#define OP_NotFound 37
8219
+#define OP_Int64 38
8220
+#define OP_MustBeInt 39
8221
+#define OP_Halt 40
8222
+#define OP_Rowid 41
8223
+#define OP_IdxLT 42
8224
+#define OP_AddImm 43
8225
+#define OP_Statement 44
8226
+#define OP_RowData 45
8227
+#define OP_MemMax 46
8228
+#define OP_Or 63 /* same as TK_OR */
8229
+#define OP_NotExists 47
8230
+#define OP_Gosub 48
8231
+#define OP_Divide 84 /* same as TK_SLASH */
8232
+#define OP_Integer 49
82238233
#define OP_ToNumeric 143 /* same as TK_TO_NUMERIC*/
8224
-#define OP_ToText 141 /* same as TK_TO_TEXT */
8225
-#define OP_ContextPush 62
8226
-#define OP_DropTrigger 65
8227
-#define OP_AutoCommit 66
8228
-#define OP_Column 67
8229
-#define OP_AddImm 76
8230
-#define OP_Remainder 85 /* same as TK_REM */
8231
-#define OP_ContextPop 87
8232
-#define OP_IdxDelete 88
8233
-#define OP_Ne 70 /* same as TK_NE */
8234
-#define OP_ToInt 144 /* same as TK_TO_INT */
8235
-#define OP_IncrVacuum 89
8236
-#define OP_AggFinal 92
8237
-#define OP_RealAffinity 93
8234
+#define OP_Prev 50
8235
+#define OP_RowSetRead 51
82388236
#define OP_Concat 86 /* same as TK_CONCAT */
8239
-#define OP_Return 94
8240
-#define OP_Expire 95
8241
-#define OP_Rewind 96
8242
-#define OP_Statement 97
8243
-#define OP_BitOr 78 /* same as TK_BITOR */
8244
-#define OP_Integer 98
8245
-#define OP_Compare 99
8246
-#define OP_Destroy 100
8247
-#define OP_IdxLT 101
8248
-#define OP_Affinity 102
8249
-#define OP_Lt 74 /* same as TK_LT */
8250
-#define OP_Subtract 82 /* same as TK_MINUS */
8251
-#define OP_Vacuum 103
8252
-#define OP_IfNot 104
8253
-#define OP_Move 105
8254
-#define OP_Explain 106
8255
-#define OP_ParseSchema 107
8256
-#define OP_NewRowid 108
8257
-#define OP_SetNumColumns 109
8237
+#define OP_RowSetAdd 52
82588238
#define OP_BitAnd 77 /* same as TK_BITAND */
8259
-#define OP_String 110
8260
-#define OP_AggStep 111
8261
-#define OP_VRowid 112
8262
-#define OP_VOpen 113
8263
-#define OP_NotExists 114
8264
-#define OP_Close 115
8265
-#define OP_Halt 116
8266
-#define OP_Noop 117
8267
-#define OP_SeekGe 118
8268
-#define OP_VFilter 119
8269
-#define OP_OpenPseudo 120
8270
-#define OP_Or 63 /* same as TK_OR */
8239
+#define OP_VColumn 53
8240
+#define OP_CreateTable 54
8241
+#define OP_Last 55
8242
+#define OP_SeekLe 56
8243
+#define OP_IsNull 68 /* same as TK_ISNULL */
8244
+#define OP_IncrVacuum 57
8245
+#define OP_IdxRowid 58
8246
+#define OP_ShiftRight 80 /* same as TK_RSHIFT */
8247
+#define OP_ResetCount 59
8248
+#define OP_ContextPush 60
8249
+#define OP_Yield 61
8250
+#define OP_DropTrigger 62
8251
+#define OP_DropIndex 65
8252
+#define OP_IdxGE 66
8253
+#define OP_IdxDelete 67
8254
+#define OP_Vacuum 76
8255
+#define OP_IfNot 87
8256
+#define OP_DropTable 88
8257
+#define OP_SeekLt 89
8258
+#define OP_MakeRecord 92
8259
+#define OP_ToBlob 142 /* same as TK_TO_BLOB */
8260
+#define OP_ResultRow 93
8261
+#define OP_Delete 94
8262
+#define OP_AggFinal 95
8263
+#define OP_Compare 96
82718264
#define OP_ShiftLeft 79 /* same as TK_LSHIFT */
8265
+#define OP_Goto 97
8266
+#define OP_TableLock 98
8267
+#define OP_Clear 99
8268
+#define OP_Le 73 /* same as TK_LE */
8269
+#define OP_VerifyCookie 100
8270
+#define OP_AggStep 101
8271
+#define OP_ToText 141 /* same as TK_TO_TEXT */
8272
+#define OP_Not 19 /* same as TK_NOT */
82728273
#define OP_ToReal 145 /* same as TK_TO_REAL */
8273
-#define OP_RowSetRead 121
8274
-#define OP_RowSetAdd 122
8275
-#define OP_IsUnique 123
8276
-#define OP_OpenWrite 124
8277
-#define OP_Permutation 125
8278
-#define OP_Gosub 126
8274
+#define OP_SetNumColumns 102
8275
+#define OP_Transaction 103
8276
+#define OP_VFilter 104
8277
+#define OP_Ne 70 /* same as TK_NE */
8278
+#define OP_VDestroy 105
8279
+#define OP_ContextPop 106
8280
+#define OP_BitOr 78 /* same as TK_BITOR */
8281
+#define OP_Next 107
8282
+#define OP_IdxInsert 108
8283
+#define OP_Lt 74 /* same as TK_LT */
8284
+#define OP_SeekGe 109
8285
+#define OP_Insert 110
8286
+#define OP_Destroy 111
8287
+#define OP_ReadCookie 112
8288
+#define OP_LoadAnalysis 113
8289
+#define OP_Explain 114
8290
+#define OP_OpenPseudo 115
8291
+#define OP_OpenEphemeral 116
8292
+#define OP_Null 117
8293
+#define OP_Move 118
8294
+#define OP_Blob 119
8295
+#define OP_Add 81 /* same as TK_PLUS */
8296
+#define OP_Rewind 120
8297
+#define OP_SeekGt 121
8298
+#define OP_VBegin 122
8299
+#define OP_VUpdate 123
8300
+#define OP_IfZero 124
8301
+#define OP_BitNot 90 /* same as TK_BITNOT */
8302
+#define OP_VCreate 125
8303
+#define OP_Found 126
82798304
#define OP_IfPos 127
8280
-#define OP_Real 129 /* same as TK_FLOAT */
8281
-#define OP_NotNull 69 /* same as TK_NOTNULL */
8282
-#define OP_Pagecount 128
8283
-#define OP_NotFound 130
8284
-#define OP_CreateTable 131
8305
+#define OP_NullRow 128
8306
+#define OP_Jump 130
8307
+#define OP_Permutation 131
82858308
82868309
/* The following opcode values are never used */
82878310
#define OP_NotUsed_132 132
82888311
#define OP_NotUsed_133 133
82898312
#define OP_NotUsed_134 134
@@ -8304,27 +8327,27 @@
83048327
#define OPFLG_IN1 0x0004 /* in1: P1 is an input */
83058328
#define OPFLG_IN2 0x0008 /* in2: P2 is an input */
83068329
#define OPFLG_IN3 0x0010 /* in3: P3 is an input */
83078330
#define OPFLG_OUT3 0x0020 /* out3: P3 is an output */
83088331
#define OPFLG_INITIALIZER {\
8309
-/* 0 */ 0x00, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x11,\
8310
-/* 8 */ 0x11, 0x05, 0x00, 0x01, 0x00, 0x02, 0x02, 0x00,\
8311
-/* 16 */ 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x02, 0x00,\
8312
-/* 24 */ 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x11, 0x00,\
8313
-/* 32 */ 0x00, 0x00, 0x02, 0x08, 0x11, 0x02, 0x00, 0x00,\
8314
-/* 40 */ 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x08,\
8315
-/* 48 */ 0x11, 0x05, 0x05, 0x01, 0x00, 0x04, 0x01, 0x02,\
8316
-/* 56 */ 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x2c,\
8317
-/* 64 */ 0x2c, 0x00, 0x00, 0x00, 0x05, 0x05, 0x15, 0x15,\
8318
-/* 72 */ 0x15, 0x15, 0x15, 0x15, 0x04, 0x2c, 0x2c, 0x2c,\
8319
-/* 80 */ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x00,\
8320
-/* 88 */ 0x00, 0x01, 0x04, 0x02, 0x00, 0x04, 0x04, 0x00,\
8321
-/* 96 */ 0x01, 0x00, 0x02, 0x00, 0x02, 0x11, 0x00, 0x00,\
8322
-/* 104 */ 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00,\
8323
-/* 112 */ 0x02, 0x00, 0x11, 0x00, 0x00, 0x00, 0x11, 0x01,\
8324
-/* 120 */ 0x00, 0x21, 0x08, 0x11, 0x00, 0x00, 0x01, 0x05,\
8325
-/* 128 */ 0x02, 0x02, 0x11, 0x02, 0x00, 0x00, 0x00, 0x00,\
8332
+/* 0 */ 0x00, 0x01, 0x00, 0x00, 0x10, 0x08, 0x02, 0x00,\
8333
+/* 8 */ 0x00, 0x04, 0x00, 0x05, 0x02, 0x00, 0x00, 0x00,\
8334
+/* 16 */ 0x00, 0x02, 0x00, 0x04, 0x01, 0x04, 0x00, 0x00,\
8335
+/* 24 */ 0x05, 0x00, 0x04, 0x02, 0x02, 0x02, 0x04, 0x00,\
8336
+/* 32 */ 0x00, 0x00, 0x00, 0x02, 0x11, 0x11, 0x02, 0x05,\
8337
+/* 40 */ 0x00, 0x02, 0x11, 0x04, 0x00, 0x00, 0x0c, 0x11,\
8338
+/* 48 */ 0x01, 0x02, 0x01, 0x21, 0x08, 0x00, 0x02, 0x01,\
8339
+/* 56 */ 0x11, 0x01, 0x02, 0x00, 0x00, 0x04, 0x00, 0x2c,\
8340
+/* 64 */ 0x2c, 0x00, 0x11, 0x00, 0x05, 0x05, 0x15, 0x15,\
8341
+/* 72 */ 0x15, 0x15, 0x15, 0x15, 0x00, 0x2c, 0x2c, 0x2c,\
8342
+/* 80 */ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x05,\
8343
+/* 88 */ 0x00, 0x11, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00,\
8344
+/* 96 */ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
8345
+/* 104 */ 0x01, 0x00, 0x00, 0x01, 0x08, 0x11, 0x00, 0x02,\
8346
+/* 112 */ 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02,\
8347
+/* 120 */ 0x01, 0x11, 0x00, 0x00, 0x05, 0x00, 0x11, 0x05,\
8348
+/* 128 */ 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,\
83268349
/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04,\
83278350
/* 144 */ 0x04, 0x04,}
83288351
83298352
/************** End of opcodes.h *********************************************/
83308353
/************** Continuing where we left off in vdbe.h ***********************/
@@ -9357,10 +9380,11 @@
93579380
*/
93589381
#define SQLITE_FUNC_LIKE 0x01 /* Candidate for the LIKE optimization */
93599382
#define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */
93609383
#define SQLITE_FUNC_EPHEM 0x04 /* Ephemeral. Delete with VDBE */
93619384
#define SQLITE_FUNC_NEEDCOLL 0x08 /* sqlite3GetFuncCollSeq() might be called */
9385
+#define SQLITE_FUNC_PRIVATE 0x10 /* Allowed for internal use only */
93629386
93639387
/*
93649388
** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are
93659389
** used to create the initializers for the FuncDef structures.
93669390
**
@@ -10782,11 +10806,11 @@
1078210806
SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int, int);
1078310807
SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse*, int, int, int);
1078410808
SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, int, int, int);
1078510809
SQLITE_PRIVATE void sqlite3ExprClearColumnCache(Parse*, int);
1078610810
SQLITE_PRIVATE void sqlite3ExprCacheAffinityChange(Parse*, int, int);
10787
-SQLITE_PRIVATE int sqlite3ExprWritableRegister(Parse*,int,int);
10811
+SQLITE_PRIVATE void sqlite3ExprWritableRegister(Parse*,int);
1078810812
SQLITE_PRIVATE void sqlite3ExprHardCopy(Parse*,int,int);
1078910813
SQLITE_PRIVATE int sqlite3ExprCode(Parse*, Expr*, int);
1079010814
SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*);
1079110815
SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse*, Expr*, int);
1079210816
SQLITE_PRIVATE int sqlite3ExprCodeAndCache(Parse*, Expr*, int);
@@ -18712,14 +18736,45 @@
1871218736
** Utility functions used throughout sqlite.
1871318737
**
1871418738
** This file contains functions for allocating memory, comparing
1871518739
** strings, and stuff like that.
1871618740
**
18717
-** $Id: util.c,v 1.245 2008/12/10 22:15:00 drh Exp $
18741
+** $Id: util.c,v 1.246 2009/01/10 16:15:22 drh Exp $
1871818742
*/
1871918743
1872018744
18745
+/*
18746
+** Routine needed to support the testcase() macro.
18747
+*/
18748
+#ifdef SQLITE_COVERAGE_TEST
18749
+SQLITE_PRIVATE void sqlite3Coverage(int x){
18750
+ static int dummy = 0;
18751
+ dummy += x;
18752
+}
18753
+#endif
18754
+
18755
+/*
18756
+** Routine needed to support the ALWAYS() and NEVER() macros.
18757
+**
18758
+** The argument to ALWAYS() should always be true and the argument
18759
+** to NEVER() should always be false. If either is not the case
18760
+** then this routine is called in order to throw an error.
18761
+**
18762
+** This routine only exists if assert() is operational. It always
18763
+** throws an assert on its first invocation. The variable has a long
18764
+** name to help the assert() message be more readable. The variable
18765
+** is used to prevent a too-clever optimizer from optimizing out the
18766
+** entire call.
18767
+*/
18768
+#ifndef NDEBUG
18769
+SQLITE_PRIVATE int sqlite3Assert(void){
18770
+ static volatile int ALWAYS_was_false_or_NEVER_was_true = 0;
18771
+ assert( ALWAYS_was_false_or_NEVER_was_true ); /* Always fails */
18772
+ return ALWAYS_was_false_or_NEVER_was_true++; /* Not Reached */
18773
+}
18774
+#endif
18775
+
1872118776
/*
1872218777
** Return true if the floating point value is Not a Number (NaN).
1872318778
*/
1872418779
SQLITE_PRIVATE int sqlite3IsNaN(double x){
1872518780
/* This NaN test sometimes fails if compiled on GCC with -ffast-math.
@@ -19967,86 +20022,86 @@
1996720022
/* Automatically generated. Do not edit */
1996820023
/* See the mkopcodec.awk script for details. */
1996920024
#if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
1997020025
SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
1997120026
static const char *const azName[] = { "?",
19972
- /* 1 */ "VCreate",
19973
- /* 2 */ "MemMax",
19974
- /* 3 */ "LoadAnalysis",
19975
- /* 4 */ "RowData",
19976
- /* 5 */ "CreateIndex",
19977
- /* 6 */ "Variable",
19978
- /* 7 */ "SeekGt",
19979
- /* 8 */ "SeekLe",
19980
- /* 9 */ "IfNeg",
19981
- /* 10 */ "Clear",
19982
- /* 11 */ "Last",
19983
- /* 12 */ "Savepoint",
19984
- /* 13 */ "Sequence",
19985
- /* 14 */ "Int64",
19986
- /* 15 */ "VBegin",
19987
- /* 16 */ "RowKey",
19988
- /* 17 */ "SCopy",
19989
- /* 18 */ "ResetCount",
20027
+ /* 1 */ "VNext",
20028
+ /* 2 */ "Affinity",
20029
+ /* 3 */ "Column",
20030
+ /* 4 */ "SetCookie",
20031
+ /* 5 */ "Seek",
20032
+ /* 6 */ "Sequence",
20033
+ /* 7 */ "Savepoint",
20034
+ /* 8 */ "RowKey",
20035
+ /* 9 */ "SCopy",
20036
+ /* 10 */ "OpenWrite",
20037
+ /* 11 */ "If",
20038
+ /* 12 */ "VRowid",
20039
+ /* 13 */ "CollSeq",
20040
+ /* 14 */ "OpenRead",
20041
+ /* 15 */ "Expire",
20042
+ /* 16 */ "AutoCommit",
20043
+ /* 17 */ "Pagecount",
20044
+ /* 18 */ "IntegrityCk",
1999020045
/* 19 */ "Not",
19991
- /* 20 */ "Delete",
19992
- /* 21 */ "Trace",
19993
- /* 22 */ "Rowid",
19994
- /* 23 */ "OpenRead",
19995
- /* 24 */ "Sort",
19996
- /* 25 */ "VerifyCookie",
19997
- /* 26 */ "VColumn",
19998
- /* 27 */ "Next",
19999
- /* 28 */ "Insert",
20000
- /* 29 */ "Prev",
20001
- /* 30 */ "IdxGE",
20046
+ /* 20 */ "Sort",
20047
+ /* 21 */ "Copy",
20048
+ /* 22 */ "Trace",
20049
+ /* 23 */ "Function",
20050
+ /* 24 */ "IfNeg",
20051
+ /* 25 */ "Noop",
20052
+ /* 26 */ "Return",
20053
+ /* 27 */ "NewRowid",
20054
+ /* 28 */ "Variable",
20055
+ /* 29 */ "String",
20056
+ /* 30 */ "RealAffinity",
2000220057
/* 31 */ "VRename",
20003
- /* 32 */ "DropTable",
20004
- /* 33 */ "MakeRecord",
20005
- /* 34 */ "Null",
20006
- /* 35 */ "IdxInsert",
20007
- /* 36 */ "SeekLt",
20008
- /* 37 */ "ReadCookie",
20009
- /* 38 */ "VDestroy",
20010
- /* 39 */ "DropIndex",
20011
- /* 40 */ "MustBeInt",
20012
- /* 41 */ "IntegrityCk",
20013
- /* 42 */ "CollSeq",
20014
- /* 43 */ "ResultRow",
20015
- /* 44 */ "Yield",
20016
- /* 45 */ "OpenEphemeral",
20017
- /* 46 */ "VNext",
20018
- /* 47 */ "Seek",
20019
- /* 48 */ "Found",
20020
- /* 49 */ "If",
20021
- /* 50 */ "IfZero",
20022
- /* 51 */ "Goto",
20023
- /* 52 */ "Function",
20024
- /* 53 */ "Copy",
20025
- /* 54 */ "Jump",
20026
- /* 55 */ "Blob",
20027
- /* 56 */ "NullRow",
20028
- /* 57 */ "Transaction",
20029
- /* 58 */ "VUpdate",
20030
- /* 59 */ "TableLock",
20031
- /* 60 */ "IdxRowid",
20032
- /* 61 */ "SetCookie",
20033
- /* 62 */ "ContextPush",
20058
+ /* 32 */ "ParseSchema",
20059
+ /* 33 */ "VOpen",
20060
+ /* 34 */ "Close",
20061
+ /* 35 */ "CreateIndex",
20062
+ /* 36 */ "IsUnique",
20063
+ /* 37 */ "NotFound",
20064
+ /* 38 */ "Int64",
20065
+ /* 39 */ "MustBeInt",
20066
+ /* 40 */ "Halt",
20067
+ /* 41 */ "Rowid",
20068
+ /* 42 */ "IdxLT",
20069
+ /* 43 */ "AddImm",
20070
+ /* 44 */ "Statement",
20071
+ /* 45 */ "RowData",
20072
+ /* 46 */ "MemMax",
20073
+ /* 47 */ "NotExists",
20074
+ /* 48 */ "Gosub",
20075
+ /* 49 */ "Integer",
20076
+ /* 50 */ "Prev",
20077
+ /* 51 */ "RowSetRead",
20078
+ /* 52 */ "RowSetAdd",
20079
+ /* 53 */ "VColumn",
20080
+ /* 54 */ "CreateTable",
20081
+ /* 55 */ "Last",
20082
+ /* 56 */ "SeekLe",
20083
+ /* 57 */ "IncrVacuum",
20084
+ /* 58 */ "IdxRowid",
20085
+ /* 59 */ "ResetCount",
20086
+ /* 60 */ "ContextPush",
20087
+ /* 61 */ "Yield",
20088
+ /* 62 */ "DropTrigger",
2003420089
/* 63 */ "Or",
2003520090
/* 64 */ "And",
20036
- /* 65 */ "DropTrigger",
20037
- /* 66 */ "AutoCommit",
20038
- /* 67 */ "Column",
20091
+ /* 65 */ "DropIndex",
20092
+ /* 66 */ "IdxGE",
20093
+ /* 67 */ "IdxDelete",
2003920094
/* 68 */ "IsNull",
2004020095
/* 69 */ "NotNull",
2004120096
/* 70 */ "Ne",
2004220097
/* 71 */ "Eq",
2004320098
/* 72 */ "Gt",
2004420099
/* 73 */ "Le",
2004520100
/* 74 */ "Lt",
2004620101
/* 75 */ "Ge",
20047
- /* 76 */ "AddImm",
20102
+ /* 76 */ "Vacuum",
2004820103
/* 77 */ "BitAnd",
2004920104
/* 78 */ "BitOr",
2005020105
/* 79 */ "ShiftLeft",
2005120106
/* 80 */ "ShiftRight",
2005220107
/* 81 */ "Add",
@@ -20053,55 +20108,55 @@
2005320108
/* 82 */ "Subtract",
2005420109
/* 83 */ "Multiply",
2005520110
/* 84 */ "Divide",
2005620111
/* 85 */ "Remainder",
2005720112
/* 86 */ "Concat",
20058
- /* 87 */ "ContextPop",
20059
- /* 88 */ "IdxDelete",
20060
- /* 89 */ "IncrVacuum",
20113
+ /* 87 */ "IfNot",
20114
+ /* 88 */ "DropTable",
20115
+ /* 89 */ "SeekLt",
2006120116
/* 90 */ "BitNot",
2006220117
/* 91 */ "String8",
20063
- /* 92 */ "AggFinal",
20064
- /* 93 */ "RealAffinity",
20065
- /* 94 */ "Return",
20066
- /* 95 */ "Expire",
20067
- /* 96 */ "Rewind",
20068
- /* 97 */ "Statement",
20069
- /* 98 */ "Integer",
20070
- /* 99 */ "Compare",
20071
- /* 100 */ "Destroy",
20072
- /* 101 */ "IdxLT",
20073
- /* 102 */ "Affinity",
20074
- /* 103 */ "Vacuum",
20075
- /* 104 */ "IfNot",
20076
- /* 105 */ "Move",
20077
- /* 106 */ "Explain",
20078
- /* 107 */ "ParseSchema",
20079
- /* 108 */ "NewRowid",
20080
- /* 109 */ "SetNumColumns",
20081
- /* 110 */ "String",
20082
- /* 111 */ "AggStep",
20083
- /* 112 */ "VRowid",
20084
- /* 113 */ "VOpen",
20085
- /* 114 */ "NotExists",
20086
- /* 115 */ "Close",
20087
- /* 116 */ "Halt",
20088
- /* 117 */ "Noop",
20089
- /* 118 */ "SeekGe",
20090
- /* 119 */ "VFilter",
20091
- /* 120 */ "OpenPseudo",
20092
- /* 121 */ "RowSetRead",
20093
- /* 122 */ "RowSetAdd",
20094
- /* 123 */ "IsUnique",
20095
- /* 124 */ "OpenWrite",
20096
- /* 125 */ "Permutation",
20097
- /* 126 */ "Gosub",
20118
+ /* 92 */ "MakeRecord",
20119
+ /* 93 */ "ResultRow",
20120
+ /* 94 */ "Delete",
20121
+ /* 95 */ "AggFinal",
20122
+ /* 96 */ "Compare",
20123
+ /* 97 */ "Goto",
20124
+ /* 98 */ "TableLock",
20125
+ /* 99 */ "Clear",
20126
+ /* 100 */ "VerifyCookie",
20127
+ /* 101 */ "AggStep",
20128
+ /* 102 */ "SetNumColumns",
20129
+ /* 103 */ "Transaction",
20130
+ /* 104 */ "VFilter",
20131
+ /* 105 */ "VDestroy",
20132
+ /* 106 */ "ContextPop",
20133
+ /* 107 */ "Next",
20134
+ /* 108 */ "IdxInsert",
20135
+ /* 109 */ "SeekGe",
20136
+ /* 110 */ "Insert",
20137
+ /* 111 */ "Destroy",
20138
+ /* 112 */ "ReadCookie",
20139
+ /* 113 */ "LoadAnalysis",
20140
+ /* 114 */ "Explain",
20141
+ /* 115 */ "OpenPseudo",
20142
+ /* 116 */ "OpenEphemeral",
20143
+ /* 117 */ "Null",
20144
+ /* 118 */ "Move",
20145
+ /* 119 */ "Blob",
20146
+ /* 120 */ "Rewind",
20147
+ /* 121 */ "SeekGt",
20148
+ /* 122 */ "VBegin",
20149
+ /* 123 */ "VUpdate",
20150
+ /* 124 */ "IfZero",
20151
+ /* 125 */ "VCreate",
20152
+ /* 126 */ "Found",
2009820153
/* 127 */ "IfPos",
20099
- /* 128 */ "Pagecount",
20154
+ /* 128 */ "NullRow",
2010020155
/* 129 */ "Real",
20101
- /* 130 */ "NotFound",
20102
- /* 131 */ "CreateTable",
20156
+ /* 130 */ "Jump",
20157
+ /* 131 */ "Permutation",
2010320158
/* 132 */ "NotUsed_132",
2010420159
/* 133 */ "NotUsed_133",
2010520160
/* 134 */ "NotUsed_134",
2010620161
/* 135 */ "NotUsed_135",
2010720162
/* 136 */ "NotUsed_136",
@@ -30390,10 +30445,12 @@
3039030445
** output, it first sorts the linked list (removing duplicates during
3039130446
** the sort) then returns elements one by one by walking the list.
3039230447
**
3039330448
** Big chunks of rowid/next-ptr pairs are allocated at a time, to
3039430449
** reduce the malloc overhead.
30450
+**
30451
+** $Id: rowset.c,v 1.3 2009/01/13 20:14:16 drh Exp $
3039530452
*/
3039630453
3039730454
/*
3039830455
** The number of rowset entries per allocation chunk.
3039930456
*/
@@ -30622,11 +30679,11 @@
3062230679
** is separate from the database file. The pager also implements file
3062330680
** locking to prevent two processes from writing the same database
3062430681
** file simultaneously, or one process from reading the database while
3062530682
** another is writing.
3062630683
**
30627
-** @(#) $Id: pager.c,v 1.544 2009/01/09 17:11:05 danielk1977 Exp $
30684
+** @(#) $Id: pager.c,v 1.549 2009/01/13 16:03:44 danielk1977 Exp $
3062830685
*/
3062930686
#ifndef SQLITE_OMIT_DISKIO
3063030687
3063130688
/*
3063230689
** Macros for troubleshooting. Normally turned off
@@ -30719,10 +30776,18 @@
3071930776
#else
3072030777
# define CODEC1(P,D,N,X) /* NO-OP */
3072130778
# define CODEC2(P,D,N,X) ((char*)D)
3072230779
#endif
3072330780
30781
+/*
30782
+** The maximum allowed sector size. 16MB. If the xSectorsize() method
30783
+** returns a value larger than this, then MAX_SECTOR_SIZE is used instead.
30784
+** This could conceivably cause corruption following a power failure on
30785
+** such a system. This is currently an undocumented limit.
30786
+*/
30787
+#define MAX_SECTOR_SIZE 0x0100000
30788
+
3072430789
/*
3072530790
** An instance of the following structure is allocated for each active
3072630791
** savepoint and statement transaction in the system. All such structures
3072730792
** are stored in the Pager.aSavepoint[] array, which is allocated and
3072830793
** resized using sqlite3Realloc().
@@ -30778,11 +30843,10 @@
3077830843
u8 state; /* PAGER_UNLOCK, _SHARED, _RESERVED, etc. */
3077930844
u8 tempFile; /* zFilename is a temporary file */
3078030845
u8 readOnly; /* True for a read-only database */
3078130846
u8 needSync; /* True if an fsync() is needed on the journal */
3078230847
u8 dirtyCache; /* True if cached pages have changed */
30783
- u8 alwaysRollback; /* Disable DontRollback() for all pages */
3078430848
u8 memDb; /* True to inhibit all file I/O */
3078530849
u8 setMaster; /* True if a m-j name has been written to jrnl */
3078630850
u8 doNotSync; /* Boolean. While true, do not spill the cache */
3078730851
u8 exclusiveMode; /* Boolean. True if locking_mode==EXCLUSIVE */
3078830852
u8 journalMode; /* On of the PAGER_JOURNALMODE_* values */
@@ -31004,11 +31068,11 @@
3100431068
int szPage; /* Page size */
3100531069
sqlite3_file *fd = pPager->fd;
3100631070
3100731071
if( fd->pMethods ){
3100831072
dc = sqlite3OsDeviceCharacteristics(fd);
31009
- nSector = sqlite3OsSectorSize(fd);
31073
+ nSector = pPager->sectorSize;
3101031074
szPage = pPager->pageSize;
3101131075
}
3101231076
3101331077
assert(SQLITE_IOCAP_ATOMIC512==(512>>8));
3101431078
assert(SQLITE_IOCAP_ATOMIC64K==(65536>>8));
@@ -31363,11 +31427,12 @@
3136331427
u32 *pDbSize
3136431428
){
3136531429
int rc;
3136631430
unsigned char aMagic[8]; /* A buffer to hold the magic header */
3136731431
i64 jrnlOff;
31368
- int iPageSize;
31432
+ u32 iPageSize;
31433
+ u32 iSectorSize;
3136931434
3137031435
seekJournalHdr(pPager);
3137131436
if( pPager->journalOff+JOURNAL_HDR_SZ(pPager) > journalSize ){
3137231437
return SQLITE_DONE;
3137331438
}
@@ -31388,32 +31453,45 @@
3138831453
if( rc ) return rc;
3138931454
3139031455
rc = read32bits(pPager->jfd, jrnlOff+8, pDbSize);
3139131456
if( rc ) return rc;
3139231457
31393
- rc = read32bits(pPager->jfd, jrnlOff+16, (u32 *)&iPageSize);
31394
- if( rc==SQLITE_OK
31395
- && iPageSize>=512
31396
- && iPageSize<=SQLITE_MAX_PAGE_SIZE
31397
- && ((iPageSize-1)&iPageSize)==0
31398
- ){
31399
- u16 pagesize = (u16)iPageSize;
31400
- rc = sqlite3PagerSetPagesize(pPager, &pagesize);
31401
- }
31402
- if( rc ) return rc;
31403
-
31404
- /* Update the assumed sector-size to match the value used by
31405
- ** the process that created this journal. If this journal was
31406
- ** created by a process other than this one, then this routine
31407
- ** is being called from within pager_playback(). The local value
31408
- ** of Pager.sectorSize is restored at the end of that routine.
31409
- */
31410
- rc = read32bits(pPager->jfd, jrnlOff+12, &pPager->sectorSize);
31411
- if( rc ) return rc;
31412
- if( (pPager->sectorSize & (pPager->sectorSize-1))!=0
31413
- || pPager->sectorSize>0x1000000 ){
31414
- return SQLITE_DONE;
31458
+ if( pPager->journalOff==0 ){
31459
+ rc = read32bits(pPager->jfd, jrnlOff+16, &iPageSize);
31460
+ if( rc ) return rc;
31461
+
31462
+ if( iPageSize<512
31463
+ || iPageSize>SQLITE_MAX_PAGE_SIZE
31464
+ || ((iPageSize-1)&iPageSize)!=0
31465
+ ){
31466
+ /* If the page-size in the journal-header is invalid, then the process
31467
+ ** that wrote the journal-header must have crashed before the header
31468
+ ** was synced. In this case stop reading the journal file here.
31469
+ */
31470
+ rc = SQLITE_DONE;
31471
+ }else{
31472
+ u16 pagesize = (u16)iPageSize;
31473
+ rc = sqlite3PagerSetPagesize(pPager, &pagesize);
31474
+ assert( rc!=SQLITE_OK || pagesize==(u16)iPageSize );
31475
+ }
31476
+ if( rc ) return rc;
31477
+
31478
+ /* Update the assumed sector-size to match the value used by
31479
+ ** the process that created this journal. If this journal was
31480
+ ** created by a process other than this one, then this routine
31481
+ ** is being called from within pager_playback(). The local value
31482
+ ** of Pager.sectorSize is restored at the end of that routine.
31483
+ */
31484
+ rc = read32bits(pPager->jfd, jrnlOff+12, &iSectorSize);
31485
+ if( rc ) return rc;
31486
+ if( (iSectorSize&(iSectorSize-1))
31487
+ || iSectorSize<512
31488
+ || iSectorSize>MAX_SECTOR_SIZE
31489
+ ){
31490
+ return SQLITE_DONE;
31491
+ }
31492
+ pPager->sectorSize = iSectorSize;
3141531493
}
3141631494
3141731495
pPager->journalOff += JOURNAL_HDR_SZ(pPager);
3141831496
return SQLITE_OK;
3141931497
}
@@ -31567,14 +31645,11 @@
3156731645
** on the pager file (by this or any other process), it will be
3156831646
** treated as a hot-journal and rolled back.
3156931647
*/
3157031648
static void pager_unlock(Pager *pPager){
3157131649
if( !pPager->exclusiveMode ){
31572
- int rc = osUnlock(pPager->fd, NO_LOCK);
31573
- if( rc ) pPager->errCode = rc;
31574
- pPager->dbSizeValid = 0;
31575
- IOTRACE(("UNLOCK %p\n", pPager))
31650
+ int rc;
3157631651
3157731652
/* Always close the journal file when dropping the database lock.
3157831653
** Otherwise, another connection with journal_mode=delete might
3157931654
** delete the file out from under us.
3158031655
*/
@@ -31584,10 +31659,15 @@
3158431659
sqlite3BitvecDestroy(pPager->pInJournal);
3158531660
pPager->pInJournal = 0;
3158631661
sqlite3BitvecDestroy(pPager->pAlwaysRollback);
3158731662
pPager->pAlwaysRollback = 0;
3158831663
}
31664
+
31665
+ rc = osUnlock(pPager->fd, NO_LOCK);
31666
+ if( rc ) pPager->errCode = rc;
31667
+ pPager->dbSizeValid = 0;
31668
+ IOTRACE(("UNLOCK %p\n", pPager))
3158931669
3159031670
/* If Pager.errCode is set, the contents of the pager cache cannot be
3159131671
** trusted. Now that the pager file is unlocked, the contents of the
3159231672
** cache can be discarded and the error code safely cleared.
3159331673
*/
@@ -32106,11 +32186,11 @@
3210632186
3210732187
/*
3210832188
** Set the sectorSize for the given pager.
3210932189
**
3211032190
** The sector size is at least as big as the sector size reported
32111
-** by sqlite3OsSectorSize(). The minimum sector size is 512.
32191
+** by sqlite3OsSectorSize(). The minimum sector size is 512.
3211232192
*/
3211332193
static void setSectorSize(Pager *pPager){
3211432194
assert(pPager->fd->pMethods||pPager->tempFile);
3211532195
if( !pPager->tempFile ){
3211632196
/* Sector size doesn't matter for temporary files. Also, the file
@@ -32119,10 +32199,13 @@
3211932199
*/
3212032200
pPager->sectorSize = sqlite3OsSectorSize(pPager->fd);
3212132201
}
3212232202
if( pPager->sectorSize<512 ){
3212332203
pPager->sectorSize = 512;
32204
+ }
32205
+ if( pPager->sectorSize>MAX_SECTOR_SIZE ){
32206
+ pPager->sectorSize = MAX_SECTOR_SIZE;
3212432207
}
3212532208
}
3212632209
3212732210
/*
3212832211
** Playback the journal and thus restore the database file to
@@ -32625,13 +32708,13 @@
3262532708
** + SQLITE_DEFAULT_PAGE_SIZE,
3262632709
** + The value returned by sqlite3OsSectorSize()
3262732710
** + The largest page size that can be written atomically.
3262832711
*/
3262932712
if( rc==SQLITE_OK && !readOnly ){
32630
- int iSectorSize = sqlite3OsSectorSize(pPager->fd);
32631
- if( szPageDflt<iSectorSize ){
32632
- szPageDflt = iSectorSize;
32713
+ setSectorSize(pPager);
32714
+ if( szPageDflt<pPager->sectorSize ){
32715
+ szPageDflt = pPager->sectorSize;
3263332716
}
3263432717
#ifdef SQLITE_ENABLE_ATOMIC_WRITE
3263532718
{
3263632719
int iDc = sqlite3OsDeviceCharacteristics(pPager->fd);
3263732720
int ii;
@@ -34215,23 +34298,16 @@
3421534298
/* If the PGHDR_NEED_SYNC flag is set for any of the nPage pages
3421634299
** starting at pg1, then it needs to be set for all of them. Because
3421734300
** writing to any of these nPage pages may damage the others, the
3421834301
** journal file must contain sync()ed copies of all of them
3421934302
** before any of them can be written out to the database file.
34220
- **
34221
- ** 2009-01-07: This block of code appears to be a no-op. I do not
34222
- ** believe it is possible for any page on the sector to not have
34223
- ** the PGHDR_NEED_SYNC flag set. The "pPage->flags |= PGHDR_NEED_SYNC"
34224
- ** line below does nothing, I think. But it does no harm to leave
34225
- ** this code in place until we can definitively prove this is the case.
3422634303
*/
3422734304
if( needSync ){
3422834305
assert( !MEMDB && pPager->noSync==0 );
3422934306
for(ii=0; ii<nPage && needSync; ii++){
3423034307
PgHdr *pPage = pager_lookup(pPager, pg1+ii);
3423134308
if( pPage ){
34232
- assert( pPage->flags & PGHDR_NEED_SYNC ); /* 2009-01-07 conjecture */
3423334309
pPage->flags |= PGHDR_NEED_SYNC;
3423434310
sqlite3PagerUnref(pPage);
3423534311
}
3423634312
}
3423734313
assert(pPager->needSync);
@@ -34269,20 +34345,20 @@
3426934345
**
3427034346
** Tests show that this optimization, together with the
3427134347
** sqlite3PagerDontRollback() below, more than double the speed
3427234348
** of large INSERT operations and quadruple the speed of large DELETEs.
3427334349
**
34274
-** When this routine is called, set the alwaysRollback flag to true.
34275
-** Subsequent calls to sqlite3PagerDontRollback() for the same page
34276
-** will thereafter be ignored. This is necessary to avoid a problem
34277
-** where a page with data is added to the freelist during one part of
34278
-** a transaction then removed from the freelist during a later part
34279
-** of the same transaction and reused for some other purpose. When it
34280
-** is first added to the freelist, this routine is called. When reused,
34281
-** the sqlite3PagerDontRollback() routine is called. But because the
34282
-** page contains critical data, we still need to be sure it gets
34283
-** rolled back in spite of the sqlite3PagerDontRollback() call.
34350
+** When this routine is called, set the bit corresponding to pDbPage in
34351
+** the Pager.pAlwaysRollback bitvec. Subsequent calls to
34352
+** sqlite3PagerDontRollback() for the same page will thereafter be ignored.
34353
+** This is necessary to avoid a problem where a page with data is added to
34354
+** the freelist during one part of a transaction then removed from the
34355
+** freelist during a later part of the same transaction and reused for some
34356
+** other purpose. When it is first added to the freelist, this routine is
34357
+** called. When reused, the sqlite3PagerDontRollback() routine is called.
34358
+** But because the page contains critical data, we still need to be sure it
34359
+** gets rolled back in spite of the sqlite3PagerDontRollback() call.
3428434360
*/
3428534361
SQLITE_PRIVATE int sqlite3PagerDontWrite(DbPage *pDbPage){
3428634362
PgHdr *pPg = pDbPage;
3428734363
Pager *pPager = pPg->pPager;
3428834364
int rc;
@@ -34338,11 +34414,11 @@
3433834414
TESTONLY( int rc; ) /* Return value from sqlite3BitvecSet() */
3433934415
3434034416
assert( pPager->state>=PAGER_RESERVED );
3434134417
3434234418
/* If the journal file is not open, or DontWrite() has been called on
34343
- ** this page (DontWrite() sets the alwaysRollback flag), then this
34419
+ ** this page (DontWrite() sets the Pager.pAlwaysRollback bit), then this
3434434420
** function is a no-op.
3434534421
*/
3434634422
if( pPager->journalOpen==0
3434734423
|| sqlite3BitvecTest(pPager->pAlwaysRollback, pPg->pgno)
3434834424
|| pPg->pgno>pPager->dbOrigSize
@@ -34754,12 +34830,14 @@
3475434830
3475534831
if( nSavepoint>pPager->nSavepoint && pPager->useJournal ){
3475634832
int ii;
3475734833
PagerSavepoint *aNew;
3475834834
34759
- /* Either the sub-journal is open or there are no active savepoints. */
34760
- assert( pPager->nSavepoint==0 || pPager->sjfd->pMethods );
34835
+ /* Either there is no active journal or the sub-journal is open or
34836
+ ** the journal is always stored in memory */
34837
+ assert( pPager->nSavepoint==0 || pPager->sjfd->pMethods ||
34838
+ pPager->journalMode==PAGER_JOURNALMODE_MEMORY );
3476134839
3476234840
/* Grow the Pager.aSavepoint array using realloc(). Return SQLITE_NOMEM
3476334841
** if the allocation fails. Otherwise, zero the new portion in case a
3476434842
** malloc failure occurs while populating it in the for(...) loop below.
3476534843
*/
@@ -36078,11 +36156,11 @@
3607836156
** May you do good and not evil.
3607936157
** May you find forgiveness for yourself and forgive others.
3608036158
** May you share freely, never taking more than you give.
3608136159
**
3608236160
*************************************************************************
36083
-** $Id: btree.c,v 1.557 2009/01/09 14:11:05 drh Exp $
36161
+** $Id: btree.c,v 1.558 2009/01/10 16:15:21 drh Exp $
3608436162
**
3608536163
** This file implements a external (disk-based) database using BTrees.
3608636164
** See the header comment on "btreeInt.h" for additional information.
3608736165
** Including a description of file format and an overview of operation.
3608836166
*/
@@ -43414,11 +43492,10 @@
4341443492
/*
4341543493
** Return non-zero if a statement transaction is active.
4341643494
*/
4341743495
SQLITE_PRIVATE int sqlite3BtreeIsInStmt(Btree *p){
4341843496
assert( sqlite3BtreeHoldsMutex(p) );
43419
- assert( p->pBt );
4342043497
return ALWAYS(p->pBt) && p->pBt->inStmt;
4342143498
}
4342243499
4342343500
/*
4342443501
** Return non-zero if a read (or write) transaction is active.
@@ -48544,11 +48621,11 @@
4854448621
** documentation, headers files, or other derived files. The formatting
4854548622
** of the code in this file is, therefore, important. See other comments
4854648623
** in this file for details. If in doubt, do not deviate from existing
4854748624
** commenting and indentation practices when changing or adding code.
4854848625
**
48549
-** $Id: vdbe.c,v 1.810 2009/01/05 22:30:39 drh Exp $
48626
+** $Id: vdbe.c,v 1.811 2009/01/14 00:55:10 drh Exp $
4855048627
*/
4855148628
4855248629
/*
4855348630
** The following global variable is incremented every time a cursor
4855448631
** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test
@@ -52497,10 +52574,11 @@
5249752574
pCrsr = pC->pCursor;
5249852575
assert( pCrsr!=0 );
5249952576
rc = sqlite3BtreeLast(pCrsr, &res);
5250052577
pC->nullRow = (u8)res;
5250152578
pC->deferredMoveto = 0;
52579
+ pC->rowidIsValid = 0;
5250252580
pC->cacheStatus = CACHE_STALE;
5250352581
if( res && pOp->p2>0 ){
5250452582
pc = pOp->p2 - 1;
5250552583
}
5250652584
break;
@@ -52547,10 +52625,11 @@
5254752625
if( (pCrsr = pC->pCursor)!=0 ){
5254852626
rc = sqlite3BtreeFirst(pCrsr, &res);
5254952627
pC->atFirst = res==0 ?1:0;
5255052628
pC->deferredMoveto = 0;
5255152629
pC->cacheStatus = CACHE_STALE;
52630
+ pC->rowidIsValid = 0;
5255252631
}else{
5255352632
res = 1;
5255452633
}
5255552634
pC->nullRow = (u8)res;
5255652635
assert( pOp->p2>0 && pOp->p2<p->nOp );
@@ -56080,11 +56159,11 @@
5608056159
**
5608156160
*************************************************************************
5608256161
** This file contains routines used for analyzing expressions and
5608356162
** for generating VDBE code that evaluates expressions in SQLite.
5608456163
**
56085
-** $Id: expr.c,v 1.408 2008/12/15 15:27:52 drh Exp $
56164
+** $Id: expr.c,v 1.409 2009/01/10 13:24:51 drh Exp $
5608656165
*/
5608756166
5608856167
/*
5608956168
** Return the 'affinity' of the expression pExpr if any.
5609056169
**
@@ -56986,11 +57065,10 @@
5698657065
case TK_FUNCTION:
5698757066
if( pWalker->u.i==2 ) return 0;
5698857067
/* Fall through */
5698957068
case TK_ID:
5699057069
case TK_COLUMN:
56991
- case TK_DOT:
5699257070
case TK_AGG_FUNCTION:
5699357071
case TK_AGG_COLUMN:
5699457072
#ifndef SQLITE_OMIT_SUBQUERY
5699557073
case TK_SELECT:
5699657074
case TK_EXISTS:
@@ -56997,11 +57075,10 @@
5699757075
testcase( pExpr->op==TK_SELECT );
5699857076
testcase( pExpr->op==TK_EXISTS );
5699957077
#endif
5700057078
testcase( pExpr->op==TK_ID );
5700157079
testcase( pExpr->op==TK_COLUMN );
57002
- testcase( pExpr->op==TK_DOT );
5700357080
testcase( pExpr->op==TK_AGG_FUNCTION );
5700457081
testcase( pExpr->op==TK_AGG_COLUMN );
5700557082
pWalker->u.i = 0;
5700657083
return WRC_Abort;
5700757084
default:
@@ -57104,16 +57181,10 @@
5710457181
if( sqlite3StrICmp(z, "ROWID")==0 ) return 1;
5710557182
if( sqlite3StrICmp(z, "OID")==0 ) return 1;
5710657183
return 0;
5710757184
}
5710857185
57109
-#ifdef SQLITE_TEST
57110
- int sqlite3_enable_in_opt = 1;
57111
-#else
57112
- #define sqlite3_enable_in_opt 1
57113
-#endif
57114
-
5711557186
/*
5711657187
** Return true if the IN operator optimization is enabled and
5711757188
** the SELECT statement p exists and is of the
5711857189
** simple form:
5711957190
**
@@ -57125,11 +57196,10 @@
5712557196
#ifndef SQLITE_OMIT_SUBQUERY
5712657197
static int isCandidateForInOpt(Select *p){
5712757198
SrcList *pSrc;
5712857199
ExprList *pEList;
5712957200
Table *pTab;
57130
- if( !sqlite3_enable_in_opt ) return 0; /* IN optimization must be enabled */
5713157201
if( p==0 ) return 0; /* right-hand side of IN is SELECT */
5713257202
if( p->pPrior ) return 0; /* Not a compound SELECT */
5713357203
if( p->selFlags & (SF_Distinct|SF_Aggregate) ){
5713457204
return 0; /* No DISTINCT keyword and no aggregate functions */
5713557205
}
@@ -57136,12 +57206,12 @@
5713657206
if( p->pGroupBy ) return 0; /* Has no GROUP BY clause */
5713757207
if( p->pLimit ) return 0; /* Has no LIMIT clause */
5713857208
if( p->pOffset ) return 0;
5713957209
if( p->pWhere ) return 0; /* Has no WHERE clause */
5714057210
pSrc = p->pSrc;
57141
- if( pSrc==0 ) return 0; /* A single table in the FROM clause */
57142
- if( pSrc->nSrc!=1 ) return 0;
57211
+ assert( pSrc!=0 );
57212
+ if( pSrc->nSrc!=1 ) return 0; /* Single term in FROM clause */
5714357213
if( pSrc->a[0].pSelect ) return 0; /* FROM clause is not a subquery */
5714457214
pTab = pSrc->a[0].pTab;
5714557215
if( pTab==0 ) return 0;
5714657216
if( pTab->pSelect ) return 0; /* FROM clause is not a view */
5714757217
if( IsVirtual(pTab) ) return 0; /* FROM clause not a virtual table */
@@ -57724,37 +57794,26 @@
5772457794
}
5772557795
return 0;
5772657796
}
5772757797
5772857798
/*
57729
-** Theres is a value in register iCurrent. We ultimately want
57730
-** the value to be in register iTarget. It might be that
57731
-** iCurrent and iTarget are the same register.
57799
+** There is a value in register iReg.
5773257800
**
5773357801
** We are going to modify the value, so we need to make sure it
57734
-** is not a cached register. If iCurrent is a cached register,
57735
-** then try to move the value over to iTarget. If iTarget is a
57736
-** cached register, then clear the corresponding cache line.
57737
-**
57738
-** Return the register that the value ends up in.
57739
-*/
57740
-SQLITE_PRIVATE int sqlite3ExprWritableRegister(Parse *pParse, int iCurrent, int iTarget){
57741
- int i;
57742
- assert( pParse->pVdbe!=0 );
57743
- if( !usedAsColumnCache(pParse, iCurrent, iCurrent) ){
57744
- return iCurrent;
57745
- }
57746
- if( iCurrent!=iTarget ){
57747
- sqlite3VdbeAddOp2(pParse->pVdbe, OP_SCopy, iCurrent, iTarget);
57748
- }
57749
- for(i=0; i<pParse->nColCache; i++){
57750
- if( pParse->aColCache[i].iReg==iTarget ){
57751
- pParse->aColCache[i] = pParse->aColCache[--pParse->nColCache];
57752
- pParse->iColCache = pParse->nColCache;
57753
- }
57754
- }
57755
- return iTarget;
57802
+** is not a cached register. If iReg is a cached register,
57803
+** then clear the corresponding cache line.
57804
+*/
57805
+SQLITE_PRIVATE void sqlite3ExprWritableRegister(Parse *pParse, int iReg){
57806
+ int i;
57807
+ if( usedAsColumnCache(pParse, iReg, iReg) ){
57808
+ for(i=0; i<pParse->nColCache; i++){
57809
+ if( pParse->aColCache[i].iReg==iReg ){
57810
+ pParse->aColCache[i] = pParse->aColCache[--pParse->nColCache];
57811
+ pParse->iColCache = pParse->nColCache;
57812
+ }
57813
+ }
57814
+ }
5775657815
}
5775757816
5775857817
/*
5775957818
** If the last instruction coded is an ephemeral copy of any of
5776057819
** the registers in the nReg registers beginning with iReg, then
@@ -59143,11 +59202,11 @@
5914359202
}
5914459203
return pParse->aTempReg[--pParse->nTempReg];
5914559204
}
5914659205
SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse *pParse, int iReg){
5914759206
if( iReg && pParse->nTempReg<ArraySize(pParse->aTempReg) ){
59148
- sqlite3ExprWritableRegister(pParse, iReg, iReg);
59207
+ sqlite3ExprWritableRegister(pParse, iReg);
5914959208
pParse->aTempReg[pParse->nTempReg++] = iReg;
5915059209
}
5915159210
}
5915259211
5915359212
/*
@@ -69985,11 +70044,11 @@
6998570044
** May you share freely, never taking more than you give.
6998670045
**
6998770046
*************************************************************************
6998870047
** This file contains code used to implement the PRAGMA command.
6998970048
**
69990
-** $Id: pragma.c,v 1.200 2009/01/09 21:41:17 drh Exp $
70049
+** $Id: pragma.c,v 1.201 2009/01/13 20:14:16 drh Exp $
6999170050
*/
6999270051
6999370052
/* Ignore this whole file if pragmas are disabled
6999470053
*/
6999570054
#if !defined(SQLITE_OMIT_PRAGMA) && !defined(SQLITE_OMIT_PARSER)
@@ -70497,11 +70556,11 @@
7049770556
7049870557
/*
7049970558
** PRAGMA [database.]journal_size_limit
7050070559
** PRAGMA [database.]journal_size_limit=N
7050170560
**
70502
- ** Get or set the (boolean) value of the database 'auto-vacuum' parameter.
70561
+ ** Get or set the size limit on rollback journal files.
7050370562
*/
7050470563
if( sqlite3StrICmp(zLeft,"journal_size_limit")==0 ){
7050570564
Pager *pPager = sqlite3BtreePager(pDb->pBt);
7050670565
i64 iLimit = -2;
7050770566
if( zRight ){
@@ -70519,11 +70578,12 @@
7051970578
7052070579
/*
7052170580
** PRAGMA [database.]auto_vacuum
7052270581
** PRAGMA [database.]auto_vacuum=N
7052370582
**
70524
- ** Get or set the (boolean) value of the database 'auto-vacuum' parameter.
70583
+ ** Get or set the value of the database 'auto-vacuum' parameter.
70584
+ ** The value is one of: 0 NONE 1 FULL 2 INCREMENTAL
7052570585
*/
7052670586
#ifndef SQLITE_OMIT_AUTOVACUUM
7052770587
if( sqlite3StrICmp(zLeft,"auto_vacuum")==0 ){
7052870588
Btree *pBt = pDb->pBt;
7052970589
assert( pBt!=0 );
@@ -79313,11 +79373,11 @@
7931379373
** generating the code that loops through a table looking for applicable
7931479374
** rows. Indices are selected and used to speed the search when doing
7931579375
** so is applicable. Because this module is responsible for selecting
7931679376
** indices, you might also think of this module as the "query optimizer".
7931779377
**
79318
-** $Id: where.c,v 1.362 2009/01/09 02:49:32 drh Exp $
79378
+** $Id: where.c,v 1.364 2009/01/14 00:55:10 drh Exp $
7931979379
*/
7932079380
7932179381
/*
7932279382
** Trace output macros
7932379383
*/
@@ -80140,14 +80200,16 @@
8014080200
pAndWC = &pAndInfo->wc;
8014180201
whereClauseInit(pAndWC, pWC->pParse, pMaskSet);
8014280202
whereSplit(pAndWC, pOrTerm->pExpr, TK_AND);
8014380203
exprAnalyzeAll(pSrc, pAndWC);
8014480204
testcase( db->mallocFailed );
80145
- for(j=0, pAndTerm=pAndWC->a; j<pAndWC->nTerm; j++, pAndTerm++){
80146
- assert( pAndTerm->pExpr );
80147
- if( allowedOp(pAndTerm->pExpr->op) ){
80148
- b |= getMask(pMaskSet, pAndTerm->leftCursor);
80205
+ if( !db->mallocFailed ){
80206
+ for(j=0, pAndTerm=pAndWC->a; j<pAndWC->nTerm; j++, pAndTerm++){
80207
+ assert( pAndTerm->pExpr );
80208
+ if( allowedOp(pAndTerm->pExpr->op) ){
80209
+ b |= getMask(pMaskSet, pAndTerm->leftCursor);
80210
+ }
8014980211
}
8015080212
}
8015180213
indexable &= b;
8015280214
}
8015380215
}else if( pOrTerm->wtFlags & TERM_COPIED ){
@@ -81140,10 +81202,11 @@
8114081202
&& ((pTerm->prereqAll & ~maskSrc) & notReady)==0
8114181203
&& (pTerm->u.pOrInfo->indexable & maskSrc)!=0 ){
8114281204
WhereClause *pOrWC = &pTerm->u.pOrInfo->wc;
8114381205
WhereTerm *pOrTerm;
8114481206
int j;
81207
+ int sortable = 0;
8114581208
double rTotal = 0;
8114681209
nRow = 0;
8114781210
for(j=0, pOrTerm=pOrWC->a; j<pOrWC->nTerm; j++, pOrTerm++){
8114881211
WhereCost sTermCost;
8114981212
WHERETRACE(("... Multi-index OR testing for term %d of %d....\n", j,i));
@@ -81158,22 +81221,27 @@
8115881221
continue;
8115981222
}
8116081223
rTotal += sTermCost.rCost;
8116181224
nRow += sTermCost.nRow;
8116281225
if( rTotal>=pCost->rCost ) break;
81226
+ }
81227
+ if( pOrderBy!=0 ){
81228
+ if( sortableByRowid(iCur, pOrderBy, pWC->pMaskSet, &rev) && !rev ){
81229
+ sortable = 1;
81230
+ }else{
81231
+ rTotal += nRow*estLog(nRow);
81232
+ WHERETRACE(("... sorting increases OR cost to %.9g\n", rTotal));
81233
+ }
8116381234
}
8116481235
WHERETRACE(("... multi-index OR cost=%.9g nrow=%.9g\n",
8116581236
rTotal, nRow));
8116681237
if( rTotal<pCost->rCost ){
8116781238
pCost->rCost = rTotal;
8116881239
pCost->nRow = nRow;
8116981240
pCost->plan.wsFlags = WHERE_MULTI_OR;
8117081241
pCost->plan.u.pTerm = pTerm;
81171
- if( pOrderBy!=0
81172
- && sortableByRowid(iCur, pOrderBy, pWC->pMaskSet, &rev)
81173
- && !rev
81174
- ){
81242
+ if( sortable ){
8117581243
pCost->plan.wsFlags = WHERE_ORDERBY|WHERE_MULTI_OR;
8117681244
}
8117781245
}
8117881246
}
8117981247
}
@@ -87024,11 +87092,11 @@
8702487092
** Main file for the SQLite library. The routines in this file
8702587093
** implement the programmer interface to the library. Routines in
8702687094
** other files are for internal use by SQLite and should not be
8702787095
** accessed by users of the library.
8702887096
**
87029
-** $Id: main.c,v 1.520 2008/12/17 17:30:26 danielk1977 Exp $
87097
+** $Id: main.c,v 1.521 2009/01/10 16:15:22 drh Exp $
8703087098
*/
8703187099
8703287100
#ifdef SQLITE_ENABLE_FTS3
8703387101
/************** Include fts3.h in the middle of main.c ***********************/
8703487102
/************** Begin file fts3.h ********************************************/
@@ -87550,20 +87618,10 @@
8755087618
}
8755187619
va_end(ap);
8755287620
return rc;
8755387621
}
8755487622
87555
-/*
87556
-** Routine needed to support the testcase() macro.
87557
-*/
87558
-#ifdef SQLITE_COVERAGE_TEST
87559
-SQLITE_PRIVATE void sqlite3Coverage(int x){
87560
- static int dummy = 0;
87561
- dummy += x;
87562
-}
87563
-#endif
87564
-
8756587623
8756687624
/*
8756787625
** Return true if the buffer z[0..n-1] contains all spaces.
8756887626
*/
8756987627
static int allSpaces(const char *z, int n){
8757087628
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -15,11 +15,11 @@
15 ** needed if you want a wrapper to interface SQLite with your choice of
16 ** programming language. The code for the "sqlite3" command-line shell
17 ** is also in a separate file. This file contains only code for the core
18 ** SQLite library.
19 **
20 ** This amalgamation was generated on 2009-01-10 13:14:08 UTC.
21 */
22 #define SQLITE_CORE 1
23 #define SQLITE_AMALGAMATION 1
24 #ifndef SQLITE_PRIVATE
25 # define SQLITE_PRIVATE static
@@ -39,11 +39,11 @@
39 ** May you share freely, never taking more than you give.
40 **
41 *************************************************************************
42 ** Internal interface definitions for SQLite.
43 **
44 ** @(#) $Id: sqliteInt.h,v 1.821 2009/01/09 14:11:05 drh Exp $
45 */
46 #ifndef _SQLITEINT_H_
47 #define _SQLITEINT_H_
48
49 /*
@@ -68,11 +68,11 @@
68 **
69 *************************************************************************
70 **
71 ** This file defines various limits of what SQLite can process.
72 **
73 ** @(#) $Id: sqliteLimit.h,v 1.9 2009/01/07 16:15:43 danielk1977 Exp $
74 */
75
76 /*
77 ** The maximum length of a TEXT or BLOB in bytes. This also
78 ** limits the size of a row in a table or index.
@@ -186,10 +186,17 @@
186 #endif
187
188 /* Maximum page size. The upper bound on this value is 32768. This a limit
189 ** imposed by the necessity of storing the value in a 2-byte unsigned integer
190 ** and the fact that the page size must be a power of 2.
 
 
 
 
 
 
 
191 */
192 #ifndef SQLITE_MAX_PAGE_SIZE
193 # define SQLITE_MAX_PAGE_SIZE 32768
194 #endif
195
@@ -265,61 +272,10 @@
265 #endif
266 #ifdef HAVE_INTTYPES_H
267 #include <inttypes.h>
268 #endif
269
270 /*
271 ** A macro used to aid in coverage testing. When doing coverage
272 ** testing, the condition inside the argument must be evaluated
273 ** both true and false in order to get full branch coverage.
274 ** This macro can be inserted to ensure adequate test coverage
275 ** in places where simple condition/decision coverage is inadequate.
276 */
277 #ifdef SQLITE_COVERAGE_TEST
278 SQLITE_PRIVATE void sqlite3Coverage(int);
279 # define testcase(X) if( X ){ sqlite3Coverage(__LINE__); }
280 # define TESTONLY(X) X
281 #else
282 # define testcase(X)
283 # define TESTONLY(X)
284 #endif
285
286 /*
287 ** The ALWAYS and NEVER macros surround boolean expressions which
288 ** are intended to always be true or false, respectively. Such
289 ** expressions could be omitted from the code completely. But they
290 ** are included in a few cases in order to enhance the resilience
291 ** of SQLite to unexpected behavior - to make the code "self-healing"
292 ** or "ductile" rather than being "brittle" and crashing at the first
293 ** hint of unplanned behavior.
294 **
295 ** When doing coverage testing ALWAYS and NEVER are hard-coded to
296 ** be true and false so that the unreachable code then specify will
297 ** not be counted as untested code.
298 */
299 #ifdef SQLITE_COVERAGE_TEST
300 # define ALWAYS(X) (1)
301 # define NEVER(X) (0)
302 #else
303 # define ALWAYS(X) (X)
304 # define NEVER(X) (X)
305 #endif
306
307 /*
308 ** The macro unlikely() is a hint that surrounds a boolean
309 ** expression that is usually false. Macro likely() surrounds
310 ** a boolean expression that is usually true. GCC is able to
311 ** use these hints to generate better code, sometimes.
312 */
313 #if defined(__GNUC__) && 0
314 # define likely(X) __builtin_expect((X),1)
315 # define unlikely(X) __builtin_expect((X),0)
316 #else
317 # define likely(X) !!(X)
318 # define unlikely(X) !!(X)
319 #endif
320
321 /*
322 * This macro is used to "hide" some ugliness in casting an int
323 * value to a ptr value under the MSVC 64-bit compiler. Casting
324 * non 64-bit values to ptr types results in a "hard" error with
325 * the MSVC 64-bit compiler which this attempts to avoid.
@@ -453,10 +409,77 @@
453 */
454 #if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
455 # define NDEBUG 1
456 #endif
457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
458 /*
459 ** Sometimes we need a small amount of code such as a variable initialization
460 ** to setup for a later assert() statement. We do not want this code to
461 ** appear when assert() is disabled. The following macro is therefore
462 ** used to contain that setup code. The "VVA" acronym stands for
@@ -8144,146 +8167,146 @@
8144 */
8145 /************** Include opcodes.h in the middle of vdbe.h ********************/
8146 /************** Begin file opcodes.h *****************************************/
8147 /* Automatically generated. Do not edit */
8148 /* See the mkopcodeh.awk script for details */
8149 #define OP_VCreate 1
8150 #define OP_MemMax 2
8151 #define OP_LoadAnalysis 3
8152 #define OP_RowData 4
8153 #define OP_CreateIndex 5
8154 #define OP_Variable 6
8155 #define OP_SeekGt 7
8156 #define OP_SeekLe 8
8157 #define OP_IfNeg 9
8158 #define OP_Clear 10
8159 #define OP_Last 11
8160 #define OP_Add 81 /* same as TK_PLUS */
8161 #define OP_Savepoint 12
8162 #define OP_Sequence 13
8163 #define OP_Int64 14
8164 #define OP_VBegin 15
8165 #define OP_RowKey 16
8166 #define OP_Divide 84 /* same as TK_SLASH */
8167 #define OP_SCopy 17
8168 #define OP_ResetCount 18
8169 #define OP_Delete 20
8170 #define OP_Trace 21
8171 #define OP_Rowid 22
8172 #define OP_OpenRead 23
8173 #define OP_Sort 24
8174 #define OP_VerifyCookie 25
8175 #define OP_VColumn 26
8176 #define OP_Next 27
8177 #define OP_Insert 28
8178 #define OP_Prev 29
8179 #define OP_IdxGE 30
8180 #define OP_Not 19 /* same as TK_NOT */
8181 #define OP_Ge 75 /* same as TK_GE */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8182 #define OP_VRename 31
8183 #define OP_DropTable 32
8184 #define OP_MakeRecord 33
8185 #define OP_Null 34
8186 #define OP_IdxInsert 35
8187 #define OP_SeekLt 36
8188 #define OP_ReadCookie 37
8189 #define OP_VDestroy 38
8190 #define OP_DropIndex 39
8191 #define OP_IsNull 68 /* same as TK_ISNULL */
8192 #define OP_MustBeInt 40
8193 #define OP_IntegrityCk 41
8194 #define OP_CollSeq 42
8195 #define OP_ResultRow 43
8196 #define OP_Yield 44
8197 #define OP_OpenEphemeral 45
8198 #define OP_VNext 46
8199 #define OP_Seek 47
8200 #define OP_Eq 71 /* same as TK_EQ */
8201 #define OP_String8 91 /* same as TK_STRING */
8202 #define OP_Found 48
8203 #define OP_If 49
8204 #define OP_ToBlob 142 /* same as TK_TO_BLOB */
8205 #define OP_Multiply 83 /* same as TK_STAR */
8206 #define OP_IfZero 50
8207 #define OP_ShiftRight 80 /* same as TK_RSHIFT */
8208 #define OP_Goto 51
8209 #define OP_Function 52
8210 #define OP_Copy 53
8211 #define OP_Jump 54
8212 #define OP_Blob 55
8213 #define OP_BitNot 90 /* same as TK_BITNOT */
8214 #define OP_Gt 72 /* same as TK_GT */
8215 #define OP_Le 73 /* same as TK_LE */
8216 #define OP_NullRow 56
8217 #define OP_Transaction 57
8218 #define OP_VUpdate 58
8219 #define OP_TableLock 59
8220 #define OP_IdxRowid 60
8221 #define OP_SetCookie 61
8222 #define OP_And 64 /* same as TK_AND */
8223 #define OP_ToNumeric 143 /* same as TK_TO_NUMERIC*/
8224 #define OP_ToText 141 /* same as TK_TO_TEXT */
8225 #define OP_ContextPush 62
8226 #define OP_DropTrigger 65
8227 #define OP_AutoCommit 66
8228 #define OP_Column 67
8229 #define OP_AddImm 76
8230 #define OP_Remainder 85 /* same as TK_REM */
8231 #define OP_ContextPop 87
8232 #define OP_IdxDelete 88
8233 #define OP_Ne 70 /* same as TK_NE */
8234 #define OP_ToInt 144 /* same as TK_TO_INT */
8235 #define OP_IncrVacuum 89
8236 #define OP_AggFinal 92
8237 #define OP_RealAffinity 93
8238 #define OP_Concat 86 /* same as TK_CONCAT */
8239 #define OP_Return 94
8240 #define OP_Expire 95
8241 #define OP_Rewind 96
8242 #define OP_Statement 97
8243 #define OP_BitOr 78 /* same as TK_BITOR */
8244 #define OP_Integer 98
8245 #define OP_Compare 99
8246 #define OP_Destroy 100
8247 #define OP_IdxLT 101
8248 #define OP_Affinity 102
8249 #define OP_Lt 74 /* same as TK_LT */
8250 #define OP_Subtract 82 /* same as TK_MINUS */
8251 #define OP_Vacuum 103
8252 #define OP_IfNot 104
8253 #define OP_Move 105
8254 #define OP_Explain 106
8255 #define OP_ParseSchema 107
8256 #define OP_NewRowid 108
8257 #define OP_SetNumColumns 109
8258 #define OP_BitAnd 77 /* same as TK_BITAND */
8259 #define OP_String 110
8260 #define OP_AggStep 111
8261 #define OP_VRowid 112
8262 #define OP_VOpen 113
8263 #define OP_NotExists 114
8264 #define OP_Close 115
8265 #define OP_Halt 116
8266 #define OP_Noop 117
8267 #define OP_SeekGe 118
8268 #define OP_VFilter 119
8269 #define OP_OpenPseudo 120
8270 #define OP_Or 63 /* same as TK_OR */
 
 
 
 
 
 
 
 
 
 
 
 
 
8271 #define OP_ShiftLeft 79 /* same as TK_LSHIFT */
 
 
 
 
 
 
 
 
8272 #define OP_ToReal 145 /* same as TK_TO_REAL */
8273 #define OP_RowSetRead 121
8274 #define OP_RowSetAdd 122
8275 #define OP_IsUnique 123
8276 #define OP_OpenWrite 124
8277 #define OP_Permutation 125
8278 #define OP_Gosub 126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8279 #define OP_IfPos 127
8280 #define OP_Real 129 /* same as TK_FLOAT */
8281 #define OP_NotNull 69 /* same as TK_NOTNULL */
8282 #define OP_Pagecount 128
8283 #define OP_NotFound 130
8284 #define OP_CreateTable 131
8285
8286 /* The following opcode values are never used */
8287 #define OP_NotUsed_132 132
8288 #define OP_NotUsed_133 133
8289 #define OP_NotUsed_134 134
@@ -8304,27 +8327,27 @@
8304 #define OPFLG_IN1 0x0004 /* in1: P1 is an input */
8305 #define OPFLG_IN2 0x0008 /* in2: P2 is an input */
8306 #define OPFLG_IN3 0x0010 /* in3: P3 is an input */
8307 #define OPFLG_OUT3 0x0020 /* out3: P3 is an output */
8308 #define OPFLG_INITIALIZER {\
8309 /* 0 */ 0x00, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x11,\
8310 /* 8 */ 0x11, 0x05, 0x00, 0x01, 0x00, 0x02, 0x02, 0x00,\
8311 /* 16 */ 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x02, 0x00,\
8312 /* 24 */ 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x11, 0x00,\
8313 /* 32 */ 0x00, 0x00, 0x02, 0x08, 0x11, 0x02, 0x00, 0x00,\
8314 /* 40 */ 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x08,\
8315 /* 48 */ 0x11, 0x05, 0x05, 0x01, 0x00, 0x04, 0x01, 0x02,\
8316 /* 56 */ 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x2c,\
8317 /* 64 */ 0x2c, 0x00, 0x00, 0x00, 0x05, 0x05, 0x15, 0x15,\
8318 /* 72 */ 0x15, 0x15, 0x15, 0x15, 0x04, 0x2c, 0x2c, 0x2c,\
8319 /* 80 */ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x00,\
8320 /* 88 */ 0x00, 0x01, 0x04, 0x02, 0x00, 0x04, 0x04, 0x00,\
8321 /* 96 */ 0x01, 0x00, 0x02, 0x00, 0x02, 0x11, 0x00, 0x00,\
8322 /* 104 */ 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00,\
8323 /* 112 */ 0x02, 0x00, 0x11, 0x00, 0x00, 0x00, 0x11, 0x01,\
8324 /* 120 */ 0x00, 0x21, 0x08, 0x11, 0x00, 0x00, 0x01, 0x05,\
8325 /* 128 */ 0x02, 0x02, 0x11, 0x02, 0x00, 0x00, 0x00, 0x00,\
8326 /* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04,\
8327 /* 144 */ 0x04, 0x04,}
8328
8329 /************** End of opcodes.h *********************************************/
8330 /************** Continuing where we left off in vdbe.h ***********************/
@@ -9357,10 +9380,11 @@
9357 */
9358 #define SQLITE_FUNC_LIKE 0x01 /* Candidate for the LIKE optimization */
9359 #define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */
9360 #define SQLITE_FUNC_EPHEM 0x04 /* Ephemeral. Delete with VDBE */
9361 #define SQLITE_FUNC_NEEDCOLL 0x08 /* sqlite3GetFuncCollSeq() might be called */
 
9362
9363 /*
9364 ** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are
9365 ** used to create the initializers for the FuncDef structures.
9366 **
@@ -10782,11 +10806,11 @@
10782 SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int, int);
10783 SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse*, int, int, int);
10784 SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, int, int, int);
10785 SQLITE_PRIVATE void sqlite3ExprClearColumnCache(Parse*, int);
10786 SQLITE_PRIVATE void sqlite3ExprCacheAffinityChange(Parse*, int, int);
10787 SQLITE_PRIVATE int sqlite3ExprWritableRegister(Parse*,int,int);
10788 SQLITE_PRIVATE void sqlite3ExprHardCopy(Parse*,int,int);
10789 SQLITE_PRIVATE int sqlite3ExprCode(Parse*, Expr*, int);
10790 SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*);
10791 SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse*, Expr*, int);
10792 SQLITE_PRIVATE int sqlite3ExprCodeAndCache(Parse*, Expr*, int);
@@ -18712,14 +18736,45 @@
18712 ** Utility functions used throughout sqlite.
18713 **
18714 ** This file contains functions for allocating memory, comparing
18715 ** strings, and stuff like that.
18716 **
18717 ** $Id: util.c,v 1.245 2008/12/10 22:15:00 drh Exp $
18718 */
18719
18720
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18721 /*
18722 ** Return true if the floating point value is Not a Number (NaN).
18723 */
18724 SQLITE_PRIVATE int sqlite3IsNaN(double x){
18725 /* This NaN test sometimes fails if compiled on GCC with -ffast-math.
@@ -19967,86 +20022,86 @@
19967 /* Automatically generated. Do not edit */
19968 /* See the mkopcodec.awk script for details. */
19969 #if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
19970 SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
19971 static const char *const azName[] = { "?",
19972 /* 1 */ "VCreate",
19973 /* 2 */ "MemMax",
19974 /* 3 */ "LoadAnalysis",
19975 /* 4 */ "RowData",
19976 /* 5 */ "CreateIndex",
19977 /* 6 */ "Variable",
19978 /* 7 */ "SeekGt",
19979 /* 8 */ "SeekLe",
19980 /* 9 */ "IfNeg",
19981 /* 10 */ "Clear",
19982 /* 11 */ "Last",
19983 /* 12 */ "Savepoint",
19984 /* 13 */ "Sequence",
19985 /* 14 */ "Int64",
19986 /* 15 */ "VBegin",
19987 /* 16 */ "RowKey",
19988 /* 17 */ "SCopy",
19989 /* 18 */ "ResetCount",
19990 /* 19 */ "Not",
19991 /* 20 */ "Delete",
19992 /* 21 */ "Trace",
19993 /* 22 */ "Rowid",
19994 /* 23 */ "OpenRead",
19995 /* 24 */ "Sort",
19996 /* 25 */ "VerifyCookie",
19997 /* 26 */ "VColumn",
19998 /* 27 */ "Next",
19999 /* 28 */ "Insert",
20000 /* 29 */ "Prev",
20001 /* 30 */ "IdxGE",
20002 /* 31 */ "VRename",
20003 /* 32 */ "DropTable",
20004 /* 33 */ "MakeRecord",
20005 /* 34 */ "Null",
20006 /* 35 */ "IdxInsert",
20007 /* 36 */ "SeekLt",
20008 /* 37 */ "ReadCookie",
20009 /* 38 */ "VDestroy",
20010 /* 39 */ "DropIndex",
20011 /* 40 */ "MustBeInt",
20012 /* 41 */ "IntegrityCk",
20013 /* 42 */ "CollSeq",
20014 /* 43 */ "ResultRow",
20015 /* 44 */ "Yield",
20016 /* 45 */ "OpenEphemeral",
20017 /* 46 */ "VNext",
20018 /* 47 */ "Seek",
20019 /* 48 */ "Found",
20020 /* 49 */ "If",
20021 /* 50 */ "IfZero",
20022 /* 51 */ "Goto",
20023 /* 52 */ "Function",
20024 /* 53 */ "Copy",
20025 /* 54 */ "Jump",
20026 /* 55 */ "Blob",
20027 /* 56 */ "NullRow",
20028 /* 57 */ "Transaction",
20029 /* 58 */ "VUpdate",
20030 /* 59 */ "TableLock",
20031 /* 60 */ "IdxRowid",
20032 /* 61 */ "SetCookie",
20033 /* 62 */ "ContextPush",
20034 /* 63 */ "Or",
20035 /* 64 */ "And",
20036 /* 65 */ "DropTrigger",
20037 /* 66 */ "AutoCommit",
20038 /* 67 */ "Column",
20039 /* 68 */ "IsNull",
20040 /* 69 */ "NotNull",
20041 /* 70 */ "Ne",
20042 /* 71 */ "Eq",
20043 /* 72 */ "Gt",
20044 /* 73 */ "Le",
20045 /* 74 */ "Lt",
20046 /* 75 */ "Ge",
20047 /* 76 */ "AddImm",
20048 /* 77 */ "BitAnd",
20049 /* 78 */ "BitOr",
20050 /* 79 */ "ShiftLeft",
20051 /* 80 */ "ShiftRight",
20052 /* 81 */ "Add",
@@ -20053,55 +20108,55 @@
20053 /* 82 */ "Subtract",
20054 /* 83 */ "Multiply",
20055 /* 84 */ "Divide",
20056 /* 85 */ "Remainder",
20057 /* 86 */ "Concat",
20058 /* 87 */ "ContextPop",
20059 /* 88 */ "IdxDelete",
20060 /* 89 */ "IncrVacuum",
20061 /* 90 */ "BitNot",
20062 /* 91 */ "String8",
20063 /* 92 */ "AggFinal",
20064 /* 93 */ "RealAffinity",
20065 /* 94 */ "Return",
20066 /* 95 */ "Expire",
20067 /* 96 */ "Rewind",
20068 /* 97 */ "Statement",
20069 /* 98 */ "Integer",
20070 /* 99 */ "Compare",
20071 /* 100 */ "Destroy",
20072 /* 101 */ "IdxLT",
20073 /* 102 */ "Affinity",
20074 /* 103 */ "Vacuum",
20075 /* 104 */ "IfNot",
20076 /* 105 */ "Move",
20077 /* 106 */ "Explain",
20078 /* 107 */ "ParseSchema",
20079 /* 108 */ "NewRowid",
20080 /* 109 */ "SetNumColumns",
20081 /* 110 */ "String",
20082 /* 111 */ "AggStep",
20083 /* 112 */ "VRowid",
20084 /* 113 */ "VOpen",
20085 /* 114 */ "NotExists",
20086 /* 115 */ "Close",
20087 /* 116 */ "Halt",
20088 /* 117 */ "Noop",
20089 /* 118 */ "SeekGe",
20090 /* 119 */ "VFilter",
20091 /* 120 */ "OpenPseudo",
20092 /* 121 */ "RowSetRead",
20093 /* 122 */ "RowSetAdd",
20094 /* 123 */ "IsUnique",
20095 /* 124 */ "OpenWrite",
20096 /* 125 */ "Permutation",
20097 /* 126 */ "Gosub",
20098 /* 127 */ "IfPos",
20099 /* 128 */ "Pagecount",
20100 /* 129 */ "Real",
20101 /* 130 */ "NotFound",
20102 /* 131 */ "CreateTable",
20103 /* 132 */ "NotUsed_132",
20104 /* 133 */ "NotUsed_133",
20105 /* 134 */ "NotUsed_134",
20106 /* 135 */ "NotUsed_135",
20107 /* 136 */ "NotUsed_136",
@@ -30390,10 +30445,12 @@
30390 ** output, it first sorts the linked list (removing duplicates during
30391 ** the sort) then returns elements one by one by walking the list.
30392 **
30393 ** Big chunks of rowid/next-ptr pairs are allocated at a time, to
30394 ** reduce the malloc overhead.
 
 
30395 */
30396
30397 /*
30398 ** The number of rowset entries per allocation chunk.
30399 */
@@ -30622,11 +30679,11 @@
30622 ** is separate from the database file. The pager also implements file
30623 ** locking to prevent two processes from writing the same database
30624 ** file simultaneously, or one process from reading the database while
30625 ** another is writing.
30626 **
30627 ** @(#) $Id: pager.c,v 1.544 2009/01/09 17:11:05 danielk1977 Exp $
30628 */
30629 #ifndef SQLITE_OMIT_DISKIO
30630
30631 /*
30632 ** Macros for troubleshooting. Normally turned off
@@ -30719,10 +30776,18 @@
30719 #else
30720 # define CODEC1(P,D,N,X) /* NO-OP */
30721 # define CODEC2(P,D,N,X) ((char*)D)
30722 #endif
30723
 
 
 
 
 
 
 
 
30724 /*
30725 ** An instance of the following structure is allocated for each active
30726 ** savepoint and statement transaction in the system. All such structures
30727 ** are stored in the Pager.aSavepoint[] array, which is allocated and
30728 ** resized using sqlite3Realloc().
@@ -30778,11 +30843,10 @@
30778 u8 state; /* PAGER_UNLOCK, _SHARED, _RESERVED, etc. */
30779 u8 tempFile; /* zFilename is a temporary file */
30780 u8 readOnly; /* True for a read-only database */
30781 u8 needSync; /* True if an fsync() is needed on the journal */
30782 u8 dirtyCache; /* True if cached pages have changed */
30783 u8 alwaysRollback; /* Disable DontRollback() for all pages */
30784 u8 memDb; /* True to inhibit all file I/O */
30785 u8 setMaster; /* True if a m-j name has been written to jrnl */
30786 u8 doNotSync; /* Boolean. While true, do not spill the cache */
30787 u8 exclusiveMode; /* Boolean. True if locking_mode==EXCLUSIVE */
30788 u8 journalMode; /* On of the PAGER_JOURNALMODE_* values */
@@ -31004,11 +31068,11 @@
31004 int szPage; /* Page size */
31005 sqlite3_file *fd = pPager->fd;
31006
31007 if( fd->pMethods ){
31008 dc = sqlite3OsDeviceCharacteristics(fd);
31009 nSector = sqlite3OsSectorSize(fd);
31010 szPage = pPager->pageSize;
31011 }
31012
31013 assert(SQLITE_IOCAP_ATOMIC512==(512>>8));
31014 assert(SQLITE_IOCAP_ATOMIC64K==(65536>>8));
@@ -31363,11 +31427,12 @@
31363 u32 *pDbSize
31364 ){
31365 int rc;
31366 unsigned char aMagic[8]; /* A buffer to hold the magic header */
31367 i64 jrnlOff;
31368 int iPageSize;
 
31369
31370 seekJournalHdr(pPager);
31371 if( pPager->journalOff+JOURNAL_HDR_SZ(pPager) > journalSize ){
31372 return SQLITE_DONE;
31373 }
@@ -31388,32 +31453,45 @@
31388 if( rc ) return rc;
31389
31390 rc = read32bits(pPager->jfd, jrnlOff+8, pDbSize);
31391 if( rc ) return rc;
31392
31393 rc = read32bits(pPager->jfd, jrnlOff+16, (u32 *)&iPageSize);
31394 if( rc==SQLITE_OK
31395 && iPageSize>=512
31396 && iPageSize<=SQLITE_MAX_PAGE_SIZE
31397 && ((iPageSize-1)&iPageSize)==0
31398 ){
31399 u16 pagesize = (u16)iPageSize;
31400 rc = sqlite3PagerSetPagesize(pPager, &pagesize);
31401 }
31402 if( rc ) return rc;
31403
31404 /* Update the assumed sector-size to match the value used by
31405 ** the process that created this journal. If this journal was
31406 ** created by a process other than this one, then this routine
31407 ** is being called from within pager_playback(). The local value
31408 ** of Pager.sectorSize is restored at the end of that routine.
31409 */
31410 rc = read32bits(pPager->jfd, jrnlOff+12, &pPager->sectorSize);
31411 if( rc ) return rc;
31412 if( (pPager->sectorSize & (pPager->sectorSize-1))!=0
31413 || pPager->sectorSize>0x1000000 ){
31414 return SQLITE_DONE;
 
 
 
 
 
 
 
 
 
 
 
 
 
31415 }
31416
31417 pPager->journalOff += JOURNAL_HDR_SZ(pPager);
31418 return SQLITE_OK;
31419 }
@@ -31567,14 +31645,11 @@
31567 ** on the pager file (by this or any other process), it will be
31568 ** treated as a hot-journal and rolled back.
31569 */
31570 static void pager_unlock(Pager *pPager){
31571 if( !pPager->exclusiveMode ){
31572 int rc = osUnlock(pPager->fd, NO_LOCK);
31573 if( rc ) pPager->errCode = rc;
31574 pPager->dbSizeValid = 0;
31575 IOTRACE(("UNLOCK %p\n", pPager))
31576
31577 /* Always close the journal file when dropping the database lock.
31578 ** Otherwise, another connection with journal_mode=delete might
31579 ** delete the file out from under us.
31580 */
@@ -31584,10 +31659,15 @@
31584 sqlite3BitvecDestroy(pPager->pInJournal);
31585 pPager->pInJournal = 0;
31586 sqlite3BitvecDestroy(pPager->pAlwaysRollback);
31587 pPager->pAlwaysRollback = 0;
31588 }
 
 
 
 
 
31589
31590 /* If Pager.errCode is set, the contents of the pager cache cannot be
31591 ** trusted. Now that the pager file is unlocked, the contents of the
31592 ** cache can be discarded and the error code safely cleared.
31593 */
@@ -32106,11 +32186,11 @@
32106
32107 /*
32108 ** Set the sectorSize for the given pager.
32109 **
32110 ** The sector size is at least as big as the sector size reported
32111 ** by sqlite3OsSectorSize(). The minimum sector size is 512.
32112 */
32113 static void setSectorSize(Pager *pPager){
32114 assert(pPager->fd->pMethods||pPager->tempFile);
32115 if( !pPager->tempFile ){
32116 /* Sector size doesn't matter for temporary files. Also, the file
@@ -32119,10 +32199,13 @@
32119 */
32120 pPager->sectorSize = sqlite3OsSectorSize(pPager->fd);
32121 }
32122 if( pPager->sectorSize<512 ){
32123 pPager->sectorSize = 512;
 
 
 
32124 }
32125 }
32126
32127 /*
32128 ** Playback the journal and thus restore the database file to
@@ -32625,13 +32708,13 @@
32625 ** + SQLITE_DEFAULT_PAGE_SIZE,
32626 ** + The value returned by sqlite3OsSectorSize()
32627 ** + The largest page size that can be written atomically.
32628 */
32629 if( rc==SQLITE_OK && !readOnly ){
32630 int iSectorSize = sqlite3OsSectorSize(pPager->fd);
32631 if( szPageDflt<iSectorSize ){
32632 szPageDflt = iSectorSize;
32633 }
32634 #ifdef SQLITE_ENABLE_ATOMIC_WRITE
32635 {
32636 int iDc = sqlite3OsDeviceCharacteristics(pPager->fd);
32637 int ii;
@@ -34215,23 +34298,16 @@
34215 /* If the PGHDR_NEED_SYNC flag is set for any of the nPage pages
34216 ** starting at pg1, then it needs to be set for all of them. Because
34217 ** writing to any of these nPage pages may damage the others, the
34218 ** journal file must contain sync()ed copies of all of them
34219 ** before any of them can be written out to the database file.
34220 **
34221 ** 2009-01-07: This block of code appears to be a no-op. I do not
34222 ** believe it is possible for any page on the sector to not have
34223 ** the PGHDR_NEED_SYNC flag set. The "pPage->flags |= PGHDR_NEED_SYNC"
34224 ** line below does nothing, I think. But it does no harm to leave
34225 ** this code in place until we can definitively prove this is the case.
34226 */
34227 if( needSync ){
34228 assert( !MEMDB && pPager->noSync==0 );
34229 for(ii=0; ii<nPage && needSync; ii++){
34230 PgHdr *pPage = pager_lookup(pPager, pg1+ii);
34231 if( pPage ){
34232 assert( pPage->flags & PGHDR_NEED_SYNC ); /* 2009-01-07 conjecture */
34233 pPage->flags |= PGHDR_NEED_SYNC;
34234 sqlite3PagerUnref(pPage);
34235 }
34236 }
34237 assert(pPager->needSync);
@@ -34269,20 +34345,20 @@
34269 **
34270 ** Tests show that this optimization, together with the
34271 ** sqlite3PagerDontRollback() below, more than double the speed
34272 ** of large INSERT operations and quadruple the speed of large DELETEs.
34273 **
34274 ** When this routine is called, set the alwaysRollback flag to true.
34275 ** Subsequent calls to sqlite3PagerDontRollback() for the same page
34276 ** will thereafter be ignored. This is necessary to avoid a problem
34277 ** where a page with data is added to the freelist during one part of
34278 ** a transaction then removed from the freelist during a later part
34279 ** of the same transaction and reused for some other purpose. When it
34280 ** is first added to the freelist, this routine is called. When reused,
34281 ** the sqlite3PagerDontRollback() routine is called. But because the
34282 ** page contains critical data, we still need to be sure it gets
34283 ** rolled back in spite of the sqlite3PagerDontRollback() call.
34284 */
34285 SQLITE_PRIVATE int sqlite3PagerDontWrite(DbPage *pDbPage){
34286 PgHdr *pPg = pDbPage;
34287 Pager *pPager = pPg->pPager;
34288 int rc;
@@ -34338,11 +34414,11 @@
34338 TESTONLY( int rc; ) /* Return value from sqlite3BitvecSet() */
34339
34340 assert( pPager->state>=PAGER_RESERVED );
34341
34342 /* If the journal file is not open, or DontWrite() has been called on
34343 ** this page (DontWrite() sets the alwaysRollback flag), then this
34344 ** function is a no-op.
34345 */
34346 if( pPager->journalOpen==0
34347 || sqlite3BitvecTest(pPager->pAlwaysRollback, pPg->pgno)
34348 || pPg->pgno>pPager->dbOrigSize
@@ -34754,12 +34830,14 @@
34754
34755 if( nSavepoint>pPager->nSavepoint && pPager->useJournal ){
34756 int ii;
34757 PagerSavepoint *aNew;
34758
34759 /* Either the sub-journal is open or there are no active savepoints. */
34760 assert( pPager->nSavepoint==0 || pPager->sjfd->pMethods );
 
 
34761
34762 /* Grow the Pager.aSavepoint array using realloc(). Return SQLITE_NOMEM
34763 ** if the allocation fails. Otherwise, zero the new portion in case a
34764 ** malloc failure occurs while populating it in the for(...) loop below.
34765 */
@@ -36078,11 +36156,11 @@
36078 ** May you do good and not evil.
36079 ** May you find forgiveness for yourself and forgive others.
36080 ** May you share freely, never taking more than you give.
36081 **
36082 *************************************************************************
36083 ** $Id: btree.c,v 1.557 2009/01/09 14:11:05 drh Exp $
36084 **
36085 ** This file implements a external (disk-based) database using BTrees.
36086 ** See the header comment on "btreeInt.h" for additional information.
36087 ** Including a description of file format and an overview of operation.
36088 */
@@ -43414,11 +43492,10 @@
43414 /*
43415 ** Return non-zero if a statement transaction is active.
43416 */
43417 SQLITE_PRIVATE int sqlite3BtreeIsInStmt(Btree *p){
43418 assert( sqlite3BtreeHoldsMutex(p) );
43419 assert( p->pBt );
43420 return ALWAYS(p->pBt) && p->pBt->inStmt;
43421 }
43422
43423 /*
43424 ** Return non-zero if a read (or write) transaction is active.
@@ -48544,11 +48621,11 @@
48544 ** documentation, headers files, or other derived files. The formatting
48545 ** of the code in this file is, therefore, important. See other comments
48546 ** in this file for details. If in doubt, do not deviate from existing
48547 ** commenting and indentation practices when changing or adding code.
48548 **
48549 ** $Id: vdbe.c,v 1.810 2009/01/05 22:30:39 drh Exp $
48550 */
48551
48552 /*
48553 ** The following global variable is incremented every time a cursor
48554 ** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test
@@ -52497,10 +52574,11 @@
52497 pCrsr = pC->pCursor;
52498 assert( pCrsr!=0 );
52499 rc = sqlite3BtreeLast(pCrsr, &res);
52500 pC->nullRow = (u8)res;
52501 pC->deferredMoveto = 0;
 
52502 pC->cacheStatus = CACHE_STALE;
52503 if( res && pOp->p2>0 ){
52504 pc = pOp->p2 - 1;
52505 }
52506 break;
@@ -52547,10 +52625,11 @@
52547 if( (pCrsr = pC->pCursor)!=0 ){
52548 rc = sqlite3BtreeFirst(pCrsr, &res);
52549 pC->atFirst = res==0 ?1:0;
52550 pC->deferredMoveto = 0;
52551 pC->cacheStatus = CACHE_STALE;
 
52552 }else{
52553 res = 1;
52554 }
52555 pC->nullRow = (u8)res;
52556 assert( pOp->p2>0 && pOp->p2<p->nOp );
@@ -56080,11 +56159,11 @@
56080 **
56081 *************************************************************************
56082 ** This file contains routines used for analyzing expressions and
56083 ** for generating VDBE code that evaluates expressions in SQLite.
56084 **
56085 ** $Id: expr.c,v 1.408 2008/12/15 15:27:52 drh Exp $
56086 */
56087
56088 /*
56089 ** Return the 'affinity' of the expression pExpr if any.
56090 **
@@ -56986,11 +57065,10 @@
56986 case TK_FUNCTION:
56987 if( pWalker->u.i==2 ) return 0;
56988 /* Fall through */
56989 case TK_ID:
56990 case TK_COLUMN:
56991 case TK_DOT:
56992 case TK_AGG_FUNCTION:
56993 case TK_AGG_COLUMN:
56994 #ifndef SQLITE_OMIT_SUBQUERY
56995 case TK_SELECT:
56996 case TK_EXISTS:
@@ -56997,11 +57075,10 @@
56997 testcase( pExpr->op==TK_SELECT );
56998 testcase( pExpr->op==TK_EXISTS );
56999 #endif
57000 testcase( pExpr->op==TK_ID );
57001 testcase( pExpr->op==TK_COLUMN );
57002 testcase( pExpr->op==TK_DOT );
57003 testcase( pExpr->op==TK_AGG_FUNCTION );
57004 testcase( pExpr->op==TK_AGG_COLUMN );
57005 pWalker->u.i = 0;
57006 return WRC_Abort;
57007 default:
@@ -57104,16 +57181,10 @@
57104 if( sqlite3StrICmp(z, "ROWID")==0 ) return 1;
57105 if( sqlite3StrICmp(z, "OID")==0 ) return 1;
57106 return 0;
57107 }
57108
57109 #ifdef SQLITE_TEST
57110 int sqlite3_enable_in_opt = 1;
57111 #else
57112 #define sqlite3_enable_in_opt 1
57113 #endif
57114
57115 /*
57116 ** Return true if the IN operator optimization is enabled and
57117 ** the SELECT statement p exists and is of the
57118 ** simple form:
57119 **
@@ -57125,11 +57196,10 @@
57125 #ifndef SQLITE_OMIT_SUBQUERY
57126 static int isCandidateForInOpt(Select *p){
57127 SrcList *pSrc;
57128 ExprList *pEList;
57129 Table *pTab;
57130 if( !sqlite3_enable_in_opt ) return 0; /* IN optimization must be enabled */
57131 if( p==0 ) return 0; /* right-hand side of IN is SELECT */
57132 if( p->pPrior ) return 0; /* Not a compound SELECT */
57133 if( p->selFlags & (SF_Distinct|SF_Aggregate) ){
57134 return 0; /* No DISTINCT keyword and no aggregate functions */
57135 }
@@ -57136,12 +57206,12 @@
57136 if( p->pGroupBy ) return 0; /* Has no GROUP BY clause */
57137 if( p->pLimit ) return 0; /* Has no LIMIT clause */
57138 if( p->pOffset ) return 0;
57139 if( p->pWhere ) return 0; /* Has no WHERE clause */
57140 pSrc = p->pSrc;
57141 if( pSrc==0 ) return 0; /* A single table in the FROM clause */
57142 if( pSrc->nSrc!=1 ) return 0;
57143 if( pSrc->a[0].pSelect ) return 0; /* FROM clause is not a subquery */
57144 pTab = pSrc->a[0].pTab;
57145 if( pTab==0 ) return 0;
57146 if( pTab->pSelect ) return 0; /* FROM clause is not a view */
57147 if( IsVirtual(pTab) ) return 0; /* FROM clause not a virtual table */
@@ -57724,37 +57794,26 @@
57724 }
57725 return 0;
57726 }
57727
57728 /*
57729 ** Theres is a value in register iCurrent. We ultimately want
57730 ** the value to be in register iTarget. It might be that
57731 ** iCurrent and iTarget are the same register.
57732 **
57733 ** We are going to modify the value, so we need to make sure it
57734 ** is not a cached register. If iCurrent is a cached register,
57735 ** then try to move the value over to iTarget. If iTarget is a
57736 ** cached register, then clear the corresponding cache line.
57737 **
57738 ** Return the register that the value ends up in.
57739 */
57740 SQLITE_PRIVATE int sqlite3ExprWritableRegister(Parse *pParse, int iCurrent, int iTarget){
57741 int i;
57742 assert( pParse->pVdbe!=0 );
57743 if( !usedAsColumnCache(pParse, iCurrent, iCurrent) ){
57744 return iCurrent;
57745 }
57746 if( iCurrent!=iTarget ){
57747 sqlite3VdbeAddOp2(pParse->pVdbe, OP_SCopy, iCurrent, iTarget);
57748 }
57749 for(i=0; i<pParse->nColCache; i++){
57750 if( pParse->aColCache[i].iReg==iTarget ){
57751 pParse->aColCache[i] = pParse->aColCache[--pParse->nColCache];
57752 pParse->iColCache = pParse->nColCache;
57753 }
57754 }
57755 return iTarget;
57756 }
57757
57758 /*
57759 ** If the last instruction coded is an ephemeral copy of any of
57760 ** the registers in the nReg registers beginning with iReg, then
@@ -59143,11 +59202,11 @@
59143 }
59144 return pParse->aTempReg[--pParse->nTempReg];
59145 }
59146 SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse *pParse, int iReg){
59147 if( iReg && pParse->nTempReg<ArraySize(pParse->aTempReg) ){
59148 sqlite3ExprWritableRegister(pParse, iReg, iReg);
59149 pParse->aTempReg[pParse->nTempReg++] = iReg;
59150 }
59151 }
59152
59153 /*
@@ -69985,11 +70044,11 @@
69985 ** May you share freely, never taking more than you give.
69986 **
69987 *************************************************************************
69988 ** This file contains code used to implement the PRAGMA command.
69989 **
69990 ** $Id: pragma.c,v 1.200 2009/01/09 21:41:17 drh Exp $
69991 */
69992
69993 /* Ignore this whole file if pragmas are disabled
69994 */
69995 #if !defined(SQLITE_OMIT_PRAGMA) && !defined(SQLITE_OMIT_PARSER)
@@ -70497,11 +70556,11 @@
70497
70498 /*
70499 ** PRAGMA [database.]journal_size_limit
70500 ** PRAGMA [database.]journal_size_limit=N
70501 **
70502 ** Get or set the (boolean) value of the database 'auto-vacuum' parameter.
70503 */
70504 if( sqlite3StrICmp(zLeft,"journal_size_limit")==0 ){
70505 Pager *pPager = sqlite3BtreePager(pDb->pBt);
70506 i64 iLimit = -2;
70507 if( zRight ){
@@ -70519,11 +70578,12 @@
70519
70520 /*
70521 ** PRAGMA [database.]auto_vacuum
70522 ** PRAGMA [database.]auto_vacuum=N
70523 **
70524 ** Get or set the (boolean) value of the database 'auto-vacuum' parameter.
 
70525 */
70526 #ifndef SQLITE_OMIT_AUTOVACUUM
70527 if( sqlite3StrICmp(zLeft,"auto_vacuum")==0 ){
70528 Btree *pBt = pDb->pBt;
70529 assert( pBt!=0 );
@@ -79313,11 +79373,11 @@
79313 ** generating the code that loops through a table looking for applicable
79314 ** rows. Indices are selected and used to speed the search when doing
79315 ** so is applicable. Because this module is responsible for selecting
79316 ** indices, you might also think of this module as the "query optimizer".
79317 **
79318 ** $Id: where.c,v 1.362 2009/01/09 02:49:32 drh Exp $
79319 */
79320
79321 /*
79322 ** Trace output macros
79323 */
@@ -80140,14 +80200,16 @@
80140 pAndWC = &pAndInfo->wc;
80141 whereClauseInit(pAndWC, pWC->pParse, pMaskSet);
80142 whereSplit(pAndWC, pOrTerm->pExpr, TK_AND);
80143 exprAnalyzeAll(pSrc, pAndWC);
80144 testcase( db->mallocFailed );
80145 for(j=0, pAndTerm=pAndWC->a; j<pAndWC->nTerm; j++, pAndTerm++){
80146 assert( pAndTerm->pExpr );
80147 if( allowedOp(pAndTerm->pExpr->op) ){
80148 b |= getMask(pMaskSet, pAndTerm->leftCursor);
 
 
80149 }
80150 }
80151 indexable &= b;
80152 }
80153 }else if( pOrTerm->wtFlags & TERM_COPIED ){
@@ -81140,10 +81202,11 @@
81140 && ((pTerm->prereqAll & ~maskSrc) & notReady)==0
81141 && (pTerm->u.pOrInfo->indexable & maskSrc)!=0 ){
81142 WhereClause *pOrWC = &pTerm->u.pOrInfo->wc;
81143 WhereTerm *pOrTerm;
81144 int j;
 
81145 double rTotal = 0;
81146 nRow = 0;
81147 for(j=0, pOrTerm=pOrWC->a; j<pOrWC->nTerm; j++, pOrTerm++){
81148 WhereCost sTermCost;
81149 WHERETRACE(("... Multi-index OR testing for term %d of %d....\n", j,i));
@@ -81158,22 +81221,27 @@
81158 continue;
81159 }
81160 rTotal += sTermCost.rCost;
81161 nRow += sTermCost.nRow;
81162 if( rTotal>=pCost->rCost ) break;
 
 
 
 
 
 
 
 
81163 }
81164 WHERETRACE(("... multi-index OR cost=%.9g nrow=%.9g\n",
81165 rTotal, nRow));
81166 if( rTotal<pCost->rCost ){
81167 pCost->rCost = rTotal;
81168 pCost->nRow = nRow;
81169 pCost->plan.wsFlags = WHERE_MULTI_OR;
81170 pCost->plan.u.pTerm = pTerm;
81171 if( pOrderBy!=0
81172 && sortableByRowid(iCur, pOrderBy, pWC->pMaskSet, &rev)
81173 && !rev
81174 ){
81175 pCost->plan.wsFlags = WHERE_ORDERBY|WHERE_MULTI_OR;
81176 }
81177 }
81178 }
81179 }
@@ -87024,11 +87092,11 @@
87024 ** Main file for the SQLite library. The routines in this file
87025 ** implement the programmer interface to the library. Routines in
87026 ** other files are for internal use by SQLite and should not be
87027 ** accessed by users of the library.
87028 **
87029 ** $Id: main.c,v 1.520 2008/12/17 17:30:26 danielk1977 Exp $
87030 */
87031
87032 #ifdef SQLITE_ENABLE_FTS3
87033 /************** Include fts3.h in the middle of main.c ***********************/
87034 /************** Begin file fts3.h ********************************************/
@@ -87550,20 +87618,10 @@
87550 }
87551 va_end(ap);
87552 return rc;
87553 }
87554
87555 /*
87556 ** Routine needed to support the testcase() macro.
87557 */
87558 #ifdef SQLITE_COVERAGE_TEST
87559 SQLITE_PRIVATE void sqlite3Coverage(int x){
87560 static int dummy = 0;
87561 dummy += x;
87562 }
87563 #endif
87564
87565
87566 /*
87567 ** Return true if the buffer z[0..n-1] contains all spaces.
87568 */
87569 static int allSpaces(const char *z, int n){
87570
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -15,11 +15,11 @@
15 ** needed if you want a wrapper to interface SQLite with your choice of
16 ** programming language. The code for the "sqlite3" command-line shell
17 ** is also in a separate file. This file contains only code for the core
18 ** SQLite library.
19 **
20 ** This amalgamation was generated on 2009-01-14 00:59:32 UTC.
21 */
22 #define SQLITE_CORE 1
23 #define SQLITE_AMALGAMATION 1
24 #ifndef SQLITE_PRIVATE
25 # define SQLITE_PRIVATE static
@@ -39,11 +39,11 @@
39 ** May you share freely, never taking more than you give.
40 **
41 *************************************************************************
42 ** Internal interface definitions for SQLite.
43 **
44 ** @(#) $Id: sqliteInt.h,v 1.823 2009/01/10 16:15:22 drh Exp $
45 */
46 #ifndef _SQLITEINT_H_
47 #define _SQLITEINT_H_
48
49 /*
@@ -68,11 +68,11 @@
68 **
69 *************************************************************************
70 **
71 ** This file defines various limits of what SQLite can process.
72 **
73 ** @(#) $Id: sqliteLimit.h,v 1.10 2009/01/10 16:15:09 danielk1977 Exp $
74 */
75
76 /*
77 ** The maximum length of a TEXT or BLOB in bytes. This also
78 ** limits the size of a row in a table or index.
@@ -186,10 +186,17 @@
186 #endif
187
188 /* Maximum page size. The upper bound on this value is 32768. This a limit
189 ** imposed by the necessity of storing the value in a 2-byte unsigned integer
190 ** and the fact that the page size must be a power of 2.
191 **
192 ** If this limit is changed, then the compiled library is technically
193 ** incompatible with an SQLite library compiled with a different limit. If
194 ** a process operating on a database with a page-size of 65536 bytes
195 ** crashes, then an instance of SQLite compiled with the default page-size
196 ** limit will not be able to rollback the aborted transaction. This could
197 ** lead to database corruption.
198 */
199 #ifndef SQLITE_MAX_PAGE_SIZE
200 # define SQLITE_MAX_PAGE_SIZE 32768
201 #endif
202
@@ -265,61 +272,10 @@
272 #endif
273 #ifdef HAVE_INTTYPES_H
274 #include <inttypes.h>
275 #endif
276
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277 /*
278 * This macro is used to "hide" some ugliness in casting an int
279 * value to a ptr value under the MSVC 64-bit compiler. Casting
280 * non 64-bit values to ptr types results in a "hard" error with
281 * the MSVC 64-bit compiler which this attempts to avoid.
@@ -453,10 +409,77 @@
409 */
410 #if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
411 # define NDEBUG 1
412 #endif
413
414 /*
415 ** The testcase() macro is used to aid in coverage testing. When
416 ** doing coverage testing, the condition inside the argument to
417 ** testcase() must be evaluated both true and false in order to
418 ** get full branch coverage. The testcase() macro is inserted
419 ** to help ensure adequate test coverage in places where simple
420 ** condition/decision coverage is inadequate. For example, testcase()
421 ** can be used to make sure boundary values are tested. For
422 ** bitmask tests, testcase() can be used to make sure each bit
423 ** is significant and used at least once. On switch statements
424 ** where multiple cases go to the same block of code, testcase()
425 ** can insure that all cases are evaluated.
426 **
427 ** The TESTONLY macro is used to enclose variable declarations or
428 ** other bits of code that are needed to support the arguments
429 ** within testcase() macros.
430 */
431 #ifdef SQLITE_COVERAGE_TEST
432 SQLITE_PRIVATE void sqlite3Coverage(int);
433 # define testcase(X) if( X ){ sqlite3Coverage(__LINE__); }
434 # define TESTONLY(X) X
435 #else
436 # define testcase(X)
437 # define TESTONLY(X)
438 #endif
439
440 /*
441 ** The ALWAYS and NEVER macros surround boolean expressions which
442 ** are intended to always be true or false, respectively. Such
443 ** expressions could be omitted from the code completely. But they
444 ** are included in a few cases in order to enhance the resilience
445 ** of SQLite to unexpected behavior - to make the code "self-healing"
446 ** or "ductile" rather than being "brittle" and crashing at the first
447 ** hint of unplanned behavior.
448 **
449 ** In other words, ALWAYS and NEVER are added for defensive code.
450 **
451 ** When doing coverage testing ALWAYS and NEVER are hard-coded to
452 ** be true and false so that the unreachable code then specify will
453 ** not be counted as untested code.
454 */
455 #if defined(SQLITE_COVERAGE_TEST)
456 # define ALWAYS(X) (1)
457 # define NEVER(X) (0)
458 #elif !defined(NDEBUG)
459 SQLITE_PRIVATE int sqlite3Assert(void);
460 # define ALWAYS(X) ((X)?1:sqlite3Assert())
461 # define NEVER(X) ((X)?sqlite3Assert():0)
462 #else
463 # define ALWAYS(X) (X)
464 # define NEVER(X) (X)
465 #endif
466
467 /*
468 ** The macro unlikely() is a hint that surrounds a boolean
469 ** expression that is usually false. Macro likely() surrounds
470 ** a boolean expression that is usually true. GCC is able to
471 ** use these hints to generate better code, sometimes.
472 */
473 #if defined(__GNUC__) && 0
474 # define likely(X) __builtin_expect((X),1)
475 # define unlikely(X) __builtin_expect((X),0)
476 #else
477 # define likely(X) !!(X)
478 # define unlikely(X) !!(X)
479 #endif
480
481 /*
482 ** Sometimes we need a small amount of code such as a variable initialization
483 ** to setup for a later assert() statement. We do not want this code to
484 ** appear when assert() is disabled. The following macro is therefore
485 ** used to contain that setup code. The "VVA" acronym stands for
@@ -8144,146 +8167,146 @@
8167 */
8168 /************** Include opcodes.h in the middle of vdbe.h ********************/
8169 /************** Begin file opcodes.h *****************************************/
8170 /* Automatically generated. Do not edit */
8171 /* See the mkopcodeh.awk script for details */
8172 #define OP_VNext 1
8173 #define OP_Affinity 2
8174 #define OP_Column 3
8175 #define OP_SetCookie 4
8176 #define OP_Seek 5
8177 #define OP_Real 129 /* same as TK_FLOAT */
8178 #define OP_Sequence 6
8179 #define OP_Savepoint 7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8180 #define OP_Ge 75 /* same as TK_GE */
8181 #define OP_RowKey 8
8182 #define OP_SCopy 9
8183 #define OP_Eq 71 /* same as TK_EQ */
8184 #define OP_OpenWrite 10
8185 #define OP_NotNull 69 /* same as TK_NOTNULL */
8186 #define OP_If 11
8187 #define OP_ToInt 144 /* same as TK_TO_INT */
8188 #define OP_String8 91 /* same as TK_STRING */
8189 #define OP_VRowid 12
8190 #define OP_CollSeq 13
8191 #define OP_OpenRead 14
8192 #define OP_Expire 15
8193 #define OP_AutoCommit 16
8194 #define OP_Gt 72 /* same as TK_GT */
8195 #define OP_Pagecount 17
8196 #define OP_IntegrityCk 18
8197 #define OP_Sort 20
8198 #define OP_Copy 21
8199 #define OP_Trace 22
8200 #define OP_Function 23
8201 #define OP_IfNeg 24
8202 #define OP_And 64 /* same as TK_AND */
8203 #define OP_Subtract 82 /* same as TK_MINUS */
8204 #define OP_Noop 25
8205 #define OP_Return 26
8206 #define OP_Remainder 85 /* same as TK_REM */
8207 #define OP_NewRowid 27
8208 #define OP_Multiply 83 /* same as TK_STAR */
8209 #define OP_Variable 28
8210 #define OP_String 29
8211 #define OP_RealAffinity 30
8212 #define OP_VRename 31
8213 #define OP_ParseSchema 32
8214 #define OP_VOpen 33
8215 #define OP_Close 34
8216 #define OP_CreateIndex 35
8217 #define OP_IsUnique 36
8218 #define OP_NotFound 37
8219 #define OP_Int64 38
8220 #define OP_MustBeInt 39
8221 #define OP_Halt 40
8222 #define OP_Rowid 41
8223 #define OP_IdxLT 42
8224 #define OP_AddImm 43
8225 #define OP_Statement 44
8226 #define OP_RowData 45
8227 #define OP_MemMax 46
8228 #define OP_Or 63 /* same as TK_OR */
8229 #define OP_NotExists 47
8230 #define OP_Gosub 48
8231 #define OP_Divide 84 /* same as TK_SLASH */
8232 #define OP_Integer 49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8233 #define OP_ToNumeric 143 /* same as TK_TO_NUMERIC*/
8234 #define OP_Prev 50
8235 #define OP_RowSetRead 51
 
 
 
 
 
 
 
 
 
 
 
 
8236 #define OP_Concat 86 /* same as TK_CONCAT */
8237 #define OP_RowSetAdd 52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8238 #define OP_BitAnd 77 /* same as TK_BITAND */
8239 #define OP_VColumn 53
8240 #define OP_CreateTable 54
8241 #define OP_Last 55
8242 #define OP_SeekLe 56
8243 #define OP_IsNull 68 /* same as TK_ISNULL */
8244 #define OP_IncrVacuum 57
8245 #define OP_IdxRowid 58
8246 #define OP_ShiftRight 80 /* same as TK_RSHIFT */
8247 #define OP_ResetCount 59
8248 #define OP_ContextPush 60
8249 #define OP_Yield 61
8250 #define OP_DropTrigger 62
8251 #define OP_DropIndex 65
8252 #define OP_IdxGE 66
8253 #define OP_IdxDelete 67
8254 #define OP_Vacuum 76
8255 #define OP_IfNot 87
8256 #define OP_DropTable 88
8257 #define OP_SeekLt 89
8258 #define OP_MakeRecord 92
8259 #define OP_ToBlob 142 /* same as TK_TO_BLOB */
8260 #define OP_ResultRow 93
8261 #define OP_Delete 94
8262 #define OP_AggFinal 95
8263 #define OP_Compare 96
8264 #define OP_ShiftLeft 79 /* same as TK_LSHIFT */
8265 #define OP_Goto 97
8266 #define OP_TableLock 98
8267 #define OP_Clear 99
8268 #define OP_Le 73 /* same as TK_LE */
8269 #define OP_VerifyCookie 100
8270 #define OP_AggStep 101
8271 #define OP_ToText 141 /* same as TK_TO_TEXT */
8272 #define OP_Not 19 /* same as TK_NOT */
8273 #define OP_ToReal 145 /* same as TK_TO_REAL */
8274 #define OP_SetNumColumns 102
8275 #define OP_Transaction 103
8276 #define OP_VFilter 104
8277 #define OP_Ne 70 /* same as TK_NE */
8278 #define OP_VDestroy 105
8279 #define OP_ContextPop 106
8280 #define OP_BitOr 78 /* same as TK_BITOR */
8281 #define OP_Next 107
8282 #define OP_IdxInsert 108
8283 #define OP_Lt 74 /* same as TK_LT */
8284 #define OP_SeekGe 109
8285 #define OP_Insert 110
8286 #define OP_Destroy 111
8287 #define OP_ReadCookie 112
8288 #define OP_LoadAnalysis 113
8289 #define OP_Explain 114
8290 #define OP_OpenPseudo 115
8291 #define OP_OpenEphemeral 116
8292 #define OP_Null 117
8293 #define OP_Move 118
8294 #define OP_Blob 119
8295 #define OP_Add 81 /* same as TK_PLUS */
8296 #define OP_Rewind 120
8297 #define OP_SeekGt 121
8298 #define OP_VBegin 122
8299 #define OP_VUpdate 123
8300 #define OP_IfZero 124
8301 #define OP_BitNot 90 /* same as TK_BITNOT */
8302 #define OP_VCreate 125
8303 #define OP_Found 126
8304 #define OP_IfPos 127
8305 #define OP_NullRow 128
8306 #define OP_Jump 130
8307 #define OP_Permutation 131
 
 
8308
8309 /* The following opcode values are never used */
8310 #define OP_NotUsed_132 132
8311 #define OP_NotUsed_133 133
8312 #define OP_NotUsed_134 134
@@ -8304,27 +8327,27 @@
8327 #define OPFLG_IN1 0x0004 /* in1: P1 is an input */
8328 #define OPFLG_IN2 0x0008 /* in2: P2 is an input */
8329 #define OPFLG_IN3 0x0010 /* in3: P3 is an input */
8330 #define OPFLG_OUT3 0x0020 /* out3: P3 is an output */
8331 #define OPFLG_INITIALIZER {\
8332 /* 0 */ 0x00, 0x01, 0x00, 0x00, 0x10, 0x08, 0x02, 0x00,\
8333 /* 8 */ 0x00, 0x04, 0x00, 0x05, 0x02, 0x00, 0x00, 0x00,\
8334 /* 16 */ 0x00, 0x02, 0x00, 0x04, 0x01, 0x04, 0x00, 0x00,\
8335 /* 24 */ 0x05, 0x00, 0x04, 0x02, 0x02, 0x02, 0x04, 0x00,\
8336 /* 32 */ 0x00, 0x00, 0x00, 0x02, 0x11, 0x11, 0x02, 0x05,\
8337 /* 40 */ 0x00, 0x02, 0x11, 0x04, 0x00, 0x00, 0x0c, 0x11,\
8338 /* 48 */ 0x01, 0x02, 0x01, 0x21, 0x08, 0x00, 0x02, 0x01,\
8339 /* 56 */ 0x11, 0x01, 0x02, 0x00, 0x00, 0x04, 0x00, 0x2c,\
8340 /* 64 */ 0x2c, 0x00, 0x11, 0x00, 0x05, 0x05, 0x15, 0x15,\
8341 /* 72 */ 0x15, 0x15, 0x15, 0x15, 0x00, 0x2c, 0x2c, 0x2c,\
8342 /* 80 */ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x05,\
8343 /* 88 */ 0x00, 0x11, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00,\
8344 /* 96 */ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
8345 /* 104 */ 0x01, 0x00, 0x00, 0x01, 0x08, 0x11, 0x00, 0x02,\
8346 /* 112 */ 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02,\
8347 /* 120 */ 0x01, 0x11, 0x00, 0x00, 0x05, 0x00, 0x11, 0x05,\
8348 /* 128 */ 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,\
8349 /* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04,\
8350 /* 144 */ 0x04, 0x04,}
8351
8352 /************** End of opcodes.h *********************************************/
8353 /************** Continuing where we left off in vdbe.h ***********************/
@@ -9357,10 +9380,11 @@
9380 */
9381 #define SQLITE_FUNC_LIKE 0x01 /* Candidate for the LIKE optimization */
9382 #define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */
9383 #define SQLITE_FUNC_EPHEM 0x04 /* Ephemeral. Delete with VDBE */
9384 #define SQLITE_FUNC_NEEDCOLL 0x08 /* sqlite3GetFuncCollSeq() might be called */
9385 #define SQLITE_FUNC_PRIVATE 0x10 /* Allowed for internal use only */
9386
9387 /*
9388 ** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are
9389 ** used to create the initializers for the FuncDef structures.
9390 **
@@ -10782,11 +10806,11 @@
10806 SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int, int);
10807 SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse*, int, int, int);
10808 SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, int, int, int);
10809 SQLITE_PRIVATE void sqlite3ExprClearColumnCache(Parse*, int);
10810 SQLITE_PRIVATE void sqlite3ExprCacheAffinityChange(Parse*, int, int);
10811 SQLITE_PRIVATE void sqlite3ExprWritableRegister(Parse*,int);
10812 SQLITE_PRIVATE void sqlite3ExprHardCopy(Parse*,int,int);
10813 SQLITE_PRIVATE int sqlite3ExprCode(Parse*, Expr*, int);
10814 SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*);
10815 SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse*, Expr*, int);
10816 SQLITE_PRIVATE int sqlite3ExprCodeAndCache(Parse*, Expr*, int);
@@ -18712,14 +18736,45 @@
18736 ** Utility functions used throughout sqlite.
18737 **
18738 ** This file contains functions for allocating memory, comparing
18739 ** strings, and stuff like that.
18740 **
18741 ** $Id: util.c,v 1.246 2009/01/10 16:15:22 drh Exp $
18742 */
18743
18744
18745 /*
18746 ** Routine needed to support the testcase() macro.
18747 */
18748 #ifdef SQLITE_COVERAGE_TEST
18749 SQLITE_PRIVATE void sqlite3Coverage(int x){
18750 static int dummy = 0;
18751 dummy += x;
18752 }
18753 #endif
18754
18755 /*
18756 ** Routine needed to support the ALWAYS() and NEVER() macros.
18757 **
18758 ** The argument to ALWAYS() should always be true and the argument
18759 ** to NEVER() should always be false. If either is not the case
18760 ** then this routine is called in order to throw an error.
18761 **
18762 ** This routine only exists if assert() is operational. It always
18763 ** throws an assert on its first invocation. The variable has a long
18764 ** name to help the assert() message be more readable. The variable
18765 ** is used to prevent a too-clever optimizer from optimizing out the
18766 ** entire call.
18767 */
18768 #ifndef NDEBUG
18769 SQLITE_PRIVATE int sqlite3Assert(void){
18770 static volatile int ALWAYS_was_false_or_NEVER_was_true = 0;
18771 assert( ALWAYS_was_false_or_NEVER_was_true ); /* Always fails */
18772 return ALWAYS_was_false_or_NEVER_was_true++; /* Not Reached */
18773 }
18774 #endif
18775
18776 /*
18777 ** Return true if the floating point value is Not a Number (NaN).
18778 */
18779 SQLITE_PRIVATE int sqlite3IsNaN(double x){
18780 /* This NaN test sometimes fails if compiled on GCC with -ffast-math.
@@ -19967,86 +20022,86 @@
20022 /* Automatically generated. Do not edit */
20023 /* See the mkopcodec.awk script for details. */
20024 #if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
20025 SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
20026 static const char *const azName[] = { "?",
20027 /* 1 */ "VNext",
20028 /* 2 */ "Affinity",
20029 /* 3 */ "Column",
20030 /* 4 */ "SetCookie",
20031 /* 5 */ "Seek",
20032 /* 6 */ "Sequence",
20033 /* 7 */ "Savepoint",
20034 /* 8 */ "RowKey",
20035 /* 9 */ "SCopy",
20036 /* 10 */ "OpenWrite",
20037 /* 11 */ "If",
20038 /* 12 */ "VRowid",
20039 /* 13 */ "CollSeq",
20040 /* 14 */ "OpenRead",
20041 /* 15 */ "Expire",
20042 /* 16 */ "AutoCommit",
20043 /* 17 */ "Pagecount",
20044 /* 18 */ "IntegrityCk",
20045 /* 19 */ "Not",
20046 /* 20 */ "Sort",
20047 /* 21 */ "Copy",
20048 /* 22 */ "Trace",
20049 /* 23 */ "Function",
20050 /* 24 */ "IfNeg",
20051 /* 25 */ "Noop",
20052 /* 26 */ "Return",
20053 /* 27 */ "NewRowid",
20054 /* 28 */ "Variable",
20055 /* 29 */ "String",
20056 /* 30 */ "RealAffinity",
20057 /* 31 */ "VRename",
20058 /* 32 */ "ParseSchema",
20059 /* 33 */ "VOpen",
20060 /* 34 */ "Close",
20061 /* 35 */ "CreateIndex",
20062 /* 36 */ "IsUnique",
20063 /* 37 */ "NotFound",
20064 /* 38 */ "Int64",
20065 /* 39 */ "MustBeInt",
20066 /* 40 */ "Halt",
20067 /* 41 */ "Rowid",
20068 /* 42 */ "IdxLT",
20069 /* 43 */ "AddImm",
20070 /* 44 */ "Statement",
20071 /* 45 */ "RowData",
20072 /* 46 */ "MemMax",
20073 /* 47 */ "NotExists",
20074 /* 48 */ "Gosub",
20075 /* 49 */ "Integer",
20076 /* 50 */ "Prev",
20077 /* 51 */ "RowSetRead",
20078 /* 52 */ "RowSetAdd",
20079 /* 53 */ "VColumn",
20080 /* 54 */ "CreateTable",
20081 /* 55 */ "Last",
20082 /* 56 */ "SeekLe",
20083 /* 57 */ "IncrVacuum",
20084 /* 58 */ "IdxRowid",
20085 /* 59 */ "ResetCount",
20086 /* 60 */ "ContextPush",
20087 /* 61 */ "Yield",
20088 /* 62 */ "DropTrigger",
20089 /* 63 */ "Or",
20090 /* 64 */ "And",
20091 /* 65 */ "DropIndex",
20092 /* 66 */ "IdxGE",
20093 /* 67 */ "IdxDelete",
20094 /* 68 */ "IsNull",
20095 /* 69 */ "NotNull",
20096 /* 70 */ "Ne",
20097 /* 71 */ "Eq",
20098 /* 72 */ "Gt",
20099 /* 73 */ "Le",
20100 /* 74 */ "Lt",
20101 /* 75 */ "Ge",
20102 /* 76 */ "Vacuum",
20103 /* 77 */ "BitAnd",
20104 /* 78 */ "BitOr",
20105 /* 79 */ "ShiftLeft",
20106 /* 80 */ "ShiftRight",
20107 /* 81 */ "Add",
@@ -20053,55 +20108,55 @@
20108 /* 82 */ "Subtract",
20109 /* 83 */ "Multiply",
20110 /* 84 */ "Divide",
20111 /* 85 */ "Remainder",
20112 /* 86 */ "Concat",
20113 /* 87 */ "IfNot",
20114 /* 88 */ "DropTable",
20115 /* 89 */ "SeekLt",
20116 /* 90 */ "BitNot",
20117 /* 91 */ "String8",
20118 /* 92 */ "MakeRecord",
20119 /* 93 */ "ResultRow",
20120 /* 94 */ "Delete",
20121 /* 95 */ "AggFinal",
20122 /* 96 */ "Compare",
20123 /* 97 */ "Goto",
20124 /* 98 */ "TableLock",
20125 /* 99 */ "Clear",
20126 /* 100 */ "VerifyCookie",
20127 /* 101 */ "AggStep",
20128 /* 102 */ "SetNumColumns",
20129 /* 103 */ "Transaction",
20130 /* 104 */ "VFilter",
20131 /* 105 */ "VDestroy",
20132 /* 106 */ "ContextPop",
20133 /* 107 */ "Next",
20134 /* 108 */ "IdxInsert",
20135 /* 109 */ "SeekGe",
20136 /* 110 */ "Insert",
20137 /* 111 */ "Destroy",
20138 /* 112 */ "ReadCookie",
20139 /* 113 */ "LoadAnalysis",
20140 /* 114 */ "Explain",
20141 /* 115 */ "OpenPseudo",
20142 /* 116 */ "OpenEphemeral",
20143 /* 117 */ "Null",
20144 /* 118 */ "Move",
20145 /* 119 */ "Blob",
20146 /* 120 */ "Rewind",
20147 /* 121 */ "SeekGt",
20148 /* 122 */ "VBegin",
20149 /* 123 */ "VUpdate",
20150 /* 124 */ "IfZero",
20151 /* 125 */ "VCreate",
20152 /* 126 */ "Found",
20153 /* 127 */ "IfPos",
20154 /* 128 */ "NullRow",
20155 /* 129 */ "Real",
20156 /* 130 */ "Jump",
20157 /* 131 */ "Permutation",
20158 /* 132 */ "NotUsed_132",
20159 /* 133 */ "NotUsed_133",
20160 /* 134 */ "NotUsed_134",
20161 /* 135 */ "NotUsed_135",
20162 /* 136 */ "NotUsed_136",
@@ -30390,10 +30445,12 @@
30445 ** output, it first sorts the linked list (removing duplicates during
30446 ** the sort) then returns elements one by one by walking the list.
30447 **
30448 ** Big chunks of rowid/next-ptr pairs are allocated at a time, to
30449 ** reduce the malloc overhead.
30450 **
30451 ** $Id: rowset.c,v 1.3 2009/01/13 20:14:16 drh Exp $
30452 */
30453
30454 /*
30455 ** The number of rowset entries per allocation chunk.
30456 */
@@ -30622,11 +30679,11 @@
30679 ** is separate from the database file. The pager also implements file
30680 ** locking to prevent two processes from writing the same database
30681 ** file simultaneously, or one process from reading the database while
30682 ** another is writing.
30683 **
30684 ** @(#) $Id: pager.c,v 1.549 2009/01/13 16:03:44 danielk1977 Exp $
30685 */
30686 #ifndef SQLITE_OMIT_DISKIO
30687
30688 /*
30689 ** Macros for troubleshooting. Normally turned off
@@ -30719,10 +30776,18 @@
30776 #else
30777 # define CODEC1(P,D,N,X) /* NO-OP */
30778 # define CODEC2(P,D,N,X) ((char*)D)
30779 #endif
30780
30781 /*
30782 ** The maximum allowed sector size. 16MB. If the xSectorsize() method
30783 ** returns a value larger than this, then MAX_SECTOR_SIZE is used instead.
30784 ** This could conceivably cause corruption following a power failure on
30785 ** such a system. This is currently an undocumented limit.
30786 */
30787 #define MAX_SECTOR_SIZE 0x0100000
30788
30789 /*
30790 ** An instance of the following structure is allocated for each active
30791 ** savepoint and statement transaction in the system. All such structures
30792 ** are stored in the Pager.aSavepoint[] array, which is allocated and
30793 ** resized using sqlite3Realloc().
@@ -30778,11 +30843,10 @@
30843 u8 state; /* PAGER_UNLOCK, _SHARED, _RESERVED, etc. */
30844 u8 tempFile; /* zFilename is a temporary file */
30845 u8 readOnly; /* True for a read-only database */
30846 u8 needSync; /* True if an fsync() is needed on the journal */
30847 u8 dirtyCache; /* True if cached pages have changed */
 
30848 u8 memDb; /* True to inhibit all file I/O */
30849 u8 setMaster; /* True if a m-j name has been written to jrnl */
30850 u8 doNotSync; /* Boolean. While true, do not spill the cache */
30851 u8 exclusiveMode; /* Boolean. True if locking_mode==EXCLUSIVE */
30852 u8 journalMode; /* On of the PAGER_JOURNALMODE_* values */
@@ -31004,11 +31068,11 @@
31068 int szPage; /* Page size */
31069 sqlite3_file *fd = pPager->fd;
31070
31071 if( fd->pMethods ){
31072 dc = sqlite3OsDeviceCharacteristics(fd);
31073 nSector = pPager->sectorSize;
31074 szPage = pPager->pageSize;
31075 }
31076
31077 assert(SQLITE_IOCAP_ATOMIC512==(512>>8));
31078 assert(SQLITE_IOCAP_ATOMIC64K==(65536>>8));
@@ -31363,11 +31427,12 @@
31427 u32 *pDbSize
31428 ){
31429 int rc;
31430 unsigned char aMagic[8]; /* A buffer to hold the magic header */
31431 i64 jrnlOff;
31432 u32 iPageSize;
31433 u32 iSectorSize;
31434
31435 seekJournalHdr(pPager);
31436 if( pPager->journalOff+JOURNAL_HDR_SZ(pPager) > journalSize ){
31437 return SQLITE_DONE;
31438 }
@@ -31388,32 +31453,45 @@
31453 if( rc ) return rc;
31454
31455 rc = read32bits(pPager->jfd, jrnlOff+8, pDbSize);
31456 if( rc ) return rc;
31457
31458 if( pPager->journalOff==0 ){
31459 rc = read32bits(pPager->jfd, jrnlOff+16, &iPageSize);
31460 if( rc ) return rc;
31461
31462 if( iPageSize<512
31463 || iPageSize>SQLITE_MAX_PAGE_SIZE
31464 || ((iPageSize-1)&iPageSize)!=0
31465 ){
31466 /* If the page-size in the journal-header is invalid, then the process
31467 ** that wrote the journal-header must have crashed before the header
31468 ** was synced. In this case stop reading the journal file here.
31469 */
31470 rc = SQLITE_DONE;
31471 }else{
31472 u16 pagesize = (u16)iPageSize;
31473 rc = sqlite3PagerSetPagesize(pPager, &pagesize);
31474 assert( rc!=SQLITE_OK || pagesize==(u16)iPageSize );
31475 }
31476 if( rc ) return rc;
31477
31478 /* Update the assumed sector-size to match the value used by
31479 ** the process that created this journal. If this journal was
31480 ** created by a process other than this one, then this routine
31481 ** is being called from within pager_playback(). The local value
31482 ** of Pager.sectorSize is restored at the end of that routine.
31483 */
31484 rc = read32bits(pPager->jfd, jrnlOff+12, &iSectorSize);
31485 if( rc ) return rc;
31486 if( (iSectorSize&(iSectorSize-1))
31487 || iSectorSize<512
31488 || iSectorSize>MAX_SECTOR_SIZE
31489 ){
31490 return SQLITE_DONE;
31491 }
31492 pPager->sectorSize = iSectorSize;
31493 }
31494
31495 pPager->journalOff += JOURNAL_HDR_SZ(pPager);
31496 return SQLITE_OK;
31497 }
@@ -31567,14 +31645,11 @@
31645 ** on the pager file (by this or any other process), it will be
31646 ** treated as a hot-journal and rolled back.
31647 */
31648 static void pager_unlock(Pager *pPager){
31649 if( !pPager->exclusiveMode ){
31650 int rc;
 
 
 
31651
31652 /* Always close the journal file when dropping the database lock.
31653 ** Otherwise, another connection with journal_mode=delete might
31654 ** delete the file out from under us.
31655 */
@@ -31584,10 +31659,15 @@
31659 sqlite3BitvecDestroy(pPager->pInJournal);
31660 pPager->pInJournal = 0;
31661 sqlite3BitvecDestroy(pPager->pAlwaysRollback);
31662 pPager->pAlwaysRollback = 0;
31663 }
31664
31665 rc = osUnlock(pPager->fd, NO_LOCK);
31666 if( rc ) pPager->errCode = rc;
31667 pPager->dbSizeValid = 0;
31668 IOTRACE(("UNLOCK %p\n", pPager))
31669
31670 /* If Pager.errCode is set, the contents of the pager cache cannot be
31671 ** trusted. Now that the pager file is unlocked, the contents of the
31672 ** cache can be discarded and the error code safely cleared.
31673 */
@@ -32106,11 +32186,11 @@
32186
32187 /*
32188 ** Set the sectorSize for the given pager.
32189 **
32190 ** The sector size is at least as big as the sector size reported
32191 ** by sqlite3OsSectorSize(). The minimum sector size is 512.
32192 */
32193 static void setSectorSize(Pager *pPager){
32194 assert(pPager->fd->pMethods||pPager->tempFile);
32195 if( !pPager->tempFile ){
32196 /* Sector size doesn't matter for temporary files. Also, the file
@@ -32119,10 +32199,13 @@
32199 */
32200 pPager->sectorSize = sqlite3OsSectorSize(pPager->fd);
32201 }
32202 if( pPager->sectorSize<512 ){
32203 pPager->sectorSize = 512;
32204 }
32205 if( pPager->sectorSize>MAX_SECTOR_SIZE ){
32206 pPager->sectorSize = MAX_SECTOR_SIZE;
32207 }
32208 }
32209
32210 /*
32211 ** Playback the journal and thus restore the database file to
@@ -32625,13 +32708,13 @@
32708 ** + SQLITE_DEFAULT_PAGE_SIZE,
32709 ** + The value returned by sqlite3OsSectorSize()
32710 ** + The largest page size that can be written atomically.
32711 */
32712 if( rc==SQLITE_OK && !readOnly ){
32713 setSectorSize(pPager);
32714 if( szPageDflt<pPager->sectorSize ){
32715 szPageDflt = pPager->sectorSize;
32716 }
32717 #ifdef SQLITE_ENABLE_ATOMIC_WRITE
32718 {
32719 int iDc = sqlite3OsDeviceCharacteristics(pPager->fd);
32720 int ii;
@@ -34215,23 +34298,16 @@
34298 /* If the PGHDR_NEED_SYNC flag is set for any of the nPage pages
34299 ** starting at pg1, then it needs to be set for all of them. Because
34300 ** writing to any of these nPage pages may damage the others, the
34301 ** journal file must contain sync()ed copies of all of them
34302 ** before any of them can be written out to the database file.
 
 
 
 
 
 
34303 */
34304 if( needSync ){
34305 assert( !MEMDB && pPager->noSync==0 );
34306 for(ii=0; ii<nPage && needSync; ii++){
34307 PgHdr *pPage = pager_lookup(pPager, pg1+ii);
34308 if( pPage ){
 
34309 pPage->flags |= PGHDR_NEED_SYNC;
34310 sqlite3PagerUnref(pPage);
34311 }
34312 }
34313 assert(pPager->needSync);
@@ -34269,20 +34345,20 @@
34345 **
34346 ** Tests show that this optimization, together with the
34347 ** sqlite3PagerDontRollback() below, more than double the speed
34348 ** of large INSERT operations and quadruple the speed of large DELETEs.
34349 **
34350 ** When this routine is called, set the bit corresponding to pDbPage in
34351 ** the Pager.pAlwaysRollback bitvec. Subsequent calls to
34352 ** sqlite3PagerDontRollback() for the same page will thereafter be ignored.
34353 ** This is necessary to avoid a problem where a page with data is added to
34354 ** the freelist during one part of a transaction then removed from the
34355 ** freelist during a later part of the same transaction and reused for some
34356 ** other purpose. When it is first added to the freelist, this routine is
34357 ** called. When reused, the sqlite3PagerDontRollback() routine is called.
34358 ** But because the page contains critical data, we still need to be sure it
34359 ** gets rolled back in spite of the sqlite3PagerDontRollback() call.
34360 */
34361 SQLITE_PRIVATE int sqlite3PagerDontWrite(DbPage *pDbPage){
34362 PgHdr *pPg = pDbPage;
34363 Pager *pPager = pPg->pPager;
34364 int rc;
@@ -34338,11 +34414,11 @@
34414 TESTONLY( int rc; ) /* Return value from sqlite3BitvecSet() */
34415
34416 assert( pPager->state>=PAGER_RESERVED );
34417
34418 /* If the journal file is not open, or DontWrite() has been called on
34419 ** this page (DontWrite() sets the Pager.pAlwaysRollback bit), then this
34420 ** function is a no-op.
34421 */
34422 if( pPager->journalOpen==0
34423 || sqlite3BitvecTest(pPager->pAlwaysRollback, pPg->pgno)
34424 || pPg->pgno>pPager->dbOrigSize
@@ -34754,12 +34830,14 @@
34830
34831 if( nSavepoint>pPager->nSavepoint && pPager->useJournal ){
34832 int ii;
34833 PagerSavepoint *aNew;
34834
34835 /* Either there is no active journal or the sub-journal is open or
34836 ** the journal is always stored in memory */
34837 assert( pPager->nSavepoint==0 || pPager->sjfd->pMethods ||
34838 pPager->journalMode==PAGER_JOURNALMODE_MEMORY );
34839
34840 /* Grow the Pager.aSavepoint array using realloc(). Return SQLITE_NOMEM
34841 ** if the allocation fails. Otherwise, zero the new portion in case a
34842 ** malloc failure occurs while populating it in the for(...) loop below.
34843 */
@@ -36078,11 +36156,11 @@
36156 ** May you do good and not evil.
36157 ** May you find forgiveness for yourself and forgive others.
36158 ** May you share freely, never taking more than you give.
36159 **
36160 *************************************************************************
36161 ** $Id: btree.c,v 1.558 2009/01/10 16:15:21 drh Exp $
36162 **
36163 ** This file implements a external (disk-based) database using BTrees.
36164 ** See the header comment on "btreeInt.h" for additional information.
36165 ** Including a description of file format and an overview of operation.
36166 */
@@ -43414,11 +43492,10 @@
43492 /*
43493 ** Return non-zero if a statement transaction is active.
43494 */
43495 SQLITE_PRIVATE int sqlite3BtreeIsInStmt(Btree *p){
43496 assert( sqlite3BtreeHoldsMutex(p) );
 
43497 return ALWAYS(p->pBt) && p->pBt->inStmt;
43498 }
43499
43500 /*
43501 ** Return non-zero if a read (or write) transaction is active.
@@ -48544,11 +48621,11 @@
48621 ** documentation, headers files, or other derived files. The formatting
48622 ** of the code in this file is, therefore, important. See other comments
48623 ** in this file for details. If in doubt, do not deviate from existing
48624 ** commenting and indentation practices when changing or adding code.
48625 **
48626 ** $Id: vdbe.c,v 1.811 2009/01/14 00:55:10 drh Exp $
48627 */
48628
48629 /*
48630 ** The following global variable is incremented every time a cursor
48631 ** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test
@@ -52497,10 +52574,11 @@
52574 pCrsr = pC->pCursor;
52575 assert( pCrsr!=0 );
52576 rc = sqlite3BtreeLast(pCrsr, &res);
52577 pC->nullRow = (u8)res;
52578 pC->deferredMoveto = 0;
52579 pC->rowidIsValid = 0;
52580 pC->cacheStatus = CACHE_STALE;
52581 if( res && pOp->p2>0 ){
52582 pc = pOp->p2 - 1;
52583 }
52584 break;
@@ -52547,10 +52625,11 @@
52625 if( (pCrsr = pC->pCursor)!=0 ){
52626 rc = sqlite3BtreeFirst(pCrsr, &res);
52627 pC->atFirst = res==0 ?1:0;
52628 pC->deferredMoveto = 0;
52629 pC->cacheStatus = CACHE_STALE;
52630 pC->rowidIsValid = 0;
52631 }else{
52632 res = 1;
52633 }
52634 pC->nullRow = (u8)res;
52635 assert( pOp->p2>0 && pOp->p2<p->nOp );
@@ -56080,11 +56159,11 @@
56159 **
56160 *************************************************************************
56161 ** This file contains routines used for analyzing expressions and
56162 ** for generating VDBE code that evaluates expressions in SQLite.
56163 **
56164 ** $Id: expr.c,v 1.409 2009/01/10 13:24:51 drh Exp $
56165 */
56166
56167 /*
56168 ** Return the 'affinity' of the expression pExpr if any.
56169 **
@@ -56986,11 +57065,10 @@
57065 case TK_FUNCTION:
57066 if( pWalker->u.i==2 ) return 0;
57067 /* Fall through */
57068 case TK_ID:
57069 case TK_COLUMN:
 
57070 case TK_AGG_FUNCTION:
57071 case TK_AGG_COLUMN:
57072 #ifndef SQLITE_OMIT_SUBQUERY
57073 case TK_SELECT:
57074 case TK_EXISTS:
@@ -56997,11 +57075,10 @@
57075 testcase( pExpr->op==TK_SELECT );
57076 testcase( pExpr->op==TK_EXISTS );
57077 #endif
57078 testcase( pExpr->op==TK_ID );
57079 testcase( pExpr->op==TK_COLUMN );
 
57080 testcase( pExpr->op==TK_AGG_FUNCTION );
57081 testcase( pExpr->op==TK_AGG_COLUMN );
57082 pWalker->u.i = 0;
57083 return WRC_Abort;
57084 default:
@@ -57104,16 +57181,10 @@
57181 if( sqlite3StrICmp(z, "ROWID")==0 ) return 1;
57182 if( sqlite3StrICmp(z, "OID")==0 ) return 1;
57183 return 0;
57184 }
57185
 
 
 
 
 
 
57186 /*
57187 ** Return true if the IN operator optimization is enabled and
57188 ** the SELECT statement p exists and is of the
57189 ** simple form:
57190 **
@@ -57125,11 +57196,10 @@
57196 #ifndef SQLITE_OMIT_SUBQUERY
57197 static int isCandidateForInOpt(Select *p){
57198 SrcList *pSrc;
57199 ExprList *pEList;
57200 Table *pTab;
 
57201 if( p==0 ) return 0; /* right-hand side of IN is SELECT */
57202 if( p->pPrior ) return 0; /* Not a compound SELECT */
57203 if( p->selFlags & (SF_Distinct|SF_Aggregate) ){
57204 return 0; /* No DISTINCT keyword and no aggregate functions */
57205 }
@@ -57136,12 +57206,12 @@
57206 if( p->pGroupBy ) return 0; /* Has no GROUP BY clause */
57207 if( p->pLimit ) return 0; /* Has no LIMIT clause */
57208 if( p->pOffset ) return 0;
57209 if( p->pWhere ) return 0; /* Has no WHERE clause */
57210 pSrc = p->pSrc;
57211 assert( pSrc!=0 );
57212 if( pSrc->nSrc!=1 ) return 0; /* Single term in FROM clause */
57213 if( pSrc->a[0].pSelect ) return 0; /* FROM clause is not a subquery */
57214 pTab = pSrc->a[0].pTab;
57215 if( pTab==0 ) return 0;
57216 if( pTab->pSelect ) return 0; /* FROM clause is not a view */
57217 if( IsVirtual(pTab) ) return 0; /* FROM clause not a virtual table */
@@ -57724,37 +57794,26 @@
57794 }
57795 return 0;
57796 }
57797
57798 /*
57799 ** There is a value in register iReg.
 
 
57800 **
57801 ** We are going to modify the value, so we need to make sure it
57802 ** is not a cached register. If iReg is a cached register,
57803 ** then clear the corresponding cache line.
57804 */
57805 SQLITE_PRIVATE void sqlite3ExprWritableRegister(Parse *pParse, int iReg){
57806 int i;
57807 if( usedAsColumnCache(pParse, iReg, iReg) ){
57808 for(i=0; i<pParse->nColCache; i++){
57809 if( pParse->aColCache[i].iReg==iReg ){
57810 pParse->aColCache[i] = pParse->aColCache[--pParse->nColCache];
57811 pParse->iColCache = pParse->nColCache;
57812 }
57813 }
57814 }
 
 
 
 
 
 
 
 
 
57815 }
57816
57817 /*
57818 ** If the last instruction coded is an ephemeral copy of any of
57819 ** the registers in the nReg registers beginning with iReg, then
@@ -59143,11 +59202,11 @@
59202 }
59203 return pParse->aTempReg[--pParse->nTempReg];
59204 }
59205 SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse *pParse, int iReg){
59206 if( iReg && pParse->nTempReg<ArraySize(pParse->aTempReg) ){
59207 sqlite3ExprWritableRegister(pParse, iReg);
59208 pParse->aTempReg[pParse->nTempReg++] = iReg;
59209 }
59210 }
59211
59212 /*
@@ -69985,11 +70044,11 @@
70044 ** May you share freely, never taking more than you give.
70045 **
70046 *************************************************************************
70047 ** This file contains code used to implement the PRAGMA command.
70048 **
70049 ** $Id: pragma.c,v 1.201 2009/01/13 20:14:16 drh Exp $
70050 */
70051
70052 /* Ignore this whole file if pragmas are disabled
70053 */
70054 #if !defined(SQLITE_OMIT_PRAGMA) && !defined(SQLITE_OMIT_PARSER)
@@ -70497,11 +70556,11 @@
70556
70557 /*
70558 ** PRAGMA [database.]journal_size_limit
70559 ** PRAGMA [database.]journal_size_limit=N
70560 **
70561 ** Get or set the size limit on rollback journal files.
70562 */
70563 if( sqlite3StrICmp(zLeft,"journal_size_limit")==0 ){
70564 Pager *pPager = sqlite3BtreePager(pDb->pBt);
70565 i64 iLimit = -2;
70566 if( zRight ){
@@ -70519,11 +70578,12 @@
70578
70579 /*
70580 ** PRAGMA [database.]auto_vacuum
70581 ** PRAGMA [database.]auto_vacuum=N
70582 **
70583 ** Get or set the value of the database 'auto-vacuum' parameter.
70584 ** The value is one of: 0 NONE 1 FULL 2 INCREMENTAL
70585 */
70586 #ifndef SQLITE_OMIT_AUTOVACUUM
70587 if( sqlite3StrICmp(zLeft,"auto_vacuum")==0 ){
70588 Btree *pBt = pDb->pBt;
70589 assert( pBt!=0 );
@@ -79313,11 +79373,11 @@
79373 ** generating the code that loops through a table looking for applicable
79374 ** rows. Indices are selected and used to speed the search when doing
79375 ** so is applicable. Because this module is responsible for selecting
79376 ** indices, you might also think of this module as the "query optimizer".
79377 **
79378 ** $Id: where.c,v 1.364 2009/01/14 00:55:10 drh Exp $
79379 */
79380
79381 /*
79382 ** Trace output macros
79383 */
@@ -80140,14 +80200,16 @@
80200 pAndWC = &pAndInfo->wc;
80201 whereClauseInit(pAndWC, pWC->pParse, pMaskSet);
80202 whereSplit(pAndWC, pOrTerm->pExpr, TK_AND);
80203 exprAnalyzeAll(pSrc, pAndWC);
80204 testcase( db->mallocFailed );
80205 if( !db->mallocFailed ){
80206 for(j=0, pAndTerm=pAndWC->a; j<pAndWC->nTerm; j++, pAndTerm++){
80207 assert( pAndTerm->pExpr );
80208 if( allowedOp(pAndTerm->pExpr->op) ){
80209 b |= getMask(pMaskSet, pAndTerm->leftCursor);
80210 }
80211 }
80212 }
80213 indexable &= b;
80214 }
80215 }else if( pOrTerm->wtFlags & TERM_COPIED ){
@@ -81140,10 +81202,11 @@
81202 && ((pTerm->prereqAll & ~maskSrc) & notReady)==0
81203 && (pTerm->u.pOrInfo->indexable & maskSrc)!=0 ){
81204 WhereClause *pOrWC = &pTerm->u.pOrInfo->wc;
81205 WhereTerm *pOrTerm;
81206 int j;
81207 int sortable = 0;
81208 double rTotal = 0;
81209 nRow = 0;
81210 for(j=0, pOrTerm=pOrWC->a; j<pOrWC->nTerm; j++, pOrTerm++){
81211 WhereCost sTermCost;
81212 WHERETRACE(("... Multi-index OR testing for term %d of %d....\n", j,i));
@@ -81158,22 +81221,27 @@
81221 continue;
81222 }
81223 rTotal += sTermCost.rCost;
81224 nRow += sTermCost.nRow;
81225 if( rTotal>=pCost->rCost ) break;
81226 }
81227 if( pOrderBy!=0 ){
81228 if( sortableByRowid(iCur, pOrderBy, pWC->pMaskSet, &rev) && !rev ){
81229 sortable = 1;
81230 }else{
81231 rTotal += nRow*estLog(nRow);
81232 WHERETRACE(("... sorting increases OR cost to %.9g\n", rTotal));
81233 }
81234 }
81235 WHERETRACE(("... multi-index OR cost=%.9g nrow=%.9g\n",
81236 rTotal, nRow));
81237 if( rTotal<pCost->rCost ){
81238 pCost->rCost = rTotal;
81239 pCost->nRow = nRow;
81240 pCost->plan.wsFlags = WHERE_MULTI_OR;
81241 pCost->plan.u.pTerm = pTerm;
81242 if( sortable ){
 
 
 
81243 pCost->plan.wsFlags = WHERE_ORDERBY|WHERE_MULTI_OR;
81244 }
81245 }
81246 }
81247 }
@@ -87024,11 +87092,11 @@
87092 ** Main file for the SQLite library. The routines in this file
87093 ** implement the programmer interface to the library. Routines in
87094 ** other files are for internal use by SQLite and should not be
87095 ** accessed by users of the library.
87096 **
87097 ** $Id: main.c,v 1.521 2009/01/10 16:15:22 drh Exp $
87098 */
87099
87100 #ifdef SQLITE_ENABLE_FTS3
87101 /************** Include fts3.h in the middle of main.c ***********************/
87102 /************** Begin file fts3.h ********************************************/
@@ -87550,20 +87618,10 @@
87618 }
87619 va_end(ap);
87620 return rc;
87621 }
87622
 
 
 
 
 
 
 
 
 
 
87623
87624 /*
87625 ** Return true if the buffer z[0..n-1] contains all spaces.
87626 */
87627 static int allSpaces(const char *z, int n){
87628

Keyboard Shortcuts

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