Fossil SCM

Run the "PRAGMA optimize" command as the database is closing. This change is intended as a test of "PRAGMA optimize".

drh 2017-02-23 13:42 trunk
Commit 90555227ea0362810b569fff3d4f863aae84cf1b
3 files changed +1 +1245 -895 +3 -3
+1
--- src/db.c
+++ src/db.c
@@ -1677,10 +1677,11 @@
16771677
while( db.pAllStmt ){
16781678
db_finalize(db.pAllStmt);
16791679
}
16801680
db_end_transaction(1);
16811681
pStmt = 0;
1682
+ sqlite3_exec(g.db, "PRAGMA optimize", 0, 0, 0);
16821683
db_close_config();
16831684
16841685
/* If the localdb has a lot of unused free space,
16851686
** then VACUUM it as we shut down.
16861687
*/
16871688
--- src/db.c
+++ src/db.c
@@ -1677,10 +1677,11 @@
1677 while( db.pAllStmt ){
1678 db_finalize(db.pAllStmt);
1679 }
1680 db_end_transaction(1);
1681 pStmt = 0;
 
1682 db_close_config();
1683
1684 /* If the localdb has a lot of unused free space,
1685 ** then VACUUM it as we shut down.
1686 */
1687
--- src/db.c
+++ src/db.c
@@ -1677,10 +1677,11 @@
1677 while( db.pAllStmt ){
1678 db_finalize(db.pAllStmt);
1679 }
1680 db_end_transaction(1);
1681 pStmt = 0;
1682 sqlite3_exec(g.db, "PRAGMA optimize", 0, 0, 0);
1683 db_close_config();
1684
1685 /* If the localdb has a lot of unused free space,
1686 ** then VACUUM it as we shut down.
1687 */
1688
+1245 -895
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3
-** version 3.17.0. By combining all the individual C code files into this
3
+** version 3.18.0. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
77
** of 5% or more are commonly seen when SQLite is compiled as a single
88
** translation unit.
@@ -396,13 +396,13 @@
396396
**
397397
** See also: [sqlite3_libversion()],
398398
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
399399
** [sqlite_version()] and [sqlite_source_id()].
400400
*/
401
-#define SQLITE_VERSION "3.17.0"
402
-#define SQLITE_VERSION_NUMBER 3017000
403
-#define SQLITE_SOURCE_ID "2017-02-13 16:02:40 ada05cfa86ad7f5645450ac7a2a21c9aa6e57d2c"
401
+#define SQLITE_VERSION "3.18.0"
402
+#define SQLITE_VERSION_NUMBER 3018000
403
+#define SQLITE_SOURCE_ID "2017-02-23 02:15:33 7a959f6d1ea038988cdb4c02d6f37abaec2580a0"
404404
405405
/*
406406
** CAPI3REF: Run-Time Library Version Numbers
407407
** KEYWORDS: sqlite3_version sqlite3_sourceid
408408
**
@@ -12457,10 +12457,11 @@
1245712457
SQLITE_PRIVATE const void *sqlite3BtreePayloadFetch(BtCursor*, u32 *pAmt);
1245812458
SQLITE_PRIVATE u32 sqlite3BtreePayloadSize(BtCursor*);
1245912459
1246012460
SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*);
1246112461
SQLITE_PRIVATE struct Pager *sqlite3BtreePager(Btree*);
12462
+SQLITE_PRIVATE i64 sqlite3BtreeRowCountEst(BtCursor*);
1246212463
1246312464
#ifndef SQLITE_OMIT_INCRBLOB
1246412465
SQLITE_PRIVATE int sqlite3BtreePayloadChecked(BtCursor*, u32 offset, u32 amt, void*);
1246512466
SQLITE_PRIVATE int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*);
1246612467
SQLITE_PRIVATE void sqlite3BtreeIncrblobCursor(BtCursor *);
@@ -12757,117 +12758,119 @@
1275712758
#define OP_Divide 50 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
1275812759
#define OP_Remainder 51 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
1275912760
#define OP_Concat 52 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
1276012761
#define OP_Last 53
1276112762
#define OP_BitNot 54 /* same as TK_BITNOT, synopsis: r[P1]= ~r[P1] */
12762
-#define OP_SorterSort 55
12763
-#define OP_Sort 56
12764
-#define OP_Rewind 57
12765
-#define OP_IdxLE 58 /* synopsis: key=r[P3@P4] */
12766
-#define OP_IdxGT 59 /* synopsis: key=r[P3@P4] */
12767
-#define OP_IdxLT 60 /* synopsis: key=r[P3@P4] */
12768
-#define OP_IdxGE 61 /* synopsis: key=r[P3@P4] */
12769
-#define OP_RowSetRead 62 /* synopsis: r[P3]=rowset(P1) */
12770
-#define OP_RowSetTest 63 /* synopsis: if r[P3] in rowset(P1) goto P2 */
12771
-#define OP_Program 64
12772
-#define OP_FkIfZero 65 /* synopsis: if fkctr[P1]==0 goto P2 */
12773
-#define OP_IfPos 66 /* synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
12774
-#define OP_IfNotZero 67 /* synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
12775
-#define OP_DecrJumpZero 68 /* synopsis: if (--r[P1])==0 goto P2 */
12776
-#define OP_IncrVacuum 69
12777
-#define OP_VNext 70
12778
-#define OP_Init 71 /* synopsis: Start at P2 */
12779
-#define OP_Return 72
12780
-#define OP_EndCoroutine 73
12781
-#define OP_HaltIfNull 74 /* synopsis: if r[P3]=null halt */
12782
-#define OP_Halt 75
12783
-#define OP_Integer 76 /* synopsis: r[P2]=P1 */
12784
-#define OP_Int64 77 /* synopsis: r[P2]=P4 */
12785
-#define OP_String 78 /* synopsis: r[P2]='P4' (len=P1) */
12786
-#define OP_Null 79 /* synopsis: r[P2..P3]=NULL */
12787
-#define OP_SoftNull 80 /* synopsis: r[P1]=NULL */
12788
-#define OP_Blob 81 /* synopsis: r[P2]=P4 (len=P1) */
12789
-#define OP_Variable 82 /* synopsis: r[P2]=parameter(P1,P4) */
12790
-#define OP_Move 83 /* synopsis: r[P2@P3]=r[P1@P3] */
12791
-#define OP_Copy 84 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
12792
-#define OP_SCopy 85 /* synopsis: r[P2]=r[P1] */
12793
-#define OP_IntCopy 86 /* synopsis: r[P2]=r[P1] */
12794
-#define OP_ResultRow 87 /* synopsis: output=r[P1@P2] */
12795
-#define OP_CollSeq 88
12796
-#define OP_Function0 89 /* synopsis: r[P3]=func(r[P2@P5]) */
12797
-#define OP_Function 90 /* synopsis: r[P3]=func(r[P2@P5]) */
12798
-#define OP_AddImm 91 /* synopsis: r[P1]=r[P1]+P2 */
12799
-#define OP_RealAffinity 92
12800
-#define OP_Cast 93 /* synopsis: affinity(r[P1]) */
12801
-#define OP_Permutation 94
12802
-#define OP_Compare 95 /* synopsis: r[P1@P3] <-> r[P2@P3] */
12803
-#define OP_Column 96 /* synopsis: r[P3]=PX */
12763
+#define OP_IfSmaller 55
12764
+#define OP_SorterSort 56
12765
+#define OP_Sort 57
12766
+#define OP_Rewind 58
12767
+#define OP_IdxLE 59 /* synopsis: key=r[P3@P4] */
12768
+#define OP_IdxGT 60 /* synopsis: key=r[P3@P4] */
12769
+#define OP_IdxLT 61 /* synopsis: key=r[P3@P4] */
12770
+#define OP_IdxGE 62 /* synopsis: key=r[P3@P4] */
12771
+#define OP_RowSetRead 63 /* synopsis: r[P3]=rowset(P1) */
12772
+#define OP_RowSetTest 64 /* synopsis: if r[P3] in rowset(P1) goto P2 */
12773
+#define OP_Program 65
12774
+#define OP_FkIfZero 66 /* synopsis: if fkctr[P1]==0 goto P2 */
12775
+#define OP_IfPos 67 /* synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
12776
+#define OP_IfNotZero 68 /* synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
12777
+#define OP_DecrJumpZero 69 /* synopsis: if (--r[P1])==0 goto P2 */
12778
+#define OP_IncrVacuum 70
12779
+#define OP_VNext 71
12780
+#define OP_Init 72 /* synopsis: Start at P2 */
12781
+#define OP_Return 73
12782
+#define OP_EndCoroutine 74
12783
+#define OP_HaltIfNull 75 /* synopsis: if r[P3]=null halt */
12784
+#define OP_Halt 76
12785
+#define OP_Integer 77 /* synopsis: r[P2]=P1 */
12786
+#define OP_Int64 78 /* synopsis: r[P2]=P4 */
12787
+#define OP_String 79 /* synopsis: r[P2]='P4' (len=P1) */
12788
+#define OP_Null 80 /* synopsis: r[P2..P3]=NULL */
12789
+#define OP_SoftNull 81 /* synopsis: r[P1]=NULL */
12790
+#define OP_Blob 82 /* synopsis: r[P2]=P4 (len=P1) */
12791
+#define OP_Variable 83 /* synopsis: r[P2]=parameter(P1,P4) */
12792
+#define OP_Move 84 /* synopsis: r[P2@P3]=r[P1@P3] */
12793
+#define OP_Copy 85 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
12794
+#define OP_SCopy 86 /* synopsis: r[P2]=r[P1] */
12795
+#define OP_IntCopy 87 /* synopsis: r[P2]=r[P1] */
12796
+#define OP_ResultRow 88 /* synopsis: output=r[P1@P2] */
12797
+#define OP_CollSeq 89
12798
+#define OP_Function0 90 /* synopsis: r[P3]=func(r[P2@P5]) */
12799
+#define OP_Function 91 /* synopsis: r[P3]=func(r[P2@P5]) */
12800
+#define OP_AddImm 92 /* synopsis: r[P1]=r[P1]+P2 */
12801
+#define OP_RealAffinity 93
12802
+#define OP_Cast 94 /* synopsis: affinity(r[P1]) */
12803
+#define OP_Permutation 95
12804
+#define OP_Compare 96 /* synopsis: r[P1@P3] <-> r[P2@P3] */
1280412805
#define OP_String8 97 /* same as TK_STRING, synopsis: r[P2]='P4' */
12805
-#define OP_Affinity 98 /* synopsis: affinity(r[P1@P2]) */
12806
-#define OP_MakeRecord 99 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
12807
-#define OP_Count 100 /* synopsis: r[P2]=count() */
12808
-#define OP_ReadCookie 101
12809
-#define OP_SetCookie 102
12810
-#define OP_ReopenIdx 103 /* synopsis: root=P2 iDb=P3 */
12811
-#define OP_OpenRead 104 /* synopsis: root=P2 iDb=P3 */
12812
-#define OP_OpenWrite 105 /* synopsis: root=P2 iDb=P3 */
12813
-#define OP_OpenAutoindex 106 /* synopsis: nColumn=P2 */
12814
-#define OP_OpenEphemeral 107 /* synopsis: nColumn=P2 */
12815
-#define OP_SorterOpen 108
12816
-#define OP_SequenceTest 109 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
12817
-#define OP_OpenPseudo 110 /* synopsis: P3 columns in r[P2] */
12818
-#define OP_Close 111
12819
-#define OP_ColumnsUsed 112
12820
-#define OP_Sequence 113 /* synopsis: r[P2]=cursor[P1].ctr++ */
12821
-#define OP_NewRowid 114 /* synopsis: r[P2]=rowid */
12822
-#define OP_Insert 115 /* synopsis: intkey=r[P3] data=r[P2] */
12823
-#define OP_InsertInt 116 /* synopsis: intkey=P3 data=r[P2] */
12824
-#define OP_Delete 117
12825
-#define OP_ResetCount 118
12826
-#define OP_SorterCompare 119 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
12827
-#define OP_SorterData 120 /* synopsis: r[P2]=data */
12828
-#define OP_RowData 121 /* synopsis: r[P2]=data */
12829
-#define OP_Rowid 122 /* synopsis: r[P2]=rowid */
12830
-#define OP_NullRow 123
12831
-#define OP_SorterInsert 124 /* synopsis: key=r[P2] */
12832
-#define OP_IdxInsert 125 /* synopsis: key=r[P2] */
12833
-#define OP_IdxDelete 126 /* synopsis: key=r[P2@P3] */
12834
-#define OP_Seek 127 /* synopsis: Move P3 to P1.rowid */
12835
-#define OP_IdxRowid 128 /* synopsis: r[P2]=rowid */
12836
-#define OP_Destroy 129
12837
-#define OP_Clear 130
12838
-#define OP_ResetSorter 131
12806
+#define OP_Column 98 /* synopsis: r[P3]=PX */
12807
+#define OP_Affinity 99 /* synopsis: affinity(r[P1@P2]) */
12808
+#define OP_MakeRecord 100 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
12809
+#define OP_Count 101 /* synopsis: r[P2]=count() */
12810
+#define OP_ReadCookie 102
12811
+#define OP_SetCookie 103
12812
+#define OP_ReopenIdx 104 /* synopsis: root=P2 iDb=P3 */
12813
+#define OP_OpenRead 105 /* synopsis: root=P2 iDb=P3 */
12814
+#define OP_OpenWrite 106 /* synopsis: root=P2 iDb=P3 */
12815
+#define OP_OpenAutoindex 107 /* synopsis: nColumn=P2 */
12816
+#define OP_OpenEphemeral 108 /* synopsis: nColumn=P2 */
12817
+#define OP_SorterOpen 109
12818
+#define OP_SequenceTest 110 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
12819
+#define OP_OpenPseudo 111 /* synopsis: P3 columns in r[P2] */
12820
+#define OP_Close 112
12821
+#define OP_ColumnsUsed 113
12822
+#define OP_Sequence 114 /* synopsis: r[P2]=cursor[P1].ctr++ */
12823
+#define OP_NewRowid 115 /* synopsis: r[P2]=rowid */
12824
+#define OP_Insert 116 /* synopsis: intkey=r[P3] data=r[P2] */
12825
+#define OP_InsertInt 117 /* synopsis: intkey=P3 data=r[P2] */
12826
+#define OP_Delete 118
12827
+#define OP_ResetCount 119
12828
+#define OP_SorterCompare 120 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
12829
+#define OP_SorterData 121 /* synopsis: r[P2]=data */
12830
+#define OP_RowData 122 /* synopsis: r[P2]=data */
12831
+#define OP_Rowid 123 /* synopsis: r[P2]=rowid */
12832
+#define OP_NullRow 124
12833
+#define OP_SorterInsert 125 /* synopsis: key=r[P2] */
12834
+#define OP_IdxInsert 126 /* synopsis: key=r[P2] */
12835
+#define OP_IdxDelete 127 /* synopsis: key=r[P2@P3] */
12836
+#define OP_Seek 128 /* synopsis: Move P3 to P1.rowid */
12837
+#define OP_IdxRowid 129 /* synopsis: r[P2]=rowid */
12838
+#define OP_Destroy 130
12839
+#define OP_Clear 131
1283912840
#define OP_Real 132 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
12840
-#define OP_CreateIndex 133 /* synopsis: r[P2]=root iDb=P1 */
12841
-#define OP_CreateTable 134 /* synopsis: r[P2]=root iDb=P1 */
12842
-#define OP_ParseSchema 135
12843
-#define OP_LoadAnalysis 136
12844
-#define OP_DropTable 137
12845
-#define OP_DropIndex 138
12846
-#define OP_DropTrigger 139
12847
-#define OP_IntegrityCk 140
12848
-#define OP_RowSetAdd 141 /* synopsis: rowset(P1)=r[P2] */
12849
-#define OP_Param 142
12850
-#define OP_FkCounter 143 /* synopsis: fkctr[P1]+=P2 */
12851
-#define OP_MemMax 144 /* synopsis: r[P1]=max(r[P1],r[P2]) */
12852
-#define OP_OffsetLimit 145 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
12853
-#define OP_AggStep0 146 /* synopsis: accum=r[P3] step(r[P2@P5]) */
12854
-#define OP_AggStep 147 /* synopsis: accum=r[P3] step(r[P2@P5]) */
12855
-#define OP_AggFinal 148 /* synopsis: accum=r[P1] N=P2 */
12856
-#define OP_Expire 149
12857
-#define OP_TableLock 150 /* synopsis: iDb=P1 root=P2 write=P3 */
12858
-#define OP_VBegin 151
12859
-#define OP_VCreate 152
12860
-#define OP_VDestroy 153
12861
-#define OP_VOpen 154
12862
-#define OP_VColumn 155 /* synopsis: r[P3]=vcolumn(P2) */
12863
-#define OP_VRename 156
12864
-#define OP_Pagecount 157
12865
-#define OP_MaxPgcnt 158
12866
-#define OP_CursorHint 159
12867
-#define OP_Noop 160
12868
-#define OP_Explain 161
12841
+#define OP_ResetSorter 133
12842
+#define OP_CreateIndex 134 /* synopsis: r[P2]=root iDb=P1 */
12843
+#define OP_CreateTable 135 /* synopsis: r[P2]=root iDb=P1 */
12844
+#define OP_SqlExec 136
12845
+#define OP_ParseSchema 137
12846
+#define OP_LoadAnalysis 138
12847
+#define OP_DropTable 139
12848
+#define OP_DropIndex 140
12849
+#define OP_DropTrigger 141
12850
+#define OP_IntegrityCk 142
12851
+#define OP_RowSetAdd 143 /* synopsis: rowset(P1)=r[P2] */
12852
+#define OP_Param 144
12853
+#define OP_FkCounter 145 /* synopsis: fkctr[P1]+=P2 */
12854
+#define OP_MemMax 146 /* synopsis: r[P1]=max(r[P1],r[P2]) */
12855
+#define OP_OffsetLimit 147 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
12856
+#define OP_AggStep0 148 /* synopsis: accum=r[P3] step(r[P2@P5]) */
12857
+#define OP_AggStep 149 /* synopsis: accum=r[P3] step(r[P2@P5]) */
12858
+#define OP_AggFinal 150 /* synopsis: accum=r[P1] N=P2 */
12859
+#define OP_Expire 151
12860
+#define OP_TableLock 152 /* synopsis: iDb=P1 root=P2 write=P3 */
12861
+#define OP_VBegin 153
12862
+#define OP_VCreate 154
12863
+#define OP_VDestroy 155
12864
+#define OP_VOpen 156
12865
+#define OP_VColumn 157 /* synopsis: r[P3]=vcolumn(P2) */
12866
+#define OP_VRename 158
12867
+#define OP_Pagecount 159
12868
+#define OP_MaxPgcnt 160
12869
+#define OP_CursorHint 161
12870
+#define OP_Noop 162
12871
+#define OP_Explain 163
1286912872
1287012873
/* Properties such as "out2" or "jump" that are specified in
1287112874
** comments following the "case" for each opcode in the vdbe.c
1287212875
** are encoded into bitvectors as follows:
1287312876
*/
@@ -12883,32 +12886,32 @@
1288312886
/* 16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0x03, 0x03, 0x09,\
1288412887
/* 24 */ 0x09, 0x09, 0x09, 0x26, 0x26, 0x09, 0x09, 0x09,\
1288512888
/* 32 */ 0x09, 0x09, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\
1288612889
/* 40 */ 0x0b, 0x0b, 0x01, 0x26, 0x26, 0x26, 0x26, 0x26,\
1288712890
/* 48 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x01, 0x12, 0x01,\
12888
-/* 56 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x23, 0x0b,\
12889
-/* 64 */ 0x01, 0x01, 0x03, 0x03, 0x03, 0x01, 0x01, 0x01,\
12890
-/* 72 */ 0x02, 0x02, 0x08, 0x00, 0x10, 0x10, 0x10, 0x10,\
12891
-/* 80 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00,\
12892
-/* 88 */ 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00,\
12893
-/* 96 */ 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
12891
+/* 56 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x23,\
12892
+/* 64 */ 0x0b, 0x01, 0x01, 0x03, 0x03, 0x03, 0x01, 0x01,\
12893
+/* 72 */ 0x01, 0x02, 0x02, 0x08, 0x00, 0x10, 0x10, 0x10,\
12894
+/* 80 */ 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10,\
12895
+/* 88 */ 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00,\
12896
+/* 96 */ 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\
1289412897
/* 104 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
12895
-/* 112 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
12896
-/* 120 */ 0x00, 0x00, 0x10, 0x00, 0x04, 0x04, 0x00, 0x00,\
12897
-/* 128 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00,\
12898
-/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00,\
12899
-/* 144 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
12900
-/* 152 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\
12901
-/* 160 */ 0x00, 0x00,}
12898
+/* 112 */ 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,\
12899
+/* 120 */ 0x00, 0x00, 0x00, 0x10, 0x00, 0x04, 0x04, 0x00,\
12900
+/* 128 */ 0x00, 0x10, 0x10, 0x00, 0x10, 0x00, 0x10, 0x10,\
12901
+/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,\
12902
+/* 144 */ 0x10, 0x00, 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00,\
12903
+/* 152 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\
12904
+/* 160 */ 0x10, 0x00, 0x00, 0x00,}
1290212905
1290312906
/* The sqlite3P2Values() routine is able to run faster if it knows
1290412907
** the value of the largest JUMP opcode. The smaller the maximum
1290512908
** JUMP opcode the better, so the mkopcodeh.tcl script that
1290612909
** generated this include file strives to group all JUMP opcodes
1290712910
** together near the beginning of the list.
1290812911
*/
12909
-#define SQLITE_MX_JUMP_OPCODE 71 /* Maximum JUMP opcode */
12912
+#define SQLITE_MX_JUMP_OPCODE 72 /* Maximum JUMP opcode */
1291012913
1291112914
/************** End of opcodes.h *********************************************/
1291212915
/************** Continuing where we left off in vdbe.h ***********************/
1291312916
1291412917
/*
@@ -14074,10 +14077,11 @@
1407414077
u8 suppressErr; /* Do not issue error messages if true */
1407514078
u8 vtabOnConflict; /* Value to return for s3_vtab_on_conflict() */
1407614079
u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */
1407714080
u8 mTrace; /* zero or more SQLITE_TRACE flags */
1407814081
u8 skipBtreeMutex; /* True if no shared-cache backends */
14082
+ u8 nSqlExec; /* Number of pending OP_SqlExec opcodes */
1407914083
int nextPagesize; /* Pagesize after VACUUM if >0 */
1408014084
u32 magic; /* Magic number for detect library misuse */
1408114085
int nChange; /* Value returned by sqlite3_changes() */
1408214086
int nTotalChange; /* Value returned by sqlite3_total_changes() */
1408314087
int aLimit[SQLITE_N_LIMIT]; /* Limits */
@@ -14589,18 +14593,18 @@
1458914593
char *zColAff; /* String defining the affinity of each column */
1459014594
ExprList *pCheck; /* All CHECK constraints */
1459114595
/* ... also used as column name list in a VIEW */
1459214596
int tnum; /* Root BTree page for this table */
1459314597
u32 nTabRef; /* Number of pointers to this Table */
14598
+ u32 tabFlags; /* Mask of TF_* values */
1459414599
i16 iPKey; /* If not negative, use aCol[iPKey] as the rowid */
1459514600
i16 nCol; /* Number of columns in this table */
1459614601
LogEst nRowLogEst; /* Estimated rows in table - from sqlite_stat1 table */
1459714602
LogEst szTabRow; /* Estimated size of each table row in bytes */
1459814603
#ifdef SQLITE_ENABLE_COSTMULT
1459914604
LogEst costMult; /* Cost multiplier for using this table */
1460014605
#endif
14601
- u8 tabFlags; /* Mask of TF_* values */
1460214606
u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */
1460314607
#ifndef SQLITE_OMIT_ALTERTABLE
1460414608
int addColOffset; /* Offset in CREATE TABLE stmt to add a new column */
1460514609
#endif
1460614610
#ifndef SQLITE_OMIT_VIRTUALTABLE
@@ -14620,27 +14624,29 @@
1462014624
** followed by non-hidden columns. Example: "CREATE VIRTUAL TABLE x USING
1462114625
** vtab1(a HIDDEN, b);". Since "b" is a non-hidden column but "a" is hidden,
1462214626
** the TF_OOOHidden attribute would apply in this case. Such tables require
1462314627
** special handling during INSERT processing.
1462414628
*/
14625
-#define TF_Readonly 0x01 /* Read-only system table */
14626
-#define TF_Ephemeral 0x02 /* An ephemeral table */
14627
-#define TF_HasPrimaryKey 0x04 /* Table has a primary key */
14628
-#define TF_Autoincrement 0x08 /* Integer primary key is autoincrement */
14629
-#define TF_Virtual 0x10 /* Is a virtual table */
14630
-#define TF_WithoutRowid 0x20 /* No rowid. PRIMARY KEY is the key */
14631
-#define TF_NoVisibleRowid 0x40 /* No user-visible "rowid" column */
14632
-#define TF_OOOHidden 0x80 /* Out-of-Order hidden columns */
14633
-
14629
+#define TF_Readonly 0x0001 /* Read-only system table */
14630
+#define TF_Ephemeral 0x0002 /* An ephemeral table */
14631
+#define TF_HasPrimaryKey 0x0004 /* Table has a primary key */
14632
+#define TF_Autoincrement 0x0008 /* Integer primary key is autoincrement */
14633
+#define TF_HasStat1 0x0010 /* nRowLogEst set from sqlite_stat1 */
14634
+#define TF_WithoutRowid 0x0020 /* No rowid. PRIMARY KEY is the key */
14635
+#define TF_NoVisibleRowid 0x0040 /* No user-visible "rowid" column */
14636
+#define TF_OOOHidden 0x0080 /* Out-of-Order hidden columns */
14637
+#define TF_StatsUsed 0x0100 /* Query planner decisions affected by
14638
+ ** Index.aiRowLogEst[] values */
14639
+#define TF_HasNotNull 0x0200 /* Contains NOT NULL constraints */
1463414640
1463514641
/*
1463614642
** Test to see whether or not a table is a virtual table. This is
1463714643
** done as a macro so that it will be optimized out when virtual
1463814644
** table support is omitted from the build.
1463914645
*/
1464014646
#ifndef SQLITE_OMIT_VIRTUALTABLE
14641
-# define IsVirtual(X) (((X)->tabFlags & TF_Virtual)!=0)
14647
+# define IsVirtual(X) ((X)->nModuleArg)
1464214648
#else
1464314649
# define IsVirtual(X) 0
1464414650
#endif
1464514651
1464614652
/*
@@ -14871,10 +14877,11 @@
1487114877
unsigned bUnordered:1; /* Use this index for == or IN queries only */
1487214878
unsigned uniqNotNull:1; /* True if UNIQUE and NOT NULL for all columns */
1487314879
unsigned isResized:1; /* True if resizeIndexObject() has been called */
1487414880
unsigned isCovering:1; /* True if this is a covering index */
1487514881
unsigned noSkipScan:1; /* Do not try to use skip-scan if true */
14882
+ unsigned hasStat1:1; /* aiRowLogEst values come from sqlite_stat1 */
1487614883
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
1487714884
int nSample; /* Number of elements in aSample[] */
1487814885
int nSampleCol; /* Size of IndexSample.anEq[] and so on */
1487914886
tRowcnt *aAvgEq; /* Average nEq values for keys not in aSample */
1488014887
IndexSample *aSample; /* Samples of the left-most key */
@@ -15181,11 +15188,11 @@
1518115188
** form is used for name resolution with nested FROM clauses.
1518215189
*/
1518315190
struct ExprList {
1518415191
int nExpr; /* Number of expressions on the list */
1518515192
struct ExprList_item { /* For each expression in the list */
15186
- Expr *pExpr; /* The list of expressions */
15193
+ Expr *pExpr; /* The parse tree for this expression */
1518715194
char *zName; /* Token associated with this expression */
1518815195
char *zSpan; /* Original text of the expression */
1518915196
u8 sortOrder; /* 1 for DESC or 0 for ASC */
1519015197
unsigned done :1; /* A flag to indicate when processing is finished */
1519115198
unsigned bSpanIsTab :1; /* zSpan holds DB.TABLE.COLUMN */
@@ -16504,10 +16511,11 @@
1650416511
SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*);
1650516512
SQLITE_PRIVATE void sqlite3Vacuum(Parse*,Token*);
1650616513
SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*, int);
1650716514
SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3*, Token*);
1650816515
SQLITE_PRIVATE int sqlite3ExprCompare(Expr*, Expr*, int);
16516
+SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr*, Expr*, int);
1650916517
SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList*, ExprList*, int);
1651016518
SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Expr*, Expr*, int);
1651116519
SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);
1651216520
SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*);
1651316521
SQLITE_PRIVATE int sqlite3ExprCoveredByIndex(Expr*, int iCur, Index *pIdx);
@@ -17450,11 +17458,11 @@
1745017458
"COMPILER=gcc-" __VERSION__,
1745117459
#endif
1745217460
#if SQLITE_COVERAGE_TEST
1745317461
"COVERAGE_TEST",
1745417462
#endif
17455
-#if SQLITE_DEBUG
17463
+#ifdef SQLITE_DEBUG
1745617464
"DEBUG",
1745717465
#endif
1745817466
#if SQLITE_DEFAULT_LOCKING_MODE
1745917467
"DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),
1746017468
#endif
@@ -24050,12 +24058,12 @@
2405024058
#ifdef SQLITE_DEBUG
2405124059
assert( p->nRef>0 || p->owner==0 );
2405224060
p->owner = tid;
2405324061
p->nRef++;
2405424062
if( p->trace ){
24055
- OSTRACE(("ENTER-MUTEX tid=%lu, mutex=%p (%d), nRef=%d\n",
24056
- tid, p, p->trace, p->nRef));
24063
+ OSTRACE(("ENTER-MUTEX tid=%lu, mutex(%d)=%p (%d), nRef=%d\n",
24064
+ tid, p->id, p, p->trace, p->nRef));
2405724065
}
2405824066
#endif
2405924067
}
2406024068
2406124069
static int winMutexTry(sqlite3_mutex *p){
@@ -24093,12 +24101,12 @@
2409324101
#else
2409424102
UNUSED_PARAMETER(p);
2409524103
#endif
2409624104
#ifdef SQLITE_DEBUG
2409724105
if( p->trace ){
24098
- OSTRACE(("TRY-MUTEX tid=%lu, mutex=%p (%d), owner=%lu, nRef=%d, rc=%s\n",
24099
- tid, p, p->trace, p->owner, p->nRef, sqlite3ErrName(rc)));
24106
+ OSTRACE(("TRY-MUTEX tid=%lu, mutex(%d)=%p (%d), owner=%lu, nRef=%d, rc=%s\n",
24107
+ tid, p->id, p, p->trace, p->owner, p->nRef, sqlite3ErrName(rc)));
2410024108
}
2410124109
#endif
2410224110
return rc;
2410324111
}
2410424112
@@ -24122,12 +24130,12 @@
2412224130
#endif
2412324131
assert( winMutex_isInit==1 );
2412424132
LeaveCriticalSection(&p->mutex);
2412524133
#ifdef SQLITE_DEBUG
2412624134
if( p->trace ){
24127
- OSTRACE(("LEAVE-MUTEX tid=%lu, mutex=%p (%d), nRef=%d\n",
24128
- tid, p, p->trace, p->nRef));
24135
+ OSTRACE(("LEAVE-MUTEX tid=%lu, mutex(%d)=%p (%d), nRef=%d\n",
24136
+ tid, p->id, p, p->trace, p->nRef));
2412924137
}
2413024138
#endif
2413124139
}
2413224140
2413324141
SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){
@@ -24572,11 +24580,11 @@
2457224580
return sqlite3GlobalConfig.m.xSize(p);
2457324581
}
2457424582
SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3 *db, void *p){
2457524583
assert( p!=0 );
2457624584
if( db==0 || !isLookaside(db,p) ){
24577
-#if SQLITE_DEBUG
24585
+#ifdef SQLITE_DEBUG
2457824586
if( db==0 ){
2457924587
assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );
2458024588
assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
2458124589
}else{
2458224590
assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
@@ -24633,11 +24641,11 @@
2463324641
measureAllocationSize(db, p);
2463424642
return;
2463524643
}
2463624644
if( isLookaside(db, p) ){
2463724645
LookasideSlot *pBuf = (LookasideSlot*)p;
24638
-#if SQLITE_DEBUG
24646
+#ifdef SQLITE_DEBUG
2463924647
/* Trash all content in the buffer being freed */
2464024648
memset(p, 0xaa, db->lookaside.sz);
2464124649
#endif
2464224650
pBuf->pNext = db->lookaside.pFree;
2464324651
db->lookaside.pFree = pBuf;
@@ -25002,11 +25010,11 @@
2500225010
2500325011
/*
2500425012
** Conversion types fall into various categories as defined by the
2500525013
** following enumeration.
2500625014
*/
25007
-#define etRADIX 0 /* Integer types. %d, %x, %o, and so forth */
25015
+#define etRADIX 0 /* non-decimal integer types. %x %o */
2500825016
#define etFLOAT 1 /* Floating point. %f */
2500925017
#define etEXP 2 /* Exponentional notation. %e and %E */
2501025018
#define etGENERIC 3 /* Floating or exponential, depending on exponent. %g */
2501125019
#define etSIZE 4 /* Return number of characters processed so far. %n */
2501225020
#define etSTRING 5 /* Strings. %s */
@@ -25020,12 +25028,13 @@
2502025028
#define etTOKEN 11 /* a pointer to a Token structure */
2502125029
#define etSRCLIST 12 /* a pointer to a SrcList */
2502225030
#define etPOINTER 13 /* The %p conversion */
2502325031
#define etSQLESCAPE3 14 /* %w -> Strings with '\"' doubled */
2502425032
#define etORDINAL 15 /* %r -> 1st, 2nd, 3rd, 4th, etc. English only */
25033
+#define etDECIMAL 16 /* %d or %u, but not %x, %o */
2502525034
25026
-#define etINVALID 16 /* Any unrecognized conversion type */
25035
+#define etINVALID 17 /* Any unrecognized conversion type */
2502725036
2502825037
2502925038
/*
2503025039
** An "etByte" is an 8-bit unsigned value.
2503125040
*/
@@ -25045,40 +25054,40 @@
2504525054
} et_info;
2504625055
2504725056
/*
2504825057
** Allowed values for et_info.flags
2504925058
*/
25050
-#define FLAG_SIGNED 1 /* True if the value to convert is signed */
25051
-#define FLAG_STRING 4 /* Allow infinity precision */
25059
+#define FLAG_SIGNED 1 /* True if the value to convert is signed */
25060
+#define FLAG_STRING 4 /* Allow infinite precision */
2505225061
2505325062
2505425063
/*
2505525064
** The following table is searched linearly, so it is good to put the
2505625065
** most frequently used conversion types first.
2505725066
*/
2505825067
static const char aDigits[] = "0123456789ABCDEF0123456789abcdef";
2505925068
static const char aPrefix[] = "-x0\000X0";
2506025069
static const et_info fmtinfo[] = {
25061
- { 'd', 10, 1, etRADIX, 0, 0 },
25070
+ { 'd', 10, 1, etDECIMAL, 0, 0 },
2506225071
{ 's', 0, 4, etSTRING, 0, 0 },
2506325072
{ 'g', 0, 1, etGENERIC, 30, 0 },
2506425073
{ 'z', 0, 4, etDYNSTRING, 0, 0 },
2506525074
{ 'q', 0, 4, etSQLESCAPE, 0, 0 },
2506625075
{ 'Q', 0, 4, etSQLESCAPE2, 0, 0 },
2506725076
{ 'w', 0, 4, etSQLESCAPE3, 0, 0 },
2506825077
{ 'c', 0, 0, etCHARX, 0, 0 },
2506925078
{ 'o', 8, 0, etRADIX, 0, 2 },
25070
- { 'u', 10, 0, etRADIX, 0, 0 },
25079
+ { 'u', 10, 0, etDECIMAL, 0, 0 },
2507125080
{ 'x', 16, 0, etRADIX, 16, 1 },
2507225081
{ 'X', 16, 0, etRADIX, 0, 4 },
2507325082
#ifndef SQLITE_OMIT_FLOATING_POINT
2507425083
{ 'f', 0, 1, etFLOAT, 0, 0 },
2507525084
{ 'e', 0, 1, etEXP, 30, 0 },
2507625085
{ 'E', 0, 1, etEXP, 14, 0 },
2507725086
{ 'G', 0, 1, etGENERIC, 14, 0 },
2507825087
#endif
25079
- { 'i', 10, 1, etRADIX, 0, 0 },
25088
+ { 'i', 10, 1, etDECIMAL, 0, 0 },
2508025089
{ 'n', 0, 0, etSIZE, 0, 0 },
2508125090
{ '%', 0, 0, etPERCENT, 0, 0 },
2508225091
{ 'p', 16, 0, etPOINTER, 0, 1 },
2508325092
2508425093
/* All the rest are undocumented and are for internal use only */
@@ -25166,18 +25175,17 @@
2516625175
int precision; /* Precision of the current field */
2516725176
int length; /* Length of the field */
2516825177
int idx; /* A general purpose loop counter */
2516925178
int width; /* Width of the current field */
2517025179
etByte flag_leftjustify; /* True if "-" flag is present */
25171
- etByte flag_plussign; /* True if "+" flag is present */
25172
- etByte flag_blanksign; /* True if " " flag is present */
25180
+ etByte flag_prefix; /* '+' or ' ' or 0 for prefix */
2517325181
etByte flag_alternateform; /* True if "#" flag is present */
2517425182
etByte flag_altform2; /* True if "!" flag is present */
2517525183
etByte flag_zeropad; /* True if field width constant starts with zero */
25176
- etByte flag_long; /* True if "l" flag is present */
25177
- etByte flag_longlong; /* True if the "ll" flag is present */
25184
+ etByte flag_long; /* 1 for the "l" flag, 2 for "ll", 0 by default */
2517825185
etByte done; /* Loop termination flag */
25186
+ etByte cThousand; /* Thousands separator for %d and %u */
2517925187
etByte xtype = etINVALID; /* Conversion paradigm */
2518025188
u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */
2518125189
char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
2518225190
sqlite_uint64 longvalue; /* Value for integer types */
2518325191
LONGDOUBLE_TYPE realvalue; /* Value for real types */
@@ -25216,21 +25224,22 @@
2521625224
if( (c=(*++fmt))==0 ){
2521725225
sqlite3StrAccumAppend(pAccum, "%", 1);
2521825226
break;
2521925227
}
2522025228
/* Find out what flags are present */
25221
- flag_leftjustify = flag_plussign = flag_blanksign =
25229
+ flag_leftjustify = flag_prefix = cThousand =
2522225230
flag_alternateform = flag_altform2 = flag_zeropad = 0;
2522325231
done = 0;
2522425232
do{
2522525233
switch( c ){
2522625234
case '-': flag_leftjustify = 1; break;
25227
- case '+': flag_plussign = 1; break;
25228
- case ' ': flag_blanksign = 1; break;
25235
+ case '+': flag_prefix = '+'; break;
25236
+ case ' ': flag_prefix = ' '; break;
2522925237
case '#': flag_alternateform = 1; break;
2523025238
case '!': flag_altform2 = 1; break;
2523125239
case '0': flag_zeropad = 1; break;
25240
+ case ',': cThousand = ','; break;
2523225241
default: done = 1; break;
2523325242
}
2523425243
}while( !done && (c=(*++fmt))!=0 );
2523525244
/* Get the field width */
2523625245
if( c=='*' ){
@@ -25296,17 +25305,15 @@
2529625305
/* Get the conversion type modifier */
2529725306
if( c=='l' ){
2529825307
flag_long = 1;
2529925308
c = *++fmt;
2530025309
if( c=='l' ){
25301
- flag_longlong = 1;
25310
+ flag_long = 2;
2530225311
c = *++fmt;
25303
- }else{
25304
- flag_longlong = 0;
2530525312
}
2530625313
}else{
25307
- flag_long = flag_longlong = 0;
25314
+ flag_long = 0;
2530825315
}
2530925316
/* Fetch the info entry for the field */
2531025317
infop = &fmtinfo[0];
2531125318
xtype = etINVALID;
2531225319
for(idx=0; idx<ArraySize(fmtinfo); idx++){
@@ -25320,41 +25327,42 @@
2532025327
/*
2532125328
** At this point, variables are initialized as follows:
2532225329
**
2532325330
** flag_alternateform TRUE if a '#' is present.
2532425331
** flag_altform2 TRUE if a '!' is present.
25325
- ** flag_plussign TRUE if a '+' is present.
25332
+ ** flag_prefix '+' or ' ' or zero
2532625333
** flag_leftjustify TRUE if a '-' is present or if the
2532725334
** field width was negative.
2532825335
** flag_zeropad TRUE if the width began with 0.
25329
- ** flag_long TRUE if the letter 'l' (ell) prefixed
25330
- ** the conversion character.
25331
- ** flag_longlong TRUE if the letter 'll' (ell ell) prefixed
25332
- ** the conversion character.
25333
- ** flag_blanksign TRUE if a ' ' is present.
25336
+ ** flag_long 1 for "l", 2 for "ll"
2533425337
** width The specified field width. This is
2533525338
** always non-negative. Zero is the default.
2533625339
** precision The specified precision. The default
2533725340
** is -1.
2533825341
** xtype The class of the conversion.
2533925342
** infop Pointer to the appropriate info struct.
2534025343
*/
2534125344
switch( xtype ){
2534225345
case etPOINTER:
25343
- flag_longlong = sizeof(char*)==sizeof(i64);
25344
- flag_long = sizeof(char*)==sizeof(long int);
25346
+ flag_long = sizeof(char*)==sizeof(i64) ? 2 :
25347
+ sizeof(char*)==sizeof(long int) ? 1 : 0;
2534525348
/* Fall through into the next case */
2534625349
case etORDINAL:
25347
- case etRADIX:
25350
+ case etRADIX:
25351
+ cThousand = 0;
25352
+ /* Fall through into the next case */
25353
+ case etDECIMAL:
2534825354
if( infop->flags & FLAG_SIGNED ){
2534925355
i64 v;
2535025356
if( bArgList ){
2535125357
v = getIntArg(pArgList);
25352
- }else if( flag_longlong ){
25353
- v = va_arg(ap,i64);
2535425358
}else if( flag_long ){
25355
- v = va_arg(ap,long int);
25359
+ if( flag_long==2 ){
25360
+ v = va_arg(ap,i64) ;
25361
+ }else{
25362
+ v = va_arg(ap,long int);
25363
+ }
2535625364
}else{
2535725365
v = va_arg(ap,int);
2535825366
}
2535925367
if( v<0 ){
2536025368
if( v==SMALLEST_INT64 ){
@@ -25363,35 +25371,35 @@
2536325371
longvalue = -v;
2536425372
}
2536525373
prefix = '-';
2536625374
}else{
2536725375
longvalue = v;
25368
- if( flag_plussign ) prefix = '+';
25369
- else if( flag_blanksign ) prefix = ' ';
25370
- else prefix = 0;
25376
+ prefix = flag_prefix;
2537125377
}
2537225378
}else{
2537325379
if( bArgList ){
2537425380
longvalue = (u64)getIntArg(pArgList);
25375
- }else if( flag_longlong ){
25376
- longvalue = va_arg(ap,u64);
2537725381
}else if( flag_long ){
25378
- longvalue = va_arg(ap,unsigned long int);
25382
+ if( flag_long==2 ){
25383
+ longvalue = va_arg(ap,u64);
25384
+ }else{
25385
+ longvalue = va_arg(ap,unsigned long int);
25386
+ }
2537925387
}else{
2538025388
longvalue = va_arg(ap,unsigned int);
2538125389
}
2538225390
prefix = 0;
2538325391
}
2538425392
if( longvalue==0 ) flag_alternateform = 0;
2538525393
if( flag_zeropad && precision<width-(prefix!=0) ){
2538625394
precision = width-(prefix!=0);
2538725395
}
25388
- if( precision<etBUFSIZE-10 ){
25396
+ if( precision<etBUFSIZE-10-etBUFSIZE/3 ){
2538925397
nOut = etBUFSIZE;
2539025398
zOut = buf;
2539125399
}else{
25392
- nOut = precision + 10;
25400
+ nOut = precision + 10 + precision/3;
2539325401
zOut = zExtra = sqlite3Malloc( nOut );
2539425402
if( zOut==0 ){
2539525403
setStrAccumError(pAccum, STRACCUM_NOMEM);
2539625404
return;
2539725405
}
@@ -25413,12 +25421,27 @@
2541325421
*(--bufpt) = cset[longvalue%base];
2541425422
longvalue = longvalue/base;
2541525423
}while( longvalue>0 );
2541625424
}
2541725425
length = (int)(&zOut[nOut-1]-bufpt);
25418
- for(idx=precision-length; idx>0; idx--){
25426
+ while( precision>length ){
2541925427
*(--bufpt) = '0'; /* Zero pad */
25428
+ length++;
25429
+ }
25430
+ if( cThousand ){
25431
+ int nn = (length - 1)/3; /* Number of "," to insert */
25432
+ int ix = (length - 1)%3 + 1;
25433
+ bufpt -= nn;
25434
+ for(idx=0; nn>0; idx++){
25435
+ bufpt[idx] = bufpt[idx+nn];
25436
+ ix--;
25437
+ if( ix==0 ){
25438
+ bufpt[++idx] = cThousand;
25439
+ nn--;
25440
+ ix = 3;
25441
+ }
25442
+ }
2542025443
}
2542125444
if( prefix ) *(--bufpt) = prefix; /* Add sign */
2542225445
if( flag_alternateform && infop->prefix ){ /* Add "0" or "0x" */
2542325446
const char *pre;
2542425447
char x;
@@ -25441,13 +25464,11 @@
2544125464
if( precision<0 ) precision = 6; /* Set default precision */
2544225465
if( realvalue<0.0 ){
2544325466
realvalue = -realvalue;
2544425467
prefix = '-';
2544525468
}else{
25446
- if( flag_plussign ) prefix = '+';
25447
- else if( flag_blanksign ) prefix = ' ';
25448
- else prefix = 0;
25469
+ prefix = flag_prefix;
2544925470
}
2545025471
if( xtype==etGENERIC && precision>0 ) precision--;
2545125472
testcase( precision>0xfff );
2545225473
for(idx=precision&0xfff, rounder=0.5; idx>0; idx--, rounder*=0.1){}
2545325474
if( xtype==etFLOAT ) realvalue += rounder;
@@ -29464,117 +29485,119 @@
2946429485
/* 50 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
2946529486
/* 51 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
2946629487
/* 52 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
2946729488
/* 53 */ "Last" OpHelp(""),
2946829489
/* 54 */ "BitNot" OpHelp("r[P1]= ~r[P1]"),
29469
- /* 55 */ "SorterSort" OpHelp(""),
29470
- /* 56 */ "Sort" OpHelp(""),
29471
- /* 57 */ "Rewind" OpHelp(""),
29472
- /* 58 */ "IdxLE" OpHelp("key=r[P3@P4]"),
29473
- /* 59 */ "IdxGT" OpHelp("key=r[P3@P4]"),
29474
- /* 60 */ "IdxLT" OpHelp("key=r[P3@P4]"),
29475
- /* 61 */ "IdxGE" OpHelp("key=r[P3@P4]"),
29476
- /* 62 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"),
29477
- /* 63 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"),
29478
- /* 64 */ "Program" OpHelp(""),
29479
- /* 65 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
29480
- /* 66 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"),
29481
- /* 67 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
29482
- /* 68 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
29483
- /* 69 */ "IncrVacuum" OpHelp(""),
29484
- /* 70 */ "VNext" OpHelp(""),
29485
- /* 71 */ "Init" OpHelp("Start at P2"),
29486
- /* 72 */ "Return" OpHelp(""),
29487
- /* 73 */ "EndCoroutine" OpHelp(""),
29488
- /* 74 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
29489
- /* 75 */ "Halt" OpHelp(""),
29490
- /* 76 */ "Integer" OpHelp("r[P2]=P1"),
29491
- /* 77 */ "Int64" OpHelp("r[P2]=P4"),
29492
- /* 78 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
29493
- /* 79 */ "Null" OpHelp("r[P2..P3]=NULL"),
29494
- /* 80 */ "SoftNull" OpHelp("r[P1]=NULL"),
29495
- /* 81 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
29496
- /* 82 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
29497
- /* 83 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
29498
- /* 84 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
29499
- /* 85 */ "SCopy" OpHelp("r[P2]=r[P1]"),
29500
- /* 86 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
29501
- /* 87 */ "ResultRow" OpHelp("output=r[P1@P2]"),
29502
- /* 88 */ "CollSeq" OpHelp(""),
29503
- /* 89 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"),
29504
- /* 90 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"),
29505
- /* 91 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
29506
- /* 92 */ "RealAffinity" OpHelp(""),
29507
- /* 93 */ "Cast" OpHelp("affinity(r[P1])"),
29508
- /* 94 */ "Permutation" OpHelp(""),
29509
- /* 95 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
29510
- /* 96 */ "Column" OpHelp("r[P3]=PX"),
29490
+ /* 55 */ "IfSmaller" OpHelp(""),
29491
+ /* 56 */ "SorterSort" OpHelp(""),
29492
+ /* 57 */ "Sort" OpHelp(""),
29493
+ /* 58 */ "Rewind" OpHelp(""),
29494
+ /* 59 */ "IdxLE" OpHelp("key=r[P3@P4]"),
29495
+ /* 60 */ "IdxGT" OpHelp("key=r[P3@P4]"),
29496
+ /* 61 */ "IdxLT" OpHelp("key=r[P3@P4]"),
29497
+ /* 62 */ "IdxGE" OpHelp("key=r[P3@P4]"),
29498
+ /* 63 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"),
29499
+ /* 64 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"),
29500
+ /* 65 */ "Program" OpHelp(""),
29501
+ /* 66 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
29502
+ /* 67 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"),
29503
+ /* 68 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
29504
+ /* 69 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
29505
+ /* 70 */ "IncrVacuum" OpHelp(""),
29506
+ /* 71 */ "VNext" OpHelp(""),
29507
+ /* 72 */ "Init" OpHelp("Start at P2"),
29508
+ /* 73 */ "Return" OpHelp(""),
29509
+ /* 74 */ "EndCoroutine" OpHelp(""),
29510
+ /* 75 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
29511
+ /* 76 */ "Halt" OpHelp(""),
29512
+ /* 77 */ "Integer" OpHelp("r[P2]=P1"),
29513
+ /* 78 */ "Int64" OpHelp("r[P2]=P4"),
29514
+ /* 79 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
29515
+ /* 80 */ "Null" OpHelp("r[P2..P3]=NULL"),
29516
+ /* 81 */ "SoftNull" OpHelp("r[P1]=NULL"),
29517
+ /* 82 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
29518
+ /* 83 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
29519
+ /* 84 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
29520
+ /* 85 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
29521
+ /* 86 */ "SCopy" OpHelp("r[P2]=r[P1]"),
29522
+ /* 87 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
29523
+ /* 88 */ "ResultRow" OpHelp("output=r[P1@P2]"),
29524
+ /* 89 */ "CollSeq" OpHelp(""),
29525
+ /* 90 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"),
29526
+ /* 91 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"),
29527
+ /* 92 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
29528
+ /* 93 */ "RealAffinity" OpHelp(""),
29529
+ /* 94 */ "Cast" OpHelp("affinity(r[P1])"),
29530
+ /* 95 */ "Permutation" OpHelp(""),
29531
+ /* 96 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
2951129532
/* 97 */ "String8" OpHelp("r[P2]='P4'"),
29512
- /* 98 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
29513
- /* 99 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
29514
- /* 100 */ "Count" OpHelp("r[P2]=count()"),
29515
- /* 101 */ "ReadCookie" OpHelp(""),
29516
- /* 102 */ "SetCookie" OpHelp(""),
29517
- /* 103 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
29518
- /* 104 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
29519
- /* 105 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
29520
- /* 106 */ "OpenAutoindex" OpHelp("nColumn=P2"),
29521
- /* 107 */ "OpenEphemeral" OpHelp("nColumn=P2"),
29522
- /* 108 */ "SorterOpen" OpHelp(""),
29523
- /* 109 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
29524
- /* 110 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
29525
- /* 111 */ "Close" OpHelp(""),
29526
- /* 112 */ "ColumnsUsed" OpHelp(""),
29527
- /* 113 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
29528
- /* 114 */ "NewRowid" OpHelp("r[P2]=rowid"),
29529
- /* 115 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
29530
- /* 116 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"),
29531
- /* 117 */ "Delete" OpHelp(""),
29532
- /* 118 */ "ResetCount" OpHelp(""),
29533
- /* 119 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
29534
- /* 120 */ "SorterData" OpHelp("r[P2]=data"),
29535
- /* 121 */ "RowData" OpHelp("r[P2]=data"),
29536
- /* 122 */ "Rowid" OpHelp("r[P2]=rowid"),
29537
- /* 123 */ "NullRow" OpHelp(""),
29538
- /* 124 */ "SorterInsert" OpHelp("key=r[P2]"),
29539
- /* 125 */ "IdxInsert" OpHelp("key=r[P2]"),
29540
- /* 126 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
29541
- /* 127 */ "Seek" OpHelp("Move P3 to P1.rowid"),
29542
- /* 128 */ "IdxRowid" OpHelp("r[P2]=rowid"),
29543
- /* 129 */ "Destroy" OpHelp(""),
29544
- /* 130 */ "Clear" OpHelp(""),
29545
- /* 131 */ "ResetSorter" OpHelp(""),
29533
+ /* 98 */ "Column" OpHelp("r[P3]=PX"),
29534
+ /* 99 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
29535
+ /* 100 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
29536
+ /* 101 */ "Count" OpHelp("r[P2]=count()"),
29537
+ /* 102 */ "ReadCookie" OpHelp(""),
29538
+ /* 103 */ "SetCookie" OpHelp(""),
29539
+ /* 104 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
29540
+ /* 105 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
29541
+ /* 106 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
29542
+ /* 107 */ "OpenAutoindex" OpHelp("nColumn=P2"),
29543
+ /* 108 */ "OpenEphemeral" OpHelp("nColumn=P2"),
29544
+ /* 109 */ "SorterOpen" OpHelp(""),
29545
+ /* 110 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
29546
+ /* 111 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
29547
+ /* 112 */ "Close" OpHelp(""),
29548
+ /* 113 */ "ColumnsUsed" OpHelp(""),
29549
+ /* 114 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
29550
+ /* 115 */ "NewRowid" OpHelp("r[P2]=rowid"),
29551
+ /* 116 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
29552
+ /* 117 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"),
29553
+ /* 118 */ "Delete" OpHelp(""),
29554
+ /* 119 */ "ResetCount" OpHelp(""),
29555
+ /* 120 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
29556
+ /* 121 */ "SorterData" OpHelp("r[P2]=data"),
29557
+ /* 122 */ "RowData" OpHelp("r[P2]=data"),
29558
+ /* 123 */ "Rowid" OpHelp("r[P2]=rowid"),
29559
+ /* 124 */ "NullRow" OpHelp(""),
29560
+ /* 125 */ "SorterInsert" OpHelp("key=r[P2]"),
29561
+ /* 126 */ "IdxInsert" OpHelp("key=r[P2]"),
29562
+ /* 127 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
29563
+ /* 128 */ "Seek" OpHelp("Move P3 to P1.rowid"),
29564
+ /* 129 */ "IdxRowid" OpHelp("r[P2]=rowid"),
29565
+ /* 130 */ "Destroy" OpHelp(""),
29566
+ /* 131 */ "Clear" OpHelp(""),
2954629567
/* 132 */ "Real" OpHelp("r[P2]=P4"),
29547
- /* 133 */ "CreateIndex" OpHelp("r[P2]=root iDb=P1"),
29548
- /* 134 */ "CreateTable" OpHelp("r[P2]=root iDb=P1"),
29549
- /* 135 */ "ParseSchema" OpHelp(""),
29550
- /* 136 */ "LoadAnalysis" OpHelp(""),
29551
- /* 137 */ "DropTable" OpHelp(""),
29552
- /* 138 */ "DropIndex" OpHelp(""),
29553
- /* 139 */ "DropTrigger" OpHelp(""),
29554
- /* 140 */ "IntegrityCk" OpHelp(""),
29555
- /* 141 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
29556
- /* 142 */ "Param" OpHelp(""),
29557
- /* 143 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
29558
- /* 144 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
29559
- /* 145 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
29560
- /* 146 */ "AggStep0" OpHelp("accum=r[P3] step(r[P2@P5])"),
29561
- /* 147 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
29562
- /* 148 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
29563
- /* 149 */ "Expire" OpHelp(""),
29564
- /* 150 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
29565
- /* 151 */ "VBegin" OpHelp(""),
29566
- /* 152 */ "VCreate" OpHelp(""),
29567
- /* 153 */ "VDestroy" OpHelp(""),
29568
- /* 154 */ "VOpen" OpHelp(""),
29569
- /* 155 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
29570
- /* 156 */ "VRename" OpHelp(""),
29571
- /* 157 */ "Pagecount" OpHelp(""),
29572
- /* 158 */ "MaxPgcnt" OpHelp(""),
29573
- /* 159 */ "CursorHint" OpHelp(""),
29574
- /* 160 */ "Noop" OpHelp(""),
29575
- /* 161 */ "Explain" OpHelp(""),
29568
+ /* 133 */ "ResetSorter" OpHelp(""),
29569
+ /* 134 */ "CreateIndex" OpHelp("r[P2]=root iDb=P1"),
29570
+ /* 135 */ "CreateTable" OpHelp("r[P2]=root iDb=P1"),
29571
+ /* 136 */ "SqlExec" OpHelp(""),
29572
+ /* 137 */ "ParseSchema" OpHelp(""),
29573
+ /* 138 */ "LoadAnalysis" OpHelp(""),
29574
+ /* 139 */ "DropTable" OpHelp(""),
29575
+ /* 140 */ "DropIndex" OpHelp(""),
29576
+ /* 141 */ "DropTrigger" OpHelp(""),
29577
+ /* 142 */ "IntegrityCk" OpHelp(""),
29578
+ /* 143 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
29579
+ /* 144 */ "Param" OpHelp(""),
29580
+ /* 145 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
29581
+ /* 146 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
29582
+ /* 147 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
29583
+ /* 148 */ "AggStep0" OpHelp("accum=r[P3] step(r[P2@P5])"),
29584
+ /* 149 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
29585
+ /* 150 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
29586
+ /* 151 */ "Expire" OpHelp(""),
29587
+ /* 152 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
29588
+ /* 153 */ "VBegin" OpHelp(""),
29589
+ /* 154 */ "VCreate" OpHelp(""),
29590
+ /* 155 */ "VDestroy" OpHelp(""),
29591
+ /* 156 */ "VOpen" OpHelp(""),
29592
+ /* 157 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
29593
+ /* 158 */ "VRename" OpHelp(""),
29594
+ /* 159 */ "Pagecount" OpHelp(""),
29595
+ /* 160 */ "MaxPgcnt" OpHelp(""),
29596
+ /* 161 */ "CursorHint" OpHelp(""),
29597
+ /* 162 */ "Noop" OpHelp(""),
29598
+ /* 163 */ "Explain" OpHelp(""),
2957629599
};
2957729600
return azName[i];
2957829601
}
2957929602
#endif
2958029603
@@ -37952,46 +37975,84 @@
3795237975
* be freed immediately and any attempt to access any of that freed
3795337976
* data will almost certainly result in an immediate access violation.
3795437977
******************************************************************************
3795537978
*/
3795637979
#ifndef SQLITE_WIN32_HEAP_CREATE
37957
-# define SQLITE_WIN32_HEAP_CREATE (TRUE)
37980
+# define SQLITE_WIN32_HEAP_CREATE (TRUE)
37981
+#endif
37982
+
37983
+/*
37984
+ * This is the maximum possible initial size of the Win32-specific heap, in
37985
+ * bytes.
37986
+ */
37987
+#ifndef SQLITE_WIN32_HEAP_MAX_INIT_SIZE
37988
+# define SQLITE_WIN32_HEAP_MAX_INIT_SIZE (4294967295U)
37989
+#endif
37990
+
37991
+/*
37992
+ * This is the extra space for the initial size of the Win32-specific heap,
37993
+ * in bytes. This value may be zero.
37994
+ */
37995
+#ifndef SQLITE_WIN32_HEAP_INIT_EXTRA
37996
+# define SQLITE_WIN32_HEAP_INIT_EXTRA (4194304)
37997
+#endif
37998
+
37999
+/*
38000
+ * Calculate the maximum legal cache size, in pages, based on the maximum
38001
+ * possible initial heap size and the default page size, setting aside the
38002
+ * needed extra space.
38003
+ */
38004
+#ifndef SQLITE_WIN32_MAX_CACHE_SIZE
38005
+# define SQLITE_WIN32_MAX_CACHE_SIZE (((SQLITE_WIN32_HEAP_MAX_INIT_SIZE) - \
38006
+ (SQLITE_WIN32_HEAP_INIT_EXTRA)) / \
38007
+ (SQLITE_DEFAULT_PAGE_SIZE))
3795838008
#endif
3795938009
3796038010
/*
3796138011
* This is cache size used in the calculation of the initial size of the
3796238012
* Win32-specific heap. It cannot be negative.
3796338013
*/
3796438014
#ifndef SQLITE_WIN32_CACHE_SIZE
3796538015
# if SQLITE_DEFAULT_CACHE_SIZE>=0
37966
-# define SQLITE_WIN32_CACHE_SIZE (SQLITE_DEFAULT_CACHE_SIZE)
38016
+# define SQLITE_WIN32_CACHE_SIZE (SQLITE_DEFAULT_CACHE_SIZE)
3796738017
# else
37968
-# define SQLITE_WIN32_CACHE_SIZE (-(SQLITE_DEFAULT_CACHE_SIZE))
38018
+# define SQLITE_WIN32_CACHE_SIZE (-(SQLITE_DEFAULT_CACHE_SIZE))
3796938019
# endif
3797038020
#endif
3797138021
38022
+/*
38023
+ * Make sure that the calculated cache size, in pages, cannot cause the
38024
+ * initial size of the Win32-specific heap to exceed the maximum amount
38025
+ * of memory that can be specified in the call to HeapCreate.
38026
+ */
38027
+#if SQLITE_WIN32_CACHE_SIZE>SQLITE_WIN32_MAX_CACHE_SIZE
38028
+# undef SQLITE_WIN32_CACHE_SIZE
38029
+# define SQLITE_WIN32_CACHE_SIZE (2000)
38030
+#endif
38031
+
3797238032
/*
3797338033
* The initial size of the Win32-specific heap. This value may be zero.
3797438034
*/
3797538035
#ifndef SQLITE_WIN32_HEAP_INIT_SIZE
37976
-# define SQLITE_WIN32_HEAP_INIT_SIZE ((SQLITE_WIN32_CACHE_SIZE) * \
37977
- (SQLITE_DEFAULT_PAGE_SIZE) + 4194304)
38036
+# define SQLITE_WIN32_HEAP_INIT_SIZE ((SQLITE_WIN32_CACHE_SIZE) * \
38037
+ (SQLITE_DEFAULT_PAGE_SIZE) + \
38038
+ (SQLITE_WIN32_HEAP_INIT_EXTRA))
3797838039
#endif
3797938040
3798038041
/*
3798138042
* The maximum size of the Win32-specific heap. This value may be zero.
3798238043
*/
3798338044
#ifndef SQLITE_WIN32_HEAP_MAX_SIZE
37984
-# define SQLITE_WIN32_HEAP_MAX_SIZE (0)
38045
+# define SQLITE_WIN32_HEAP_MAX_SIZE (0)
3798538046
#endif
3798638047
3798738048
/*
3798838049
* The extra flags to use in calls to the Win32 heap APIs. This value may be
3798938050
* zero for the default behavior.
3799038051
*/
3799138052
#ifndef SQLITE_WIN32_HEAP_FLAGS
37992
-# define SQLITE_WIN32_HEAP_FLAGS (0)
38053
+# define SQLITE_WIN32_HEAP_FLAGS (0)
3799338054
#endif
3799438055
3799538056
3799638057
/*
3799738058
** The winMemData structure stores information required by the Win32-specific
@@ -44084,11 +44145,11 @@
4408444145
** This routine is for use inside of assert() statements only. For
4408544146
** example:
4408644147
**
4408744148
** assert( sqlite3PcachePageSanity(pPg) );
4408844149
*/
44089
-#if SQLITE_DEBUG
44150
+#ifdef SQLITE_DEBUG
4409044151
SQLITE_PRIVATE int sqlite3PcachePageSanity(PgHdr *pPg){
4409144152
PCache *pCache;
4409244153
assert( pPg!=0 );
4409344154
assert( pPg->pgno>0 || pPg->pPager==0 ); /* Page number is 1 or more */
4409444155
pCache = pPg->pCache;
@@ -63636,11 +63697,11 @@
6363663697
pCur->aiIdx[pCur->iPage] = 0;
6363763698
return getAndInitPage(pBt, newPgno, &pCur->apPage[pCur->iPage],
6363863699
pCur, pCur->curPagerFlags);
6363963700
}
6364063701
63641
-#if SQLITE_DEBUG
63702
+#ifdef SQLITE_DEBUG
6364263703
/*
6364363704
** Page pParent is an internal (non-leaf) tree page. This function
6364463705
** asserts that page number iChild is the left-child if the iIdx'th
6364563706
** cell in page pParent. Or, if iIdx is equal to the total number of
6364663707
** cells in pParent, that page number iChild is the right-child of
@@ -64178,10 +64239,34 @@
6417864239
** have been deleted? This API will need to change to return an error code
6417964240
** as well as the boolean result value.
6418064241
*/
6418164242
return (CURSOR_VALID!=pCur->eState);
6418264243
}
64244
+
64245
+/*
64246
+** Return an estimate for the number of rows in the table that pCur is
64247
+** pointing to. Return a negative number if no estimate is currently
64248
+** available.
64249
+*/
64250
+SQLITE_PRIVATE i64 sqlite3BtreeRowCountEst(BtCursor *pCur){
64251
+ i64 n;
64252
+ u8 i;
64253
+
64254
+ assert( cursorOwnsBtShared(pCur) );
64255
+ assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
64256
+
64257
+ /* Currently this interface is only called by the OP_IfSmaller
64258
+ ** opcode, and it that case the cursor will always be valid and
64259
+ ** will always point to a leaf node. */
64260
+ if( NEVER(pCur->eState!=CURSOR_VALID) ) return -1;
64261
+ if( NEVER(pCur->apPage[pCur->iPage]->leaf==0) ) return -1;
64262
+
64263
+ for(n=1, i=0; i<=pCur->iPage; i++){
64264
+ n *= pCur->apPage[i]->nCell;
64265
+ }
64266
+ return n;
64267
+}
6418364268
6418464269
/*
6418564270
** Advance the cursor to the next entry in the database. If
6418664271
** successful then set *pRes=0. If the cursor
6418764272
** was already pointing to the last entry in the database before
@@ -65023,11 +65108,11 @@
6502365108
** pPrior Where to write the pgno of the first overflow page
6502465109
**
6502565110
** Use a call to btreeParseCellPtr() to verify that the values above
6502665111
** were computed correctly.
6502765112
*/
65028
-#if SQLITE_DEBUG
65113
+#ifdef SQLITE_DEBUG
6502965114
{
6503065115
CellInfo info;
6503165116
pPage->xParseCell(pPage, pCell, &info);
6503265117
assert( nHeader==(int)(info.pPayload - pCell) );
6503365118
assert( info.nKey==pX->nKey );
@@ -73753,17 +73838,17 @@
7375373838
** Then the internal cache might have been left in an inconsistent
7375473839
** state. We need to rollback the statement transaction, if there is
7375573840
** one, or the complete transaction if there is no statement transaction.
7375673841
*/
7375773842
73843
+ if( p->magic!=VDBE_MAGIC_RUN ){
73844
+ return SQLITE_OK;
73845
+ }
7375873846
if( db->mallocFailed ){
7375973847
p->rc = SQLITE_NOMEM_BKPT;
7376073848
}
7376173849
closeAllCursors(p);
73762
- if( p->magic!=VDBE_MAGIC_RUN ){
73763
- return SQLITE_OK;
73764
- }
7376573850
checkActiveVdbeCnt(db);
7376673851
7376773852
/* No commit or rollback needed if the program never started or if the
7376873853
** SQL statement does not read or write a database file. */
7376973854
if( p->pc>=0 && p->bIsReader ){
@@ -74706,11 +74791,11 @@
7470674791
}
7470774792
assert( u<=pKeyInfo->nField + 1 );
7470874793
p->nField = u;
7470974794
}
7471074795
74711
-#if SQLITE_DEBUG
74796
+#ifdef SQLITE_DEBUG
7471274797
/*
7471374798
** This function compares two index or table record keys in the same way
7471474799
** as the sqlite3VdbeRecordCompare() routine. Unlike VdbeRecordCompare(),
7471574800
** this function deserializes and compares values using the
7471674801
** sqlite3VdbeSerialGet() and sqlite3MemCompare() functions. It is used
@@ -74811,11 +74896,11 @@
7481174896
if( pKeyInfo->db->mallocFailed ) return 1;
7481274897
return 0;
7481374898
}
7481474899
#endif
7481574900
74816
-#if SQLITE_DEBUG
74901
+#ifdef SQLITE_DEBUG
7481774902
/*
7481874903
** Count the number of fields (a.k.a. columns) in the record given by
7481974904
** pKey,nKey. The verify that this count is less than or equal to the
7482074905
** limit given by pKeyInfo->nField + pKeyInfo->nXField.
7482174906
**
@@ -79658,39 +79743,39 @@
7965879743
if( pCtx->pOut != pOut ){
7965979744
pCtx->pOut = pOut;
7966079745
for(i=pCtx->argc-1; i>=0; i--) pCtx->argv[i] = &aMem[pOp->p2+i];
7966179746
}
7966279747
79663
- memAboutToChange(p, pCtx->pOut);
79748
+ memAboutToChange(p, pOut);
7966479749
#ifdef SQLITE_DEBUG
7966579750
for(i=0; i<pCtx->argc; i++){
7966679751
assert( memIsValid(pCtx->argv[i]) );
7966779752
REGISTER_TRACE(pOp->p2+i, pCtx->argv[i]);
7966879753
}
7966979754
#endif
79670
- MemSetTypeFlag(pCtx->pOut, MEM_Null);
79755
+ MemSetTypeFlag(pOut, MEM_Null);
7967179756
pCtx->fErrorOrAux = 0;
7967279757
(*pCtx->pFunc->xSFunc)(pCtx, pCtx->argc, pCtx->argv);/* IMP: R-24505-23230 */
7967379758
7967479759
/* If the function returned an error, throw an exception */
7967579760
if( pCtx->fErrorOrAux ){
7967679761
if( pCtx->isError ){
79677
- sqlite3VdbeError(p, "%s", sqlite3_value_text(pCtx->pOut));
79762
+ sqlite3VdbeError(p, "%s", sqlite3_value_text(pOut));
7967879763
rc = pCtx->isError;
7967979764
}
7968079765
sqlite3VdbeDeleteAuxData(db, &p->pAuxData, pCtx->iOp, pOp->p1);
7968179766
if( rc ) goto abort_due_to_error;
7968279767
}
7968379768
7968479769
/* Copy the result of the function into register P3 */
7968579770
if( pOut->flags & (MEM_Str|MEM_Blob) ){
79686
- sqlite3VdbeChangeEncoding(pCtx->pOut, encoding);
79687
- if( sqlite3VdbeMemTooBig(pCtx->pOut) ) goto too_big;
79771
+ sqlite3VdbeChangeEncoding(pOut, encoding);
79772
+ if( sqlite3VdbeMemTooBig(pOut) ) goto too_big;
7968879773
}
7968979774
79690
- REGISTER_TRACE(pOp->p3, pCtx->pOut);
79691
- UPDATE_MAX_BLOBSIZE(pCtx->pOut);
79775
+ REGISTER_TRACE(pOp->p3, pOut);
79776
+ UPDATE_MAX_BLOBSIZE(pOut);
7969279777
break;
7969379778
}
7969479779
7969579780
/* Opcode: BitAnd P1 P2 P3 * *
7969679781
** Synopsis: r[P3]=r[P1]&r[P2]
@@ -80187,11 +80272,11 @@
8018780272
pKeyInfo = pOp->p4.pKeyInfo;
8018880273
assert( n>0 );
8018980274
assert( pKeyInfo!=0 );
8019080275
p1 = pOp->p1;
8019180276
p2 = pOp->p2;
80192
-#if SQLITE_DEBUG
80277
+#ifdef SQLITE_DEBUG
8019380278
if( aPermute ){
8019480279
int k, mx = 0;
8019580280
for(k=0; k<n; k++) if( aPermute[k]>mx ) mx = aPermute[k];
8019680281
assert( p1>0 && p1+mx<=(p->nMem+1 - p->nCursor)+1 );
8019780282
assert( p2>0 && p2+mx<=(p->nMem+1 - p->nCursor)+1 );
@@ -82836,10 +82921,37 @@
8283682921
assert( pOp->p2==0 );
8283782922
}
8283882923
break;
8283982924
}
8284082925
82926
+/* Opcode: IfSmaller P1 P2 P3 * *
82927
+**
82928
+** Estimate the number of rows in the table P1. Jump to P2 if that
82929
+** estimate is less than approximately 2**(0.1*P3).
82930
+*/
82931
+case OP_IfSmaller: { /* jump */
82932
+ VdbeCursor *pC;
82933
+ BtCursor *pCrsr;
82934
+ int res;
82935
+ i64 sz;
82936
+
82937
+ assert( pOp->p1>=0 && pOp->p1<p->nCursor );
82938
+ pC = p->apCsr[pOp->p1];
82939
+ assert( pC!=0 );
82940
+ pCrsr = pC->uc.pCursor;
82941
+ assert( pCrsr );
82942
+ rc = sqlite3BtreeFirst(pCrsr, &res);
82943
+ if( rc ) goto abort_due_to_error;
82944
+ if( res==0 ){
82945
+ sz = sqlite3BtreeRowCountEst(pCrsr);
82946
+ if( ALWAYS(sz>=0) && sqlite3LogEst((u64)sz)<pOp->p3 ) res = 1;
82947
+ }
82948
+ VdbeBranchTaken(res!=0,2);
82949
+ if( res ) goto jump_to_p2;
82950
+ break;
82951
+}
82952
+
8284182953
8284282954
/* Opcode: SorterSort P1 P2 * * *
8284382955
**
8284482956
** After all records have been inserted into the Sorter object
8284582957
** identified by P1, invoke this opcode to actually do the sorting.
@@ -83479,10 +83591,22 @@
8347983591
rc = sqlite3BtreeCreateTable(pDb->pBt, &pgno, flags);
8348083592
if( rc ) goto abort_due_to_error;
8348183593
pOut->u.i = pgno;
8348283594
break;
8348383595
}
83596
+
83597
+/* Opcode: SqlExec * * * P4 *
83598
+**
83599
+** Run the SQL statement or statements specified in the P4 string.
83600
+*/
83601
+case OP_SqlExec: {
83602
+ db->nSqlExec++;
83603
+ rc = sqlite3_exec(db, pOp->p4.z, 0, 0, 0);
83604
+ db->nSqlExec--;
83605
+ if( rc ) goto abort_due_to_error;
83606
+ break;
83607
+}
8348483608
8348583609
/* Opcode: ParseSchema P1 * * P4 *
8348683610
**
8348783611
** Read and parse all entries from the SQLITE_MASTER table of database P1
8348883612
** that match the WHERE clause P4.
@@ -83600,11 +83724,11 @@
8360083724
**
8360183725
** Do an analysis of the currently open database. Store in
8360283726
** register P1 the text of an error message describing any problems.
8360383727
** If no problems are found, store a NULL in register P1.
8360483728
**
83605
-** The register P3 contains the maximum number of allowed errors.
83729
+** The register P3 contains one less than the maximum number of allowed errors.
8360683730
** At most reg(P3) errors will be reported.
8360783731
** In other words, the analysis stops as soon as reg(P1) errors are
8360883732
** seen. Reg(P1) is updated with the number of errors remaining.
8360983733
**
8361083734
** The root page numbers of all tables in the database are integers
@@ -83633,18 +83757,18 @@
8363383757
assert( (pnErr->flags & (MEM_Str|MEM_Blob))==0 );
8363483758
pIn1 = &aMem[pOp->p1];
8363583759
assert( pOp->p5<db->nDb );
8363683760
assert( DbMaskTest(p->btreeMask, pOp->p5) );
8363783761
z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p5].pBt, aRoot, nRoot,
83638
- (int)pnErr->u.i, &nErr);
83639
- pnErr->u.i -= nErr;
83762
+ (int)pnErr->u.i+1, &nErr);
8364083763
sqlite3VdbeMemSetNull(pIn1);
8364183764
if( nErr==0 ){
8364283765
assert( z==0 );
8364383766
}else if( z==0 ){
8364483767
goto no_mem;
8364583768
}else{
83769
+ pnErr->u.i -= nErr-1;
8364683770
sqlite3VdbeMemSetStr(pIn1, z, -1, SQLITE_UTF8, sqlite3_free);
8364783771
}
8364883772
UPDATE_MAX_BLOBSIZE(pIn1);
8364983773
sqlite3VdbeChangeEncoding(pIn1, encoding);
8365083774
break;
@@ -92833,11 +92957,11 @@
9283392957
int nVal = sqlite3ExprVectorSize(pLeft);
9283492958
Select *pSelect = (pExpr->flags & EP_xIsSelect) ? pExpr->x.pSelect : 0;
9283592959
char *zRet;
9283692960
9283792961
assert( pExpr->op==TK_IN );
92838
- zRet = sqlite3DbMallocZero(pParse->db, nVal+1);
92962
+ zRet = sqlite3DbMallocRaw(pParse->db, nVal+1);
9283992963
if( zRet ){
9284092964
int i;
9284192965
for(i=0; i<nVal; i++){
9284292966
Expr *pA = sqlite3VectorFieldSubexpr(pLeft, i);
9284392967
char a = sqlite3ExprAffinity(pA);
@@ -93738,11 +93862,11 @@
9373893862
** Clear all column cache entries.
9373993863
*/
9374093864
SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse *pParse){
9374193865
int i;
9374293866
93743
-#if SQLITE_DEBUG
93867
+#ifdef SQLITE_DEBUG
9374493868
if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
9374593869
printf("CLEAR\n");
9374693870
}
9374793871
#endif
9374893872
for(i=0; i<pParse->nColCache; i++){
@@ -95145,10 +95269,21 @@
9514595269
if( pA->a[i].sortOrder!=pB->a[i].sortOrder ) return 1;
9514695270
if( sqlite3ExprCompare(pExprA, pExprB, iTab) ) return 1;
9514795271
}
9514895272
return 0;
9514995273
}
95274
+
95275
+/*
95276
+** Like sqlite3ExprCompare() except COLLATE operators at the top-level
95277
+** are ignored.
95278
+*/
95279
+SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){
95280
+ return sqlite3ExprCompare(
95281
+ sqlite3ExprSkipCollate(pA),
95282
+ sqlite3ExprSkipCollate(pB),
95283
+ iTab);
95284
+}
9515095285
9515195286
/*
9515295287
** Return true if we can prove the pE2 will always be true if pE1 is
9515395288
** true. Return false if we cannot complete the proof or if pE2 might
9515495289
** be false. Examples:
@@ -96698,10 +96833,11 @@
9669896833
Stat4Sample current; /* Current row as a Stat4Sample */
9669996834
u32 iPrn; /* Pseudo-random number used for sampling */
9670096835
Stat4Sample *aBest; /* Array of nCol best samples */
9670196836
int iMin; /* Index in a[] of entry with minimum score */
9670296837
int nSample; /* Current number of samples */
96838
+ int nMaxEqZero; /* Max leading 0 in anEq[] for any a[] entry */
9670396839
int iGet; /* Index of current sample accessed by stat_get() */
9670496840
Stat4Sample *a; /* Array of mxSample Stat4Sample objects */
9670596841
sqlite3 *db; /* Database connection, for malloc() */
9670696842
};
9670796843
@@ -96962,10 +97098,17 @@
9696297098
int i;
9696397099
9696497100
assert( IsStat4 || nEqZero==0 );
9696597101
9696697102
#ifdef SQLITE_ENABLE_STAT4
97103
+ /* Stat4Accum.nMaxEqZero is set to the maximum number of leading 0
97104
+ ** values in the anEq[] array of any sample in Stat4Accum.a[]. In
97105
+ ** other words, if nMaxEqZero is n, then it is guaranteed that there
97106
+ ** are no samples with Stat4Sample.anEq[m]==0 for (m>=n). */
97107
+ if( nEqZero>p->nMaxEqZero ){
97108
+ p->nMaxEqZero = nEqZero;
97109
+ }
9696797110
if( pNew->isPSample==0 ){
9696897111
Stat4Sample *pUpgrade = 0;
9696997112
assert( pNew->anEq[pNew->iCol]>0 );
9697097113
9697197114
/* This sample is being added because the prefix that ends in column
@@ -97059,16 +97202,26 @@
9705997202
if( p->nSample<p->mxSample || sampleIsBetter(p, pBest, &p->a[p->iMin]) ){
9706097203
sampleInsert(p, pBest, i);
9706197204
}
9706297205
}
9706397206
97064
- /* Update the anEq[] fields of any samples already collected. */
97207
+ /* Check that no sample contains an anEq[] entry with an index of
97208
+ ** p->nMaxEqZero or greater set to zero. */
9706597209
for(i=p->nSample-1; i>=0; i--){
9706697210
int j;
97067
- for(j=iChng; j<p->nCol; j++){
97068
- if( p->a[i].anEq[j]==0 ) p->a[i].anEq[j] = p->current.anEq[j];
97211
+ for(j=p->nMaxEqZero; j<p->nCol; j++) assert( p->a[i].anEq[j]>0 );
97212
+ }
97213
+
97214
+ /* Update the anEq[] fields of any samples already collected. */
97215
+ if( iChng<p->nMaxEqZero ){
97216
+ for(i=p->nSample-1; i>=0; i--){
97217
+ int j;
97218
+ for(j=iChng; j<p->nCol; j++){
97219
+ if( p->a[i].anEq[j]==0 ) p->a[i].anEq[j] = p->current.anEq[j];
97220
+ }
9706997221
}
97222
+ p->nMaxEqZero = iChng;
9707097223
}
9707197224
#endif
9707297225
9707397226
#if defined(SQLITE_ENABLE_STAT3) && !defined(SQLITE_ENABLE_STAT4)
9707497227
if( iChng==0 ){
@@ -97778,44 +97931,32 @@
9777897931
/* Form 1: Analyze everything */
9777997932
for(i=0; i<db->nDb; i++){
9778097933
if( i==1 ) continue; /* Do not analyze the TEMP database */
9778197934
analyzeDatabase(pParse, i);
9778297935
}
97783
- }else if( pName2->n==0 ){
97784
- /* Form 2: Analyze the database or table named */
97785
- iDb = sqlite3FindDb(db, pName1);
97786
- if( iDb>=0 ){
97787
- analyzeDatabase(pParse, iDb);
97788
- }else{
97789
- z = sqlite3NameFromToken(db, pName1);
97790
- if( z ){
97791
- if( (pIdx = sqlite3FindIndex(db, z, 0))!=0 ){
97792
- analyzeTable(pParse, pIdx->pTable, pIdx);
97793
- }else if( (pTab = sqlite3LocateTable(pParse, 0, z, 0))!=0 ){
97794
- analyzeTable(pParse, pTab, 0);
97795
- }
97796
- sqlite3DbFree(db, z);
97797
- }
97798
- }
97799
- }else{
97800
- /* Form 3: Analyze the fully qualified table name */
97936
+ }else if( pName2->n==0 && (iDb = sqlite3FindDb(db, pName1))>=0 ){
97937
+ /* Analyze the schema named as the argument */
97938
+ analyzeDatabase(pParse, iDb);
97939
+ }else{
97940
+ /* Form 3: Analyze the table or index named as an argument */
9780197941
iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pTableName);
9780297942
if( iDb>=0 ){
97803
- zDb = db->aDb[iDb].zDbSName;
97943
+ zDb = pName2->n ? db->aDb[iDb].zDbSName : 0;
9780497944
z = sqlite3NameFromToken(db, pTableName);
9780597945
if( z ){
9780697946
if( (pIdx = sqlite3FindIndex(db, z, zDb))!=0 ){
9780797947
analyzeTable(pParse, pIdx->pTable, pIdx);
9780897948
}else if( (pTab = sqlite3LocateTable(pParse, 0, z, zDb))!=0 ){
9780997949
analyzeTable(pParse, pTab, 0);
9781097950
}
9781197951
sqlite3DbFree(db, z);
9781297952
}
97813
- }
97953
+ }
9781497954
}
97815
- v = sqlite3GetVdbe(pParse);
97816
- if( v ) sqlite3VdbeAddOp0(v, OP_Expire);
97955
+ if( db->nSqlExec==0 && (v = sqlite3GetVdbe(pParse))!=0 ){
97956
+ sqlite3VdbeAddOp0(v, OP_Expire);
97957
+ }
9781797958
}
9781897959
9781997960
/*
9782097961
** Used to pass information from the analyzer reader through to the
9782197962
** callback routine.
@@ -97940,19 +98081,24 @@
9794098081
}
9794198082
aiRowEst = pIndex->aiRowEst;
9794298083
#endif
9794398084
pIndex->bUnordered = 0;
9794498085
decodeIntArray((char*)z, nCol, aiRowEst, pIndex->aiRowLogEst, pIndex);
97945
- if( pIndex->pPartIdxWhere==0 ) pTable->nRowLogEst = pIndex->aiRowLogEst[0];
98086
+ pIndex->hasStat1 = 1;
98087
+ if( pIndex->pPartIdxWhere==0 ){
98088
+ pTable->nRowLogEst = pIndex->aiRowLogEst[0];
98089
+ pTable->tabFlags |= TF_HasStat1;
98090
+ }
9794698091
}else{
9794798092
Index fakeIdx;
9794898093
fakeIdx.szIdxRow = pTable->szTabRow;
9794998094
#ifdef SQLITE_ENABLE_COSTMULT
9795098095
fakeIdx.pTable = pTable;
9795198096
#endif
9795298097
decodeIntArray((char*)z, 1, 0, &pTable->nRowLogEst, &fakeIdx);
9795398098
pTable->szTabRow = fakeIdx.szIdxRow;
98099
+ pTable->tabFlags |= TF_HasStat1;
9795498100
}
9795598101
9795698102
return 0;
9795798103
}
9795898104
@@ -98243,19 +98389,24 @@
9824398389
SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
9824498390
analysisInfo sInfo;
9824598391
HashElem *i;
9824698392
char *zSql;
9824798393
int rc = SQLITE_OK;
98394
+ Schema *pSchema = db->aDb[iDb].pSchema;
9824898395
9824998396
assert( iDb>=0 && iDb<db->nDb );
9825098397
assert( db->aDb[iDb].pBt!=0 );
9825198398
9825298399
/* Clear any prior statistics */
9825398400
assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
98254
- for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){
98401
+ for(i=sqliteHashFirst(&pSchema->tblHash); i; i=sqliteHashNext(i)){
98402
+ Table *pTab = sqliteHashData(i);
98403
+ pTab->tabFlags &= ~TF_HasStat1;
98404
+ }
98405
+ for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){
9825598406
Index *pIdx = sqliteHashData(i);
98256
- pIdx->aiRowLogEst[0] = 0;
98407
+ pIdx->hasStat1 = 0;
9825798408
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
9825898409
sqlite3DeleteIndexSamples(db, pIdx);
9825998410
pIdx->aSample = 0;
9826098411
#endif
9826198412
}
@@ -98274,23 +98425,23 @@
9827498425
}
9827598426
}
9827698427
9827798428
/* Set appropriate defaults on all indexes not in the sqlite_stat1 table */
9827898429
assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
98279
- for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){
98430
+ for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){
9828098431
Index *pIdx = sqliteHashData(i);
98281
- if( pIdx->aiRowLogEst[0]==0 ) sqlite3DefaultRowEst(pIdx);
98432
+ if( !pIdx->hasStat1 ) sqlite3DefaultRowEst(pIdx);
9828298433
}
9828398434
9828498435
/* Load the statistics from the sqlite_stat4 table. */
9828598436
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
9828698437
if( rc==SQLITE_OK && OptimizationEnabled(db, SQLITE_Stat34) ){
9828798438
db->lookaside.bDisable++;
9828898439
rc = loadStat4(db, sInfo.zDatabase);
9828998440
db->lookaside.bDisable--;
9829098441
}
98291
- for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){
98442
+ for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){
9829298443
Index *pIdx = sqliteHashData(i);
9829398444
sqlite3_free(pIdx->aiRowEst);
9829498445
pIdx->aiRowEst = 0;
9829598446
}
9829698447
#endif
@@ -100271,10 +100422,11 @@
100271100422
SQLITE_PRIVATE void sqlite3AddNotNull(Parse *pParse, int onError){
100272100423
Table *p;
100273100424
p = pParse->pNewTable;
100274100425
if( p==0 || NEVER(p->nCol<1) ) return;
100275100426
p->aCol[p->nCol-1].notNull = (u8)onError;
100427
+ p->tabFlags |= TF_HasNotNull;
100276100428
}
100277100429
100278100430
/*
100279100431
** Scan the column type name zType (length nType) and return the
100280100432
** associated affinity type.
@@ -102609,10 +102761,13 @@
102609102761
/* 10, 9, 8, 7, 6 */
102610102762
LogEst aVal[] = { 33, 32, 30, 28, 26 };
102611102763
LogEst *a = pIdx->aiRowLogEst;
102612102764
int nCopy = MIN(ArraySize(aVal), pIdx->nKeyCol);
102613102765
int i;
102766
+
102767
+ /* Indexes with default row estimates should not have stat1 data */
102768
+ assert( !pIdx->hasStat1 );
102614102769
102615102770
/* Set the first entry (number of rows in the index) to the estimated
102616102771
** number of rows in the table, or half the number of rows in the table
102617102772
** for a partial index. But do not let the estimate drop below 10. */
102618102773
a[0] = pIdx->pTable->nRowLogEst;
@@ -109798,10 +109953,13 @@
109798109953
VdbeComment((v, "%s", iField<0 ? "rowid" : pTab->aCol[iField].zName));
109799109954
}
109800109955
}
109801109956
sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]);
109802109957
VdbeComment((v, "for %s", pIdx->zName));
109958
+#ifdef SQLITE_ENABLE_NULL_TRIM
109959
+ if( pIdx->idxType==2 ) sqlite3SetMakeRecordP5(v, pIdx->pTable);
109960
+#endif
109803109961
109804109962
/* In an UPDATE operation, if this index is the PRIMARY KEY index
109805109963
** of a WITHOUT ROWID table and there has been no change the
109806109964
** primary key, then no collision is possible. The collision detection
109807109965
** logic below can all be skipped. */
@@ -109953,12 +110111,15 @@
109953110111
109954110112
/* Records with omitted columns are only allowed for schema format
109955110113
** version 2 and later (SQLite version 3.1.4, 2005-02-20). */
109956110114
if( pTab->pSchema->file_format<2 ) return;
109957110115
109958
- for(i=pTab->nCol; i>1 && pTab->aCol[i-1].pDflt==0; i--){}
109959
- sqlite3VdbeChangeP5(v, i);
110116
+ for(i=pTab->nCol-1; i>0; i--){
110117
+ if( pTab->aCol[i].pDflt!=0 ) break;
110118
+ if( pTab->aCol[i].colFlags & COLFLAG_PRIMKEY ) break;
110119
+ }
110120
+ sqlite3VdbeChangeP5(v, i+1);
109960110121
}
109961110122
#endif
109962110123
109963110124
/*
109964110125
** This routine generates code to finish the INSERT or UPDATE operation
@@ -110244,11 +110405,11 @@
110244110405
}
110245110406
if( sqlite3TriggerList(pParse, pDest) ){
110246110407
return 0; /* tab1 must not have triggers */
110247110408
}
110248110409
#ifndef SQLITE_OMIT_VIRTUALTABLE
110249
- if( pDest->tabFlags & TF_Virtual ){
110410
+ if( IsVirtual(pDest) ){
110250110411
return 0; /* tab1 must not be a virtual table */
110251110412
}
110252110413
#endif
110253110414
if( onError==OE_Default ){
110254110415
if( pDest->iPKey>=0 ) onError = pDest->keyConf;
@@ -110306,11 +110467,11 @@
110306110467
}
110307110468
if( HasRowid(pDest)!=HasRowid(pSrc) ){
110308110469
return 0; /* source and destination must both be WITHOUT ROWID or not */
110309110470
}
110310110471
#ifndef SQLITE_OMIT_VIRTUALTABLE
110311
- if( pSrc->tabFlags & TF_Virtual ){
110472
+ if( IsVirtual(pSrc) ){
110312110473
return 0; /* tab2 must not be a virtual table */
110313110474
}
110314110475
#endif
110315110476
if( pSrc->pSelect ){
110316110477
return 0; /* tab2 may not be a view */
@@ -110603,11 +110764,11 @@
110603110764
/* Invoke the callback function if required */
110604110765
if( xCallback && (SQLITE_ROW==rc ||
110605110766
(SQLITE_DONE==rc && !callbackIsInit
110606110767
&& db->flags&SQLITE_NullCallback)) ){
110607110768
if( !callbackIsInit ){
110608
- azCols = sqlite3DbMallocZero(db, 2*nCol*sizeof(const char*) + 1);
110769
+ azCols = sqlite3DbMallocRaw(db, (2*nCol+1)*sizeof(const char*));
110609110770
if( azCols==0 ){
110610110771
goto exec_out;
110611110772
}
110612110773
for(i=0; i<nCol; i++){
110613110774
azCols[i] = (char *)sqlite3_column_name(pStmt, i);
@@ -110624,10 +110785,11 @@
110624110785
if( !azVals[i] && sqlite3_column_type(pStmt, i)!=SQLITE_NULL ){
110625110786
sqlite3OomFault(db);
110626110787
goto exec_out;
110627110788
}
110628110789
}
110790
+ azVals[i] = 0;
110629110791
}
110630110792
if( xCallback(pArg, nCol, azVals, azCols) ){
110631110793
/* EVIDENCE-OF: R-38229-40159 If the callback function to
110632110794
** sqlite3_exec() returns non-zero, then sqlite3_exec() will
110633110795
** return SQLITE_ABORT. */
@@ -112094,15 +112256,15 @@
112094112256
#define PragTyp_JOURNAL_SIZE_LIMIT 20
112095112257
#define PragTyp_LOCK_PROXY_FILE 21
112096112258
#define PragTyp_LOCKING_MODE 22
112097112259
#define PragTyp_PAGE_COUNT 23
112098112260
#define PragTyp_MMAP_SIZE 24
112099
-#define PragTyp_PAGE_SIZE 25
112100
-#define PragTyp_SECURE_DELETE 26
112101
-#define PragTyp_SHRINK_MEMORY 27
112102
-#define PragTyp_SOFT_HEAP_LIMIT 28
112103
-#define PragTyp_STATS 29
112261
+#define PragTyp_OPTIMIZE 25
112262
+#define PragTyp_PAGE_SIZE 26
112263
+#define PragTyp_SECURE_DELETE 27
112264
+#define PragTyp_SHRINK_MEMORY 28
112265
+#define PragTyp_SOFT_HEAP_LIMIT 29
112104112266
#define PragTyp_SYNCHRONOUS 30
112105112267
#define PragTyp_TABLE_INFO 31
112106112268
#define PragTyp_TEMP_STORE 32
112107112269
#define PragTyp_TEMP_STORE_DIRECTORY 33
112108112270
#define PragTyp_THREADS 34
@@ -112112,10 +112274,11 @@
112112112274
#define PragTyp_HEXKEY 38
112113112275
#define PragTyp_KEY 39
112114112276
#define PragTyp_REKEY 40
112115112277
#define PragTyp_LOCK_STATUS 41
112116112278
#define PragTyp_PARSER_TRACE 42
112279
+#define PragTyp_STATS 43
112117112280
112118112281
/* Property flags associated with various pragma. */
112119112282
#define PragFlg_NeedSchema 0x01 /* Force schema load before running */
112120112283
#define PragFlg_NoColumns 0x02 /* OP_ResultRow called with zero columns */
112121112284
#define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */
@@ -112135,51 +112298,52 @@
112135112298
/* 2 */ "name",
112136112299
/* 3 */ "type",
112137112300
/* 4 */ "notnull",
112138112301
/* 5 */ "dflt_value",
112139112302
/* 6 */ "pk",
112140
- /* 7 */ "table", /* Used by: stats */
112141
- /* 8 */ "index",
112142
- /* 9 */ "width",
112143
- /* 10 */ "height",
112144
- /* 11 */ "seqno", /* Used by: index_info */
112145
- /* 12 */ "cid",
112146
- /* 13 */ "name",
112147
- /* 14 */ "seqno", /* Used by: index_xinfo */
112148
- /* 15 */ "cid",
112149
- /* 16 */ "name",
112150
- /* 17 */ "desc",
112151
- /* 18 */ "coll",
112152
- /* 19 */ "key",
112153
- /* 20 */ "seq", /* Used by: index_list */
112154
- /* 21 */ "name",
112155
- /* 22 */ "unique",
112156
- /* 23 */ "origin",
112157
- /* 24 */ "partial",
112158
- /* 25 */ "seq", /* Used by: database_list */
112159
- /* 26 */ "name",
112160
- /* 27 */ "file",
112161
- /* 28 */ "seq", /* Used by: collation_list */
112162
- /* 29 */ "name",
112163
- /* 30 */ "id", /* Used by: foreign_key_list */
112164
- /* 31 */ "seq",
112165
- /* 32 */ "table",
112166
- /* 33 */ "from",
112167
- /* 34 */ "to",
112168
- /* 35 */ "on_update",
112169
- /* 36 */ "on_delete",
112170
- /* 37 */ "match",
112171
- /* 38 */ "table", /* Used by: foreign_key_check */
112172
- /* 39 */ "rowid",
112173
- /* 40 */ "parent",
112174
- /* 41 */ "fkid",
112175
- /* 42 */ "busy", /* Used by: wal_checkpoint */
112176
- /* 43 */ "log",
112177
- /* 44 */ "checkpointed",
112178
- /* 45 */ "timeout", /* Used by: busy_timeout */
112179
- /* 46 */ "database", /* Used by: lock_status */
112180
- /* 47 */ "status",
112303
+ /* 7 */ "tbl", /* Used by: stats */
112304
+ /* 8 */ "idx",
112305
+ /* 9 */ "wdth",
112306
+ /* 10 */ "hght",
112307
+ /* 11 */ "flgs",
112308
+ /* 12 */ "seqno", /* Used by: index_info */
112309
+ /* 13 */ "cid",
112310
+ /* 14 */ "name",
112311
+ /* 15 */ "seqno", /* Used by: index_xinfo */
112312
+ /* 16 */ "cid",
112313
+ /* 17 */ "name",
112314
+ /* 18 */ "desc",
112315
+ /* 19 */ "coll",
112316
+ /* 20 */ "key",
112317
+ /* 21 */ "seq", /* Used by: index_list */
112318
+ /* 22 */ "name",
112319
+ /* 23 */ "unique",
112320
+ /* 24 */ "origin",
112321
+ /* 25 */ "partial",
112322
+ /* 26 */ "seq", /* Used by: database_list */
112323
+ /* 27 */ "name",
112324
+ /* 28 */ "file",
112325
+ /* 29 */ "seq", /* Used by: collation_list */
112326
+ /* 30 */ "name",
112327
+ /* 31 */ "id", /* Used by: foreign_key_list */
112328
+ /* 32 */ "seq",
112329
+ /* 33 */ "table",
112330
+ /* 34 */ "from",
112331
+ /* 35 */ "to",
112332
+ /* 36 */ "on_update",
112333
+ /* 37 */ "on_delete",
112334
+ /* 38 */ "match",
112335
+ /* 39 */ "table", /* Used by: foreign_key_check */
112336
+ /* 40 */ "rowid",
112337
+ /* 41 */ "parent",
112338
+ /* 42 */ "fkid",
112339
+ /* 43 */ "busy", /* Used by: wal_checkpoint */
112340
+ /* 44 */ "log",
112341
+ /* 45 */ "checkpointed",
112342
+ /* 46 */ "timeout", /* Used by: busy_timeout */
112343
+ /* 47 */ "database", /* Used by: lock_status */
112344
+ /* 48 */ "status",
112181112345
};
112182112346
112183112347
/* Definitions of all built-in pragmas */
112184112348
typedef struct PragmaName {
112185112349
const char *const zName; /* Name of pragma */
@@ -112221,11 +112385,11 @@
112221112385
#endif
112222112386
#endif
112223112387
{/* zName: */ "busy_timeout",
112224112388
/* ePragTyp: */ PragTyp_BUSY_TIMEOUT,
112225112389
/* ePragFlg: */ PragFlg_Result0,
112226
- /* ColNames: */ 45, 1,
112390
+ /* ColNames: */ 46, 1,
112227112391
/* iArg: */ 0 },
112228112392
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112229112393
{/* zName: */ "cache_size",
112230112394
/* ePragTyp: */ PragTyp_CACHE_SIZE,
112231112395
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
@@ -112258,11 +112422,11 @@
112258112422
#endif
112259112423
#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
112260112424
{/* zName: */ "collation_list",
112261112425
/* ePragTyp: */ PragTyp_COLLATION_LIST,
112262112426
/* ePragFlg: */ PragFlg_Result0,
112263
- /* ColNames: */ 28, 2,
112427
+ /* ColNames: */ 29, 2,
112264112428
/* iArg: */ 0 },
112265112429
#endif
112266112430
#if !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)
112267112431
{/* zName: */ "compile_options",
112268112432
/* ePragTyp: */ PragTyp_COMPILE_OPTIONS,
@@ -112293,11 +112457,11 @@
112293112457
#endif
112294112458
#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
112295112459
{/* zName: */ "database_list",
112296112460
/* ePragTyp: */ PragTyp_DATABASE_LIST,
112297112461
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0,
112298
- /* ColNames: */ 25, 3,
112462
+ /* ColNames: */ 26, 3,
112299112463
/* iArg: */ 0 },
112300112464
#endif
112301112465
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)
112302112466
{/* zName: */ "default_cache_size",
112303112467
/* ePragTyp: */ PragTyp_DEFAULT_CACHE_SIZE,
@@ -112330,18 +112494,18 @@
112330112494
#endif
112331112495
#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
112332112496
{/* zName: */ "foreign_key_check",
112333112497
/* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK,
112334112498
/* ePragFlg: */ PragFlg_NeedSchema,
112335
- /* ColNames: */ 38, 4,
112499
+ /* ColNames: */ 39, 4,
112336112500
/* iArg: */ 0 },
112337112501
#endif
112338112502
#if !defined(SQLITE_OMIT_FOREIGN_KEY)
112339112503
{/* zName: */ "foreign_key_list",
112340112504
/* ePragTyp: */ PragTyp_FOREIGN_KEY_LIST,
112341112505
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
112342
- /* ColNames: */ 30, 8,
112506
+ /* ColNames: */ 31, 8,
112343112507
/* iArg: */ 0 },
112344112508
#endif
112345112509
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112346112510
#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
112347112511
{/* zName: */ "foreign_keys",
@@ -112400,21 +112564,21 @@
112400112564
#endif
112401112565
#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
112402112566
{/* zName: */ "index_info",
112403112567
/* ePragTyp: */ PragTyp_INDEX_INFO,
112404112568
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
112405
- /* ColNames: */ 11, 3,
112569
+ /* ColNames: */ 12, 3,
112406112570
/* iArg: */ 0 },
112407112571
{/* zName: */ "index_list",
112408112572
/* ePragTyp: */ PragTyp_INDEX_LIST,
112409112573
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
112410
- /* ColNames: */ 20, 5,
112574
+ /* ColNames: */ 21, 5,
112411112575
/* iArg: */ 0 },
112412112576
{/* zName: */ "index_xinfo",
112413112577
/* ePragTyp: */ PragTyp_INDEX_INFO,
112414112578
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
112415
- /* ColNames: */ 14, 6,
112579
+ /* ColNames: */ 15, 6,
112416112580
/* iArg: */ 1 },
112417112581
#endif
112418112582
#if !defined(SQLITE_OMIT_INTEGRITY_CHECK)
112419112583
{/* zName: */ "integrity_check",
112420112584
/* ePragTyp: */ PragTyp_INTEGRITY_CHECK,
@@ -112457,11 +112621,11 @@
112457112621
#endif
112458112622
#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
112459112623
{/* zName: */ "lock_status",
112460112624
/* ePragTyp: */ PragTyp_LOCK_STATUS,
112461112625
/* ePragFlg: */ PragFlg_Result0,
112462
- /* ColNames: */ 46, 2,
112626
+ /* ColNames: */ 47, 2,
112463112627
/* iArg: */ 0 },
112464112628
#endif
112465112629
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112466112630
{/* zName: */ "locking_mode",
112467112631
/* ePragTyp: */ PragTyp_LOCKING_MODE,
@@ -112476,10 +112640,17 @@
112476112640
{/* zName: */ "mmap_size",
112477112641
/* ePragTyp: */ PragTyp_MMAP_SIZE,
112478112642
/* ePragFlg: */ 0,
112479112643
/* ColNames: */ 0, 0,
112480112644
/* iArg: */ 0 },
112645
+#endif
112646
+ {/* zName: */ "optimize",
112647
+ /* ePragTyp: */ PragTyp_OPTIMIZE,
112648
+ /* ePragFlg: */ PragFlg_NoColumns,
112649
+ /* ColNames: */ 0, 0,
112650
+ /* iArg: */ 0 },
112651
+#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112481112652
{/* zName: */ "page_count",
112482112653
/* ePragTyp: */ PragTyp_PAGE_COUNT,
112483112654
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
112484112655
/* ColNames: */ 0, 0,
112485112656
/* iArg: */ 0 },
@@ -112574,15 +112745,15 @@
112574112745
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112575112746
/* ColNames: */ 0, 0,
112576112747
/* iArg: */ SQLITE_SqlTrace },
112577112748
#endif
112578112749
#endif
112579
-#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
112750
+#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) && defined(SQLITE_DEBUG)
112580112751
{/* zName: */ "stats",
112581112752
/* ePragTyp: */ PragTyp_STATS,
112582112753
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
112583
- /* ColNames: */ 7, 4,
112754
+ /* ColNames: */ 7, 5,
112584112755
/* iArg: */ 0 },
112585112756
#endif
112586112757
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112587112758
{/* zName: */ "synchronous",
112588112759
/* ePragTyp: */ PragTyp_SYNCHRONOUS,
@@ -112657,11 +112828,11 @@
112657112828
/* ColNames: */ 0, 0,
112658112829
/* iArg: */ 0 },
112659112830
{/* zName: */ "wal_checkpoint",
112660112831
/* ePragTyp: */ PragTyp_WAL_CHECKPOINT,
112661112832
/* ePragFlg: */ PragFlg_NeedSchema,
112662
- /* ColNames: */ 42, 3,
112833
+ /* ColNames: */ 43, 3,
112663112834
/* iArg: */ 0 },
112664112835
#endif
112665112836
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112666112837
{/* zName: */ "writable_schema",
112667112838
/* ePragTyp: */ PragTyp_FLAG,
@@ -112668,11 +112839,11 @@
112668112839
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112669112840
/* ColNames: */ 0, 0,
112670112841
/* iArg: */ SQLITE_WriteSchema|SQLITE_RecoveryMode },
112671112842
#endif
112672112843
};
112673
-/* Number of pragmas: 60 on by default, 73 total. */
112844
+/* Number of pragmas: 60 on by default, 74 total. */
112674112845
112675112846
/************** End of pragma.h **********************************************/
112676112847
/************** Continuing where we left off in pragma.c *********************/
112677112848
112678112849
/*
@@ -112937,10 +113108,26 @@
112937113108
lwr = mid + 1;
112938113109
}
112939113110
}
112940113111
return lwr>upr ? 0 : &aPragmaName[mid];
112941113112
}
113113
+
113114
+/*
113115
+** Helper subroutine for PRAGMA integrity_check:
113116
+**
113117
+** Generate code to output a single-column result row with the result
113118
+** held in register regResult. Decrement the result count and halt if
113119
+** the maximum number of result rows have been issued.
113120
+*/
113121
+static int integrityCheckResultRow(Vdbe *v, int regResult){
113122
+ int addr;
113123
+ sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, 1);
113124
+ addr = sqlite3VdbeAddOp3(v, OP_IfPos, 1, sqlite3VdbeCurrentAddr(v)+2, 1);
113125
+ VdbeCoverage(v);
113126
+ sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);
113127
+ return addr;
113128
+}
112942113129
112943113130
/*
112944113131
** Process a pragma statement.
112945113132
**
112946113133
** Pragmas are of this form:
@@ -113741,33 +113928,37 @@
113741113928
}
113742113929
}
113743113930
}
113744113931
break;
113745113932
113933
+#ifdef SQLITE_DEBUG
113746113934
case PragTyp_STATS: {
113747113935
Index *pIdx;
113748113936
HashElem *i;
113749
- pParse->nMem = 4;
113937
+ pParse->nMem = 5;
113750113938
sqlite3CodeVerifySchema(pParse, iDb);
113751113939
for(i=sqliteHashFirst(&pDb->pSchema->tblHash); i; i=sqliteHashNext(i)){
113752113940
Table *pTab = sqliteHashData(i);
113753
- sqlite3VdbeMultiLoad(v, 1, "ssii",
113941
+ sqlite3VdbeMultiLoad(v, 1, "ssiii",
113754113942
pTab->zName,
113755113943
0,
113756113944
pTab->szTabRow,
113757
- pTab->nRowLogEst);
113758
- sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 4);
113945
+ pTab->nRowLogEst,
113946
+ pTab->tabFlags);
113947
+ sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 5);
113759113948
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
113760
- sqlite3VdbeMultiLoad(v, 2, "sii",
113949
+ sqlite3VdbeMultiLoad(v, 2, "siii",
113761113950
pIdx->zName,
113762113951
pIdx->szIdxRow,
113763
- pIdx->aiRowLogEst[0]);
113764
- sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 4);
113952
+ pIdx->aiRowLogEst[0],
113953
+ pIdx->hasStat1);
113954
+ sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 5);
113765113955
}
113766113956
}
113767113957
}
113768113958
break;
113959
+#endif
113769113960
113770113961
case PragTyp_INDEX_INFO: if( zRight ){
113771113962
Index *pIdx;
113772113963
Table *pTab;
113773113964
pIdx = sqlite3FindIndex(db, zRight, zDb);
@@ -114020,13 +114211,21 @@
114020114211
#ifndef SQLITE_INTEGRITY_CHECK_ERROR_MAX
114021114212
# define SQLITE_INTEGRITY_CHECK_ERROR_MAX 100
114022114213
#endif
114023114214
114024114215
#ifndef SQLITE_OMIT_INTEGRITY_CHECK
114025
- /* Pragma "quick_check" is reduced version of
114216
+ /* PRAGMA integrity_check
114217
+ ** PRAGMA integrity_check(N)
114218
+ ** PRAGMA quick_check
114219
+ ** PRAGMA quick_check(N)
114220
+ **
114221
+ ** Verify the integrity of the database.
114222
+ **
114223
+ ** The "quick_check" is reduced version of
114026114224
** integrity_check designed to detect most database corruption
114027
- ** without most of the overhead of a full integrity-check.
114225
+ ** without the overhead of cross-checking indexes. Quick_check
114226
+ ** is linear time wherease integrity_check is O(NlogN).
114028114227
*/
114029114228
case PragTyp_INTEGRITY_CHECK: {
114030114229
int i, j, addr, mxErr;
114031114230
114032114231
int isQuick = (sqlite3Tolower(zLeft[0])=='q');
@@ -114053,11 +114252,11 @@
114053114252
sqlite3GetInt32(zRight, &mxErr);
114054114253
if( mxErr<=0 ){
114055114254
mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;
114056114255
}
114057114256
}
114058
- sqlite3VdbeAddOp2(v, OP_Integer, mxErr, 1); /* reg[1] holds errors left */
114257
+ sqlite3VdbeAddOp2(v, OP_Integer, mxErr-1, 1); /* reg[1] holds errors left */
114059114258
114060114259
/* Do an integrity check on each database file */
114061114260
for(i=0; i<db->nDb; i++){
114062114261
HashElem *x;
114063114262
Hash *pTbls;
@@ -114068,14 +114267,10 @@
114068114267
114069114268
if( OMIT_TEMPDB && i==1 ) continue;
114070114269
if( iDb>=0 && i!=iDb ) continue;
114071114270
114072114271
sqlite3CodeVerifySchema(pParse, i);
114073
- addr = sqlite3VdbeAddOp1(v, OP_IfPos, 1); /* Halt if out of errors */
114074
- VdbeCoverage(v);
114075
- sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);
114076
- sqlite3VdbeJumpHere(v, addr);
114077114272
114078114273
/* Do an integrity check of the B-Tree
114079114274
**
114080114275
** Begin by finding the root pages numbers
114081114276
** for all tables and indices in the database.
@@ -114111,29 +114306,30 @@
114111114306
sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,
114112114307
sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zDbSName),
114113114308
P4_DYNAMIC);
114114114309
sqlite3VdbeAddOp3(v, OP_Move, 2, 4, 1);
114115114310
sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 2);
114116
- sqlite3VdbeAddOp2(v, OP_ResultRow, 2, 1);
114311
+ integrityCheckResultRow(v, 2);
114117114312
sqlite3VdbeJumpHere(v, addr);
114118114313
114119114314
/* Make sure all the indices are constructed correctly.
114120114315
*/
114121
- for(x=sqliteHashFirst(pTbls); x && !isQuick; x=sqliteHashNext(x)){
114316
+ for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
114122114317
Table *pTab = sqliteHashData(x);
114123114318
Index *pIdx, *pPk;
114124114319
Index *pPrior = 0;
114125114320
int loopTop;
114126114321
int iDataCur, iIdxCur;
114127114322
int r1 = -1;
114128114323
114129
- if( pTab->pIndex==0 ) continue;
114324
+ if( pTab->pCheck==0
114325
+ && (pTab->tabFlags & TF_HasNotNull)==0
114326
+ && (pTab->pIndex==0 || isQuick)
114327
+ ){
114328
+ continue; /* No additional checks needed for this table */
114329
+ }
114130114330
pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
114131
- addr = sqlite3VdbeAddOp1(v, OP_IfPos, 1); /* Stop if out of errors */
114132
- VdbeCoverage(v);
114133
- sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);
114134
- sqlite3VdbeJumpHere(v, addr);
114135114331
sqlite3ExprCacheClear(pParse);
114136114332
sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenRead, 0,
114137114333
1, 0, &iDataCur, &iIdxCur);
114138114334
sqlite3VdbeAddOp2(v, OP_Integer, 0, 7);
114139114335
for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
@@ -114144,28 +114340,46 @@
114144114340
sqlite3VdbeAddOp2(v, OP_Rewind, iDataCur, 0); VdbeCoverage(v);
114145114341
loopTop = sqlite3VdbeAddOp2(v, OP_AddImm, 7, 1);
114146114342
/* Verify that all NOT NULL columns really are NOT NULL */
114147114343
for(j=0; j<pTab->nCol; j++){
114148114344
char *zErr;
114149
- int jmp2, jmp3;
114345
+ int jmp2;
114150114346
if( j==pTab->iPKey ) continue;
114151114347
if( pTab->aCol[j].notNull==0 ) continue;
114152114348
sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, j, 3);
114153114349
sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG);
114154114350
jmp2 = sqlite3VdbeAddOp1(v, OP_NotNull, 3); VdbeCoverage(v);
114155
- sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1); /* Decrement error limit */
114156114351
zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
114157114352
pTab->aCol[j].zName);
114158114353
sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
114159
- sqlite3VdbeAddOp2(v, OP_ResultRow, 3, 1);
114160
- jmp3 = sqlite3VdbeAddOp1(v, OP_IfPos, 1); VdbeCoverage(v);
114161
- sqlite3VdbeAddOp0(v, OP_Halt);
114354
+ integrityCheckResultRow(v, 3);
114162114355
sqlite3VdbeJumpHere(v, jmp2);
114163
- sqlite3VdbeJumpHere(v, jmp3);
114356
+ }
114357
+ /* Verify CHECK constraints */
114358
+ if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){
114359
+ int addrCkFault = sqlite3VdbeMakeLabel(v);
114360
+ int addrCkOk = sqlite3VdbeMakeLabel(v);
114361
+ ExprList *pCheck = pTab->pCheck;
114362
+ char *zErr;
114363
+ int k;
114364
+ pParse->iSelfTab = iDataCur;
114365
+ sqlite3ExprCachePush(pParse);
114366
+ for(k=pCheck->nExpr-1; k>0; k--){
114367
+ sqlite3ExprIfFalse(pParse, pCheck->a[k].pExpr, addrCkFault, 0);
114368
+ }
114369
+ sqlite3ExprIfTrue(pParse, pCheck->a[0].pExpr, addrCkOk,
114370
+ SQLITE_JUMPIFNULL);
114371
+ sqlite3VdbeResolveLabel(v, addrCkFault);
114372
+ zErr = sqlite3MPrintf(db, "CHECK constraint failed in %s",
114373
+ pTab->zName);
114374
+ sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
114375
+ integrityCheckResultRow(v, 3);
114376
+ sqlite3VdbeResolveLabel(v, addrCkOk);
114377
+ sqlite3ExprCachePop(pParse);
114164114378
}
114165114379
/* Validate index entries for the current row */
114166
- for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
114380
+ for(j=0, pIdx=pTab->pIndex; pIdx && !isQuick; pIdx=pIdx->pNext, j++){
114167114381
int jmp2, jmp3, jmp4, jmp5;
114168114382
int ckUniq = sqlite3VdbeMakeLabel(v);
114169114383
if( pPk==pIdx ) continue;
114170114384
r1 = sqlite3GenerateIndexKey(pParse, pIdx, iDataCur, 0, 0, &jmp3,
114171114385
pPrior, r1);
@@ -114172,20 +114386,17 @@
114172114386
pPrior = pIdx;
114173114387
sqlite3VdbeAddOp2(v, OP_AddImm, 8+j, 1); /* increment entry count */
114174114388
/* Verify that an index entry exists for the current table row */
114175114389
jmp2 = sqlite3VdbeAddOp4Int(v, OP_Found, iIdxCur+j, ckUniq, r1,
114176114390
pIdx->nColumn); VdbeCoverage(v);
114177
- sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1); /* Decrement error limit */
114178114391
sqlite3VdbeLoadString(v, 3, "row ");
114179114392
sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3);
114180114393
sqlite3VdbeLoadString(v, 4, " missing from index ");
114181114394
sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
114182114395
jmp5 = sqlite3VdbeLoadString(v, 4, pIdx->zName);
114183114396
sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
114184
- sqlite3VdbeAddOp2(v, OP_ResultRow, 3, 1);
114185
- jmp4 = sqlite3VdbeAddOp1(v, OP_IfPos, 1); VdbeCoverage(v);
114186
- sqlite3VdbeAddOp0(v, OP_Halt);
114397
+ jmp4 = integrityCheckResultRow(v, 3);
114187114398
sqlite3VdbeJumpHere(v, jmp2);
114188114399
/* For UNIQUE indexes, verify that only one entry exists with the
114189114400
** current key. The entry is unique if (1) any column is NULL
114190114401
** or (2) the next entry has a different key */
114191114402
if( IsUniqueIndex(pIdx) ){
@@ -114202,11 +114413,10 @@
114202114413
jmp6 = sqlite3VdbeAddOp1(v, OP_Next, iIdxCur+j); VdbeCoverage(v);
114203114414
sqlite3VdbeGoto(v, uniqOk);
114204114415
sqlite3VdbeJumpHere(v, jmp6);
114205114416
sqlite3VdbeAddOp4Int(v, OP_IdxGT, iIdxCur+j, uniqOk, r1,
114206114417
pIdx->nKeyCol); VdbeCoverage(v);
114207
- sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1); /* Decrement error limit */
114208114418
sqlite3VdbeLoadString(v, 3, "non-unique entry in index ");
114209114419
sqlite3VdbeGoto(v, jmp5);
114210114420
sqlite3VdbeResolveLabel(v, uniqOk);
114211114421
}
114212114422
sqlite3VdbeJumpHere(v, jmp4);
@@ -114213,40 +114423,39 @@
114213114423
sqlite3ResolvePartIdxLabel(pParse, jmp3);
114214114424
}
114215114425
sqlite3VdbeAddOp2(v, OP_Next, iDataCur, loopTop); VdbeCoverage(v);
114216114426
sqlite3VdbeJumpHere(v, loopTop-1);
114217114427
#ifndef SQLITE_OMIT_BTREECOUNT
114218
- sqlite3VdbeLoadString(v, 2, "wrong # of entries in index ");
114219
- for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
114220
- if( pPk==pIdx ) continue;
114221
- addr = sqlite3VdbeCurrentAddr(v);
114222
- sqlite3VdbeAddOp2(v, OP_IfPos, 1, addr+2); VdbeCoverage(v);
114223
- sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);
114224
- sqlite3VdbeAddOp2(v, OP_Count, iIdxCur+j, 3);
114225
- sqlite3VdbeAddOp3(v, OP_Eq, 8+j, addr+8, 3); VdbeCoverage(v);
114226
- sqlite3VdbeChangeP5(v, SQLITE_NOTNULL);
114227
- sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1);
114228
- sqlite3VdbeLoadString(v, 3, pIdx->zName);
114229
- sqlite3VdbeAddOp3(v, OP_Concat, 3, 2, 7);
114230
- sqlite3VdbeAddOp2(v, OP_ResultRow, 7, 1);
114428
+ if( !isQuick ){
114429
+ sqlite3VdbeLoadString(v, 2, "wrong # of entries in index ");
114430
+ for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
114431
+ if( pPk==pIdx ) continue;
114432
+ sqlite3VdbeAddOp2(v, OP_Count, iIdxCur+j, 3);
114433
+ addr = sqlite3VdbeAddOp3(v, OP_Eq, 8+j, 0, 3); VdbeCoverage(v);
114434
+ sqlite3VdbeChangeP5(v, SQLITE_NOTNULL);
114435
+ sqlite3VdbeLoadString(v, 3, pIdx->zName);
114436
+ sqlite3VdbeAddOp3(v, OP_Concat, 3, 2, 7);
114437
+ integrityCheckResultRow(v, 7);
114438
+ sqlite3VdbeJumpHere(v, addr);
114439
+ }
114231114440
}
114232114441
#endif /* SQLITE_OMIT_BTREECOUNT */
114233114442
}
114234114443
}
114235114444
{
114236114445
static const int iLn = VDBE_OFFSET_LINENO(2);
114237114446
static const VdbeOpList endCode[] = {
114238114447
{ OP_AddImm, 1, 0, 0}, /* 0 */
114239
- { OP_If, 1, 4, 0}, /* 1 */
114448
+ { OP_IfNotZero, 1, 4, 0}, /* 1 */
114240114449
{ OP_String8, 0, 3, 0}, /* 2 */
114241114450
{ OP_ResultRow, 3, 1, 0}, /* 3 */
114242114451
};
114243114452
VdbeOp *aOp;
114244114453
114245114454
aOp = sqlite3VdbeAddOpList(v, ArraySize(endCode), endCode, iLn);
114246114455
if( aOp ){
114247
- aOp[0].p2 = -mxErr;
114456
+ aOp[0].p2 = 1-mxErr;
114248114457
aOp[2].p4type = P4_STATIC;
114249114458
aOp[2].p4.z = "ok";
114250114459
}
114251114460
}
114252114461
}
@@ -114466,10 +114675,92 @@
114466114675
*/
114467114676
case PragTyp_SHRINK_MEMORY: {
114468114677
sqlite3_db_release_memory(db);
114469114678
break;
114470114679
}
114680
+
114681
+ /*
114682
+ ** PRAGMA optimize
114683
+ ** PRAGMA schema.optimize
114684
+ **
114685
+ ** Attempt to optimize the database. All schemas are optimized in the first
114686
+ ** form, and only the specified schema is optimized in the second form.
114687
+ **
114688
+ ** The details of optimizations performed by this pragma does are expected
114689
+ ** to change and improve over time. Applications should anticipate that
114690
+ ** this pragma will perform new optimizations in future releases.
114691
+ **
114692
+ ** Argments to this pragma are currently ignored, but future enhancements
114693
+ ** might make use of arguments to control which optimizations are allowed
114694
+ ** or to suggest limits on how much CPU time and I/O should be expended
114695
+ ** in the optimization effort.
114696
+ **
114697
+ ** The current implementation runs ANALYZE on any tables which might have
114698
+ ** benefitted from having recent statistics at some point since the start
114699
+ ** of the current connection. Only tables in "schema" are analyzed in the
114700
+ ** second form. In the first form, all tables except TEMP tables are
114701
+ ** checked.
114702
+ **
114703
+ ** In the current implementation, a table is analyzed only if both of
114704
+ ** the following are true:
114705
+ **
114706
+ ** (1) The query planner used sqlite_stat1-style statistics for one or
114707
+ ** more indexes of the table at some point during the lifetime of
114708
+ ** the current connection.
114709
+ **
114710
+ ** (2) One or more indexes of the table are currently unanalyzed OR
114711
+ ** the number of rows in the table has increased by 25 times or more
114712
+ ** since the last time ANALYZE was run.
114713
+ **
114714
+ ** The rules for when tables are analyzed are likely to change in
114715
+ ** future releases.
114716
+ */
114717
+ case PragTyp_OPTIMIZE: {
114718
+ int iDbLast; /* Loop termination point for the schema loop */
114719
+ int iTabCur; /* Cursor for a table whose size needs checking */
114720
+ HashElem *k; /* Loop over tables of a schema */
114721
+ Schema *pSchema; /* The current schema */
114722
+ Table *pTab; /* A table in the schema */
114723
+ Index *pIdx; /* An index of the table */
114724
+ LogEst szThreshold; /* Size threshold above which reanalysis is needd */
114725
+ char *zSubSql; /* SQL statement for the OP_SqlExec opcode */
114726
+
114727
+ iTabCur = pParse->nTab++;
114728
+ for(iDbLast = zDb?iDb:db->nDb-1; iDb<=iDbLast; iDb++){
114729
+ if( iDb==1 ) continue;
114730
+ sqlite3CodeVerifySchema(pParse, iDb);
114731
+ pSchema = db->aDb[iDb].pSchema;
114732
+ for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
114733
+ pTab = (Table*)sqliteHashData(k);
114734
+
114735
+ /* If table pTab has not been used in a way that would benefit from
114736
+ ** having analysis statistics during the current session, then skip it.
114737
+ ** This also has the effect of skipping virtual tables and views */
114738
+ if( (pTab->tabFlags & TF_StatsUsed)==0 ) continue;
114739
+
114740
+ /* Reanalyze if the table is 25 times larger than the last analysis */
114741
+ szThreshold = pTab->nRowLogEst + 46; assert( sqlite3LogEst(25)==46 );
114742
+ for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
114743
+ if( !pIdx->hasStat1 ){
114744
+ szThreshold = 0; /* Always analyze if any index lacks statistics */
114745
+ break;
114746
+ }
114747
+ }
114748
+ if( szThreshold ){
114749
+ sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead);
114750
+ sqlite3VdbeAddOp3(v, OP_IfSmaller, iTabCur,
114751
+ sqlite3VdbeCurrentAddr(v)+2, szThreshold);
114752
+ VdbeCoverage(v);
114753
+ }
114754
+ zSubSql = sqlite3MPrintf(db, "ANALYZE \"%w\".\"%w\"",
114755
+ db->aDb[iDb].zDbSName, pTab->zName);
114756
+ sqlite3VdbeAddOp4(v, OP_SqlExec, 0, 0, 0, zSubSql, P4_DYNAMIC);
114757
+ }
114758
+ }
114759
+ sqlite3VdbeAddOp0(v, OP_Expire);
114760
+ break;
114761
+ }
114471114762
114472114763
/*
114473114764
** PRAGMA busy_timeout
114474114765
** PRAGMA busy_timeout = N
114475114766
**
@@ -123782,12 +124073,29 @@
123782124073
** transient would cause the database file to appear to be deleted
123783124074
** following reboot.
123784124075
*/
123785124076
SQLITE_PRIVATE void sqlite3Vacuum(Parse *pParse, Token *pNm){
123786124077
Vdbe *v = sqlite3GetVdbe(pParse);
123787
- int iDb = pNm ? sqlite3TwoPartName(pParse, pNm, pNm, &pNm) : 0;
123788
- if( v && (iDb>=2 || iDb==0) ){
124078
+ int iDb = 0;
124079
+ if( v==0 ) return;
124080
+ if( pNm ){
124081
+#ifndef SQLITE_BUG_COMPATIBLE_20160819
124082
+ /* Default behavior: Report an error if the argument to VACUUM is
124083
+ ** not recognized */
124084
+ iDb = sqlite3TwoPartName(pParse, pNm, pNm, &pNm);
124085
+ if( iDb<0 ) return;
124086
+#else
124087
+ /* When SQLITE_BUG_COMPATIBLE_20160819 is defined, unrecognized arguments
124088
+ ** to VACUUM are silently ignored. This is a back-out of a bug fix that
124089
+ ** occurred on 2016-08-19 (https://www.sqlite.org/src/info/083f9e6270).
124090
+ ** The buggy behavior is required for binary compatibility with some
124091
+ ** legacy applications. */
124092
+ iDb = sqlite3FindDb(pParse->db, pNm);
124093
+ if( iDb<0 ) iDb = 0;
124094
+#endif
124095
+ }
124096
+ if( iDb!=1 ){
123789124097
sqlite3VdbeAddOp1(v, OP_Vacuum, iDb);
123790124098
sqlite3VdbeUsesBtree(v, iDb);
123791124099
}
123792124100
return;
123793124101
}
@@ -124377,12 +124685,11 @@
124377124685
124378124686
db = pParse->db;
124379124687
iDb = sqlite3SchemaToIndex(db, pTable->pSchema);
124380124688
assert( iDb>=0 );
124381124689
124382
- pTable->tabFlags |= TF_Virtual;
124383
- pTable->nModuleArg = 0;
124690
+ assert( pTable->nModuleArg==0 );
124384124691
addModuleArgument(db, pTable, sqlite3NameFromToken(db, pModuleName));
124385124692
addModuleArgument(db, pTable, 0);
124386124693
addModuleArgument(db, pTable, sqlite3DbStrDup(db, pTable->zName));
124387124694
assert( (pParse->sNameToken.z==pName2->z && pName2->z!=0)
124388124695
|| (pParse->sNameToken.z==pName1->z && pName2->z==0)
@@ -124666,11 +124973,11 @@
124666124973
const char *zMod;
124667124974
Module *pMod;
124668124975
int rc;
124669124976
124670124977
assert( pTab );
124671
- if( (pTab->tabFlags & TF_Virtual)==0 || sqlite3GetVTable(db, pTab) ){
124978
+ if( !IsVirtual(pTab) || sqlite3GetVTable(db, pTab) ){
124672124979
return SQLITE_OK;
124673124980
}
124674124981
124675124982
/* Locate the required virtual table module */
124676124983
zMod = pTab->azModuleArg[0];
@@ -124736,11 +125043,11 @@
124736125043
Table *pTab;
124737125044
Module *pMod;
124738125045
const char *zMod;
124739125046
124740125047
pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zDbSName);
124741
- assert( pTab && (pTab->tabFlags & TF_Virtual)!=0 && !pTab->pVTable );
125048
+ assert( pTab && IsVirtual(pTab) && !pTab->pVTable );
124742125049
124743125050
/* Locate the required virtual table module */
124744125051
zMod = pTab->azModuleArg[0];
124745125052
pMod = (Module*)sqlite3HashFind(&db->aModule, zMod);
124746125053
@@ -124790,11 +125097,11 @@
124790125097
sqlite3Error(db, SQLITE_MISUSE);
124791125098
sqlite3_mutex_leave(db->mutex);
124792125099
return SQLITE_MISUSE_BKPT;
124793125100
}
124794125101
pTab = pCtx->pTab;
124795
- assert( (pTab->tabFlags & TF_Virtual)!=0 );
125102
+ assert( IsVirtual(pTab) );
124796125103
124797125104
pParse = sqlite3StackAllocZero(db, sizeof(*pParse));
124798125105
if( pParse==0 ){
124799125106
rc = SQLITE_NOMEM_BKPT;
124800125107
}else{
@@ -124804,11 +125111,11 @@
124804125111
124805125112
if( SQLITE_OK==sqlite3RunParser(pParse, zCreateTable, &zErr)
124806125113
&& pParse->pNewTable
124807125114
&& !db->mallocFailed
124808125115
&& !pParse->pNewTable->pSelect
124809
- && (pParse->pNewTable->tabFlags & TF_Virtual)==0
125116
+ && !IsVirtual(pParse->pNewTable)
124810125117
){
124811125118
if( !pTab->aCol ){
124812125119
Table *pNew = pParse->pNewTable;
124813125120
Index *pIdx;
124814125121
pTab->aCol = pNew->aCol;
@@ -125093,11 +125400,11 @@
125093125400
/* Check to see the left operand is a column in a virtual table */
125094125401
if( NEVER(pExpr==0) ) return pDef;
125095125402
if( pExpr->op!=TK_COLUMN ) return pDef;
125096125403
pTab = pExpr->pTab;
125097125404
if( NEVER(pTab==0) ) return pDef;
125098
- if( (pTab->tabFlags & TF_Virtual)==0 ) return pDef;
125405
+ if( !IsVirtual(pTab) ) return pDef;
125099125406
pVtab = sqlite3GetVTable(db, pTab)->pVtab;
125100125407
assert( pVtab!=0 );
125101125408
assert( pVtab->pModule!=0 );
125102125409
pMod = (sqlite3_module *)pVtab->pModule;
125103125410
if( pMod->xFindFunction==0 ) return pDef;
@@ -125188,12 +125495,11 @@
125188125495
return 0;
125189125496
}
125190125497
pMod->pEpoTab = pTab;
125191125498
pTab->nTabRef = 1;
125192125499
pTab->pSchema = db->aDb[0].pSchema;
125193
- pTab->tabFlags |= TF_Virtual;
125194
- pTab->nModuleArg = 0;
125500
+ assert( pTab->nModuleArg==0 );
125195125501
pTab->iPKey = -1;
125196125502
addModuleArgument(db, pTab, sqlite3DbStrDup(db, pTab->zName));
125197125503
addModuleArgument(db, pTab, 0);
125198125504
addModuleArgument(db, pTab, sqlite3DbStrDup(db, pTab->zName));
125199125505
rc = vtabCallConstructor(db, pTab, pMod, pModule->xConnect, &zErr);
@@ -125260,11 +125566,11 @@
125260125566
case SQLITE_VTAB_CONSTRAINT_SUPPORT: {
125261125567
VtabCtx *p = db->pVtabCtx;
125262125568
if( !p ){
125263125569
rc = SQLITE_MISUSE_BKPT;
125264125570
}else{
125265
- assert( p->pTab==0 || (p->pTab->tabFlags & TF_Virtual)!=0 );
125571
+ assert( p->pTab==0 || IsVirtual(p->pTab) );
125266125572
p->pVTable->bConstraint = (u8)va_arg(ap, int);
125267125573
}
125268125574
break;
125269125575
}
125270125576
default:
@@ -125699,12 +126005,17 @@
125699126005
WhereOrSet *pOrSet; /* Record best loops here, if not NULL */
125700126006
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
125701126007
UnpackedRecord *pRec; /* Probe for stat4 (if required) */
125702126008
int nRecValid; /* Number of valid fields currently in pRec */
125703126009
#endif
126010
+ unsigned int bldFlags; /* SQLITE_BLDF_* flags */
125704126011
};
125705126012
126013
+/* Allowed values for WhereLoopBuider.bldFlags */
126014
+#define SQLITE_BLDF_INDEXED 0x0001 /* An index is used */
126015
+#define SQLITE_BLDF_UNIQUE 0x0002 /* All keys of a UNIQUE index used */
126016
+
125706126017
/*
125707126018
** The WHERE clause processing routine has two halves. The
125708126019
** first part does the start of the WHERE loop and the second
125709126020
** half does the tail of the WHERE loop. An instance of
125710126021
** this structure is returned by the first half and passed
@@ -125715,11 +126026,11 @@
125715126026
*/
125716126027
struct WhereInfo {
125717126028
Parse *pParse; /* Parsing and code generating context */
125718126029
SrcList *pTabList; /* List of tables in the join */
125719126030
ExprList *pOrderBy; /* The ORDER BY clause or NULL */
125720
- ExprList *pDistinctSet; /* DISTINCT over all these values */
126031
+ ExprList *pResultSet; /* Result set of the query */
125721126032
LogEst iLimit; /* LIMIT if wctrlFlags has WHERE_USE_LIMIT */
125722126033
int aiCurOnePass[2]; /* OP_OpenWrite cursors for the ONEPASS opt */
125723126034
int iContinue; /* Jump here to continue with next record */
125724126035
int iBreak; /* Jump here to break out of the loop */
125725126036
int savedNQueryLoop; /* pParse->nQueryLoop outside the WHERE loop */
@@ -126899,10 +127210,11 @@
126899127210
Parse *pParse; /* Parsing context */
126900127211
sqlite3 *db; /* Database connection */
126901127212
Vdbe *v; /* The prepared stmt under constructions */
126902127213
struct SrcList_item *pTabItem; /* FROM clause term being coded */
126903127214
int addrBrk; /* Jump here to break out of the loop */
127215
+ int addrHalt; /* addrBrk for the outermost loop */
126904127216
int addrCont; /* Jump here to continue with next cycle */
126905127217
int iRowidReg = 0; /* Rowid is stored in this register, if not zero */
126906127218
int iReleaseReg = 0; /* Temp register to free before returning */
126907127219
126908127220
pParse = pWInfo->pParse;
@@ -126939,10 +127251,15 @@
126939127251
if( pLevel->iFrom>0 && (pTabItem[0].fg.jointype & JT_LEFT)!=0 ){
126940127252
pLevel->iLeftJoin = ++pParse->nMem;
126941127253
sqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin);
126942127254
VdbeComment((v, "init LEFT JOIN no-match flag"));
126943127255
}
127256
+
127257
+ /* Compute a safe address to jump to if we discover that the table for
127258
+ ** this loop is empty and can never contribute content. */
127259
+ for(j=iLevel; j>0 && pWInfo->a[j].iLeftJoin==0; j--){}
127260
+ addrHalt = pWInfo->a[j].addrBrk;
126944127261
126945127262
/* Special case of a FROM clause subquery implemented as a co-routine */
126946127263
if( pTabItem->fg.viaCoroutine ){
126947127264
int regYield = pTabItem->regReturn;
126948127265
sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
@@ -127124,11 +127441,11 @@
127124127441
VdbeCoverageIf(v, pX->op==TK_LT);
127125127442
VdbeCoverageIf(v, pX->op==TK_GE);
127126127443
sqlite3ExprCacheAffinityChange(pParse, r1, 1);
127127127444
sqlite3ReleaseTempReg(pParse, rTemp);
127128127445
}else{
127129
- sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, addrBrk);
127446
+ sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, addrHalt);
127130127447
VdbeCoverageIf(v, bRev==0);
127131127448
VdbeCoverageIf(v, bRev!=0);
127132127449
}
127133127450
if( pEnd ){
127134127451
Expr *pX;
@@ -127770,11 +128087,11 @@
127770128087
pLevel->op = OP_Noop;
127771128088
}else{
127772128089
codeCursorHint(pTabItem, pWInfo, pLevel, 0);
127773128090
pLevel->op = aStep[bRev];
127774128091
pLevel->p1 = iCur;
127775
- pLevel->p2 = 1 + sqlite3VdbeAddOp2(v, aStart[bRev], iCur, addrBrk);
128092
+ pLevel->p2 = 1 + sqlite3VdbeAddOp2(v, aStart[bRev], iCur, addrHalt);
127776128093
VdbeCoverageIf(v, bRev==0);
127777128094
VdbeCoverageIf(v, bRev!=0);
127778128095
pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP;
127779128096
}
127780128097
}
@@ -128095,19 +128412,10 @@
128095128412
#ifdef SQLITE_EBCDIC
128096128413
if( *pnoCase ) return 0;
128097128414
#endif
128098128415
pList = pExpr->x.pList;
128099128416
pLeft = pList->a[1].pExpr;
128100
- if( pLeft->op!=TK_COLUMN
128101
- || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT
128102
- || IsVirtual(pLeft->pTab) /* Value might be numeric */
128103
- ){
128104
- /* IMP: R-02065-49465 The left-hand side of the LIKE or GLOB operator must
128105
- ** be the name of an indexed column with TEXT affinity. */
128106
- return 0;
128107
- }
128108
- assert( pLeft->iColumn!=(-1) ); /* Because IPK never has AFF_TEXT */
128109128417
128110128418
pRight = sqlite3ExprSkipCollate(pList->a[0].pExpr);
128111128419
op = pRight->op;
128112128420
if( op==TK_VARIABLE ){
128113128421
Vdbe *pReprepare = pParse->pReprepare;
@@ -128120,10 +128428,27 @@
128120128428
assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER );
128121128429
}else if( op==TK_STRING ){
128122128430
z = pRight->u.zToken;
128123128431
}
128124128432
if( z ){
128433
+
128434
+ /* If the RHS begins with a digit or a minus sign, then the LHS must
128435
+ ** be an ordinary column (not a virtual table column) with TEXT affinity.
128436
+ ** Otherwise the LHS might be numeric and "lhs >= rhs" would be false
128437
+ ** even though "lhs LIKE rhs" is true. But if the RHS does not start
128438
+ ** with a digit or '-', then "lhs LIKE rhs" will always be false if
128439
+ ** the LHS is numeric and so the optimization still works.
128440
+ */
128441
+ if( sqlite3Isdigit(z[0]) || z[0]=='-' ){
128442
+ if( pLeft->op!=TK_COLUMN
128443
+ || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT
128444
+ || IsVirtual(pLeft->pTab) /* Value might be numeric */
128445
+ ){
128446
+ sqlite3ValueFree(pVal);
128447
+ return 0;
128448
+ }
128449
+ }
128125128450
cnt = 0;
128126128451
while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){
128127128452
cnt++;
128128128453
}
128129128454
if( cnt!=0 && 255!=(u8)z[cnt-1] ){
@@ -128748,11 +129073,11 @@
128748129073
iCur = pFrom->a[i].iCursor;
128749129074
for(pIdx=pFrom->a[i].pTab->pIndex; pIdx; pIdx=pIdx->pNext){
128750129075
if( pIdx->aColExpr==0 ) continue;
128751129076
for(i=0; i<pIdx->nKeyCol; i++){
128752129077
if( pIdx->aiColumn[i]!=XN_EXPR ) continue;
128753
- if( sqlite3ExprCompare(pExpr, pIdx->aColExpr->a[i].pExpr, iCur)==0 ){
129078
+ if( sqlite3ExprCompareSkip(pExpr, pIdx->aColExpr->a[i].pExpr, iCur)==0 ){
128754129079
*piCur = iCur;
128755129080
*piColumn = XN_EXPR;
128756129081
return 1;
128757129082
}
128758129083
}
@@ -129539,11 +129864,12 @@
129539129864
do{
129540129865
for(pTerm=pWC->a+k; k<pWC->nTerm; k++, pTerm++){
129541129866
if( pTerm->leftCursor==iCur
129542129867
&& pTerm->u.leftColumn==iColumn
129543129868
&& (iColumn!=XN_EXPR
129544
- || sqlite3ExprCompare(pTerm->pExpr->pLeft,pScan->pIdxExpr,iCur)==0)
129869
+ || sqlite3ExprCompareSkip(pTerm->pExpr->pLeft,
129870
+ pScan->pIdxExpr,iCur)==0)
129545129871
&& (pScan->iEquiv<=1 || !ExprHasProperty(pTerm->pExpr, EP_FromJoin))
129546129872
){
129547129873
if( (pTerm->eOperator & WO_EQUIV)!=0
129548129874
&& pScan->nEquiv<ArraySize(pScan->aiCur)
129549129875
&& (pX = sqlite3ExprSkipCollate(pTerm->pExpr->pRight))->op==TK_COLUMN
@@ -131716,10 +132042,15 @@
131716132042
testcase( eOp & WO_IS );
131717132043
testcase( eOp & WO_ISNULL );
131718132044
continue;
131719132045
}
131720132046
132047
+ if( IsUniqueIndex(pProbe) && saved_nEq==pProbe->nKeyCol-1 ){
132048
+ pBuilder->bldFlags |= SQLITE_BLDF_UNIQUE;
132049
+ }else{
132050
+ pBuilder->bldFlags |= SQLITE_BLDF_INDEXED;
132051
+ }
131721132052
pNew->wsFlags = saved_wsFlags;
131722132053
pNew->u.btree.nEq = saved_nEq;
131723132054
pNew->u.btree.nBtm = saved_nBtm;
131724132055
pNew->u.btree.nTop = saved_nTop;
131725132056
pNew->nLTerm = saved_nLTerm;
@@ -132263,11 +132594,19 @@
132263132594
pNew->nOut = rSize;
132264132595
if( rc ) break;
132265132596
}
132266132597
}
132267132598
132599
+ pBuilder->bldFlags = 0;
132268132600
rc = whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, 0);
132601
+ if( pBuilder->bldFlags==SQLITE_BLDF_INDEXED ){
132602
+ /* If a non-unique index is used, or if a prefix of the key for
132603
+ ** unique index is used (making the index functionally non-unique)
132604
+ ** then the sqlite_stat1 data becomes important for scoring the
132605
+ ** plan */
132606
+ pTab->tabFlags |= TF_StatsUsed;
132607
+ }
132269132608
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
132270132609
sqlite3Stat4ProbeFree(pBuilder->pRec);
132271132610
pBuilder->nRecValid = 0;
132272132611
pBuilder->pRec = 0;
132273132612
#endif
@@ -133443,13 +133782,13 @@
133443133782
&& (pWInfo->wctrlFlags & WHERE_DISTINCTBY)==0
133444133783
&& pWInfo->eDistinct==WHERE_DISTINCT_NOOP
133445133784
&& nRowEst
133446133785
){
133447133786
Bitmask notUsed;
133448
- int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pDistinctSet, pFrom,
133787
+ int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pResultSet, pFrom,
133449133788
WHERE_DISTINCTBY, nLoop-1, pFrom->aLoop[nLoop-1], &notUsed);
133450
- if( rc==pWInfo->pDistinctSet->nExpr ){
133789
+ if( rc==pWInfo->pResultSet->nExpr ){
133451133790
pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;
133452133791
}
133453133792
}
133454133793
if( pWInfo->pOrderBy ){
133455133794
if( pWInfo->wctrlFlags & WHERE_DISTINCTBY ){
@@ -133682,11 +134021,11 @@
133682134021
SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
133683134022
Parse *pParse, /* The parser context */
133684134023
SrcList *pTabList, /* FROM clause: A list of all tables to be scanned */
133685134024
Expr *pWhere, /* The WHERE clause */
133686134025
ExprList *pOrderBy, /* An ORDER BY (or GROUP BY) clause, or NULL */
133687
- ExprList *pDistinctSet, /* Try not to output two rows that duplicate these */
134026
+ ExprList *pResultSet, /* Query result set. Req'd for DISTINCT */
133688134027
u16 wctrlFlags, /* The WHERE_* flags defined in sqliteInt.h */
133689134028
int iAuxArg /* If WHERE_OR_SUBCLAUSE is set, index cursor number
133690134029
** If WHERE_USE_LIMIT, then the limit amount */
133691134030
){
133692134031
int nByteWInfo; /* Num. bytes allocated for WhereInfo struct */
@@ -133758,11 +134097,11 @@
133758134097
goto whereBeginError;
133759134098
}
133760134099
pWInfo->pParse = pParse;
133761134100
pWInfo->pTabList = pTabList;
133762134101
pWInfo->pOrderBy = pOrderBy;
133763
- pWInfo->pDistinctSet = pDistinctSet;
134102
+ pWInfo->pResultSet = pResultSet;
133764134103
pWInfo->aiCurOnePass[0] = pWInfo->aiCurOnePass[1] = -1;
133765134104
pWInfo->nLevel = nTabList;
133766134105
pWInfo->iBreak = pWInfo->iContinue = sqlite3VdbeMakeLabel(v);
133767134106
pWInfo->wctrlFlags = wctrlFlags;
133768134107
pWInfo->iLimit = iAuxArg;
@@ -133836,17 +134175,17 @@
133836134175
/* Analyze all of the subexpressions. */
133837134176
sqlite3WhereExprAnalyze(pTabList, &pWInfo->sWC);
133838134177
if( db->mallocFailed ) goto whereBeginError;
133839134178
133840134179
if( wctrlFlags & WHERE_WANT_DISTINCT ){
133841
- if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pDistinctSet) ){
134180
+ if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pResultSet) ){
133842134181
/* The DISTINCT marking is pointless. Ignore it. */
133843134182
pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;
133844134183
}else if( pOrderBy==0 ){
133845134184
/* Try to ORDER BY the result set to make distinct processing easier */
133846134185
pWInfo->wctrlFlags |= WHERE_DISTINCTBY;
133847
- pWInfo->pOrderBy = pDistinctSet;
134186
+ pWInfo->pOrderBy = pResultSet;
133848134187
}
133849134188
}
133850134189
133851134190
/* Construct the WhereLoop objects */
133852134191
#if defined(WHERETRACE_ENABLED)
@@ -133918,14 +134257,14 @@
133918134257
}
133919134258
}
133920134259
#endif
133921134260
/* Attempt to omit tables from the join that do not effect the result */
133922134261
if( pWInfo->nLevel>=2
133923
- && pDistinctSet!=0
134262
+ && pResultSet!=0
133924134263
&& OptimizationEnabled(db, SQLITE_OmitNoopJoin)
133925134264
){
133926
- Bitmask tabUsed = sqlite3WhereExprListUsage(pMaskSet, pDistinctSet);
134265
+ Bitmask tabUsed = sqlite3WhereExprListUsage(pMaskSet, pResultSet);
133927134266
if( sWLB.pOrderBy ){
133928134267
tabUsed |= sqlite3WhereExprListUsage(pMaskSet, sWLB.pOrderBy);
133929134268
}
133930134269
while( pWInfo->nLevel>=2 ){
133931134270
WhereTerm *pTerm, *pEnd;
@@ -134704,166 +135043,166 @@
134704135043
**
134705135044
*********** Begin parsing tables **********************************************/
134706135045
#define YY_ACTTAB_COUNT (1567)
134707135046
static const YYACTIONTYPE yy_action[] = {
134708135047
/* 0 */ 325, 832, 351, 825, 5, 203, 203, 819, 99, 100,
134709
- /* 10 */ 90, 842, 842, 854, 857, 846, 846, 97, 97, 98,
135048
+ /* 10 */ 90, 978, 978, 853, 856, 845, 845, 97, 97, 98,
134710135049
/* 20 */ 98, 98, 98, 301, 96, 96, 96, 96, 95, 95,
134711
- /* 30 */ 94, 94, 94, 93, 351, 325, 977, 977, 824, 824,
134712
- /* 40 */ 826, 947, 354, 99, 100, 90, 842, 842, 854, 857,
134713
- /* 50 */ 846, 846, 97, 97, 98, 98, 98, 98, 338, 96,
135050
+ /* 30 */ 94, 94, 94, 93, 351, 325, 976, 976, 824, 824,
135051
+ /* 40 */ 826, 946, 354, 99, 100, 90, 978, 978, 853, 856,
135052
+ /* 50 */ 845, 845, 97, 97, 98, 98, 98, 98, 338, 96,
134714135053
/* 60 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 351,
134715
- /* 70 */ 95, 95, 94, 94, 94, 93, 351, 791, 977, 977,
135054
+ /* 70 */ 95, 95, 94, 94, 94, 93, 351, 791, 976, 976,
134716135055
/* 80 */ 325, 94, 94, 94, 93, 351, 792, 75, 99, 100,
134717
- /* 90 */ 90, 842, 842, 854, 857, 846, 846, 97, 97, 98,
135056
+ /* 90 */ 90, 978, 978, 853, 856, 845, 845, 97, 97, 98,
134718135057
/* 100 */ 98, 98, 98, 450, 96, 96, 96, 96, 95, 95,
134719135058
/* 110 */ 94, 94, 94, 93, 351, 1333, 155, 155, 2, 325,
134720135059
/* 120 */ 275, 146, 132, 52, 52, 93, 351, 99, 100, 90,
134721
- /* 130 */ 842, 842, 854, 857, 846, 846, 97, 97, 98, 98,
135060
+ /* 130 */ 978, 978, 853, 856, 845, 845, 97, 97, 98, 98,
134722135061
/* 140 */ 98, 98, 101, 96, 96, 96, 96, 95, 95, 94,
134723
- /* 150 */ 94, 94, 93, 351, 958, 958, 325, 268, 428, 413,
134724
- /* 160 */ 411, 61, 752, 752, 99, 100, 90, 842, 842, 854,
134725
- /* 170 */ 857, 846, 846, 97, 97, 98, 98, 98, 98, 60,
135062
+ /* 150 */ 94, 94, 93, 351, 957, 957, 325, 268, 428, 413,
135063
+ /* 160 */ 411, 61, 752, 752, 99, 100, 90, 978, 978, 853,
135064
+ /* 170 */ 856, 845, 845, 97, 97, 98, 98, 98, 98, 60,
134726135065
/* 180 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
134727
- /* 190 */ 351, 325, 270, 329, 273, 277, 959, 960, 250, 99,
134728
- /* 200 */ 100, 90, 842, 842, 854, 857, 846, 846, 97, 97,
135066
+ /* 190 */ 351, 325, 270, 329, 273, 277, 958, 959, 250, 99,
135067
+ /* 200 */ 100, 90, 978, 978, 853, 856, 845, 845, 97, 97,
134729135068
/* 210 */ 98, 98, 98, 98, 301, 96, 96, 96, 96, 95,
134730
- /* 220 */ 95, 94, 94, 94, 93, 351, 325, 938, 1326, 698,
134731
- /* 230 */ 706, 1326, 242, 412, 99, 100, 90, 842, 842, 854,
134732
- /* 240 */ 857, 846, 846, 97, 97, 98, 98, 98, 98, 347,
135069
+ /* 220 */ 95, 94, 94, 94, 93, 351, 325, 937, 1326, 698,
135070
+ /* 230 */ 706, 1326, 242, 412, 99, 100, 90, 978, 978, 853,
135071
+ /* 240 */ 856, 845, 845, 97, 97, 98, 98, 98, 98, 347,
134733135072
/* 250 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
134734
- /* 260 */ 351, 325, 938, 1327, 384, 699, 1327, 381, 379, 99,
134735
- /* 270 */ 100, 90, 842, 842, 854, 857, 846, 846, 97, 97,
135073
+ /* 260 */ 351, 325, 937, 1327, 384, 699, 1327, 381, 379, 99,
135074
+ /* 270 */ 100, 90, 978, 978, 853, 856, 845, 845, 97, 97,
134736135075
/* 280 */ 98, 98, 98, 98, 701, 96, 96, 96, 96, 95,
134737135076
/* 290 */ 95, 94, 94, 94, 93, 351, 325, 92, 89, 178,
134738
- /* 300 */ 833, 936, 373, 700, 99, 100, 90, 842, 842, 854,
134739
- /* 310 */ 857, 846, 846, 97, 97, 98, 98, 98, 98, 375,
135077
+ /* 300 */ 833, 935, 373, 700, 99, 100, 90, 978, 978, 853,
135078
+ /* 310 */ 856, 845, 845, 97, 97, 98, 98, 98, 98, 375,
134740135079
/* 320 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
134741
- /* 330 */ 351, 325, 1276, 947, 354, 818, 936, 739, 739, 99,
134742
- /* 340 */ 100, 90, 842, 842, 854, 857, 846, 846, 97, 97,
135080
+ /* 330 */ 351, 325, 1275, 946, 354, 818, 935, 739, 739, 99,
135081
+ /* 340 */ 100, 90, 978, 978, 853, 856, 845, 845, 97, 97,
134743135082
/* 350 */ 98, 98, 98, 98, 230, 96, 96, 96, 96, 95,
134744
- /* 360 */ 95, 94, 94, 94, 93, 351, 325, 969, 227, 92,
134745
- /* 370 */ 89, 178, 373, 300, 99, 100, 90, 842, 842, 854,
134746
- /* 380 */ 857, 846, 846, 97, 97, 98, 98, 98, 98, 921,
135083
+ /* 360 */ 95, 94, 94, 94, 93, 351, 325, 968, 227, 92,
135084
+ /* 370 */ 89, 178, 373, 300, 99, 100, 90, 978, 978, 853,
135085
+ /* 380 */ 856, 845, 845, 97, 97, 98, 98, 98, 98, 920,
134747135086
/* 390 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
134748135087
/* 400 */ 351, 325, 449, 447, 447, 447, 147, 737, 737, 99,
134749
- /* 410 */ 100, 90, 842, 842, 854, 857, 846, 846, 97, 97,
135088
+ /* 410 */ 100, 90, 978, 978, 853, 856, 845, 845, 97, 97,
134750135089
/* 420 */ 98, 98, 98, 98, 296, 96, 96, 96, 96, 95,
134751
- /* 430 */ 95, 94, 94, 94, 93, 351, 325, 419, 231, 958,
134752
- /* 440 */ 958, 158, 25, 422, 99, 100, 90, 842, 842, 854,
134753
- /* 450 */ 857, 846, 846, 97, 97, 98, 98, 98, 98, 450,
135090
+ /* 430 */ 95, 94, 94, 94, 93, 351, 325, 419, 231, 957,
135091
+ /* 440 */ 957, 158, 25, 422, 99, 100, 90, 978, 978, 853,
135092
+ /* 450 */ 856, 845, 845, 97, 97, 98, 98, 98, 98, 450,
134754135093
/* 460 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
134755
- /* 470 */ 351, 443, 224, 224, 420, 958, 958, 962, 325, 52,
134756
- /* 480 */ 52, 959, 960, 176, 415, 78, 99, 100, 90, 842,
134757
- /* 490 */ 842, 854, 857, 846, 846, 97, 97, 98, 98, 98,
135094
+ /* 470 */ 351, 443, 224, 224, 420, 957, 957, 961, 325, 52,
135095
+ /* 480 */ 52, 958, 959, 176, 415, 78, 99, 100, 90, 978,
135096
+ /* 490 */ 978, 853, 856, 845, 845, 97, 97, 98, 98, 98,
134758135097
/* 500 */ 98, 379, 96, 96, 96, 96, 95, 95, 94, 94,
134759
- /* 510 */ 94, 93, 351, 325, 428, 418, 298, 959, 960, 962,
134760
- /* 520 */ 81, 99, 88, 90, 842, 842, 854, 857, 846, 846,
135098
+ /* 510 */ 94, 93, 351, 325, 428, 418, 298, 958, 959, 961,
135099
+ /* 520 */ 81, 99, 88, 90, 978, 978, 853, 856, 845, 845,
134761135100
/* 530 */ 97, 97, 98, 98, 98, 98, 717, 96, 96, 96,
134762
- /* 540 */ 96, 95, 95, 94, 94, 94, 93, 351, 325, 843,
134763
- /* 550 */ 843, 855, 858, 996, 318, 343, 379, 100, 90, 842,
134764
- /* 560 */ 842, 854, 857, 846, 846, 97, 97, 98, 98, 98,
135101
+ /* 540 */ 96, 95, 95, 94, 94, 94, 93, 351, 325, 842,
135102
+ /* 550 */ 842, 854, 857, 996, 318, 343, 379, 100, 90, 978,
135103
+ /* 560 */ 978, 853, 856, 845, 845, 97, 97, 98, 98, 98,
134765135104
/* 570 */ 98, 450, 96, 96, 96, 96, 95, 95, 94, 94,
134766135105
/* 580 */ 94, 93, 351, 325, 350, 350, 350, 260, 377, 340,
134767
- /* 590 */ 929, 52, 52, 90, 842, 842, 854, 857, 846, 846,
135106
+ /* 590 */ 928, 52, 52, 90, 978, 978, 853, 856, 845, 845,
134768135107
/* 600 */ 97, 97, 98, 98, 98, 98, 361, 96, 96, 96,
134769135108
/* 610 */ 96, 95, 95, 94, 94, 94, 93, 351, 86, 445,
134770
- /* 620 */ 847, 3, 1203, 361, 360, 378, 344, 813, 958, 958,
134771
- /* 630 */ 1300, 86, 445, 729, 3, 212, 169, 287, 405, 282,
135109
+ /* 620 */ 846, 3, 1202, 361, 360, 378, 344, 813, 957, 957,
135110
+ /* 630 */ 1299, 86, 445, 729, 3, 212, 169, 287, 405, 282,
134772135111
/* 640 */ 404, 199, 232, 450, 300, 760, 83, 84, 280, 245,
134773135112
/* 650 */ 262, 365, 251, 85, 352, 352, 92, 89, 178, 83,
134774135113
/* 660 */ 84, 242, 412, 52, 52, 448, 85, 352, 352, 246,
134775
- /* 670 */ 959, 960, 194, 455, 670, 402, 399, 398, 448, 243,
135114
+ /* 670 */ 958, 959, 194, 455, 670, 402, 399, 398, 448, 243,
134776135115
/* 680 */ 221, 114, 434, 776, 361, 450, 397, 268, 747, 224,
134777135116
/* 690 */ 224, 132, 132, 198, 832, 434, 452, 451, 428, 427,
134778135117
/* 700 */ 819, 415, 734, 713, 132, 52, 52, 832, 268, 452,
134779
- /* 710 */ 451, 734, 194, 819, 363, 402, 399, 398, 450, 1271,
134780
- /* 720 */ 1271, 23, 958, 958, 86, 445, 397, 3, 228, 429,
134781
- /* 730 */ 895, 824, 824, 826, 827, 19, 203, 720, 52, 52,
135118
+ /* 710 */ 451, 734, 194, 819, 363, 402, 399, 398, 450, 1270,
135119
+ /* 720 */ 1270, 23, 957, 957, 86, 445, 397, 3, 228, 429,
135120
+ /* 730 */ 894, 824, 824, 826, 827, 19, 203, 720, 52, 52,
134782135121
/* 740 */ 428, 408, 439, 249, 824, 824, 826, 827, 19, 229,
134783135122
/* 750 */ 403, 153, 83, 84, 761, 177, 241, 450, 721, 85,
134784
- /* 760 */ 352, 352, 120, 157, 959, 960, 58, 977, 409, 355,
135123
+ /* 760 */ 352, 352, 120, 157, 958, 959, 58, 976, 409, 355,
134785135124
/* 770 */ 330, 448, 268, 428, 430, 320, 790, 32, 32, 86,
134786135125
/* 780 */ 445, 776, 3, 341, 98, 98, 98, 98, 434, 96,
134787135126
/* 790 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 351,
134788
- /* 800 */ 832, 120, 452, 451, 813, 887, 819, 83, 84, 977,
134789
- /* 810 */ 813, 132, 410, 920, 85, 352, 352, 132, 407, 789,
134790
- /* 820 */ 958, 958, 92, 89, 178, 917, 448, 262, 370, 261,
134791
- /* 830 */ 82, 914, 80, 262, 370, 261, 776, 824, 824, 826,
134792
- /* 840 */ 827, 19, 934, 434, 96, 96, 96, 96, 95, 95,
134793
- /* 850 */ 94, 94, 94, 93, 351, 832, 74, 452, 451, 958,
134794
- /* 860 */ 958, 819, 959, 960, 120, 92, 89, 178, 945, 2,
134795
- /* 870 */ 918, 965, 268, 1, 976, 76, 445, 762, 3, 708,
134796
- /* 880 */ 901, 901, 387, 958, 958, 757, 919, 371, 740, 778,
135127
+ /* 800 */ 832, 120, 452, 451, 813, 886, 819, 83, 84, 976,
135128
+ /* 810 */ 813, 132, 410, 919, 85, 352, 352, 132, 407, 789,
135129
+ /* 820 */ 957, 957, 92, 89, 178, 916, 448, 262, 370, 261,
135130
+ /* 830 */ 82, 913, 80, 262, 370, 261, 776, 824, 824, 826,
135131
+ /* 840 */ 827, 19, 933, 434, 96, 96, 96, 96, 95, 95,
135132
+ /* 850 */ 94, 94, 94, 93, 351, 832, 74, 452, 451, 957,
135133
+ /* 860 */ 957, 819, 958, 959, 120, 92, 89, 178, 944, 2,
135134
+ /* 870 */ 917, 964, 268, 1, 975, 76, 445, 762, 3, 708,
135135
+ /* 880 */ 900, 900, 387, 957, 957, 757, 918, 371, 740, 778,
134797135136
/* 890 */ 756, 257, 824, 824, 826, 827, 19, 417, 741, 450,
134798
- /* 900 */ 24, 959, 960, 83, 84, 369, 958, 958, 177, 226,
134799
- /* 910 */ 85, 352, 352, 885, 315, 314, 313, 215, 311, 10,
134800
- /* 920 */ 10, 683, 448, 349, 348, 959, 960, 909, 777, 157,
134801
- /* 930 */ 120, 958, 958, 337, 776, 416, 711, 310, 450, 434,
134802
- /* 940 */ 450, 321, 450, 791, 103, 200, 175, 450, 959, 960,
134803
- /* 950 */ 908, 832, 792, 452, 451, 9, 9, 819, 10, 10,
135137
+ /* 900 */ 24, 958, 959, 83, 84, 369, 957, 957, 177, 226,
135138
+ /* 910 */ 85, 352, 352, 884, 315, 314, 313, 215, 311, 10,
135139
+ /* 920 */ 10, 683, 448, 349, 348, 958, 959, 908, 777, 157,
135140
+ /* 930 */ 120, 957, 957, 337, 776, 416, 711, 310, 450, 434,
135141
+ /* 940 */ 450, 321, 450, 791, 103, 200, 175, 450, 958, 959,
135142
+ /* 950 */ 907, 832, 792, 452, 451, 9, 9, 819, 10, 10,
134804135143
/* 960 */ 52, 52, 51, 51, 180, 716, 248, 10, 10, 171,
134805
- /* 970 */ 170, 167, 339, 959, 960, 247, 984, 702, 702, 450,
134806
- /* 980 */ 715, 233, 686, 982, 889, 983, 182, 914, 824, 824,
135144
+ /* 970 */ 170, 167, 339, 958, 959, 247, 984, 702, 702, 450,
135145
+ /* 980 */ 715, 233, 686, 982, 888, 983, 182, 913, 824, 824,
134807135146
/* 990 */ 826, 827, 19, 183, 256, 423, 132, 181, 394, 10,
134808
- /* 1000 */ 10, 889, 891, 749, 958, 958, 917, 268, 985, 198,
135147
+ /* 1000 */ 10, 888, 890, 749, 957, 957, 916, 268, 985, 198,
134809135148
/* 1010 */ 985, 349, 348, 425, 415, 299, 817, 832, 326, 825,
134810135149
/* 1020 */ 120, 332, 133, 819, 268, 98, 98, 98, 98, 91,
134811135150
/* 1030 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
134812
- /* 1040 */ 351, 157, 810, 371, 382, 359, 959, 960, 358, 268,
134813
- /* 1050 */ 450, 918, 368, 324, 824, 824, 826, 450, 709, 450,
134814
- /* 1060 */ 264, 380, 889, 450, 877, 746, 253, 919, 255, 433,
135151
+ /* 1040 */ 351, 157, 810, 371, 382, 359, 958, 959, 358, 268,
135152
+ /* 1050 */ 450, 917, 368, 324, 824, 824, 826, 450, 709, 450,
135153
+ /* 1060 */ 264, 380, 888, 450, 876, 746, 253, 918, 255, 433,
134815135154
/* 1070 */ 36, 36, 234, 450, 234, 120, 269, 37, 37, 12,
134816135155
/* 1080 */ 12, 334, 272, 27, 27, 450, 330, 118, 450, 162,
134817135156
/* 1090 */ 742, 280, 450, 38, 38, 450, 985, 356, 985, 450,
134818
- /* 1100 */ 709, 1210, 450, 132, 450, 39, 39, 450, 40, 40,
135157
+ /* 1100 */ 709, 1209, 450, 132, 450, 39, 39, 450, 40, 40,
134819135158
/* 1110 */ 450, 362, 41, 41, 450, 42, 42, 450, 254, 28,
134820135159
/* 1120 */ 28, 450, 29, 29, 31, 31, 450, 43, 43, 450,
134821135160
/* 1130 */ 44, 44, 450, 714, 45, 45, 450, 11, 11, 767,
134822135161
/* 1140 */ 450, 46, 46, 450, 268, 450, 105, 105, 450, 47,
134823135162
/* 1150 */ 47, 450, 48, 48, 450, 237, 33, 33, 450, 172,
134824135163
/* 1160 */ 49, 49, 450, 50, 50, 34, 34, 274, 122, 122,
134825
- /* 1170 */ 450, 123, 123, 450, 124, 124, 450, 898, 56, 56,
134826
- /* 1180 */ 450, 897, 35, 35, 450, 267, 450, 817, 450, 817,
135164
+ /* 1170 */ 450, 123, 123, 450, 124, 124, 450, 897, 56, 56,
135165
+ /* 1180 */ 450, 896, 35, 35, 450, 267, 450, 817, 450, 817,
134827135166
/* 1190 */ 106, 106, 450, 53, 53, 385, 107, 107, 450, 817,
134828135167
/* 1200 */ 108, 108, 817, 450, 104, 104, 121, 121, 119, 119,
134829135168
/* 1210 */ 450, 117, 112, 112, 450, 276, 450, 225, 111, 111,
134830
- /* 1220 */ 450, 730, 450, 109, 109, 450, 673, 674, 675, 912,
135169
+ /* 1220 */ 450, 730, 450, 109, 109, 450, 673, 674, 675, 911,
134831135170
/* 1230 */ 110, 110, 317, 998, 55, 55, 57, 57, 692, 331,
134832
- /* 1240 */ 54, 54, 26, 26, 696, 30, 30, 317, 937, 197,
135171
+ /* 1240 */ 54, 54, 26, 26, 696, 30, 30, 317, 936, 197,
134833135172
/* 1250 */ 196, 195, 335, 281, 336, 446, 331, 745, 689, 436,
134834
- /* 1260 */ 440, 444, 120, 72, 386, 223, 175, 345, 757, 933,
135173
+ /* 1260 */ 440, 444, 120, 72, 386, 223, 175, 345, 757, 932,
134835135174
/* 1270 */ 20, 286, 319, 756, 815, 372, 374, 202, 202, 202,
134836
- /* 1280 */ 263, 395, 285, 74, 208, 21, 696, 719, 718, 884,
135175
+ /* 1280 */ 263, 395, 285, 74, 208, 21, 696, 719, 718, 883,
134837135176
/* 1290 */ 120, 120, 120, 120, 120, 754, 278, 828, 77, 74,
134838
- /* 1300 */ 726, 727, 785, 783, 880, 202, 999, 208, 894, 893,
134839
- /* 1310 */ 894, 893, 694, 816, 763, 116, 774, 1290, 431, 432,
135177
+ /* 1300 */ 726, 727, 785, 783, 879, 202, 999, 208, 893, 892,
135178
+ /* 1310 */ 893, 892, 694, 816, 763, 116, 774, 1289, 431, 432,
134840135179
/* 1320 */ 302, 999, 390, 303, 823, 697, 691, 680, 159, 289,
134841
- /* 1330 */ 679, 884, 681, 952, 291, 218, 293, 7, 316, 828,
134842
- /* 1340 */ 173, 805, 259, 364, 252, 911, 376, 713, 295, 435,
134843
- /* 1350 */ 308, 168, 955, 993, 135, 400, 990, 284, 882, 881,
134844
- /* 1360 */ 205, 928, 926, 59, 333, 62, 144, 156, 130, 72,
135180
+ /* 1330 */ 679, 883, 681, 951, 291, 218, 293, 7, 316, 828,
135181
+ /* 1340 */ 173, 805, 259, 364, 252, 910, 376, 713, 295, 435,
135182
+ /* 1350 */ 308, 168, 954, 993, 135, 400, 990, 284, 881, 880,
135183
+ /* 1360 */ 205, 927, 925, 59, 333, 62, 144, 156, 130, 72,
134845135184
/* 1370 */ 802, 366, 367, 393, 137, 185, 189, 160, 139, 383,
134846
- /* 1380 */ 67, 896, 140, 141, 142, 148, 389, 812, 775, 266,
134847
- /* 1390 */ 219, 190, 154, 391, 913, 876, 271, 406, 191, 322,
135185
+ /* 1380 */ 67, 895, 140, 141, 142, 148, 389, 812, 775, 266,
135186
+ /* 1390 */ 219, 190, 154, 391, 912, 875, 271, 406, 191, 322,
134848135187
/* 1400 */ 682, 733, 192, 342, 732, 724, 731, 711, 723, 421,
134849135188
/* 1410 */ 705, 71, 323, 6, 204, 771, 288, 79, 297, 346,
134850
- /* 1420 */ 772, 704, 290, 283, 703, 770, 292, 294, 967, 239,
134851
- /* 1430 */ 769, 102, 862, 438, 426, 240, 424, 442, 73, 213,
134852
- /* 1440 */ 688, 238, 22, 453, 953, 214, 217, 216, 454, 677,
135189
+ /* 1420 */ 772, 704, 290, 283, 703, 770, 292, 294, 966, 239,
135190
+ /* 1430 */ 769, 102, 861, 438, 426, 240, 424, 442, 73, 213,
135191
+ /* 1440 */ 688, 238, 22, 453, 952, 214, 217, 216, 454, 677,
134853135192
/* 1450 */ 676, 671, 753, 125, 115, 235, 126, 669, 353, 166,
134854
- /* 1460 */ 127, 244, 179, 357, 306, 304, 305, 307, 113, 892,
134855
- /* 1470 */ 327, 890, 811, 328, 134, 128, 136, 138, 743, 258,
134856
- /* 1480 */ 907, 184, 143, 129, 910, 186, 63, 64, 145, 187,
134857
- /* 1490 */ 906, 65, 8, 66, 13, 188, 202, 899, 265, 149,
135193
+ /* 1460 */ 127, 244, 179, 357, 306, 304, 305, 307, 113, 891,
135194
+ /* 1470 */ 327, 889, 811, 328, 134, 128, 136, 138, 743, 258,
135195
+ /* 1480 */ 906, 184, 143, 129, 909, 186, 63, 64, 145, 187,
135196
+ /* 1490 */ 905, 65, 8, 66, 13, 188, 202, 898, 265, 149,
134858135197
/* 1500 */ 987, 388, 150, 685, 161, 392, 285, 193, 279, 396,
134859135198
/* 1510 */ 151, 401, 68, 14, 15, 722, 69, 236, 831, 131,
134860
- /* 1520 */ 830, 860, 70, 751, 16, 414, 755, 4, 174, 220,
134861
- /* 1530 */ 222, 784, 201, 152, 779, 77, 74, 17, 18, 875,
134862
- /* 1540 */ 861, 859, 916, 864, 915, 207, 206, 942, 163, 437,
134863
- /* 1550 */ 948, 943, 164, 209, 1002, 441, 863, 165, 210, 829,
134864
- /* 1560 */ 695, 87, 312, 211, 1292, 1291, 309,
135199
+ /* 1520 */ 830, 859, 70, 751, 16, 414, 755, 4, 174, 220,
135200
+ /* 1530 */ 222, 784, 201, 152, 779, 77, 74, 17, 18, 874,
135201
+ /* 1540 */ 860, 858, 915, 863, 914, 207, 206, 941, 163, 437,
135202
+ /* 1550 */ 947, 942, 164, 209, 1002, 441, 862, 165, 210, 829,
135203
+ /* 1560 */ 695, 87, 312, 211, 1291, 1290, 309,
134865135204
};
134866135205
static const YYCODETYPE yy_lookahead[] = {
134867135206
/* 0 */ 19, 95, 53, 97, 22, 24, 24, 101, 27, 28,
134868135207
/* 10 */ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
134869135208
/* 20 */ 39, 40, 41, 152, 43, 44, 45, 46, 47, 48,
@@ -135112,55 +135451,55 @@
135112135451
/* 300 */ 1256, 1200, 1206, 1260, 1247, 1261, 1263, 1262, 1266, 1278,
135113135452
/* 310 */ 1282, 1292, 1294, 1297, 1298, 1299, 1300, 1221, 1224, 1228,
135114135453
/* 320 */ 1288, 1291, 1276, 1277, 1295,
135115135454
};
135116135455
static const YYACTIONTYPE yy_default[] = {
135117
- /* 0 */ 1281, 1271, 1271, 1271, 1203, 1203, 1203, 1203, 1271, 1096,
135118
- /* 10 */ 1125, 1125, 1255, 1332, 1332, 1332, 1332, 1332, 1332, 1202,
135119
- /* 20 */ 1332, 1332, 1332, 1332, 1271, 1100, 1131, 1332, 1332, 1332,
135120
- /* 30 */ 1332, 1204, 1205, 1332, 1332, 1332, 1254, 1256, 1141, 1140,
135121
- /* 40 */ 1139, 1138, 1237, 1112, 1136, 1129, 1133, 1204, 1198, 1199,
135122
- /* 50 */ 1197, 1201, 1205, 1332, 1132, 1167, 1182, 1166, 1332, 1332,
135456
+ /* 0 */ 1280, 1270, 1270, 1270, 1202, 1202, 1202, 1202, 1270, 1096,
135457
+ /* 10 */ 1125, 1125, 1254, 1332, 1332, 1332, 1332, 1332, 1332, 1201,
135458
+ /* 20 */ 1332, 1332, 1332, 1332, 1270, 1100, 1131, 1332, 1332, 1332,
135459
+ /* 30 */ 1332, 1203, 1204, 1332, 1332, 1332, 1253, 1255, 1141, 1140,
135460
+ /* 40 */ 1139, 1138, 1236, 1112, 1136, 1129, 1133, 1203, 1197, 1198,
135461
+ /* 50 */ 1196, 1200, 1204, 1332, 1132, 1167, 1181, 1166, 1332, 1332,
135123135462
/* 60 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135124135463
/* 70 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135125135464
/* 80 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135126135465
/* 90 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135127
- /* 100 */ 1332, 1332, 1332, 1332, 1176, 1181, 1188, 1180, 1177, 1169,
135466
+ /* 100 */ 1332, 1332, 1332, 1332, 1175, 1180, 1187, 1179, 1176, 1169,
135128135467
/* 110 */ 1168, 1170, 1171, 1332, 1019, 1067, 1332, 1332, 1332, 1172,
135129
- /* 120 */ 1332, 1173, 1185, 1184, 1183, 1262, 1289, 1288, 1332, 1332,
135468
+ /* 120 */ 1332, 1173, 1184, 1183, 1182, 1261, 1288, 1287, 1332, 1332,
135130135469
/* 130 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135131135470
/* 140 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135132
- /* 150 */ 1332, 1332, 1332, 1332, 1332, 1281, 1271, 1025, 1025, 1332,
135133
- /* 160 */ 1271, 1271, 1271, 1271, 1271, 1271, 1267, 1100, 1091, 1332,
135471
+ /* 150 */ 1332, 1332, 1332, 1332, 1332, 1280, 1270, 1025, 1025, 1332,
135472
+ /* 160 */ 1270, 1270, 1270, 1270, 1270, 1270, 1266, 1100, 1091, 1332,
135134135473
/* 170 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135135
- /* 180 */ 1259, 1257, 1332, 1218, 1332, 1332, 1332, 1332, 1332, 1332,
135474
+ /* 180 */ 1258, 1256, 1332, 1217, 1332, 1332, 1332, 1332, 1332, 1332,
135136135475
/* 190 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135137135476
/* 200 */ 1332, 1332, 1332, 1332, 1096, 1332, 1332, 1332, 1332, 1332,
135138
- /* 210 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1283, 1332, 1232,
135477
+ /* 210 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1282, 1332, 1231,
135139135478
/* 220 */ 1096, 1096, 1096, 1098, 1080, 1090, 1004, 1135, 1114, 1114,
135140
- /* 230 */ 1321, 1135, 1321, 1042, 1303, 1039, 1125, 1114, 1200, 1125,
135479
+ /* 230 */ 1321, 1135, 1321, 1042, 1302, 1039, 1125, 1114, 1199, 1125,
135141135480
/* 240 */ 1125, 1097, 1090, 1332, 1324, 1105, 1105, 1323, 1323, 1105,
135142135481
/* 250 */ 1146, 1070, 1135, 1076, 1076, 1076, 1076, 1105, 1016, 1135,
135143
- /* 260 */ 1146, 1070, 1070, 1135, 1105, 1016, 1236, 1318, 1105, 1105,
135144
- /* 270 */ 1016, 1211, 1105, 1016, 1105, 1016, 1211, 1068, 1068, 1068,
135145
- /* 280 */ 1057, 1211, 1068, 1042, 1068, 1057, 1068, 1068, 1118, 1113,
135146
- /* 290 */ 1118, 1113, 1118, 1113, 1118, 1113, 1105, 1206, 1105, 1332,
135147
- /* 300 */ 1211, 1215, 1215, 1211, 1130, 1119, 1128, 1126, 1135, 1022,
135148
- /* 310 */ 1060, 1286, 1286, 1282, 1282, 1282, 1282, 1329, 1329, 1267,
135149
- /* 320 */ 1298, 1298, 1044, 1044, 1298, 1332, 1332, 1332, 1332, 1332,
135150
- /* 330 */ 1332, 1293, 1332, 1220, 1332, 1332, 1332, 1332, 1332, 1332,
135482
+ /* 260 */ 1146, 1070, 1070, 1135, 1105, 1016, 1235, 1318, 1105, 1105,
135483
+ /* 270 */ 1016, 1210, 1105, 1016, 1105, 1016, 1210, 1068, 1068, 1068,
135484
+ /* 280 */ 1057, 1210, 1068, 1042, 1068, 1057, 1068, 1068, 1118, 1113,
135485
+ /* 290 */ 1118, 1113, 1118, 1113, 1118, 1113, 1105, 1205, 1105, 1332,
135486
+ /* 300 */ 1210, 1214, 1214, 1210, 1130, 1119, 1128, 1126, 1135, 1022,
135487
+ /* 310 */ 1060, 1285, 1285, 1281, 1281, 1281, 1281, 1329, 1329, 1266,
135488
+ /* 320 */ 1297, 1297, 1044, 1044, 1297, 1332, 1332, 1332, 1332, 1332,
135489
+ /* 330 */ 1332, 1292, 1332, 1219, 1332, 1332, 1332, 1332, 1332, 1332,
135151135490
/* 340 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135152
- /* 350 */ 1332, 1332, 1152, 1332, 1000, 1264, 1332, 1332, 1263, 1332,
135491
+ /* 350 */ 1332, 1332, 1152, 1332, 1000, 1263, 1332, 1332, 1262, 1332,
135153135492
/* 360 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135154135493
/* 370 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1320,
135155
- /* 380 */ 1332, 1332, 1332, 1332, 1332, 1332, 1235, 1234, 1332, 1332,
135494
+ /* 380 */ 1332, 1332, 1332, 1332, 1332, 1332, 1234, 1233, 1332, 1332,
135156135495
/* 390 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135157135496
/* 400 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135158
- /* 410 */ 1332, 1082, 1332, 1332, 1332, 1307, 1332, 1332, 1332, 1332,
135497
+ /* 410 */ 1332, 1082, 1332, 1332, 1332, 1306, 1332, 1332, 1332, 1332,
135159135498
/* 420 */ 1332, 1332, 1332, 1127, 1332, 1120, 1332, 1332, 1311, 1332,
135160
- /* 430 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1273,
135161
- /* 440 */ 1332, 1332, 1332, 1272, 1332, 1332, 1332, 1332, 1332, 1154,
135499
+ /* 430 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1272,
135500
+ /* 440 */ 1332, 1332, 1332, 1271, 1332, 1332, 1332, 1332, 1332, 1154,
135162135501
/* 450 */ 1332, 1153, 1157, 1332, 1010, 1332,
135163135502
};
135164135503
/********** End of lemon-generated parsing tables *****************************/
135165135504
135166135505
/* The next table maps tokens (terminal symbols) into fallback tokens.
@@ -135602,147 +135941,147 @@
135602135941
/* 169 */ "expr ::= expr EQ|NE expr",
135603135942
/* 170 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
135604135943
/* 171 */ "expr ::= expr PLUS|MINUS expr",
135605135944
/* 172 */ "expr ::= expr STAR|SLASH|REM expr",
135606135945
/* 173 */ "expr ::= expr CONCAT expr",
135607
- /* 174 */ "likeop ::= LIKE_KW|MATCH",
135608
- /* 175 */ "likeop ::= NOT LIKE_KW|MATCH",
135609
- /* 176 */ "expr ::= expr likeop expr",
135610
- /* 177 */ "expr ::= expr likeop expr ESCAPE expr",
135611
- /* 178 */ "expr ::= expr ISNULL|NOTNULL",
135612
- /* 179 */ "expr ::= expr NOT NULL",
135613
- /* 180 */ "expr ::= expr IS expr",
135614
- /* 181 */ "expr ::= expr IS NOT expr",
135615
- /* 182 */ "expr ::= NOT expr",
135616
- /* 183 */ "expr ::= BITNOT expr",
135617
- /* 184 */ "expr ::= MINUS expr",
135618
- /* 185 */ "expr ::= PLUS expr",
135619
- /* 186 */ "between_op ::= BETWEEN",
135620
- /* 187 */ "between_op ::= NOT BETWEEN",
135621
- /* 188 */ "expr ::= expr between_op expr AND expr",
135622
- /* 189 */ "in_op ::= IN",
135623
- /* 190 */ "in_op ::= NOT IN",
135624
- /* 191 */ "expr ::= expr in_op LP exprlist RP",
135625
- /* 192 */ "expr ::= LP select RP",
135626
- /* 193 */ "expr ::= expr in_op LP select RP",
135627
- /* 194 */ "expr ::= expr in_op nm dbnm paren_exprlist",
135628
- /* 195 */ "expr ::= EXISTS LP select RP",
135629
- /* 196 */ "expr ::= CASE case_operand case_exprlist case_else END",
135630
- /* 197 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
135631
- /* 198 */ "case_exprlist ::= WHEN expr THEN expr",
135632
- /* 199 */ "case_else ::= ELSE expr",
135633
- /* 200 */ "case_else ::=",
135634
- /* 201 */ "case_operand ::= expr",
135635
- /* 202 */ "case_operand ::=",
135636
- /* 203 */ "exprlist ::=",
135637
- /* 204 */ "nexprlist ::= nexprlist COMMA expr",
135638
- /* 205 */ "nexprlist ::= expr",
135639
- /* 206 */ "paren_exprlist ::=",
135640
- /* 207 */ "paren_exprlist ::= LP exprlist RP",
135641
- /* 208 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
135642
- /* 209 */ "uniqueflag ::= UNIQUE",
135643
- /* 210 */ "uniqueflag ::=",
135644
- /* 211 */ "eidlist_opt ::=",
135645
- /* 212 */ "eidlist_opt ::= LP eidlist RP",
135646
- /* 213 */ "eidlist ::= eidlist COMMA nm collate sortorder",
135647
- /* 214 */ "eidlist ::= nm collate sortorder",
135648
- /* 215 */ "collate ::=",
135649
- /* 216 */ "collate ::= COLLATE ID|STRING",
135650
- /* 217 */ "cmd ::= DROP INDEX ifexists fullname",
135651
- /* 218 */ "cmd ::= VACUUM",
135652
- /* 219 */ "cmd ::= VACUUM nm",
135653
- /* 220 */ "cmd ::= PRAGMA nm dbnm",
135654
- /* 221 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
135655
- /* 222 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
135656
- /* 223 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
135657
- /* 224 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
135658
- /* 225 */ "plus_num ::= PLUS INTEGER|FLOAT",
135659
- /* 226 */ "minus_num ::= MINUS INTEGER|FLOAT",
135660
- /* 227 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
135661
- /* 228 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
135662
- /* 229 */ "trigger_time ::= BEFORE",
135663
- /* 230 */ "trigger_time ::= AFTER",
135664
- /* 231 */ "trigger_time ::= INSTEAD OF",
135665
- /* 232 */ "trigger_time ::=",
135666
- /* 233 */ "trigger_event ::= DELETE|INSERT",
135667
- /* 234 */ "trigger_event ::= UPDATE",
135668
- /* 235 */ "trigger_event ::= UPDATE OF idlist",
135669
- /* 236 */ "when_clause ::=",
135670
- /* 237 */ "when_clause ::= WHEN expr",
135671
- /* 238 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
135672
- /* 239 */ "trigger_cmd_list ::= trigger_cmd SEMI",
135673
- /* 240 */ "trnm ::= nm DOT nm",
135674
- /* 241 */ "tridxby ::= INDEXED BY nm",
135675
- /* 242 */ "tridxby ::= NOT INDEXED",
135676
- /* 243 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt",
135677
- /* 244 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select",
135678
- /* 245 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt",
135679
- /* 246 */ "trigger_cmd ::= select",
135680
- /* 247 */ "expr ::= RAISE LP IGNORE RP",
135681
- /* 248 */ "expr ::= RAISE LP raisetype COMMA nm RP",
135682
- /* 249 */ "raisetype ::= ROLLBACK",
135683
- /* 250 */ "raisetype ::= ABORT",
135684
- /* 251 */ "raisetype ::= FAIL",
135685
- /* 252 */ "cmd ::= DROP TRIGGER ifexists fullname",
135686
- /* 253 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
135687
- /* 254 */ "cmd ::= DETACH database_kw_opt expr",
135688
- /* 255 */ "key_opt ::=",
135689
- /* 256 */ "key_opt ::= KEY expr",
135690
- /* 257 */ "cmd ::= REINDEX",
135691
- /* 258 */ "cmd ::= REINDEX nm dbnm",
135692
- /* 259 */ "cmd ::= ANALYZE",
135693
- /* 260 */ "cmd ::= ANALYZE nm dbnm",
135694
- /* 261 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
135695
- /* 262 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
135696
- /* 263 */ "add_column_fullname ::= fullname",
135697
- /* 264 */ "cmd ::= create_vtab",
135698
- /* 265 */ "cmd ::= create_vtab LP vtabarglist RP",
135699
- /* 266 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
135700
- /* 267 */ "vtabarg ::=",
135701
- /* 268 */ "vtabargtoken ::= ANY",
135702
- /* 269 */ "vtabargtoken ::= lp anylist RP",
135703
- /* 270 */ "lp ::= LP",
135704
- /* 271 */ "with ::=",
135705
- /* 272 */ "with ::= WITH wqlist",
135706
- /* 273 */ "with ::= WITH RECURSIVE wqlist",
135707
- /* 274 */ "wqlist ::= nm eidlist_opt AS LP select RP",
135708
- /* 275 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
135709
- /* 276 */ "input ::= cmdlist",
135710
- /* 277 */ "cmdlist ::= cmdlist ecmd",
135711
- /* 278 */ "cmdlist ::= ecmd",
135712
- /* 279 */ "ecmd ::= SEMI",
135713
- /* 280 */ "ecmd ::= explain cmdx SEMI",
135714
- /* 281 */ "explain ::=",
135715
- /* 282 */ "trans_opt ::=",
135716
- /* 283 */ "trans_opt ::= TRANSACTION",
135717
- /* 284 */ "trans_opt ::= TRANSACTION nm",
135718
- /* 285 */ "savepoint_opt ::= SAVEPOINT",
135719
- /* 286 */ "savepoint_opt ::=",
135720
- /* 287 */ "cmd ::= create_table create_table_args",
135721
- /* 288 */ "columnlist ::= columnlist COMMA columnname carglist",
135722
- /* 289 */ "columnlist ::= columnname carglist",
135723
- /* 290 */ "nm ::= ID|INDEXED",
135724
- /* 291 */ "nm ::= STRING",
135725
- /* 292 */ "nm ::= JOIN_KW",
135726
- /* 293 */ "typetoken ::= typename",
135727
- /* 294 */ "typename ::= ID|STRING",
135728
- /* 295 */ "signed ::= plus_num",
135729
- /* 296 */ "signed ::= minus_num",
135730
- /* 297 */ "carglist ::= carglist ccons",
135731
- /* 298 */ "carglist ::=",
135732
- /* 299 */ "ccons ::= NULL onconf",
135733
- /* 300 */ "conslist_opt ::= COMMA conslist",
135734
- /* 301 */ "conslist ::= conslist tconscomma tcons",
135735
- /* 302 */ "conslist ::= tcons",
135736
- /* 303 */ "tconscomma ::=",
135737
- /* 304 */ "defer_subclause_opt ::= defer_subclause",
135738
- /* 305 */ "resolvetype ::= raisetype",
135739
- /* 306 */ "selectnowith ::= oneselect",
135740
- /* 307 */ "oneselect ::= values",
135741
- /* 308 */ "sclp ::= selcollist COMMA",
135742
- /* 309 */ "as ::= ID|STRING",
135743
- /* 310 */ "expr ::= term",
135946
+ /* 174 */ "likeop ::= NOT LIKE_KW|MATCH",
135947
+ /* 175 */ "expr ::= expr likeop expr",
135948
+ /* 176 */ "expr ::= expr likeop expr ESCAPE expr",
135949
+ /* 177 */ "expr ::= expr ISNULL|NOTNULL",
135950
+ /* 178 */ "expr ::= expr NOT NULL",
135951
+ /* 179 */ "expr ::= expr IS expr",
135952
+ /* 180 */ "expr ::= expr IS NOT expr",
135953
+ /* 181 */ "expr ::= NOT expr",
135954
+ /* 182 */ "expr ::= BITNOT expr",
135955
+ /* 183 */ "expr ::= MINUS expr",
135956
+ /* 184 */ "expr ::= PLUS expr",
135957
+ /* 185 */ "between_op ::= BETWEEN",
135958
+ /* 186 */ "between_op ::= NOT BETWEEN",
135959
+ /* 187 */ "expr ::= expr between_op expr AND expr",
135960
+ /* 188 */ "in_op ::= IN",
135961
+ /* 189 */ "in_op ::= NOT IN",
135962
+ /* 190 */ "expr ::= expr in_op LP exprlist RP",
135963
+ /* 191 */ "expr ::= LP select RP",
135964
+ /* 192 */ "expr ::= expr in_op LP select RP",
135965
+ /* 193 */ "expr ::= expr in_op nm dbnm paren_exprlist",
135966
+ /* 194 */ "expr ::= EXISTS LP select RP",
135967
+ /* 195 */ "expr ::= CASE case_operand case_exprlist case_else END",
135968
+ /* 196 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
135969
+ /* 197 */ "case_exprlist ::= WHEN expr THEN expr",
135970
+ /* 198 */ "case_else ::= ELSE expr",
135971
+ /* 199 */ "case_else ::=",
135972
+ /* 200 */ "case_operand ::= expr",
135973
+ /* 201 */ "case_operand ::=",
135974
+ /* 202 */ "exprlist ::=",
135975
+ /* 203 */ "nexprlist ::= nexprlist COMMA expr",
135976
+ /* 204 */ "nexprlist ::= expr",
135977
+ /* 205 */ "paren_exprlist ::=",
135978
+ /* 206 */ "paren_exprlist ::= LP exprlist RP",
135979
+ /* 207 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
135980
+ /* 208 */ "uniqueflag ::= UNIQUE",
135981
+ /* 209 */ "uniqueflag ::=",
135982
+ /* 210 */ "eidlist_opt ::=",
135983
+ /* 211 */ "eidlist_opt ::= LP eidlist RP",
135984
+ /* 212 */ "eidlist ::= eidlist COMMA nm collate sortorder",
135985
+ /* 213 */ "eidlist ::= nm collate sortorder",
135986
+ /* 214 */ "collate ::=",
135987
+ /* 215 */ "collate ::= COLLATE ID|STRING",
135988
+ /* 216 */ "cmd ::= DROP INDEX ifexists fullname",
135989
+ /* 217 */ "cmd ::= VACUUM",
135990
+ /* 218 */ "cmd ::= VACUUM nm",
135991
+ /* 219 */ "cmd ::= PRAGMA nm dbnm",
135992
+ /* 220 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
135993
+ /* 221 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
135994
+ /* 222 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
135995
+ /* 223 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
135996
+ /* 224 */ "plus_num ::= PLUS INTEGER|FLOAT",
135997
+ /* 225 */ "minus_num ::= MINUS INTEGER|FLOAT",
135998
+ /* 226 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
135999
+ /* 227 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
136000
+ /* 228 */ "trigger_time ::= BEFORE",
136001
+ /* 229 */ "trigger_time ::= AFTER",
136002
+ /* 230 */ "trigger_time ::= INSTEAD OF",
136003
+ /* 231 */ "trigger_time ::=",
136004
+ /* 232 */ "trigger_event ::= DELETE|INSERT",
136005
+ /* 233 */ "trigger_event ::= UPDATE",
136006
+ /* 234 */ "trigger_event ::= UPDATE OF idlist",
136007
+ /* 235 */ "when_clause ::=",
136008
+ /* 236 */ "when_clause ::= WHEN expr",
136009
+ /* 237 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
136010
+ /* 238 */ "trigger_cmd_list ::= trigger_cmd SEMI",
136011
+ /* 239 */ "trnm ::= nm DOT nm",
136012
+ /* 240 */ "tridxby ::= INDEXED BY nm",
136013
+ /* 241 */ "tridxby ::= NOT INDEXED",
136014
+ /* 242 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt",
136015
+ /* 243 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select",
136016
+ /* 244 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt",
136017
+ /* 245 */ "trigger_cmd ::= select",
136018
+ /* 246 */ "expr ::= RAISE LP IGNORE RP",
136019
+ /* 247 */ "expr ::= RAISE LP raisetype COMMA nm RP",
136020
+ /* 248 */ "raisetype ::= ROLLBACK",
136021
+ /* 249 */ "raisetype ::= ABORT",
136022
+ /* 250 */ "raisetype ::= FAIL",
136023
+ /* 251 */ "cmd ::= DROP TRIGGER ifexists fullname",
136024
+ /* 252 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
136025
+ /* 253 */ "cmd ::= DETACH database_kw_opt expr",
136026
+ /* 254 */ "key_opt ::=",
136027
+ /* 255 */ "key_opt ::= KEY expr",
136028
+ /* 256 */ "cmd ::= REINDEX",
136029
+ /* 257 */ "cmd ::= REINDEX nm dbnm",
136030
+ /* 258 */ "cmd ::= ANALYZE",
136031
+ /* 259 */ "cmd ::= ANALYZE nm dbnm",
136032
+ /* 260 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
136033
+ /* 261 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
136034
+ /* 262 */ "add_column_fullname ::= fullname",
136035
+ /* 263 */ "cmd ::= create_vtab",
136036
+ /* 264 */ "cmd ::= create_vtab LP vtabarglist RP",
136037
+ /* 265 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
136038
+ /* 266 */ "vtabarg ::=",
136039
+ /* 267 */ "vtabargtoken ::= ANY",
136040
+ /* 268 */ "vtabargtoken ::= lp anylist RP",
136041
+ /* 269 */ "lp ::= LP",
136042
+ /* 270 */ "with ::=",
136043
+ /* 271 */ "with ::= WITH wqlist",
136044
+ /* 272 */ "with ::= WITH RECURSIVE wqlist",
136045
+ /* 273 */ "wqlist ::= nm eidlist_opt AS LP select RP",
136046
+ /* 274 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
136047
+ /* 275 */ "input ::= cmdlist",
136048
+ /* 276 */ "cmdlist ::= cmdlist ecmd",
136049
+ /* 277 */ "cmdlist ::= ecmd",
136050
+ /* 278 */ "ecmd ::= SEMI",
136051
+ /* 279 */ "ecmd ::= explain cmdx SEMI",
136052
+ /* 280 */ "explain ::=",
136053
+ /* 281 */ "trans_opt ::=",
136054
+ /* 282 */ "trans_opt ::= TRANSACTION",
136055
+ /* 283 */ "trans_opt ::= TRANSACTION nm",
136056
+ /* 284 */ "savepoint_opt ::= SAVEPOINT",
136057
+ /* 285 */ "savepoint_opt ::=",
136058
+ /* 286 */ "cmd ::= create_table create_table_args",
136059
+ /* 287 */ "columnlist ::= columnlist COMMA columnname carglist",
136060
+ /* 288 */ "columnlist ::= columnname carglist",
136061
+ /* 289 */ "nm ::= ID|INDEXED",
136062
+ /* 290 */ "nm ::= STRING",
136063
+ /* 291 */ "nm ::= JOIN_KW",
136064
+ /* 292 */ "typetoken ::= typename",
136065
+ /* 293 */ "typename ::= ID|STRING",
136066
+ /* 294 */ "signed ::= plus_num",
136067
+ /* 295 */ "signed ::= minus_num",
136068
+ /* 296 */ "carglist ::= carglist ccons",
136069
+ /* 297 */ "carglist ::=",
136070
+ /* 298 */ "ccons ::= NULL onconf",
136071
+ /* 299 */ "conslist_opt ::= COMMA conslist",
136072
+ /* 300 */ "conslist ::= conslist tconscomma tcons",
136073
+ /* 301 */ "conslist ::= tcons",
136074
+ /* 302 */ "tconscomma ::=",
136075
+ /* 303 */ "defer_subclause_opt ::= defer_subclause",
136076
+ /* 304 */ "resolvetype ::= raisetype",
136077
+ /* 305 */ "selectnowith ::= oneselect",
136078
+ /* 306 */ "oneselect ::= values",
136079
+ /* 307 */ "sclp ::= selcollist COMMA",
136080
+ /* 308 */ "as ::= ID|STRING",
136081
+ /* 309 */ "expr ::= term",
136082
+ /* 310 */ "likeop ::= LIKE_KW|MATCH",
135744136083
/* 311 */ "exprlist ::= nexprlist",
135745136084
/* 312 */ "nmnum ::= plus_num",
135746136085
/* 313 */ "nmnum ::= nm",
135747136086
/* 314 */ "nmnum ::= ON",
135748136087
/* 315 */ "nmnum ::= DELETE",
@@ -136375,11 +136714,10 @@
136375136714
{ 173, 3 },
136376136715
{ 173, 3 },
136377136716
{ 173, 3 },
136378136717
{ 173, 3 },
136379136718
{ 173, 3 },
136380
- { 221, 1 },
136381136719
{ 221, 2 },
136382136720
{ 173, 3 },
136383136721
{ 173, 5 },
136384136722
{ 173, 2 },
136385136723
{ 173, 3 },
@@ -136512,10 +136850,11 @@
136512136850
{ 194, 1 },
136513136851
{ 195, 1 },
136514136852
{ 209, 2 },
136515136853
{ 210, 1 },
136516136854
{ 173, 1 },
136855
+ { 221, 1 },
136517136856
{ 208, 1 },
136518136857
{ 230, 1 },
136519136858
{ 230, 1 },
136520136859
{ 230, 1 },
136521136860
{ 230, 1 },
@@ -136654,11 +136993,11 @@
136654136993
case 42: /* autoinc ::= */ yytestcase(yyruleno==42);
136655136994
case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57);
136656136995
case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67);
136657136996
case 76: /* ifexists ::= */ yytestcase(yyruleno==76);
136658136997
case 90: /* distinct ::= */ yytestcase(yyruleno==90);
136659
- case 215: /* collate ::= */ yytestcase(yyruleno==215);
136998
+ case 214: /* collate ::= */ yytestcase(yyruleno==214);
136660136999
{yymsp[1].minor.yy194 = 0;}
136661137000
break;
136662137001
case 17: /* ifnotexists ::= IF NOT EXISTS */
136663137002
{yymsp[-2].minor.yy194 = 1;}
136664137003
break;
@@ -136798,13 +137137,13 @@
136798137137
case 144: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==144);
136799137138
{yymsp[-1].minor.yy194 = yymsp[0].minor.yy194;}
136800137139
break;
136801137140
case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
136802137141
case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75);
136803
- case 187: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==187);
136804
- case 190: /* in_op ::= NOT IN */ yytestcase(yyruleno==190);
136805
- case 216: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==216);
137142
+ case 186: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==186);
137143
+ case 189: /* in_op ::= NOT IN */ yytestcase(yyruleno==189);
137144
+ case 215: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==215);
136806137145
{yymsp[-1].minor.yy194 = 1;}
136807137146
break;
136808137147
case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
136809137148
{yymsp[-1].minor.yy194 = 0;}
136810137149
break;
@@ -136964,13 +137303,13 @@
136964137303
{yymsp[0].minor.yy194 = SF_All;}
136965137304
break;
136966137305
case 91: /* sclp ::= */
136967137306
case 119: /* orderby_opt ::= */ yytestcase(yyruleno==119);
136968137307
case 126: /* groupby_opt ::= */ yytestcase(yyruleno==126);
136969
- case 203: /* exprlist ::= */ yytestcase(yyruleno==203);
136970
- case 206: /* paren_exprlist ::= */ yytestcase(yyruleno==206);
136971
- case 211: /* eidlist_opt ::= */ yytestcase(yyruleno==211);
137308
+ case 202: /* exprlist ::= */ yytestcase(yyruleno==202);
137309
+ case 205: /* paren_exprlist ::= */ yytestcase(yyruleno==205);
137310
+ case 210: /* eidlist_opt ::= */ yytestcase(yyruleno==210);
136972137311
{yymsp[1].minor.yy148 = 0;}
136973137312
break;
136974137313
case 92: /* selcollist ::= sclp expr as */
136975137314
{
136976137315
yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy148, yymsp[-1].minor.yy190.pExpr);
@@ -136992,12 +137331,12 @@
136992137331
yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, pDot);
136993137332
}
136994137333
break;
136995137334
case 95: /* as ::= AS nm */
136996137335
case 106: /* dbnm ::= DOT nm */ yytestcase(yyruleno==106);
136997
- case 225: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==225);
136998
- case 226: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==226);
137336
+ case 224: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==224);
137337
+ case 225: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==225);
136999137338
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
137000137339
break;
137001137340
case 97: /* from ::= */
137002137341
{yymsp[1].minor.yy185 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy185));}
137003137342
break;
@@ -137076,18 +137415,18 @@
137076137415
{yymsp[-3].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
137077137416
break;
137078137417
case 112: /* on_opt ::= ON expr */
137079137418
case 129: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==129);
137080137419
case 136: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==136);
137081
- case 199: /* case_else ::= ELSE expr */ yytestcase(yyruleno==199);
137420
+ case 198: /* case_else ::= ELSE expr */ yytestcase(yyruleno==198);
137082137421
{yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr;}
137083137422
break;
137084137423
case 113: /* on_opt ::= */
137085137424
case 128: /* having_opt ::= */ yytestcase(yyruleno==128);
137086137425
case 135: /* where_opt ::= */ yytestcase(yyruleno==135);
137087
- case 200: /* case_else ::= */ yytestcase(yyruleno==200);
137088
- case 202: /* case_operand ::= */ yytestcase(yyruleno==202);
137426
+ case 199: /* case_else ::= */ yytestcase(yyruleno==199);
137427
+ case 201: /* case_operand ::= */ yytestcase(yyruleno==201);
137089137428
{yymsp[1].minor.yy72 = 0;}
137090137429
break;
137091137430
case 115: /* indexed_opt ::= INDEXED BY nm */
137092137431
{yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
137093137432
break;
@@ -137320,17 +137659,14 @@
137320137659
case 171: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==171);
137321137660
case 172: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==172);
137322137661
case 173: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==173);
137323137662
{spanBinaryExpr(pParse,yymsp[-1].major,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);}
137324137663
break;
137325
- case 174: /* likeop ::= LIKE_KW|MATCH */
137326
-{yymsp[0].minor.yy0=yymsp[0].minor.yy0;/*A-overwrites-X*/}
137327
- break;
137328
- case 175: /* likeop ::= NOT LIKE_KW|MATCH */
137664
+ case 174: /* likeop ::= NOT LIKE_KW|MATCH */
137329137665
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
137330137666
break;
137331
- case 176: /* expr ::= expr likeop expr */
137667
+ case 175: /* expr ::= expr likeop expr */
137332137668
{
137333137669
ExprList *pList;
137334137670
int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
137335137671
yymsp[-1].minor.yy0.n &= 0x7fffffff;
137336137672
pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy190.pExpr);
@@ -137339,11 +137675,11 @@
137339137675
exprNot(pParse, bNot, &yymsp[-2].minor.yy190);
137340137676
yymsp[-2].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
137341137677
if( yymsp[-2].minor.yy190.pExpr ) yymsp[-2].minor.yy190.pExpr->flags |= EP_InfixFunc;
137342137678
}
137343137679
break;
137344
- case 177: /* expr ::= expr likeop expr ESCAPE expr */
137680
+ case 176: /* expr ::= expr likeop expr ESCAPE expr */
137345137681
{
137346137682
ExprList *pList;
137347137683
int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
137348137684
yymsp[-3].minor.yy0.n &= 0x7fffffff;
137349137685
pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
@@ -137353,43 +137689,43 @@
137353137689
exprNot(pParse, bNot, &yymsp[-4].minor.yy190);
137354137690
yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
137355137691
if( yymsp[-4].minor.yy190.pExpr ) yymsp[-4].minor.yy190.pExpr->flags |= EP_InfixFunc;
137356137692
}
137357137693
break;
137358
- case 178: /* expr ::= expr ISNULL|NOTNULL */
137694
+ case 177: /* expr ::= expr ISNULL|NOTNULL */
137359137695
{spanUnaryPostfix(pParse,yymsp[0].major,&yymsp[-1].minor.yy190,&yymsp[0].minor.yy0);}
137360137696
break;
137361
- case 179: /* expr ::= expr NOT NULL */
137697
+ case 178: /* expr ::= expr NOT NULL */
137362137698
{spanUnaryPostfix(pParse,TK_NOTNULL,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy0);}
137363137699
break;
137364
- case 180: /* expr ::= expr IS expr */
137700
+ case 179: /* expr ::= expr IS expr */
137365137701
{
137366137702
spanBinaryExpr(pParse,TK_IS,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);
137367137703
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-2].minor.yy190.pExpr, TK_ISNULL);
137368137704
}
137369137705
break;
137370
- case 181: /* expr ::= expr IS NOT expr */
137706
+ case 180: /* expr ::= expr IS NOT expr */
137371137707
{
137372137708
spanBinaryExpr(pParse,TK_ISNOT,&yymsp[-3].minor.yy190,&yymsp[0].minor.yy190);
137373137709
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-3].minor.yy190.pExpr, TK_NOTNULL);
137374137710
}
137375137711
break;
137376
- case 182: /* expr ::= NOT expr */
137377
- case 183: /* expr ::= BITNOT expr */ yytestcase(yyruleno==183);
137712
+ case 181: /* expr ::= NOT expr */
137713
+ case 182: /* expr ::= BITNOT expr */ yytestcase(yyruleno==182);
137378137714
{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,yymsp[-1].major,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
137379137715
break;
137380
- case 184: /* expr ::= MINUS expr */
137716
+ case 183: /* expr ::= MINUS expr */
137381137717
{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UMINUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
137382137718
break;
137383
- case 185: /* expr ::= PLUS expr */
137719
+ case 184: /* expr ::= PLUS expr */
137384137720
{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UPLUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
137385137721
break;
137386
- case 186: /* between_op ::= BETWEEN */
137387
- case 189: /* in_op ::= IN */ yytestcase(yyruleno==189);
137722
+ case 185: /* between_op ::= BETWEEN */
137723
+ case 188: /* in_op ::= IN */ yytestcase(yyruleno==188);
137388137724
{yymsp[0].minor.yy194 = 0;}
137389137725
break;
137390
- case 188: /* expr ::= expr between_op expr AND expr */
137726
+ case 187: /* expr ::= expr between_op expr AND expr */
137391137727
{
137392137728
ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
137393137729
pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr);
137394137730
yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy190.pExpr, 0);
137395137731
if( yymsp[-4].minor.yy190.pExpr ){
@@ -137399,11 +137735,11 @@
137399137735
}
137400137736
exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
137401137737
yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
137402137738
}
137403137739
break;
137404
- case 191: /* expr ::= expr in_op LP exprlist RP */
137740
+ case 190: /* expr ::= expr in_op LP exprlist RP */
137405137741
{
137406137742
if( yymsp[-1].minor.yy148==0 ){
137407137743
/* Expressions of the form
137408137744
**
137409137745
** expr1 IN ()
@@ -137452,26 +137788,26 @@
137452137788
exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
137453137789
}
137454137790
yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
137455137791
}
137456137792
break;
137457
- case 192: /* expr ::= LP select RP */
137793
+ case 191: /* expr ::= LP select RP */
137458137794
{
137459137795
spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/
137460137796
yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
137461137797
sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy190.pExpr, yymsp[-1].minor.yy243);
137462137798
}
137463137799
break;
137464
- case 193: /* expr ::= expr in_op LP select RP */
137800
+ case 192: /* expr ::= expr in_op LP select RP */
137465137801
{
137466137802
yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0);
137467137803
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, yymsp[-1].minor.yy243);
137468137804
exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
137469137805
yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
137470137806
}
137471137807
break;
137472
- case 194: /* expr ::= expr in_op nm dbnm paren_exprlist */
137808
+ case 193: /* expr ::= expr in_op nm dbnm paren_exprlist */
137473137809
{
137474137810
SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
137475137811
Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
137476137812
if( yymsp[0].minor.yy148 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy148);
137477137813
yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0);
@@ -137478,19 +137814,19 @@
137478137814
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, pSelect);
137479137815
exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
137480137816
yymsp[-4].minor.yy190.zEnd = yymsp[-1].minor.yy0.z ? &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n] : &yymsp[-2].minor.yy0.z[yymsp[-2].minor.yy0.n];
137481137817
}
137482137818
break;
137483
- case 195: /* expr ::= EXISTS LP select RP */
137819
+ case 194: /* expr ::= EXISTS LP select RP */
137484137820
{
137485137821
Expr *p;
137486137822
spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/
137487137823
p = yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
137488137824
sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy243);
137489137825
}
137490137826
break;
137491
- case 196: /* expr ::= CASE case_operand case_exprlist case_else END */
137827
+ case 195: /* expr ::= CASE case_operand case_exprlist case_else END */
137492137828
{
137493137829
spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-C*/
137494137830
yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy72, 0);
137495137831
if( yymsp[-4].minor.yy190.pExpr ){
137496137832
yymsp[-4].minor.yy190.pExpr->x.pList = yymsp[-1].minor.yy72 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[-1].minor.yy72) : yymsp[-2].minor.yy148;
@@ -137499,313 +137835,314 @@
137499137835
sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy148);
137500137836
sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy72);
137501137837
}
137502137838
}
137503137839
break;
137504
- case 197: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
137840
+ case 196: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
137505137841
{
137506137842
yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[-2].minor.yy190.pExpr);
137507137843
yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr);
137508137844
}
137509137845
break;
137510
- case 198: /* case_exprlist ::= WHEN expr THEN expr */
137846
+ case 197: /* case_exprlist ::= WHEN expr THEN expr */
137511137847
{
137512137848
yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
137513137849
yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, yymsp[0].minor.yy190.pExpr);
137514137850
}
137515137851
break;
137516
- case 201: /* case_operand ::= expr */
137852
+ case 200: /* case_operand ::= expr */
137517137853
{yymsp[0].minor.yy72 = yymsp[0].minor.yy190.pExpr; /*A-overwrites-X*/}
137518137854
break;
137519
- case 204: /* nexprlist ::= nexprlist COMMA expr */
137855
+ case 203: /* nexprlist ::= nexprlist COMMA expr */
137520137856
{yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[0].minor.yy190.pExpr);}
137521137857
break;
137522
- case 205: /* nexprlist ::= expr */
137858
+ case 204: /* nexprlist ::= expr */
137523137859
{yymsp[0].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy190.pExpr); /*A-overwrites-Y*/}
137524137860
break;
137525
- case 207: /* paren_exprlist ::= LP exprlist RP */
137526
- case 212: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==212);
137861
+ case 206: /* paren_exprlist ::= LP exprlist RP */
137862
+ case 211: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==211);
137527137863
{yymsp[-2].minor.yy148 = yymsp[-1].minor.yy148;}
137528137864
break;
137529
- case 208: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
137865
+ case 207: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
137530137866
{
137531137867
sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
137532137868
sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy148, yymsp[-10].minor.yy194,
137533137869
&yymsp[-11].minor.yy0, yymsp[0].minor.yy72, SQLITE_SO_ASC, yymsp[-8].minor.yy194, SQLITE_IDXTYPE_APPDEF);
137534137870
}
137535137871
break;
137536
- case 209: /* uniqueflag ::= UNIQUE */
137537
- case 250: /* raisetype ::= ABORT */ yytestcase(yyruleno==250);
137872
+ case 208: /* uniqueflag ::= UNIQUE */
137873
+ case 249: /* raisetype ::= ABORT */ yytestcase(yyruleno==249);
137538137874
{yymsp[0].minor.yy194 = OE_Abort;}
137539137875
break;
137540
- case 210: /* uniqueflag ::= */
137876
+ case 209: /* uniqueflag ::= */
137541137877
{yymsp[1].minor.yy194 = OE_None;}
137542137878
break;
137543
- case 213: /* eidlist ::= eidlist COMMA nm collate sortorder */
137879
+ case 212: /* eidlist ::= eidlist COMMA nm collate sortorder */
137544137880
{
137545137881
yymsp[-4].minor.yy148 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194);
137546137882
}
137547137883
break;
137548
- case 214: /* eidlist ::= nm collate sortorder */
137884
+ case 213: /* eidlist ::= nm collate sortorder */
137549137885
{
137550137886
yymsp[-2].minor.yy148 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194); /*A-overwrites-Y*/
137551137887
}
137552137888
break;
137553
- case 217: /* cmd ::= DROP INDEX ifexists fullname */
137889
+ case 216: /* cmd ::= DROP INDEX ifexists fullname */
137554137890
{sqlite3DropIndex(pParse, yymsp[0].minor.yy185, yymsp[-1].minor.yy194);}
137555137891
break;
137556
- case 218: /* cmd ::= VACUUM */
137892
+ case 217: /* cmd ::= VACUUM */
137557137893
{sqlite3Vacuum(pParse,0);}
137558137894
break;
137559
- case 219: /* cmd ::= VACUUM nm */
137895
+ case 218: /* cmd ::= VACUUM nm */
137560137896
{sqlite3Vacuum(pParse,&yymsp[0].minor.yy0);}
137561137897
break;
137562
- case 220: /* cmd ::= PRAGMA nm dbnm */
137898
+ case 219: /* cmd ::= PRAGMA nm dbnm */
137563137899
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
137564137900
break;
137565
- case 221: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
137901
+ case 220: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
137566137902
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
137567137903
break;
137568
- case 222: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
137904
+ case 221: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
137569137905
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
137570137906
break;
137571
- case 223: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
137907
+ case 222: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
137572137908
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
137573137909
break;
137574
- case 224: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
137910
+ case 223: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
137575137911
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
137576137912
break;
137577
- case 227: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
137913
+ case 226: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
137578137914
{
137579137915
Token all;
137580137916
all.z = yymsp[-3].minor.yy0.z;
137581137917
all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
137582137918
sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy145, &all);
137583137919
}
137584137920
break;
137585
- case 228: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
137921
+ case 227: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
137586137922
{
137587137923
sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy194, yymsp[-4].minor.yy332.a, yymsp[-4].minor.yy332.b, yymsp[-2].minor.yy185, yymsp[0].minor.yy72, yymsp[-10].minor.yy194, yymsp[-8].minor.yy194);
137588137924
yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
137589137925
}
137590137926
break;
137591
- case 229: /* trigger_time ::= BEFORE */
137927
+ case 228: /* trigger_time ::= BEFORE */
137592137928
{ yymsp[0].minor.yy194 = TK_BEFORE; }
137593137929
break;
137594
- case 230: /* trigger_time ::= AFTER */
137930
+ case 229: /* trigger_time ::= AFTER */
137595137931
{ yymsp[0].minor.yy194 = TK_AFTER; }
137596137932
break;
137597
- case 231: /* trigger_time ::= INSTEAD OF */
137933
+ case 230: /* trigger_time ::= INSTEAD OF */
137598137934
{ yymsp[-1].minor.yy194 = TK_INSTEAD;}
137599137935
break;
137600
- case 232: /* trigger_time ::= */
137936
+ case 231: /* trigger_time ::= */
137601137937
{ yymsp[1].minor.yy194 = TK_BEFORE; }
137602137938
break;
137603
- case 233: /* trigger_event ::= DELETE|INSERT */
137604
- case 234: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==234);
137939
+ case 232: /* trigger_event ::= DELETE|INSERT */
137940
+ case 233: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==233);
137605137941
{yymsp[0].minor.yy332.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy332.b = 0;}
137606137942
break;
137607
- case 235: /* trigger_event ::= UPDATE OF idlist */
137943
+ case 234: /* trigger_event ::= UPDATE OF idlist */
137608137944
{yymsp[-2].minor.yy332.a = TK_UPDATE; yymsp[-2].minor.yy332.b = yymsp[0].minor.yy254;}
137609137945
break;
137610
- case 236: /* when_clause ::= */
137611
- case 255: /* key_opt ::= */ yytestcase(yyruleno==255);
137946
+ case 235: /* when_clause ::= */
137947
+ case 254: /* key_opt ::= */ yytestcase(yyruleno==254);
137612137948
{ yymsp[1].minor.yy72 = 0; }
137613137949
break;
137614
- case 237: /* when_clause ::= WHEN expr */
137615
- case 256: /* key_opt ::= KEY expr */ yytestcase(yyruleno==256);
137950
+ case 236: /* when_clause ::= WHEN expr */
137951
+ case 255: /* key_opt ::= KEY expr */ yytestcase(yyruleno==255);
137616137952
{ yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr; }
137617137953
break;
137618
- case 238: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
137954
+ case 237: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
137619137955
{
137620137956
assert( yymsp[-2].minor.yy145!=0 );
137621137957
yymsp[-2].minor.yy145->pLast->pNext = yymsp[-1].minor.yy145;
137622137958
yymsp[-2].minor.yy145->pLast = yymsp[-1].minor.yy145;
137623137959
}
137624137960
break;
137625
- case 239: /* trigger_cmd_list ::= trigger_cmd SEMI */
137961
+ case 238: /* trigger_cmd_list ::= trigger_cmd SEMI */
137626137962
{
137627137963
assert( yymsp[-1].minor.yy145!=0 );
137628137964
yymsp[-1].minor.yy145->pLast = yymsp[-1].minor.yy145;
137629137965
}
137630137966
break;
137631
- case 240: /* trnm ::= nm DOT nm */
137967
+ case 239: /* trnm ::= nm DOT nm */
137632137968
{
137633137969
yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
137634137970
sqlite3ErrorMsg(pParse,
137635137971
"qualified table names are not allowed on INSERT, UPDATE, and DELETE "
137636137972
"statements within triggers");
137637137973
}
137638137974
break;
137639
- case 241: /* tridxby ::= INDEXED BY nm */
137975
+ case 240: /* tridxby ::= INDEXED BY nm */
137640137976
{
137641137977
sqlite3ErrorMsg(pParse,
137642137978
"the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
137643137979
"within triggers");
137644137980
}
137645137981
break;
137646
- case 242: /* tridxby ::= NOT INDEXED */
137982
+ case 241: /* tridxby ::= NOT INDEXED */
137647137983
{
137648137984
sqlite3ErrorMsg(pParse,
137649137985
"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
137650137986
"within triggers");
137651137987
}
137652137988
break;
137653
- case 243: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
137989
+ case 242: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
137654137990
{yymsp[-6].minor.yy145 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy148, yymsp[0].minor.yy72, yymsp[-5].minor.yy194);}
137655137991
break;
137656
- case 244: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */
137992
+ case 243: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */
137657137993
{yymsp[-4].minor.yy145 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy254, yymsp[0].minor.yy243, yymsp[-4].minor.yy194);/*A-overwrites-R*/}
137658137994
break;
137659
- case 245: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
137995
+ case 244: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
137660137996
{yymsp[-4].minor.yy145 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy72);}
137661137997
break;
137662
- case 246: /* trigger_cmd ::= select */
137998
+ case 245: /* trigger_cmd ::= select */
137663137999
{yymsp[0].minor.yy145 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy243); /*A-overwrites-X*/}
137664138000
break;
137665
- case 247: /* expr ::= RAISE LP IGNORE RP */
138001
+ case 246: /* expr ::= RAISE LP IGNORE RP */
137666138002
{
137667138003
spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
137668138004
yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
137669138005
if( yymsp[-3].minor.yy190.pExpr ){
137670138006
yymsp[-3].minor.yy190.pExpr->affinity = OE_Ignore;
137671138007
}
137672138008
}
137673138009
break;
137674
- case 248: /* expr ::= RAISE LP raisetype COMMA nm RP */
138010
+ case 247: /* expr ::= RAISE LP raisetype COMMA nm RP */
137675138011
{
137676138012
spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
137677138013
yymsp[-5].minor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
137678138014
if( yymsp[-5].minor.yy190.pExpr ) {
137679138015
yymsp[-5].minor.yy190.pExpr->affinity = (char)yymsp[-3].minor.yy194;
137680138016
}
137681138017
}
137682138018
break;
137683
- case 249: /* raisetype ::= ROLLBACK */
138019
+ case 248: /* raisetype ::= ROLLBACK */
137684138020
{yymsp[0].minor.yy194 = OE_Rollback;}
137685138021
break;
137686
- case 251: /* raisetype ::= FAIL */
138022
+ case 250: /* raisetype ::= FAIL */
137687138023
{yymsp[0].minor.yy194 = OE_Fail;}
137688138024
break;
137689
- case 252: /* cmd ::= DROP TRIGGER ifexists fullname */
138025
+ case 251: /* cmd ::= DROP TRIGGER ifexists fullname */
137690138026
{
137691138027
sqlite3DropTrigger(pParse,yymsp[0].minor.yy185,yymsp[-1].minor.yy194);
137692138028
}
137693138029
break;
137694
- case 253: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
138030
+ case 252: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
137695138031
{
137696138032
sqlite3Attach(pParse, yymsp[-3].minor.yy190.pExpr, yymsp[-1].minor.yy190.pExpr, yymsp[0].minor.yy72);
137697138033
}
137698138034
break;
137699
- case 254: /* cmd ::= DETACH database_kw_opt expr */
138035
+ case 253: /* cmd ::= DETACH database_kw_opt expr */
137700138036
{
137701138037
sqlite3Detach(pParse, yymsp[0].minor.yy190.pExpr);
137702138038
}
137703138039
break;
137704
- case 257: /* cmd ::= REINDEX */
138040
+ case 256: /* cmd ::= REINDEX */
137705138041
{sqlite3Reindex(pParse, 0, 0);}
137706138042
break;
137707
- case 258: /* cmd ::= REINDEX nm dbnm */
138043
+ case 257: /* cmd ::= REINDEX nm dbnm */
137708138044
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
137709138045
break;
137710
- case 259: /* cmd ::= ANALYZE */
138046
+ case 258: /* cmd ::= ANALYZE */
137711138047
{sqlite3Analyze(pParse, 0, 0);}
137712138048
break;
137713
- case 260: /* cmd ::= ANALYZE nm dbnm */
138049
+ case 259: /* cmd ::= ANALYZE nm dbnm */
137714138050
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
137715138051
break;
137716
- case 261: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
138052
+ case 260: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
137717138053
{
137718138054
sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy185,&yymsp[0].minor.yy0);
137719138055
}
137720138056
break;
137721
- case 262: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
138057
+ case 261: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
137722138058
{
137723138059
yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
137724138060
sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
137725138061
}
137726138062
break;
137727
- case 263: /* add_column_fullname ::= fullname */
138063
+ case 262: /* add_column_fullname ::= fullname */
137728138064
{
137729138065
disableLookaside(pParse);
137730138066
sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy185);
137731138067
}
137732138068
break;
137733
- case 264: /* cmd ::= create_vtab */
138069
+ case 263: /* cmd ::= create_vtab */
137734138070
{sqlite3VtabFinishParse(pParse,0);}
137735138071
break;
137736
- case 265: /* cmd ::= create_vtab LP vtabarglist RP */
138072
+ case 264: /* cmd ::= create_vtab LP vtabarglist RP */
137737138073
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
137738138074
break;
137739
- case 266: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
138075
+ case 265: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
137740138076
{
137741138077
sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy194);
137742138078
}
137743138079
break;
137744
- case 267: /* vtabarg ::= */
138080
+ case 266: /* vtabarg ::= */
137745138081
{sqlite3VtabArgInit(pParse);}
137746138082
break;
137747
- case 268: /* vtabargtoken ::= ANY */
137748
- case 269: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==269);
137749
- case 270: /* lp ::= LP */ yytestcase(yyruleno==270);
138083
+ case 267: /* vtabargtoken ::= ANY */
138084
+ case 268: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==268);
138085
+ case 269: /* lp ::= LP */ yytestcase(yyruleno==269);
137750138086
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
137751138087
break;
137752
- case 271: /* with ::= */
138088
+ case 270: /* with ::= */
137753138089
{yymsp[1].minor.yy285 = 0;}
137754138090
break;
137755
- case 272: /* with ::= WITH wqlist */
138091
+ case 271: /* with ::= WITH wqlist */
137756138092
{ yymsp[-1].minor.yy285 = yymsp[0].minor.yy285; }
137757138093
break;
137758
- case 273: /* with ::= WITH RECURSIVE wqlist */
138094
+ case 272: /* with ::= WITH RECURSIVE wqlist */
137759138095
{ yymsp[-2].minor.yy285 = yymsp[0].minor.yy285; }
137760138096
break;
137761
- case 274: /* wqlist ::= nm eidlist_opt AS LP select RP */
138097
+ case 273: /* wqlist ::= nm eidlist_opt AS LP select RP */
137762138098
{
137763138099
yymsp[-5].minor.yy285 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); /*A-overwrites-X*/
137764138100
}
137765138101
break;
137766
- case 275: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
138102
+ case 274: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
137767138103
{
137768138104
yymsp[-7].minor.yy285 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy285, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243);
137769138105
}
137770138106
break;
137771138107
default:
137772
- /* (276) input ::= cmdlist */ yytestcase(yyruleno==276);
137773
- /* (277) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==277);
137774
- /* (278) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=278);
137775
- /* (279) ecmd ::= SEMI */ yytestcase(yyruleno==279);
137776
- /* (280) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==280);
137777
- /* (281) explain ::= */ yytestcase(yyruleno==281);
137778
- /* (282) trans_opt ::= */ yytestcase(yyruleno==282);
137779
- /* (283) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==283);
137780
- /* (284) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==284);
137781
- /* (285) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==285);
137782
- /* (286) savepoint_opt ::= */ yytestcase(yyruleno==286);
137783
- /* (287) cmd ::= create_table create_table_args */ yytestcase(yyruleno==287);
137784
- /* (288) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==288);
137785
- /* (289) columnlist ::= columnname carglist */ yytestcase(yyruleno==289);
137786
- /* (290) nm ::= ID|INDEXED */ yytestcase(yyruleno==290);
137787
- /* (291) nm ::= STRING */ yytestcase(yyruleno==291);
137788
- /* (292) nm ::= JOIN_KW */ yytestcase(yyruleno==292);
137789
- /* (293) typetoken ::= typename */ yytestcase(yyruleno==293);
137790
- /* (294) typename ::= ID|STRING */ yytestcase(yyruleno==294);
137791
- /* (295) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=295);
137792
- /* (296) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=296);
137793
- /* (297) carglist ::= carglist ccons */ yytestcase(yyruleno==297);
137794
- /* (298) carglist ::= */ yytestcase(yyruleno==298);
137795
- /* (299) ccons ::= NULL onconf */ yytestcase(yyruleno==299);
137796
- /* (300) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==300);
137797
- /* (301) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==301);
137798
- /* (302) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=302);
137799
- /* (303) tconscomma ::= */ yytestcase(yyruleno==303);
137800
- /* (304) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=304);
137801
- /* (305) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=305);
137802
- /* (306) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=306);
137803
- /* (307) oneselect ::= values */ yytestcase(yyruleno==307);
137804
- /* (308) sclp ::= selcollist COMMA */ yytestcase(yyruleno==308);
137805
- /* (309) as ::= ID|STRING */ yytestcase(yyruleno==309);
137806
- /* (310) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=310);
138108
+ /* (275) input ::= cmdlist */ yytestcase(yyruleno==275);
138109
+ /* (276) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==276);
138110
+ /* (277) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=277);
138111
+ /* (278) ecmd ::= SEMI */ yytestcase(yyruleno==278);
138112
+ /* (279) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==279);
138113
+ /* (280) explain ::= */ yytestcase(yyruleno==280);
138114
+ /* (281) trans_opt ::= */ yytestcase(yyruleno==281);
138115
+ /* (282) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==282);
138116
+ /* (283) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==283);
138117
+ /* (284) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==284);
138118
+ /* (285) savepoint_opt ::= */ yytestcase(yyruleno==285);
138119
+ /* (286) cmd ::= create_table create_table_args */ yytestcase(yyruleno==286);
138120
+ /* (287) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==287);
138121
+ /* (288) columnlist ::= columnname carglist */ yytestcase(yyruleno==288);
138122
+ /* (289) nm ::= ID|INDEXED */ yytestcase(yyruleno==289);
138123
+ /* (290) nm ::= STRING */ yytestcase(yyruleno==290);
138124
+ /* (291) nm ::= JOIN_KW */ yytestcase(yyruleno==291);
138125
+ /* (292) typetoken ::= typename */ yytestcase(yyruleno==292);
138126
+ /* (293) typename ::= ID|STRING */ yytestcase(yyruleno==293);
138127
+ /* (294) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=294);
138128
+ /* (295) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=295);
138129
+ /* (296) carglist ::= carglist ccons */ yytestcase(yyruleno==296);
138130
+ /* (297) carglist ::= */ yytestcase(yyruleno==297);
138131
+ /* (298) ccons ::= NULL onconf */ yytestcase(yyruleno==298);
138132
+ /* (299) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==299);
138133
+ /* (300) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==300);
138134
+ /* (301) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=301);
138135
+ /* (302) tconscomma ::= */ yytestcase(yyruleno==302);
138136
+ /* (303) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=303);
138137
+ /* (304) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=304);
138138
+ /* (305) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=305);
138139
+ /* (306) oneselect ::= values */ yytestcase(yyruleno==306);
138140
+ /* (307) sclp ::= selcollist COMMA */ yytestcase(yyruleno==307);
138141
+ /* (308) as ::= ID|STRING */ yytestcase(yyruleno==308);
138142
+ /* (309) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=309);
138143
+ /* (310) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==310);
137807138144
/* (311) exprlist ::= nexprlist */ yytestcase(yyruleno==311);
137808138145
/* (312) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=312);
137809138146
/* (313) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=313);
137810138147
/* (314) nmnum ::= ON */ yytestcase(yyruleno==314);
137811138148
/* (315) nmnum ::= DELETE */ yytestcase(yyruleno==315);
@@ -181079,11 +181416,13 @@
181079181416
typedef unsigned short u16;
181080181417
typedef short i16;
181081181418
typedef sqlite3_int64 i64;
181082181419
typedef sqlite3_uint64 u64;
181083181420
181084
-#define ArraySize(x) ((int)(sizeof(x) / sizeof(x[0])))
181421
+#ifndef ArraySize
181422
+# define ArraySize(x) ((int)(sizeof(x) / sizeof(x[0])))
181423
+#endif
181085181424
181086181425
#define testcase(x)
181087181426
#define ALWAYS(x) 1
181088181427
#define NEVER(x) 0
181089181428
@@ -186302,11 +186641,14 @@
186302186641
if( p1->bEof==0 ){
186303186642
if( (p1->iRowid==iLast)
186304186643
|| (bFromValid && fts5RowidCmp(pExpr, p1->iRowid, iFrom)<0)
186305186644
){
186306186645
int rc = fts5ExprNodeNext(pExpr, p1, bFromValid, iFrom);
186307
- if( rc!=SQLITE_OK ) return rc;
186646
+ if( rc!=SQLITE_OK ){
186647
+ pNode->bNomatch = 0;
186648
+ return rc;
186649
+ }
186308186650
}
186309186651
}
186310186652
}
186311186653
186312186654
fts5ExprNodeTest_OR(pExpr, pNode);
@@ -186333,11 +186675,14 @@
186333186675
Fts5ExprNode *pChild = pAnd->apChild[iChild];
186334186676
int cmp = fts5RowidCmp(pExpr, iLast, pChild->iRowid);
186335186677
if( cmp>0 ){
186336186678
/* Advance pChild until it points to iLast or laster */
186337186679
rc = fts5ExprNodeNext(pExpr, pChild, 1, iLast);
186338
- if( rc!=SQLITE_OK ) return rc;
186680
+ if( rc!=SQLITE_OK ){
186681
+ pAnd->bNomatch = 0;
186682
+ return rc;
186683
+ }
186339186684
}
186340186685
186341186686
/* If the child node is now at EOF, so is the parent AND node. Otherwise,
186342186687
** the child node is guaranteed to have advanced at least as far as
186343186688
** rowid iLast. So if it is not at exactly iLast, pChild->iRowid is the
@@ -186372,10 +186717,12 @@
186372186717
i64 iFrom
186373186718
){
186374186719
int rc = fts5ExprNodeNext(pExpr, pNode->apChild[0], bFromValid, iFrom);
186375186720
if( rc==SQLITE_OK ){
186376186721
rc = fts5ExprNodeTest_AND(pExpr, pNode);
186722
+ }else{
186723
+ pNode->bNomatch = 0;
186377186724
}
186378186725
return rc;
186379186726
}
186380186727
186381186728
static int fts5ExprNodeTest_NOT(
@@ -186414,10 +186761,13 @@
186414186761
){
186415186762
int rc = fts5ExprNodeNext(pExpr, pNode->apChild[0], bFromValid, iFrom);
186416186763
if( rc==SQLITE_OK ){
186417186764
rc = fts5ExprNodeTest_NOT(pExpr, pNode);
186418186765
}
186766
+ if( rc!=SQLITE_OK ){
186767
+ pNode->bNomatch = 0;
186768
+ }
186419186769
return rc;
186420186770
}
186421186771
186422186772
/*
186423186773
** If pNode currently points to a match, this function returns SQLITE_OK
@@ -197534,11 +197884,11 @@
197534197884
int nArg, /* Number of args */
197535197885
sqlite3_value **apUnused /* Function arguments */
197536197886
){
197537197887
assert( nArg==0 );
197538197888
UNUSED_PARAM2(nArg, apUnused);
197539
- sqlite3_result_text(pCtx, "fts5: 2017-02-13 16:02:40 ada05cfa86ad7f5645450ac7a2a21c9aa6e57d2c", -1, SQLITE_TRANSIENT);
197889
+ sqlite3_result_text(pCtx, "fts5: 2017-02-20 13:11:07 ff213f2ef5bf96754a2264685d25546d8b5ccf0a", -1, SQLITE_TRANSIENT);
197540197890
}
197541197891
197542197892
static int fts5Init(sqlite3 *db){
197543197893
static const sqlite3_module fts5Mod = {
197544197894
/* iVersion */ 2,
197545197895
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.17.0. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -396,13 +396,13 @@
396 **
397 ** See also: [sqlite3_libversion()],
398 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
399 ** [sqlite_version()] and [sqlite_source_id()].
400 */
401 #define SQLITE_VERSION "3.17.0"
402 #define SQLITE_VERSION_NUMBER 3017000
403 #define SQLITE_SOURCE_ID "2017-02-13 16:02:40 ada05cfa86ad7f5645450ac7a2a21c9aa6e57d2c"
404
405 /*
406 ** CAPI3REF: Run-Time Library Version Numbers
407 ** KEYWORDS: sqlite3_version sqlite3_sourceid
408 **
@@ -12457,10 +12457,11 @@
12457 SQLITE_PRIVATE const void *sqlite3BtreePayloadFetch(BtCursor*, u32 *pAmt);
12458 SQLITE_PRIVATE u32 sqlite3BtreePayloadSize(BtCursor*);
12459
12460 SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*);
12461 SQLITE_PRIVATE struct Pager *sqlite3BtreePager(Btree*);
 
12462
12463 #ifndef SQLITE_OMIT_INCRBLOB
12464 SQLITE_PRIVATE int sqlite3BtreePayloadChecked(BtCursor*, u32 offset, u32 amt, void*);
12465 SQLITE_PRIVATE int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*);
12466 SQLITE_PRIVATE void sqlite3BtreeIncrblobCursor(BtCursor *);
@@ -12757,117 +12758,119 @@
12757 #define OP_Divide 50 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
12758 #define OP_Remainder 51 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
12759 #define OP_Concat 52 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
12760 #define OP_Last 53
12761 #define OP_BitNot 54 /* same as TK_BITNOT, synopsis: r[P1]= ~r[P1] */
12762 #define OP_SorterSort 55
12763 #define OP_Sort 56
12764 #define OP_Rewind 57
12765 #define OP_IdxLE 58 /* synopsis: key=r[P3@P4] */
12766 #define OP_IdxGT 59 /* synopsis: key=r[P3@P4] */
12767 #define OP_IdxLT 60 /* synopsis: key=r[P3@P4] */
12768 #define OP_IdxGE 61 /* synopsis: key=r[P3@P4] */
12769 #define OP_RowSetRead 62 /* synopsis: r[P3]=rowset(P1) */
12770 #define OP_RowSetTest 63 /* synopsis: if r[P3] in rowset(P1) goto P2 */
12771 #define OP_Program 64
12772 #define OP_FkIfZero 65 /* synopsis: if fkctr[P1]==0 goto P2 */
12773 #define OP_IfPos 66 /* synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
12774 #define OP_IfNotZero 67 /* synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
12775 #define OP_DecrJumpZero 68 /* synopsis: if (--r[P1])==0 goto P2 */
12776 #define OP_IncrVacuum 69
12777 #define OP_VNext 70
12778 #define OP_Init 71 /* synopsis: Start at P2 */
12779 #define OP_Return 72
12780 #define OP_EndCoroutine 73
12781 #define OP_HaltIfNull 74 /* synopsis: if r[P3]=null halt */
12782 #define OP_Halt 75
12783 #define OP_Integer 76 /* synopsis: r[P2]=P1 */
12784 #define OP_Int64 77 /* synopsis: r[P2]=P4 */
12785 #define OP_String 78 /* synopsis: r[P2]='P4' (len=P1) */
12786 #define OP_Null 79 /* synopsis: r[P2..P3]=NULL */
12787 #define OP_SoftNull 80 /* synopsis: r[P1]=NULL */
12788 #define OP_Blob 81 /* synopsis: r[P2]=P4 (len=P1) */
12789 #define OP_Variable 82 /* synopsis: r[P2]=parameter(P1,P4) */
12790 #define OP_Move 83 /* synopsis: r[P2@P3]=r[P1@P3] */
12791 #define OP_Copy 84 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
12792 #define OP_SCopy 85 /* synopsis: r[P2]=r[P1] */
12793 #define OP_IntCopy 86 /* synopsis: r[P2]=r[P1] */
12794 #define OP_ResultRow 87 /* synopsis: output=r[P1@P2] */
12795 #define OP_CollSeq 88
12796 #define OP_Function0 89 /* synopsis: r[P3]=func(r[P2@P5]) */
12797 #define OP_Function 90 /* synopsis: r[P3]=func(r[P2@P5]) */
12798 #define OP_AddImm 91 /* synopsis: r[P1]=r[P1]+P2 */
12799 #define OP_RealAffinity 92
12800 #define OP_Cast 93 /* synopsis: affinity(r[P1]) */
12801 #define OP_Permutation 94
12802 #define OP_Compare 95 /* synopsis: r[P1@P3] <-> r[P2@P3] */
12803 #define OP_Column 96 /* synopsis: r[P3]=PX */
12804 #define OP_String8 97 /* same as TK_STRING, synopsis: r[P2]='P4' */
12805 #define OP_Affinity 98 /* synopsis: affinity(r[P1@P2]) */
12806 #define OP_MakeRecord 99 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
12807 #define OP_Count 100 /* synopsis: r[P2]=count() */
12808 #define OP_ReadCookie 101
12809 #define OP_SetCookie 102
12810 #define OP_ReopenIdx 103 /* synopsis: root=P2 iDb=P3 */
12811 #define OP_OpenRead 104 /* synopsis: root=P2 iDb=P3 */
12812 #define OP_OpenWrite 105 /* synopsis: root=P2 iDb=P3 */
12813 #define OP_OpenAutoindex 106 /* synopsis: nColumn=P2 */
12814 #define OP_OpenEphemeral 107 /* synopsis: nColumn=P2 */
12815 #define OP_SorterOpen 108
12816 #define OP_SequenceTest 109 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
12817 #define OP_OpenPseudo 110 /* synopsis: P3 columns in r[P2] */
12818 #define OP_Close 111
12819 #define OP_ColumnsUsed 112
12820 #define OP_Sequence 113 /* synopsis: r[P2]=cursor[P1].ctr++ */
12821 #define OP_NewRowid 114 /* synopsis: r[P2]=rowid */
12822 #define OP_Insert 115 /* synopsis: intkey=r[P3] data=r[P2] */
12823 #define OP_InsertInt 116 /* synopsis: intkey=P3 data=r[P2] */
12824 #define OP_Delete 117
12825 #define OP_ResetCount 118
12826 #define OP_SorterCompare 119 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
12827 #define OP_SorterData 120 /* synopsis: r[P2]=data */
12828 #define OP_RowData 121 /* synopsis: r[P2]=data */
12829 #define OP_Rowid 122 /* synopsis: r[P2]=rowid */
12830 #define OP_NullRow 123
12831 #define OP_SorterInsert 124 /* synopsis: key=r[P2] */
12832 #define OP_IdxInsert 125 /* synopsis: key=r[P2] */
12833 #define OP_IdxDelete 126 /* synopsis: key=r[P2@P3] */
12834 #define OP_Seek 127 /* synopsis: Move P3 to P1.rowid */
12835 #define OP_IdxRowid 128 /* synopsis: r[P2]=rowid */
12836 #define OP_Destroy 129
12837 #define OP_Clear 130
12838 #define OP_ResetSorter 131
12839 #define OP_Real 132 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
12840 #define OP_CreateIndex 133 /* synopsis: r[P2]=root iDb=P1 */
12841 #define OP_CreateTable 134 /* synopsis: r[P2]=root iDb=P1 */
12842 #define OP_ParseSchema 135
12843 #define OP_LoadAnalysis 136
12844 #define OP_DropTable 137
12845 #define OP_DropIndex 138
12846 #define OP_DropTrigger 139
12847 #define OP_IntegrityCk 140
12848 #define OP_RowSetAdd 141 /* synopsis: rowset(P1)=r[P2] */
12849 #define OP_Param 142
12850 #define OP_FkCounter 143 /* synopsis: fkctr[P1]+=P2 */
12851 #define OP_MemMax 144 /* synopsis: r[P1]=max(r[P1],r[P2]) */
12852 #define OP_OffsetLimit 145 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
12853 #define OP_AggStep0 146 /* synopsis: accum=r[P3] step(r[P2@P5]) */
12854 #define OP_AggStep 147 /* synopsis: accum=r[P3] step(r[P2@P5]) */
12855 #define OP_AggFinal 148 /* synopsis: accum=r[P1] N=P2 */
12856 #define OP_Expire 149
12857 #define OP_TableLock 150 /* synopsis: iDb=P1 root=P2 write=P3 */
12858 #define OP_VBegin 151
12859 #define OP_VCreate 152
12860 #define OP_VDestroy 153
12861 #define OP_VOpen 154
12862 #define OP_VColumn 155 /* synopsis: r[P3]=vcolumn(P2) */
12863 #define OP_VRename 156
12864 #define OP_Pagecount 157
12865 #define OP_MaxPgcnt 158
12866 #define OP_CursorHint 159
12867 #define OP_Noop 160
12868 #define OP_Explain 161
 
 
12869
12870 /* Properties such as "out2" or "jump" that are specified in
12871 ** comments following the "case" for each opcode in the vdbe.c
12872 ** are encoded into bitvectors as follows:
12873 */
@@ -12883,32 +12886,32 @@
12883 /* 16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0x03, 0x03, 0x09,\
12884 /* 24 */ 0x09, 0x09, 0x09, 0x26, 0x26, 0x09, 0x09, 0x09,\
12885 /* 32 */ 0x09, 0x09, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\
12886 /* 40 */ 0x0b, 0x0b, 0x01, 0x26, 0x26, 0x26, 0x26, 0x26,\
12887 /* 48 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x01, 0x12, 0x01,\
12888 /* 56 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x23, 0x0b,\
12889 /* 64 */ 0x01, 0x01, 0x03, 0x03, 0x03, 0x01, 0x01, 0x01,\
12890 /* 72 */ 0x02, 0x02, 0x08, 0x00, 0x10, 0x10, 0x10, 0x10,\
12891 /* 80 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00,\
12892 /* 88 */ 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00,\
12893 /* 96 */ 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
12894 /* 104 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
12895 /* 112 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
12896 /* 120 */ 0x00, 0x00, 0x10, 0x00, 0x04, 0x04, 0x00, 0x00,\
12897 /* 128 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00,\
12898 /* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00,\
12899 /* 144 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
12900 /* 152 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\
12901 /* 160 */ 0x00, 0x00,}
12902
12903 /* The sqlite3P2Values() routine is able to run faster if it knows
12904 ** the value of the largest JUMP opcode. The smaller the maximum
12905 ** JUMP opcode the better, so the mkopcodeh.tcl script that
12906 ** generated this include file strives to group all JUMP opcodes
12907 ** together near the beginning of the list.
12908 */
12909 #define SQLITE_MX_JUMP_OPCODE 71 /* Maximum JUMP opcode */
12910
12911 /************** End of opcodes.h *********************************************/
12912 /************** Continuing where we left off in vdbe.h ***********************/
12913
12914 /*
@@ -14074,10 +14077,11 @@
14074 u8 suppressErr; /* Do not issue error messages if true */
14075 u8 vtabOnConflict; /* Value to return for s3_vtab_on_conflict() */
14076 u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */
14077 u8 mTrace; /* zero or more SQLITE_TRACE flags */
14078 u8 skipBtreeMutex; /* True if no shared-cache backends */
 
14079 int nextPagesize; /* Pagesize after VACUUM if >0 */
14080 u32 magic; /* Magic number for detect library misuse */
14081 int nChange; /* Value returned by sqlite3_changes() */
14082 int nTotalChange; /* Value returned by sqlite3_total_changes() */
14083 int aLimit[SQLITE_N_LIMIT]; /* Limits */
@@ -14589,18 +14593,18 @@
14589 char *zColAff; /* String defining the affinity of each column */
14590 ExprList *pCheck; /* All CHECK constraints */
14591 /* ... also used as column name list in a VIEW */
14592 int tnum; /* Root BTree page for this table */
14593 u32 nTabRef; /* Number of pointers to this Table */
 
14594 i16 iPKey; /* If not negative, use aCol[iPKey] as the rowid */
14595 i16 nCol; /* Number of columns in this table */
14596 LogEst nRowLogEst; /* Estimated rows in table - from sqlite_stat1 table */
14597 LogEst szTabRow; /* Estimated size of each table row in bytes */
14598 #ifdef SQLITE_ENABLE_COSTMULT
14599 LogEst costMult; /* Cost multiplier for using this table */
14600 #endif
14601 u8 tabFlags; /* Mask of TF_* values */
14602 u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */
14603 #ifndef SQLITE_OMIT_ALTERTABLE
14604 int addColOffset; /* Offset in CREATE TABLE stmt to add a new column */
14605 #endif
14606 #ifndef SQLITE_OMIT_VIRTUALTABLE
@@ -14620,27 +14624,29 @@
14620 ** followed by non-hidden columns. Example: "CREATE VIRTUAL TABLE x USING
14621 ** vtab1(a HIDDEN, b);". Since "b" is a non-hidden column but "a" is hidden,
14622 ** the TF_OOOHidden attribute would apply in this case. Such tables require
14623 ** special handling during INSERT processing.
14624 */
14625 #define TF_Readonly 0x01 /* Read-only system table */
14626 #define TF_Ephemeral 0x02 /* An ephemeral table */
14627 #define TF_HasPrimaryKey 0x04 /* Table has a primary key */
14628 #define TF_Autoincrement 0x08 /* Integer primary key is autoincrement */
14629 #define TF_Virtual 0x10 /* Is a virtual table */
14630 #define TF_WithoutRowid 0x20 /* No rowid. PRIMARY KEY is the key */
14631 #define TF_NoVisibleRowid 0x40 /* No user-visible "rowid" column */
14632 #define TF_OOOHidden 0x80 /* Out-of-Order hidden columns */
14633
 
 
14634
14635 /*
14636 ** Test to see whether or not a table is a virtual table. This is
14637 ** done as a macro so that it will be optimized out when virtual
14638 ** table support is omitted from the build.
14639 */
14640 #ifndef SQLITE_OMIT_VIRTUALTABLE
14641 # define IsVirtual(X) (((X)->tabFlags & TF_Virtual)!=0)
14642 #else
14643 # define IsVirtual(X) 0
14644 #endif
14645
14646 /*
@@ -14871,10 +14877,11 @@
14871 unsigned bUnordered:1; /* Use this index for == or IN queries only */
14872 unsigned uniqNotNull:1; /* True if UNIQUE and NOT NULL for all columns */
14873 unsigned isResized:1; /* True if resizeIndexObject() has been called */
14874 unsigned isCovering:1; /* True if this is a covering index */
14875 unsigned noSkipScan:1; /* Do not try to use skip-scan if true */
 
14876 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
14877 int nSample; /* Number of elements in aSample[] */
14878 int nSampleCol; /* Size of IndexSample.anEq[] and so on */
14879 tRowcnt *aAvgEq; /* Average nEq values for keys not in aSample */
14880 IndexSample *aSample; /* Samples of the left-most key */
@@ -15181,11 +15188,11 @@
15181 ** form is used for name resolution with nested FROM clauses.
15182 */
15183 struct ExprList {
15184 int nExpr; /* Number of expressions on the list */
15185 struct ExprList_item { /* For each expression in the list */
15186 Expr *pExpr; /* The list of expressions */
15187 char *zName; /* Token associated with this expression */
15188 char *zSpan; /* Original text of the expression */
15189 u8 sortOrder; /* 1 for DESC or 0 for ASC */
15190 unsigned done :1; /* A flag to indicate when processing is finished */
15191 unsigned bSpanIsTab :1; /* zSpan holds DB.TABLE.COLUMN */
@@ -16504,10 +16511,11 @@
16504 SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*);
16505 SQLITE_PRIVATE void sqlite3Vacuum(Parse*,Token*);
16506 SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*, int);
16507 SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3*, Token*);
16508 SQLITE_PRIVATE int sqlite3ExprCompare(Expr*, Expr*, int);
 
16509 SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList*, ExprList*, int);
16510 SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Expr*, Expr*, int);
16511 SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);
16512 SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*);
16513 SQLITE_PRIVATE int sqlite3ExprCoveredByIndex(Expr*, int iCur, Index *pIdx);
@@ -17450,11 +17458,11 @@
17450 "COMPILER=gcc-" __VERSION__,
17451 #endif
17452 #if SQLITE_COVERAGE_TEST
17453 "COVERAGE_TEST",
17454 #endif
17455 #if SQLITE_DEBUG
17456 "DEBUG",
17457 #endif
17458 #if SQLITE_DEFAULT_LOCKING_MODE
17459 "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),
17460 #endif
@@ -24050,12 +24058,12 @@
24050 #ifdef SQLITE_DEBUG
24051 assert( p->nRef>0 || p->owner==0 );
24052 p->owner = tid;
24053 p->nRef++;
24054 if( p->trace ){
24055 OSTRACE(("ENTER-MUTEX tid=%lu, mutex=%p (%d), nRef=%d\n",
24056 tid, p, p->trace, p->nRef));
24057 }
24058 #endif
24059 }
24060
24061 static int winMutexTry(sqlite3_mutex *p){
@@ -24093,12 +24101,12 @@
24093 #else
24094 UNUSED_PARAMETER(p);
24095 #endif
24096 #ifdef SQLITE_DEBUG
24097 if( p->trace ){
24098 OSTRACE(("TRY-MUTEX tid=%lu, mutex=%p (%d), owner=%lu, nRef=%d, rc=%s\n",
24099 tid, p, p->trace, p->owner, p->nRef, sqlite3ErrName(rc)));
24100 }
24101 #endif
24102 return rc;
24103 }
24104
@@ -24122,12 +24130,12 @@
24122 #endif
24123 assert( winMutex_isInit==1 );
24124 LeaveCriticalSection(&p->mutex);
24125 #ifdef SQLITE_DEBUG
24126 if( p->trace ){
24127 OSTRACE(("LEAVE-MUTEX tid=%lu, mutex=%p (%d), nRef=%d\n",
24128 tid, p, p->trace, p->nRef));
24129 }
24130 #endif
24131 }
24132
24133 SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){
@@ -24572,11 +24580,11 @@
24572 return sqlite3GlobalConfig.m.xSize(p);
24573 }
24574 SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3 *db, void *p){
24575 assert( p!=0 );
24576 if( db==0 || !isLookaside(db,p) ){
24577 #if SQLITE_DEBUG
24578 if( db==0 ){
24579 assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );
24580 assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
24581 }else{
24582 assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
@@ -24633,11 +24641,11 @@
24633 measureAllocationSize(db, p);
24634 return;
24635 }
24636 if( isLookaside(db, p) ){
24637 LookasideSlot *pBuf = (LookasideSlot*)p;
24638 #if SQLITE_DEBUG
24639 /* Trash all content in the buffer being freed */
24640 memset(p, 0xaa, db->lookaside.sz);
24641 #endif
24642 pBuf->pNext = db->lookaside.pFree;
24643 db->lookaside.pFree = pBuf;
@@ -25002,11 +25010,11 @@
25002
25003 /*
25004 ** Conversion types fall into various categories as defined by the
25005 ** following enumeration.
25006 */
25007 #define etRADIX 0 /* Integer types. %d, %x, %o, and so forth */
25008 #define etFLOAT 1 /* Floating point. %f */
25009 #define etEXP 2 /* Exponentional notation. %e and %E */
25010 #define etGENERIC 3 /* Floating or exponential, depending on exponent. %g */
25011 #define etSIZE 4 /* Return number of characters processed so far. %n */
25012 #define etSTRING 5 /* Strings. %s */
@@ -25020,12 +25028,13 @@
25020 #define etTOKEN 11 /* a pointer to a Token structure */
25021 #define etSRCLIST 12 /* a pointer to a SrcList */
25022 #define etPOINTER 13 /* The %p conversion */
25023 #define etSQLESCAPE3 14 /* %w -> Strings with '\"' doubled */
25024 #define etORDINAL 15 /* %r -> 1st, 2nd, 3rd, 4th, etc. English only */
 
25025
25026 #define etINVALID 16 /* Any unrecognized conversion type */
25027
25028
25029 /*
25030 ** An "etByte" is an 8-bit unsigned value.
25031 */
@@ -25045,40 +25054,40 @@
25045 } et_info;
25046
25047 /*
25048 ** Allowed values for et_info.flags
25049 */
25050 #define FLAG_SIGNED 1 /* True if the value to convert is signed */
25051 #define FLAG_STRING 4 /* Allow infinity precision */
25052
25053
25054 /*
25055 ** The following table is searched linearly, so it is good to put the
25056 ** most frequently used conversion types first.
25057 */
25058 static const char aDigits[] = "0123456789ABCDEF0123456789abcdef";
25059 static const char aPrefix[] = "-x0\000X0";
25060 static const et_info fmtinfo[] = {
25061 { 'd', 10, 1, etRADIX, 0, 0 },
25062 { 's', 0, 4, etSTRING, 0, 0 },
25063 { 'g', 0, 1, etGENERIC, 30, 0 },
25064 { 'z', 0, 4, etDYNSTRING, 0, 0 },
25065 { 'q', 0, 4, etSQLESCAPE, 0, 0 },
25066 { 'Q', 0, 4, etSQLESCAPE2, 0, 0 },
25067 { 'w', 0, 4, etSQLESCAPE3, 0, 0 },
25068 { 'c', 0, 0, etCHARX, 0, 0 },
25069 { 'o', 8, 0, etRADIX, 0, 2 },
25070 { 'u', 10, 0, etRADIX, 0, 0 },
25071 { 'x', 16, 0, etRADIX, 16, 1 },
25072 { 'X', 16, 0, etRADIX, 0, 4 },
25073 #ifndef SQLITE_OMIT_FLOATING_POINT
25074 { 'f', 0, 1, etFLOAT, 0, 0 },
25075 { 'e', 0, 1, etEXP, 30, 0 },
25076 { 'E', 0, 1, etEXP, 14, 0 },
25077 { 'G', 0, 1, etGENERIC, 14, 0 },
25078 #endif
25079 { 'i', 10, 1, etRADIX, 0, 0 },
25080 { 'n', 0, 0, etSIZE, 0, 0 },
25081 { '%', 0, 0, etPERCENT, 0, 0 },
25082 { 'p', 16, 0, etPOINTER, 0, 1 },
25083
25084 /* All the rest are undocumented and are for internal use only */
@@ -25166,18 +25175,17 @@
25166 int precision; /* Precision of the current field */
25167 int length; /* Length of the field */
25168 int idx; /* A general purpose loop counter */
25169 int width; /* Width of the current field */
25170 etByte flag_leftjustify; /* True if "-" flag is present */
25171 etByte flag_plussign; /* True if "+" flag is present */
25172 etByte flag_blanksign; /* True if " " flag is present */
25173 etByte flag_alternateform; /* True if "#" flag is present */
25174 etByte flag_altform2; /* True if "!" flag is present */
25175 etByte flag_zeropad; /* True if field width constant starts with zero */
25176 etByte flag_long; /* True if "l" flag is present */
25177 etByte flag_longlong; /* True if the "ll" flag is present */
25178 etByte done; /* Loop termination flag */
 
25179 etByte xtype = etINVALID; /* Conversion paradigm */
25180 u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */
25181 char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
25182 sqlite_uint64 longvalue; /* Value for integer types */
25183 LONGDOUBLE_TYPE realvalue; /* Value for real types */
@@ -25216,21 +25224,22 @@
25216 if( (c=(*++fmt))==0 ){
25217 sqlite3StrAccumAppend(pAccum, "%", 1);
25218 break;
25219 }
25220 /* Find out what flags are present */
25221 flag_leftjustify = flag_plussign = flag_blanksign =
25222 flag_alternateform = flag_altform2 = flag_zeropad = 0;
25223 done = 0;
25224 do{
25225 switch( c ){
25226 case '-': flag_leftjustify = 1; break;
25227 case '+': flag_plussign = 1; break;
25228 case ' ': flag_blanksign = 1; break;
25229 case '#': flag_alternateform = 1; break;
25230 case '!': flag_altform2 = 1; break;
25231 case '0': flag_zeropad = 1; break;
 
25232 default: done = 1; break;
25233 }
25234 }while( !done && (c=(*++fmt))!=0 );
25235 /* Get the field width */
25236 if( c=='*' ){
@@ -25296,17 +25305,15 @@
25296 /* Get the conversion type modifier */
25297 if( c=='l' ){
25298 flag_long = 1;
25299 c = *++fmt;
25300 if( c=='l' ){
25301 flag_longlong = 1;
25302 c = *++fmt;
25303 }else{
25304 flag_longlong = 0;
25305 }
25306 }else{
25307 flag_long = flag_longlong = 0;
25308 }
25309 /* Fetch the info entry for the field */
25310 infop = &fmtinfo[0];
25311 xtype = etINVALID;
25312 for(idx=0; idx<ArraySize(fmtinfo); idx++){
@@ -25320,41 +25327,42 @@
25320 /*
25321 ** At this point, variables are initialized as follows:
25322 **
25323 ** flag_alternateform TRUE if a '#' is present.
25324 ** flag_altform2 TRUE if a '!' is present.
25325 ** flag_plussign TRUE if a '+' is present.
25326 ** flag_leftjustify TRUE if a '-' is present or if the
25327 ** field width was negative.
25328 ** flag_zeropad TRUE if the width began with 0.
25329 ** flag_long TRUE if the letter 'l' (ell) prefixed
25330 ** the conversion character.
25331 ** flag_longlong TRUE if the letter 'll' (ell ell) prefixed
25332 ** the conversion character.
25333 ** flag_blanksign TRUE if a ' ' is present.
25334 ** width The specified field width. This is
25335 ** always non-negative. Zero is the default.
25336 ** precision The specified precision. The default
25337 ** is -1.
25338 ** xtype The class of the conversion.
25339 ** infop Pointer to the appropriate info struct.
25340 */
25341 switch( xtype ){
25342 case etPOINTER:
25343 flag_longlong = sizeof(char*)==sizeof(i64);
25344 flag_long = sizeof(char*)==sizeof(long int);
25345 /* Fall through into the next case */
25346 case etORDINAL:
25347 case etRADIX:
 
 
 
25348 if( infop->flags & FLAG_SIGNED ){
25349 i64 v;
25350 if( bArgList ){
25351 v = getIntArg(pArgList);
25352 }else if( flag_longlong ){
25353 v = va_arg(ap,i64);
25354 }else if( flag_long ){
25355 v = va_arg(ap,long int);
 
 
 
 
25356 }else{
25357 v = va_arg(ap,int);
25358 }
25359 if( v<0 ){
25360 if( v==SMALLEST_INT64 ){
@@ -25363,35 +25371,35 @@
25363 longvalue = -v;
25364 }
25365 prefix = '-';
25366 }else{
25367 longvalue = v;
25368 if( flag_plussign ) prefix = '+';
25369 else if( flag_blanksign ) prefix = ' ';
25370 else prefix = 0;
25371 }
25372 }else{
25373 if( bArgList ){
25374 longvalue = (u64)getIntArg(pArgList);
25375 }else if( flag_longlong ){
25376 longvalue = va_arg(ap,u64);
25377 }else if( flag_long ){
25378 longvalue = va_arg(ap,unsigned long int);
 
 
 
 
25379 }else{
25380 longvalue = va_arg(ap,unsigned int);
25381 }
25382 prefix = 0;
25383 }
25384 if( longvalue==0 ) flag_alternateform = 0;
25385 if( flag_zeropad && precision<width-(prefix!=0) ){
25386 precision = width-(prefix!=0);
25387 }
25388 if( precision<etBUFSIZE-10 ){
25389 nOut = etBUFSIZE;
25390 zOut = buf;
25391 }else{
25392 nOut = precision + 10;
25393 zOut = zExtra = sqlite3Malloc( nOut );
25394 if( zOut==0 ){
25395 setStrAccumError(pAccum, STRACCUM_NOMEM);
25396 return;
25397 }
@@ -25413,12 +25421,27 @@
25413 *(--bufpt) = cset[longvalue%base];
25414 longvalue = longvalue/base;
25415 }while( longvalue>0 );
25416 }
25417 length = (int)(&zOut[nOut-1]-bufpt);
25418 for(idx=precision-length; idx>0; idx--){
25419 *(--bufpt) = '0'; /* Zero pad */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25420 }
25421 if( prefix ) *(--bufpt) = prefix; /* Add sign */
25422 if( flag_alternateform && infop->prefix ){ /* Add "0" or "0x" */
25423 const char *pre;
25424 char x;
@@ -25441,13 +25464,11 @@
25441 if( precision<0 ) precision = 6; /* Set default precision */
25442 if( realvalue<0.0 ){
25443 realvalue = -realvalue;
25444 prefix = '-';
25445 }else{
25446 if( flag_plussign ) prefix = '+';
25447 else if( flag_blanksign ) prefix = ' ';
25448 else prefix = 0;
25449 }
25450 if( xtype==etGENERIC && precision>0 ) precision--;
25451 testcase( precision>0xfff );
25452 for(idx=precision&0xfff, rounder=0.5; idx>0; idx--, rounder*=0.1){}
25453 if( xtype==etFLOAT ) realvalue += rounder;
@@ -29464,117 +29485,119 @@
29464 /* 50 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
29465 /* 51 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
29466 /* 52 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
29467 /* 53 */ "Last" OpHelp(""),
29468 /* 54 */ "BitNot" OpHelp("r[P1]= ~r[P1]"),
29469 /* 55 */ "SorterSort" OpHelp(""),
29470 /* 56 */ "Sort" OpHelp(""),
29471 /* 57 */ "Rewind" OpHelp(""),
29472 /* 58 */ "IdxLE" OpHelp("key=r[P3@P4]"),
29473 /* 59 */ "IdxGT" OpHelp("key=r[P3@P4]"),
29474 /* 60 */ "IdxLT" OpHelp("key=r[P3@P4]"),
29475 /* 61 */ "IdxGE" OpHelp("key=r[P3@P4]"),
29476 /* 62 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"),
29477 /* 63 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"),
29478 /* 64 */ "Program" OpHelp(""),
29479 /* 65 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
29480 /* 66 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"),
29481 /* 67 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
29482 /* 68 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
29483 /* 69 */ "IncrVacuum" OpHelp(""),
29484 /* 70 */ "VNext" OpHelp(""),
29485 /* 71 */ "Init" OpHelp("Start at P2"),
29486 /* 72 */ "Return" OpHelp(""),
29487 /* 73 */ "EndCoroutine" OpHelp(""),
29488 /* 74 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
29489 /* 75 */ "Halt" OpHelp(""),
29490 /* 76 */ "Integer" OpHelp("r[P2]=P1"),
29491 /* 77 */ "Int64" OpHelp("r[P2]=P4"),
29492 /* 78 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
29493 /* 79 */ "Null" OpHelp("r[P2..P3]=NULL"),
29494 /* 80 */ "SoftNull" OpHelp("r[P1]=NULL"),
29495 /* 81 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
29496 /* 82 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
29497 /* 83 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
29498 /* 84 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
29499 /* 85 */ "SCopy" OpHelp("r[P2]=r[P1]"),
29500 /* 86 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
29501 /* 87 */ "ResultRow" OpHelp("output=r[P1@P2]"),
29502 /* 88 */ "CollSeq" OpHelp(""),
29503 /* 89 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"),
29504 /* 90 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"),
29505 /* 91 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
29506 /* 92 */ "RealAffinity" OpHelp(""),
29507 /* 93 */ "Cast" OpHelp("affinity(r[P1])"),
29508 /* 94 */ "Permutation" OpHelp(""),
29509 /* 95 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
29510 /* 96 */ "Column" OpHelp("r[P3]=PX"),
29511 /* 97 */ "String8" OpHelp("r[P2]='P4'"),
29512 /* 98 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
29513 /* 99 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
29514 /* 100 */ "Count" OpHelp("r[P2]=count()"),
29515 /* 101 */ "ReadCookie" OpHelp(""),
29516 /* 102 */ "SetCookie" OpHelp(""),
29517 /* 103 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
29518 /* 104 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
29519 /* 105 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
29520 /* 106 */ "OpenAutoindex" OpHelp("nColumn=P2"),
29521 /* 107 */ "OpenEphemeral" OpHelp("nColumn=P2"),
29522 /* 108 */ "SorterOpen" OpHelp(""),
29523 /* 109 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
29524 /* 110 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
29525 /* 111 */ "Close" OpHelp(""),
29526 /* 112 */ "ColumnsUsed" OpHelp(""),
29527 /* 113 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
29528 /* 114 */ "NewRowid" OpHelp("r[P2]=rowid"),
29529 /* 115 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
29530 /* 116 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"),
29531 /* 117 */ "Delete" OpHelp(""),
29532 /* 118 */ "ResetCount" OpHelp(""),
29533 /* 119 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
29534 /* 120 */ "SorterData" OpHelp("r[P2]=data"),
29535 /* 121 */ "RowData" OpHelp("r[P2]=data"),
29536 /* 122 */ "Rowid" OpHelp("r[P2]=rowid"),
29537 /* 123 */ "NullRow" OpHelp(""),
29538 /* 124 */ "SorterInsert" OpHelp("key=r[P2]"),
29539 /* 125 */ "IdxInsert" OpHelp("key=r[P2]"),
29540 /* 126 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
29541 /* 127 */ "Seek" OpHelp("Move P3 to P1.rowid"),
29542 /* 128 */ "IdxRowid" OpHelp("r[P2]=rowid"),
29543 /* 129 */ "Destroy" OpHelp(""),
29544 /* 130 */ "Clear" OpHelp(""),
29545 /* 131 */ "ResetSorter" OpHelp(""),
29546 /* 132 */ "Real" OpHelp("r[P2]=P4"),
29547 /* 133 */ "CreateIndex" OpHelp("r[P2]=root iDb=P1"),
29548 /* 134 */ "CreateTable" OpHelp("r[P2]=root iDb=P1"),
29549 /* 135 */ "ParseSchema" OpHelp(""),
29550 /* 136 */ "LoadAnalysis" OpHelp(""),
29551 /* 137 */ "DropTable" OpHelp(""),
29552 /* 138 */ "DropIndex" OpHelp(""),
29553 /* 139 */ "DropTrigger" OpHelp(""),
29554 /* 140 */ "IntegrityCk" OpHelp(""),
29555 /* 141 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
29556 /* 142 */ "Param" OpHelp(""),
29557 /* 143 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
29558 /* 144 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
29559 /* 145 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
29560 /* 146 */ "AggStep0" OpHelp("accum=r[P3] step(r[P2@P5])"),
29561 /* 147 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
29562 /* 148 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
29563 /* 149 */ "Expire" OpHelp(""),
29564 /* 150 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
29565 /* 151 */ "VBegin" OpHelp(""),
29566 /* 152 */ "VCreate" OpHelp(""),
29567 /* 153 */ "VDestroy" OpHelp(""),
29568 /* 154 */ "VOpen" OpHelp(""),
29569 /* 155 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
29570 /* 156 */ "VRename" OpHelp(""),
29571 /* 157 */ "Pagecount" OpHelp(""),
29572 /* 158 */ "MaxPgcnt" OpHelp(""),
29573 /* 159 */ "CursorHint" OpHelp(""),
29574 /* 160 */ "Noop" OpHelp(""),
29575 /* 161 */ "Explain" OpHelp(""),
 
 
29576 };
29577 return azName[i];
29578 }
29579 #endif
29580
@@ -37952,46 +37975,84 @@
37952 * be freed immediately and any attempt to access any of that freed
37953 * data will almost certainly result in an immediate access violation.
37954 ******************************************************************************
37955 */
37956 #ifndef SQLITE_WIN32_HEAP_CREATE
37957 # define SQLITE_WIN32_HEAP_CREATE (TRUE)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37958 #endif
37959
37960 /*
37961 * This is cache size used in the calculation of the initial size of the
37962 * Win32-specific heap. It cannot be negative.
37963 */
37964 #ifndef SQLITE_WIN32_CACHE_SIZE
37965 # if SQLITE_DEFAULT_CACHE_SIZE>=0
37966 # define SQLITE_WIN32_CACHE_SIZE (SQLITE_DEFAULT_CACHE_SIZE)
37967 # else
37968 # define SQLITE_WIN32_CACHE_SIZE (-(SQLITE_DEFAULT_CACHE_SIZE))
37969 # endif
37970 #endif
37971
 
 
 
 
 
 
 
 
 
 
37972 /*
37973 * The initial size of the Win32-specific heap. This value may be zero.
37974 */
37975 #ifndef SQLITE_WIN32_HEAP_INIT_SIZE
37976 # define SQLITE_WIN32_HEAP_INIT_SIZE ((SQLITE_WIN32_CACHE_SIZE) * \
37977 (SQLITE_DEFAULT_PAGE_SIZE) + 4194304)
 
37978 #endif
37979
37980 /*
37981 * The maximum size of the Win32-specific heap. This value may be zero.
37982 */
37983 #ifndef SQLITE_WIN32_HEAP_MAX_SIZE
37984 # define SQLITE_WIN32_HEAP_MAX_SIZE (0)
37985 #endif
37986
37987 /*
37988 * The extra flags to use in calls to the Win32 heap APIs. This value may be
37989 * zero for the default behavior.
37990 */
37991 #ifndef SQLITE_WIN32_HEAP_FLAGS
37992 # define SQLITE_WIN32_HEAP_FLAGS (0)
37993 #endif
37994
37995
37996 /*
37997 ** The winMemData structure stores information required by the Win32-specific
@@ -44084,11 +44145,11 @@
44084 ** This routine is for use inside of assert() statements only. For
44085 ** example:
44086 **
44087 ** assert( sqlite3PcachePageSanity(pPg) );
44088 */
44089 #if SQLITE_DEBUG
44090 SQLITE_PRIVATE int sqlite3PcachePageSanity(PgHdr *pPg){
44091 PCache *pCache;
44092 assert( pPg!=0 );
44093 assert( pPg->pgno>0 || pPg->pPager==0 ); /* Page number is 1 or more */
44094 pCache = pPg->pCache;
@@ -63636,11 +63697,11 @@
63636 pCur->aiIdx[pCur->iPage] = 0;
63637 return getAndInitPage(pBt, newPgno, &pCur->apPage[pCur->iPage],
63638 pCur, pCur->curPagerFlags);
63639 }
63640
63641 #if SQLITE_DEBUG
63642 /*
63643 ** Page pParent is an internal (non-leaf) tree page. This function
63644 ** asserts that page number iChild is the left-child if the iIdx'th
63645 ** cell in page pParent. Or, if iIdx is equal to the total number of
63646 ** cells in pParent, that page number iChild is the right-child of
@@ -64178,10 +64239,34 @@
64178 ** have been deleted? This API will need to change to return an error code
64179 ** as well as the boolean result value.
64180 */
64181 return (CURSOR_VALID!=pCur->eState);
64182 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64183
64184 /*
64185 ** Advance the cursor to the next entry in the database. If
64186 ** successful then set *pRes=0. If the cursor
64187 ** was already pointing to the last entry in the database before
@@ -65023,11 +65108,11 @@
65023 ** pPrior Where to write the pgno of the first overflow page
65024 **
65025 ** Use a call to btreeParseCellPtr() to verify that the values above
65026 ** were computed correctly.
65027 */
65028 #if SQLITE_DEBUG
65029 {
65030 CellInfo info;
65031 pPage->xParseCell(pPage, pCell, &info);
65032 assert( nHeader==(int)(info.pPayload - pCell) );
65033 assert( info.nKey==pX->nKey );
@@ -73753,17 +73838,17 @@
73753 ** Then the internal cache might have been left in an inconsistent
73754 ** state. We need to rollback the statement transaction, if there is
73755 ** one, or the complete transaction if there is no statement transaction.
73756 */
73757
 
 
 
73758 if( db->mallocFailed ){
73759 p->rc = SQLITE_NOMEM_BKPT;
73760 }
73761 closeAllCursors(p);
73762 if( p->magic!=VDBE_MAGIC_RUN ){
73763 return SQLITE_OK;
73764 }
73765 checkActiveVdbeCnt(db);
73766
73767 /* No commit or rollback needed if the program never started or if the
73768 ** SQL statement does not read or write a database file. */
73769 if( p->pc>=0 && p->bIsReader ){
@@ -74706,11 +74791,11 @@
74706 }
74707 assert( u<=pKeyInfo->nField + 1 );
74708 p->nField = u;
74709 }
74710
74711 #if SQLITE_DEBUG
74712 /*
74713 ** This function compares two index or table record keys in the same way
74714 ** as the sqlite3VdbeRecordCompare() routine. Unlike VdbeRecordCompare(),
74715 ** this function deserializes and compares values using the
74716 ** sqlite3VdbeSerialGet() and sqlite3MemCompare() functions. It is used
@@ -74811,11 +74896,11 @@
74811 if( pKeyInfo->db->mallocFailed ) return 1;
74812 return 0;
74813 }
74814 #endif
74815
74816 #if SQLITE_DEBUG
74817 /*
74818 ** Count the number of fields (a.k.a. columns) in the record given by
74819 ** pKey,nKey. The verify that this count is less than or equal to the
74820 ** limit given by pKeyInfo->nField + pKeyInfo->nXField.
74821 **
@@ -79658,39 +79743,39 @@
79658 if( pCtx->pOut != pOut ){
79659 pCtx->pOut = pOut;
79660 for(i=pCtx->argc-1; i>=0; i--) pCtx->argv[i] = &aMem[pOp->p2+i];
79661 }
79662
79663 memAboutToChange(p, pCtx->pOut);
79664 #ifdef SQLITE_DEBUG
79665 for(i=0; i<pCtx->argc; i++){
79666 assert( memIsValid(pCtx->argv[i]) );
79667 REGISTER_TRACE(pOp->p2+i, pCtx->argv[i]);
79668 }
79669 #endif
79670 MemSetTypeFlag(pCtx->pOut, MEM_Null);
79671 pCtx->fErrorOrAux = 0;
79672 (*pCtx->pFunc->xSFunc)(pCtx, pCtx->argc, pCtx->argv);/* IMP: R-24505-23230 */
79673
79674 /* If the function returned an error, throw an exception */
79675 if( pCtx->fErrorOrAux ){
79676 if( pCtx->isError ){
79677 sqlite3VdbeError(p, "%s", sqlite3_value_text(pCtx->pOut));
79678 rc = pCtx->isError;
79679 }
79680 sqlite3VdbeDeleteAuxData(db, &p->pAuxData, pCtx->iOp, pOp->p1);
79681 if( rc ) goto abort_due_to_error;
79682 }
79683
79684 /* Copy the result of the function into register P3 */
79685 if( pOut->flags & (MEM_Str|MEM_Blob) ){
79686 sqlite3VdbeChangeEncoding(pCtx->pOut, encoding);
79687 if( sqlite3VdbeMemTooBig(pCtx->pOut) ) goto too_big;
79688 }
79689
79690 REGISTER_TRACE(pOp->p3, pCtx->pOut);
79691 UPDATE_MAX_BLOBSIZE(pCtx->pOut);
79692 break;
79693 }
79694
79695 /* Opcode: BitAnd P1 P2 P3 * *
79696 ** Synopsis: r[P3]=r[P1]&r[P2]
@@ -80187,11 +80272,11 @@
80187 pKeyInfo = pOp->p4.pKeyInfo;
80188 assert( n>0 );
80189 assert( pKeyInfo!=0 );
80190 p1 = pOp->p1;
80191 p2 = pOp->p2;
80192 #if SQLITE_DEBUG
80193 if( aPermute ){
80194 int k, mx = 0;
80195 for(k=0; k<n; k++) if( aPermute[k]>mx ) mx = aPermute[k];
80196 assert( p1>0 && p1+mx<=(p->nMem+1 - p->nCursor)+1 );
80197 assert( p2>0 && p2+mx<=(p->nMem+1 - p->nCursor)+1 );
@@ -82836,10 +82921,37 @@
82836 assert( pOp->p2==0 );
82837 }
82838 break;
82839 }
82840
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82841
82842 /* Opcode: SorterSort P1 P2 * * *
82843 **
82844 ** After all records have been inserted into the Sorter object
82845 ** identified by P1, invoke this opcode to actually do the sorting.
@@ -83479,10 +83591,22 @@
83479 rc = sqlite3BtreeCreateTable(pDb->pBt, &pgno, flags);
83480 if( rc ) goto abort_due_to_error;
83481 pOut->u.i = pgno;
83482 break;
83483 }
 
 
 
 
 
 
 
 
 
 
 
 
83484
83485 /* Opcode: ParseSchema P1 * * P4 *
83486 **
83487 ** Read and parse all entries from the SQLITE_MASTER table of database P1
83488 ** that match the WHERE clause P4.
@@ -83600,11 +83724,11 @@
83600 **
83601 ** Do an analysis of the currently open database. Store in
83602 ** register P1 the text of an error message describing any problems.
83603 ** If no problems are found, store a NULL in register P1.
83604 **
83605 ** The register P3 contains the maximum number of allowed errors.
83606 ** At most reg(P3) errors will be reported.
83607 ** In other words, the analysis stops as soon as reg(P1) errors are
83608 ** seen. Reg(P1) is updated with the number of errors remaining.
83609 **
83610 ** The root page numbers of all tables in the database are integers
@@ -83633,18 +83757,18 @@
83633 assert( (pnErr->flags & (MEM_Str|MEM_Blob))==0 );
83634 pIn1 = &aMem[pOp->p1];
83635 assert( pOp->p5<db->nDb );
83636 assert( DbMaskTest(p->btreeMask, pOp->p5) );
83637 z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p5].pBt, aRoot, nRoot,
83638 (int)pnErr->u.i, &nErr);
83639 pnErr->u.i -= nErr;
83640 sqlite3VdbeMemSetNull(pIn1);
83641 if( nErr==0 ){
83642 assert( z==0 );
83643 }else if( z==0 ){
83644 goto no_mem;
83645 }else{
 
83646 sqlite3VdbeMemSetStr(pIn1, z, -1, SQLITE_UTF8, sqlite3_free);
83647 }
83648 UPDATE_MAX_BLOBSIZE(pIn1);
83649 sqlite3VdbeChangeEncoding(pIn1, encoding);
83650 break;
@@ -92833,11 +92957,11 @@
92833 int nVal = sqlite3ExprVectorSize(pLeft);
92834 Select *pSelect = (pExpr->flags & EP_xIsSelect) ? pExpr->x.pSelect : 0;
92835 char *zRet;
92836
92837 assert( pExpr->op==TK_IN );
92838 zRet = sqlite3DbMallocZero(pParse->db, nVal+1);
92839 if( zRet ){
92840 int i;
92841 for(i=0; i<nVal; i++){
92842 Expr *pA = sqlite3VectorFieldSubexpr(pLeft, i);
92843 char a = sqlite3ExprAffinity(pA);
@@ -93738,11 +93862,11 @@
93738 ** Clear all column cache entries.
93739 */
93740 SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse *pParse){
93741 int i;
93742
93743 #if SQLITE_DEBUG
93744 if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
93745 printf("CLEAR\n");
93746 }
93747 #endif
93748 for(i=0; i<pParse->nColCache; i++){
@@ -95145,10 +95269,21 @@
95145 if( pA->a[i].sortOrder!=pB->a[i].sortOrder ) return 1;
95146 if( sqlite3ExprCompare(pExprA, pExprB, iTab) ) return 1;
95147 }
95148 return 0;
95149 }
 
 
 
 
 
 
 
 
 
 
 
95150
95151 /*
95152 ** Return true if we can prove the pE2 will always be true if pE1 is
95153 ** true. Return false if we cannot complete the proof or if pE2 might
95154 ** be false. Examples:
@@ -96698,10 +96833,11 @@
96698 Stat4Sample current; /* Current row as a Stat4Sample */
96699 u32 iPrn; /* Pseudo-random number used for sampling */
96700 Stat4Sample *aBest; /* Array of nCol best samples */
96701 int iMin; /* Index in a[] of entry with minimum score */
96702 int nSample; /* Current number of samples */
 
96703 int iGet; /* Index of current sample accessed by stat_get() */
96704 Stat4Sample *a; /* Array of mxSample Stat4Sample objects */
96705 sqlite3 *db; /* Database connection, for malloc() */
96706 };
96707
@@ -96962,10 +97098,17 @@
96962 int i;
96963
96964 assert( IsStat4 || nEqZero==0 );
96965
96966 #ifdef SQLITE_ENABLE_STAT4
 
 
 
 
 
 
 
96967 if( pNew->isPSample==0 ){
96968 Stat4Sample *pUpgrade = 0;
96969 assert( pNew->anEq[pNew->iCol]>0 );
96970
96971 /* This sample is being added because the prefix that ends in column
@@ -97059,16 +97202,26 @@
97059 if( p->nSample<p->mxSample || sampleIsBetter(p, pBest, &p->a[p->iMin]) ){
97060 sampleInsert(p, pBest, i);
97061 }
97062 }
97063
97064 /* Update the anEq[] fields of any samples already collected. */
 
97065 for(i=p->nSample-1; i>=0; i--){
97066 int j;
97067 for(j=iChng; j<p->nCol; j++){
97068 if( p->a[i].anEq[j]==0 ) p->a[i].anEq[j] = p->current.anEq[j];
 
 
 
 
 
 
 
 
97069 }
 
97070 }
97071 #endif
97072
97073 #if defined(SQLITE_ENABLE_STAT3) && !defined(SQLITE_ENABLE_STAT4)
97074 if( iChng==0 ){
@@ -97778,44 +97931,32 @@
97778 /* Form 1: Analyze everything */
97779 for(i=0; i<db->nDb; i++){
97780 if( i==1 ) continue; /* Do not analyze the TEMP database */
97781 analyzeDatabase(pParse, i);
97782 }
97783 }else if( pName2->n==0 ){
97784 /* Form 2: Analyze the database or table named */
97785 iDb = sqlite3FindDb(db, pName1);
97786 if( iDb>=0 ){
97787 analyzeDatabase(pParse, iDb);
97788 }else{
97789 z = sqlite3NameFromToken(db, pName1);
97790 if( z ){
97791 if( (pIdx = sqlite3FindIndex(db, z, 0))!=0 ){
97792 analyzeTable(pParse, pIdx->pTable, pIdx);
97793 }else if( (pTab = sqlite3LocateTable(pParse, 0, z, 0))!=0 ){
97794 analyzeTable(pParse, pTab, 0);
97795 }
97796 sqlite3DbFree(db, z);
97797 }
97798 }
97799 }else{
97800 /* Form 3: Analyze the fully qualified table name */
97801 iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pTableName);
97802 if( iDb>=0 ){
97803 zDb = db->aDb[iDb].zDbSName;
97804 z = sqlite3NameFromToken(db, pTableName);
97805 if( z ){
97806 if( (pIdx = sqlite3FindIndex(db, z, zDb))!=0 ){
97807 analyzeTable(pParse, pIdx->pTable, pIdx);
97808 }else if( (pTab = sqlite3LocateTable(pParse, 0, z, zDb))!=0 ){
97809 analyzeTable(pParse, pTab, 0);
97810 }
97811 sqlite3DbFree(db, z);
97812 }
97813 }
97814 }
97815 v = sqlite3GetVdbe(pParse);
97816 if( v ) sqlite3VdbeAddOp0(v, OP_Expire);
 
97817 }
97818
97819 /*
97820 ** Used to pass information from the analyzer reader through to the
97821 ** callback routine.
@@ -97940,19 +98081,24 @@
97940 }
97941 aiRowEst = pIndex->aiRowEst;
97942 #endif
97943 pIndex->bUnordered = 0;
97944 decodeIntArray((char*)z, nCol, aiRowEst, pIndex->aiRowLogEst, pIndex);
97945 if( pIndex->pPartIdxWhere==0 ) pTable->nRowLogEst = pIndex->aiRowLogEst[0];
 
 
 
 
97946 }else{
97947 Index fakeIdx;
97948 fakeIdx.szIdxRow = pTable->szTabRow;
97949 #ifdef SQLITE_ENABLE_COSTMULT
97950 fakeIdx.pTable = pTable;
97951 #endif
97952 decodeIntArray((char*)z, 1, 0, &pTable->nRowLogEst, &fakeIdx);
97953 pTable->szTabRow = fakeIdx.szIdxRow;
 
97954 }
97955
97956 return 0;
97957 }
97958
@@ -98243,19 +98389,24 @@
98243 SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
98244 analysisInfo sInfo;
98245 HashElem *i;
98246 char *zSql;
98247 int rc = SQLITE_OK;
 
98248
98249 assert( iDb>=0 && iDb<db->nDb );
98250 assert( db->aDb[iDb].pBt!=0 );
98251
98252 /* Clear any prior statistics */
98253 assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
98254 for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){
 
 
 
 
98255 Index *pIdx = sqliteHashData(i);
98256 pIdx->aiRowLogEst[0] = 0;
98257 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
98258 sqlite3DeleteIndexSamples(db, pIdx);
98259 pIdx->aSample = 0;
98260 #endif
98261 }
@@ -98274,23 +98425,23 @@
98274 }
98275 }
98276
98277 /* Set appropriate defaults on all indexes not in the sqlite_stat1 table */
98278 assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
98279 for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){
98280 Index *pIdx = sqliteHashData(i);
98281 if( pIdx->aiRowLogEst[0]==0 ) sqlite3DefaultRowEst(pIdx);
98282 }
98283
98284 /* Load the statistics from the sqlite_stat4 table. */
98285 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
98286 if( rc==SQLITE_OK && OptimizationEnabled(db, SQLITE_Stat34) ){
98287 db->lookaside.bDisable++;
98288 rc = loadStat4(db, sInfo.zDatabase);
98289 db->lookaside.bDisable--;
98290 }
98291 for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){
98292 Index *pIdx = sqliteHashData(i);
98293 sqlite3_free(pIdx->aiRowEst);
98294 pIdx->aiRowEst = 0;
98295 }
98296 #endif
@@ -100271,10 +100422,11 @@
100271 SQLITE_PRIVATE void sqlite3AddNotNull(Parse *pParse, int onError){
100272 Table *p;
100273 p = pParse->pNewTable;
100274 if( p==0 || NEVER(p->nCol<1) ) return;
100275 p->aCol[p->nCol-1].notNull = (u8)onError;
 
100276 }
100277
100278 /*
100279 ** Scan the column type name zType (length nType) and return the
100280 ** associated affinity type.
@@ -102609,10 +102761,13 @@
102609 /* 10, 9, 8, 7, 6 */
102610 LogEst aVal[] = { 33, 32, 30, 28, 26 };
102611 LogEst *a = pIdx->aiRowLogEst;
102612 int nCopy = MIN(ArraySize(aVal), pIdx->nKeyCol);
102613 int i;
 
 
 
102614
102615 /* Set the first entry (number of rows in the index) to the estimated
102616 ** number of rows in the table, or half the number of rows in the table
102617 ** for a partial index. But do not let the estimate drop below 10. */
102618 a[0] = pIdx->pTable->nRowLogEst;
@@ -109798,10 +109953,13 @@
109798 VdbeComment((v, "%s", iField<0 ? "rowid" : pTab->aCol[iField].zName));
109799 }
109800 }
109801 sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]);
109802 VdbeComment((v, "for %s", pIdx->zName));
 
 
 
109803
109804 /* In an UPDATE operation, if this index is the PRIMARY KEY index
109805 ** of a WITHOUT ROWID table and there has been no change the
109806 ** primary key, then no collision is possible. The collision detection
109807 ** logic below can all be skipped. */
@@ -109953,12 +110111,15 @@
109953
109954 /* Records with omitted columns are only allowed for schema format
109955 ** version 2 and later (SQLite version 3.1.4, 2005-02-20). */
109956 if( pTab->pSchema->file_format<2 ) return;
109957
109958 for(i=pTab->nCol; i>1 && pTab->aCol[i-1].pDflt==0; i--){}
109959 sqlite3VdbeChangeP5(v, i);
 
 
 
109960 }
109961 #endif
109962
109963 /*
109964 ** This routine generates code to finish the INSERT or UPDATE operation
@@ -110244,11 +110405,11 @@
110244 }
110245 if( sqlite3TriggerList(pParse, pDest) ){
110246 return 0; /* tab1 must not have triggers */
110247 }
110248 #ifndef SQLITE_OMIT_VIRTUALTABLE
110249 if( pDest->tabFlags & TF_Virtual ){
110250 return 0; /* tab1 must not be a virtual table */
110251 }
110252 #endif
110253 if( onError==OE_Default ){
110254 if( pDest->iPKey>=0 ) onError = pDest->keyConf;
@@ -110306,11 +110467,11 @@
110306 }
110307 if( HasRowid(pDest)!=HasRowid(pSrc) ){
110308 return 0; /* source and destination must both be WITHOUT ROWID or not */
110309 }
110310 #ifndef SQLITE_OMIT_VIRTUALTABLE
110311 if( pSrc->tabFlags & TF_Virtual ){
110312 return 0; /* tab2 must not be a virtual table */
110313 }
110314 #endif
110315 if( pSrc->pSelect ){
110316 return 0; /* tab2 may not be a view */
@@ -110603,11 +110764,11 @@
110603 /* Invoke the callback function if required */
110604 if( xCallback && (SQLITE_ROW==rc ||
110605 (SQLITE_DONE==rc && !callbackIsInit
110606 && db->flags&SQLITE_NullCallback)) ){
110607 if( !callbackIsInit ){
110608 azCols = sqlite3DbMallocZero(db, 2*nCol*sizeof(const char*) + 1);
110609 if( azCols==0 ){
110610 goto exec_out;
110611 }
110612 for(i=0; i<nCol; i++){
110613 azCols[i] = (char *)sqlite3_column_name(pStmt, i);
@@ -110624,10 +110785,11 @@
110624 if( !azVals[i] && sqlite3_column_type(pStmt, i)!=SQLITE_NULL ){
110625 sqlite3OomFault(db);
110626 goto exec_out;
110627 }
110628 }
 
110629 }
110630 if( xCallback(pArg, nCol, azVals, azCols) ){
110631 /* EVIDENCE-OF: R-38229-40159 If the callback function to
110632 ** sqlite3_exec() returns non-zero, then sqlite3_exec() will
110633 ** return SQLITE_ABORT. */
@@ -112094,15 +112256,15 @@
112094 #define PragTyp_JOURNAL_SIZE_LIMIT 20
112095 #define PragTyp_LOCK_PROXY_FILE 21
112096 #define PragTyp_LOCKING_MODE 22
112097 #define PragTyp_PAGE_COUNT 23
112098 #define PragTyp_MMAP_SIZE 24
112099 #define PragTyp_PAGE_SIZE 25
112100 #define PragTyp_SECURE_DELETE 26
112101 #define PragTyp_SHRINK_MEMORY 27
112102 #define PragTyp_SOFT_HEAP_LIMIT 28
112103 #define PragTyp_STATS 29
112104 #define PragTyp_SYNCHRONOUS 30
112105 #define PragTyp_TABLE_INFO 31
112106 #define PragTyp_TEMP_STORE 32
112107 #define PragTyp_TEMP_STORE_DIRECTORY 33
112108 #define PragTyp_THREADS 34
@@ -112112,10 +112274,11 @@
112112 #define PragTyp_HEXKEY 38
112113 #define PragTyp_KEY 39
112114 #define PragTyp_REKEY 40
112115 #define PragTyp_LOCK_STATUS 41
112116 #define PragTyp_PARSER_TRACE 42
 
112117
112118 /* Property flags associated with various pragma. */
112119 #define PragFlg_NeedSchema 0x01 /* Force schema load before running */
112120 #define PragFlg_NoColumns 0x02 /* OP_ResultRow called with zero columns */
112121 #define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */
@@ -112135,51 +112298,52 @@
112135 /* 2 */ "name",
112136 /* 3 */ "type",
112137 /* 4 */ "notnull",
112138 /* 5 */ "dflt_value",
112139 /* 6 */ "pk",
112140 /* 7 */ "table", /* Used by: stats */
112141 /* 8 */ "index",
112142 /* 9 */ "width",
112143 /* 10 */ "height",
112144 /* 11 */ "seqno", /* Used by: index_info */
112145 /* 12 */ "cid",
112146 /* 13 */ "name",
112147 /* 14 */ "seqno", /* Used by: index_xinfo */
112148 /* 15 */ "cid",
112149 /* 16 */ "name",
112150 /* 17 */ "desc",
112151 /* 18 */ "coll",
112152 /* 19 */ "key",
112153 /* 20 */ "seq", /* Used by: index_list */
112154 /* 21 */ "name",
112155 /* 22 */ "unique",
112156 /* 23 */ "origin",
112157 /* 24 */ "partial",
112158 /* 25 */ "seq", /* Used by: database_list */
112159 /* 26 */ "name",
112160 /* 27 */ "file",
112161 /* 28 */ "seq", /* Used by: collation_list */
112162 /* 29 */ "name",
112163 /* 30 */ "id", /* Used by: foreign_key_list */
112164 /* 31 */ "seq",
112165 /* 32 */ "table",
112166 /* 33 */ "from",
112167 /* 34 */ "to",
112168 /* 35 */ "on_update",
112169 /* 36 */ "on_delete",
112170 /* 37 */ "match",
112171 /* 38 */ "table", /* Used by: foreign_key_check */
112172 /* 39 */ "rowid",
112173 /* 40 */ "parent",
112174 /* 41 */ "fkid",
112175 /* 42 */ "busy", /* Used by: wal_checkpoint */
112176 /* 43 */ "log",
112177 /* 44 */ "checkpointed",
112178 /* 45 */ "timeout", /* Used by: busy_timeout */
112179 /* 46 */ "database", /* Used by: lock_status */
112180 /* 47 */ "status",
 
112181 };
112182
112183 /* Definitions of all built-in pragmas */
112184 typedef struct PragmaName {
112185 const char *const zName; /* Name of pragma */
@@ -112221,11 +112385,11 @@
112221 #endif
112222 #endif
112223 {/* zName: */ "busy_timeout",
112224 /* ePragTyp: */ PragTyp_BUSY_TIMEOUT,
112225 /* ePragFlg: */ PragFlg_Result0,
112226 /* ColNames: */ 45, 1,
112227 /* iArg: */ 0 },
112228 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112229 {/* zName: */ "cache_size",
112230 /* ePragTyp: */ PragTyp_CACHE_SIZE,
112231 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
@@ -112258,11 +112422,11 @@
112258 #endif
112259 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
112260 {/* zName: */ "collation_list",
112261 /* ePragTyp: */ PragTyp_COLLATION_LIST,
112262 /* ePragFlg: */ PragFlg_Result0,
112263 /* ColNames: */ 28, 2,
112264 /* iArg: */ 0 },
112265 #endif
112266 #if !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)
112267 {/* zName: */ "compile_options",
112268 /* ePragTyp: */ PragTyp_COMPILE_OPTIONS,
@@ -112293,11 +112457,11 @@
112293 #endif
112294 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
112295 {/* zName: */ "database_list",
112296 /* ePragTyp: */ PragTyp_DATABASE_LIST,
112297 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0,
112298 /* ColNames: */ 25, 3,
112299 /* iArg: */ 0 },
112300 #endif
112301 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)
112302 {/* zName: */ "default_cache_size",
112303 /* ePragTyp: */ PragTyp_DEFAULT_CACHE_SIZE,
@@ -112330,18 +112494,18 @@
112330 #endif
112331 #if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
112332 {/* zName: */ "foreign_key_check",
112333 /* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK,
112334 /* ePragFlg: */ PragFlg_NeedSchema,
112335 /* ColNames: */ 38, 4,
112336 /* iArg: */ 0 },
112337 #endif
112338 #if !defined(SQLITE_OMIT_FOREIGN_KEY)
112339 {/* zName: */ "foreign_key_list",
112340 /* ePragTyp: */ PragTyp_FOREIGN_KEY_LIST,
112341 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
112342 /* ColNames: */ 30, 8,
112343 /* iArg: */ 0 },
112344 #endif
112345 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112346 #if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
112347 {/* zName: */ "foreign_keys",
@@ -112400,21 +112564,21 @@
112400 #endif
112401 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
112402 {/* zName: */ "index_info",
112403 /* ePragTyp: */ PragTyp_INDEX_INFO,
112404 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
112405 /* ColNames: */ 11, 3,
112406 /* iArg: */ 0 },
112407 {/* zName: */ "index_list",
112408 /* ePragTyp: */ PragTyp_INDEX_LIST,
112409 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
112410 /* ColNames: */ 20, 5,
112411 /* iArg: */ 0 },
112412 {/* zName: */ "index_xinfo",
112413 /* ePragTyp: */ PragTyp_INDEX_INFO,
112414 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
112415 /* ColNames: */ 14, 6,
112416 /* iArg: */ 1 },
112417 #endif
112418 #if !defined(SQLITE_OMIT_INTEGRITY_CHECK)
112419 {/* zName: */ "integrity_check",
112420 /* ePragTyp: */ PragTyp_INTEGRITY_CHECK,
@@ -112457,11 +112621,11 @@
112457 #endif
112458 #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
112459 {/* zName: */ "lock_status",
112460 /* ePragTyp: */ PragTyp_LOCK_STATUS,
112461 /* ePragFlg: */ PragFlg_Result0,
112462 /* ColNames: */ 46, 2,
112463 /* iArg: */ 0 },
112464 #endif
112465 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112466 {/* zName: */ "locking_mode",
112467 /* ePragTyp: */ PragTyp_LOCKING_MODE,
@@ -112476,10 +112640,17 @@
112476 {/* zName: */ "mmap_size",
112477 /* ePragTyp: */ PragTyp_MMAP_SIZE,
112478 /* ePragFlg: */ 0,
112479 /* ColNames: */ 0, 0,
112480 /* iArg: */ 0 },
 
 
 
 
 
 
 
112481 {/* zName: */ "page_count",
112482 /* ePragTyp: */ PragTyp_PAGE_COUNT,
112483 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
112484 /* ColNames: */ 0, 0,
112485 /* iArg: */ 0 },
@@ -112574,15 +112745,15 @@
112574 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112575 /* ColNames: */ 0, 0,
112576 /* iArg: */ SQLITE_SqlTrace },
112577 #endif
112578 #endif
112579 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
112580 {/* zName: */ "stats",
112581 /* ePragTyp: */ PragTyp_STATS,
112582 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
112583 /* ColNames: */ 7, 4,
112584 /* iArg: */ 0 },
112585 #endif
112586 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112587 {/* zName: */ "synchronous",
112588 /* ePragTyp: */ PragTyp_SYNCHRONOUS,
@@ -112657,11 +112828,11 @@
112657 /* ColNames: */ 0, 0,
112658 /* iArg: */ 0 },
112659 {/* zName: */ "wal_checkpoint",
112660 /* ePragTyp: */ PragTyp_WAL_CHECKPOINT,
112661 /* ePragFlg: */ PragFlg_NeedSchema,
112662 /* ColNames: */ 42, 3,
112663 /* iArg: */ 0 },
112664 #endif
112665 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112666 {/* zName: */ "writable_schema",
112667 /* ePragTyp: */ PragTyp_FLAG,
@@ -112668,11 +112839,11 @@
112668 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112669 /* ColNames: */ 0, 0,
112670 /* iArg: */ SQLITE_WriteSchema|SQLITE_RecoveryMode },
112671 #endif
112672 };
112673 /* Number of pragmas: 60 on by default, 73 total. */
112674
112675 /************** End of pragma.h **********************************************/
112676 /************** Continuing where we left off in pragma.c *********************/
112677
112678 /*
@@ -112937,10 +113108,26 @@
112937 lwr = mid + 1;
112938 }
112939 }
112940 return lwr>upr ? 0 : &aPragmaName[mid];
112941 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112942
112943 /*
112944 ** Process a pragma statement.
112945 **
112946 ** Pragmas are of this form:
@@ -113741,33 +113928,37 @@
113741 }
113742 }
113743 }
113744 break;
113745
 
113746 case PragTyp_STATS: {
113747 Index *pIdx;
113748 HashElem *i;
113749 pParse->nMem = 4;
113750 sqlite3CodeVerifySchema(pParse, iDb);
113751 for(i=sqliteHashFirst(&pDb->pSchema->tblHash); i; i=sqliteHashNext(i)){
113752 Table *pTab = sqliteHashData(i);
113753 sqlite3VdbeMultiLoad(v, 1, "ssii",
113754 pTab->zName,
113755 0,
113756 pTab->szTabRow,
113757 pTab->nRowLogEst);
113758 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 4);
 
113759 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
113760 sqlite3VdbeMultiLoad(v, 2, "sii",
113761 pIdx->zName,
113762 pIdx->szIdxRow,
113763 pIdx->aiRowLogEst[0]);
113764 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 4);
 
113765 }
113766 }
113767 }
113768 break;
 
113769
113770 case PragTyp_INDEX_INFO: if( zRight ){
113771 Index *pIdx;
113772 Table *pTab;
113773 pIdx = sqlite3FindIndex(db, zRight, zDb);
@@ -114020,13 +114211,21 @@
114020 #ifndef SQLITE_INTEGRITY_CHECK_ERROR_MAX
114021 # define SQLITE_INTEGRITY_CHECK_ERROR_MAX 100
114022 #endif
114023
114024 #ifndef SQLITE_OMIT_INTEGRITY_CHECK
114025 /* Pragma "quick_check" is reduced version of
 
 
 
 
 
 
 
114026 ** integrity_check designed to detect most database corruption
114027 ** without most of the overhead of a full integrity-check.
 
114028 */
114029 case PragTyp_INTEGRITY_CHECK: {
114030 int i, j, addr, mxErr;
114031
114032 int isQuick = (sqlite3Tolower(zLeft[0])=='q');
@@ -114053,11 +114252,11 @@
114053 sqlite3GetInt32(zRight, &mxErr);
114054 if( mxErr<=0 ){
114055 mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;
114056 }
114057 }
114058 sqlite3VdbeAddOp2(v, OP_Integer, mxErr, 1); /* reg[1] holds errors left */
114059
114060 /* Do an integrity check on each database file */
114061 for(i=0; i<db->nDb; i++){
114062 HashElem *x;
114063 Hash *pTbls;
@@ -114068,14 +114267,10 @@
114068
114069 if( OMIT_TEMPDB && i==1 ) continue;
114070 if( iDb>=0 && i!=iDb ) continue;
114071
114072 sqlite3CodeVerifySchema(pParse, i);
114073 addr = sqlite3VdbeAddOp1(v, OP_IfPos, 1); /* Halt if out of errors */
114074 VdbeCoverage(v);
114075 sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);
114076 sqlite3VdbeJumpHere(v, addr);
114077
114078 /* Do an integrity check of the B-Tree
114079 **
114080 ** Begin by finding the root pages numbers
114081 ** for all tables and indices in the database.
@@ -114111,29 +114306,30 @@
114111 sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,
114112 sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zDbSName),
114113 P4_DYNAMIC);
114114 sqlite3VdbeAddOp3(v, OP_Move, 2, 4, 1);
114115 sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 2);
114116 sqlite3VdbeAddOp2(v, OP_ResultRow, 2, 1);
114117 sqlite3VdbeJumpHere(v, addr);
114118
114119 /* Make sure all the indices are constructed correctly.
114120 */
114121 for(x=sqliteHashFirst(pTbls); x && !isQuick; x=sqliteHashNext(x)){
114122 Table *pTab = sqliteHashData(x);
114123 Index *pIdx, *pPk;
114124 Index *pPrior = 0;
114125 int loopTop;
114126 int iDataCur, iIdxCur;
114127 int r1 = -1;
114128
114129 if( pTab->pIndex==0 ) continue;
 
 
 
 
 
114130 pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
114131 addr = sqlite3VdbeAddOp1(v, OP_IfPos, 1); /* Stop if out of errors */
114132 VdbeCoverage(v);
114133 sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);
114134 sqlite3VdbeJumpHere(v, addr);
114135 sqlite3ExprCacheClear(pParse);
114136 sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenRead, 0,
114137 1, 0, &iDataCur, &iIdxCur);
114138 sqlite3VdbeAddOp2(v, OP_Integer, 0, 7);
114139 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
@@ -114144,28 +114340,46 @@
114144 sqlite3VdbeAddOp2(v, OP_Rewind, iDataCur, 0); VdbeCoverage(v);
114145 loopTop = sqlite3VdbeAddOp2(v, OP_AddImm, 7, 1);
114146 /* Verify that all NOT NULL columns really are NOT NULL */
114147 for(j=0; j<pTab->nCol; j++){
114148 char *zErr;
114149 int jmp2, jmp3;
114150 if( j==pTab->iPKey ) continue;
114151 if( pTab->aCol[j].notNull==0 ) continue;
114152 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, j, 3);
114153 sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG);
114154 jmp2 = sqlite3VdbeAddOp1(v, OP_NotNull, 3); VdbeCoverage(v);
114155 sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1); /* Decrement error limit */
114156 zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
114157 pTab->aCol[j].zName);
114158 sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
114159 sqlite3VdbeAddOp2(v, OP_ResultRow, 3, 1);
114160 jmp3 = sqlite3VdbeAddOp1(v, OP_IfPos, 1); VdbeCoverage(v);
114161 sqlite3VdbeAddOp0(v, OP_Halt);
114162 sqlite3VdbeJumpHere(v, jmp2);
114163 sqlite3VdbeJumpHere(v, jmp3);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114164 }
114165 /* Validate index entries for the current row */
114166 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
114167 int jmp2, jmp3, jmp4, jmp5;
114168 int ckUniq = sqlite3VdbeMakeLabel(v);
114169 if( pPk==pIdx ) continue;
114170 r1 = sqlite3GenerateIndexKey(pParse, pIdx, iDataCur, 0, 0, &jmp3,
114171 pPrior, r1);
@@ -114172,20 +114386,17 @@
114172 pPrior = pIdx;
114173 sqlite3VdbeAddOp2(v, OP_AddImm, 8+j, 1); /* increment entry count */
114174 /* Verify that an index entry exists for the current table row */
114175 jmp2 = sqlite3VdbeAddOp4Int(v, OP_Found, iIdxCur+j, ckUniq, r1,
114176 pIdx->nColumn); VdbeCoverage(v);
114177 sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1); /* Decrement error limit */
114178 sqlite3VdbeLoadString(v, 3, "row ");
114179 sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3);
114180 sqlite3VdbeLoadString(v, 4, " missing from index ");
114181 sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
114182 jmp5 = sqlite3VdbeLoadString(v, 4, pIdx->zName);
114183 sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
114184 sqlite3VdbeAddOp2(v, OP_ResultRow, 3, 1);
114185 jmp4 = sqlite3VdbeAddOp1(v, OP_IfPos, 1); VdbeCoverage(v);
114186 sqlite3VdbeAddOp0(v, OP_Halt);
114187 sqlite3VdbeJumpHere(v, jmp2);
114188 /* For UNIQUE indexes, verify that only one entry exists with the
114189 ** current key. The entry is unique if (1) any column is NULL
114190 ** or (2) the next entry has a different key */
114191 if( IsUniqueIndex(pIdx) ){
@@ -114202,11 +114413,10 @@
114202 jmp6 = sqlite3VdbeAddOp1(v, OP_Next, iIdxCur+j); VdbeCoverage(v);
114203 sqlite3VdbeGoto(v, uniqOk);
114204 sqlite3VdbeJumpHere(v, jmp6);
114205 sqlite3VdbeAddOp4Int(v, OP_IdxGT, iIdxCur+j, uniqOk, r1,
114206 pIdx->nKeyCol); VdbeCoverage(v);
114207 sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1); /* Decrement error limit */
114208 sqlite3VdbeLoadString(v, 3, "non-unique entry in index ");
114209 sqlite3VdbeGoto(v, jmp5);
114210 sqlite3VdbeResolveLabel(v, uniqOk);
114211 }
114212 sqlite3VdbeJumpHere(v, jmp4);
@@ -114213,40 +114423,39 @@
114213 sqlite3ResolvePartIdxLabel(pParse, jmp3);
114214 }
114215 sqlite3VdbeAddOp2(v, OP_Next, iDataCur, loopTop); VdbeCoverage(v);
114216 sqlite3VdbeJumpHere(v, loopTop-1);
114217 #ifndef SQLITE_OMIT_BTREECOUNT
114218 sqlite3VdbeLoadString(v, 2, "wrong # of entries in index ");
114219 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
114220 if( pPk==pIdx ) continue;
114221 addr = sqlite3VdbeCurrentAddr(v);
114222 sqlite3VdbeAddOp2(v, OP_IfPos, 1, addr+2); VdbeCoverage(v);
114223 sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);
114224 sqlite3VdbeAddOp2(v, OP_Count, iIdxCur+j, 3);
114225 sqlite3VdbeAddOp3(v, OP_Eq, 8+j, addr+8, 3); VdbeCoverage(v);
114226 sqlite3VdbeChangeP5(v, SQLITE_NOTNULL);
114227 sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1);
114228 sqlite3VdbeLoadString(v, 3, pIdx->zName);
114229 sqlite3VdbeAddOp3(v, OP_Concat, 3, 2, 7);
114230 sqlite3VdbeAddOp2(v, OP_ResultRow, 7, 1);
114231 }
114232 #endif /* SQLITE_OMIT_BTREECOUNT */
114233 }
114234 }
114235 {
114236 static const int iLn = VDBE_OFFSET_LINENO(2);
114237 static const VdbeOpList endCode[] = {
114238 { OP_AddImm, 1, 0, 0}, /* 0 */
114239 { OP_If, 1, 4, 0}, /* 1 */
114240 { OP_String8, 0, 3, 0}, /* 2 */
114241 { OP_ResultRow, 3, 1, 0}, /* 3 */
114242 };
114243 VdbeOp *aOp;
114244
114245 aOp = sqlite3VdbeAddOpList(v, ArraySize(endCode), endCode, iLn);
114246 if( aOp ){
114247 aOp[0].p2 = -mxErr;
114248 aOp[2].p4type = P4_STATIC;
114249 aOp[2].p4.z = "ok";
114250 }
114251 }
114252 }
@@ -114466,10 +114675,92 @@
114466 */
114467 case PragTyp_SHRINK_MEMORY: {
114468 sqlite3_db_release_memory(db);
114469 break;
114470 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114471
114472 /*
114473 ** PRAGMA busy_timeout
114474 ** PRAGMA busy_timeout = N
114475 **
@@ -123782,12 +124073,29 @@
123782 ** transient would cause the database file to appear to be deleted
123783 ** following reboot.
123784 */
123785 SQLITE_PRIVATE void sqlite3Vacuum(Parse *pParse, Token *pNm){
123786 Vdbe *v = sqlite3GetVdbe(pParse);
123787 int iDb = pNm ? sqlite3TwoPartName(pParse, pNm, pNm, &pNm) : 0;
123788 if( v && (iDb>=2 || iDb==0) ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123789 sqlite3VdbeAddOp1(v, OP_Vacuum, iDb);
123790 sqlite3VdbeUsesBtree(v, iDb);
123791 }
123792 return;
123793 }
@@ -124377,12 +124685,11 @@
124377
124378 db = pParse->db;
124379 iDb = sqlite3SchemaToIndex(db, pTable->pSchema);
124380 assert( iDb>=0 );
124381
124382 pTable->tabFlags |= TF_Virtual;
124383 pTable->nModuleArg = 0;
124384 addModuleArgument(db, pTable, sqlite3NameFromToken(db, pModuleName));
124385 addModuleArgument(db, pTable, 0);
124386 addModuleArgument(db, pTable, sqlite3DbStrDup(db, pTable->zName));
124387 assert( (pParse->sNameToken.z==pName2->z && pName2->z!=0)
124388 || (pParse->sNameToken.z==pName1->z && pName2->z==0)
@@ -124666,11 +124973,11 @@
124666 const char *zMod;
124667 Module *pMod;
124668 int rc;
124669
124670 assert( pTab );
124671 if( (pTab->tabFlags & TF_Virtual)==0 || sqlite3GetVTable(db, pTab) ){
124672 return SQLITE_OK;
124673 }
124674
124675 /* Locate the required virtual table module */
124676 zMod = pTab->azModuleArg[0];
@@ -124736,11 +125043,11 @@
124736 Table *pTab;
124737 Module *pMod;
124738 const char *zMod;
124739
124740 pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zDbSName);
124741 assert( pTab && (pTab->tabFlags & TF_Virtual)!=0 && !pTab->pVTable );
124742
124743 /* Locate the required virtual table module */
124744 zMod = pTab->azModuleArg[0];
124745 pMod = (Module*)sqlite3HashFind(&db->aModule, zMod);
124746
@@ -124790,11 +125097,11 @@
124790 sqlite3Error(db, SQLITE_MISUSE);
124791 sqlite3_mutex_leave(db->mutex);
124792 return SQLITE_MISUSE_BKPT;
124793 }
124794 pTab = pCtx->pTab;
124795 assert( (pTab->tabFlags & TF_Virtual)!=0 );
124796
124797 pParse = sqlite3StackAllocZero(db, sizeof(*pParse));
124798 if( pParse==0 ){
124799 rc = SQLITE_NOMEM_BKPT;
124800 }else{
@@ -124804,11 +125111,11 @@
124804
124805 if( SQLITE_OK==sqlite3RunParser(pParse, zCreateTable, &zErr)
124806 && pParse->pNewTable
124807 && !db->mallocFailed
124808 && !pParse->pNewTable->pSelect
124809 && (pParse->pNewTable->tabFlags & TF_Virtual)==0
124810 ){
124811 if( !pTab->aCol ){
124812 Table *pNew = pParse->pNewTable;
124813 Index *pIdx;
124814 pTab->aCol = pNew->aCol;
@@ -125093,11 +125400,11 @@
125093 /* Check to see the left operand is a column in a virtual table */
125094 if( NEVER(pExpr==0) ) return pDef;
125095 if( pExpr->op!=TK_COLUMN ) return pDef;
125096 pTab = pExpr->pTab;
125097 if( NEVER(pTab==0) ) return pDef;
125098 if( (pTab->tabFlags & TF_Virtual)==0 ) return pDef;
125099 pVtab = sqlite3GetVTable(db, pTab)->pVtab;
125100 assert( pVtab!=0 );
125101 assert( pVtab->pModule!=0 );
125102 pMod = (sqlite3_module *)pVtab->pModule;
125103 if( pMod->xFindFunction==0 ) return pDef;
@@ -125188,12 +125495,11 @@
125188 return 0;
125189 }
125190 pMod->pEpoTab = pTab;
125191 pTab->nTabRef = 1;
125192 pTab->pSchema = db->aDb[0].pSchema;
125193 pTab->tabFlags |= TF_Virtual;
125194 pTab->nModuleArg = 0;
125195 pTab->iPKey = -1;
125196 addModuleArgument(db, pTab, sqlite3DbStrDup(db, pTab->zName));
125197 addModuleArgument(db, pTab, 0);
125198 addModuleArgument(db, pTab, sqlite3DbStrDup(db, pTab->zName));
125199 rc = vtabCallConstructor(db, pTab, pMod, pModule->xConnect, &zErr);
@@ -125260,11 +125566,11 @@
125260 case SQLITE_VTAB_CONSTRAINT_SUPPORT: {
125261 VtabCtx *p = db->pVtabCtx;
125262 if( !p ){
125263 rc = SQLITE_MISUSE_BKPT;
125264 }else{
125265 assert( p->pTab==0 || (p->pTab->tabFlags & TF_Virtual)!=0 );
125266 p->pVTable->bConstraint = (u8)va_arg(ap, int);
125267 }
125268 break;
125269 }
125270 default:
@@ -125699,12 +126005,17 @@
125699 WhereOrSet *pOrSet; /* Record best loops here, if not NULL */
125700 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
125701 UnpackedRecord *pRec; /* Probe for stat4 (if required) */
125702 int nRecValid; /* Number of valid fields currently in pRec */
125703 #endif
 
125704 };
125705
 
 
 
 
125706 /*
125707 ** The WHERE clause processing routine has two halves. The
125708 ** first part does the start of the WHERE loop and the second
125709 ** half does the tail of the WHERE loop. An instance of
125710 ** this structure is returned by the first half and passed
@@ -125715,11 +126026,11 @@
125715 */
125716 struct WhereInfo {
125717 Parse *pParse; /* Parsing and code generating context */
125718 SrcList *pTabList; /* List of tables in the join */
125719 ExprList *pOrderBy; /* The ORDER BY clause or NULL */
125720 ExprList *pDistinctSet; /* DISTINCT over all these values */
125721 LogEst iLimit; /* LIMIT if wctrlFlags has WHERE_USE_LIMIT */
125722 int aiCurOnePass[2]; /* OP_OpenWrite cursors for the ONEPASS opt */
125723 int iContinue; /* Jump here to continue with next record */
125724 int iBreak; /* Jump here to break out of the loop */
125725 int savedNQueryLoop; /* pParse->nQueryLoop outside the WHERE loop */
@@ -126899,10 +127210,11 @@
126899 Parse *pParse; /* Parsing context */
126900 sqlite3 *db; /* Database connection */
126901 Vdbe *v; /* The prepared stmt under constructions */
126902 struct SrcList_item *pTabItem; /* FROM clause term being coded */
126903 int addrBrk; /* Jump here to break out of the loop */
 
126904 int addrCont; /* Jump here to continue with next cycle */
126905 int iRowidReg = 0; /* Rowid is stored in this register, if not zero */
126906 int iReleaseReg = 0; /* Temp register to free before returning */
126907
126908 pParse = pWInfo->pParse;
@@ -126939,10 +127251,15 @@
126939 if( pLevel->iFrom>0 && (pTabItem[0].fg.jointype & JT_LEFT)!=0 ){
126940 pLevel->iLeftJoin = ++pParse->nMem;
126941 sqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin);
126942 VdbeComment((v, "init LEFT JOIN no-match flag"));
126943 }
 
 
 
 
 
126944
126945 /* Special case of a FROM clause subquery implemented as a co-routine */
126946 if( pTabItem->fg.viaCoroutine ){
126947 int regYield = pTabItem->regReturn;
126948 sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
@@ -127124,11 +127441,11 @@
127124 VdbeCoverageIf(v, pX->op==TK_LT);
127125 VdbeCoverageIf(v, pX->op==TK_GE);
127126 sqlite3ExprCacheAffinityChange(pParse, r1, 1);
127127 sqlite3ReleaseTempReg(pParse, rTemp);
127128 }else{
127129 sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, addrBrk);
127130 VdbeCoverageIf(v, bRev==0);
127131 VdbeCoverageIf(v, bRev!=0);
127132 }
127133 if( pEnd ){
127134 Expr *pX;
@@ -127770,11 +128087,11 @@
127770 pLevel->op = OP_Noop;
127771 }else{
127772 codeCursorHint(pTabItem, pWInfo, pLevel, 0);
127773 pLevel->op = aStep[bRev];
127774 pLevel->p1 = iCur;
127775 pLevel->p2 = 1 + sqlite3VdbeAddOp2(v, aStart[bRev], iCur, addrBrk);
127776 VdbeCoverageIf(v, bRev==0);
127777 VdbeCoverageIf(v, bRev!=0);
127778 pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP;
127779 }
127780 }
@@ -128095,19 +128412,10 @@
128095 #ifdef SQLITE_EBCDIC
128096 if( *pnoCase ) return 0;
128097 #endif
128098 pList = pExpr->x.pList;
128099 pLeft = pList->a[1].pExpr;
128100 if( pLeft->op!=TK_COLUMN
128101 || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT
128102 || IsVirtual(pLeft->pTab) /* Value might be numeric */
128103 ){
128104 /* IMP: R-02065-49465 The left-hand side of the LIKE or GLOB operator must
128105 ** be the name of an indexed column with TEXT affinity. */
128106 return 0;
128107 }
128108 assert( pLeft->iColumn!=(-1) ); /* Because IPK never has AFF_TEXT */
128109
128110 pRight = sqlite3ExprSkipCollate(pList->a[0].pExpr);
128111 op = pRight->op;
128112 if( op==TK_VARIABLE ){
128113 Vdbe *pReprepare = pParse->pReprepare;
@@ -128120,10 +128428,27 @@
128120 assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER );
128121 }else if( op==TK_STRING ){
128122 z = pRight->u.zToken;
128123 }
128124 if( z ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128125 cnt = 0;
128126 while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){
128127 cnt++;
128128 }
128129 if( cnt!=0 && 255!=(u8)z[cnt-1] ){
@@ -128748,11 +129073,11 @@
128748 iCur = pFrom->a[i].iCursor;
128749 for(pIdx=pFrom->a[i].pTab->pIndex; pIdx; pIdx=pIdx->pNext){
128750 if( pIdx->aColExpr==0 ) continue;
128751 for(i=0; i<pIdx->nKeyCol; i++){
128752 if( pIdx->aiColumn[i]!=XN_EXPR ) continue;
128753 if( sqlite3ExprCompare(pExpr, pIdx->aColExpr->a[i].pExpr, iCur)==0 ){
128754 *piCur = iCur;
128755 *piColumn = XN_EXPR;
128756 return 1;
128757 }
128758 }
@@ -129539,11 +129864,12 @@
129539 do{
129540 for(pTerm=pWC->a+k; k<pWC->nTerm; k++, pTerm++){
129541 if( pTerm->leftCursor==iCur
129542 && pTerm->u.leftColumn==iColumn
129543 && (iColumn!=XN_EXPR
129544 || sqlite3ExprCompare(pTerm->pExpr->pLeft,pScan->pIdxExpr,iCur)==0)
 
129545 && (pScan->iEquiv<=1 || !ExprHasProperty(pTerm->pExpr, EP_FromJoin))
129546 ){
129547 if( (pTerm->eOperator & WO_EQUIV)!=0
129548 && pScan->nEquiv<ArraySize(pScan->aiCur)
129549 && (pX = sqlite3ExprSkipCollate(pTerm->pExpr->pRight))->op==TK_COLUMN
@@ -131716,10 +132042,15 @@
131716 testcase( eOp & WO_IS );
131717 testcase( eOp & WO_ISNULL );
131718 continue;
131719 }
131720
 
 
 
 
 
131721 pNew->wsFlags = saved_wsFlags;
131722 pNew->u.btree.nEq = saved_nEq;
131723 pNew->u.btree.nBtm = saved_nBtm;
131724 pNew->u.btree.nTop = saved_nTop;
131725 pNew->nLTerm = saved_nLTerm;
@@ -132263,11 +132594,19 @@
132263 pNew->nOut = rSize;
132264 if( rc ) break;
132265 }
132266 }
132267
 
132268 rc = whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, 0);
 
 
 
 
 
 
 
132269 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
132270 sqlite3Stat4ProbeFree(pBuilder->pRec);
132271 pBuilder->nRecValid = 0;
132272 pBuilder->pRec = 0;
132273 #endif
@@ -133443,13 +133782,13 @@
133443 && (pWInfo->wctrlFlags & WHERE_DISTINCTBY)==0
133444 && pWInfo->eDistinct==WHERE_DISTINCT_NOOP
133445 && nRowEst
133446 ){
133447 Bitmask notUsed;
133448 int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pDistinctSet, pFrom,
133449 WHERE_DISTINCTBY, nLoop-1, pFrom->aLoop[nLoop-1], &notUsed);
133450 if( rc==pWInfo->pDistinctSet->nExpr ){
133451 pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;
133452 }
133453 }
133454 if( pWInfo->pOrderBy ){
133455 if( pWInfo->wctrlFlags & WHERE_DISTINCTBY ){
@@ -133682,11 +134021,11 @@
133682 SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
133683 Parse *pParse, /* The parser context */
133684 SrcList *pTabList, /* FROM clause: A list of all tables to be scanned */
133685 Expr *pWhere, /* The WHERE clause */
133686 ExprList *pOrderBy, /* An ORDER BY (or GROUP BY) clause, or NULL */
133687 ExprList *pDistinctSet, /* Try not to output two rows that duplicate these */
133688 u16 wctrlFlags, /* The WHERE_* flags defined in sqliteInt.h */
133689 int iAuxArg /* If WHERE_OR_SUBCLAUSE is set, index cursor number
133690 ** If WHERE_USE_LIMIT, then the limit amount */
133691 ){
133692 int nByteWInfo; /* Num. bytes allocated for WhereInfo struct */
@@ -133758,11 +134097,11 @@
133758 goto whereBeginError;
133759 }
133760 pWInfo->pParse = pParse;
133761 pWInfo->pTabList = pTabList;
133762 pWInfo->pOrderBy = pOrderBy;
133763 pWInfo->pDistinctSet = pDistinctSet;
133764 pWInfo->aiCurOnePass[0] = pWInfo->aiCurOnePass[1] = -1;
133765 pWInfo->nLevel = nTabList;
133766 pWInfo->iBreak = pWInfo->iContinue = sqlite3VdbeMakeLabel(v);
133767 pWInfo->wctrlFlags = wctrlFlags;
133768 pWInfo->iLimit = iAuxArg;
@@ -133836,17 +134175,17 @@
133836 /* Analyze all of the subexpressions. */
133837 sqlite3WhereExprAnalyze(pTabList, &pWInfo->sWC);
133838 if( db->mallocFailed ) goto whereBeginError;
133839
133840 if( wctrlFlags & WHERE_WANT_DISTINCT ){
133841 if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pDistinctSet) ){
133842 /* The DISTINCT marking is pointless. Ignore it. */
133843 pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;
133844 }else if( pOrderBy==0 ){
133845 /* Try to ORDER BY the result set to make distinct processing easier */
133846 pWInfo->wctrlFlags |= WHERE_DISTINCTBY;
133847 pWInfo->pOrderBy = pDistinctSet;
133848 }
133849 }
133850
133851 /* Construct the WhereLoop objects */
133852 #if defined(WHERETRACE_ENABLED)
@@ -133918,14 +134257,14 @@
133918 }
133919 }
133920 #endif
133921 /* Attempt to omit tables from the join that do not effect the result */
133922 if( pWInfo->nLevel>=2
133923 && pDistinctSet!=0
133924 && OptimizationEnabled(db, SQLITE_OmitNoopJoin)
133925 ){
133926 Bitmask tabUsed = sqlite3WhereExprListUsage(pMaskSet, pDistinctSet);
133927 if( sWLB.pOrderBy ){
133928 tabUsed |= sqlite3WhereExprListUsage(pMaskSet, sWLB.pOrderBy);
133929 }
133930 while( pWInfo->nLevel>=2 ){
133931 WhereTerm *pTerm, *pEnd;
@@ -134704,166 +135043,166 @@
134704 **
134705 *********** Begin parsing tables **********************************************/
134706 #define YY_ACTTAB_COUNT (1567)
134707 static const YYACTIONTYPE yy_action[] = {
134708 /* 0 */ 325, 832, 351, 825, 5, 203, 203, 819, 99, 100,
134709 /* 10 */ 90, 842, 842, 854, 857, 846, 846, 97, 97, 98,
134710 /* 20 */ 98, 98, 98, 301, 96, 96, 96, 96, 95, 95,
134711 /* 30 */ 94, 94, 94, 93, 351, 325, 977, 977, 824, 824,
134712 /* 40 */ 826, 947, 354, 99, 100, 90, 842, 842, 854, 857,
134713 /* 50 */ 846, 846, 97, 97, 98, 98, 98, 98, 338, 96,
134714 /* 60 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 351,
134715 /* 70 */ 95, 95, 94, 94, 94, 93, 351, 791, 977, 977,
134716 /* 80 */ 325, 94, 94, 94, 93, 351, 792, 75, 99, 100,
134717 /* 90 */ 90, 842, 842, 854, 857, 846, 846, 97, 97, 98,
134718 /* 100 */ 98, 98, 98, 450, 96, 96, 96, 96, 95, 95,
134719 /* 110 */ 94, 94, 94, 93, 351, 1333, 155, 155, 2, 325,
134720 /* 120 */ 275, 146, 132, 52, 52, 93, 351, 99, 100, 90,
134721 /* 130 */ 842, 842, 854, 857, 846, 846, 97, 97, 98, 98,
134722 /* 140 */ 98, 98, 101, 96, 96, 96, 96, 95, 95, 94,
134723 /* 150 */ 94, 94, 93, 351, 958, 958, 325, 268, 428, 413,
134724 /* 160 */ 411, 61, 752, 752, 99, 100, 90, 842, 842, 854,
134725 /* 170 */ 857, 846, 846, 97, 97, 98, 98, 98, 98, 60,
134726 /* 180 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
134727 /* 190 */ 351, 325, 270, 329, 273, 277, 959, 960, 250, 99,
134728 /* 200 */ 100, 90, 842, 842, 854, 857, 846, 846, 97, 97,
134729 /* 210 */ 98, 98, 98, 98, 301, 96, 96, 96, 96, 95,
134730 /* 220 */ 95, 94, 94, 94, 93, 351, 325, 938, 1326, 698,
134731 /* 230 */ 706, 1326, 242, 412, 99, 100, 90, 842, 842, 854,
134732 /* 240 */ 857, 846, 846, 97, 97, 98, 98, 98, 98, 347,
134733 /* 250 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
134734 /* 260 */ 351, 325, 938, 1327, 384, 699, 1327, 381, 379, 99,
134735 /* 270 */ 100, 90, 842, 842, 854, 857, 846, 846, 97, 97,
134736 /* 280 */ 98, 98, 98, 98, 701, 96, 96, 96, 96, 95,
134737 /* 290 */ 95, 94, 94, 94, 93, 351, 325, 92, 89, 178,
134738 /* 300 */ 833, 936, 373, 700, 99, 100, 90, 842, 842, 854,
134739 /* 310 */ 857, 846, 846, 97, 97, 98, 98, 98, 98, 375,
134740 /* 320 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
134741 /* 330 */ 351, 325, 1276, 947, 354, 818, 936, 739, 739, 99,
134742 /* 340 */ 100, 90, 842, 842, 854, 857, 846, 846, 97, 97,
134743 /* 350 */ 98, 98, 98, 98, 230, 96, 96, 96, 96, 95,
134744 /* 360 */ 95, 94, 94, 94, 93, 351, 325, 969, 227, 92,
134745 /* 370 */ 89, 178, 373, 300, 99, 100, 90, 842, 842, 854,
134746 /* 380 */ 857, 846, 846, 97, 97, 98, 98, 98, 98, 921,
134747 /* 390 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
134748 /* 400 */ 351, 325, 449, 447, 447, 447, 147, 737, 737, 99,
134749 /* 410 */ 100, 90, 842, 842, 854, 857, 846, 846, 97, 97,
134750 /* 420 */ 98, 98, 98, 98, 296, 96, 96, 96, 96, 95,
134751 /* 430 */ 95, 94, 94, 94, 93, 351, 325, 419, 231, 958,
134752 /* 440 */ 958, 158, 25, 422, 99, 100, 90, 842, 842, 854,
134753 /* 450 */ 857, 846, 846, 97, 97, 98, 98, 98, 98, 450,
134754 /* 460 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
134755 /* 470 */ 351, 443, 224, 224, 420, 958, 958, 962, 325, 52,
134756 /* 480 */ 52, 959, 960, 176, 415, 78, 99, 100, 90, 842,
134757 /* 490 */ 842, 854, 857, 846, 846, 97, 97, 98, 98, 98,
134758 /* 500 */ 98, 379, 96, 96, 96, 96, 95, 95, 94, 94,
134759 /* 510 */ 94, 93, 351, 325, 428, 418, 298, 959, 960, 962,
134760 /* 520 */ 81, 99, 88, 90, 842, 842, 854, 857, 846, 846,
134761 /* 530 */ 97, 97, 98, 98, 98, 98, 717, 96, 96, 96,
134762 /* 540 */ 96, 95, 95, 94, 94, 94, 93, 351, 325, 843,
134763 /* 550 */ 843, 855, 858, 996, 318, 343, 379, 100, 90, 842,
134764 /* 560 */ 842, 854, 857, 846, 846, 97, 97, 98, 98, 98,
134765 /* 570 */ 98, 450, 96, 96, 96, 96, 95, 95, 94, 94,
134766 /* 580 */ 94, 93, 351, 325, 350, 350, 350, 260, 377, 340,
134767 /* 590 */ 929, 52, 52, 90, 842, 842, 854, 857, 846, 846,
134768 /* 600 */ 97, 97, 98, 98, 98, 98, 361, 96, 96, 96,
134769 /* 610 */ 96, 95, 95, 94, 94, 94, 93, 351, 86, 445,
134770 /* 620 */ 847, 3, 1203, 361, 360, 378, 344, 813, 958, 958,
134771 /* 630 */ 1300, 86, 445, 729, 3, 212, 169, 287, 405, 282,
134772 /* 640 */ 404, 199, 232, 450, 300, 760, 83, 84, 280, 245,
134773 /* 650 */ 262, 365, 251, 85, 352, 352, 92, 89, 178, 83,
134774 /* 660 */ 84, 242, 412, 52, 52, 448, 85, 352, 352, 246,
134775 /* 670 */ 959, 960, 194, 455, 670, 402, 399, 398, 448, 243,
134776 /* 680 */ 221, 114, 434, 776, 361, 450, 397, 268, 747, 224,
134777 /* 690 */ 224, 132, 132, 198, 832, 434, 452, 451, 428, 427,
134778 /* 700 */ 819, 415, 734, 713, 132, 52, 52, 832, 268, 452,
134779 /* 710 */ 451, 734, 194, 819, 363, 402, 399, 398, 450, 1271,
134780 /* 720 */ 1271, 23, 958, 958, 86, 445, 397, 3, 228, 429,
134781 /* 730 */ 895, 824, 824, 826, 827, 19, 203, 720, 52, 52,
134782 /* 740 */ 428, 408, 439, 249, 824, 824, 826, 827, 19, 229,
134783 /* 750 */ 403, 153, 83, 84, 761, 177, 241, 450, 721, 85,
134784 /* 760 */ 352, 352, 120, 157, 959, 960, 58, 977, 409, 355,
134785 /* 770 */ 330, 448, 268, 428, 430, 320, 790, 32, 32, 86,
134786 /* 780 */ 445, 776, 3, 341, 98, 98, 98, 98, 434, 96,
134787 /* 790 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 351,
134788 /* 800 */ 832, 120, 452, 451, 813, 887, 819, 83, 84, 977,
134789 /* 810 */ 813, 132, 410, 920, 85, 352, 352, 132, 407, 789,
134790 /* 820 */ 958, 958, 92, 89, 178, 917, 448, 262, 370, 261,
134791 /* 830 */ 82, 914, 80, 262, 370, 261, 776, 824, 824, 826,
134792 /* 840 */ 827, 19, 934, 434, 96, 96, 96, 96, 95, 95,
134793 /* 850 */ 94, 94, 94, 93, 351, 832, 74, 452, 451, 958,
134794 /* 860 */ 958, 819, 959, 960, 120, 92, 89, 178, 945, 2,
134795 /* 870 */ 918, 965, 268, 1, 976, 76, 445, 762, 3, 708,
134796 /* 880 */ 901, 901, 387, 958, 958, 757, 919, 371, 740, 778,
134797 /* 890 */ 756, 257, 824, 824, 826, 827, 19, 417, 741, 450,
134798 /* 900 */ 24, 959, 960, 83, 84, 369, 958, 958, 177, 226,
134799 /* 910 */ 85, 352, 352, 885, 315, 314, 313, 215, 311, 10,
134800 /* 920 */ 10, 683, 448, 349, 348, 959, 960, 909, 777, 157,
134801 /* 930 */ 120, 958, 958, 337, 776, 416, 711, 310, 450, 434,
134802 /* 940 */ 450, 321, 450, 791, 103, 200, 175, 450, 959, 960,
134803 /* 950 */ 908, 832, 792, 452, 451, 9, 9, 819, 10, 10,
134804 /* 960 */ 52, 52, 51, 51, 180, 716, 248, 10, 10, 171,
134805 /* 970 */ 170, 167, 339, 959, 960, 247, 984, 702, 702, 450,
134806 /* 980 */ 715, 233, 686, 982, 889, 983, 182, 914, 824, 824,
134807 /* 990 */ 826, 827, 19, 183, 256, 423, 132, 181, 394, 10,
134808 /* 1000 */ 10, 889, 891, 749, 958, 958, 917, 268, 985, 198,
134809 /* 1010 */ 985, 349, 348, 425, 415, 299, 817, 832, 326, 825,
134810 /* 1020 */ 120, 332, 133, 819, 268, 98, 98, 98, 98, 91,
134811 /* 1030 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
134812 /* 1040 */ 351, 157, 810, 371, 382, 359, 959, 960, 358, 268,
134813 /* 1050 */ 450, 918, 368, 324, 824, 824, 826, 450, 709, 450,
134814 /* 1060 */ 264, 380, 889, 450, 877, 746, 253, 919, 255, 433,
134815 /* 1070 */ 36, 36, 234, 450, 234, 120, 269, 37, 37, 12,
134816 /* 1080 */ 12, 334, 272, 27, 27, 450, 330, 118, 450, 162,
134817 /* 1090 */ 742, 280, 450, 38, 38, 450, 985, 356, 985, 450,
134818 /* 1100 */ 709, 1210, 450, 132, 450, 39, 39, 450, 40, 40,
134819 /* 1110 */ 450, 362, 41, 41, 450, 42, 42, 450, 254, 28,
134820 /* 1120 */ 28, 450, 29, 29, 31, 31, 450, 43, 43, 450,
134821 /* 1130 */ 44, 44, 450, 714, 45, 45, 450, 11, 11, 767,
134822 /* 1140 */ 450, 46, 46, 450, 268, 450, 105, 105, 450, 47,
134823 /* 1150 */ 47, 450, 48, 48, 450, 237, 33, 33, 450, 172,
134824 /* 1160 */ 49, 49, 450, 50, 50, 34, 34, 274, 122, 122,
134825 /* 1170 */ 450, 123, 123, 450, 124, 124, 450, 898, 56, 56,
134826 /* 1180 */ 450, 897, 35, 35, 450, 267, 450, 817, 450, 817,
134827 /* 1190 */ 106, 106, 450, 53, 53, 385, 107, 107, 450, 817,
134828 /* 1200 */ 108, 108, 817, 450, 104, 104, 121, 121, 119, 119,
134829 /* 1210 */ 450, 117, 112, 112, 450, 276, 450, 225, 111, 111,
134830 /* 1220 */ 450, 730, 450, 109, 109, 450, 673, 674, 675, 912,
134831 /* 1230 */ 110, 110, 317, 998, 55, 55, 57, 57, 692, 331,
134832 /* 1240 */ 54, 54, 26, 26, 696, 30, 30, 317, 937, 197,
134833 /* 1250 */ 196, 195, 335, 281, 336, 446, 331, 745, 689, 436,
134834 /* 1260 */ 440, 444, 120, 72, 386, 223, 175, 345, 757, 933,
134835 /* 1270 */ 20, 286, 319, 756, 815, 372, 374, 202, 202, 202,
134836 /* 1280 */ 263, 395, 285, 74, 208, 21, 696, 719, 718, 884,
134837 /* 1290 */ 120, 120, 120, 120, 120, 754, 278, 828, 77, 74,
134838 /* 1300 */ 726, 727, 785, 783, 880, 202, 999, 208, 894, 893,
134839 /* 1310 */ 894, 893, 694, 816, 763, 116, 774, 1290, 431, 432,
134840 /* 1320 */ 302, 999, 390, 303, 823, 697, 691, 680, 159, 289,
134841 /* 1330 */ 679, 884, 681, 952, 291, 218, 293, 7, 316, 828,
134842 /* 1340 */ 173, 805, 259, 364, 252, 911, 376, 713, 295, 435,
134843 /* 1350 */ 308, 168, 955, 993, 135, 400, 990, 284, 882, 881,
134844 /* 1360 */ 205, 928, 926, 59, 333, 62, 144, 156, 130, 72,
134845 /* 1370 */ 802, 366, 367, 393, 137, 185, 189, 160, 139, 383,
134846 /* 1380 */ 67, 896, 140, 141, 142, 148, 389, 812, 775, 266,
134847 /* 1390 */ 219, 190, 154, 391, 913, 876, 271, 406, 191, 322,
134848 /* 1400 */ 682, 733, 192, 342, 732, 724, 731, 711, 723, 421,
134849 /* 1410 */ 705, 71, 323, 6, 204, 771, 288, 79, 297, 346,
134850 /* 1420 */ 772, 704, 290, 283, 703, 770, 292, 294, 967, 239,
134851 /* 1430 */ 769, 102, 862, 438, 426, 240, 424, 442, 73, 213,
134852 /* 1440 */ 688, 238, 22, 453, 953, 214, 217, 216, 454, 677,
134853 /* 1450 */ 676, 671, 753, 125, 115, 235, 126, 669, 353, 166,
134854 /* 1460 */ 127, 244, 179, 357, 306, 304, 305, 307, 113, 892,
134855 /* 1470 */ 327, 890, 811, 328, 134, 128, 136, 138, 743, 258,
134856 /* 1480 */ 907, 184, 143, 129, 910, 186, 63, 64, 145, 187,
134857 /* 1490 */ 906, 65, 8, 66, 13, 188, 202, 899, 265, 149,
134858 /* 1500 */ 987, 388, 150, 685, 161, 392, 285, 193, 279, 396,
134859 /* 1510 */ 151, 401, 68, 14, 15, 722, 69, 236, 831, 131,
134860 /* 1520 */ 830, 860, 70, 751, 16, 414, 755, 4, 174, 220,
134861 /* 1530 */ 222, 784, 201, 152, 779, 77, 74, 17, 18, 875,
134862 /* 1540 */ 861, 859, 916, 864, 915, 207, 206, 942, 163, 437,
134863 /* 1550 */ 948, 943, 164, 209, 1002, 441, 863, 165, 210, 829,
134864 /* 1560 */ 695, 87, 312, 211, 1292, 1291, 309,
134865 };
134866 static const YYCODETYPE yy_lookahead[] = {
134867 /* 0 */ 19, 95, 53, 97, 22, 24, 24, 101, 27, 28,
134868 /* 10 */ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
134869 /* 20 */ 39, 40, 41, 152, 43, 44, 45, 46, 47, 48,
@@ -135112,55 +135451,55 @@
135112 /* 300 */ 1256, 1200, 1206, 1260, 1247, 1261, 1263, 1262, 1266, 1278,
135113 /* 310 */ 1282, 1292, 1294, 1297, 1298, 1299, 1300, 1221, 1224, 1228,
135114 /* 320 */ 1288, 1291, 1276, 1277, 1295,
135115 };
135116 static const YYACTIONTYPE yy_default[] = {
135117 /* 0 */ 1281, 1271, 1271, 1271, 1203, 1203, 1203, 1203, 1271, 1096,
135118 /* 10 */ 1125, 1125, 1255, 1332, 1332, 1332, 1332, 1332, 1332, 1202,
135119 /* 20 */ 1332, 1332, 1332, 1332, 1271, 1100, 1131, 1332, 1332, 1332,
135120 /* 30 */ 1332, 1204, 1205, 1332, 1332, 1332, 1254, 1256, 1141, 1140,
135121 /* 40 */ 1139, 1138, 1237, 1112, 1136, 1129, 1133, 1204, 1198, 1199,
135122 /* 50 */ 1197, 1201, 1205, 1332, 1132, 1167, 1182, 1166, 1332, 1332,
135123 /* 60 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135124 /* 70 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135125 /* 80 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135126 /* 90 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135127 /* 100 */ 1332, 1332, 1332, 1332, 1176, 1181, 1188, 1180, 1177, 1169,
135128 /* 110 */ 1168, 1170, 1171, 1332, 1019, 1067, 1332, 1332, 1332, 1172,
135129 /* 120 */ 1332, 1173, 1185, 1184, 1183, 1262, 1289, 1288, 1332, 1332,
135130 /* 130 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135131 /* 140 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135132 /* 150 */ 1332, 1332, 1332, 1332, 1332, 1281, 1271, 1025, 1025, 1332,
135133 /* 160 */ 1271, 1271, 1271, 1271, 1271, 1271, 1267, 1100, 1091, 1332,
135134 /* 170 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135135 /* 180 */ 1259, 1257, 1332, 1218, 1332, 1332, 1332, 1332, 1332, 1332,
135136 /* 190 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135137 /* 200 */ 1332, 1332, 1332, 1332, 1096, 1332, 1332, 1332, 1332, 1332,
135138 /* 210 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1283, 1332, 1232,
135139 /* 220 */ 1096, 1096, 1096, 1098, 1080, 1090, 1004, 1135, 1114, 1114,
135140 /* 230 */ 1321, 1135, 1321, 1042, 1303, 1039, 1125, 1114, 1200, 1125,
135141 /* 240 */ 1125, 1097, 1090, 1332, 1324, 1105, 1105, 1323, 1323, 1105,
135142 /* 250 */ 1146, 1070, 1135, 1076, 1076, 1076, 1076, 1105, 1016, 1135,
135143 /* 260 */ 1146, 1070, 1070, 1135, 1105, 1016, 1236, 1318, 1105, 1105,
135144 /* 270 */ 1016, 1211, 1105, 1016, 1105, 1016, 1211, 1068, 1068, 1068,
135145 /* 280 */ 1057, 1211, 1068, 1042, 1068, 1057, 1068, 1068, 1118, 1113,
135146 /* 290 */ 1118, 1113, 1118, 1113, 1118, 1113, 1105, 1206, 1105, 1332,
135147 /* 300 */ 1211, 1215, 1215, 1211, 1130, 1119, 1128, 1126, 1135, 1022,
135148 /* 310 */ 1060, 1286, 1286, 1282, 1282, 1282, 1282, 1329, 1329, 1267,
135149 /* 320 */ 1298, 1298, 1044, 1044, 1298, 1332, 1332, 1332, 1332, 1332,
135150 /* 330 */ 1332, 1293, 1332, 1220, 1332, 1332, 1332, 1332, 1332, 1332,
135151 /* 340 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135152 /* 350 */ 1332, 1332, 1152, 1332, 1000, 1264, 1332, 1332, 1263, 1332,
135153 /* 360 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135154 /* 370 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1320,
135155 /* 380 */ 1332, 1332, 1332, 1332, 1332, 1332, 1235, 1234, 1332, 1332,
135156 /* 390 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135157 /* 400 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135158 /* 410 */ 1332, 1082, 1332, 1332, 1332, 1307, 1332, 1332, 1332, 1332,
135159 /* 420 */ 1332, 1332, 1332, 1127, 1332, 1120, 1332, 1332, 1311, 1332,
135160 /* 430 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1273,
135161 /* 440 */ 1332, 1332, 1332, 1272, 1332, 1332, 1332, 1332, 1332, 1154,
135162 /* 450 */ 1332, 1153, 1157, 1332, 1010, 1332,
135163 };
135164 /********** End of lemon-generated parsing tables *****************************/
135165
135166 /* The next table maps tokens (terminal symbols) into fallback tokens.
@@ -135602,147 +135941,147 @@
135602 /* 169 */ "expr ::= expr EQ|NE expr",
135603 /* 170 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
135604 /* 171 */ "expr ::= expr PLUS|MINUS expr",
135605 /* 172 */ "expr ::= expr STAR|SLASH|REM expr",
135606 /* 173 */ "expr ::= expr CONCAT expr",
135607 /* 174 */ "likeop ::= LIKE_KW|MATCH",
135608 /* 175 */ "likeop ::= NOT LIKE_KW|MATCH",
135609 /* 176 */ "expr ::= expr likeop expr",
135610 /* 177 */ "expr ::= expr likeop expr ESCAPE expr",
135611 /* 178 */ "expr ::= expr ISNULL|NOTNULL",
135612 /* 179 */ "expr ::= expr NOT NULL",
135613 /* 180 */ "expr ::= expr IS expr",
135614 /* 181 */ "expr ::= expr IS NOT expr",
135615 /* 182 */ "expr ::= NOT expr",
135616 /* 183 */ "expr ::= BITNOT expr",
135617 /* 184 */ "expr ::= MINUS expr",
135618 /* 185 */ "expr ::= PLUS expr",
135619 /* 186 */ "between_op ::= BETWEEN",
135620 /* 187 */ "between_op ::= NOT BETWEEN",
135621 /* 188 */ "expr ::= expr between_op expr AND expr",
135622 /* 189 */ "in_op ::= IN",
135623 /* 190 */ "in_op ::= NOT IN",
135624 /* 191 */ "expr ::= expr in_op LP exprlist RP",
135625 /* 192 */ "expr ::= LP select RP",
135626 /* 193 */ "expr ::= expr in_op LP select RP",
135627 /* 194 */ "expr ::= expr in_op nm dbnm paren_exprlist",
135628 /* 195 */ "expr ::= EXISTS LP select RP",
135629 /* 196 */ "expr ::= CASE case_operand case_exprlist case_else END",
135630 /* 197 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
135631 /* 198 */ "case_exprlist ::= WHEN expr THEN expr",
135632 /* 199 */ "case_else ::= ELSE expr",
135633 /* 200 */ "case_else ::=",
135634 /* 201 */ "case_operand ::= expr",
135635 /* 202 */ "case_operand ::=",
135636 /* 203 */ "exprlist ::=",
135637 /* 204 */ "nexprlist ::= nexprlist COMMA expr",
135638 /* 205 */ "nexprlist ::= expr",
135639 /* 206 */ "paren_exprlist ::=",
135640 /* 207 */ "paren_exprlist ::= LP exprlist RP",
135641 /* 208 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
135642 /* 209 */ "uniqueflag ::= UNIQUE",
135643 /* 210 */ "uniqueflag ::=",
135644 /* 211 */ "eidlist_opt ::=",
135645 /* 212 */ "eidlist_opt ::= LP eidlist RP",
135646 /* 213 */ "eidlist ::= eidlist COMMA nm collate sortorder",
135647 /* 214 */ "eidlist ::= nm collate sortorder",
135648 /* 215 */ "collate ::=",
135649 /* 216 */ "collate ::= COLLATE ID|STRING",
135650 /* 217 */ "cmd ::= DROP INDEX ifexists fullname",
135651 /* 218 */ "cmd ::= VACUUM",
135652 /* 219 */ "cmd ::= VACUUM nm",
135653 /* 220 */ "cmd ::= PRAGMA nm dbnm",
135654 /* 221 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
135655 /* 222 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
135656 /* 223 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
135657 /* 224 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
135658 /* 225 */ "plus_num ::= PLUS INTEGER|FLOAT",
135659 /* 226 */ "minus_num ::= MINUS INTEGER|FLOAT",
135660 /* 227 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
135661 /* 228 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
135662 /* 229 */ "trigger_time ::= BEFORE",
135663 /* 230 */ "trigger_time ::= AFTER",
135664 /* 231 */ "trigger_time ::= INSTEAD OF",
135665 /* 232 */ "trigger_time ::=",
135666 /* 233 */ "trigger_event ::= DELETE|INSERT",
135667 /* 234 */ "trigger_event ::= UPDATE",
135668 /* 235 */ "trigger_event ::= UPDATE OF idlist",
135669 /* 236 */ "when_clause ::=",
135670 /* 237 */ "when_clause ::= WHEN expr",
135671 /* 238 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
135672 /* 239 */ "trigger_cmd_list ::= trigger_cmd SEMI",
135673 /* 240 */ "trnm ::= nm DOT nm",
135674 /* 241 */ "tridxby ::= INDEXED BY nm",
135675 /* 242 */ "tridxby ::= NOT INDEXED",
135676 /* 243 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt",
135677 /* 244 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select",
135678 /* 245 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt",
135679 /* 246 */ "trigger_cmd ::= select",
135680 /* 247 */ "expr ::= RAISE LP IGNORE RP",
135681 /* 248 */ "expr ::= RAISE LP raisetype COMMA nm RP",
135682 /* 249 */ "raisetype ::= ROLLBACK",
135683 /* 250 */ "raisetype ::= ABORT",
135684 /* 251 */ "raisetype ::= FAIL",
135685 /* 252 */ "cmd ::= DROP TRIGGER ifexists fullname",
135686 /* 253 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
135687 /* 254 */ "cmd ::= DETACH database_kw_opt expr",
135688 /* 255 */ "key_opt ::=",
135689 /* 256 */ "key_opt ::= KEY expr",
135690 /* 257 */ "cmd ::= REINDEX",
135691 /* 258 */ "cmd ::= REINDEX nm dbnm",
135692 /* 259 */ "cmd ::= ANALYZE",
135693 /* 260 */ "cmd ::= ANALYZE nm dbnm",
135694 /* 261 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
135695 /* 262 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
135696 /* 263 */ "add_column_fullname ::= fullname",
135697 /* 264 */ "cmd ::= create_vtab",
135698 /* 265 */ "cmd ::= create_vtab LP vtabarglist RP",
135699 /* 266 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
135700 /* 267 */ "vtabarg ::=",
135701 /* 268 */ "vtabargtoken ::= ANY",
135702 /* 269 */ "vtabargtoken ::= lp anylist RP",
135703 /* 270 */ "lp ::= LP",
135704 /* 271 */ "with ::=",
135705 /* 272 */ "with ::= WITH wqlist",
135706 /* 273 */ "with ::= WITH RECURSIVE wqlist",
135707 /* 274 */ "wqlist ::= nm eidlist_opt AS LP select RP",
135708 /* 275 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
135709 /* 276 */ "input ::= cmdlist",
135710 /* 277 */ "cmdlist ::= cmdlist ecmd",
135711 /* 278 */ "cmdlist ::= ecmd",
135712 /* 279 */ "ecmd ::= SEMI",
135713 /* 280 */ "ecmd ::= explain cmdx SEMI",
135714 /* 281 */ "explain ::=",
135715 /* 282 */ "trans_opt ::=",
135716 /* 283 */ "trans_opt ::= TRANSACTION",
135717 /* 284 */ "trans_opt ::= TRANSACTION nm",
135718 /* 285 */ "savepoint_opt ::= SAVEPOINT",
135719 /* 286 */ "savepoint_opt ::=",
135720 /* 287 */ "cmd ::= create_table create_table_args",
135721 /* 288 */ "columnlist ::= columnlist COMMA columnname carglist",
135722 /* 289 */ "columnlist ::= columnname carglist",
135723 /* 290 */ "nm ::= ID|INDEXED",
135724 /* 291 */ "nm ::= STRING",
135725 /* 292 */ "nm ::= JOIN_KW",
135726 /* 293 */ "typetoken ::= typename",
135727 /* 294 */ "typename ::= ID|STRING",
135728 /* 295 */ "signed ::= plus_num",
135729 /* 296 */ "signed ::= minus_num",
135730 /* 297 */ "carglist ::= carglist ccons",
135731 /* 298 */ "carglist ::=",
135732 /* 299 */ "ccons ::= NULL onconf",
135733 /* 300 */ "conslist_opt ::= COMMA conslist",
135734 /* 301 */ "conslist ::= conslist tconscomma tcons",
135735 /* 302 */ "conslist ::= tcons",
135736 /* 303 */ "tconscomma ::=",
135737 /* 304 */ "defer_subclause_opt ::= defer_subclause",
135738 /* 305 */ "resolvetype ::= raisetype",
135739 /* 306 */ "selectnowith ::= oneselect",
135740 /* 307 */ "oneselect ::= values",
135741 /* 308 */ "sclp ::= selcollist COMMA",
135742 /* 309 */ "as ::= ID|STRING",
135743 /* 310 */ "expr ::= term",
135744 /* 311 */ "exprlist ::= nexprlist",
135745 /* 312 */ "nmnum ::= plus_num",
135746 /* 313 */ "nmnum ::= nm",
135747 /* 314 */ "nmnum ::= ON",
135748 /* 315 */ "nmnum ::= DELETE",
@@ -136375,11 +136714,10 @@
136375 { 173, 3 },
136376 { 173, 3 },
136377 { 173, 3 },
136378 { 173, 3 },
136379 { 173, 3 },
136380 { 221, 1 },
136381 { 221, 2 },
136382 { 173, 3 },
136383 { 173, 5 },
136384 { 173, 2 },
136385 { 173, 3 },
@@ -136512,10 +136850,11 @@
136512 { 194, 1 },
136513 { 195, 1 },
136514 { 209, 2 },
136515 { 210, 1 },
136516 { 173, 1 },
 
136517 { 208, 1 },
136518 { 230, 1 },
136519 { 230, 1 },
136520 { 230, 1 },
136521 { 230, 1 },
@@ -136654,11 +136993,11 @@
136654 case 42: /* autoinc ::= */ yytestcase(yyruleno==42);
136655 case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57);
136656 case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67);
136657 case 76: /* ifexists ::= */ yytestcase(yyruleno==76);
136658 case 90: /* distinct ::= */ yytestcase(yyruleno==90);
136659 case 215: /* collate ::= */ yytestcase(yyruleno==215);
136660 {yymsp[1].minor.yy194 = 0;}
136661 break;
136662 case 17: /* ifnotexists ::= IF NOT EXISTS */
136663 {yymsp[-2].minor.yy194 = 1;}
136664 break;
@@ -136798,13 +137137,13 @@
136798 case 144: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==144);
136799 {yymsp[-1].minor.yy194 = yymsp[0].minor.yy194;}
136800 break;
136801 case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
136802 case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75);
136803 case 187: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==187);
136804 case 190: /* in_op ::= NOT IN */ yytestcase(yyruleno==190);
136805 case 216: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==216);
136806 {yymsp[-1].minor.yy194 = 1;}
136807 break;
136808 case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
136809 {yymsp[-1].minor.yy194 = 0;}
136810 break;
@@ -136964,13 +137303,13 @@
136964 {yymsp[0].minor.yy194 = SF_All;}
136965 break;
136966 case 91: /* sclp ::= */
136967 case 119: /* orderby_opt ::= */ yytestcase(yyruleno==119);
136968 case 126: /* groupby_opt ::= */ yytestcase(yyruleno==126);
136969 case 203: /* exprlist ::= */ yytestcase(yyruleno==203);
136970 case 206: /* paren_exprlist ::= */ yytestcase(yyruleno==206);
136971 case 211: /* eidlist_opt ::= */ yytestcase(yyruleno==211);
136972 {yymsp[1].minor.yy148 = 0;}
136973 break;
136974 case 92: /* selcollist ::= sclp expr as */
136975 {
136976 yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy148, yymsp[-1].minor.yy190.pExpr);
@@ -136992,12 +137331,12 @@
136992 yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, pDot);
136993 }
136994 break;
136995 case 95: /* as ::= AS nm */
136996 case 106: /* dbnm ::= DOT nm */ yytestcase(yyruleno==106);
136997 case 225: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==225);
136998 case 226: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==226);
136999 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
137000 break;
137001 case 97: /* from ::= */
137002 {yymsp[1].minor.yy185 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy185));}
137003 break;
@@ -137076,18 +137415,18 @@
137076 {yymsp[-3].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
137077 break;
137078 case 112: /* on_opt ::= ON expr */
137079 case 129: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==129);
137080 case 136: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==136);
137081 case 199: /* case_else ::= ELSE expr */ yytestcase(yyruleno==199);
137082 {yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr;}
137083 break;
137084 case 113: /* on_opt ::= */
137085 case 128: /* having_opt ::= */ yytestcase(yyruleno==128);
137086 case 135: /* where_opt ::= */ yytestcase(yyruleno==135);
137087 case 200: /* case_else ::= */ yytestcase(yyruleno==200);
137088 case 202: /* case_operand ::= */ yytestcase(yyruleno==202);
137089 {yymsp[1].minor.yy72 = 0;}
137090 break;
137091 case 115: /* indexed_opt ::= INDEXED BY nm */
137092 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
137093 break;
@@ -137320,17 +137659,14 @@
137320 case 171: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==171);
137321 case 172: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==172);
137322 case 173: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==173);
137323 {spanBinaryExpr(pParse,yymsp[-1].major,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);}
137324 break;
137325 case 174: /* likeop ::= LIKE_KW|MATCH */
137326 {yymsp[0].minor.yy0=yymsp[0].minor.yy0;/*A-overwrites-X*/}
137327 break;
137328 case 175: /* likeop ::= NOT LIKE_KW|MATCH */
137329 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
137330 break;
137331 case 176: /* expr ::= expr likeop expr */
137332 {
137333 ExprList *pList;
137334 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
137335 yymsp[-1].minor.yy0.n &= 0x7fffffff;
137336 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy190.pExpr);
@@ -137339,11 +137675,11 @@
137339 exprNot(pParse, bNot, &yymsp[-2].minor.yy190);
137340 yymsp[-2].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
137341 if( yymsp[-2].minor.yy190.pExpr ) yymsp[-2].minor.yy190.pExpr->flags |= EP_InfixFunc;
137342 }
137343 break;
137344 case 177: /* expr ::= expr likeop expr ESCAPE expr */
137345 {
137346 ExprList *pList;
137347 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
137348 yymsp[-3].minor.yy0.n &= 0x7fffffff;
137349 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
@@ -137353,43 +137689,43 @@
137353 exprNot(pParse, bNot, &yymsp[-4].minor.yy190);
137354 yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
137355 if( yymsp[-4].minor.yy190.pExpr ) yymsp[-4].minor.yy190.pExpr->flags |= EP_InfixFunc;
137356 }
137357 break;
137358 case 178: /* expr ::= expr ISNULL|NOTNULL */
137359 {spanUnaryPostfix(pParse,yymsp[0].major,&yymsp[-1].minor.yy190,&yymsp[0].minor.yy0);}
137360 break;
137361 case 179: /* expr ::= expr NOT NULL */
137362 {spanUnaryPostfix(pParse,TK_NOTNULL,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy0);}
137363 break;
137364 case 180: /* expr ::= expr IS expr */
137365 {
137366 spanBinaryExpr(pParse,TK_IS,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);
137367 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-2].minor.yy190.pExpr, TK_ISNULL);
137368 }
137369 break;
137370 case 181: /* expr ::= expr IS NOT expr */
137371 {
137372 spanBinaryExpr(pParse,TK_ISNOT,&yymsp[-3].minor.yy190,&yymsp[0].minor.yy190);
137373 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-3].minor.yy190.pExpr, TK_NOTNULL);
137374 }
137375 break;
137376 case 182: /* expr ::= NOT expr */
137377 case 183: /* expr ::= BITNOT expr */ yytestcase(yyruleno==183);
137378 {spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,yymsp[-1].major,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
137379 break;
137380 case 184: /* expr ::= MINUS expr */
137381 {spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UMINUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
137382 break;
137383 case 185: /* expr ::= PLUS expr */
137384 {spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UPLUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
137385 break;
137386 case 186: /* between_op ::= BETWEEN */
137387 case 189: /* in_op ::= IN */ yytestcase(yyruleno==189);
137388 {yymsp[0].minor.yy194 = 0;}
137389 break;
137390 case 188: /* expr ::= expr between_op expr AND expr */
137391 {
137392 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
137393 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr);
137394 yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy190.pExpr, 0);
137395 if( yymsp[-4].minor.yy190.pExpr ){
@@ -137399,11 +137735,11 @@
137399 }
137400 exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
137401 yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
137402 }
137403 break;
137404 case 191: /* expr ::= expr in_op LP exprlist RP */
137405 {
137406 if( yymsp[-1].minor.yy148==0 ){
137407 /* Expressions of the form
137408 **
137409 ** expr1 IN ()
@@ -137452,26 +137788,26 @@
137452 exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
137453 }
137454 yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
137455 }
137456 break;
137457 case 192: /* expr ::= LP select RP */
137458 {
137459 spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/
137460 yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
137461 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy190.pExpr, yymsp[-1].minor.yy243);
137462 }
137463 break;
137464 case 193: /* expr ::= expr in_op LP select RP */
137465 {
137466 yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0);
137467 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, yymsp[-1].minor.yy243);
137468 exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
137469 yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
137470 }
137471 break;
137472 case 194: /* expr ::= expr in_op nm dbnm paren_exprlist */
137473 {
137474 SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
137475 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
137476 if( yymsp[0].minor.yy148 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy148);
137477 yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0);
@@ -137478,19 +137814,19 @@
137478 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, pSelect);
137479 exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
137480 yymsp[-4].minor.yy190.zEnd = yymsp[-1].minor.yy0.z ? &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n] : &yymsp[-2].minor.yy0.z[yymsp[-2].minor.yy0.n];
137481 }
137482 break;
137483 case 195: /* expr ::= EXISTS LP select RP */
137484 {
137485 Expr *p;
137486 spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/
137487 p = yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
137488 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy243);
137489 }
137490 break;
137491 case 196: /* expr ::= CASE case_operand case_exprlist case_else END */
137492 {
137493 spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-C*/
137494 yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy72, 0);
137495 if( yymsp[-4].minor.yy190.pExpr ){
137496 yymsp[-4].minor.yy190.pExpr->x.pList = yymsp[-1].minor.yy72 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[-1].minor.yy72) : yymsp[-2].minor.yy148;
@@ -137499,313 +137835,314 @@
137499 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy148);
137500 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy72);
137501 }
137502 }
137503 break;
137504 case 197: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
137505 {
137506 yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[-2].minor.yy190.pExpr);
137507 yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr);
137508 }
137509 break;
137510 case 198: /* case_exprlist ::= WHEN expr THEN expr */
137511 {
137512 yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
137513 yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, yymsp[0].minor.yy190.pExpr);
137514 }
137515 break;
137516 case 201: /* case_operand ::= expr */
137517 {yymsp[0].minor.yy72 = yymsp[0].minor.yy190.pExpr; /*A-overwrites-X*/}
137518 break;
137519 case 204: /* nexprlist ::= nexprlist COMMA expr */
137520 {yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[0].minor.yy190.pExpr);}
137521 break;
137522 case 205: /* nexprlist ::= expr */
137523 {yymsp[0].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy190.pExpr); /*A-overwrites-Y*/}
137524 break;
137525 case 207: /* paren_exprlist ::= LP exprlist RP */
137526 case 212: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==212);
137527 {yymsp[-2].minor.yy148 = yymsp[-1].minor.yy148;}
137528 break;
137529 case 208: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
137530 {
137531 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
137532 sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy148, yymsp[-10].minor.yy194,
137533 &yymsp[-11].minor.yy0, yymsp[0].minor.yy72, SQLITE_SO_ASC, yymsp[-8].minor.yy194, SQLITE_IDXTYPE_APPDEF);
137534 }
137535 break;
137536 case 209: /* uniqueflag ::= UNIQUE */
137537 case 250: /* raisetype ::= ABORT */ yytestcase(yyruleno==250);
137538 {yymsp[0].minor.yy194 = OE_Abort;}
137539 break;
137540 case 210: /* uniqueflag ::= */
137541 {yymsp[1].minor.yy194 = OE_None;}
137542 break;
137543 case 213: /* eidlist ::= eidlist COMMA nm collate sortorder */
137544 {
137545 yymsp[-4].minor.yy148 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194);
137546 }
137547 break;
137548 case 214: /* eidlist ::= nm collate sortorder */
137549 {
137550 yymsp[-2].minor.yy148 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194); /*A-overwrites-Y*/
137551 }
137552 break;
137553 case 217: /* cmd ::= DROP INDEX ifexists fullname */
137554 {sqlite3DropIndex(pParse, yymsp[0].minor.yy185, yymsp[-1].minor.yy194);}
137555 break;
137556 case 218: /* cmd ::= VACUUM */
137557 {sqlite3Vacuum(pParse,0);}
137558 break;
137559 case 219: /* cmd ::= VACUUM nm */
137560 {sqlite3Vacuum(pParse,&yymsp[0].minor.yy0);}
137561 break;
137562 case 220: /* cmd ::= PRAGMA nm dbnm */
137563 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
137564 break;
137565 case 221: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
137566 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
137567 break;
137568 case 222: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
137569 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
137570 break;
137571 case 223: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
137572 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
137573 break;
137574 case 224: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
137575 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
137576 break;
137577 case 227: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
137578 {
137579 Token all;
137580 all.z = yymsp[-3].minor.yy0.z;
137581 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
137582 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy145, &all);
137583 }
137584 break;
137585 case 228: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
137586 {
137587 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy194, yymsp[-4].minor.yy332.a, yymsp[-4].minor.yy332.b, yymsp[-2].minor.yy185, yymsp[0].minor.yy72, yymsp[-10].minor.yy194, yymsp[-8].minor.yy194);
137588 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
137589 }
137590 break;
137591 case 229: /* trigger_time ::= BEFORE */
137592 { yymsp[0].minor.yy194 = TK_BEFORE; }
137593 break;
137594 case 230: /* trigger_time ::= AFTER */
137595 { yymsp[0].minor.yy194 = TK_AFTER; }
137596 break;
137597 case 231: /* trigger_time ::= INSTEAD OF */
137598 { yymsp[-1].minor.yy194 = TK_INSTEAD;}
137599 break;
137600 case 232: /* trigger_time ::= */
137601 { yymsp[1].minor.yy194 = TK_BEFORE; }
137602 break;
137603 case 233: /* trigger_event ::= DELETE|INSERT */
137604 case 234: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==234);
137605 {yymsp[0].minor.yy332.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy332.b = 0;}
137606 break;
137607 case 235: /* trigger_event ::= UPDATE OF idlist */
137608 {yymsp[-2].minor.yy332.a = TK_UPDATE; yymsp[-2].minor.yy332.b = yymsp[0].minor.yy254;}
137609 break;
137610 case 236: /* when_clause ::= */
137611 case 255: /* key_opt ::= */ yytestcase(yyruleno==255);
137612 { yymsp[1].minor.yy72 = 0; }
137613 break;
137614 case 237: /* when_clause ::= WHEN expr */
137615 case 256: /* key_opt ::= KEY expr */ yytestcase(yyruleno==256);
137616 { yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr; }
137617 break;
137618 case 238: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
137619 {
137620 assert( yymsp[-2].minor.yy145!=0 );
137621 yymsp[-2].minor.yy145->pLast->pNext = yymsp[-1].minor.yy145;
137622 yymsp[-2].minor.yy145->pLast = yymsp[-1].minor.yy145;
137623 }
137624 break;
137625 case 239: /* trigger_cmd_list ::= trigger_cmd SEMI */
137626 {
137627 assert( yymsp[-1].minor.yy145!=0 );
137628 yymsp[-1].minor.yy145->pLast = yymsp[-1].minor.yy145;
137629 }
137630 break;
137631 case 240: /* trnm ::= nm DOT nm */
137632 {
137633 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
137634 sqlite3ErrorMsg(pParse,
137635 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
137636 "statements within triggers");
137637 }
137638 break;
137639 case 241: /* tridxby ::= INDEXED BY nm */
137640 {
137641 sqlite3ErrorMsg(pParse,
137642 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
137643 "within triggers");
137644 }
137645 break;
137646 case 242: /* tridxby ::= NOT INDEXED */
137647 {
137648 sqlite3ErrorMsg(pParse,
137649 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
137650 "within triggers");
137651 }
137652 break;
137653 case 243: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
137654 {yymsp[-6].minor.yy145 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy148, yymsp[0].minor.yy72, yymsp[-5].minor.yy194);}
137655 break;
137656 case 244: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */
137657 {yymsp[-4].minor.yy145 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy254, yymsp[0].minor.yy243, yymsp[-4].minor.yy194);/*A-overwrites-R*/}
137658 break;
137659 case 245: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
137660 {yymsp[-4].minor.yy145 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy72);}
137661 break;
137662 case 246: /* trigger_cmd ::= select */
137663 {yymsp[0].minor.yy145 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy243); /*A-overwrites-X*/}
137664 break;
137665 case 247: /* expr ::= RAISE LP IGNORE RP */
137666 {
137667 spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
137668 yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
137669 if( yymsp[-3].minor.yy190.pExpr ){
137670 yymsp[-3].minor.yy190.pExpr->affinity = OE_Ignore;
137671 }
137672 }
137673 break;
137674 case 248: /* expr ::= RAISE LP raisetype COMMA nm RP */
137675 {
137676 spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
137677 yymsp[-5].minor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
137678 if( yymsp[-5].minor.yy190.pExpr ) {
137679 yymsp[-5].minor.yy190.pExpr->affinity = (char)yymsp[-3].minor.yy194;
137680 }
137681 }
137682 break;
137683 case 249: /* raisetype ::= ROLLBACK */
137684 {yymsp[0].minor.yy194 = OE_Rollback;}
137685 break;
137686 case 251: /* raisetype ::= FAIL */
137687 {yymsp[0].minor.yy194 = OE_Fail;}
137688 break;
137689 case 252: /* cmd ::= DROP TRIGGER ifexists fullname */
137690 {
137691 sqlite3DropTrigger(pParse,yymsp[0].minor.yy185,yymsp[-1].minor.yy194);
137692 }
137693 break;
137694 case 253: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
137695 {
137696 sqlite3Attach(pParse, yymsp[-3].minor.yy190.pExpr, yymsp[-1].minor.yy190.pExpr, yymsp[0].minor.yy72);
137697 }
137698 break;
137699 case 254: /* cmd ::= DETACH database_kw_opt expr */
137700 {
137701 sqlite3Detach(pParse, yymsp[0].minor.yy190.pExpr);
137702 }
137703 break;
137704 case 257: /* cmd ::= REINDEX */
137705 {sqlite3Reindex(pParse, 0, 0);}
137706 break;
137707 case 258: /* cmd ::= REINDEX nm dbnm */
137708 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
137709 break;
137710 case 259: /* cmd ::= ANALYZE */
137711 {sqlite3Analyze(pParse, 0, 0);}
137712 break;
137713 case 260: /* cmd ::= ANALYZE nm dbnm */
137714 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
137715 break;
137716 case 261: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
137717 {
137718 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy185,&yymsp[0].minor.yy0);
137719 }
137720 break;
137721 case 262: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
137722 {
137723 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
137724 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
137725 }
137726 break;
137727 case 263: /* add_column_fullname ::= fullname */
137728 {
137729 disableLookaside(pParse);
137730 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy185);
137731 }
137732 break;
137733 case 264: /* cmd ::= create_vtab */
137734 {sqlite3VtabFinishParse(pParse,0);}
137735 break;
137736 case 265: /* cmd ::= create_vtab LP vtabarglist RP */
137737 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
137738 break;
137739 case 266: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
137740 {
137741 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy194);
137742 }
137743 break;
137744 case 267: /* vtabarg ::= */
137745 {sqlite3VtabArgInit(pParse);}
137746 break;
137747 case 268: /* vtabargtoken ::= ANY */
137748 case 269: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==269);
137749 case 270: /* lp ::= LP */ yytestcase(yyruleno==270);
137750 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
137751 break;
137752 case 271: /* with ::= */
137753 {yymsp[1].minor.yy285 = 0;}
137754 break;
137755 case 272: /* with ::= WITH wqlist */
137756 { yymsp[-1].minor.yy285 = yymsp[0].minor.yy285; }
137757 break;
137758 case 273: /* with ::= WITH RECURSIVE wqlist */
137759 { yymsp[-2].minor.yy285 = yymsp[0].minor.yy285; }
137760 break;
137761 case 274: /* wqlist ::= nm eidlist_opt AS LP select RP */
137762 {
137763 yymsp[-5].minor.yy285 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); /*A-overwrites-X*/
137764 }
137765 break;
137766 case 275: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
137767 {
137768 yymsp[-7].minor.yy285 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy285, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243);
137769 }
137770 break;
137771 default:
137772 /* (276) input ::= cmdlist */ yytestcase(yyruleno==276);
137773 /* (277) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==277);
137774 /* (278) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=278);
137775 /* (279) ecmd ::= SEMI */ yytestcase(yyruleno==279);
137776 /* (280) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==280);
137777 /* (281) explain ::= */ yytestcase(yyruleno==281);
137778 /* (282) trans_opt ::= */ yytestcase(yyruleno==282);
137779 /* (283) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==283);
137780 /* (284) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==284);
137781 /* (285) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==285);
137782 /* (286) savepoint_opt ::= */ yytestcase(yyruleno==286);
137783 /* (287) cmd ::= create_table create_table_args */ yytestcase(yyruleno==287);
137784 /* (288) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==288);
137785 /* (289) columnlist ::= columnname carglist */ yytestcase(yyruleno==289);
137786 /* (290) nm ::= ID|INDEXED */ yytestcase(yyruleno==290);
137787 /* (291) nm ::= STRING */ yytestcase(yyruleno==291);
137788 /* (292) nm ::= JOIN_KW */ yytestcase(yyruleno==292);
137789 /* (293) typetoken ::= typename */ yytestcase(yyruleno==293);
137790 /* (294) typename ::= ID|STRING */ yytestcase(yyruleno==294);
137791 /* (295) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=295);
137792 /* (296) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=296);
137793 /* (297) carglist ::= carglist ccons */ yytestcase(yyruleno==297);
137794 /* (298) carglist ::= */ yytestcase(yyruleno==298);
137795 /* (299) ccons ::= NULL onconf */ yytestcase(yyruleno==299);
137796 /* (300) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==300);
137797 /* (301) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==301);
137798 /* (302) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=302);
137799 /* (303) tconscomma ::= */ yytestcase(yyruleno==303);
137800 /* (304) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=304);
137801 /* (305) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=305);
137802 /* (306) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=306);
137803 /* (307) oneselect ::= values */ yytestcase(yyruleno==307);
137804 /* (308) sclp ::= selcollist COMMA */ yytestcase(yyruleno==308);
137805 /* (309) as ::= ID|STRING */ yytestcase(yyruleno==309);
137806 /* (310) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=310);
 
137807 /* (311) exprlist ::= nexprlist */ yytestcase(yyruleno==311);
137808 /* (312) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=312);
137809 /* (313) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=313);
137810 /* (314) nmnum ::= ON */ yytestcase(yyruleno==314);
137811 /* (315) nmnum ::= DELETE */ yytestcase(yyruleno==315);
@@ -181079,11 +181416,13 @@
181079 typedef unsigned short u16;
181080 typedef short i16;
181081 typedef sqlite3_int64 i64;
181082 typedef sqlite3_uint64 u64;
181083
181084 #define ArraySize(x) ((int)(sizeof(x) / sizeof(x[0])))
 
 
181085
181086 #define testcase(x)
181087 #define ALWAYS(x) 1
181088 #define NEVER(x) 0
181089
@@ -186302,11 +186641,14 @@
186302 if( p1->bEof==0 ){
186303 if( (p1->iRowid==iLast)
186304 || (bFromValid && fts5RowidCmp(pExpr, p1->iRowid, iFrom)<0)
186305 ){
186306 int rc = fts5ExprNodeNext(pExpr, p1, bFromValid, iFrom);
186307 if( rc!=SQLITE_OK ) return rc;
 
 
 
186308 }
186309 }
186310 }
186311
186312 fts5ExprNodeTest_OR(pExpr, pNode);
@@ -186333,11 +186675,14 @@
186333 Fts5ExprNode *pChild = pAnd->apChild[iChild];
186334 int cmp = fts5RowidCmp(pExpr, iLast, pChild->iRowid);
186335 if( cmp>0 ){
186336 /* Advance pChild until it points to iLast or laster */
186337 rc = fts5ExprNodeNext(pExpr, pChild, 1, iLast);
186338 if( rc!=SQLITE_OK ) return rc;
 
 
 
186339 }
186340
186341 /* If the child node is now at EOF, so is the parent AND node. Otherwise,
186342 ** the child node is guaranteed to have advanced at least as far as
186343 ** rowid iLast. So if it is not at exactly iLast, pChild->iRowid is the
@@ -186372,10 +186717,12 @@
186372 i64 iFrom
186373 ){
186374 int rc = fts5ExprNodeNext(pExpr, pNode->apChild[0], bFromValid, iFrom);
186375 if( rc==SQLITE_OK ){
186376 rc = fts5ExprNodeTest_AND(pExpr, pNode);
 
 
186377 }
186378 return rc;
186379 }
186380
186381 static int fts5ExprNodeTest_NOT(
@@ -186414,10 +186761,13 @@
186414 ){
186415 int rc = fts5ExprNodeNext(pExpr, pNode->apChild[0], bFromValid, iFrom);
186416 if( rc==SQLITE_OK ){
186417 rc = fts5ExprNodeTest_NOT(pExpr, pNode);
186418 }
 
 
 
186419 return rc;
186420 }
186421
186422 /*
186423 ** If pNode currently points to a match, this function returns SQLITE_OK
@@ -197534,11 +197884,11 @@
197534 int nArg, /* Number of args */
197535 sqlite3_value **apUnused /* Function arguments */
197536 ){
197537 assert( nArg==0 );
197538 UNUSED_PARAM2(nArg, apUnused);
197539 sqlite3_result_text(pCtx, "fts5: 2017-02-13 16:02:40 ada05cfa86ad7f5645450ac7a2a21c9aa6e57d2c", -1, SQLITE_TRANSIENT);
197540 }
197541
197542 static int fts5Init(sqlite3 *db){
197543 static const sqlite3_module fts5Mod = {
197544 /* iVersion */ 2,
197545
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.18.0. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -396,13 +396,13 @@
396 **
397 ** See also: [sqlite3_libversion()],
398 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
399 ** [sqlite_version()] and [sqlite_source_id()].
400 */
401 #define SQLITE_VERSION "3.18.0"
402 #define SQLITE_VERSION_NUMBER 3018000
403 #define SQLITE_SOURCE_ID "2017-02-23 02:15:33 7a959f6d1ea038988cdb4c02d6f37abaec2580a0"
404
405 /*
406 ** CAPI3REF: Run-Time Library Version Numbers
407 ** KEYWORDS: sqlite3_version sqlite3_sourceid
408 **
@@ -12457,10 +12457,11 @@
12457 SQLITE_PRIVATE const void *sqlite3BtreePayloadFetch(BtCursor*, u32 *pAmt);
12458 SQLITE_PRIVATE u32 sqlite3BtreePayloadSize(BtCursor*);
12459
12460 SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*);
12461 SQLITE_PRIVATE struct Pager *sqlite3BtreePager(Btree*);
12462 SQLITE_PRIVATE i64 sqlite3BtreeRowCountEst(BtCursor*);
12463
12464 #ifndef SQLITE_OMIT_INCRBLOB
12465 SQLITE_PRIVATE int sqlite3BtreePayloadChecked(BtCursor*, u32 offset, u32 amt, void*);
12466 SQLITE_PRIVATE int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*);
12467 SQLITE_PRIVATE void sqlite3BtreeIncrblobCursor(BtCursor *);
@@ -12757,117 +12758,119 @@
12758 #define OP_Divide 50 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
12759 #define OP_Remainder 51 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
12760 #define OP_Concat 52 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
12761 #define OP_Last 53
12762 #define OP_BitNot 54 /* same as TK_BITNOT, synopsis: r[P1]= ~r[P1] */
12763 #define OP_IfSmaller 55
12764 #define OP_SorterSort 56
12765 #define OP_Sort 57
12766 #define OP_Rewind 58
12767 #define OP_IdxLE 59 /* synopsis: key=r[P3@P4] */
12768 #define OP_IdxGT 60 /* synopsis: key=r[P3@P4] */
12769 #define OP_IdxLT 61 /* synopsis: key=r[P3@P4] */
12770 #define OP_IdxGE 62 /* synopsis: key=r[P3@P4] */
12771 #define OP_RowSetRead 63 /* synopsis: r[P3]=rowset(P1) */
12772 #define OP_RowSetTest 64 /* synopsis: if r[P3] in rowset(P1) goto P2 */
12773 #define OP_Program 65
12774 #define OP_FkIfZero 66 /* synopsis: if fkctr[P1]==0 goto P2 */
12775 #define OP_IfPos 67 /* synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
12776 #define OP_IfNotZero 68 /* synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
12777 #define OP_DecrJumpZero 69 /* synopsis: if (--r[P1])==0 goto P2 */
12778 #define OP_IncrVacuum 70
12779 #define OP_VNext 71
12780 #define OP_Init 72 /* synopsis: Start at P2 */
12781 #define OP_Return 73
12782 #define OP_EndCoroutine 74
12783 #define OP_HaltIfNull 75 /* synopsis: if r[P3]=null halt */
12784 #define OP_Halt 76
12785 #define OP_Integer 77 /* synopsis: r[P2]=P1 */
12786 #define OP_Int64 78 /* synopsis: r[P2]=P4 */
12787 #define OP_String 79 /* synopsis: r[P2]='P4' (len=P1) */
12788 #define OP_Null 80 /* synopsis: r[P2..P3]=NULL */
12789 #define OP_SoftNull 81 /* synopsis: r[P1]=NULL */
12790 #define OP_Blob 82 /* synopsis: r[P2]=P4 (len=P1) */
12791 #define OP_Variable 83 /* synopsis: r[P2]=parameter(P1,P4) */
12792 #define OP_Move 84 /* synopsis: r[P2@P3]=r[P1@P3] */
12793 #define OP_Copy 85 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
12794 #define OP_SCopy 86 /* synopsis: r[P2]=r[P1] */
12795 #define OP_IntCopy 87 /* synopsis: r[P2]=r[P1] */
12796 #define OP_ResultRow 88 /* synopsis: output=r[P1@P2] */
12797 #define OP_CollSeq 89
12798 #define OP_Function0 90 /* synopsis: r[P3]=func(r[P2@P5]) */
12799 #define OP_Function 91 /* synopsis: r[P3]=func(r[P2@P5]) */
12800 #define OP_AddImm 92 /* synopsis: r[P1]=r[P1]+P2 */
12801 #define OP_RealAffinity 93
12802 #define OP_Cast 94 /* synopsis: affinity(r[P1]) */
12803 #define OP_Permutation 95
12804 #define OP_Compare 96 /* synopsis: r[P1@P3] <-> r[P2@P3] */
12805 #define OP_String8 97 /* same as TK_STRING, synopsis: r[P2]='P4' */
12806 #define OP_Column 98 /* synopsis: r[P3]=PX */
12807 #define OP_Affinity 99 /* synopsis: affinity(r[P1@P2]) */
12808 #define OP_MakeRecord 100 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
12809 #define OP_Count 101 /* synopsis: r[P2]=count() */
12810 #define OP_ReadCookie 102
12811 #define OP_SetCookie 103
12812 #define OP_ReopenIdx 104 /* synopsis: root=P2 iDb=P3 */
12813 #define OP_OpenRead 105 /* synopsis: root=P2 iDb=P3 */
12814 #define OP_OpenWrite 106 /* synopsis: root=P2 iDb=P3 */
12815 #define OP_OpenAutoindex 107 /* synopsis: nColumn=P2 */
12816 #define OP_OpenEphemeral 108 /* synopsis: nColumn=P2 */
12817 #define OP_SorterOpen 109
12818 #define OP_SequenceTest 110 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
12819 #define OP_OpenPseudo 111 /* synopsis: P3 columns in r[P2] */
12820 #define OP_Close 112
12821 #define OP_ColumnsUsed 113
12822 #define OP_Sequence 114 /* synopsis: r[P2]=cursor[P1].ctr++ */
12823 #define OP_NewRowid 115 /* synopsis: r[P2]=rowid */
12824 #define OP_Insert 116 /* synopsis: intkey=r[P3] data=r[P2] */
12825 #define OP_InsertInt 117 /* synopsis: intkey=P3 data=r[P2] */
12826 #define OP_Delete 118
12827 #define OP_ResetCount 119
12828 #define OP_SorterCompare 120 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
12829 #define OP_SorterData 121 /* synopsis: r[P2]=data */
12830 #define OP_RowData 122 /* synopsis: r[P2]=data */
12831 #define OP_Rowid 123 /* synopsis: r[P2]=rowid */
12832 #define OP_NullRow 124
12833 #define OP_SorterInsert 125 /* synopsis: key=r[P2] */
12834 #define OP_IdxInsert 126 /* synopsis: key=r[P2] */
12835 #define OP_IdxDelete 127 /* synopsis: key=r[P2@P3] */
12836 #define OP_Seek 128 /* synopsis: Move P3 to P1.rowid */
12837 #define OP_IdxRowid 129 /* synopsis: r[P2]=rowid */
12838 #define OP_Destroy 130
12839 #define OP_Clear 131
12840 #define OP_Real 132 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
12841 #define OP_ResetSorter 133
12842 #define OP_CreateIndex 134 /* synopsis: r[P2]=root iDb=P1 */
12843 #define OP_CreateTable 135 /* synopsis: r[P2]=root iDb=P1 */
12844 #define OP_SqlExec 136
12845 #define OP_ParseSchema 137
12846 #define OP_LoadAnalysis 138
12847 #define OP_DropTable 139
12848 #define OP_DropIndex 140
12849 #define OP_DropTrigger 141
12850 #define OP_IntegrityCk 142
12851 #define OP_RowSetAdd 143 /* synopsis: rowset(P1)=r[P2] */
12852 #define OP_Param 144
12853 #define OP_FkCounter 145 /* synopsis: fkctr[P1]+=P2 */
12854 #define OP_MemMax 146 /* synopsis: r[P1]=max(r[P1],r[P2]) */
12855 #define OP_OffsetLimit 147 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
12856 #define OP_AggStep0 148 /* synopsis: accum=r[P3] step(r[P2@P5]) */
12857 #define OP_AggStep 149 /* synopsis: accum=r[P3] step(r[P2@P5]) */
12858 #define OP_AggFinal 150 /* synopsis: accum=r[P1] N=P2 */
12859 #define OP_Expire 151
12860 #define OP_TableLock 152 /* synopsis: iDb=P1 root=P2 write=P3 */
12861 #define OP_VBegin 153
12862 #define OP_VCreate 154
12863 #define OP_VDestroy 155
12864 #define OP_VOpen 156
12865 #define OP_VColumn 157 /* synopsis: r[P3]=vcolumn(P2) */
12866 #define OP_VRename 158
12867 #define OP_Pagecount 159
12868 #define OP_MaxPgcnt 160
12869 #define OP_CursorHint 161
12870 #define OP_Noop 162
12871 #define OP_Explain 163
12872
12873 /* Properties such as "out2" or "jump" that are specified in
12874 ** comments following the "case" for each opcode in the vdbe.c
12875 ** are encoded into bitvectors as follows:
12876 */
@@ -12883,32 +12886,32 @@
12886 /* 16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0x03, 0x03, 0x09,\
12887 /* 24 */ 0x09, 0x09, 0x09, 0x26, 0x26, 0x09, 0x09, 0x09,\
12888 /* 32 */ 0x09, 0x09, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\
12889 /* 40 */ 0x0b, 0x0b, 0x01, 0x26, 0x26, 0x26, 0x26, 0x26,\
12890 /* 48 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x01, 0x12, 0x01,\
12891 /* 56 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x23,\
12892 /* 64 */ 0x0b, 0x01, 0x01, 0x03, 0x03, 0x03, 0x01, 0x01,\
12893 /* 72 */ 0x01, 0x02, 0x02, 0x08, 0x00, 0x10, 0x10, 0x10,\
12894 /* 80 */ 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10,\
12895 /* 88 */ 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00,\
12896 /* 96 */ 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\
12897 /* 104 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
12898 /* 112 */ 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,\
12899 /* 120 */ 0x00, 0x00, 0x00, 0x10, 0x00, 0x04, 0x04, 0x00,\
12900 /* 128 */ 0x00, 0x10, 0x10, 0x00, 0x10, 0x00, 0x10, 0x10,\
12901 /* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,\
12902 /* 144 */ 0x10, 0x00, 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00,\
12903 /* 152 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\
12904 /* 160 */ 0x10, 0x00, 0x00, 0x00,}
12905
12906 /* The sqlite3P2Values() routine is able to run faster if it knows
12907 ** the value of the largest JUMP opcode. The smaller the maximum
12908 ** JUMP opcode the better, so the mkopcodeh.tcl script that
12909 ** generated this include file strives to group all JUMP opcodes
12910 ** together near the beginning of the list.
12911 */
12912 #define SQLITE_MX_JUMP_OPCODE 72 /* Maximum JUMP opcode */
12913
12914 /************** End of opcodes.h *********************************************/
12915 /************** Continuing where we left off in vdbe.h ***********************/
12916
12917 /*
@@ -14074,10 +14077,11 @@
14077 u8 suppressErr; /* Do not issue error messages if true */
14078 u8 vtabOnConflict; /* Value to return for s3_vtab_on_conflict() */
14079 u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */
14080 u8 mTrace; /* zero or more SQLITE_TRACE flags */
14081 u8 skipBtreeMutex; /* True if no shared-cache backends */
14082 u8 nSqlExec; /* Number of pending OP_SqlExec opcodes */
14083 int nextPagesize; /* Pagesize after VACUUM if >0 */
14084 u32 magic; /* Magic number for detect library misuse */
14085 int nChange; /* Value returned by sqlite3_changes() */
14086 int nTotalChange; /* Value returned by sqlite3_total_changes() */
14087 int aLimit[SQLITE_N_LIMIT]; /* Limits */
@@ -14589,18 +14593,18 @@
14593 char *zColAff; /* String defining the affinity of each column */
14594 ExprList *pCheck; /* All CHECK constraints */
14595 /* ... also used as column name list in a VIEW */
14596 int tnum; /* Root BTree page for this table */
14597 u32 nTabRef; /* Number of pointers to this Table */
14598 u32 tabFlags; /* Mask of TF_* values */
14599 i16 iPKey; /* If not negative, use aCol[iPKey] as the rowid */
14600 i16 nCol; /* Number of columns in this table */
14601 LogEst nRowLogEst; /* Estimated rows in table - from sqlite_stat1 table */
14602 LogEst szTabRow; /* Estimated size of each table row in bytes */
14603 #ifdef SQLITE_ENABLE_COSTMULT
14604 LogEst costMult; /* Cost multiplier for using this table */
14605 #endif
 
14606 u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */
14607 #ifndef SQLITE_OMIT_ALTERTABLE
14608 int addColOffset; /* Offset in CREATE TABLE stmt to add a new column */
14609 #endif
14610 #ifndef SQLITE_OMIT_VIRTUALTABLE
@@ -14620,27 +14624,29 @@
14624 ** followed by non-hidden columns. Example: "CREATE VIRTUAL TABLE x USING
14625 ** vtab1(a HIDDEN, b);". Since "b" is a non-hidden column but "a" is hidden,
14626 ** the TF_OOOHidden attribute would apply in this case. Such tables require
14627 ** special handling during INSERT processing.
14628 */
14629 #define TF_Readonly 0x0001 /* Read-only system table */
14630 #define TF_Ephemeral 0x0002 /* An ephemeral table */
14631 #define TF_HasPrimaryKey 0x0004 /* Table has a primary key */
14632 #define TF_Autoincrement 0x0008 /* Integer primary key is autoincrement */
14633 #define TF_HasStat1 0x0010 /* nRowLogEst set from sqlite_stat1 */
14634 #define TF_WithoutRowid 0x0020 /* No rowid. PRIMARY KEY is the key */
14635 #define TF_NoVisibleRowid 0x0040 /* No user-visible "rowid" column */
14636 #define TF_OOOHidden 0x0080 /* Out-of-Order hidden columns */
14637 #define TF_StatsUsed 0x0100 /* Query planner decisions affected by
14638 ** Index.aiRowLogEst[] values */
14639 #define TF_HasNotNull 0x0200 /* Contains NOT NULL constraints */
14640
14641 /*
14642 ** Test to see whether or not a table is a virtual table. This is
14643 ** done as a macro so that it will be optimized out when virtual
14644 ** table support is omitted from the build.
14645 */
14646 #ifndef SQLITE_OMIT_VIRTUALTABLE
14647 # define IsVirtual(X) ((X)->nModuleArg)
14648 #else
14649 # define IsVirtual(X) 0
14650 #endif
14651
14652 /*
@@ -14871,10 +14877,11 @@
14877 unsigned bUnordered:1; /* Use this index for == or IN queries only */
14878 unsigned uniqNotNull:1; /* True if UNIQUE and NOT NULL for all columns */
14879 unsigned isResized:1; /* True if resizeIndexObject() has been called */
14880 unsigned isCovering:1; /* True if this is a covering index */
14881 unsigned noSkipScan:1; /* Do not try to use skip-scan if true */
14882 unsigned hasStat1:1; /* aiRowLogEst values come from sqlite_stat1 */
14883 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
14884 int nSample; /* Number of elements in aSample[] */
14885 int nSampleCol; /* Size of IndexSample.anEq[] and so on */
14886 tRowcnt *aAvgEq; /* Average nEq values for keys not in aSample */
14887 IndexSample *aSample; /* Samples of the left-most key */
@@ -15181,11 +15188,11 @@
15188 ** form is used for name resolution with nested FROM clauses.
15189 */
15190 struct ExprList {
15191 int nExpr; /* Number of expressions on the list */
15192 struct ExprList_item { /* For each expression in the list */
15193 Expr *pExpr; /* The parse tree for this expression */
15194 char *zName; /* Token associated with this expression */
15195 char *zSpan; /* Original text of the expression */
15196 u8 sortOrder; /* 1 for DESC or 0 for ASC */
15197 unsigned done :1; /* A flag to indicate when processing is finished */
15198 unsigned bSpanIsTab :1; /* zSpan holds DB.TABLE.COLUMN */
@@ -16504,10 +16511,11 @@
16511 SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*);
16512 SQLITE_PRIVATE void sqlite3Vacuum(Parse*,Token*);
16513 SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*, int);
16514 SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3*, Token*);
16515 SQLITE_PRIVATE int sqlite3ExprCompare(Expr*, Expr*, int);
16516 SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr*, Expr*, int);
16517 SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList*, ExprList*, int);
16518 SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Expr*, Expr*, int);
16519 SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);
16520 SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*);
16521 SQLITE_PRIVATE int sqlite3ExprCoveredByIndex(Expr*, int iCur, Index *pIdx);
@@ -17450,11 +17458,11 @@
17458 "COMPILER=gcc-" __VERSION__,
17459 #endif
17460 #if SQLITE_COVERAGE_TEST
17461 "COVERAGE_TEST",
17462 #endif
17463 #ifdef SQLITE_DEBUG
17464 "DEBUG",
17465 #endif
17466 #if SQLITE_DEFAULT_LOCKING_MODE
17467 "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),
17468 #endif
@@ -24050,12 +24058,12 @@
24058 #ifdef SQLITE_DEBUG
24059 assert( p->nRef>0 || p->owner==0 );
24060 p->owner = tid;
24061 p->nRef++;
24062 if( p->trace ){
24063 OSTRACE(("ENTER-MUTEX tid=%lu, mutex(%d)=%p (%d), nRef=%d\n",
24064 tid, p->id, p, p->trace, p->nRef));
24065 }
24066 #endif
24067 }
24068
24069 static int winMutexTry(sqlite3_mutex *p){
@@ -24093,12 +24101,12 @@
24101 #else
24102 UNUSED_PARAMETER(p);
24103 #endif
24104 #ifdef SQLITE_DEBUG
24105 if( p->trace ){
24106 OSTRACE(("TRY-MUTEX tid=%lu, mutex(%d)=%p (%d), owner=%lu, nRef=%d, rc=%s\n",
24107 tid, p->id, p, p->trace, p->owner, p->nRef, sqlite3ErrName(rc)));
24108 }
24109 #endif
24110 return rc;
24111 }
24112
@@ -24122,12 +24130,12 @@
24130 #endif
24131 assert( winMutex_isInit==1 );
24132 LeaveCriticalSection(&p->mutex);
24133 #ifdef SQLITE_DEBUG
24134 if( p->trace ){
24135 OSTRACE(("LEAVE-MUTEX tid=%lu, mutex(%d)=%p (%d), nRef=%d\n",
24136 tid, p->id, p, p->trace, p->nRef));
24137 }
24138 #endif
24139 }
24140
24141 SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){
@@ -24572,11 +24580,11 @@
24580 return sqlite3GlobalConfig.m.xSize(p);
24581 }
24582 SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3 *db, void *p){
24583 assert( p!=0 );
24584 if( db==0 || !isLookaside(db,p) ){
24585 #ifdef SQLITE_DEBUG
24586 if( db==0 ){
24587 assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );
24588 assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
24589 }else{
24590 assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
@@ -24633,11 +24641,11 @@
24641 measureAllocationSize(db, p);
24642 return;
24643 }
24644 if( isLookaside(db, p) ){
24645 LookasideSlot *pBuf = (LookasideSlot*)p;
24646 #ifdef SQLITE_DEBUG
24647 /* Trash all content in the buffer being freed */
24648 memset(p, 0xaa, db->lookaside.sz);
24649 #endif
24650 pBuf->pNext = db->lookaside.pFree;
24651 db->lookaside.pFree = pBuf;
@@ -25002,11 +25010,11 @@
25010
25011 /*
25012 ** Conversion types fall into various categories as defined by the
25013 ** following enumeration.
25014 */
25015 #define etRADIX 0 /* non-decimal integer types. %x %o */
25016 #define etFLOAT 1 /* Floating point. %f */
25017 #define etEXP 2 /* Exponentional notation. %e and %E */
25018 #define etGENERIC 3 /* Floating or exponential, depending on exponent. %g */
25019 #define etSIZE 4 /* Return number of characters processed so far. %n */
25020 #define etSTRING 5 /* Strings. %s */
@@ -25020,12 +25028,13 @@
25028 #define etTOKEN 11 /* a pointer to a Token structure */
25029 #define etSRCLIST 12 /* a pointer to a SrcList */
25030 #define etPOINTER 13 /* The %p conversion */
25031 #define etSQLESCAPE3 14 /* %w -> Strings with '\"' doubled */
25032 #define etORDINAL 15 /* %r -> 1st, 2nd, 3rd, 4th, etc. English only */
25033 #define etDECIMAL 16 /* %d or %u, but not %x, %o */
25034
25035 #define etINVALID 17 /* Any unrecognized conversion type */
25036
25037
25038 /*
25039 ** An "etByte" is an 8-bit unsigned value.
25040 */
@@ -25045,40 +25054,40 @@
25054 } et_info;
25055
25056 /*
25057 ** Allowed values for et_info.flags
25058 */
25059 #define FLAG_SIGNED 1 /* True if the value to convert is signed */
25060 #define FLAG_STRING 4 /* Allow infinite precision */
25061
25062
25063 /*
25064 ** The following table is searched linearly, so it is good to put the
25065 ** most frequently used conversion types first.
25066 */
25067 static const char aDigits[] = "0123456789ABCDEF0123456789abcdef";
25068 static const char aPrefix[] = "-x0\000X0";
25069 static const et_info fmtinfo[] = {
25070 { 'd', 10, 1, etDECIMAL, 0, 0 },
25071 { 's', 0, 4, etSTRING, 0, 0 },
25072 { 'g', 0, 1, etGENERIC, 30, 0 },
25073 { 'z', 0, 4, etDYNSTRING, 0, 0 },
25074 { 'q', 0, 4, etSQLESCAPE, 0, 0 },
25075 { 'Q', 0, 4, etSQLESCAPE2, 0, 0 },
25076 { 'w', 0, 4, etSQLESCAPE3, 0, 0 },
25077 { 'c', 0, 0, etCHARX, 0, 0 },
25078 { 'o', 8, 0, etRADIX, 0, 2 },
25079 { 'u', 10, 0, etDECIMAL, 0, 0 },
25080 { 'x', 16, 0, etRADIX, 16, 1 },
25081 { 'X', 16, 0, etRADIX, 0, 4 },
25082 #ifndef SQLITE_OMIT_FLOATING_POINT
25083 { 'f', 0, 1, etFLOAT, 0, 0 },
25084 { 'e', 0, 1, etEXP, 30, 0 },
25085 { 'E', 0, 1, etEXP, 14, 0 },
25086 { 'G', 0, 1, etGENERIC, 14, 0 },
25087 #endif
25088 { 'i', 10, 1, etDECIMAL, 0, 0 },
25089 { 'n', 0, 0, etSIZE, 0, 0 },
25090 { '%', 0, 0, etPERCENT, 0, 0 },
25091 { 'p', 16, 0, etPOINTER, 0, 1 },
25092
25093 /* All the rest are undocumented and are for internal use only */
@@ -25166,18 +25175,17 @@
25175 int precision; /* Precision of the current field */
25176 int length; /* Length of the field */
25177 int idx; /* A general purpose loop counter */
25178 int width; /* Width of the current field */
25179 etByte flag_leftjustify; /* True if "-" flag is present */
25180 etByte flag_prefix; /* '+' or ' ' or 0 for prefix */
 
25181 etByte flag_alternateform; /* True if "#" flag is present */
25182 etByte flag_altform2; /* True if "!" flag is present */
25183 etByte flag_zeropad; /* True if field width constant starts with zero */
25184 etByte flag_long; /* 1 for the "l" flag, 2 for "ll", 0 by default */
 
25185 etByte done; /* Loop termination flag */
25186 etByte cThousand; /* Thousands separator for %d and %u */
25187 etByte xtype = etINVALID; /* Conversion paradigm */
25188 u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */
25189 char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
25190 sqlite_uint64 longvalue; /* Value for integer types */
25191 LONGDOUBLE_TYPE realvalue; /* Value for real types */
@@ -25216,21 +25224,22 @@
25224 if( (c=(*++fmt))==0 ){
25225 sqlite3StrAccumAppend(pAccum, "%", 1);
25226 break;
25227 }
25228 /* Find out what flags are present */
25229 flag_leftjustify = flag_prefix = cThousand =
25230 flag_alternateform = flag_altform2 = flag_zeropad = 0;
25231 done = 0;
25232 do{
25233 switch( c ){
25234 case '-': flag_leftjustify = 1; break;
25235 case '+': flag_prefix = '+'; break;
25236 case ' ': flag_prefix = ' '; break;
25237 case '#': flag_alternateform = 1; break;
25238 case '!': flag_altform2 = 1; break;
25239 case '0': flag_zeropad = 1; break;
25240 case ',': cThousand = ','; break;
25241 default: done = 1; break;
25242 }
25243 }while( !done && (c=(*++fmt))!=0 );
25244 /* Get the field width */
25245 if( c=='*' ){
@@ -25296,17 +25305,15 @@
25305 /* Get the conversion type modifier */
25306 if( c=='l' ){
25307 flag_long = 1;
25308 c = *++fmt;
25309 if( c=='l' ){
25310 flag_long = 2;
25311 c = *++fmt;
 
 
25312 }
25313 }else{
25314 flag_long = 0;
25315 }
25316 /* Fetch the info entry for the field */
25317 infop = &fmtinfo[0];
25318 xtype = etINVALID;
25319 for(idx=0; idx<ArraySize(fmtinfo); idx++){
@@ -25320,41 +25327,42 @@
25327 /*
25328 ** At this point, variables are initialized as follows:
25329 **
25330 ** flag_alternateform TRUE if a '#' is present.
25331 ** flag_altform2 TRUE if a '!' is present.
25332 ** flag_prefix '+' or ' ' or zero
25333 ** flag_leftjustify TRUE if a '-' is present or if the
25334 ** field width was negative.
25335 ** flag_zeropad TRUE if the width began with 0.
25336 ** flag_long 1 for "l", 2 for "ll"
 
 
 
 
25337 ** width The specified field width. This is
25338 ** always non-negative. Zero is the default.
25339 ** precision The specified precision. The default
25340 ** is -1.
25341 ** xtype The class of the conversion.
25342 ** infop Pointer to the appropriate info struct.
25343 */
25344 switch( xtype ){
25345 case etPOINTER:
25346 flag_long = sizeof(char*)==sizeof(i64) ? 2 :
25347 sizeof(char*)==sizeof(long int) ? 1 : 0;
25348 /* Fall through into the next case */
25349 case etORDINAL:
25350 case etRADIX:
25351 cThousand = 0;
25352 /* Fall through into the next case */
25353 case etDECIMAL:
25354 if( infop->flags & FLAG_SIGNED ){
25355 i64 v;
25356 if( bArgList ){
25357 v = getIntArg(pArgList);
 
 
25358 }else if( flag_long ){
25359 if( flag_long==2 ){
25360 v = va_arg(ap,i64) ;
25361 }else{
25362 v = va_arg(ap,long int);
25363 }
25364 }else{
25365 v = va_arg(ap,int);
25366 }
25367 if( v<0 ){
25368 if( v==SMALLEST_INT64 ){
@@ -25363,35 +25371,35 @@
25371 longvalue = -v;
25372 }
25373 prefix = '-';
25374 }else{
25375 longvalue = v;
25376 prefix = flag_prefix;
 
 
25377 }
25378 }else{
25379 if( bArgList ){
25380 longvalue = (u64)getIntArg(pArgList);
 
 
25381 }else if( flag_long ){
25382 if( flag_long==2 ){
25383 longvalue = va_arg(ap,u64);
25384 }else{
25385 longvalue = va_arg(ap,unsigned long int);
25386 }
25387 }else{
25388 longvalue = va_arg(ap,unsigned int);
25389 }
25390 prefix = 0;
25391 }
25392 if( longvalue==0 ) flag_alternateform = 0;
25393 if( flag_zeropad && precision<width-(prefix!=0) ){
25394 precision = width-(prefix!=0);
25395 }
25396 if( precision<etBUFSIZE-10-etBUFSIZE/3 ){
25397 nOut = etBUFSIZE;
25398 zOut = buf;
25399 }else{
25400 nOut = precision + 10 + precision/3;
25401 zOut = zExtra = sqlite3Malloc( nOut );
25402 if( zOut==0 ){
25403 setStrAccumError(pAccum, STRACCUM_NOMEM);
25404 return;
25405 }
@@ -25413,12 +25421,27 @@
25421 *(--bufpt) = cset[longvalue%base];
25422 longvalue = longvalue/base;
25423 }while( longvalue>0 );
25424 }
25425 length = (int)(&zOut[nOut-1]-bufpt);
25426 while( precision>length ){
25427 *(--bufpt) = '0'; /* Zero pad */
25428 length++;
25429 }
25430 if( cThousand ){
25431 int nn = (length - 1)/3; /* Number of "," to insert */
25432 int ix = (length - 1)%3 + 1;
25433 bufpt -= nn;
25434 for(idx=0; nn>0; idx++){
25435 bufpt[idx] = bufpt[idx+nn];
25436 ix--;
25437 if( ix==0 ){
25438 bufpt[++idx] = cThousand;
25439 nn--;
25440 ix = 3;
25441 }
25442 }
25443 }
25444 if( prefix ) *(--bufpt) = prefix; /* Add sign */
25445 if( flag_alternateform && infop->prefix ){ /* Add "0" or "0x" */
25446 const char *pre;
25447 char x;
@@ -25441,13 +25464,11 @@
25464 if( precision<0 ) precision = 6; /* Set default precision */
25465 if( realvalue<0.0 ){
25466 realvalue = -realvalue;
25467 prefix = '-';
25468 }else{
25469 prefix = flag_prefix;
 
 
25470 }
25471 if( xtype==etGENERIC && precision>0 ) precision--;
25472 testcase( precision>0xfff );
25473 for(idx=precision&0xfff, rounder=0.5; idx>0; idx--, rounder*=0.1){}
25474 if( xtype==etFLOAT ) realvalue += rounder;
@@ -29464,117 +29485,119 @@
29485 /* 50 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
29486 /* 51 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
29487 /* 52 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
29488 /* 53 */ "Last" OpHelp(""),
29489 /* 54 */ "BitNot" OpHelp("r[P1]= ~r[P1]"),
29490 /* 55 */ "IfSmaller" OpHelp(""),
29491 /* 56 */ "SorterSort" OpHelp(""),
29492 /* 57 */ "Sort" OpHelp(""),
29493 /* 58 */ "Rewind" OpHelp(""),
29494 /* 59 */ "IdxLE" OpHelp("key=r[P3@P4]"),
29495 /* 60 */ "IdxGT" OpHelp("key=r[P3@P4]"),
29496 /* 61 */ "IdxLT" OpHelp("key=r[P3@P4]"),
29497 /* 62 */ "IdxGE" OpHelp("key=r[P3@P4]"),
29498 /* 63 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"),
29499 /* 64 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"),
29500 /* 65 */ "Program" OpHelp(""),
29501 /* 66 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
29502 /* 67 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"),
29503 /* 68 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
29504 /* 69 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
29505 /* 70 */ "IncrVacuum" OpHelp(""),
29506 /* 71 */ "VNext" OpHelp(""),
29507 /* 72 */ "Init" OpHelp("Start at P2"),
29508 /* 73 */ "Return" OpHelp(""),
29509 /* 74 */ "EndCoroutine" OpHelp(""),
29510 /* 75 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
29511 /* 76 */ "Halt" OpHelp(""),
29512 /* 77 */ "Integer" OpHelp("r[P2]=P1"),
29513 /* 78 */ "Int64" OpHelp("r[P2]=P4"),
29514 /* 79 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
29515 /* 80 */ "Null" OpHelp("r[P2..P3]=NULL"),
29516 /* 81 */ "SoftNull" OpHelp("r[P1]=NULL"),
29517 /* 82 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
29518 /* 83 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
29519 /* 84 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
29520 /* 85 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
29521 /* 86 */ "SCopy" OpHelp("r[P2]=r[P1]"),
29522 /* 87 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
29523 /* 88 */ "ResultRow" OpHelp("output=r[P1@P2]"),
29524 /* 89 */ "CollSeq" OpHelp(""),
29525 /* 90 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"),
29526 /* 91 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"),
29527 /* 92 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
29528 /* 93 */ "RealAffinity" OpHelp(""),
29529 /* 94 */ "Cast" OpHelp("affinity(r[P1])"),
29530 /* 95 */ "Permutation" OpHelp(""),
29531 /* 96 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
29532 /* 97 */ "String8" OpHelp("r[P2]='P4'"),
29533 /* 98 */ "Column" OpHelp("r[P3]=PX"),
29534 /* 99 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
29535 /* 100 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
29536 /* 101 */ "Count" OpHelp("r[P2]=count()"),
29537 /* 102 */ "ReadCookie" OpHelp(""),
29538 /* 103 */ "SetCookie" OpHelp(""),
29539 /* 104 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
29540 /* 105 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
29541 /* 106 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
29542 /* 107 */ "OpenAutoindex" OpHelp("nColumn=P2"),
29543 /* 108 */ "OpenEphemeral" OpHelp("nColumn=P2"),
29544 /* 109 */ "SorterOpen" OpHelp(""),
29545 /* 110 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
29546 /* 111 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
29547 /* 112 */ "Close" OpHelp(""),
29548 /* 113 */ "ColumnsUsed" OpHelp(""),
29549 /* 114 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
29550 /* 115 */ "NewRowid" OpHelp("r[P2]=rowid"),
29551 /* 116 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
29552 /* 117 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"),
29553 /* 118 */ "Delete" OpHelp(""),
29554 /* 119 */ "ResetCount" OpHelp(""),
29555 /* 120 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
29556 /* 121 */ "SorterData" OpHelp("r[P2]=data"),
29557 /* 122 */ "RowData" OpHelp("r[P2]=data"),
29558 /* 123 */ "Rowid" OpHelp("r[P2]=rowid"),
29559 /* 124 */ "NullRow" OpHelp(""),
29560 /* 125 */ "SorterInsert" OpHelp("key=r[P2]"),
29561 /* 126 */ "IdxInsert" OpHelp("key=r[P2]"),
29562 /* 127 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
29563 /* 128 */ "Seek" OpHelp("Move P3 to P1.rowid"),
29564 /* 129 */ "IdxRowid" OpHelp("r[P2]=rowid"),
29565 /* 130 */ "Destroy" OpHelp(""),
29566 /* 131 */ "Clear" OpHelp(""),
29567 /* 132 */ "Real" OpHelp("r[P2]=P4"),
29568 /* 133 */ "ResetSorter" OpHelp(""),
29569 /* 134 */ "CreateIndex" OpHelp("r[P2]=root iDb=P1"),
29570 /* 135 */ "CreateTable" OpHelp("r[P2]=root iDb=P1"),
29571 /* 136 */ "SqlExec" OpHelp(""),
29572 /* 137 */ "ParseSchema" OpHelp(""),
29573 /* 138 */ "LoadAnalysis" OpHelp(""),
29574 /* 139 */ "DropTable" OpHelp(""),
29575 /* 140 */ "DropIndex" OpHelp(""),
29576 /* 141 */ "DropTrigger" OpHelp(""),
29577 /* 142 */ "IntegrityCk" OpHelp(""),
29578 /* 143 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
29579 /* 144 */ "Param" OpHelp(""),
29580 /* 145 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
29581 /* 146 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
29582 /* 147 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
29583 /* 148 */ "AggStep0" OpHelp("accum=r[P3] step(r[P2@P5])"),
29584 /* 149 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
29585 /* 150 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
29586 /* 151 */ "Expire" OpHelp(""),
29587 /* 152 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
29588 /* 153 */ "VBegin" OpHelp(""),
29589 /* 154 */ "VCreate" OpHelp(""),
29590 /* 155 */ "VDestroy" OpHelp(""),
29591 /* 156 */ "VOpen" OpHelp(""),
29592 /* 157 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
29593 /* 158 */ "VRename" OpHelp(""),
29594 /* 159 */ "Pagecount" OpHelp(""),
29595 /* 160 */ "MaxPgcnt" OpHelp(""),
29596 /* 161 */ "CursorHint" OpHelp(""),
29597 /* 162 */ "Noop" OpHelp(""),
29598 /* 163 */ "Explain" OpHelp(""),
29599 };
29600 return azName[i];
29601 }
29602 #endif
29603
@@ -37952,46 +37975,84 @@
37975 * be freed immediately and any attempt to access any of that freed
37976 * data will almost certainly result in an immediate access violation.
37977 ******************************************************************************
37978 */
37979 #ifndef SQLITE_WIN32_HEAP_CREATE
37980 # define SQLITE_WIN32_HEAP_CREATE (TRUE)
37981 #endif
37982
37983 /*
37984 * This is the maximum possible initial size of the Win32-specific heap, in
37985 * bytes.
37986 */
37987 #ifndef SQLITE_WIN32_HEAP_MAX_INIT_SIZE
37988 # define SQLITE_WIN32_HEAP_MAX_INIT_SIZE (4294967295U)
37989 #endif
37990
37991 /*
37992 * This is the extra space for the initial size of the Win32-specific heap,
37993 * in bytes. This value may be zero.
37994 */
37995 #ifndef SQLITE_WIN32_HEAP_INIT_EXTRA
37996 # define SQLITE_WIN32_HEAP_INIT_EXTRA (4194304)
37997 #endif
37998
37999 /*
38000 * Calculate the maximum legal cache size, in pages, based on the maximum
38001 * possible initial heap size and the default page size, setting aside the
38002 * needed extra space.
38003 */
38004 #ifndef SQLITE_WIN32_MAX_CACHE_SIZE
38005 # define SQLITE_WIN32_MAX_CACHE_SIZE (((SQLITE_WIN32_HEAP_MAX_INIT_SIZE) - \
38006 (SQLITE_WIN32_HEAP_INIT_EXTRA)) / \
38007 (SQLITE_DEFAULT_PAGE_SIZE))
38008 #endif
38009
38010 /*
38011 * This is cache size used in the calculation of the initial size of the
38012 * Win32-specific heap. It cannot be negative.
38013 */
38014 #ifndef SQLITE_WIN32_CACHE_SIZE
38015 # if SQLITE_DEFAULT_CACHE_SIZE>=0
38016 # define SQLITE_WIN32_CACHE_SIZE (SQLITE_DEFAULT_CACHE_SIZE)
38017 # else
38018 # define SQLITE_WIN32_CACHE_SIZE (-(SQLITE_DEFAULT_CACHE_SIZE))
38019 # endif
38020 #endif
38021
38022 /*
38023 * Make sure that the calculated cache size, in pages, cannot cause the
38024 * initial size of the Win32-specific heap to exceed the maximum amount
38025 * of memory that can be specified in the call to HeapCreate.
38026 */
38027 #if SQLITE_WIN32_CACHE_SIZE>SQLITE_WIN32_MAX_CACHE_SIZE
38028 # undef SQLITE_WIN32_CACHE_SIZE
38029 # define SQLITE_WIN32_CACHE_SIZE (2000)
38030 #endif
38031
38032 /*
38033 * The initial size of the Win32-specific heap. This value may be zero.
38034 */
38035 #ifndef SQLITE_WIN32_HEAP_INIT_SIZE
38036 # define SQLITE_WIN32_HEAP_INIT_SIZE ((SQLITE_WIN32_CACHE_SIZE) * \
38037 (SQLITE_DEFAULT_PAGE_SIZE) + \
38038 (SQLITE_WIN32_HEAP_INIT_EXTRA))
38039 #endif
38040
38041 /*
38042 * The maximum size of the Win32-specific heap. This value may be zero.
38043 */
38044 #ifndef SQLITE_WIN32_HEAP_MAX_SIZE
38045 # define SQLITE_WIN32_HEAP_MAX_SIZE (0)
38046 #endif
38047
38048 /*
38049 * The extra flags to use in calls to the Win32 heap APIs. This value may be
38050 * zero for the default behavior.
38051 */
38052 #ifndef SQLITE_WIN32_HEAP_FLAGS
38053 # define SQLITE_WIN32_HEAP_FLAGS (0)
38054 #endif
38055
38056
38057 /*
38058 ** The winMemData structure stores information required by the Win32-specific
@@ -44084,11 +44145,11 @@
44145 ** This routine is for use inside of assert() statements only. For
44146 ** example:
44147 **
44148 ** assert( sqlite3PcachePageSanity(pPg) );
44149 */
44150 #ifdef SQLITE_DEBUG
44151 SQLITE_PRIVATE int sqlite3PcachePageSanity(PgHdr *pPg){
44152 PCache *pCache;
44153 assert( pPg!=0 );
44154 assert( pPg->pgno>0 || pPg->pPager==0 ); /* Page number is 1 or more */
44155 pCache = pPg->pCache;
@@ -63636,11 +63697,11 @@
63697 pCur->aiIdx[pCur->iPage] = 0;
63698 return getAndInitPage(pBt, newPgno, &pCur->apPage[pCur->iPage],
63699 pCur, pCur->curPagerFlags);
63700 }
63701
63702 #ifdef SQLITE_DEBUG
63703 /*
63704 ** Page pParent is an internal (non-leaf) tree page. This function
63705 ** asserts that page number iChild is the left-child if the iIdx'th
63706 ** cell in page pParent. Or, if iIdx is equal to the total number of
63707 ** cells in pParent, that page number iChild is the right-child of
@@ -64178,10 +64239,34 @@
64239 ** have been deleted? This API will need to change to return an error code
64240 ** as well as the boolean result value.
64241 */
64242 return (CURSOR_VALID!=pCur->eState);
64243 }
64244
64245 /*
64246 ** Return an estimate for the number of rows in the table that pCur is
64247 ** pointing to. Return a negative number if no estimate is currently
64248 ** available.
64249 */
64250 SQLITE_PRIVATE i64 sqlite3BtreeRowCountEst(BtCursor *pCur){
64251 i64 n;
64252 u8 i;
64253
64254 assert( cursorOwnsBtShared(pCur) );
64255 assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
64256
64257 /* Currently this interface is only called by the OP_IfSmaller
64258 ** opcode, and it that case the cursor will always be valid and
64259 ** will always point to a leaf node. */
64260 if( NEVER(pCur->eState!=CURSOR_VALID) ) return -1;
64261 if( NEVER(pCur->apPage[pCur->iPage]->leaf==0) ) return -1;
64262
64263 for(n=1, i=0; i<=pCur->iPage; i++){
64264 n *= pCur->apPage[i]->nCell;
64265 }
64266 return n;
64267 }
64268
64269 /*
64270 ** Advance the cursor to the next entry in the database. If
64271 ** successful then set *pRes=0. If the cursor
64272 ** was already pointing to the last entry in the database before
@@ -65023,11 +65108,11 @@
65108 ** pPrior Where to write the pgno of the first overflow page
65109 **
65110 ** Use a call to btreeParseCellPtr() to verify that the values above
65111 ** were computed correctly.
65112 */
65113 #ifdef SQLITE_DEBUG
65114 {
65115 CellInfo info;
65116 pPage->xParseCell(pPage, pCell, &info);
65117 assert( nHeader==(int)(info.pPayload - pCell) );
65118 assert( info.nKey==pX->nKey );
@@ -73753,17 +73838,17 @@
73838 ** Then the internal cache might have been left in an inconsistent
73839 ** state. We need to rollback the statement transaction, if there is
73840 ** one, or the complete transaction if there is no statement transaction.
73841 */
73842
73843 if( p->magic!=VDBE_MAGIC_RUN ){
73844 return SQLITE_OK;
73845 }
73846 if( db->mallocFailed ){
73847 p->rc = SQLITE_NOMEM_BKPT;
73848 }
73849 closeAllCursors(p);
 
 
 
73850 checkActiveVdbeCnt(db);
73851
73852 /* No commit or rollback needed if the program never started or if the
73853 ** SQL statement does not read or write a database file. */
73854 if( p->pc>=0 && p->bIsReader ){
@@ -74706,11 +74791,11 @@
74791 }
74792 assert( u<=pKeyInfo->nField + 1 );
74793 p->nField = u;
74794 }
74795
74796 #ifdef SQLITE_DEBUG
74797 /*
74798 ** This function compares two index or table record keys in the same way
74799 ** as the sqlite3VdbeRecordCompare() routine. Unlike VdbeRecordCompare(),
74800 ** this function deserializes and compares values using the
74801 ** sqlite3VdbeSerialGet() and sqlite3MemCompare() functions. It is used
@@ -74811,11 +74896,11 @@
74896 if( pKeyInfo->db->mallocFailed ) return 1;
74897 return 0;
74898 }
74899 #endif
74900
74901 #ifdef SQLITE_DEBUG
74902 /*
74903 ** Count the number of fields (a.k.a. columns) in the record given by
74904 ** pKey,nKey. The verify that this count is less than or equal to the
74905 ** limit given by pKeyInfo->nField + pKeyInfo->nXField.
74906 **
@@ -79658,39 +79743,39 @@
79743 if( pCtx->pOut != pOut ){
79744 pCtx->pOut = pOut;
79745 for(i=pCtx->argc-1; i>=0; i--) pCtx->argv[i] = &aMem[pOp->p2+i];
79746 }
79747
79748 memAboutToChange(p, pOut);
79749 #ifdef SQLITE_DEBUG
79750 for(i=0; i<pCtx->argc; i++){
79751 assert( memIsValid(pCtx->argv[i]) );
79752 REGISTER_TRACE(pOp->p2+i, pCtx->argv[i]);
79753 }
79754 #endif
79755 MemSetTypeFlag(pOut, MEM_Null);
79756 pCtx->fErrorOrAux = 0;
79757 (*pCtx->pFunc->xSFunc)(pCtx, pCtx->argc, pCtx->argv);/* IMP: R-24505-23230 */
79758
79759 /* If the function returned an error, throw an exception */
79760 if( pCtx->fErrorOrAux ){
79761 if( pCtx->isError ){
79762 sqlite3VdbeError(p, "%s", sqlite3_value_text(pOut));
79763 rc = pCtx->isError;
79764 }
79765 sqlite3VdbeDeleteAuxData(db, &p->pAuxData, pCtx->iOp, pOp->p1);
79766 if( rc ) goto abort_due_to_error;
79767 }
79768
79769 /* Copy the result of the function into register P3 */
79770 if( pOut->flags & (MEM_Str|MEM_Blob) ){
79771 sqlite3VdbeChangeEncoding(pOut, encoding);
79772 if( sqlite3VdbeMemTooBig(pOut) ) goto too_big;
79773 }
79774
79775 REGISTER_TRACE(pOp->p3, pOut);
79776 UPDATE_MAX_BLOBSIZE(pOut);
79777 break;
79778 }
79779
79780 /* Opcode: BitAnd P1 P2 P3 * *
79781 ** Synopsis: r[P3]=r[P1]&r[P2]
@@ -80187,11 +80272,11 @@
80272 pKeyInfo = pOp->p4.pKeyInfo;
80273 assert( n>0 );
80274 assert( pKeyInfo!=0 );
80275 p1 = pOp->p1;
80276 p2 = pOp->p2;
80277 #ifdef SQLITE_DEBUG
80278 if( aPermute ){
80279 int k, mx = 0;
80280 for(k=0; k<n; k++) if( aPermute[k]>mx ) mx = aPermute[k];
80281 assert( p1>0 && p1+mx<=(p->nMem+1 - p->nCursor)+1 );
80282 assert( p2>0 && p2+mx<=(p->nMem+1 - p->nCursor)+1 );
@@ -82836,10 +82921,37 @@
82921 assert( pOp->p2==0 );
82922 }
82923 break;
82924 }
82925
82926 /* Opcode: IfSmaller P1 P2 P3 * *
82927 **
82928 ** Estimate the number of rows in the table P1. Jump to P2 if that
82929 ** estimate is less than approximately 2**(0.1*P3).
82930 */
82931 case OP_IfSmaller: { /* jump */
82932 VdbeCursor *pC;
82933 BtCursor *pCrsr;
82934 int res;
82935 i64 sz;
82936
82937 assert( pOp->p1>=0 && pOp->p1<p->nCursor );
82938 pC = p->apCsr[pOp->p1];
82939 assert( pC!=0 );
82940 pCrsr = pC->uc.pCursor;
82941 assert( pCrsr );
82942 rc = sqlite3BtreeFirst(pCrsr, &res);
82943 if( rc ) goto abort_due_to_error;
82944 if( res==0 ){
82945 sz = sqlite3BtreeRowCountEst(pCrsr);
82946 if( ALWAYS(sz>=0) && sqlite3LogEst((u64)sz)<pOp->p3 ) res = 1;
82947 }
82948 VdbeBranchTaken(res!=0,2);
82949 if( res ) goto jump_to_p2;
82950 break;
82951 }
82952
82953
82954 /* Opcode: SorterSort P1 P2 * * *
82955 **
82956 ** After all records have been inserted into the Sorter object
82957 ** identified by P1, invoke this opcode to actually do the sorting.
@@ -83479,10 +83591,22 @@
83591 rc = sqlite3BtreeCreateTable(pDb->pBt, &pgno, flags);
83592 if( rc ) goto abort_due_to_error;
83593 pOut->u.i = pgno;
83594 break;
83595 }
83596
83597 /* Opcode: SqlExec * * * P4 *
83598 **
83599 ** Run the SQL statement or statements specified in the P4 string.
83600 */
83601 case OP_SqlExec: {
83602 db->nSqlExec++;
83603 rc = sqlite3_exec(db, pOp->p4.z, 0, 0, 0);
83604 db->nSqlExec--;
83605 if( rc ) goto abort_due_to_error;
83606 break;
83607 }
83608
83609 /* Opcode: ParseSchema P1 * * P4 *
83610 **
83611 ** Read and parse all entries from the SQLITE_MASTER table of database P1
83612 ** that match the WHERE clause P4.
@@ -83600,11 +83724,11 @@
83724 **
83725 ** Do an analysis of the currently open database. Store in
83726 ** register P1 the text of an error message describing any problems.
83727 ** If no problems are found, store a NULL in register P1.
83728 **
83729 ** The register P3 contains one less than the maximum number of allowed errors.
83730 ** At most reg(P3) errors will be reported.
83731 ** In other words, the analysis stops as soon as reg(P1) errors are
83732 ** seen. Reg(P1) is updated with the number of errors remaining.
83733 **
83734 ** The root page numbers of all tables in the database are integers
@@ -83633,18 +83757,18 @@
83757 assert( (pnErr->flags & (MEM_Str|MEM_Blob))==0 );
83758 pIn1 = &aMem[pOp->p1];
83759 assert( pOp->p5<db->nDb );
83760 assert( DbMaskTest(p->btreeMask, pOp->p5) );
83761 z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p5].pBt, aRoot, nRoot,
83762 (int)pnErr->u.i+1, &nErr);
 
83763 sqlite3VdbeMemSetNull(pIn1);
83764 if( nErr==0 ){
83765 assert( z==0 );
83766 }else if( z==0 ){
83767 goto no_mem;
83768 }else{
83769 pnErr->u.i -= nErr-1;
83770 sqlite3VdbeMemSetStr(pIn1, z, -1, SQLITE_UTF8, sqlite3_free);
83771 }
83772 UPDATE_MAX_BLOBSIZE(pIn1);
83773 sqlite3VdbeChangeEncoding(pIn1, encoding);
83774 break;
@@ -92833,11 +92957,11 @@
92957 int nVal = sqlite3ExprVectorSize(pLeft);
92958 Select *pSelect = (pExpr->flags & EP_xIsSelect) ? pExpr->x.pSelect : 0;
92959 char *zRet;
92960
92961 assert( pExpr->op==TK_IN );
92962 zRet = sqlite3DbMallocRaw(pParse->db, nVal+1);
92963 if( zRet ){
92964 int i;
92965 for(i=0; i<nVal; i++){
92966 Expr *pA = sqlite3VectorFieldSubexpr(pLeft, i);
92967 char a = sqlite3ExprAffinity(pA);
@@ -93738,11 +93862,11 @@
93862 ** Clear all column cache entries.
93863 */
93864 SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse *pParse){
93865 int i;
93866
93867 #ifdef SQLITE_DEBUG
93868 if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
93869 printf("CLEAR\n");
93870 }
93871 #endif
93872 for(i=0; i<pParse->nColCache; i++){
@@ -95145,10 +95269,21 @@
95269 if( pA->a[i].sortOrder!=pB->a[i].sortOrder ) return 1;
95270 if( sqlite3ExprCompare(pExprA, pExprB, iTab) ) return 1;
95271 }
95272 return 0;
95273 }
95274
95275 /*
95276 ** Like sqlite3ExprCompare() except COLLATE operators at the top-level
95277 ** are ignored.
95278 */
95279 SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){
95280 return sqlite3ExprCompare(
95281 sqlite3ExprSkipCollate(pA),
95282 sqlite3ExprSkipCollate(pB),
95283 iTab);
95284 }
95285
95286 /*
95287 ** Return true if we can prove the pE2 will always be true if pE1 is
95288 ** true. Return false if we cannot complete the proof or if pE2 might
95289 ** be false. Examples:
@@ -96698,10 +96833,11 @@
96833 Stat4Sample current; /* Current row as a Stat4Sample */
96834 u32 iPrn; /* Pseudo-random number used for sampling */
96835 Stat4Sample *aBest; /* Array of nCol best samples */
96836 int iMin; /* Index in a[] of entry with minimum score */
96837 int nSample; /* Current number of samples */
96838 int nMaxEqZero; /* Max leading 0 in anEq[] for any a[] entry */
96839 int iGet; /* Index of current sample accessed by stat_get() */
96840 Stat4Sample *a; /* Array of mxSample Stat4Sample objects */
96841 sqlite3 *db; /* Database connection, for malloc() */
96842 };
96843
@@ -96962,10 +97098,17 @@
97098 int i;
97099
97100 assert( IsStat4 || nEqZero==0 );
97101
97102 #ifdef SQLITE_ENABLE_STAT4
97103 /* Stat4Accum.nMaxEqZero is set to the maximum number of leading 0
97104 ** values in the anEq[] array of any sample in Stat4Accum.a[]. In
97105 ** other words, if nMaxEqZero is n, then it is guaranteed that there
97106 ** are no samples with Stat4Sample.anEq[m]==0 for (m>=n). */
97107 if( nEqZero>p->nMaxEqZero ){
97108 p->nMaxEqZero = nEqZero;
97109 }
97110 if( pNew->isPSample==0 ){
97111 Stat4Sample *pUpgrade = 0;
97112 assert( pNew->anEq[pNew->iCol]>0 );
97113
97114 /* This sample is being added because the prefix that ends in column
@@ -97059,16 +97202,26 @@
97202 if( p->nSample<p->mxSample || sampleIsBetter(p, pBest, &p->a[p->iMin]) ){
97203 sampleInsert(p, pBest, i);
97204 }
97205 }
97206
97207 /* Check that no sample contains an anEq[] entry with an index of
97208 ** p->nMaxEqZero or greater set to zero. */
97209 for(i=p->nSample-1; i>=0; i--){
97210 int j;
97211 for(j=p->nMaxEqZero; j<p->nCol; j++) assert( p->a[i].anEq[j]>0 );
97212 }
97213
97214 /* Update the anEq[] fields of any samples already collected. */
97215 if( iChng<p->nMaxEqZero ){
97216 for(i=p->nSample-1; i>=0; i--){
97217 int j;
97218 for(j=iChng; j<p->nCol; j++){
97219 if( p->a[i].anEq[j]==0 ) p->a[i].anEq[j] = p->current.anEq[j];
97220 }
97221 }
97222 p->nMaxEqZero = iChng;
97223 }
97224 #endif
97225
97226 #if defined(SQLITE_ENABLE_STAT3) && !defined(SQLITE_ENABLE_STAT4)
97227 if( iChng==0 ){
@@ -97778,44 +97931,32 @@
97931 /* Form 1: Analyze everything */
97932 for(i=0; i<db->nDb; i++){
97933 if( i==1 ) continue; /* Do not analyze the TEMP database */
97934 analyzeDatabase(pParse, i);
97935 }
97936 }else if( pName2->n==0 && (iDb = sqlite3FindDb(db, pName1))>=0 ){
97937 /* Analyze the schema named as the argument */
97938 analyzeDatabase(pParse, iDb);
97939 }else{
97940 /* Form 3: Analyze the table or index named as an argument */
 
 
 
 
 
 
 
 
 
 
 
 
 
97941 iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pTableName);
97942 if( iDb>=0 ){
97943 zDb = pName2->n ? db->aDb[iDb].zDbSName : 0;
97944 z = sqlite3NameFromToken(db, pTableName);
97945 if( z ){
97946 if( (pIdx = sqlite3FindIndex(db, z, zDb))!=0 ){
97947 analyzeTable(pParse, pIdx->pTable, pIdx);
97948 }else if( (pTab = sqlite3LocateTable(pParse, 0, z, zDb))!=0 ){
97949 analyzeTable(pParse, pTab, 0);
97950 }
97951 sqlite3DbFree(db, z);
97952 }
97953 }
97954 }
97955 if( db->nSqlExec==0 && (v = sqlite3GetVdbe(pParse))!=0 ){
97956 sqlite3VdbeAddOp0(v, OP_Expire);
97957 }
97958 }
97959
97960 /*
97961 ** Used to pass information from the analyzer reader through to the
97962 ** callback routine.
@@ -97940,19 +98081,24 @@
98081 }
98082 aiRowEst = pIndex->aiRowEst;
98083 #endif
98084 pIndex->bUnordered = 0;
98085 decodeIntArray((char*)z, nCol, aiRowEst, pIndex->aiRowLogEst, pIndex);
98086 pIndex->hasStat1 = 1;
98087 if( pIndex->pPartIdxWhere==0 ){
98088 pTable->nRowLogEst = pIndex->aiRowLogEst[0];
98089 pTable->tabFlags |= TF_HasStat1;
98090 }
98091 }else{
98092 Index fakeIdx;
98093 fakeIdx.szIdxRow = pTable->szTabRow;
98094 #ifdef SQLITE_ENABLE_COSTMULT
98095 fakeIdx.pTable = pTable;
98096 #endif
98097 decodeIntArray((char*)z, 1, 0, &pTable->nRowLogEst, &fakeIdx);
98098 pTable->szTabRow = fakeIdx.szIdxRow;
98099 pTable->tabFlags |= TF_HasStat1;
98100 }
98101
98102 return 0;
98103 }
98104
@@ -98243,19 +98389,24 @@
98389 SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
98390 analysisInfo sInfo;
98391 HashElem *i;
98392 char *zSql;
98393 int rc = SQLITE_OK;
98394 Schema *pSchema = db->aDb[iDb].pSchema;
98395
98396 assert( iDb>=0 && iDb<db->nDb );
98397 assert( db->aDb[iDb].pBt!=0 );
98398
98399 /* Clear any prior statistics */
98400 assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
98401 for(i=sqliteHashFirst(&pSchema->tblHash); i; i=sqliteHashNext(i)){
98402 Table *pTab = sqliteHashData(i);
98403 pTab->tabFlags &= ~TF_HasStat1;
98404 }
98405 for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){
98406 Index *pIdx = sqliteHashData(i);
98407 pIdx->hasStat1 = 0;
98408 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
98409 sqlite3DeleteIndexSamples(db, pIdx);
98410 pIdx->aSample = 0;
98411 #endif
98412 }
@@ -98274,23 +98425,23 @@
98425 }
98426 }
98427
98428 /* Set appropriate defaults on all indexes not in the sqlite_stat1 table */
98429 assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
98430 for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){
98431 Index *pIdx = sqliteHashData(i);
98432 if( !pIdx->hasStat1 ) sqlite3DefaultRowEst(pIdx);
98433 }
98434
98435 /* Load the statistics from the sqlite_stat4 table. */
98436 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
98437 if( rc==SQLITE_OK && OptimizationEnabled(db, SQLITE_Stat34) ){
98438 db->lookaside.bDisable++;
98439 rc = loadStat4(db, sInfo.zDatabase);
98440 db->lookaside.bDisable--;
98441 }
98442 for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){
98443 Index *pIdx = sqliteHashData(i);
98444 sqlite3_free(pIdx->aiRowEst);
98445 pIdx->aiRowEst = 0;
98446 }
98447 #endif
@@ -100271,10 +100422,11 @@
100422 SQLITE_PRIVATE void sqlite3AddNotNull(Parse *pParse, int onError){
100423 Table *p;
100424 p = pParse->pNewTable;
100425 if( p==0 || NEVER(p->nCol<1) ) return;
100426 p->aCol[p->nCol-1].notNull = (u8)onError;
100427 p->tabFlags |= TF_HasNotNull;
100428 }
100429
100430 /*
100431 ** Scan the column type name zType (length nType) and return the
100432 ** associated affinity type.
@@ -102609,10 +102761,13 @@
102761 /* 10, 9, 8, 7, 6 */
102762 LogEst aVal[] = { 33, 32, 30, 28, 26 };
102763 LogEst *a = pIdx->aiRowLogEst;
102764 int nCopy = MIN(ArraySize(aVal), pIdx->nKeyCol);
102765 int i;
102766
102767 /* Indexes with default row estimates should not have stat1 data */
102768 assert( !pIdx->hasStat1 );
102769
102770 /* Set the first entry (number of rows in the index) to the estimated
102771 ** number of rows in the table, or half the number of rows in the table
102772 ** for a partial index. But do not let the estimate drop below 10. */
102773 a[0] = pIdx->pTable->nRowLogEst;
@@ -109798,10 +109953,13 @@
109953 VdbeComment((v, "%s", iField<0 ? "rowid" : pTab->aCol[iField].zName));
109954 }
109955 }
109956 sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]);
109957 VdbeComment((v, "for %s", pIdx->zName));
109958 #ifdef SQLITE_ENABLE_NULL_TRIM
109959 if( pIdx->idxType==2 ) sqlite3SetMakeRecordP5(v, pIdx->pTable);
109960 #endif
109961
109962 /* In an UPDATE operation, if this index is the PRIMARY KEY index
109963 ** of a WITHOUT ROWID table and there has been no change the
109964 ** primary key, then no collision is possible. The collision detection
109965 ** logic below can all be skipped. */
@@ -109953,12 +110111,15 @@
110111
110112 /* Records with omitted columns are only allowed for schema format
110113 ** version 2 and later (SQLite version 3.1.4, 2005-02-20). */
110114 if( pTab->pSchema->file_format<2 ) return;
110115
110116 for(i=pTab->nCol-1; i>0; i--){
110117 if( pTab->aCol[i].pDflt!=0 ) break;
110118 if( pTab->aCol[i].colFlags & COLFLAG_PRIMKEY ) break;
110119 }
110120 sqlite3VdbeChangeP5(v, i+1);
110121 }
110122 #endif
110123
110124 /*
110125 ** This routine generates code to finish the INSERT or UPDATE operation
@@ -110244,11 +110405,11 @@
110405 }
110406 if( sqlite3TriggerList(pParse, pDest) ){
110407 return 0; /* tab1 must not have triggers */
110408 }
110409 #ifndef SQLITE_OMIT_VIRTUALTABLE
110410 if( IsVirtual(pDest) ){
110411 return 0; /* tab1 must not be a virtual table */
110412 }
110413 #endif
110414 if( onError==OE_Default ){
110415 if( pDest->iPKey>=0 ) onError = pDest->keyConf;
@@ -110306,11 +110467,11 @@
110467 }
110468 if( HasRowid(pDest)!=HasRowid(pSrc) ){
110469 return 0; /* source and destination must both be WITHOUT ROWID or not */
110470 }
110471 #ifndef SQLITE_OMIT_VIRTUALTABLE
110472 if( IsVirtual(pSrc) ){
110473 return 0; /* tab2 must not be a virtual table */
110474 }
110475 #endif
110476 if( pSrc->pSelect ){
110477 return 0; /* tab2 may not be a view */
@@ -110603,11 +110764,11 @@
110764 /* Invoke the callback function if required */
110765 if( xCallback && (SQLITE_ROW==rc ||
110766 (SQLITE_DONE==rc && !callbackIsInit
110767 && db->flags&SQLITE_NullCallback)) ){
110768 if( !callbackIsInit ){
110769 azCols = sqlite3DbMallocRaw(db, (2*nCol+1)*sizeof(const char*));
110770 if( azCols==0 ){
110771 goto exec_out;
110772 }
110773 for(i=0; i<nCol; i++){
110774 azCols[i] = (char *)sqlite3_column_name(pStmt, i);
@@ -110624,10 +110785,11 @@
110785 if( !azVals[i] && sqlite3_column_type(pStmt, i)!=SQLITE_NULL ){
110786 sqlite3OomFault(db);
110787 goto exec_out;
110788 }
110789 }
110790 azVals[i] = 0;
110791 }
110792 if( xCallback(pArg, nCol, azVals, azCols) ){
110793 /* EVIDENCE-OF: R-38229-40159 If the callback function to
110794 ** sqlite3_exec() returns non-zero, then sqlite3_exec() will
110795 ** return SQLITE_ABORT. */
@@ -112094,15 +112256,15 @@
112256 #define PragTyp_JOURNAL_SIZE_LIMIT 20
112257 #define PragTyp_LOCK_PROXY_FILE 21
112258 #define PragTyp_LOCKING_MODE 22
112259 #define PragTyp_PAGE_COUNT 23
112260 #define PragTyp_MMAP_SIZE 24
112261 #define PragTyp_OPTIMIZE 25
112262 #define PragTyp_PAGE_SIZE 26
112263 #define PragTyp_SECURE_DELETE 27
112264 #define PragTyp_SHRINK_MEMORY 28
112265 #define PragTyp_SOFT_HEAP_LIMIT 29
112266 #define PragTyp_SYNCHRONOUS 30
112267 #define PragTyp_TABLE_INFO 31
112268 #define PragTyp_TEMP_STORE 32
112269 #define PragTyp_TEMP_STORE_DIRECTORY 33
112270 #define PragTyp_THREADS 34
@@ -112112,10 +112274,11 @@
112274 #define PragTyp_HEXKEY 38
112275 #define PragTyp_KEY 39
112276 #define PragTyp_REKEY 40
112277 #define PragTyp_LOCK_STATUS 41
112278 #define PragTyp_PARSER_TRACE 42
112279 #define PragTyp_STATS 43
112280
112281 /* Property flags associated with various pragma. */
112282 #define PragFlg_NeedSchema 0x01 /* Force schema load before running */
112283 #define PragFlg_NoColumns 0x02 /* OP_ResultRow called with zero columns */
112284 #define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */
@@ -112135,51 +112298,52 @@
112298 /* 2 */ "name",
112299 /* 3 */ "type",
112300 /* 4 */ "notnull",
112301 /* 5 */ "dflt_value",
112302 /* 6 */ "pk",
112303 /* 7 */ "tbl", /* Used by: stats */
112304 /* 8 */ "idx",
112305 /* 9 */ "wdth",
112306 /* 10 */ "hght",
112307 /* 11 */ "flgs",
112308 /* 12 */ "seqno", /* Used by: index_info */
112309 /* 13 */ "cid",
112310 /* 14 */ "name",
112311 /* 15 */ "seqno", /* Used by: index_xinfo */
112312 /* 16 */ "cid",
112313 /* 17 */ "name",
112314 /* 18 */ "desc",
112315 /* 19 */ "coll",
112316 /* 20 */ "key",
112317 /* 21 */ "seq", /* Used by: index_list */
112318 /* 22 */ "name",
112319 /* 23 */ "unique",
112320 /* 24 */ "origin",
112321 /* 25 */ "partial",
112322 /* 26 */ "seq", /* Used by: database_list */
112323 /* 27 */ "name",
112324 /* 28 */ "file",
112325 /* 29 */ "seq", /* Used by: collation_list */
112326 /* 30 */ "name",
112327 /* 31 */ "id", /* Used by: foreign_key_list */
112328 /* 32 */ "seq",
112329 /* 33 */ "table",
112330 /* 34 */ "from",
112331 /* 35 */ "to",
112332 /* 36 */ "on_update",
112333 /* 37 */ "on_delete",
112334 /* 38 */ "match",
112335 /* 39 */ "table", /* Used by: foreign_key_check */
112336 /* 40 */ "rowid",
112337 /* 41 */ "parent",
112338 /* 42 */ "fkid",
112339 /* 43 */ "busy", /* Used by: wal_checkpoint */
112340 /* 44 */ "log",
112341 /* 45 */ "checkpointed",
112342 /* 46 */ "timeout", /* Used by: busy_timeout */
112343 /* 47 */ "database", /* Used by: lock_status */
112344 /* 48 */ "status",
112345 };
112346
112347 /* Definitions of all built-in pragmas */
112348 typedef struct PragmaName {
112349 const char *const zName; /* Name of pragma */
@@ -112221,11 +112385,11 @@
112385 #endif
112386 #endif
112387 {/* zName: */ "busy_timeout",
112388 /* ePragTyp: */ PragTyp_BUSY_TIMEOUT,
112389 /* ePragFlg: */ PragFlg_Result0,
112390 /* ColNames: */ 46, 1,
112391 /* iArg: */ 0 },
112392 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112393 {/* zName: */ "cache_size",
112394 /* ePragTyp: */ PragTyp_CACHE_SIZE,
112395 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
@@ -112258,11 +112422,11 @@
112422 #endif
112423 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
112424 {/* zName: */ "collation_list",
112425 /* ePragTyp: */ PragTyp_COLLATION_LIST,
112426 /* ePragFlg: */ PragFlg_Result0,
112427 /* ColNames: */ 29, 2,
112428 /* iArg: */ 0 },
112429 #endif
112430 #if !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)
112431 {/* zName: */ "compile_options",
112432 /* ePragTyp: */ PragTyp_COMPILE_OPTIONS,
@@ -112293,11 +112457,11 @@
112457 #endif
112458 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
112459 {/* zName: */ "database_list",
112460 /* ePragTyp: */ PragTyp_DATABASE_LIST,
112461 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0,
112462 /* ColNames: */ 26, 3,
112463 /* iArg: */ 0 },
112464 #endif
112465 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)
112466 {/* zName: */ "default_cache_size",
112467 /* ePragTyp: */ PragTyp_DEFAULT_CACHE_SIZE,
@@ -112330,18 +112494,18 @@
112494 #endif
112495 #if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
112496 {/* zName: */ "foreign_key_check",
112497 /* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK,
112498 /* ePragFlg: */ PragFlg_NeedSchema,
112499 /* ColNames: */ 39, 4,
112500 /* iArg: */ 0 },
112501 #endif
112502 #if !defined(SQLITE_OMIT_FOREIGN_KEY)
112503 {/* zName: */ "foreign_key_list",
112504 /* ePragTyp: */ PragTyp_FOREIGN_KEY_LIST,
112505 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
112506 /* ColNames: */ 31, 8,
112507 /* iArg: */ 0 },
112508 #endif
112509 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112510 #if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
112511 {/* zName: */ "foreign_keys",
@@ -112400,21 +112564,21 @@
112564 #endif
112565 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
112566 {/* zName: */ "index_info",
112567 /* ePragTyp: */ PragTyp_INDEX_INFO,
112568 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
112569 /* ColNames: */ 12, 3,
112570 /* iArg: */ 0 },
112571 {/* zName: */ "index_list",
112572 /* ePragTyp: */ PragTyp_INDEX_LIST,
112573 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
112574 /* ColNames: */ 21, 5,
112575 /* iArg: */ 0 },
112576 {/* zName: */ "index_xinfo",
112577 /* ePragTyp: */ PragTyp_INDEX_INFO,
112578 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
112579 /* ColNames: */ 15, 6,
112580 /* iArg: */ 1 },
112581 #endif
112582 #if !defined(SQLITE_OMIT_INTEGRITY_CHECK)
112583 {/* zName: */ "integrity_check",
112584 /* ePragTyp: */ PragTyp_INTEGRITY_CHECK,
@@ -112457,11 +112621,11 @@
112621 #endif
112622 #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
112623 {/* zName: */ "lock_status",
112624 /* ePragTyp: */ PragTyp_LOCK_STATUS,
112625 /* ePragFlg: */ PragFlg_Result0,
112626 /* ColNames: */ 47, 2,
112627 /* iArg: */ 0 },
112628 #endif
112629 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112630 {/* zName: */ "locking_mode",
112631 /* ePragTyp: */ PragTyp_LOCKING_MODE,
@@ -112476,10 +112640,17 @@
112640 {/* zName: */ "mmap_size",
112641 /* ePragTyp: */ PragTyp_MMAP_SIZE,
112642 /* ePragFlg: */ 0,
112643 /* ColNames: */ 0, 0,
112644 /* iArg: */ 0 },
112645 #endif
112646 {/* zName: */ "optimize",
112647 /* ePragTyp: */ PragTyp_OPTIMIZE,
112648 /* ePragFlg: */ PragFlg_NoColumns,
112649 /* ColNames: */ 0, 0,
112650 /* iArg: */ 0 },
112651 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112652 {/* zName: */ "page_count",
112653 /* ePragTyp: */ PragTyp_PAGE_COUNT,
112654 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
112655 /* ColNames: */ 0, 0,
112656 /* iArg: */ 0 },
@@ -112574,15 +112745,15 @@
112745 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112746 /* ColNames: */ 0, 0,
112747 /* iArg: */ SQLITE_SqlTrace },
112748 #endif
112749 #endif
112750 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) && defined(SQLITE_DEBUG)
112751 {/* zName: */ "stats",
112752 /* ePragTyp: */ PragTyp_STATS,
112753 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
112754 /* ColNames: */ 7, 5,
112755 /* iArg: */ 0 },
112756 #endif
112757 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112758 {/* zName: */ "synchronous",
112759 /* ePragTyp: */ PragTyp_SYNCHRONOUS,
@@ -112657,11 +112828,11 @@
112828 /* ColNames: */ 0, 0,
112829 /* iArg: */ 0 },
112830 {/* zName: */ "wal_checkpoint",
112831 /* ePragTyp: */ PragTyp_WAL_CHECKPOINT,
112832 /* ePragFlg: */ PragFlg_NeedSchema,
112833 /* ColNames: */ 43, 3,
112834 /* iArg: */ 0 },
112835 #endif
112836 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112837 {/* zName: */ "writable_schema",
112838 /* ePragTyp: */ PragTyp_FLAG,
@@ -112668,11 +112839,11 @@
112839 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112840 /* ColNames: */ 0, 0,
112841 /* iArg: */ SQLITE_WriteSchema|SQLITE_RecoveryMode },
112842 #endif
112843 };
112844 /* Number of pragmas: 60 on by default, 74 total. */
112845
112846 /************** End of pragma.h **********************************************/
112847 /************** Continuing where we left off in pragma.c *********************/
112848
112849 /*
@@ -112937,10 +113108,26 @@
113108 lwr = mid + 1;
113109 }
113110 }
113111 return lwr>upr ? 0 : &aPragmaName[mid];
113112 }
113113
113114 /*
113115 ** Helper subroutine for PRAGMA integrity_check:
113116 **
113117 ** Generate code to output a single-column result row with the result
113118 ** held in register regResult. Decrement the result count and halt if
113119 ** the maximum number of result rows have been issued.
113120 */
113121 static int integrityCheckResultRow(Vdbe *v, int regResult){
113122 int addr;
113123 sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, 1);
113124 addr = sqlite3VdbeAddOp3(v, OP_IfPos, 1, sqlite3VdbeCurrentAddr(v)+2, 1);
113125 VdbeCoverage(v);
113126 sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);
113127 return addr;
113128 }
113129
113130 /*
113131 ** Process a pragma statement.
113132 **
113133 ** Pragmas are of this form:
@@ -113741,33 +113928,37 @@
113928 }
113929 }
113930 }
113931 break;
113932
113933 #ifdef SQLITE_DEBUG
113934 case PragTyp_STATS: {
113935 Index *pIdx;
113936 HashElem *i;
113937 pParse->nMem = 5;
113938 sqlite3CodeVerifySchema(pParse, iDb);
113939 for(i=sqliteHashFirst(&pDb->pSchema->tblHash); i; i=sqliteHashNext(i)){
113940 Table *pTab = sqliteHashData(i);
113941 sqlite3VdbeMultiLoad(v, 1, "ssiii",
113942 pTab->zName,
113943 0,
113944 pTab->szTabRow,
113945 pTab->nRowLogEst,
113946 pTab->tabFlags);
113947 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 5);
113948 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
113949 sqlite3VdbeMultiLoad(v, 2, "siii",
113950 pIdx->zName,
113951 pIdx->szIdxRow,
113952 pIdx->aiRowLogEst[0],
113953 pIdx->hasStat1);
113954 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 5);
113955 }
113956 }
113957 }
113958 break;
113959 #endif
113960
113961 case PragTyp_INDEX_INFO: if( zRight ){
113962 Index *pIdx;
113963 Table *pTab;
113964 pIdx = sqlite3FindIndex(db, zRight, zDb);
@@ -114020,13 +114211,21 @@
114211 #ifndef SQLITE_INTEGRITY_CHECK_ERROR_MAX
114212 # define SQLITE_INTEGRITY_CHECK_ERROR_MAX 100
114213 #endif
114214
114215 #ifndef SQLITE_OMIT_INTEGRITY_CHECK
114216 /* PRAGMA integrity_check
114217 ** PRAGMA integrity_check(N)
114218 ** PRAGMA quick_check
114219 ** PRAGMA quick_check(N)
114220 **
114221 ** Verify the integrity of the database.
114222 **
114223 ** The "quick_check" is reduced version of
114224 ** integrity_check designed to detect most database corruption
114225 ** without the overhead of cross-checking indexes. Quick_check
114226 ** is linear time wherease integrity_check is O(NlogN).
114227 */
114228 case PragTyp_INTEGRITY_CHECK: {
114229 int i, j, addr, mxErr;
114230
114231 int isQuick = (sqlite3Tolower(zLeft[0])=='q');
@@ -114053,11 +114252,11 @@
114252 sqlite3GetInt32(zRight, &mxErr);
114253 if( mxErr<=0 ){
114254 mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;
114255 }
114256 }
114257 sqlite3VdbeAddOp2(v, OP_Integer, mxErr-1, 1); /* reg[1] holds errors left */
114258
114259 /* Do an integrity check on each database file */
114260 for(i=0; i<db->nDb; i++){
114261 HashElem *x;
114262 Hash *pTbls;
@@ -114068,14 +114267,10 @@
114267
114268 if( OMIT_TEMPDB && i==1 ) continue;
114269 if( iDb>=0 && i!=iDb ) continue;
114270
114271 sqlite3CodeVerifySchema(pParse, i);
 
 
 
 
114272
114273 /* Do an integrity check of the B-Tree
114274 **
114275 ** Begin by finding the root pages numbers
114276 ** for all tables and indices in the database.
@@ -114111,29 +114306,30 @@
114306 sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,
114307 sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zDbSName),
114308 P4_DYNAMIC);
114309 sqlite3VdbeAddOp3(v, OP_Move, 2, 4, 1);
114310 sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 2);
114311 integrityCheckResultRow(v, 2);
114312 sqlite3VdbeJumpHere(v, addr);
114313
114314 /* Make sure all the indices are constructed correctly.
114315 */
114316 for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
114317 Table *pTab = sqliteHashData(x);
114318 Index *pIdx, *pPk;
114319 Index *pPrior = 0;
114320 int loopTop;
114321 int iDataCur, iIdxCur;
114322 int r1 = -1;
114323
114324 if( pTab->pCheck==0
114325 && (pTab->tabFlags & TF_HasNotNull)==0
114326 && (pTab->pIndex==0 || isQuick)
114327 ){
114328 continue; /* No additional checks needed for this table */
114329 }
114330 pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
 
 
 
 
114331 sqlite3ExprCacheClear(pParse);
114332 sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenRead, 0,
114333 1, 0, &iDataCur, &iIdxCur);
114334 sqlite3VdbeAddOp2(v, OP_Integer, 0, 7);
114335 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
@@ -114144,28 +114340,46 @@
114340 sqlite3VdbeAddOp2(v, OP_Rewind, iDataCur, 0); VdbeCoverage(v);
114341 loopTop = sqlite3VdbeAddOp2(v, OP_AddImm, 7, 1);
114342 /* Verify that all NOT NULL columns really are NOT NULL */
114343 for(j=0; j<pTab->nCol; j++){
114344 char *zErr;
114345 int jmp2;
114346 if( j==pTab->iPKey ) continue;
114347 if( pTab->aCol[j].notNull==0 ) continue;
114348 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, j, 3);
114349 sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG);
114350 jmp2 = sqlite3VdbeAddOp1(v, OP_NotNull, 3); VdbeCoverage(v);
 
114351 zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
114352 pTab->aCol[j].zName);
114353 sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
114354 integrityCheckResultRow(v, 3);
 
 
114355 sqlite3VdbeJumpHere(v, jmp2);
114356 }
114357 /* Verify CHECK constraints */
114358 if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){
114359 int addrCkFault = sqlite3VdbeMakeLabel(v);
114360 int addrCkOk = sqlite3VdbeMakeLabel(v);
114361 ExprList *pCheck = pTab->pCheck;
114362 char *zErr;
114363 int k;
114364 pParse->iSelfTab = iDataCur;
114365 sqlite3ExprCachePush(pParse);
114366 for(k=pCheck->nExpr-1; k>0; k--){
114367 sqlite3ExprIfFalse(pParse, pCheck->a[k].pExpr, addrCkFault, 0);
114368 }
114369 sqlite3ExprIfTrue(pParse, pCheck->a[0].pExpr, addrCkOk,
114370 SQLITE_JUMPIFNULL);
114371 sqlite3VdbeResolveLabel(v, addrCkFault);
114372 zErr = sqlite3MPrintf(db, "CHECK constraint failed in %s",
114373 pTab->zName);
114374 sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
114375 integrityCheckResultRow(v, 3);
114376 sqlite3VdbeResolveLabel(v, addrCkOk);
114377 sqlite3ExprCachePop(pParse);
114378 }
114379 /* Validate index entries for the current row */
114380 for(j=0, pIdx=pTab->pIndex; pIdx && !isQuick; pIdx=pIdx->pNext, j++){
114381 int jmp2, jmp3, jmp4, jmp5;
114382 int ckUniq = sqlite3VdbeMakeLabel(v);
114383 if( pPk==pIdx ) continue;
114384 r1 = sqlite3GenerateIndexKey(pParse, pIdx, iDataCur, 0, 0, &jmp3,
114385 pPrior, r1);
@@ -114172,20 +114386,17 @@
114386 pPrior = pIdx;
114387 sqlite3VdbeAddOp2(v, OP_AddImm, 8+j, 1); /* increment entry count */
114388 /* Verify that an index entry exists for the current table row */
114389 jmp2 = sqlite3VdbeAddOp4Int(v, OP_Found, iIdxCur+j, ckUniq, r1,
114390 pIdx->nColumn); VdbeCoverage(v);
 
114391 sqlite3VdbeLoadString(v, 3, "row ");
114392 sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3);
114393 sqlite3VdbeLoadString(v, 4, " missing from index ");
114394 sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
114395 jmp5 = sqlite3VdbeLoadString(v, 4, pIdx->zName);
114396 sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
114397 jmp4 = integrityCheckResultRow(v, 3);
 
 
114398 sqlite3VdbeJumpHere(v, jmp2);
114399 /* For UNIQUE indexes, verify that only one entry exists with the
114400 ** current key. The entry is unique if (1) any column is NULL
114401 ** or (2) the next entry has a different key */
114402 if( IsUniqueIndex(pIdx) ){
@@ -114202,11 +114413,10 @@
114413 jmp6 = sqlite3VdbeAddOp1(v, OP_Next, iIdxCur+j); VdbeCoverage(v);
114414 sqlite3VdbeGoto(v, uniqOk);
114415 sqlite3VdbeJumpHere(v, jmp6);
114416 sqlite3VdbeAddOp4Int(v, OP_IdxGT, iIdxCur+j, uniqOk, r1,
114417 pIdx->nKeyCol); VdbeCoverage(v);
 
114418 sqlite3VdbeLoadString(v, 3, "non-unique entry in index ");
114419 sqlite3VdbeGoto(v, jmp5);
114420 sqlite3VdbeResolveLabel(v, uniqOk);
114421 }
114422 sqlite3VdbeJumpHere(v, jmp4);
@@ -114213,40 +114423,39 @@
114423 sqlite3ResolvePartIdxLabel(pParse, jmp3);
114424 }
114425 sqlite3VdbeAddOp2(v, OP_Next, iDataCur, loopTop); VdbeCoverage(v);
114426 sqlite3VdbeJumpHere(v, loopTop-1);
114427 #ifndef SQLITE_OMIT_BTREECOUNT
114428 if( !isQuick ){
114429 sqlite3VdbeLoadString(v, 2, "wrong # of entries in index ");
114430 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
114431 if( pPk==pIdx ) continue;
114432 sqlite3VdbeAddOp2(v, OP_Count, iIdxCur+j, 3);
114433 addr = sqlite3VdbeAddOp3(v, OP_Eq, 8+j, 0, 3); VdbeCoverage(v);
114434 sqlite3VdbeChangeP5(v, SQLITE_NOTNULL);
114435 sqlite3VdbeLoadString(v, 3, pIdx->zName);
114436 sqlite3VdbeAddOp3(v, OP_Concat, 3, 2, 7);
114437 integrityCheckResultRow(v, 7);
114438 sqlite3VdbeJumpHere(v, addr);
114439 }
 
114440 }
114441 #endif /* SQLITE_OMIT_BTREECOUNT */
114442 }
114443 }
114444 {
114445 static const int iLn = VDBE_OFFSET_LINENO(2);
114446 static const VdbeOpList endCode[] = {
114447 { OP_AddImm, 1, 0, 0}, /* 0 */
114448 { OP_IfNotZero, 1, 4, 0}, /* 1 */
114449 { OP_String8, 0, 3, 0}, /* 2 */
114450 { OP_ResultRow, 3, 1, 0}, /* 3 */
114451 };
114452 VdbeOp *aOp;
114453
114454 aOp = sqlite3VdbeAddOpList(v, ArraySize(endCode), endCode, iLn);
114455 if( aOp ){
114456 aOp[0].p2 = 1-mxErr;
114457 aOp[2].p4type = P4_STATIC;
114458 aOp[2].p4.z = "ok";
114459 }
114460 }
114461 }
@@ -114466,10 +114675,92 @@
114675 */
114676 case PragTyp_SHRINK_MEMORY: {
114677 sqlite3_db_release_memory(db);
114678 break;
114679 }
114680
114681 /*
114682 ** PRAGMA optimize
114683 ** PRAGMA schema.optimize
114684 **
114685 ** Attempt to optimize the database. All schemas are optimized in the first
114686 ** form, and only the specified schema is optimized in the second form.
114687 **
114688 ** The details of optimizations performed by this pragma does are expected
114689 ** to change and improve over time. Applications should anticipate that
114690 ** this pragma will perform new optimizations in future releases.
114691 **
114692 ** Argments to this pragma are currently ignored, but future enhancements
114693 ** might make use of arguments to control which optimizations are allowed
114694 ** or to suggest limits on how much CPU time and I/O should be expended
114695 ** in the optimization effort.
114696 **
114697 ** The current implementation runs ANALYZE on any tables which might have
114698 ** benefitted from having recent statistics at some point since the start
114699 ** of the current connection. Only tables in "schema" are analyzed in the
114700 ** second form. In the first form, all tables except TEMP tables are
114701 ** checked.
114702 **
114703 ** In the current implementation, a table is analyzed only if both of
114704 ** the following are true:
114705 **
114706 ** (1) The query planner used sqlite_stat1-style statistics for one or
114707 ** more indexes of the table at some point during the lifetime of
114708 ** the current connection.
114709 **
114710 ** (2) One or more indexes of the table are currently unanalyzed OR
114711 ** the number of rows in the table has increased by 25 times or more
114712 ** since the last time ANALYZE was run.
114713 **
114714 ** The rules for when tables are analyzed are likely to change in
114715 ** future releases.
114716 */
114717 case PragTyp_OPTIMIZE: {
114718 int iDbLast; /* Loop termination point for the schema loop */
114719 int iTabCur; /* Cursor for a table whose size needs checking */
114720 HashElem *k; /* Loop over tables of a schema */
114721 Schema *pSchema; /* The current schema */
114722 Table *pTab; /* A table in the schema */
114723 Index *pIdx; /* An index of the table */
114724 LogEst szThreshold; /* Size threshold above which reanalysis is needd */
114725 char *zSubSql; /* SQL statement for the OP_SqlExec opcode */
114726
114727 iTabCur = pParse->nTab++;
114728 for(iDbLast = zDb?iDb:db->nDb-1; iDb<=iDbLast; iDb++){
114729 if( iDb==1 ) continue;
114730 sqlite3CodeVerifySchema(pParse, iDb);
114731 pSchema = db->aDb[iDb].pSchema;
114732 for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
114733 pTab = (Table*)sqliteHashData(k);
114734
114735 /* If table pTab has not been used in a way that would benefit from
114736 ** having analysis statistics during the current session, then skip it.
114737 ** This also has the effect of skipping virtual tables and views */
114738 if( (pTab->tabFlags & TF_StatsUsed)==0 ) continue;
114739
114740 /* Reanalyze if the table is 25 times larger than the last analysis */
114741 szThreshold = pTab->nRowLogEst + 46; assert( sqlite3LogEst(25)==46 );
114742 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
114743 if( !pIdx->hasStat1 ){
114744 szThreshold = 0; /* Always analyze if any index lacks statistics */
114745 break;
114746 }
114747 }
114748 if( szThreshold ){
114749 sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead);
114750 sqlite3VdbeAddOp3(v, OP_IfSmaller, iTabCur,
114751 sqlite3VdbeCurrentAddr(v)+2, szThreshold);
114752 VdbeCoverage(v);
114753 }
114754 zSubSql = sqlite3MPrintf(db, "ANALYZE \"%w\".\"%w\"",
114755 db->aDb[iDb].zDbSName, pTab->zName);
114756 sqlite3VdbeAddOp4(v, OP_SqlExec, 0, 0, 0, zSubSql, P4_DYNAMIC);
114757 }
114758 }
114759 sqlite3VdbeAddOp0(v, OP_Expire);
114760 break;
114761 }
114762
114763 /*
114764 ** PRAGMA busy_timeout
114765 ** PRAGMA busy_timeout = N
114766 **
@@ -123782,12 +124073,29 @@
124073 ** transient would cause the database file to appear to be deleted
124074 ** following reboot.
124075 */
124076 SQLITE_PRIVATE void sqlite3Vacuum(Parse *pParse, Token *pNm){
124077 Vdbe *v = sqlite3GetVdbe(pParse);
124078 int iDb = 0;
124079 if( v==0 ) return;
124080 if( pNm ){
124081 #ifndef SQLITE_BUG_COMPATIBLE_20160819
124082 /* Default behavior: Report an error if the argument to VACUUM is
124083 ** not recognized */
124084 iDb = sqlite3TwoPartName(pParse, pNm, pNm, &pNm);
124085 if( iDb<0 ) return;
124086 #else
124087 /* When SQLITE_BUG_COMPATIBLE_20160819 is defined, unrecognized arguments
124088 ** to VACUUM are silently ignored. This is a back-out of a bug fix that
124089 ** occurred on 2016-08-19 (https://www.sqlite.org/src/info/083f9e6270).
124090 ** The buggy behavior is required for binary compatibility with some
124091 ** legacy applications. */
124092 iDb = sqlite3FindDb(pParse->db, pNm);
124093 if( iDb<0 ) iDb = 0;
124094 #endif
124095 }
124096 if( iDb!=1 ){
124097 sqlite3VdbeAddOp1(v, OP_Vacuum, iDb);
124098 sqlite3VdbeUsesBtree(v, iDb);
124099 }
124100 return;
124101 }
@@ -124377,12 +124685,11 @@
124685
124686 db = pParse->db;
124687 iDb = sqlite3SchemaToIndex(db, pTable->pSchema);
124688 assert( iDb>=0 );
124689
124690 assert( pTable->nModuleArg==0 );
 
124691 addModuleArgument(db, pTable, sqlite3NameFromToken(db, pModuleName));
124692 addModuleArgument(db, pTable, 0);
124693 addModuleArgument(db, pTable, sqlite3DbStrDup(db, pTable->zName));
124694 assert( (pParse->sNameToken.z==pName2->z && pName2->z!=0)
124695 || (pParse->sNameToken.z==pName1->z && pName2->z==0)
@@ -124666,11 +124973,11 @@
124973 const char *zMod;
124974 Module *pMod;
124975 int rc;
124976
124977 assert( pTab );
124978 if( !IsVirtual(pTab) || sqlite3GetVTable(db, pTab) ){
124979 return SQLITE_OK;
124980 }
124981
124982 /* Locate the required virtual table module */
124983 zMod = pTab->azModuleArg[0];
@@ -124736,11 +125043,11 @@
125043 Table *pTab;
125044 Module *pMod;
125045 const char *zMod;
125046
125047 pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zDbSName);
125048 assert( pTab && IsVirtual(pTab) && !pTab->pVTable );
125049
125050 /* Locate the required virtual table module */
125051 zMod = pTab->azModuleArg[0];
125052 pMod = (Module*)sqlite3HashFind(&db->aModule, zMod);
125053
@@ -124790,11 +125097,11 @@
125097 sqlite3Error(db, SQLITE_MISUSE);
125098 sqlite3_mutex_leave(db->mutex);
125099 return SQLITE_MISUSE_BKPT;
125100 }
125101 pTab = pCtx->pTab;
125102 assert( IsVirtual(pTab) );
125103
125104 pParse = sqlite3StackAllocZero(db, sizeof(*pParse));
125105 if( pParse==0 ){
125106 rc = SQLITE_NOMEM_BKPT;
125107 }else{
@@ -124804,11 +125111,11 @@
125111
125112 if( SQLITE_OK==sqlite3RunParser(pParse, zCreateTable, &zErr)
125113 && pParse->pNewTable
125114 && !db->mallocFailed
125115 && !pParse->pNewTable->pSelect
125116 && !IsVirtual(pParse->pNewTable)
125117 ){
125118 if( !pTab->aCol ){
125119 Table *pNew = pParse->pNewTable;
125120 Index *pIdx;
125121 pTab->aCol = pNew->aCol;
@@ -125093,11 +125400,11 @@
125400 /* Check to see the left operand is a column in a virtual table */
125401 if( NEVER(pExpr==0) ) return pDef;
125402 if( pExpr->op!=TK_COLUMN ) return pDef;
125403 pTab = pExpr->pTab;
125404 if( NEVER(pTab==0) ) return pDef;
125405 if( !IsVirtual(pTab) ) return pDef;
125406 pVtab = sqlite3GetVTable(db, pTab)->pVtab;
125407 assert( pVtab!=0 );
125408 assert( pVtab->pModule!=0 );
125409 pMod = (sqlite3_module *)pVtab->pModule;
125410 if( pMod->xFindFunction==0 ) return pDef;
@@ -125188,12 +125495,11 @@
125495 return 0;
125496 }
125497 pMod->pEpoTab = pTab;
125498 pTab->nTabRef = 1;
125499 pTab->pSchema = db->aDb[0].pSchema;
125500 assert( pTab->nModuleArg==0 );
 
125501 pTab->iPKey = -1;
125502 addModuleArgument(db, pTab, sqlite3DbStrDup(db, pTab->zName));
125503 addModuleArgument(db, pTab, 0);
125504 addModuleArgument(db, pTab, sqlite3DbStrDup(db, pTab->zName));
125505 rc = vtabCallConstructor(db, pTab, pMod, pModule->xConnect, &zErr);
@@ -125260,11 +125566,11 @@
125566 case SQLITE_VTAB_CONSTRAINT_SUPPORT: {
125567 VtabCtx *p = db->pVtabCtx;
125568 if( !p ){
125569 rc = SQLITE_MISUSE_BKPT;
125570 }else{
125571 assert( p->pTab==0 || IsVirtual(p->pTab) );
125572 p->pVTable->bConstraint = (u8)va_arg(ap, int);
125573 }
125574 break;
125575 }
125576 default:
@@ -125699,12 +126005,17 @@
126005 WhereOrSet *pOrSet; /* Record best loops here, if not NULL */
126006 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
126007 UnpackedRecord *pRec; /* Probe for stat4 (if required) */
126008 int nRecValid; /* Number of valid fields currently in pRec */
126009 #endif
126010 unsigned int bldFlags; /* SQLITE_BLDF_* flags */
126011 };
126012
126013 /* Allowed values for WhereLoopBuider.bldFlags */
126014 #define SQLITE_BLDF_INDEXED 0x0001 /* An index is used */
126015 #define SQLITE_BLDF_UNIQUE 0x0002 /* All keys of a UNIQUE index used */
126016
126017 /*
126018 ** The WHERE clause processing routine has two halves. The
126019 ** first part does the start of the WHERE loop and the second
126020 ** half does the tail of the WHERE loop. An instance of
126021 ** this structure is returned by the first half and passed
@@ -125715,11 +126026,11 @@
126026 */
126027 struct WhereInfo {
126028 Parse *pParse; /* Parsing and code generating context */
126029 SrcList *pTabList; /* List of tables in the join */
126030 ExprList *pOrderBy; /* The ORDER BY clause or NULL */
126031 ExprList *pResultSet; /* Result set of the query */
126032 LogEst iLimit; /* LIMIT if wctrlFlags has WHERE_USE_LIMIT */
126033 int aiCurOnePass[2]; /* OP_OpenWrite cursors for the ONEPASS opt */
126034 int iContinue; /* Jump here to continue with next record */
126035 int iBreak; /* Jump here to break out of the loop */
126036 int savedNQueryLoop; /* pParse->nQueryLoop outside the WHERE loop */
@@ -126899,10 +127210,11 @@
127210 Parse *pParse; /* Parsing context */
127211 sqlite3 *db; /* Database connection */
127212 Vdbe *v; /* The prepared stmt under constructions */
127213 struct SrcList_item *pTabItem; /* FROM clause term being coded */
127214 int addrBrk; /* Jump here to break out of the loop */
127215 int addrHalt; /* addrBrk for the outermost loop */
127216 int addrCont; /* Jump here to continue with next cycle */
127217 int iRowidReg = 0; /* Rowid is stored in this register, if not zero */
127218 int iReleaseReg = 0; /* Temp register to free before returning */
127219
127220 pParse = pWInfo->pParse;
@@ -126939,10 +127251,15 @@
127251 if( pLevel->iFrom>0 && (pTabItem[0].fg.jointype & JT_LEFT)!=0 ){
127252 pLevel->iLeftJoin = ++pParse->nMem;
127253 sqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin);
127254 VdbeComment((v, "init LEFT JOIN no-match flag"));
127255 }
127256
127257 /* Compute a safe address to jump to if we discover that the table for
127258 ** this loop is empty and can never contribute content. */
127259 for(j=iLevel; j>0 && pWInfo->a[j].iLeftJoin==0; j--){}
127260 addrHalt = pWInfo->a[j].addrBrk;
127261
127262 /* Special case of a FROM clause subquery implemented as a co-routine */
127263 if( pTabItem->fg.viaCoroutine ){
127264 int regYield = pTabItem->regReturn;
127265 sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
@@ -127124,11 +127441,11 @@
127441 VdbeCoverageIf(v, pX->op==TK_LT);
127442 VdbeCoverageIf(v, pX->op==TK_GE);
127443 sqlite3ExprCacheAffinityChange(pParse, r1, 1);
127444 sqlite3ReleaseTempReg(pParse, rTemp);
127445 }else{
127446 sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, addrHalt);
127447 VdbeCoverageIf(v, bRev==0);
127448 VdbeCoverageIf(v, bRev!=0);
127449 }
127450 if( pEnd ){
127451 Expr *pX;
@@ -127770,11 +128087,11 @@
128087 pLevel->op = OP_Noop;
128088 }else{
128089 codeCursorHint(pTabItem, pWInfo, pLevel, 0);
128090 pLevel->op = aStep[bRev];
128091 pLevel->p1 = iCur;
128092 pLevel->p2 = 1 + sqlite3VdbeAddOp2(v, aStart[bRev], iCur, addrHalt);
128093 VdbeCoverageIf(v, bRev==0);
128094 VdbeCoverageIf(v, bRev!=0);
128095 pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP;
128096 }
128097 }
@@ -128095,19 +128412,10 @@
128412 #ifdef SQLITE_EBCDIC
128413 if( *pnoCase ) return 0;
128414 #endif
128415 pList = pExpr->x.pList;
128416 pLeft = pList->a[1].pExpr;
 
 
 
 
 
 
 
 
 
128417
128418 pRight = sqlite3ExprSkipCollate(pList->a[0].pExpr);
128419 op = pRight->op;
128420 if( op==TK_VARIABLE ){
128421 Vdbe *pReprepare = pParse->pReprepare;
@@ -128120,10 +128428,27 @@
128428 assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER );
128429 }else if( op==TK_STRING ){
128430 z = pRight->u.zToken;
128431 }
128432 if( z ){
128433
128434 /* If the RHS begins with a digit or a minus sign, then the LHS must
128435 ** be an ordinary column (not a virtual table column) with TEXT affinity.
128436 ** Otherwise the LHS might be numeric and "lhs >= rhs" would be false
128437 ** even though "lhs LIKE rhs" is true. But if the RHS does not start
128438 ** with a digit or '-', then "lhs LIKE rhs" will always be false if
128439 ** the LHS is numeric and so the optimization still works.
128440 */
128441 if( sqlite3Isdigit(z[0]) || z[0]=='-' ){
128442 if( pLeft->op!=TK_COLUMN
128443 || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT
128444 || IsVirtual(pLeft->pTab) /* Value might be numeric */
128445 ){
128446 sqlite3ValueFree(pVal);
128447 return 0;
128448 }
128449 }
128450 cnt = 0;
128451 while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){
128452 cnt++;
128453 }
128454 if( cnt!=0 && 255!=(u8)z[cnt-1] ){
@@ -128748,11 +129073,11 @@
129073 iCur = pFrom->a[i].iCursor;
129074 for(pIdx=pFrom->a[i].pTab->pIndex; pIdx; pIdx=pIdx->pNext){
129075 if( pIdx->aColExpr==0 ) continue;
129076 for(i=0; i<pIdx->nKeyCol; i++){
129077 if( pIdx->aiColumn[i]!=XN_EXPR ) continue;
129078 if( sqlite3ExprCompareSkip(pExpr, pIdx->aColExpr->a[i].pExpr, iCur)==0 ){
129079 *piCur = iCur;
129080 *piColumn = XN_EXPR;
129081 return 1;
129082 }
129083 }
@@ -129539,11 +129864,12 @@
129864 do{
129865 for(pTerm=pWC->a+k; k<pWC->nTerm; k++, pTerm++){
129866 if( pTerm->leftCursor==iCur
129867 && pTerm->u.leftColumn==iColumn
129868 && (iColumn!=XN_EXPR
129869 || sqlite3ExprCompareSkip(pTerm->pExpr->pLeft,
129870 pScan->pIdxExpr,iCur)==0)
129871 && (pScan->iEquiv<=1 || !ExprHasProperty(pTerm->pExpr, EP_FromJoin))
129872 ){
129873 if( (pTerm->eOperator & WO_EQUIV)!=0
129874 && pScan->nEquiv<ArraySize(pScan->aiCur)
129875 && (pX = sqlite3ExprSkipCollate(pTerm->pExpr->pRight))->op==TK_COLUMN
@@ -131716,10 +132042,15 @@
132042 testcase( eOp & WO_IS );
132043 testcase( eOp & WO_ISNULL );
132044 continue;
132045 }
132046
132047 if( IsUniqueIndex(pProbe) && saved_nEq==pProbe->nKeyCol-1 ){
132048 pBuilder->bldFlags |= SQLITE_BLDF_UNIQUE;
132049 }else{
132050 pBuilder->bldFlags |= SQLITE_BLDF_INDEXED;
132051 }
132052 pNew->wsFlags = saved_wsFlags;
132053 pNew->u.btree.nEq = saved_nEq;
132054 pNew->u.btree.nBtm = saved_nBtm;
132055 pNew->u.btree.nTop = saved_nTop;
132056 pNew->nLTerm = saved_nLTerm;
@@ -132263,11 +132594,19 @@
132594 pNew->nOut = rSize;
132595 if( rc ) break;
132596 }
132597 }
132598
132599 pBuilder->bldFlags = 0;
132600 rc = whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, 0);
132601 if( pBuilder->bldFlags==SQLITE_BLDF_INDEXED ){
132602 /* If a non-unique index is used, or if a prefix of the key for
132603 ** unique index is used (making the index functionally non-unique)
132604 ** then the sqlite_stat1 data becomes important for scoring the
132605 ** plan */
132606 pTab->tabFlags |= TF_StatsUsed;
132607 }
132608 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
132609 sqlite3Stat4ProbeFree(pBuilder->pRec);
132610 pBuilder->nRecValid = 0;
132611 pBuilder->pRec = 0;
132612 #endif
@@ -133443,13 +133782,13 @@
133782 && (pWInfo->wctrlFlags & WHERE_DISTINCTBY)==0
133783 && pWInfo->eDistinct==WHERE_DISTINCT_NOOP
133784 && nRowEst
133785 ){
133786 Bitmask notUsed;
133787 int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pResultSet, pFrom,
133788 WHERE_DISTINCTBY, nLoop-1, pFrom->aLoop[nLoop-1], &notUsed);
133789 if( rc==pWInfo->pResultSet->nExpr ){
133790 pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;
133791 }
133792 }
133793 if( pWInfo->pOrderBy ){
133794 if( pWInfo->wctrlFlags & WHERE_DISTINCTBY ){
@@ -133682,11 +134021,11 @@
134021 SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
134022 Parse *pParse, /* The parser context */
134023 SrcList *pTabList, /* FROM clause: A list of all tables to be scanned */
134024 Expr *pWhere, /* The WHERE clause */
134025 ExprList *pOrderBy, /* An ORDER BY (or GROUP BY) clause, or NULL */
134026 ExprList *pResultSet, /* Query result set. Req'd for DISTINCT */
134027 u16 wctrlFlags, /* The WHERE_* flags defined in sqliteInt.h */
134028 int iAuxArg /* If WHERE_OR_SUBCLAUSE is set, index cursor number
134029 ** If WHERE_USE_LIMIT, then the limit amount */
134030 ){
134031 int nByteWInfo; /* Num. bytes allocated for WhereInfo struct */
@@ -133758,11 +134097,11 @@
134097 goto whereBeginError;
134098 }
134099 pWInfo->pParse = pParse;
134100 pWInfo->pTabList = pTabList;
134101 pWInfo->pOrderBy = pOrderBy;
134102 pWInfo->pResultSet = pResultSet;
134103 pWInfo->aiCurOnePass[0] = pWInfo->aiCurOnePass[1] = -1;
134104 pWInfo->nLevel = nTabList;
134105 pWInfo->iBreak = pWInfo->iContinue = sqlite3VdbeMakeLabel(v);
134106 pWInfo->wctrlFlags = wctrlFlags;
134107 pWInfo->iLimit = iAuxArg;
@@ -133836,17 +134175,17 @@
134175 /* Analyze all of the subexpressions. */
134176 sqlite3WhereExprAnalyze(pTabList, &pWInfo->sWC);
134177 if( db->mallocFailed ) goto whereBeginError;
134178
134179 if( wctrlFlags & WHERE_WANT_DISTINCT ){
134180 if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pResultSet) ){
134181 /* The DISTINCT marking is pointless. Ignore it. */
134182 pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;
134183 }else if( pOrderBy==0 ){
134184 /* Try to ORDER BY the result set to make distinct processing easier */
134185 pWInfo->wctrlFlags |= WHERE_DISTINCTBY;
134186 pWInfo->pOrderBy = pResultSet;
134187 }
134188 }
134189
134190 /* Construct the WhereLoop objects */
134191 #if defined(WHERETRACE_ENABLED)
@@ -133918,14 +134257,14 @@
134257 }
134258 }
134259 #endif
134260 /* Attempt to omit tables from the join that do not effect the result */
134261 if( pWInfo->nLevel>=2
134262 && pResultSet!=0
134263 && OptimizationEnabled(db, SQLITE_OmitNoopJoin)
134264 ){
134265 Bitmask tabUsed = sqlite3WhereExprListUsage(pMaskSet, pResultSet);
134266 if( sWLB.pOrderBy ){
134267 tabUsed |= sqlite3WhereExprListUsage(pMaskSet, sWLB.pOrderBy);
134268 }
134269 while( pWInfo->nLevel>=2 ){
134270 WhereTerm *pTerm, *pEnd;
@@ -134704,166 +135043,166 @@
135043 **
135044 *********** Begin parsing tables **********************************************/
135045 #define YY_ACTTAB_COUNT (1567)
135046 static const YYACTIONTYPE yy_action[] = {
135047 /* 0 */ 325, 832, 351, 825, 5, 203, 203, 819, 99, 100,
135048 /* 10 */ 90, 978, 978, 853, 856, 845, 845, 97, 97, 98,
135049 /* 20 */ 98, 98, 98, 301, 96, 96, 96, 96, 95, 95,
135050 /* 30 */ 94, 94, 94, 93, 351, 325, 976, 976, 824, 824,
135051 /* 40 */ 826, 946, 354, 99, 100, 90, 978, 978, 853, 856,
135052 /* 50 */ 845, 845, 97, 97, 98, 98, 98, 98, 338, 96,
135053 /* 60 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 351,
135054 /* 70 */ 95, 95, 94, 94, 94, 93, 351, 791, 976, 976,
135055 /* 80 */ 325, 94, 94, 94, 93, 351, 792, 75, 99, 100,
135056 /* 90 */ 90, 978, 978, 853, 856, 845, 845, 97, 97, 98,
135057 /* 100 */ 98, 98, 98, 450, 96, 96, 96, 96, 95, 95,
135058 /* 110 */ 94, 94, 94, 93, 351, 1333, 155, 155, 2, 325,
135059 /* 120 */ 275, 146, 132, 52, 52, 93, 351, 99, 100, 90,
135060 /* 130 */ 978, 978, 853, 856, 845, 845, 97, 97, 98, 98,
135061 /* 140 */ 98, 98, 101, 96, 96, 96, 96, 95, 95, 94,
135062 /* 150 */ 94, 94, 93, 351, 957, 957, 325, 268, 428, 413,
135063 /* 160 */ 411, 61, 752, 752, 99, 100, 90, 978, 978, 853,
135064 /* 170 */ 856, 845, 845, 97, 97, 98, 98, 98, 98, 60,
135065 /* 180 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
135066 /* 190 */ 351, 325, 270, 329, 273, 277, 958, 959, 250, 99,
135067 /* 200 */ 100, 90, 978, 978, 853, 856, 845, 845, 97, 97,
135068 /* 210 */ 98, 98, 98, 98, 301, 96, 96, 96, 96, 95,
135069 /* 220 */ 95, 94, 94, 94, 93, 351, 325, 937, 1326, 698,
135070 /* 230 */ 706, 1326, 242, 412, 99, 100, 90, 978, 978, 853,
135071 /* 240 */ 856, 845, 845, 97, 97, 98, 98, 98, 98, 347,
135072 /* 250 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
135073 /* 260 */ 351, 325, 937, 1327, 384, 699, 1327, 381, 379, 99,
135074 /* 270 */ 100, 90, 978, 978, 853, 856, 845, 845, 97, 97,
135075 /* 280 */ 98, 98, 98, 98, 701, 96, 96, 96, 96, 95,
135076 /* 290 */ 95, 94, 94, 94, 93, 351, 325, 92, 89, 178,
135077 /* 300 */ 833, 935, 373, 700, 99, 100, 90, 978, 978, 853,
135078 /* 310 */ 856, 845, 845, 97, 97, 98, 98, 98, 98, 375,
135079 /* 320 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
135080 /* 330 */ 351, 325, 1275, 946, 354, 818, 935, 739, 739, 99,
135081 /* 340 */ 100, 90, 978, 978, 853, 856, 845, 845, 97, 97,
135082 /* 350 */ 98, 98, 98, 98, 230, 96, 96, 96, 96, 95,
135083 /* 360 */ 95, 94, 94, 94, 93, 351, 325, 968, 227, 92,
135084 /* 370 */ 89, 178, 373, 300, 99, 100, 90, 978, 978, 853,
135085 /* 380 */ 856, 845, 845, 97, 97, 98, 98, 98, 98, 920,
135086 /* 390 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
135087 /* 400 */ 351, 325, 449, 447, 447, 447, 147, 737, 737, 99,
135088 /* 410 */ 100, 90, 978, 978, 853, 856, 845, 845, 97, 97,
135089 /* 420 */ 98, 98, 98, 98, 296, 96, 96, 96, 96, 95,
135090 /* 430 */ 95, 94, 94, 94, 93, 351, 325, 419, 231, 957,
135091 /* 440 */ 957, 158, 25, 422, 99, 100, 90, 978, 978, 853,
135092 /* 450 */ 856, 845, 845, 97, 97, 98, 98, 98, 98, 450,
135093 /* 460 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
135094 /* 470 */ 351, 443, 224, 224, 420, 957, 957, 961, 325, 52,
135095 /* 480 */ 52, 958, 959, 176, 415, 78, 99, 100, 90, 978,
135096 /* 490 */ 978, 853, 856, 845, 845, 97, 97, 98, 98, 98,
135097 /* 500 */ 98, 379, 96, 96, 96, 96, 95, 95, 94, 94,
135098 /* 510 */ 94, 93, 351, 325, 428, 418, 298, 958, 959, 961,
135099 /* 520 */ 81, 99, 88, 90, 978, 978, 853, 856, 845, 845,
135100 /* 530 */ 97, 97, 98, 98, 98, 98, 717, 96, 96, 96,
135101 /* 540 */ 96, 95, 95, 94, 94, 94, 93, 351, 325, 842,
135102 /* 550 */ 842, 854, 857, 996, 318, 343, 379, 100, 90, 978,
135103 /* 560 */ 978, 853, 856, 845, 845, 97, 97, 98, 98, 98,
135104 /* 570 */ 98, 450, 96, 96, 96, 96, 95, 95, 94, 94,
135105 /* 580 */ 94, 93, 351, 325, 350, 350, 350, 260, 377, 340,
135106 /* 590 */ 928, 52, 52, 90, 978, 978, 853, 856, 845, 845,
135107 /* 600 */ 97, 97, 98, 98, 98, 98, 361, 96, 96, 96,
135108 /* 610 */ 96, 95, 95, 94, 94, 94, 93, 351, 86, 445,
135109 /* 620 */ 846, 3, 1202, 361, 360, 378, 344, 813, 957, 957,
135110 /* 630 */ 1299, 86, 445, 729, 3, 212, 169, 287, 405, 282,
135111 /* 640 */ 404, 199, 232, 450, 300, 760, 83, 84, 280, 245,
135112 /* 650 */ 262, 365, 251, 85, 352, 352, 92, 89, 178, 83,
135113 /* 660 */ 84, 242, 412, 52, 52, 448, 85, 352, 352, 246,
135114 /* 670 */ 958, 959, 194, 455, 670, 402, 399, 398, 448, 243,
135115 /* 680 */ 221, 114, 434, 776, 361, 450, 397, 268, 747, 224,
135116 /* 690 */ 224, 132, 132, 198, 832, 434, 452, 451, 428, 427,
135117 /* 700 */ 819, 415, 734, 713, 132, 52, 52, 832, 268, 452,
135118 /* 710 */ 451, 734, 194, 819, 363, 402, 399, 398, 450, 1270,
135119 /* 720 */ 1270, 23, 957, 957, 86, 445, 397, 3, 228, 429,
135120 /* 730 */ 894, 824, 824, 826, 827, 19, 203, 720, 52, 52,
135121 /* 740 */ 428, 408, 439, 249, 824, 824, 826, 827, 19, 229,
135122 /* 750 */ 403, 153, 83, 84, 761, 177, 241, 450, 721, 85,
135123 /* 760 */ 352, 352, 120, 157, 958, 959, 58, 976, 409, 355,
135124 /* 770 */ 330, 448, 268, 428, 430, 320, 790, 32, 32, 86,
135125 /* 780 */ 445, 776, 3, 341, 98, 98, 98, 98, 434, 96,
135126 /* 790 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 351,
135127 /* 800 */ 832, 120, 452, 451, 813, 886, 819, 83, 84, 976,
135128 /* 810 */ 813, 132, 410, 919, 85, 352, 352, 132, 407, 789,
135129 /* 820 */ 957, 957, 92, 89, 178, 916, 448, 262, 370, 261,
135130 /* 830 */ 82, 913, 80, 262, 370, 261, 776, 824, 824, 826,
135131 /* 840 */ 827, 19, 933, 434, 96, 96, 96, 96, 95, 95,
135132 /* 850 */ 94, 94, 94, 93, 351, 832, 74, 452, 451, 957,
135133 /* 860 */ 957, 819, 958, 959, 120, 92, 89, 178, 944, 2,
135134 /* 870 */ 917, 964, 268, 1, 975, 76, 445, 762, 3, 708,
135135 /* 880 */ 900, 900, 387, 957, 957, 757, 918, 371, 740, 778,
135136 /* 890 */ 756, 257, 824, 824, 826, 827, 19, 417, 741, 450,
135137 /* 900 */ 24, 958, 959, 83, 84, 369, 957, 957, 177, 226,
135138 /* 910 */ 85, 352, 352, 884, 315, 314, 313, 215, 311, 10,
135139 /* 920 */ 10, 683, 448, 349, 348, 958, 959, 908, 777, 157,
135140 /* 930 */ 120, 957, 957, 337, 776, 416, 711, 310, 450, 434,
135141 /* 940 */ 450, 321, 450, 791, 103, 200, 175, 450, 958, 959,
135142 /* 950 */ 907, 832, 792, 452, 451, 9, 9, 819, 10, 10,
135143 /* 960 */ 52, 52, 51, 51, 180, 716, 248, 10, 10, 171,
135144 /* 970 */ 170, 167, 339, 958, 959, 247, 984, 702, 702, 450,
135145 /* 980 */ 715, 233, 686, 982, 888, 983, 182, 913, 824, 824,
135146 /* 990 */ 826, 827, 19, 183, 256, 423, 132, 181, 394, 10,
135147 /* 1000 */ 10, 888, 890, 749, 957, 957, 916, 268, 985, 198,
135148 /* 1010 */ 985, 349, 348, 425, 415, 299, 817, 832, 326, 825,
135149 /* 1020 */ 120, 332, 133, 819, 268, 98, 98, 98, 98, 91,
135150 /* 1030 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
135151 /* 1040 */ 351, 157, 810, 371, 382, 359, 958, 959, 358, 268,
135152 /* 1050 */ 450, 917, 368, 324, 824, 824, 826, 450, 709, 450,
135153 /* 1060 */ 264, 380, 888, 450, 876, 746, 253, 918, 255, 433,
135154 /* 1070 */ 36, 36, 234, 450, 234, 120, 269, 37, 37, 12,
135155 /* 1080 */ 12, 334, 272, 27, 27, 450, 330, 118, 450, 162,
135156 /* 1090 */ 742, 280, 450, 38, 38, 450, 985, 356, 985, 450,
135157 /* 1100 */ 709, 1209, 450, 132, 450, 39, 39, 450, 40, 40,
135158 /* 1110 */ 450, 362, 41, 41, 450, 42, 42, 450, 254, 28,
135159 /* 1120 */ 28, 450, 29, 29, 31, 31, 450, 43, 43, 450,
135160 /* 1130 */ 44, 44, 450, 714, 45, 45, 450, 11, 11, 767,
135161 /* 1140 */ 450, 46, 46, 450, 268, 450, 105, 105, 450, 47,
135162 /* 1150 */ 47, 450, 48, 48, 450, 237, 33, 33, 450, 172,
135163 /* 1160 */ 49, 49, 450, 50, 50, 34, 34, 274, 122, 122,
135164 /* 1170 */ 450, 123, 123, 450, 124, 124, 450, 897, 56, 56,
135165 /* 1180 */ 450, 896, 35, 35, 450, 267, 450, 817, 450, 817,
135166 /* 1190 */ 106, 106, 450, 53, 53, 385, 107, 107, 450, 817,
135167 /* 1200 */ 108, 108, 817, 450, 104, 104, 121, 121, 119, 119,
135168 /* 1210 */ 450, 117, 112, 112, 450, 276, 450, 225, 111, 111,
135169 /* 1220 */ 450, 730, 450, 109, 109, 450, 673, 674, 675, 911,
135170 /* 1230 */ 110, 110, 317, 998, 55, 55, 57, 57, 692, 331,
135171 /* 1240 */ 54, 54, 26, 26, 696, 30, 30, 317, 936, 197,
135172 /* 1250 */ 196, 195, 335, 281, 336, 446, 331, 745, 689, 436,
135173 /* 1260 */ 440, 444, 120, 72, 386, 223, 175, 345, 757, 932,
135174 /* 1270 */ 20, 286, 319, 756, 815, 372, 374, 202, 202, 202,
135175 /* 1280 */ 263, 395, 285, 74, 208, 21, 696, 719, 718, 883,
135176 /* 1290 */ 120, 120, 120, 120, 120, 754, 278, 828, 77, 74,
135177 /* 1300 */ 726, 727, 785, 783, 879, 202, 999, 208, 893, 892,
135178 /* 1310 */ 893, 892, 694, 816, 763, 116, 774, 1289, 431, 432,
135179 /* 1320 */ 302, 999, 390, 303, 823, 697, 691, 680, 159, 289,
135180 /* 1330 */ 679, 883, 681, 951, 291, 218, 293, 7, 316, 828,
135181 /* 1340 */ 173, 805, 259, 364, 252, 910, 376, 713, 295, 435,
135182 /* 1350 */ 308, 168, 954, 993, 135, 400, 990, 284, 881, 880,
135183 /* 1360 */ 205, 927, 925, 59, 333, 62, 144, 156, 130, 72,
135184 /* 1370 */ 802, 366, 367, 393, 137, 185, 189, 160, 139, 383,
135185 /* 1380 */ 67, 895, 140, 141, 142, 148, 389, 812, 775, 266,
135186 /* 1390 */ 219, 190, 154, 391, 912, 875, 271, 406, 191, 322,
135187 /* 1400 */ 682, 733, 192, 342, 732, 724, 731, 711, 723, 421,
135188 /* 1410 */ 705, 71, 323, 6, 204, 771, 288, 79, 297, 346,
135189 /* 1420 */ 772, 704, 290, 283, 703, 770, 292, 294, 966, 239,
135190 /* 1430 */ 769, 102, 861, 438, 426, 240, 424, 442, 73, 213,
135191 /* 1440 */ 688, 238, 22, 453, 952, 214, 217, 216, 454, 677,
135192 /* 1450 */ 676, 671, 753, 125, 115, 235, 126, 669, 353, 166,
135193 /* 1460 */ 127, 244, 179, 357, 306, 304, 305, 307, 113, 891,
135194 /* 1470 */ 327, 889, 811, 328, 134, 128, 136, 138, 743, 258,
135195 /* 1480 */ 906, 184, 143, 129, 909, 186, 63, 64, 145, 187,
135196 /* 1490 */ 905, 65, 8, 66, 13, 188, 202, 898, 265, 149,
135197 /* 1500 */ 987, 388, 150, 685, 161, 392, 285, 193, 279, 396,
135198 /* 1510 */ 151, 401, 68, 14, 15, 722, 69, 236, 831, 131,
135199 /* 1520 */ 830, 859, 70, 751, 16, 414, 755, 4, 174, 220,
135200 /* 1530 */ 222, 784, 201, 152, 779, 77, 74, 17, 18, 874,
135201 /* 1540 */ 860, 858, 915, 863, 914, 207, 206, 941, 163, 437,
135202 /* 1550 */ 947, 942, 164, 209, 1002, 441, 862, 165, 210, 829,
135203 /* 1560 */ 695, 87, 312, 211, 1291, 1290, 309,
135204 };
135205 static const YYCODETYPE yy_lookahead[] = {
135206 /* 0 */ 19, 95, 53, 97, 22, 24, 24, 101, 27, 28,
135207 /* 10 */ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
135208 /* 20 */ 39, 40, 41, 152, 43, 44, 45, 46, 47, 48,
@@ -135112,55 +135451,55 @@
135451 /* 300 */ 1256, 1200, 1206, 1260, 1247, 1261, 1263, 1262, 1266, 1278,
135452 /* 310 */ 1282, 1292, 1294, 1297, 1298, 1299, 1300, 1221, 1224, 1228,
135453 /* 320 */ 1288, 1291, 1276, 1277, 1295,
135454 };
135455 static const YYACTIONTYPE yy_default[] = {
135456 /* 0 */ 1280, 1270, 1270, 1270, 1202, 1202, 1202, 1202, 1270, 1096,
135457 /* 10 */ 1125, 1125, 1254, 1332, 1332, 1332, 1332, 1332, 1332, 1201,
135458 /* 20 */ 1332, 1332, 1332, 1332, 1270, 1100, 1131, 1332, 1332, 1332,
135459 /* 30 */ 1332, 1203, 1204, 1332, 1332, 1332, 1253, 1255, 1141, 1140,
135460 /* 40 */ 1139, 1138, 1236, 1112, 1136, 1129, 1133, 1203, 1197, 1198,
135461 /* 50 */ 1196, 1200, 1204, 1332, 1132, 1167, 1181, 1166, 1332, 1332,
135462 /* 60 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135463 /* 70 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135464 /* 80 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135465 /* 90 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135466 /* 100 */ 1332, 1332, 1332, 1332, 1175, 1180, 1187, 1179, 1176, 1169,
135467 /* 110 */ 1168, 1170, 1171, 1332, 1019, 1067, 1332, 1332, 1332, 1172,
135468 /* 120 */ 1332, 1173, 1184, 1183, 1182, 1261, 1288, 1287, 1332, 1332,
135469 /* 130 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135470 /* 140 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135471 /* 150 */ 1332, 1332, 1332, 1332, 1332, 1280, 1270, 1025, 1025, 1332,
135472 /* 160 */ 1270, 1270, 1270, 1270, 1270, 1270, 1266, 1100, 1091, 1332,
135473 /* 170 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135474 /* 180 */ 1258, 1256, 1332, 1217, 1332, 1332, 1332, 1332, 1332, 1332,
135475 /* 190 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135476 /* 200 */ 1332, 1332, 1332, 1332, 1096, 1332, 1332, 1332, 1332, 1332,
135477 /* 210 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1282, 1332, 1231,
135478 /* 220 */ 1096, 1096, 1096, 1098, 1080, 1090, 1004, 1135, 1114, 1114,
135479 /* 230 */ 1321, 1135, 1321, 1042, 1302, 1039, 1125, 1114, 1199, 1125,
135480 /* 240 */ 1125, 1097, 1090, 1332, 1324, 1105, 1105, 1323, 1323, 1105,
135481 /* 250 */ 1146, 1070, 1135, 1076, 1076, 1076, 1076, 1105, 1016, 1135,
135482 /* 260 */ 1146, 1070, 1070, 1135, 1105, 1016, 1235, 1318, 1105, 1105,
135483 /* 270 */ 1016, 1210, 1105, 1016, 1105, 1016, 1210, 1068, 1068, 1068,
135484 /* 280 */ 1057, 1210, 1068, 1042, 1068, 1057, 1068, 1068, 1118, 1113,
135485 /* 290 */ 1118, 1113, 1118, 1113, 1118, 1113, 1105, 1205, 1105, 1332,
135486 /* 300 */ 1210, 1214, 1214, 1210, 1130, 1119, 1128, 1126, 1135, 1022,
135487 /* 310 */ 1060, 1285, 1285, 1281, 1281, 1281, 1281, 1329, 1329, 1266,
135488 /* 320 */ 1297, 1297, 1044, 1044, 1297, 1332, 1332, 1332, 1332, 1332,
135489 /* 330 */ 1332, 1292, 1332, 1219, 1332, 1332, 1332, 1332, 1332, 1332,
135490 /* 340 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135491 /* 350 */ 1332, 1332, 1152, 1332, 1000, 1263, 1332, 1332, 1262, 1332,
135492 /* 360 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135493 /* 370 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1320,
135494 /* 380 */ 1332, 1332, 1332, 1332, 1332, 1332, 1234, 1233, 1332, 1332,
135495 /* 390 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135496 /* 400 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
135497 /* 410 */ 1332, 1082, 1332, 1332, 1332, 1306, 1332, 1332, 1332, 1332,
135498 /* 420 */ 1332, 1332, 1332, 1127, 1332, 1120, 1332, 1332, 1311, 1332,
135499 /* 430 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1272,
135500 /* 440 */ 1332, 1332, 1332, 1271, 1332, 1332, 1332, 1332, 1332, 1154,
135501 /* 450 */ 1332, 1153, 1157, 1332, 1010, 1332,
135502 };
135503 /********** End of lemon-generated parsing tables *****************************/
135504
135505 /* The next table maps tokens (terminal symbols) into fallback tokens.
@@ -135602,147 +135941,147 @@
135941 /* 169 */ "expr ::= expr EQ|NE expr",
135942 /* 170 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
135943 /* 171 */ "expr ::= expr PLUS|MINUS expr",
135944 /* 172 */ "expr ::= expr STAR|SLASH|REM expr",
135945 /* 173 */ "expr ::= expr CONCAT expr",
135946 /* 174 */ "likeop ::= NOT LIKE_KW|MATCH",
135947 /* 175 */ "expr ::= expr likeop expr",
135948 /* 176 */ "expr ::= expr likeop expr ESCAPE expr",
135949 /* 177 */ "expr ::= expr ISNULL|NOTNULL",
135950 /* 178 */ "expr ::= expr NOT NULL",
135951 /* 179 */ "expr ::= expr IS expr",
135952 /* 180 */ "expr ::= expr IS NOT expr",
135953 /* 181 */ "expr ::= NOT expr",
135954 /* 182 */ "expr ::= BITNOT expr",
135955 /* 183 */ "expr ::= MINUS expr",
135956 /* 184 */ "expr ::= PLUS expr",
135957 /* 185 */ "between_op ::= BETWEEN",
135958 /* 186 */ "between_op ::= NOT BETWEEN",
135959 /* 187 */ "expr ::= expr between_op expr AND expr",
135960 /* 188 */ "in_op ::= IN",
135961 /* 189 */ "in_op ::= NOT IN",
135962 /* 190 */ "expr ::= expr in_op LP exprlist RP",
135963 /* 191 */ "expr ::= LP select RP",
135964 /* 192 */ "expr ::= expr in_op LP select RP",
135965 /* 193 */ "expr ::= expr in_op nm dbnm paren_exprlist",
135966 /* 194 */ "expr ::= EXISTS LP select RP",
135967 /* 195 */ "expr ::= CASE case_operand case_exprlist case_else END",
135968 /* 196 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
135969 /* 197 */ "case_exprlist ::= WHEN expr THEN expr",
135970 /* 198 */ "case_else ::= ELSE expr",
135971 /* 199 */ "case_else ::=",
135972 /* 200 */ "case_operand ::= expr",
135973 /* 201 */ "case_operand ::=",
135974 /* 202 */ "exprlist ::=",
135975 /* 203 */ "nexprlist ::= nexprlist COMMA expr",
135976 /* 204 */ "nexprlist ::= expr",
135977 /* 205 */ "paren_exprlist ::=",
135978 /* 206 */ "paren_exprlist ::= LP exprlist RP",
135979 /* 207 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
135980 /* 208 */ "uniqueflag ::= UNIQUE",
135981 /* 209 */ "uniqueflag ::=",
135982 /* 210 */ "eidlist_opt ::=",
135983 /* 211 */ "eidlist_opt ::= LP eidlist RP",
135984 /* 212 */ "eidlist ::= eidlist COMMA nm collate sortorder",
135985 /* 213 */ "eidlist ::= nm collate sortorder",
135986 /* 214 */ "collate ::=",
135987 /* 215 */ "collate ::= COLLATE ID|STRING",
135988 /* 216 */ "cmd ::= DROP INDEX ifexists fullname",
135989 /* 217 */ "cmd ::= VACUUM",
135990 /* 218 */ "cmd ::= VACUUM nm",
135991 /* 219 */ "cmd ::= PRAGMA nm dbnm",
135992 /* 220 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
135993 /* 221 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
135994 /* 222 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
135995 /* 223 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
135996 /* 224 */ "plus_num ::= PLUS INTEGER|FLOAT",
135997 /* 225 */ "minus_num ::= MINUS INTEGER|FLOAT",
135998 /* 226 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
135999 /* 227 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
136000 /* 228 */ "trigger_time ::= BEFORE",
136001 /* 229 */ "trigger_time ::= AFTER",
136002 /* 230 */ "trigger_time ::= INSTEAD OF",
136003 /* 231 */ "trigger_time ::=",
136004 /* 232 */ "trigger_event ::= DELETE|INSERT",
136005 /* 233 */ "trigger_event ::= UPDATE",
136006 /* 234 */ "trigger_event ::= UPDATE OF idlist",
136007 /* 235 */ "when_clause ::=",
136008 /* 236 */ "when_clause ::= WHEN expr",
136009 /* 237 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
136010 /* 238 */ "trigger_cmd_list ::= trigger_cmd SEMI",
136011 /* 239 */ "trnm ::= nm DOT nm",
136012 /* 240 */ "tridxby ::= INDEXED BY nm",
136013 /* 241 */ "tridxby ::= NOT INDEXED",
136014 /* 242 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt",
136015 /* 243 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select",
136016 /* 244 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt",
136017 /* 245 */ "trigger_cmd ::= select",
136018 /* 246 */ "expr ::= RAISE LP IGNORE RP",
136019 /* 247 */ "expr ::= RAISE LP raisetype COMMA nm RP",
136020 /* 248 */ "raisetype ::= ROLLBACK",
136021 /* 249 */ "raisetype ::= ABORT",
136022 /* 250 */ "raisetype ::= FAIL",
136023 /* 251 */ "cmd ::= DROP TRIGGER ifexists fullname",
136024 /* 252 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
136025 /* 253 */ "cmd ::= DETACH database_kw_opt expr",
136026 /* 254 */ "key_opt ::=",
136027 /* 255 */ "key_opt ::= KEY expr",
136028 /* 256 */ "cmd ::= REINDEX",
136029 /* 257 */ "cmd ::= REINDEX nm dbnm",
136030 /* 258 */ "cmd ::= ANALYZE",
136031 /* 259 */ "cmd ::= ANALYZE nm dbnm",
136032 /* 260 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
136033 /* 261 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
136034 /* 262 */ "add_column_fullname ::= fullname",
136035 /* 263 */ "cmd ::= create_vtab",
136036 /* 264 */ "cmd ::= create_vtab LP vtabarglist RP",
136037 /* 265 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
136038 /* 266 */ "vtabarg ::=",
136039 /* 267 */ "vtabargtoken ::= ANY",
136040 /* 268 */ "vtabargtoken ::= lp anylist RP",
136041 /* 269 */ "lp ::= LP",
136042 /* 270 */ "with ::=",
136043 /* 271 */ "with ::= WITH wqlist",
136044 /* 272 */ "with ::= WITH RECURSIVE wqlist",
136045 /* 273 */ "wqlist ::= nm eidlist_opt AS LP select RP",
136046 /* 274 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
136047 /* 275 */ "input ::= cmdlist",
136048 /* 276 */ "cmdlist ::= cmdlist ecmd",
136049 /* 277 */ "cmdlist ::= ecmd",
136050 /* 278 */ "ecmd ::= SEMI",
136051 /* 279 */ "ecmd ::= explain cmdx SEMI",
136052 /* 280 */ "explain ::=",
136053 /* 281 */ "trans_opt ::=",
136054 /* 282 */ "trans_opt ::= TRANSACTION",
136055 /* 283 */ "trans_opt ::= TRANSACTION nm",
136056 /* 284 */ "savepoint_opt ::= SAVEPOINT",
136057 /* 285 */ "savepoint_opt ::=",
136058 /* 286 */ "cmd ::= create_table create_table_args",
136059 /* 287 */ "columnlist ::= columnlist COMMA columnname carglist",
136060 /* 288 */ "columnlist ::= columnname carglist",
136061 /* 289 */ "nm ::= ID|INDEXED",
136062 /* 290 */ "nm ::= STRING",
136063 /* 291 */ "nm ::= JOIN_KW",
136064 /* 292 */ "typetoken ::= typename",
136065 /* 293 */ "typename ::= ID|STRING",
136066 /* 294 */ "signed ::= plus_num",
136067 /* 295 */ "signed ::= minus_num",
136068 /* 296 */ "carglist ::= carglist ccons",
136069 /* 297 */ "carglist ::=",
136070 /* 298 */ "ccons ::= NULL onconf",
136071 /* 299 */ "conslist_opt ::= COMMA conslist",
136072 /* 300 */ "conslist ::= conslist tconscomma tcons",
136073 /* 301 */ "conslist ::= tcons",
136074 /* 302 */ "tconscomma ::=",
136075 /* 303 */ "defer_subclause_opt ::= defer_subclause",
136076 /* 304 */ "resolvetype ::= raisetype",
136077 /* 305 */ "selectnowith ::= oneselect",
136078 /* 306 */ "oneselect ::= values",
136079 /* 307 */ "sclp ::= selcollist COMMA",
136080 /* 308 */ "as ::= ID|STRING",
136081 /* 309 */ "expr ::= term",
136082 /* 310 */ "likeop ::= LIKE_KW|MATCH",
136083 /* 311 */ "exprlist ::= nexprlist",
136084 /* 312 */ "nmnum ::= plus_num",
136085 /* 313 */ "nmnum ::= nm",
136086 /* 314 */ "nmnum ::= ON",
136087 /* 315 */ "nmnum ::= DELETE",
@@ -136375,11 +136714,10 @@
136714 { 173, 3 },
136715 { 173, 3 },
136716 { 173, 3 },
136717 { 173, 3 },
136718 { 173, 3 },
 
136719 { 221, 2 },
136720 { 173, 3 },
136721 { 173, 5 },
136722 { 173, 2 },
136723 { 173, 3 },
@@ -136512,10 +136850,11 @@
136850 { 194, 1 },
136851 { 195, 1 },
136852 { 209, 2 },
136853 { 210, 1 },
136854 { 173, 1 },
136855 { 221, 1 },
136856 { 208, 1 },
136857 { 230, 1 },
136858 { 230, 1 },
136859 { 230, 1 },
136860 { 230, 1 },
@@ -136654,11 +136993,11 @@
136993 case 42: /* autoinc ::= */ yytestcase(yyruleno==42);
136994 case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57);
136995 case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67);
136996 case 76: /* ifexists ::= */ yytestcase(yyruleno==76);
136997 case 90: /* distinct ::= */ yytestcase(yyruleno==90);
136998 case 214: /* collate ::= */ yytestcase(yyruleno==214);
136999 {yymsp[1].minor.yy194 = 0;}
137000 break;
137001 case 17: /* ifnotexists ::= IF NOT EXISTS */
137002 {yymsp[-2].minor.yy194 = 1;}
137003 break;
@@ -136798,13 +137137,13 @@
137137 case 144: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==144);
137138 {yymsp[-1].minor.yy194 = yymsp[0].minor.yy194;}
137139 break;
137140 case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
137141 case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75);
137142 case 186: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==186);
137143 case 189: /* in_op ::= NOT IN */ yytestcase(yyruleno==189);
137144 case 215: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==215);
137145 {yymsp[-1].minor.yy194 = 1;}
137146 break;
137147 case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
137148 {yymsp[-1].minor.yy194 = 0;}
137149 break;
@@ -136964,13 +137303,13 @@
137303 {yymsp[0].minor.yy194 = SF_All;}
137304 break;
137305 case 91: /* sclp ::= */
137306 case 119: /* orderby_opt ::= */ yytestcase(yyruleno==119);
137307 case 126: /* groupby_opt ::= */ yytestcase(yyruleno==126);
137308 case 202: /* exprlist ::= */ yytestcase(yyruleno==202);
137309 case 205: /* paren_exprlist ::= */ yytestcase(yyruleno==205);
137310 case 210: /* eidlist_opt ::= */ yytestcase(yyruleno==210);
137311 {yymsp[1].minor.yy148 = 0;}
137312 break;
137313 case 92: /* selcollist ::= sclp expr as */
137314 {
137315 yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy148, yymsp[-1].minor.yy190.pExpr);
@@ -136992,12 +137331,12 @@
137331 yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, pDot);
137332 }
137333 break;
137334 case 95: /* as ::= AS nm */
137335 case 106: /* dbnm ::= DOT nm */ yytestcase(yyruleno==106);
137336 case 224: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==224);
137337 case 225: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==225);
137338 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
137339 break;
137340 case 97: /* from ::= */
137341 {yymsp[1].minor.yy185 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy185));}
137342 break;
@@ -137076,18 +137415,18 @@
137415 {yymsp[-3].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
137416 break;
137417 case 112: /* on_opt ::= ON expr */
137418 case 129: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==129);
137419 case 136: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==136);
137420 case 198: /* case_else ::= ELSE expr */ yytestcase(yyruleno==198);
137421 {yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr;}
137422 break;
137423 case 113: /* on_opt ::= */
137424 case 128: /* having_opt ::= */ yytestcase(yyruleno==128);
137425 case 135: /* where_opt ::= */ yytestcase(yyruleno==135);
137426 case 199: /* case_else ::= */ yytestcase(yyruleno==199);
137427 case 201: /* case_operand ::= */ yytestcase(yyruleno==201);
137428 {yymsp[1].minor.yy72 = 0;}
137429 break;
137430 case 115: /* indexed_opt ::= INDEXED BY nm */
137431 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
137432 break;
@@ -137320,17 +137659,14 @@
137659 case 171: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==171);
137660 case 172: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==172);
137661 case 173: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==173);
137662 {spanBinaryExpr(pParse,yymsp[-1].major,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);}
137663 break;
137664 case 174: /* likeop ::= NOT LIKE_KW|MATCH */
 
 
 
137665 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
137666 break;
137667 case 175: /* expr ::= expr likeop expr */
137668 {
137669 ExprList *pList;
137670 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
137671 yymsp[-1].minor.yy0.n &= 0x7fffffff;
137672 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy190.pExpr);
@@ -137339,11 +137675,11 @@
137675 exprNot(pParse, bNot, &yymsp[-2].minor.yy190);
137676 yymsp[-2].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
137677 if( yymsp[-2].minor.yy190.pExpr ) yymsp[-2].minor.yy190.pExpr->flags |= EP_InfixFunc;
137678 }
137679 break;
137680 case 176: /* expr ::= expr likeop expr ESCAPE expr */
137681 {
137682 ExprList *pList;
137683 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
137684 yymsp[-3].minor.yy0.n &= 0x7fffffff;
137685 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
@@ -137353,43 +137689,43 @@
137689 exprNot(pParse, bNot, &yymsp[-4].minor.yy190);
137690 yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
137691 if( yymsp[-4].minor.yy190.pExpr ) yymsp[-4].minor.yy190.pExpr->flags |= EP_InfixFunc;
137692 }
137693 break;
137694 case 177: /* expr ::= expr ISNULL|NOTNULL */
137695 {spanUnaryPostfix(pParse,yymsp[0].major,&yymsp[-1].minor.yy190,&yymsp[0].minor.yy0);}
137696 break;
137697 case 178: /* expr ::= expr NOT NULL */
137698 {spanUnaryPostfix(pParse,TK_NOTNULL,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy0);}
137699 break;
137700 case 179: /* expr ::= expr IS expr */
137701 {
137702 spanBinaryExpr(pParse,TK_IS,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);
137703 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-2].minor.yy190.pExpr, TK_ISNULL);
137704 }
137705 break;
137706 case 180: /* expr ::= expr IS NOT expr */
137707 {
137708 spanBinaryExpr(pParse,TK_ISNOT,&yymsp[-3].minor.yy190,&yymsp[0].minor.yy190);
137709 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-3].minor.yy190.pExpr, TK_NOTNULL);
137710 }
137711 break;
137712 case 181: /* expr ::= NOT expr */
137713 case 182: /* expr ::= BITNOT expr */ yytestcase(yyruleno==182);
137714 {spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,yymsp[-1].major,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
137715 break;
137716 case 183: /* expr ::= MINUS expr */
137717 {spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UMINUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
137718 break;
137719 case 184: /* expr ::= PLUS expr */
137720 {spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UPLUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
137721 break;
137722 case 185: /* between_op ::= BETWEEN */
137723 case 188: /* in_op ::= IN */ yytestcase(yyruleno==188);
137724 {yymsp[0].minor.yy194 = 0;}
137725 break;
137726 case 187: /* expr ::= expr between_op expr AND expr */
137727 {
137728 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
137729 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr);
137730 yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy190.pExpr, 0);
137731 if( yymsp[-4].minor.yy190.pExpr ){
@@ -137399,11 +137735,11 @@
137735 }
137736 exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
137737 yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
137738 }
137739 break;
137740 case 190: /* expr ::= expr in_op LP exprlist RP */
137741 {
137742 if( yymsp[-1].minor.yy148==0 ){
137743 /* Expressions of the form
137744 **
137745 ** expr1 IN ()
@@ -137452,26 +137788,26 @@
137788 exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
137789 }
137790 yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
137791 }
137792 break;
137793 case 191: /* expr ::= LP select RP */
137794 {
137795 spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/
137796 yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
137797 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy190.pExpr, yymsp[-1].minor.yy243);
137798 }
137799 break;
137800 case 192: /* expr ::= expr in_op LP select RP */
137801 {
137802 yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0);
137803 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, yymsp[-1].minor.yy243);
137804 exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
137805 yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
137806 }
137807 break;
137808 case 193: /* expr ::= expr in_op nm dbnm paren_exprlist */
137809 {
137810 SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
137811 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
137812 if( yymsp[0].minor.yy148 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy148);
137813 yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0);
@@ -137478,19 +137814,19 @@
137814 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, pSelect);
137815 exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
137816 yymsp[-4].minor.yy190.zEnd = yymsp[-1].minor.yy0.z ? &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n] : &yymsp[-2].minor.yy0.z[yymsp[-2].minor.yy0.n];
137817 }
137818 break;
137819 case 194: /* expr ::= EXISTS LP select RP */
137820 {
137821 Expr *p;
137822 spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/
137823 p = yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
137824 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy243);
137825 }
137826 break;
137827 case 195: /* expr ::= CASE case_operand case_exprlist case_else END */
137828 {
137829 spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-C*/
137830 yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy72, 0);
137831 if( yymsp[-4].minor.yy190.pExpr ){
137832 yymsp[-4].minor.yy190.pExpr->x.pList = yymsp[-1].minor.yy72 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[-1].minor.yy72) : yymsp[-2].minor.yy148;
@@ -137499,313 +137835,314 @@
137835 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy148);
137836 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy72);
137837 }
137838 }
137839 break;
137840 case 196: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
137841 {
137842 yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[-2].minor.yy190.pExpr);
137843 yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr);
137844 }
137845 break;
137846 case 197: /* case_exprlist ::= WHEN expr THEN expr */
137847 {
137848 yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
137849 yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, yymsp[0].minor.yy190.pExpr);
137850 }
137851 break;
137852 case 200: /* case_operand ::= expr */
137853 {yymsp[0].minor.yy72 = yymsp[0].minor.yy190.pExpr; /*A-overwrites-X*/}
137854 break;
137855 case 203: /* nexprlist ::= nexprlist COMMA expr */
137856 {yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[0].minor.yy190.pExpr);}
137857 break;
137858 case 204: /* nexprlist ::= expr */
137859 {yymsp[0].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy190.pExpr); /*A-overwrites-Y*/}
137860 break;
137861 case 206: /* paren_exprlist ::= LP exprlist RP */
137862 case 211: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==211);
137863 {yymsp[-2].minor.yy148 = yymsp[-1].minor.yy148;}
137864 break;
137865 case 207: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
137866 {
137867 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
137868 sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy148, yymsp[-10].minor.yy194,
137869 &yymsp[-11].minor.yy0, yymsp[0].minor.yy72, SQLITE_SO_ASC, yymsp[-8].minor.yy194, SQLITE_IDXTYPE_APPDEF);
137870 }
137871 break;
137872 case 208: /* uniqueflag ::= UNIQUE */
137873 case 249: /* raisetype ::= ABORT */ yytestcase(yyruleno==249);
137874 {yymsp[0].minor.yy194 = OE_Abort;}
137875 break;
137876 case 209: /* uniqueflag ::= */
137877 {yymsp[1].minor.yy194 = OE_None;}
137878 break;
137879 case 212: /* eidlist ::= eidlist COMMA nm collate sortorder */
137880 {
137881 yymsp[-4].minor.yy148 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194);
137882 }
137883 break;
137884 case 213: /* eidlist ::= nm collate sortorder */
137885 {
137886 yymsp[-2].minor.yy148 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194); /*A-overwrites-Y*/
137887 }
137888 break;
137889 case 216: /* cmd ::= DROP INDEX ifexists fullname */
137890 {sqlite3DropIndex(pParse, yymsp[0].minor.yy185, yymsp[-1].minor.yy194);}
137891 break;
137892 case 217: /* cmd ::= VACUUM */
137893 {sqlite3Vacuum(pParse,0);}
137894 break;
137895 case 218: /* cmd ::= VACUUM nm */
137896 {sqlite3Vacuum(pParse,&yymsp[0].minor.yy0);}
137897 break;
137898 case 219: /* cmd ::= PRAGMA nm dbnm */
137899 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
137900 break;
137901 case 220: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
137902 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
137903 break;
137904 case 221: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
137905 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
137906 break;
137907 case 222: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
137908 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
137909 break;
137910 case 223: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
137911 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
137912 break;
137913 case 226: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
137914 {
137915 Token all;
137916 all.z = yymsp[-3].minor.yy0.z;
137917 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
137918 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy145, &all);
137919 }
137920 break;
137921 case 227: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
137922 {
137923 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy194, yymsp[-4].minor.yy332.a, yymsp[-4].minor.yy332.b, yymsp[-2].minor.yy185, yymsp[0].minor.yy72, yymsp[-10].minor.yy194, yymsp[-8].minor.yy194);
137924 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
137925 }
137926 break;
137927 case 228: /* trigger_time ::= BEFORE */
137928 { yymsp[0].minor.yy194 = TK_BEFORE; }
137929 break;
137930 case 229: /* trigger_time ::= AFTER */
137931 { yymsp[0].minor.yy194 = TK_AFTER; }
137932 break;
137933 case 230: /* trigger_time ::= INSTEAD OF */
137934 { yymsp[-1].minor.yy194 = TK_INSTEAD;}
137935 break;
137936 case 231: /* trigger_time ::= */
137937 { yymsp[1].minor.yy194 = TK_BEFORE; }
137938 break;
137939 case 232: /* trigger_event ::= DELETE|INSERT */
137940 case 233: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==233);
137941 {yymsp[0].minor.yy332.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy332.b = 0;}
137942 break;
137943 case 234: /* trigger_event ::= UPDATE OF idlist */
137944 {yymsp[-2].minor.yy332.a = TK_UPDATE; yymsp[-2].minor.yy332.b = yymsp[0].minor.yy254;}
137945 break;
137946 case 235: /* when_clause ::= */
137947 case 254: /* key_opt ::= */ yytestcase(yyruleno==254);
137948 { yymsp[1].minor.yy72 = 0; }
137949 break;
137950 case 236: /* when_clause ::= WHEN expr */
137951 case 255: /* key_opt ::= KEY expr */ yytestcase(yyruleno==255);
137952 { yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr; }
137953 break;
137954 case 237: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
137955 {
137956 assert( yymsp[-2].minor.yy145!=0 );
137957 yymsp[-2].minor.yy145->pLast->pNext = yymsp[-1].minor.yy145;
137958 yymsp[-2].minor.yy145->pLast = yymsp[-1].minor.yy145;
137959 }
137960 break;
137961 case 238: /* trigger_cmd_list ::= trigger_cmd SEMI */
137962 {
137963 assert( yymsp[-1].minor.yy145!=0 );
137964 yymsp[-1].minor.yy145->pLast = yymsp[-1].minor.yy145;
137965 }
137966 break;
137967 case 239: /* trnm ::= nm DOT nm */
137968 {
137969 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
137970 sqlite3ErrorMsg(pParse,
137971 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
137972 "statements within triggers");
137973 }
137974 break;
137975 case 240: /* tridxby ::= INDEXED BY nm */
137976 {
137977 sqlite3ErrorMsg(pParse,
137978 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
137979 "within triggers");
137980 }
137981 break;
137982 case 241: /* tridxby ::= NOT INDEXED */
137983 {
137984 sqlite3ErrorMsg(pParse,
137985 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
137986 "within triggers");
137987 }
137988 break;
137989 case 242: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
137990 {yymsp[-6].minor.yy145 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy148, yymsp[0].minor.yy72, yymsp[-5].minor.yy194);}
137991 break;
137992 case 243: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */
137993 {yymsp[-4].minor.yy145 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy254, yymsp[0].minor.yy243, yymsp[-4].minor.yy194);/*A-overwrites-R*/}
137994 break;
137995 case 244: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
137996 {yymsp[-4].minor.yy145 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy72);}
137997 break;
137998 case 245: /* trigger_cmd ::= select */
137999 {yymsp[0].minor.yy145 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy243); /*A-overwrites-X*/}
138000 break;
138001 case 246: /* expr ::= RAISE LP IGNORE RP */
138002 {
138003 spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
138004 yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
138005 if( yymsp[-3].minor.yy190.pExpr ){
138006 yymsp[-3].minor.yy190.pExpr->affinity = OE_Ignore;
138007 }
138008 }
138009 break;
138010 case 247: /* expr ::= RAISE LP raisetype COMMA nm RP */
138011 {
138012 spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
138013 yymsp[-5].minor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
138014 if( yymsp[-5].minor.yy190.pExpr ) {
138015 yymsp[-5].minor.yy190.pExpr->affinity = (char)yymsp[-3].minor.yy194;
138016 }
138017 }
138018 break;
138019 case 248: /* raisetype ::= ROLLBACK */
138020 {yymsp[0].minor.yy194 = OE_Rollback;}
138021 break;
138022 case 250: /* raisetype ::= FAIL */
138023 {yymsp[0].minor.yy194 = OE_Fail;}
138024 break;
138025 case 251: /* cmd ::= DROP TRIGGER ifexists fullname */
138026 {
138027 sqlite3DropTrigger(pParse,yymsp[0].minor.yy185,yymsp[-1].minor.yy194);
138028 }
138029 break;
138030 case 252: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
138031 {
138032 sqlite3Attach(pParse, yymsp[-3].minor.yy190.pExpr, yymsp[-1].minor.yy190.pExpr, yymsp[0].minor.yy72);
138033 }
138034 break;
138035 case 253: /* cmd ::= DETACH database_kw_opt expr */
138036 {
138037 sqlite3Detach(pParse, yymsp[0].minor.yy190.pExpr);
138038 }
138039 break;
138040 case 256: /* cmd ::= REINDEX */
138041 {sqlite3Reindex(pParse, 0, 0);}
138042 break;
138043 case 257: /* cmd ::= REINDEX nm dbnm */
138044 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
138045 break;
138046 case 258: /* cmd ::= ANALYZE */
138047 {sqlite3Analyze(pParse, 0, 0);}
138048 break;
138049 case 259: /* cmd ::= ANALYZE nm dbnm */
138050 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
138051 break;
138052 case 260: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
138053 {
138054 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy185,&yymsp[0].minor.yy0);
138055 }
138056 break;
138057 case 261: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
138058 {
138059 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
138060 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
138061 }
138062 break;
138063 case 262: /* add_column_fullname ::= fullname */
138064 {
138065 disableLookaside(pParse);
138066 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy185);
138067 }
138068 break;
138069 case 263: /* cmd ::= create_vtab */
138070 {sqlite3VtabFinishParse(pParse,0);}
138071 break;
138072 case 264: /* cmd ::= create_vtab LP vtabarglist RP */
138073 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
138074 break;
138075 case 265: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
138076 {
138077 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy194);
138078 }
138079 break;
138080 case 266: /* vtabarg ::= */
138081 {sqlite3VtabArgInit(pParse);}
138082 break;
138083 case 267: /* vtabargtoken ::= ANY */
138084 case 268: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==268);
138085 case 269: /* lp ::= LP */ yytestcase(yyruleno==269);
138086 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
138087 break;
138088 case 270: /* with ::= */
138089 {yymsp[1].minor.yy285 = 0;}
138090 break;
138091 case 271: /* with ::= WITH wqlist */
138092 { yymsp[-1].minor.yy285 = yymsp[0].minor.yy285; }
138093 break;
138094 case 272: /* with ::= WITH RECURSIVE wqlist */
138095 { yymsp[-2].minor.yy285 = yymsp[0].minor.yy285; }
138096 break;
138097 case 273: /* wqlist ::= nm eidlist_opt AS LP select RP */
138098 {
138099 yymsp[-5].minor.yy285 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); /*A-overwrites-X*/
138100 }
138101 break;
138102 case 274: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
138103 {
138104 yymsp[-7].minor.yy285 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy285, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243);
138105 }
138106 break;
138107 default:
138108 /* (275) input ::= cmdlist */ yytestcase(yyruleno==275);
138109 /* (276) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==276);
138110 /* (277) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=277);
138111 /* (278) ecmd ::= SEMI */ yytestcase(yyruleno==278);
138112 /* (279) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==279);
138113 /* (280) explain ::= */ yytestcase(yyruleno==280);
138114 /* (281) trans_opt ::= */ yytestcase(yyruleno==281);
138115 /* (282) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==282);
138116 /* (283) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==283);
138117 /* (284) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==284);
138118 /* (285) savepoint_opt ::= */ yytestcase(yyruleno==285);
138119 /* (286) cmd ::= create_table create_table_args */ yytestcase(yyruleno==286);
138120 /* (287) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==287);
138121 /* (288) columnlist ::= columnname carglist */ yytestcase(yyruleno==288);
138122 /* (289) nm ::= ID|INDEXED */ yytestcase(yyruleno==289);
138123 /* (290) nm ::= STRING */ yytestcase(yyruleno==290);
138124 /* (291) nm ::= JOIN_KW */ yytestcase(yyruleno==291);
138125 /* (292) typetoken ::= typename */ yytestcase(yyruleno==292);
138126 /* (293) typename ::= ID|STRING */ yytestcase(yyruleno==293);
138127 /* (294) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=294);
138128 /* (295) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=295);
138129 /* (296) carglist ::= carglist ccons */ yytestcase(yyruleno==296);
138130 /* (297) carglist ::= */ yytestcase(yyruleno==297);
138131 /* (298) ccons ::= NULL onconf */ yytestcase(yyruleno==298);
138132 /* (299) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==299);
138133 /* (300) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==300);
138134 /* (301) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=301);
138135 /* (302) tconscomma ::= */ yytestcase(yyruleno==302);
138136 /* (303) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=303);
138137 /* (304) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=304);
138138 /* (305) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=305);
138139 /* (306) oneselect ::= values */ yytestcase(yyruleno==306);
138140 /* (307) sclp ::= selcollist COMMA */ yytestcase(yyruleno==307);
138141 /* (308) as ::= ID|STRING */ yytestcase(yyruleno==308);
138142 /* (309) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=309);
138143 /* (310) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==310);
138144 /* (311) exprlist ::= nexprlist */ yytestcase(yyruleno==311);
138145 /* (312) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=312);
138146 /* (313) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=313);
138147 /* (314) nmnum ::= ON */ yytestcase(yyruleno==314);
138148 /* (315) nmnum ::= DELETE */ yytestcase(yyruleno==315);
@@ -181079,11 +181416,13 @@
181416 typedef unsigned short u16;
181417 typedef short i16;
181418 typedef sqlite3_int64 i64;
181419 typedef sqlite3_uint64 u64;
181420
181421 #ifndef ArraySize
181422 # define ArraySize(x) ((int)(sizeof(x) / sizeof(x[0])))
181423 #endif
181424
181425 #define testcase(x)
181426 #define ALWAYS(x) 1
181427 #define NEVER(x) 0
181428
@@ -186302,11 +186641,14 @@
186641 if( p1->bEof==0 ){
186642 if( (p1->iRowid==iLast)
186643 || (bFromValid && fts5RowidCmp(pExpr, p1->iRowid, iFrom)<0)
186644 ){
186645 int rc = fts5ExprNodeNext(pExpr, p1, bFromValid, iFrom);
186646 if( rc!=SQLITE_OK ){
186647 pNode->bNomatch = 0;
186648 return rc;
186649 }
186650 }
186651 }
186652 }
186653
186654 fts5ExprNodeTest_OR(pExpr, pNode);
@@ -186333,11 +186675,14 @@
186675 Fts5ExprNode *pChild = pAnd->apChild[iChild];
186676 int cmp = fts5RowidCmp(pExpr, iLast, pChild->iRowid);
186677 if( cmp>0 ){
186678 /* Advance pChild until it points to iLast or laster */
186679 rc = fts5ExprNodeNext(pExpr, pChild, 1, iLast);
186680 if( rc!=SQLITE_OK ){
186681 pAnd->bNomatch = 0;
186682 return rc;
186683 }
186684 }
186685
186686 /* If the child node is now at EOF, so is the parent AND node. Otherwise,
186687 ** the child node is guaranteed to have advanced at least as far as
186688 ** rowid iLast. So if it is not at exactly iLast, pChild->iRowid is the
@@ -186372,10 +186717,12 @@
186717 i64 iFrom
186718 ){
186719 int rc = fts5ExprNodeNext(pExpr, pNode->apChild[0], bFromValid, iFrom);
186720 if( rc==SQLITE_OK ){
186721 rc = fts5ExprNodeTest_AND(pExpr, pNode);
186722 }else{
186723 pNode->bNomatch = 0;
186724 }
186725 return rc;
186726 }
186727
186728 static int fts5ExprNodeTest_NOT(
@@ -186414,10 +186761,13 @@
186761 ){
186762 int rc = fts5ExprNodeNext(pExpr, pNode->apChild[0], bFromValid, iFrom);
186763 if( rc==SQLITE_OK ){
186764 rc = fts5ExprNodeTest_NOT(pExpr, pNode);
186765 }
186766 if( rc!=SQLITE_OK ){
186767 pNode->bNomatch = 0;
186768 }
186769 return rc;
186770 }
186771
186772 /*
186773 ** If pNode currently points to a match, this function returns SQLITE_OK
@@ -197534,11 +197884,11 @@
197884 int nArg, /* Number of args */
197885 sqlite3_value **apUnused /* Function arguments */
197886 ){
197887 assert( nArg==0 );
197888 UNUSED_PARAM2(nArg, apUnused);
197889 sqlite3_result_text(pCtx, "fts5: 2017-02-20 13:11:07 ff213f2ef5bf96754a2264685d25546d8b5ccf0a", -1, SQLITE_TRANSIENT);
197890 }
197891
197892 static int fts5Init(sqlite3 *db){
197893 static const sqlite3_module fts5Mod = {
197894 /* iVersion */ 2,
197895
+3 -3
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -119,13 +119,13 @@
119119
**
120120
** See also: [sqlite3_libversion()],
121121
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122122
** [sqlite_version()] and [sqlite_source_id()].
123123
*/
124
-#define SQLITE_VERSION "3.17.0"
125
-#define SQLITE_VERSION_NUMBER 3017000
126
-#define SQLITE_SOURCE_ID "2017-02-13 16:02:40 ada05cfa86ad7f5645450ac7a2a21c9aa6e57d2c"
124
+#define SQLITE_VERSION "3.18.0"
125
+#define SQLITE_VERSION_NUMBER 3018000
126
+#define SQLITE_SOURCE_ID "2017-02-23 02:15:33 7a959f6d1ea038988cdb4c02d6f37abaec2580a0"
127127
128128
/*
129129
** CAPI3REF: Run-Time Library Version Numbers
130130
** KEYWORDS: sqlite3_version sqlite3_sourceid
131131
**
132132
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -119,13 +119,13 @@
119 **
120 ** See also: [sqlite3_libversion()],
121 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122 ** [sqlite_version()] and [sqlite_source_id()].
123 */
124 #define SQLITE_VERSION "3.17.0"
125 #define SQLITE_VERSION_NUMBER 3017000
126 #define SQLITE_SOURCE_ID "2017-02-13 16:02:40 ada05cfa86ad7f5645450ac7a2a21c9aa6e57d2c"
127
128 /*
129 ** CAPI3REF: Run-Time Library Version Numbers
130 ** KEYWORDS: sqlite3_version sqlite3_sourceid
131 **
132
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -119,13 +119,13 @@
119 **
120 ** See also: [sqlite3_libversion()],
121 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122 ** [sqlite_version()] and [sqlite_source_id()].
123 */
124 #define SQLITE_VERSION "3.18.0"
125 #define SQLITE_VERSION_NUMBER 3018000
126 #define SQLITE_SOURCE_ID "2017-02-23 02:15:33 7a959f6d1ea038988cdb4c02d6f37abaec2580a0"
127
128 /*
129 ** CAPI3REF: Run-Time Library Version Numbers
130 ** KEYWORDS: sqlite3_version sqlite3_sourceid
131 **
132

Keyboard Shortcuts

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