Fossil SCM
SQLite 3.27.2
Commit
367831eaac4349e60f424a474044711232057e829ba0ee0a12d05d38206d6b02
Parent
e869ad9c936daa3…
2 files changed
+170
-182
+4
-4
+170
-182
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | ** This file is an amalgamation of many separate C source files from SQLite |
| 3 | -** version 3.27.1. By combining all the individual C code files into this | |
| 3 | +** version 3.27.2. By combining all the individual C code files into this | |
| 4 | 4 | ** single large file, the entire code can be compiled as a single translation |
| 5 | 5 | ** unit. This allows many compilers to do optimizations that would not be |
| 6 | 6 | ** possible if the files were compiled separately. Performance improvements |
| 7 | 7 | ** of 5% or more are commonly seen when SQLite is compiled as a single |
| 8 | 8 | ** translation unit. |
| @@ -1160,13 +1160,13 @@ | ||
| 1160 | 1160 | ** |
| 1161 | 1161 | ** See also: [sqlite3_libversion()], |
| 1162 | 1162 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 1163 | 1163 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 1164 | 1164 | */ |
| 1165 | -#define SQLITE_VERSION "3.27.1" | |
| 1166 | -#define SQLITE_VERSION_NUMBER 3027001 | |
| 1167 | -#define SQLITE_SOURCE_ID "2019-02-08 13:17:39 0eca3dd3d38b31c92b49ca2d311128b74584714d9e7de895b1a6286ef959a1dd" | |
| 1165 | +#define SQLITE_VERSION "3.27.2" | |
| 1166 | +#define SQLITE_VERSION_NUMBER 3027002 | |
| 1167 | +#define SQLITE_SOURCE_ID "2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0f6d7" | |
| 1168 | 1168 | |
| 1169 | 1169 | /* |
| 1170 | 1170 | ** CAPI3REF: Run-Time Library Version Numbers |
| 1171 | 1171 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 1172 | 1172 | ** |
| @@ -3406,11 +3406,11 @@ | ||
| 3406 | 3406 | ** ^Changes made as part of [foreign key actions] are included in the |
| 3407 | 3407 | ** count, but those made as part of REPLACE constraint resolution are |
| 3408 | 3408 | ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers |
| 3409 | 3409 | ** are not counted. |
| 3410 | 3410 | ** |
| 3411 | -** This the [sqlite3_total_changes(D)] interface only reports the number | |
| 3411 | +** The [sqlite3_total_changes(D)] interface only reports the number | |
| 3412 | 3412 | ** of rows that changed due to SQL statement run against database |
| 3413 | 3413 | ** connection D. Any changes by other database connections are ignored. |
| 3414 | 3414 | ** To detect changes against a database file from other database |
| 3415 | 3415 | ** connections use the [PRAGMA data_version] command or the |
| 3416 | 3416 | ** [SQLITE_FCNTL_DATA_VERSION] [file control]. |
| @@ -14935,61 +14935,60 @@ | ||
| 14935 | 14935 | #define OP_ColumnsUsed 118 |
| 14936 | 14936 | #define OP_SeekHit 119 /* synopsis: seekHit=P2 */ |
| 14937 | 14937 | #define OP_Sequence 120 /* synopsis: r[P2]=cursor[P1].ctr++ */ |
| 14938 | 14938 | #define OP_NewRowid 121 /* synopsis: r[P2]=rowid */ |
| 14939 | 14939 | #define OP_Insert 122 /* synopsis: intkey=r[P3] data=r[P2] */ |
| 14940 | -#define OP_InsertInt 123 /* synopsis: intkey=P3 data=r[P2] */ | |
| 14941 | -#define OP_Delete 124 | |
| 14942 | -#define OP_ResetCount 125 | |
| 14943 | -#define OP_SorterCompare 126 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ | |
| 14944 | -#define OP_SorterData 127 /* synopsis: r[P2]=data */ | |
| 14945 | -#define OP_RowData 128 /* synopsis: r[P2]=data */ | |
| 14946 | -#define OP_Rowid 129 /* synopsis: r[P2]=rowid */ | |
| 14947 | -#define OP_NullRow 130 | |
| 14948 | -#define OP_SeekEnd 131 | |
| 14949 | -#define OP_SorterInsert 132 /* synopsis: key=r[P2] */ | |
| 14950 | -#define OP_IdxInsert 133 /* synopsis: key=r[P2] */ | |
| 14951 | -#define OP_IdxDelete 134 /* synopsis: key=r[P2@P3] */ | |
| 14952 | -#define OP_DeferredSeek 135 /* synopsis: Move P3 to P1.rowid if needed */ | |
| 14953 | -#define OP_IdxRowid 136 /* synopsis: r[P2]=rowid */ | |
| 14954 | -#define OP_Destroy 137 | |
| 14955 | -#define OP_Clear 138 | |
| 14956 | -#define OP_ResetSorter 139 | |
| 14957 | -#define OP_CreateBtree 140 /* synopsis: r[P2]=root iDb=P1 flags=P3 */ | |
| 14940 | +#define OP_Delete 123 | |
| 14941 | +#define OP_ResetCount 124 | |
| 14942 | +#define OP_SorterCompare 125 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ | |
| 14943 | +#define OP_SorterData 126 /* synopsis: r[P2]=data */ | |
| 14944 | +#define OP_RowData 127 /* synopsis: r[P2]=data */ | |
| 14945 | +#define OP_Rowid 128 /* synopsis: r[P2]=rowid */ | |
| 14946 | +#define OP_NullRow 129 | |
| 14947 | +#define OP_SeekEnd 130 | |
| 14948 | +#define OP_SorterInsert 131 /* synopsis: key=r[P2] */ | |
| 14949 | +#define OP_IdxInsert 132 /* synopsis: key=r[P2] */ | |
| 14950 | +#define OP_IdxDelete 133 /* synopsis: key=r[P2@P3] */ | |
| 14951 | +#define OP_DeferredSeek 134 /* synopsis: Move P3 to P1.rowid if needed */ | |
| 14952 | +#define OP_IdxRowid 135 /* synopsis: r[P2]=rowid */ | |
| 14953 | +#define OP_Destroy 136 | |
| 14954 | +#define OP_Clear 137 | |
| 14955 | +#define OP_ResetSorter 138 | |
| 14956 | +#define OP_CreateBtree 139 /* synopsis: r[P2]=root iDb=P1 flags=P3 */ | |
| 14957 | +#define OP_SqlExec 140 | |
| 14958 | 14958 | #define OP_Real 141 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ |
| 14959 | -#define OP_SqlExec 142 | |
| 14960 | -#define OP_ParseSchema 143 | |
| 14961 | -#define OP_LoadAnalysis 144 | |
| 14962 | -#define OP_DropTable 145 | |
| 14963 | -#define OP_DropIndex 146 | |
| 14964 | -#define OP_DropTrigger 147 | |
| 14965 | -#define OP_IntegrityCk 148 | |
| 14966 | -#define OP_RowSetAdd 149 /* synopsis: rowset(P1)=r[P2] */ | |
| 14967 | -#define OP_Param 150 | |
| 14968 | -#define OP_FkCounter 151 /* synopsis: fkctr[P1]+=P2 */ | |
| 14969 | -#define OP_MemMax 152 /* synopsis: r[P1]=max(r[P1],r[P2]) */ | |
| 14970 | -#define OP_OffsetLimit 153 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ | |
| 14971 | -#define OP_AggInverse 154 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */ | |
| 14972 | -#define OP_AggStep 155 /* synopsis: accum=r[P3] step(r[P2@P5]) */ | |
| 14973 | -#define OP_AggStep1 156 /* synopsis: accum=r[P3] step(r[P2@P5]) */ | |
| 14974 | -#define OP_AggValue 157 /* synopsis: r[P3]=value N=P2 */ | |
| 14975 | -#define OP_AggFinal 158 /* synopsis: accum=r[P1] N=P2 */ | |
| 14976 | -#define OP_Expire 159 | |
| 14977 | -#define OP_TableLock 160 /* synopsis: iDb=P1 root=P2 write=P3 */ | |
| 14978 | -#define OP_VBegin 161 | |
| 14979 | -#define OP_VCreate 162 | |
| 14980 | -#define OP_VDestroy 163 | |
| 14981 | -#define OP_VOpen 164 | |
| 14982 | -#define OP_VColumn 165 /* synopsis: r[P3]=vcolumn(P2) */ | |
| 14983 | -#define OP_VRename 166 | |
| 14984 | -#define OP_Pagecount 167 | |
| 14985 | -#define OP_MaxPgcnt 168 | |
| 14986 | -#define OP_Trace 169 | |
| 14987 | -#define OP_CursorHint 170 | |
| 14988 | -#define OP_Noop 171 | |
| 14989 | -#define OP_Explain 172 | |
| 14990 | -#define OP_Abortable 173 | |
| 14959 | +#define OP_ParseSchema 142 | |
| 14960 | +#define OP_LoadAnalysis 143 | |
| 14961 | +#define OP_DropTable 144 | |
| 14962 | +#define OP_DropIndex 145 | |
| 14963 | +#define OP_DropTrigger 146 | |
| 14964 | +#define OP_IntegrityCk 147 | |
| 14965 | +#define OP_RowSetAdd 148 /* synopsis: rowset(P1)=r[P2] */ | |
| 14966 | +#define OP_Param 149 | |
| 14967 | +#define OP_FkCounter 150 /* synopsis: fkctr[P1]+=P2 */ | |
| 14968 | +#define OP_MemMax 151 /* synopsis: r[P1]=max(r[P1],r[P2]) */ | |
| 14969 | +#define OP_OffsetLimit 152 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ | |
| 14970 | +#define OP_AggInverse 153 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */ | |
| 14971 | +#define OP_AggStep 154 /* synopsis: accum=r[P3] step(r[P2@P5]) */ | |
| 14972 | +#define OP_AggStep1 155 /* synopsis: accum=r[P3] step(r[P2@P5]) */ | |
| 14973 | +#define OP_AggValue 156 /* synopsis: r[P3]=value N=P2 */ | |
| 14974 | +#define OP_AggFinal 157 /* synopsis: accum=r[P1] N=P2 */ | |
| 14975 | +#define OP_Expire 158 | |
| 14976 | +#define OP_TableLock 159 /* synopsis: iDb=P1 root=P2 write=P3 */ | |
| 14977 | +#define OP_VBegin 160 | |
| 14978 | +#define OP_VCreate 161 | |
| 14979 | +#define OP_VDestroy 162 | |
| 14980 | +#define OP_VOpen 163 | |
| 14981 | +#define OP_VColumn 164 /* synopsis: r[P3]=vcolumn(P2) */ | |
| 14982 | +#define OP_VRename 165 | |
| 14983 | +#define OP_Pagecount 166 | |
| 14984 | +#define OP_MaxPgcnt 167 | |
| 14985 | +#define OP_Trace 168 | |
| 14986 | +#define OP_CursorHint 169 | |
| 14987 | +#define OP_Noop 170 | |
| 14988 | +#define OP_Explain 171 | |
| 14989 | +#define OP_Abortable 172 | |
| 14991 | 14990 | |
| 14992 | 14991 | /* Properties such as "out2" or "jump" that are specified in |
| 14993 | 14992 | ** comments following the "case" for each opcode in the vdbe.c |
| 14994 | 14993 | ** are encoded into bitvectors as follows: |
| 14995 | 14994 | */ |
| @@ -15014,16 +15013,16 @@ | ||
| 15014 | 15013 | /* 88 */ 0x12, 0x20, 0x00, 0x00, 0x26, 0x26, 0x26, 0x26,\ |
| 15015 | 15014 | /* 96 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00, 0x12,\ |
| 15016 | 15015 | /* 104 */ 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15017 | 15016 | /* 112 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15018 | 15017 | /* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15019 | -/* 128 */ 0x00, 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00,\ | |
| 15020 | -/* 136 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ | |
| 15021 | -/* 144 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00,\ | |
| 15022 | -/* 152 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ | |
| 15023 | -/* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\ | |
| 15024 | -/* 168 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,} | |
| 15018 | +/* 128 */ 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x10,\ | |
| 15019 | +/* 136 */ 0x10, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00,\ | |
| 15020 | +/* 144 */ 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04,\ | |
| 15021 | +/* 152 */ 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ | |
| 15022 | +/* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10,\ | |
| 15023 | +/* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00,} | |
| 15025 | 15024 | |
| 15026 | 15025 | /* The sqlite3P2Values() routine is able to run faster if it knows |
| 15027 | 15026 | ** the value of the largest JUMP opcode. The smaller the maximum |
| 15028 | 15027 | ** JUMP opcode the better, so the mkopcodeh.tcl script that |
| 15029 | 15028 | ** generated this include file strives to group all JUMP opcodes |
| @@ -19172,11 +19171,11 @@ | ||
| 19172 | 19171 | SQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*); |
| 19173 | 19172 | SQLITE_PRIVATE void sqlite3AlterRenameColumn(Parse*, SrcList*, Token*, Token*); |
| 19174 | 19173 | SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *); |
| 19175 | 19174 | SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...); |
| 19176 | 19175 | SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int); |
| 19177 | -SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int, int); | |
| 19176 | +SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int); | |
| 19178 | 19177 | SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr*); |
| 19179 | 19178 | SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*); |
| 19180 | 19179 | SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p); |
| 19181 | 19180 | SQLITE_PRIVATE int sqlite3MatchSpanName(const char*, const char*, const char*, const char*); |
| 19182 | 19181 | SQLITE_PRIVATE int sqlite3ResolveExprNames(NameContext*, Expr*); |
| @@ -32137,61 +32136,60 @@ | ||
| 32137 | 32136 | /* 118 */ "ColumnsUsed" OpHelp(""), |
| 32138 | 32137 | /* 119 */ "SeekHit" OpHelp("seekHit=P2"), |
| 32139 | 32138 | /* 120 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), |
| 32140 | 32139 | /* 121 */ "NewRowid" OpHelp("r[P2]=rowid"), |
| 32141 | 32140 | /* 122 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), |
| 32142 | - /* 123 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"), | |
| 32143 | - /* 124 */ "Delete" OpHelp(""), | |
| 32144 | - /* 125 */ "ResetCount" OpHelp(""), | |
| 32145 | - /* 126 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), | |
| 32146 | - /* 127 */ "SorterData" OpHelp("r[P2]=data"), | |
| 32147 | - /* 128 */ "RowData" OpHelp("r[P2]=data"), | |
| 32148 | - /* 129 */ "Rowid" OpHelp("r[P2]=rowid"), | |
| 32149 | - /* 130 */ "NullRow" OpHelp(""), | |
| 32150 | - /* 131 */ "SeekEnd" OpHelp(""), | |
| 32151 | - /* 132 */ "SorterInsert" OpHelp("key=r[P2]"), | |
| 32152 | - /* 133 */ "IdxInsert" OpHelp("key=r[P2]"), | |
| 32153 | - /* 134 */ "IdxDelete" OpHelp("key=r[P2@P3]"), | |
| 32154 | - /* 135 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"), | |
| 32155 | - /* 136 */ "IdxRowid" OpHelp("r[P2]=rowid"), | |
| 32156 | - /* 137 */ "Destroy" OpHelp(""), | |
| 32157 | - /* 138 */ "Clear" OpHelp(""), | |
| 32158 | - /* 139 */ "ResetSorter" OpHelp(""), | |
| 32159 | - /* 140 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"), | |
| 32141 | + /* 123 */ "Delete" OpHelp(""), | |
| 32142 | + /* 124 */ "ResetCount" OpHelp(""), | |
| 32143 | + /* 125 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), | |
| 32144 | + /* 126 */ "SorterData" OpHelp("r[P2]=data"), | |
| 32145 | + /* 127 */ "RowData" OpHelp("r[P2]=data"), | |
| 32146 | + /* 128 */ "Rowid" OpHelp("r[P2]=rowid"), | |
| 32147 | + /* 129 */ "NullRow" OpHelp(""), | |
| 32148 | + /* 130 */ "SeekEnd" OpHelp(""), | |
| 32149 | + /* 131 */ "SorterInsert" OpHelp("key=r[P2]"), | |
| 32150 | + /* 132 */ "IdxInsert" OpHelp("key=r[P2]"), | |
| 32151 | + /* 133 */ "IdxDelete" OpHelp("key=r[P2@P3]"), | |
| 32152 | + /* 134 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"), | |
| 32153 | + /* 135 */ "IdxRowid" OpHelp("r[P2]=rowid"), | |
| 32154 | + /* 136 */ "Destroy" OpHelp(""), | |
| 32155 | + /* 137 */ "Clear" OpHelp(""), | |
| 32156 | + /* 138 */ "ResetSorter" OpHelp(""), | |
| 32157 | + /* 139 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"), | |
| 32158 | + /* 140 */ "SqlExec" OpHelp(""), | |
| 32160 | 32159 | /* 141 */ "Real" OpHelp("r[P2]=P4"), |
| 32161 | - /* 142 */ "SqlExec" OpHelp(""), | |
| 32162 | - /* 143 */ "ParseSchema" OpHelp(""), | |
| 32163 | - /* 144 */ "LoadAnalysis" OpHelp(""), | |
| 32164 | - /* 145 */ "DropTable" OpHelp(""), | |
| 32165 | - /* 146 */ "DropIndex" OpHelp(""), | |
| 32166 | - /* 147 */ "DropTrigger" OpHelp(""), | |
| 32167 | - /* 148 */ "IntegrityCk" OpHelp(""), | |
| 32168 | - /* 149 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), | |
| 32169 | - /* 150 */ "Param" OpHelp(""), | |
| 32170 | - /* 151 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), | |
| 32171 | - /* 152 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), | |
| 32172 | - /* 153 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), | |
| 32173 | - /* 154 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"), | |
| 32174 | - /* 155 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), | |
| 32175 | - /* 156 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"), | |
| 32176 | - /* 157 */ "AggValue" OpHelp("r[P3]=value N=P2"), | |
| 32177 | - /* 158 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), | |
| 32178 | - /* 159 */ "Expire" OpHelp(""), | |
| 32179 | - /* 160 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), | |
| 32180 | - /* 161 */ "VBegin" OpHelp(""), | |
| 32181 | - /* 162 */ "VCreate" OpHelp(""), | |
| 32182 | - /* 163 */ "VDestroy" OpHelp(""), | |
| 32183 | - /* 164 */ "VOpen" OpHelp(""), | |
| 32184 | - /* 165 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), | |
| 32185 | - /* 166 */ "VRename" OpHelp(""), | |
| 32186 | - /* 167 */ "Pagecount" OpHelp(""), | |
| 32187 | - /* 168 */ "MaxPgcnt" OpHelp(""), | |
| 32188 | - /* 169 */ "Trace" OpHelp(""), | |
| 32189 | - /* 170 */ "CursorHint" OpHelp(""), | |
| 32190 | - /* 171 */ "Noop" OpHelp(""), | |
| 32191 | - /* 172 */ "Explain" OpHelp(""), | |
| 32192 | - /* 173 */ "Abortable" OpHelp(""), | |
| 32160 | + /* 142 */ "ParseSchema" OpHelp(""), | |
| 32161 | + /* 143 */ "LoadAnalysis" OpHelp(""), | |
| 32162 | + /* 144 */ "DropTable" OpHelp(""), | |
| 32163 | + /* 145 */ "DropIndex" OpHelp(""), | |
| 32164 | + /* 146 */ "DropTrigger" OpHelp(""), | |
| 32165 | + /* 147 */ "IntegrityCk" OpHelp(""), | |
| 32166 | + /* 148 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), | |
| 32167 | + /* 149 */ "Param" OpHelp(""), | |
| 32168 | + /* 150 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), | |
| 32169 | + /* 151 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), | |
| 32170 | + /* 152 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), | |
| 32171 | + /* 153 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"), | |
| 32172 | + /* 154 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), | |
| 32173 | + /* 155 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"), | |
| 32174 | + /* 156 */ "AggValue" OpHelp("r[P3]=value N=P2"), | |
| 32175 | + /* 157 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), | |
| 32176 | + /* 158 */ "Expire" OpHelp(""), | |
| 32177 | + /* 159 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), | |
| 32178 | + /* 160 */ "VBegin" OpHelp(""), | |
| 32179 | + /* 161 */ "VCreate" OpHelp(""), | |
| 32180 | + /* 162 */ "VDestroy" OpHelp(""), | |
| 32181 | + /* 163 */ "VOpen" OpHelp(""), | |
| 32182 | + /* 164 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), | |
| 32183 | + /* 165 */ "VRename" OpHelp(""), | |
| 32184 | + /* 166 */ "Pagecount" OpHelp(""), | |
| 32185 | + /* 167 */ "MaxPgcnt" OpHelp(""), | |
| 32186 | + /* 168 */ "Trace" OpHelp(""), | |
| 32187 | + /* 169 */ "CursorHint" OpHelp(""), | |
| 32188 | + /* 170 */ "Noop" OpHelp(""), | |
| 32189 | + /* 171 */ "Explain" OpHelp(""), | |
| 32190 | + /* 172 */ "Abortable" OpHelp(""), | |
| 32193 | 32191 | }; |
| 32194 | 32192 | return azName[i]; |
| 32195 | 32193 | } |
| 32196 | 32194 | #endif |
| 32197 | 32195 | |
| @@ -87933,18 +87931,11 @@ | ||
| 87933 | 87931 | ** cause any problems.) |
| 87934 | 87932 | ** |
| 87935 | 87933 | ** This instruction only works on tables. The equivalent instruction |
| 87936 | 87934 | ** for indices is OP_IdxInsert. |
| 87937 | 87935 | */ |
| 87938 | -/* Opcode: InsertInt P1 P2 P3 P4 P5 | |
| 87939 | -** Synopsis: intkey=P3 data=r[P2] | |
| 87940 | -** | |
| 87941 | -** This works exactly like OP_Insert except that the key is the | |
| 87942 | -** integer value P3, not the value of the integer stored in register P3. | |
| 87943 | -*/ | |
| 87944 | -case OP_Insert: | |
| 87945 | -case OP_InsertInt: { | |
| 87936 | +case OP_Insert: { | |
| 87946 | 87937 | Mem *pData; /* MEM cell holding data for the record to be inserted */ |
| 87947 | 87938 | Mem *pKey; /* MEM cell holding key for the record */ |
| 87948 | 87939 | VdbeCursor *pC; /* Cursor to table into which insert is written */ |
| 87949 | 87940 | int seekResult; /* Result of prior seek or 0 if no USESEEKRESULT flag */ |
| 87950 | 87941 | const char *zDb; /* database name - used by the update hook */ |
| @@ -87961,20 +87952,15 @@ | ||
| 87961 | 87952 | assert( (pOp->p5 & OPFLAG_ISNOOP) || pC->isTable ); |
| 87962 | 87953 | assert( pOp->p4type==P4_TABLE || pOp->p4type>=P4_STATIC ); |
| 87963 | 87954 | REGISTER_TRACE(pOp->p2, pData); |
| 87964 | 87955 | sqlite3VdbeIncrWriteCounter(p, pC); |
| 87965 | 87956 | |
| 87966 | - if( pOp->opcode==OP_Insert ){ | |
| 87967 | - pKey = &aMem[pOp->p3]; | |
| 87968 | - assert( pKey->flags & MEM_Int ); | |
| 87969 | - assert( memIsValid(pKey) ); | |
| 87970 | - REGISTER_TRACE(pOp->p3, pKey); | |
| 87971 | - x.nKey = pKey->u.i; | |
| 87972 | - }else{ | |
| 87973 | - assert( pOp->opcode==OP_InsertInt ); | |
| 87974 | - x.nKey = pOp->p3; | |
| 87975 | - } | |
| 87957 | + pKey = &aMem[pOp->p3]; | |
| 87958 | + assert( pKey->flags & MEM_Int ); | |
| 87959 | + assert( memIsValid(pKey) ); | |
| 87960 | + REGISTER_TRACE(pOp->p3, pKey); | |
| 87961 | + x.nKey = pKey->u.i; | |
| 87976 | 87962 | |
| 87977 | 87963 | if( pOp->p4type==P4_TABLE && HAS_UPDATE_HOOK(db) ){ |
| 87978 | 87964 | assert( pC->iDb>=0 ); |
| 87979 | 87965 | zDb = db->aDb[pC->iDb].zDbSName; |
| 87980 | 87966 | pTab = pOp->p4.pTab; |
| @@ -96129,10 +96115,42 @@ | ||
| 96129 | 96115 | } |
| 96130 | 96116 | } |
| 96131 | 96117 | return 0; |
| 96132 | 96118 | } |
| 96133 | 96119 | |
| 96120 | +#ifndef SQLITE_OMIT_WINDOWFUNC | |
| 96121 | +/* | |
| 96122 | +** Walker callback for resolveRemoveWindows(). | |
| 96123 | +*/ | |
| 96124 | +static int resolveRemoveWindowsCb(Walker *pWalker, Expr *pExpr){ | |
| 96125 | + if( ExprHasProperty(pExpr, EP_WinFunc) ){ | |
| 96126 | + Window **pp; | |
| 96127 | + for(pp=&pWalker->u.pSelect->pWin; *pp; pp=&(*pp)->pNextWin){ | |
| 96128 | + if( *pp==pExpr->y.pWin ){ | |
| 96129 | + *pp = (*pp)->pNextWin; | |
| 96130 | + break; | |
| 96131 | + } | |
| 96132 | + } | |
| 96133 | + } | |
| 96134 | + return WRC_Continue; | |
| 96135 | +} | |
| 96136 | + | |
| 96137 | +/* | |
| 96138 | +** Remove any Window objects owned by the expression pExpr from the | |
| 96139 | +** Select.pWin list of Select object pSelect. | |
| 96140 | +*/ | |
| 96141 | +static void resolveRemoveWindows(Select *pSelect, Expr *pExpr){ | |
| 96142 | + Walker sWalker; | |
| 96143 | + memset(&sWalker, 0, sizeof(Walker)); | |
| 96144 | + sWalker.xExprCallback = resolveRemoveWindowsCb; | |
| 96145 | + sWalker.u.pSelect = pSelect; | |
| 96146 | + sqlite3WalkExpr(&sWalker, pExpr); | |
| 96147 | +} | |
| 96148 | +#else | |
| 96149 | +# define resolveRemoveWindows(x,y) | |
| 96150 | +#endif | |
| 96151 | + | |
| 96134 | 96152 | /* |
| 96135 | 96153 | ** pOrderBy is an ORDER BY or GROUP BY clause in SELECT statement pSelect. |
| 96136 | 96154 | ** The Name context of the SELECT statement is pNC. zType is either |
| 96137 | 96155 | ** "ORDER" or "GROUP" depending on which type of clause pOrderBy is. |
| 96138 | 96156 | ** |
| @@ -96195,23 +96213,14 @@ | ||
| 96195 | 96213 | if( sqlite3ResolveExprNames(pNC, pE) ){ |
| 96196 | 96214 | return 1; |
| 96197 | 96215 | } |
| 96198 | 96216 | for(j=0; j<pSelect->pEList->nExpr; j++){ |
| 96199 | 96217 | if( sqlite3ExprCompare(0, pE, pSelect->pEList->a[j].pExpr, -1)==0 ){ |
| 96200 | -#ifndef SQLITE_OMIT_WINDOWFUNC | |
| 96201 | - if( ExprHasProperty(pE, EP_WinFunc) ){ | |
| 96202 | - /* Since this window function is being changed into a reference | |
| 96203 | - ** to the same window function the result set, remove the instance | |
| 96204 | - ** of this window function from the Select.pWin list. */ | |
| 96205 | - Window **pp; | |
| 96206 | - for(pp=&pSelect->pWin; *pp; pp=&(*pp)->pNextWin){ | |
| 96207 | - if( *pp==pE->y.pWin ){ | |
| 96208 | - *pp = (*pp)->pNextWin; | |
| 96209 | - } | |
| 96210 | - } | |
| 96211 | - } | |
| 96212 | -#endif | |
| 96218 | + /* Since this expresion is being changed into a reference | |
| 96219 | + ** to an identical expression in the result set, remove all Window | |
| 96220 | + ** objects belonging to the expression from the Select.pWin list. */ | |
| 96221 | + resolveRemoveWindows(pSelect, pE); | |
| 96213 | 96222 | pItem->u.x.iOrderByCol = j+1; |
| 96214 | 96223 | } |
| 96215 | 96224 | } |
| 96216 | 96225 | } |
| 96217 | 96226 | return sqlite3ResolveOrderGroupBy(pParse, pSelect, pOrderBy, zType); |
| @@ -99179,18 +99188,15 @@ | ||
| 99179 | 99188 | u32 savedNQueryLoop = pParse->nQueryLoop; |
| 99180 | 99189 | int rMayHaveNull = 0; |
| 99181 | 99190 | eType = IN_INDEX_EPH; |
| 99182 | 99191 | if( inFlags & IN_INDEX_LOOP ){ |
| 99183 | 99192 | pParse->nQueryLoop = 0; |
| 99184 | - if( pX->pLeft->iColumn<0 && !ExprHasProperty(pX, EP_xIsSelect) ){ | |
| 99185 | - eType = IN_INDEX_ROWID; | |
| 99186 | - } | |
| 99187 | 99193 | }else if( prRhsHasNull ){ |
| 99188 | 99194 | *prRhsHasNull = rMayHaveNull = ++pParse->nMem; |
| 99189 | 99195 | } |
| 99190 | 99196 | assert( pX->op==TK_IN ); |
| 99191 | - sqlite3CodeRhsOfIN(pParse, pX, iTab, eType==IN_INDEX_ROWID); | |
| 99197 | + sqlite3CodeRhsOfIN(pParse, pX, iTab); | |
| 99192 | 99198 | if( rMayHaveNull ){ |
| 99193 | 99199 | sqlite3SetHasNullFlag(v, iTab, rMayHaveNull); |
| 99194 | 99200 | } |
| 99195 | 99201 | pParse->nQueryLoop = savedNQueryLoop; |
| 99196 | 99202 | } |
| @@ -99287,16 +99293,10 @@ | ||
| 99287 | 99293 | ** constructed ephermeral table is returned. The first time the ephemeral |
| 99288 | 99294 | ** table is computed, the cursor number is also stored in pExpr->iTable, |
| 99289 | 99295 | ** however the cursor number returned might not be the same, as it might |
| 99290 | 99296 | ** have been duplicated using OP_OpenDup. |
| 99291 | 99297 | ** |
| 99292 | -** If parameter isRowid is non-zero, then LHS of the IN operator is guaranteed | |
| 99293 | -** to be a non-null integer. In this case, the ephemeral table can be an | |
| 99294 | -** table B-Tree that keyed by only integers. The more general cases uses | |
| 99295 | -** an index B-Tree which can have arbitrary keys, but is slower to both | |
| 99296 | -** read and write. | |
| 99297 | -** | |
| 99298 | 99298 | ** If the LHS expression ("x" in the examples) is a column value, or |
| 99299 | 99299 | ** the SELECT statement returns a column value, then the affinity of that |
| 99300 | 99300 | ** column is used to build the index keys. If both 'x' and the |
| 99301 | 99301 | ** SELECT... statement are columns, then numeric affinity is used |
| 99302 | 99302 | ** if either column has NUMERIC or INTEGER affinity. If neither |
| @@ -99304,12 +99304,11 @@ | ||
| 99304 | 99304 | ** is used. |
| 99305 | 99305 | */ |
| 99306 | 99306 | SQLITE_PRIVATE void sqlite3CodeRhsOfIN( |
| 99307 | 99307 | Parse *pParse, /* Parsing context */ |
| 99308 | 99308 | Expr *pExpr, /* The IN operator */ |
| 99309 | - int iTab, /* Use this cursor number */ | |
| 99310 | - int isRowid /* If true, LHS is a rowid */ | |
| 99309 | + int iTab /* Use this cursor number */ | |
| 99311 | 99310 | ){ |
| 99312 | 99311 | int addrOnce = 0; /* Address of the OP_Once instruction at top */ |
| 99313 | 99312 | int addr; /* Address of OP_OpenEphemeral instruction */ |
| 99314 | 99313 | Expr *pLeft; /* the LHS of the IN operator */ |
| 99315 | 99314 | KeyInfo *pKeyInfo = 0; /* Key information */ |
| @@ -99358,26 +99357,24 @@ | ||
| 99358 | 99357 | } |
| 99359 | 99358 | |
| 99360 | 99359 | /* Check to see if this is a vector IN operator */ |
| 99361 | 99360 | pLeft = pExpr->pLeft; |
| 99362 | 99361 | nVal = sqlite3ExprVectorSize(pLeft); |
| 99363 | - assert( !isRowid || nVal==1 ); | |
| 99364 | 99362 | |
| 99365 | 99363 | /* Construct the ephemeral table that will contain the content of |
| 99366 | 99364 | ** RHS of the IN operator. |
| 99367 | 99365 | */ |
| 99368 | 99366 | pExpr->iTable = iTab; |
| 99369 | - addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, | |
| 99370 | - pExpr->iTable, (isRowid?0:nVal)); | |
| 99367 | + addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pExpr->iTable, nVal); | |
| 99371 | 99368 | #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS |
| 99372 | 99369 | if( ExprHasProperty(pExpr, EP_xIsSelect) ){ |
| 99373 | 99370 | VdbeComment((v, "Result of SELECT %u", pExpr->x.pSelect->selId)); |
| 99374 | 99371 | }else{ |
| 99375 | 99372 | VdbeComment((v, "RHS of IN operator")); |
| 99376 | 99373 | } |
| 99377 | 99374 | #endif |
| 99378 | - pKeyInfo = isRowid ? 0 : sqlite3KeyInfoAlloc(pParse->db, nVal, 1); | |
| 99375 | + pKeyInfo = sqlite3KeyInfoAlloc(pParse->db, nVal, 1); | |
| 99379 | 99376 | |
| 99380 | 99377 | if( ExprHasProperty(pExpr, EP_xIsSelect) ){ |
| 99381 | 99378 | /* Case 1: expr IN (SELECT ...) |
| 99382 | 99379 | ** |
| 99383 | 99380 | ** Generate code to write the results of the select into the temporary |
| @@ -99387,11 +99384,10 @@ | ||
| 99387 | 99384 | ExprList *pEList = pSelect->pEList; |
| 99388 | 99385 | |
| 99389 | 99386 | ExplainQueryPlan((pParse, 1, "%sLIST SUBQUERY %d", |
| 99390 | 99387 | addrOnce?"":"CORRELATED ", pSelect->selId |
| 99391 | 99388 | )); |
| 99392 | - assert( !isRowid ); | |
| 99393 | 99389 | /* If the LHS and RHS of the IN operator do not match, that |
| 99394 | 99390 | ** error will have been caught long before we reach this point. */ |
| 99395 | 99391 | if( ALWAYS(pEList->nExpr==nVal) ){ |
| 99396 | 99392 | SelectDest dest; |
| 99397 | 99393 | int i; |
| @@ -99440,14 +99436,12 @@ | ||
| 99440 | 99436 | } |
| 99441 | 99437 | |
| 99442 | 99438 | /* Loop through each expression in <exprlist>. */ |
| 99443 | 99439 | r1 = sqlite3GetTempReg(pParse); |
| 99444 | 99440 | r2 = sqlite3GetTempReg(pParse); |
| 99445 | - if( isRowid ) sqlite3VdbeAddOp4(v, OP_Blob, 0, r2, 0, "", P4_STATIC); | |
| 99446 | 99441 | for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){ |
| 99447 | 99442 | Expr *pE2 = pItem->pExpr; |
| 99448 | - int iValToIns; | |
| 99449 | 99443 | |
| 99450 | 99444 | /* If the expression is not constant then we will need to |
| 99451 | 99445 | ** disable the test that was generated above that makes sure |
| 99452 | 99446 | ** this code only executes once. Because for a non-constant |
| 99453 | 99447 | ** expression we need to rerun this code each time. |
| @@ -99456,24 +99450,13 @@ | ||
| 99456 | 99450 | sqlite3VdbeChangeToNoop(v, addrOnce); |
| 99457 | 99451 | addrOnce = 0; |
| 99458 | 99452 | } |
| 99459 | 99453 | |
| 99460 | 99454 | /* Evaluate the expression and insert it into the temp table */ |
| 99461 | - if( isRowid && sqlite3ExprIsInteger(pE2, &iValToIns) ){ | |
| 99462 | - sqlite3VdbeAddOp3(v, OP_InsertInt, iTab, r2, iValToIns); | |
| 99463 | - }else{ | |
| 99464 | - r3 = sqlite3ExprCodeTarget(pParse, pE2, r1); | |
| 99465 | - if( isRowid ){ | |
| 99466 | - sqlite3VdbeAddOp2(v, OP_MustBeInt, r3, | |
| 99467 | - sqlite3VdbeCurrentAddr(v)+2); | |
| 99468 | - VdbeCoverage(v); | |
| 99469 | - sqlite3VdbeAddOp3(v, OP_Insert, iTab, r2, r3); | |
| 99470 | - }else{ | |
| 99471 | - sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1); | |
| 99472 | - sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r3, 1); | |
| 99473 | - } | |
| 99474 | - } | |
| 99455 | + r3 = sqlite3ExprCodeTarget(pParse, pE2, r1); | |
| 99456 | + sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1); | |
| 99457 | + sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r3, 1); | |
| 99475 | 99458 | } |
| 99476 | 99459 | sqlite3ReleaseTempReg(pParse, r1); |
| 99477 | 99460 | sqlite3ReleaseTempReg(pParse, r2); |
| 99478 | 99461 | } |
| 99479 | 99462 | if( pKeyInfo ){ |
| @@ -118105,14 +118088,17 @@ | ||
| 118105 | 118088 | assert( pParse->nested==0 ); |
| 118106 | 118089 | pik_flags |= OPFLAG_NCHANGE; |
| 118107 | 118090 | pik_flags |= (update_flags & OPFLAG_SAVEPOSITION); |
| 118108 | 118091 | #ifdef SQLITE_ENABLE_PREUPDATE_HOOK |
| 118109 | 118092 | if( update_flags==0 ){ |
| 118110 | - sqlite3VdbeAddOp4(v, OP_InsertInt, | |
| 118111 | - iIdxCur+i, aRegIdx[i], 0, (char*)pTab, P4_TABLE | |
| 118093 | + int r = sqlite3GetTempReg(pParse); | |
| 118094 | + sqlite3VdbeAddOp2(v, OP_Integer, 0, r); | |
| 118095 | + sqlite3VdbeAddOp4(v, OP_Insert, | |
| 118096 | + iIdxCur+i, aRegIdx[i], r, (char*)pTab, P4_TABLE | |
| 118112 | 118097 | ); |
| 118113 | 118098 | sqlite3VdbeChangeP5(v, OPFLAG_ISNOOP); |
| 118099 | + sqlite3ReleaseTempReg(pParse, r); | |
| 118114 | 118100 | } |
| 118115 | 118101 | #endif |
| 118116 | 118102 | } |
| 118117 | 118103 | sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i], |
| 118118 | 118104 | aRegIdx[i]+1, |
| @@ -136425,11 +136411,10 @@ | ||
| 136425 | 136411 | pIn += i; |
| 136426 | 136412 | for(i=iEq;i<pLoop->nLTerm; i++){ |
| 136427 | 136413 | if( pLoop->aLTerm[i]->pExpr==pX ){ |
| 136428 | 136414 | int iOut = iReg + i - iEq; |
| 136429 | 136415 | if( eType==IN_INDEX_ROWID ){ |
| 136430 | - testcase( nEq>1 ); /* Happens with a UNIQUE index on ROWID */ | |
| 136431 | 136416 | pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut); |
| 136432 | 136417 | }else{ |
| 136433 | 136418 | int iCol = aiMap ? aiMap[iMap++] : 0; |
| 136434 | 136419 | pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut); |
| 136435 | 136420 | } |
| @@ -137187,10 +137172,13 @@ | ||
| 137187 | 137172 | if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg); |
| 137188 | 137173 | addrNxt = pLevel->addrNxt; |
| 137189 | 137174 | sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg); |
| 137190 | 137175 | VdbeCoverage(v); |
| 137191 | 137176 | pLevel->op = OP_Noop; |
| 137177 | + if( (pTerm->prereqAll & pLevel->notReady)==0 ){ | |
| 137178 | + pTerm->wtFlags |= TERM_CODED; | |
| 137179 | + } | |
| 137192 | 137180 | }else if( (pLoop->wsFlags & WHERE_IPK)!=0 |
| 137193 | 137181 | && (pLoop->wsFlags & WHERE_COLUMN_RANGE)!=0 |
| 137194 | 137182 | ){ |
| 137195 | 137183 | /* Case 3: We have an inequality comparison against the ROWID field. |
| 137196 | 137184 | */ |
| @@ -217074,11 +217062,11 @@ | ||
| 217074 | 217062 | int nArg, /* Number of args */ |
| 217075 | 217063 | sqlite3_value **apUnused /* Function arguments */ |
| 217076 | 217064 | ){ |
| 217077 | 217065 | assert( nArg==0 ); |
| 217078 | 217066 | UNUSED_PARAM2(nArg, apUnused); |
| 217079 | - sqlite3_result_text(pCtx, "fts5: 2019-02-08 13:17:39 0eca3dd3d38b31c92b49ca2d311128b74584714d9e7de895b1a6286ef959a1dd", -1, SQLITE_TRANSIENT); | |
| 217067 | + sqlite3_result_text(pCtx, "fts5: 2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0f6d7", -1, SQLITE_TRANSIENT); | |
| 217080 | 217068 | } |
| 217081 | 217069 | |
| 217082 | 217070 | /* |
| 217083 | 217071 | ** Return true if zName is the extension on one of the shadow tables used |
| 217084 | 217072 | ** by this module. |
| @@ -221838,12 +221826,12 @@ | ||
| 221838 | 221826 | } |
| 221839 | 221827 | #endif /* SQLITE_CORE */ |
| 221840 | 221828 | #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ |
| 221841 | 221829 | |
| 221842 | 221830 | /************** End of stmt.c ************************************************/ |
| 221843 | -#if __LINE__!=221843 | |
| 221831 | +#if __LINE__!=221831 | |
| 221844 | 221832 | #undef SQLITE_SOURCE_ID |
| 221845 | -#define SQLITE_SOURCE_ID "2019-02-08 13:17:39 0eca3dd3d38b31c92b49ca2d311128b74584714d9e7de895b1a6286ef959alt2" | |
| 221833 | +#define SQLITE_SOURCE_ID "2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0alt2" | |
| 221846 | 221834 | #endif |
| 221847 | 221835 | /* Return the source-id for this library */ |
| 221848 | 221836 | SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } |
| 221849 | 221837 | /************************** End of sqlite3.c ******************************/ |
| 221850 | 221838 |
| --- 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.27.1. 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. |
| @@ -1160,13 +1160,13 @@ | |
| 1160 | ** |
| 1161 | ** See also: [sqlite3_libversion()], |
| 1162 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 1163 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 1164 | */ |
| 1165 | #define SQLITE_VERSION "3.27.1" |
| 1166 | #define SQLITE_VERSION_NUMBER 3027001 |
| 1167 | #define SQLITE_SOURCE_ID "2019-02-08 13:17:39 0eca3dd3d38b31c92b49ca2d311128b74584714d9e7de895b1a6286ef959a1dd" |
| 1168 | |
| 1169 | /* |
| 1170 | ** CAPI3REF: Run-Time Library Version Numbers |
| 1171 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 1172 | ** |
| @@ -3406,11 +3406,11 @@ | |
| 3406 | ** ^Changes made as part of [foreign key actions] are included in the |
| 3407 | ** count, but those made as part of REPLACE constraint resolution are |
| 3408 | ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers |
| 3409 | ** are not counted. |
| 3410 | ** |
| 3411 | ** This the [sqlite3_total_changes(D)] interface only reports the number |
| 3412 | ** of rows that changed due to SQL statement run against database |
| 3413 | ** connection D. Any changes by other database connections are ignored. |
| 3414 | ** To detect changes against a database file from other database |
| 3415 | ** connections use the [PRAGMA data_version] command or the |
| 3416 | ** [SQLITE_FCNTL_DATA_VERSION] [file control]. |
| @@ -14935,61 +14935,60 @@ | |
| 14935 | #define OP_ColumnsUsed 118 |
| 14936 | #define OP_SeekHit 119 /* synopsis: seekHit=P2 */ |
| 14937 | #define OP_Sequence 120 /* synopsis: r[P2]=cursor[P1].ctr++ */ |
| 14938 | #define OP_NewRowid 121 /* synopsis: r[P2]=rowid */ |
| 14939 | #define OP_Insert 122 /* synopsis: intkey=r[P3] data=r[P2] */ |
| 14940 | #define OP_InsertInt 123 /* synopsis: intkey=P3 data=r[P2] */ |
| 14941 | #define OP_Delete 124 |
| 14942 | #define OP_ResetCount 125 |
| 14943 | #define OP_SorterCompare 126 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ |
| 14944 | #define OP_SorterData 127 /* synopsis: r[P2]=data */ |
| 14945 | #define OP_RowData 128 /* synopsis: r[P2]=data */ |
| 14946 | #define OP_Rowid 129 /* synopsis: r[P2]=rowid */ |
| 14947 | #define OP_NullRow 130 |
| 14948 | #define OP_SeekEnd 131 |
| 14949 | #define OP_SorterInsert 132 /* synopsis: key=r[P2] */ |
| 14950 | #define OP_IdxInsert 133 /* synopsis: key=r[P2] */ |
| 14951 | #define OP_IdxDelete 134 /* synopsis: key=r[P2@P3] */ |
| 14952 | #define OP_DeferredSeek 135 /* synopsis: Move P3 to P1.rowid if needed */ |
| 14953 | #define OP_IdxRowid 136 /* synopsis: r[P2]=rowid */ |
| 14954 | #define OP_Destroy 137 |
| 14955 | #define OP_Clear 138 |
| 14956 | #define OP_ResetSorter 139 |
| 14957 | #define OP_CreateBtree 140 /* synopsis: r[P2]=root iDb=P1 flags=P3 */ |
| 14958 | #define OP_Real 141 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ |
| 14959 | #define OP_SqlExec 142 |
| 14960 | #define OP_ParseSchema 143 |
| 14961 | #define OP_LoadAnalysis 144 |
| 14962 | #define OP_DropTable 145 |
| 14963 | #define OP_DropIndex 146 |
| 14964 | #define OP_DropTrigger 147 |
| 14965 | #define OP_IntegrityCk 148 |
| 14966 | #define OP_RowSetAdd 149 /* synopsis: rowset(P1)=r[P2] */ |
| 14967 | #define OP_Param 150 |
| 14968 | #define OP_FkCounter 151 /* synopsis: fkctr[P1]+=P2 */ |
| 14969 | #define OP_MemMax 152 /* synopsis: r[P1]=max(r[P1],r[P2]) */ |
| 14970 | #define OP_OffsetLimit 153 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ |
| 14971 | #define OP_AggInverse 154 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */ |
| 14972 | #define OP_AggStep 155 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 14973 | #define OP_AggStep1 156 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 14974 | #define OP_AggValue 157 /* synopsis: r[P3]=value N=P2 */ |
| 14975 | #define OP_AggFinal 158 /* synopsis: accum=r[P1] N=P2 */ |
| 14976 | #define OP_Expire 159 |
| 14977 | #define OP_TableLock 160 /* synopsis: iDb=P1 root=P2 write=P3 */ |
| 14978 | #define OP_VBegin 161 |
| 14979 | #define OP_VCreate 162 |
| 14980 | #define OP_VDestroy 163 |
| 14981 | #define OP_VOpen 164 |
| 14982 | #define OP_VColumn 165 /* synopsis: r[P3]=vcolumn(P2) */ |
| 14983 | #define OP_VRename 166 |
| 14984 | #define OP_Pagecount 167 |
| 14985 | #define OP_MaxPgcnt 168 |
| 14986 | #define OP_Trace 169 |
| 14987 | #define OP_CursorHint 170 |
| 14988 | #define OP_Noop 171 |
| 14989 | #define OP_Explain 172 |
| 14990 | #define OP_Abortable 173 |
| 14991 | |
| 14992 | /* Properties such as "out2" or "jump" that are specified in |
| 14993 | ** comments following the "case" for each opcode in the vdbe.c |
| 14994 | ** are encoded into bitvectors as follows: |
| 14995 | */ |
| @@ -15014,16 +15013,16 @@ | |
| 15014 | /* 88 */ 0x12, 0x20, 0x00, 0x00, 0x26, 0x26, 0x26, 0x26,\ |
| 15015 | /* 96 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00, 0x12,\ |
| 15016 | /* 104 */ 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15017 | /* 112 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15018 | /* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15019 | /* 128 */ 0x00, 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00,\ |
| 15020 | /* 136 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ |
| 15021 | /* 144 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00,\ |
| 15022 | /* 152 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15023 | /* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\ |
| 15024 | /* 168 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,} |
| 15025 | |
| 15026 | /* The sqlite3P2Values() routine is able to run faster if it knows |
| 15027 | ** the value of the largest JUMP opcode. The smaller the maximum |
| 15028 | ** JUMP opcode the better, so the mkopcodeh.tcl script that |
| 15029 | ** generated this include file strives to group all JUMP opcodes |
| @@ -19172,11 +19171,11 @@ | |
| 19172 | SQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*); |
| 19173 | SQLITE_PRIVATE void sqlite3AlterRenameColumn(Parse*, SrcList*, Token*, Token*); |
| 19174 | SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *); |
| 19175 | SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...); |
| 19176 | SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int); |
| 19177 | SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int, int); |
| 19178 | SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr*); |
| 19179 | SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*); |
| 19180 | SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p); |
| 19181 | SQLITE_PRIVATE int sqlite3MatchSpanName(const char*, const char*, const char*, const char*); |
| 19182 | SQLITE_PRIVATE int sqlite3ResolveExprNames(NameContext*, Expr*); |
| @@ -32137,61 +32136,60 @@ | |
| 32137 | /* 118 */ "ColumnsUsed" OpHelp(""), |
| 32138 | /* 119 */ "SeekHit" OpHelp("seekHit=P2"), |
| 32139 | /* 120 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), |
| 32140 | /* 121 */ "NewRowid" OpHelp("r[P2]=rowid"), |
| 32141 | /* 122 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), |
| 32142 | /* 123 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"), |
| 32143 | /* 124 */ "Delete" OpHelp(""), |
| 32144 | /* 125 */ "ResetCount" OpHelp(""), |
| 32145 | /* 126 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), |
| 32146 | /* 127 */ "SorterData" OpHelp("r[P2]=data"), |
| 32147 | /* 128 */ "RowData" OpHelp("r[P2]=data"), |
| 32148 | /* 129 */ "Rowid" OpHelp("r[P2]=rowid"), |
| 32149 | /* 130 */ "NullRow" OpHelp(""), |
| 32150 | /* 131 */ "SeekEnd" OpHelp(""), |
| 32151 | /* 132 */ "SorterInsert" OpHelp("key=r[P2]"), |
| 32152 | /* 133 */ "IdxInsert" OpHelp("key=r[P2]"), |
| 32153 | /* 134 */ "IdxDelete" OpHelp("key=r[P2@P3]"), |
| 32154 | /* 135 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"), |
| 32155 | /* 136 */ "IdxRowid" OpHelp("r[P2]=rowid"), |
| 32156 | /* 137 */ "Destroy" OpHelp(""), |
| 32157 | /* 138 */ "Clear" OpHelp(""), |
| 32158 | /* 139 */ "ResetSorter" OpHelp(""), |
| 32159 | /* 140 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"), |
| 32160 | /* 141 */ "Real" OpHelp("r[P2]=P4"), |
| 32161 | /* 142 */ "SqlExec" OpHelp(""), |
| 32162 | /* 143 */ "ParseSchema" OpHelp(""), |
| 32163 | /* 144 */ "LoadAnalysis" OpHelp(""), |
| 32164 | /* 145 */ "DropTable" OpHelp(""), |
| 32165 | /* 146 */ "DropIndex" OpHelp(""), |
| 32166 | /* 147 */ "DropTrigger" OpHelp(""), |
| 32167 | /* 148 */ "IntegrityCk" OpHelp(""), |
| 32168 | /* 149 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), |
| 32169 | /* 150 */ "Param" OpHelp(""), |
| 32170 | /* 151 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), |
| 32171 | /* 152 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), |
| 32172 | /* 153 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), |
| 32173 | /* 154 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"), |
| 32174 | /* 155 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 32175 | /* 156 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 32176 | /* 157 */ "AggValue" OpHelp("r[P3]=value N=P2"), |
| 32177 | /* 158 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), |
| 32178 | /* 159 */ "Expire" OpHelp(""), |
| 32179 | /* 160 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), |
| 32180 | /* 161 */ "VBegin" OpHelp(""), |
| 32181 | /* 162 */ "VCreate" OpHelp(""), |
| 32182 | /* 163 */ "VDestroy" OpHelp(""), |
| 32183 | /* 164 */ "VOpen" OpHelp(""), |
| 32184 | /* 165 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), |
| 32185 | /* 166 */ "VRename" OpHelp(""), |
| 32186 | /* 167 */ "Pagecount" OpHelp(""), |
| 32187 | /* 168 */ "MaxPgcnt" OpHelp(""), |
| 32188 | /* 169 */ "Trace" OpHelp(""), |
| 32189 | /* 170 */ "CursorHint" OpHelp(""), |
| 32190 | /* 171 */ "Noop" OpHelp(""), |
| 32191 | /* 172 */ "Explain" OpHelp(""), |
| 32192 | /* 173 */ "Abortable" OpHelp(""), |
| 32193 | }; |
| 32194 | return azName[i]; |
| 32195 | } |
| 32196 | #endif |
| 32197 | |
| @@ -87933,18 +87931,11 @@ | |
| 87933 | ** cause any problems.) |
| 87934 | ** |
| 87935 | ** This instruction only works on tables. The equivalent instruction |
| 87936 | ** for indices is OP_IdxInsert. |
| 87937 | */ |
| 87938 | /* Opcode: InsertInt P1 P2 P3 P4 P5 |
| 87939 | ** Synopsis: intkey=P3 data=r[P2] |
| 87940 | ** |
| 87941 | ** This works exactly like OP_Insert except that the key is the |
| 87942 | ** integer value P3, not the value of the integer stored in register P3. |
| 87943 | */ |
| 87944 | case OP_Insert: |
| 87945 | case OP_InsertInt: { |
| 87946 | Mem *pData; /* MEM cell holding data for the record to be inserted */ |
| 87947 | Mem *pKey; /* MEM cell holding key for the record */ |
| 87948 | VdbeCursor *pC; /* Cursor to table into which insert is written */ |
| 87949 | int seekResult; /* Result of prior seek or 0 if no USESEEKRESULT flag */ |
| 87950 | const char *zDb; /* database name - used by the update hook */ |
| @@ -87961,20 +87952,15 @@ | |
| 87961 | assert( (pOp->p5 & OPFLAG_ISNOOP) || pC->isTable ); |
| 87962 | assert( pOp->p4type==P4_TABLE || pOp->p4type>=P4_STATIC ); |
| 87963 | REGISTER_TRACE(pOp->p2, pData); |
| 87964 | sqlite3VdbeIncrWriteCounter(p, pC); |
| 87965 | |
| 87966 | if( pOp->opcode==OP_Insert ){ |
| 87967 | pKey = &aMem[pOp->p3]; |
| 87968 | assert( pKey->flags & MEM_Int ); |
| 87969 | assert( memIsValid(pKey) ); |
| 87970 | REGISTER_TRACE(pOp->p3, pKey); |
| 87971 | x.nKey = pKey->u.i; |
| 87972 | }else{ |
| 87973 | assert( pOp->opcode==OP_InsertInt ); |
| 87974 | x.nKey = pOp->p3; |
| 87975 | } |
| 87976 | |
| 87977 | if( pOp->p4type==P4_TABLE && HAS_UPDATE_HOOK(db) ){ |
| 87978 | assert( pC->iDb>=0 ); |
| 87979 | zDb = db->aDb[pC->iDb].zDbSName; |
| 87980 | pTab = pOp->p4.pTab; |
| @@ -96129,10 +96115,42 @@ | |
| 96129 | } |
| 96130 | } |
| 96131 | return 0; |
| 96132 | } |
| 96133 | |
| 96134 | /* |
| 96135 | ** pOrderBy is an ORDER BY or GROUP BY clause in SELECT statement pSelect. |
| 96136 | ** The Name context of the SELECT statement is pNC. zType is either |
| 96137 | ** "ORDER" or "GROUP" depending on which type of clause pOrderBy is. |
| 96138 | ** |
| @@ -96195,23 +96213,14 @@ | |
| 96195 | if( sqlite3ResolveExprNames(pNC, pE) ){ |
| 96196 | return 1; |
| 96197 | } |
| 96198 | for(j=0; j<pSelect->pEList->nExpr; j++){ |
| 96199 | if( sqlite3ExprCompare(0, pE, pSelect->pEList->a[j].pExpr, -1)==0 ){ |
| 96200 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 96201 | if( ExprHasProperty(pE, EP_WinFunc) ){ |
| 96202 | /* Since this window function is being changed into a reference |
| 96203 | ** to the same window function the result set, remove the instance |
| 96204 | ** of this window function from the Select.pWin list. */ |
| 96205 | Window **pp; |
| 96206 | for(pp=&pSelect->pWin; *pp; pp=&(*pp)->pNextWin){ |
| 96207 | if( *pp==pE->y.pWin ){ |
| 96208 | *pp = (*pp)->pNextWin; |
| 96209 | } |
| 96210 | } |
| 96211 | } |
| 96212 | #endif |
| 96213 | pItem->u.x.iOrderByCol = j+1; |
| 96214 | } |
| 96215 | } |
| 96216 | } |
| 96217 | return sqlite3ResolveOrderGroupBy(pParse, pSelect, pOrderBy, zType); |
| @@ -99179,18 +99188,15 @@ | |
| 99179 | u32 savedNQueryLoop = pParse->nQueryLoop; |
| 99180 | int rMayHaveNull = 0; |
| 99181 | eType = IN_INDEX_EPH; |
| 99182 | if( inFlags & IN_INDEX_LOOP ){ |
| 99183 | pParse->nQueryLoop = 0; |
| 99184 | if( pX->pLeft->iColumn<0 && !ExprHasProperty(pX, EP_xIsSelect) ){ |
| 99185 | eType = IN_INDEX_ROWID; |
| 99186 | } |
| 99187 | }else if( prRhsHasNull ){ |
| 99188 | *prRhsHasNull = rMayHaveNull = ++pParse->nMem; |
| 99189 | } |
| 99190 | assert( pX->op==TK_IN ); |
| 99191 | sqlite3CodeRhsOfIN(pParse, pX, iTab, eType==IN_INDEX_ROWID); |
| 99192 | if( rMayHaveNull ){ |
| 99193 | sqlite3SetHasNullFlag(v, iTab, rMayHaveNull); |
| 99194 | } |
| 99195 | pParse->nQueryLoop = savedNQueryLoop; |
| 99196 | } |
| @@ -99287,16 +99293,10 @@ | |
| 99287 | ** constructed ephermeral table is returned. The first time the ephemeral |
| 99288 | ** table is computed, the cursor number is also stored in pExpr->iTable, |
| 99289 | ** however the cursor number returned might not be the same, as it might |
| 99290 | ** have been duplicated using OP_OpenDup. |
| 99291 | ** |
| 99292 | ** If parameter isRowid is non-zero, then LHS of the IN operator is guaranteed |
| 99293 | ** to be a non-null integer. In this case, the ephemeral table can be an |
| 99294 | ** table B-Tree that keyed by only integers. The more general cases uses |
| 99295 | ** an index B-Tree which can have arbitrary keys, but is slower to both |
| 99296 | ** read and write. |
| 99297 | ** |
| 99298 | ** If the LHS expression ("x" in the examples) is a column value, or |
| 99299 | ** the SELECT statement returns a column value, then the affinity of that |
| 99300 | ** column is used to build the index keys. If both 'x' and the |
| 99301 | ** SELECT... statement are columns, then numeric affinity is used |
| 99302 | ** if either column has NUMERIC or INTEGER affinity. If neither |
| @@ -99304,12 +99304,11 @@ | |
| 99304 | ** is used. |
| 99305 | */ |
| 99306 | SQLITE_PRIVATE void sqlite3CodeRhsOfIN( |
| 99307 | Parse *pParse, /* Parsing context */ |
| 99308 | Expr *pExpr, /* The IN operator */ |
| 99309 | int iTab, /* Use this cursor number */ |
| 99310 | int isRowid /* If true, LHS is a rowid */ |
| 99311 | ){ |
| 99312 | int addrOnce = 0; /* Address of the OP_Once instruction at top */ |
| 99313 | int addr; /* Address of OP_OpenEphemeral instruction */ |
| 99314 | Expr *pLeft; /* the LHS of the IN operator */ |
| 99315 | KeyInfo *pKeyInfo = 0; /* Key information */ |
| @@ -99358,26 +99357,24 @@ | |
| 99358 | } |
| 99359 | |
| 99360 | /* Check to see if this is a vector IN operator */ |
| 99361 | pLeft = pExpr->pLeft; |
| 99362 | nVal = sqlite3ExprVectorSize(pLeft); |
| 99363 | assert( !isRowid || nVal==1 ); |
| 99364 | |
| 99365 | /* Construct the ephemeral table that will contain the content of |
| 99366 | ** RHS of the IN operator. |
| 99367 | */ |
| 99368 | pExpr->iTable = iTab; |
| 99369 | addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, |
| 99370 | pExpr->iTable, (isRowid?0:nVal)); |
| 99371 | #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS |
| 99372 | if( ExprHasProperty(pExpr, EP_xIsSelect) ){ |
| 99373 | VdbeComment((v, "Result of SELECT %u", pExpr->x.pSelect->selId)); |
| 99374 | }else{ |
| 99375 | VdbeComment((v, "RHS of IN operator")); |
| 99376 | } |
| 99377 | #endif |
| 99378 | pKeyInfo = isRowid ? 0 : sqlite3KeyInfoAlloc(pParse->db, nVal, 1); |
| 99379 | |
| 99380 | if( ExprHasProperty(pExpr, EP_xIsSelect) ){ |
| 99381 | /* Case 1: expr IN (SELECT ...) |
| 99382 | ** |
| 99383 | ** Generate code to write the results of the select into the temporary |
| @@ -99387,11 +99384,10 @@ | |
| 99387 | ExprList *pEList = pSelect->pEList; |
| 99388 | |
| 99389 | ExplainQueryPlan((pParse, 1, "%sLIST SUBQUERY %d", |
| 99390 | addrOnce?"":"CORRELATED ", pSelect->selId |
| 99391 | )); |
| 99392 | assert( !isRowid ); |
| 99393 | /* If the LHS and RHS of the IN operator do not match, that |
| 99394 | ** error will have been caught long before we reach this point. */ |
| 99395 | if( ALWAYS(pEList->nExpr==nVal) ){ |
| 99396 | SelectDest dest; |
| 99397 | int i; |
| @@ -99440,14 +99436,12 @@ | |
| 99440 | } |
| 99441 | |
| 99442 | /* Loop through each expression in <exprlist>. */ |
| 99443 | r1 = sqlite3GetTempReg(pParse); |
| 99444 | r2 = sqlite3GetTempReg(pParse); |
| 99445 | if( isRowid ) sqlite3VdbeAddOp4(v, OP_Blob, 0, r2, 0, "", P4_STATIC); |
| 99446 | for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){ |
| 99447 | Expr *pE2 = pItem->pExpr; |
| 99448 | int iValToIns; |
| 99449 | |
| 99450 | /* If the expression is not constant then we will need to |
| 99451 | ** disable the test that was generated above that makes sure |
| 99452 | ** this code only executes once. Because for a non-constant |
| 99453 | ** expression we need to rerun this code each time. |
| @@ -99456,24 +99450,13 @@ | |
| 99456 | sqlite3VdbeChangeToNoop(v, addrOnce); |
| 99457 | addrOnce = 0; |
| 99458 | } |
| 99459 | |
| 99460 | /* Evaluate the expression and insert it into the temp table */ |
| 99461 | if( isRowid && sqlite3ExprIsInteger(pE2, &iValToIns) ){ |
| 99462 | sqlite3VdbeAddOp3(v, OP_InsertInt, iTab, r2, iValToIns); |
| 99463 | }else{ |
| 99464 | r3 = sqlite3ExprCodeTarget(pParse, pE2, r1); |
| 99465 | if( isRowid ){ |
| 99466 | sqlite3VdbeAddOp2(v, OP_MustBeInt, r3, |
| 99467 | sqlite3VdbeCurrentAddr(v)+2); |
| 99468 | VdbeCoverage(v); |
| 99469 | sqlite3VdbeAddOp3(v, OP_Insert, iTab, r2, r3); |
| 99470 | }else{ |
| 99471 | sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1); |
| 99472 | sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r3, 1); |
| 99473 | } |
| 99474 | } |
| 99475 | } |
| 99476 | sqlite3ReleaseTempReg(pParse, r1); |
| 99477 | sqlite3ReleaseTempReg(pParse, r2); |
| 99478 | } |
| 99479 | if( pKeyInfo ){ |
| @@ -118105,14 +118088,17 @@ | |
| 118105 | assert( pParse->nested==0 ); |
| 118106 | pik_flags |= OPFLAG_NCHANGE; |
| 118107 | pik_flags |= (update_flags & OPFLAG_SAVEPOSITION); |
| 118108 | #ifdef SQLITE_ENABLE_PREUPDATE_HOOK |
| 118109 | if( update_flags==0 ){ |
| 118110 | sqlite3VdbeAddOp4(v, OP_InsertInt, |
| 118111 | iIdxCur+i, aRegIdx[i], 0, (char*)pTab, P4_TABLE |
| 118112 | ); |
| 118113 | sqlite3VdbeChangeP5(v, OPFLAG_ISNOOP); |
| 118114 | } |
| 118115 | #endif |
| 118116 | } |
| 118117 | sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i], |
| 118118 | aRegIdx[i]+1, |
| @@ -136425,11 +136411,10 @@ | |
| 136425 | pIn += i; |
| 136426 | for(i=iEq;i<pLoop->nLTerm; i++){ |
| 136427 | if( pLoop->aLTerm[i]->pExpr==pX ){ |
| 136428 | int iOut = iReg + i - iEq; |
| 136429 | if( eType==IN_INDEX_ROWID ){ |
| 136430 | testcase( nEq>1 ); /* Happens with a UNIQUE index on ROWID */ |
| 136431 | pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut); |
| 136432 | }else{ |
| 136433 | int iCol = aiMap ? aiMap[iMap++] : 0; |
| 136434 | pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut); |
| 136435 | } |
| @@ -137187,10 +137172,13 @@ | |
| 137187 | if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg); |
| 137188 | addrNxt = pLevel->addrNxt; |
| 137189 | sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg); |
| 137190 | VdbeCoverage(v); |
| 137191 | pLevel->op = OP_Noop; |
| 137192 | }else if( (pLoop->wsFlags & WHERE_IPK)!=0 |
| 137193 | && (pLoop->wsFlags & WHERE_COLUMN_RANGE)!=0 |
| 137194 | ){ |
| 137195 | /* Case 3: We have an inequality comparison against the ROWID field. |
| 137196 | */ |
| @@ -217074,11 +217062,11 @@ | |
| 217074 | int nArg, /* Number of args */ |
| 217075 | sqlite3_value **apUnused /* Function arguments */ |
| 217076 | ){ |
| 217077 | assert( nArg==0 ); |
| 217078 | UNUSED_PARAM2(nArg, apUnused); |
| 217079 | sqlite3_result_text(pCtx, "fts5: 2019-02-08 13:17:39 0eca3dd3d38b31c92b49ca2d311128b74584714d9e7de895b1a6286ef959a1dd", -1, SQLITE_TRANSIENT); |
| 217080 | } |
| 217081 | |
| 217082 | /* |
| 217083 | ** Return true if zName is the extension on one of the shadow tables used |
| 217084 | ** by this module. |
| @@ -221838,12 +221826,12 @@ | |
| 221838 | } |
| 221839 | #endif /* SQLITE_CORE */ |
| 221840 | #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ |
| 221841 | |
| 221842 | /************** End of stmt.c ************************************************/ |
| 221843 | #if __LINE__!=221843 |
| 221844 | #undef SQLITE_SOURCE_ID |
| 221845 | #define SQLITE_SOURCE_ID "2019-02-08 13:17:39 0eca3dd3d38b31c92b49ca2d311128b74584714d9e7de895b1a6286ef959alt2" |
| 221846 | #endif |
| 221847 | /* Return the source-id for this library */ |
| 221848 | SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } |
| 221849 | /************************** End of sqlite3.c ******************************/ |
| 221850 |
| --- 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.27.2. 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. |
| @@ -1160,13 +1160,13 @@ | |
| 1160 | ** |
| 1161 | ** See also: [sqlite3_libversion()], |
| 1162 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 1163 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 1164 | */ |
| 1165 | #define SQLITE_VERSION "3.27.2" |
| 1166 | #define SQLITE_VERSION_NUMBER 3027002 |
| 1167 | #define SQLITE_SOURCE_ID "2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0f6d7" |
| 1168 | |
| 1169 | /* |
| 1170 | ** CAPI3REF: Run-Time Library Version Numbers |
| 1171 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 1172 | ** |
| @@ -3406,11 +3406,11 @@ | |
| 3406 | ** ^Changes made as part of [foreign key actions] are included in the |
| 3407 | ** count, but those made as part of REPLACE constraint resolution are |
| 3408 | ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers |
| 3409 | ** are not counted. |
| 3410 | ** |
| 3411 | ** The [sqlite3_total_changes(D)] interface only reports the number |
| 3412 | ** of rows that changed due to SQL statement run against database |
| 3413 | ** connection D. Any changes by other database connections are ignored. |
| 3414 | ** To detect changes against a database file from other database |
| 3415 | ** connections use the [PRAGMA data_version] command or the |
| 3416 | ** [SQLITE_FCNTL_DATA_VERSION] [file control]. |
| @@ -14935,61 +14935,60 @@ | |
| 14935 | #define OP_ColumnsUsed 118 |
| 14936 | #define OP_SeekHit 119 /* synopsis: seekHit=P2 */ |
| 14937 | #define OP_Sequence 120 /* synopsis: r[P2]=cursor[P1].ctr++ */ |
| 14938 | #define OP_NewRowid 121 /* synopsis: r[P2]=rowid */ |
| 14939 | #define OP_Insert 122 /* synopsis: intkey=r[P3] data=r[P2] */ |
| 14940 | #define OP_Delete 123 |
| 14941 | #define OP_ResetCount 124 |
| 14942 | #define OP_SorterCompare 125 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ |
| 14943 | #define OP_SorterData 126 /* synopsis: r[P2]=data */ |
| 14944 | #define OP_RowData 127 /* synopsis: r[P2]=data */ |
| 14945 | #define OP_Rowid 128 /* synopsis: r[P2]=rowid */ |
| 14946 | #define OP_NullRow 129 |
| 14947 | #define OP_SeekEnd 130 |
| 14948 | #define OP_SorterInsert 131 /* synopsis: key=r[P2] */ |
| 14949 | #define OP_IdxInsert 132 /* synopsis: key=r[P2] */ |
| 14950 | #define OP_IdxDelete 133 /* synopsis: key=r[P2@P3] */ |
| 14951 | #define OP_DeferredSeek 134 /* synopsis: Move P3 to P1.rowid if needed */ |
| 14952 | #define OP_IdxRowid 135 /* synopsis: r[P2]=rowid */ |
| 14953 | #define OP_Destroy 136 |
| 14954 | #define OP_Clear 137 |
| 14955 | #define OP_ResetSorter 138 |
| 14956 | #define OP_CreateBtree 139 /* synopsis: r[P2]=root iDb=P1 flags=P3 */ |
| 14957 | #define OP_SqlExec 140 |
| 14958 | #define OP_Real 141 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ |
| 14959 | #define OP_ParseSchema 142 |
| 14960 | #define OP_LoadAnalysis 143 |
| 14961 | #define OP_DropTable 144 |
| 14962 | #define OP_DropIndex 145 |
| 14963 | #define OP_DropTrigger 146 |
| 14964 | #define OP_IntegrityCk 147 |
| 14965 | #define OP_RowSetAdd 148 /* synopsis: rowset(P1)=r[P2] */ |
| 14966 | #define OP_Param 149 |
| 14967 | #define OP_FkCounter 150 /* synopsis: fkctr[P1]+=P2 */ |
| 14968 | #define OP_MemMax 151 /* synopsis: r[P1]=max(r[P1],r[P2]) */ |
| 14969 | #define OP_OffsetLimit 152 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ |
| 14970 | #define OP_AggInverse 153 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */ |
| 14971 | #define OP_AggStep 154 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 14972 | #define OP_AggStep1 155 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 14973 | #define OP_AggValue 156 /* synopsis: r[P3]=value N=P2 */ |
| 14974 | #define OP_AggFinal 157 /* synopsis: accum=r[P1] N=P2 */ |
| 14975 | #define OP_Expire 158 |
| 14976 | #define OP_TableLock 159 /* synopsis: iDb=P1 root=P2 write=P3 */ |
| 14977 | #define OP_VBegin 160 |
| 14978 | #define OP_VCreate 161 |
| 14979 | #define OP_VDestroy 162 |
| 14980 | #define OP_VOpen 163 |
| 14981 | #define OP_VColumn 164 /* synopsis: r[P3]=vcolumn(P2) */ |
| 14982 | #define OP_VRename 165 |
| 14983 | #define OP_Pagecount 166 |
| 14984 | #define OP_MaxPgcnt 167 |
| 14985 | #define OP_Trace 168 |
| 14986 | #define OP_CursorHint 169 |
| 14987 | #define OP_Noop 170 |
| 14988 | #define OP_Explain 171 |
| 14989 | #define OP_Abortable 172 |
| 14990 | |
| 14991 | /* Properties such as "out2" or "jump" that are specified in |
| 14992 | ** comments following the "case" for each opcode in the vdbe.c |
| 14993 | ** are encoded into bitvectors as follows: |
| 14994 | */ |
| @@ -15014,16 +15013,16 @@ | |
| 15013 | /* 88 */ 0x12, 0x20, 0x00, 0x00, 0x26, 0x26, 0x26, 0x26,\ |
| 15014 | /* 96 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00, 0x12,\ |
| 15015 | /* 104 */ 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15016 | /* 112 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15017 | /* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15018 | /* 128 */ 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x10,\ |
| 15019 | /* 136 */ 0x10, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00,\ |
| 15020 | /* 144 */ 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04,\ |
| 15021 | /* 152 */ 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15022 | /* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10,\ |
| 15023 | /* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00,} |
| 15024 | |
| 15025 | /* The sqlite3P2Values() routine is able to run faster if it knows |
| 15026 | ** the value of the largest JUMP opcode. The smaller the maximum |
| 15027 | ** JUMP opcode the better, so the mkopcodeh.tcl script that |
| 15028 | ** generated this include file strives to group all JUMP opcodes |
| @@ -19172,11 +19171,11 @@ | |
| 19171 | SQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*); |
| 19172 | SQLITE_PRIVATE void sqlite3AlterRenameColumn(Parse*, SrcList*, Token*, Token*); |
| 19173 | SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *); |
| 19174 | SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...); |
| 19175 | SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int); |
| 19176 | SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int); |
| 19177 | SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr*); |
| 19178 | SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*); |
| 19179 | SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p); |
| 19180 | SQLITE_PRIVATE int sqlite3MatchSpanName(const char*, const char*, const char*, const char*); |
| 19181 | SQLITE_PRIVATE int sqlite3ResolveExprNames(NameContext*, Expr*); |
| @@ -32137,61 +32136,60 @@ | |
| 32136 | /* 118 */ "ColumnsUsed" OpHelp(""), |
| 32137 | /* 119 */ "SeekHit" OpHelp("seekHit=P2"), |
| 32138 | /* 120 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), |
| 32139 | /* 121 */ "NewRowid" OpHelp("r[P2]=rowid"), |
| 32140 | /* 122 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), |
| 32141 | /* 123 */ "Delete" OpHelp(""), |
| 32142 | /* 124 */ "ResetCount" OpHelp(""), |
| 32143 | /* 125 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), |
| 32144 | /* 126 */ "SorterData" OpHelp("r[P2]=data"), |
| 32145 | /* 127 */ "RowData" OpHelp("r[P2]=data"), |
| 32146 | /* 128 */ "Rowid" OpHelp("r[P2]=rowid"), |
| 32147 | /* 129 */ "NullRow" OpHelp(""), |
| 32148 | /* 130 */ "SeekEnd" OpHelp(""), |
| 32149 | /* 131 */ "SorterInsert" OpHelp("key=r[P2]"), |
| 32150 | /* 132 */ "IdxInsert" OpHelp("key=r[P2]"), |
| 32151 | /* 133 */ "IdxDelete" OpHelp("key=r[P2@P3]"), |
| 32152 | /* 134 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"), |
| 32153 | /* 135 */ "IdxRowid" OpHelp("r[P2]=rowid"), |
| 32154 | /* 136 */ "Destroy" OpHelp(""), |
| 32155 | /* 137 */ "Clear" OpHelp(""), |
| 32156 | /* 138 */ "ResetSorter" OpHelp(""), |
| 32157 | /* 139 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"), |
| 32158 | /* 140 */ "SqlExec" OpHelp(""), |
| 32159 | /* 141 */ "Real" OpHelp("r[P2]=P4"), |
| 32160 | /* 142 */ "ParseSchema" OpHelp(""), |
| 32161 | /* 143 */ "LoadAnalysis" OpHelp(""), |
| 32162 | /* 144 */ "DropTable" OpHelp(""), |
| 32163 | /* 145 */ "DropIndex" OpHelp(""), |
| 32164 | /* 146 */ "DropTrigger" OpHelp(""), |
| 32165 | /* 147 */ "IntegrityCk" OpHelp(""), |
| 32166 | /* 148 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), |
| 32167 | /* 149 */ "Param" OpHelp(""), |
| 32168 | /* 150 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), |
| 32169 | /* 151 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), |
| 32170 | /* 152 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), |
| 32171 | /* 153 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"), |
| 32172 | /* 154 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 32173 | /* 155 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 32174 | /* 156 */ "AggValue" OpHelp("r[P3]=value N=P2"), |
| 32175 | /* 157 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), |
| 32176 | /* 158 */ "Expire" OpHelp(""), |
| 32177 | /* 159 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), |
| 32178 | /* 160 */ "VBegin" OpHelp(""), |
| 32179 | /* 161 */ "VCreate" OpHelp(""), |
| 32180 | /* 162 */ "VDestroy" OpHelp(""), |
| 32181 | /* 163 */ "VOpen" OpHelp(""), |
| 32182 | /* 164 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), |
| 32183 | /* 165 */ "VRename" OpHelp(""), |
| 32184 | /* 166 */ "Pagecount" OpHelp(""), |
| 32185 | /* 167 */ "MaxPgcnt" OpHelp(""), |
| 32186 | /* 168 */ "Trace" OpHelp(""), |
| 32187 | /* 169 */ "CursorHint" OpHelp(""), |
| 32188 | /* 170 */ "Noop" OpHelp(""), |
| 32189 | /* 171 */ "Explain" OpHelp(""), |
| 32190 | /* 172 */ "Abortable" OpHelp(""), |
| 32191 | }; |
| 32192 | return azName[i]; |
| 32193 | } |
| 32194 | #endif |
| 32195 | |
| @@ -87933,18 +87931,11 @@ | |
| 87931 | ** cause any problems.) |
| 87932 | ** |
| 87933 | ** This instruction only works on tables. The equivalent instruction |
| 87934 | ** for indices is OP_IdxInsert. |
| 87935 | */ |
| 87936 | case OP_Insert: { |
| 87937 | Mem *pData; /* MEM cell holding data for the record to be inserted */ |
| 87938 | Mem *pKey; /* MEM cell holding key for the record */ |
| 87939 | VdbeCursor *pC; /* Cursor to table into which insert is written */ |
| 87940 | int seekResult; /* Result of prior seek or 0 if no USESEEKRESULT flag */ |
| 87941 | const char *zDb; /* database name - used by the update hook */ |
| @@ -87961,20 +87952,15 @@ | |
| 87952 | assert( (pOp->p5 & OPFLAG_ISNOOP) || pC->isTable ); |
| 87953 | assert( pOp->p4type==P4_TABLE || pOp->p4type>=P4_STATIC ); |
| 87954 | REGISTER_TRACE(pOp->p2, pData); |
| 87955 | sqlite3VdbeIncrWriteCounter(p, pC); |
| 87956 | |
| 87957 | pKey = &aMem[pOp->p3]; |
| 87958 | assert( pKey->flags & MEM_Int ); |
| 87959 | assert( memIsValid(pKey) ); |
| 87960 | REGISTER_TRACE(pOp->p3, pKey); |
| 87961 | x.nKey = pKey->u.i; |
| 87962 | |
| 87963 | if( pOp->p4type==P4_TABLE && HAS_UPDATE_HOOK(db) ){ |
| 87964 | assert( pC->iDb>=0 ); |
| 87965 | zDb = db->aDb[pC->iDb].zDbSName; |
| 87966 | pTab = pOp->p4.pTab; |
| @@ -96129,10 +96115,42 @@ | |
| 96115 | } |
| 96116 | } |
| 96117 | return 0; |
| 96118 | } |
| 96119 | |
| 96120 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 96121 | /* |
| 96122 | ** Walker callback for resolveRemoveWindows(). |
| 96123 | */ |
| 96124 | static int resolveRemoveWindowsCb(Walker *pWalker, Expr *pExpr){ |
| 96125 | if( ExprHasProperty(pExpr, EP_WinFunc) ){ |
| 96126 | Window **pp; |
| 96127 | for(pp=&pWalker->u.pSelect->pWin; *pp; pp=&(*pp)->pNextWin){ |
| 96128 | if( *pp==pExpr->y.pWin ){ |
| 96129 | *pp = (*pp)->pNextWin; |
| 96130 | break; |
| 96131 | } |
| 96132 | } |
| 96133 | } |
| 96134 | return WRC_Continue; |
| 96135 | } |
| 96136 | |
| 96137 | /* |
| 96138 | ** Remove any Window objects owned by the expression pExpr from the |
| 96139 | ** Select.pWin list of Select object pSelect. |
| 96140 | */ |
| 96141 | static void resolveRemoveWindows(Select *pSelect, Expr *pExpr){ |
| 96142 | Walker sWalker; |
| 96143 | memset(&sWalker, 0, sizeof(Walker)); |
| 96144 | sWalker.xExprCallback = resolveRemoveWindowsCb; |
| 96145 | sWalker.u.pSelect = pSelect; |
| 96146 | sqlite3WalkExpr(&sWalker, pExpr); |
| 96147 | } |
| 96148 | #else |
| 96149 | # define resolveRemoveWindows(x,y) |
| 96150 | #endif |
| 96151 | |
| 96152 | /* |
| 96153 | ** pOrderBy is an ORDER BY or GROUP BY clause in SELECT statement pSelect. |
| 96154 | ** The Name context of the SELECT statement is pNC. zType is either |
| 96155 | ** "ORDER" or "GROUP" depending on which type of clause pOrderBy is. |
| 96156 | ** |
| @@ -96195,23 +96213,14 @@ | |
| 96213 | if( sqlite3ResolveExprNames(pNC, pE) ){ |
| 96214 | return 1; |
| 96215 | } |
| 96216 | for(j=0; j<pSelect->pEList->nExpr; j++){ |
| 96217 | if( sqlite3ExprCompare(0, pE, pSelect->pEList->a[j].pExpr, -1)==0 ){ |
| 96218 | /* Since this expresion is being changed into a reference |
| 96219 | ** to an identical expression in the result set, remove all Window |
| 96220 | ** objects belonging to the expression from the Select.pWin list. */ |
| 96221 | resolveRemoveWindows(pSelect, pE); |
| 96222 | pItem->u.x.iOrderByCol = j+1; |
| 96223 | } |
| 96224 | } |
| 96225 | } |
| 96226 | return sqlite3ResolveOrderGroupBy(pParse, pSelect, pOrderBy, zType); |
| @@ -99179,18 +99188,15 @@ | |
| 99188 | u32 savedNQueryLoop = pParse->nQueryLoop; |
| 99189 | int rMayHaveNull = 0; |
| 99190 | eType = IN_INDEX_EPH; |
| 99191 | if( inFlags & IN_INDEX_LOOP ){ |
| 99192 | pParse->nQueryLoop = 0; |
| 99193 | }else if( prRhsHasNull ){ |
| 99194 | *prRhsHasNull = rMayHaveNull = ++pParse->nMem; |
| 99195 | } |
| 99196 | assert( pX->op==TK_IN ); |
| 99197 | sqlite3CodeRhsOfIN(pParse, pX, iTab); |
| 99198 | if( rMayHaveNull ){ |
| 99199 | sqlite3SetHasNullFlag(v, iTab, rMayHaveNull); |
| 99200 | } |
| 99201 | pParse->nQueryLoop = savedNQueryLoop; |
| 99202 | } |
| @@ -99287,16 +99293,10 @@ | |
| 99293 | ** constructed ephermeral table is returned. The first time the ephemeral |
| 99294 | ** table is computed, the cursor number is also stored in pExpr->iTable, |
| 99295 | ** however the cursor number returned might not be the same, as it might |
| 99296 | ** have been duplicated using OP_OpenDup. |
| 99297 | ** |
| 99298 | ** If the LHS expression ("x" in the examples) is a column value, or |
| 99299 | ** the SELECT statement returns a column value, then the affinity of that |
| 99300 | ** column is used to build the index keys. If both 'x' and the |
| 99301 | ** SELECT... statement are columns, then numeric affinity is used |
| 99302 | ** if either column has NUMERIC or INTEGER affinity. If neither |
| @@ -99304,12 +99304,11 @@ | |
| 99304 | ** is used. |
| 99305 | */ |
| 99306 | SQLITE_PRIVATE void sqlite3CodeRhsOfIN( |
| 99307 | Parse *pParse, /* Parsing context */ |
| 99308 | Expr *pExpr, /* The IN operator */ |
| 99309 | int iTab /* Use this cursor number */ |
| 99310 | ){ |
| 99311 | int addrOnce = 0; /* Address of the OP_Once instruction at top */ |
| 99312 | int addr; /* Address of OP_OpenEphemeral instruction */ |
| 99313 | Expr *pLeft; /* the LHS of the IN operator */ |
| 99314 | KeyInfo *pKeyInfo = 0; /* Key information */ |
| @@ -99358,26 +99357,24 @@ | |
| 99357 | } |
| 99358 | |
| 99359 | /* Check to see if this is a vector IN operator */ |
| 99360 | pLeft = pExpr->pLeft; |
| 99361 | nVal = sqlite3ExprVectorSize(pLeft); |
| 99362 | |
| 99363 | /* Construct the ephemeral table that will contain the content of |
| 99364 | ** RHS of the IN operator. |
| 99365 | */ |
| 99366 | pExpr->iTable = iTab; |
| 99367 | addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pExpr->iTable, nVal); |
| 99368 | #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS |
| 99369 | if( ExprHasProperty(pExpr, EP_xIsSelect) ){ |
| 99370 | VdbeComment((v, "Result of SELECT %u", pExpr->x.pSelect->selId)); |
| 99371 | }else{ |
| 99372 | VdbeComment((v, "RHS of IN operator")); |
| 99373 | } |
| 99374 | #endif |
| 99375 | pKeyInfo = sqlite3KeyInfoAlloc(pParse->db, nVal, 1); |
| 99376 | |
| 99377 | if( ExprHasProperty(pExpr, EP_xIsSelect) ){ |
| 99378 | /* Case 1: expr IN (SELECT ...) |
| 99379 | ** |
| 99380 | ** Generate code to write the results of the select into the temporary |
| @@ -99387,11 +99384,10 @@ | |
| 99384 | ExprList *pEList = pSelect->pEList; |
| 99385 | |
| 99386 | ExplainQueryPlan((pParse, 1, "%sLIST SUBQUERY %d", |
| 99387 | addrOnce?"":"CORRELATED ", pSelect->selId |
| 99388 | )); |
| 99389 | /* If the LHS and RHS of the IN operator do not match, that |
| 99390 | ** error will have been caught long before we reach this point. */ |
| 99391 | if( ALWAYS(pEList->nExpr==nVal) ){ |
| 99392 | SelectDest dest; |
| 99393 | int i; |
| @@ -99440,14 +99436,12 @@ | |
| 99436 | } |
| 99437 | |
| 99438 | /* Loop through each expression in <exprlist>. */ |
| 99439 | r1 = sqlite3GetTempReg(pParse); |
| 99440 | r2 = sqlite3GetTempReg(pParse); |
| 99441 | for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){ |
| 99442 | Expr *pE2 = pItem->pExpr; |
| 99443 | |
| 99444 | /* If the expression is not constant then we will need to |
| 99445 | ** disable the test that was generated above that makes sure |
| 99446 | ** this code only executes once. Because for a non-constant |
| 99447 | ** expression we need to rerun this code each time. |
| @@ -99456,24 +99450,13 @@ | |
| 99450 | sqlite3VdbeChangeToNoop(v, addrOnce); |
| 99451 | addrOnce = 0; |
| 99452 | } |
| 99453 | |
| 99454 | /* Evaluate the expression and insert it into the temp table */ |
| 99455 | r3 = sqlite3ExprCodeTarget(pParse, pE2, r1); |
| 99456 | sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1); |
| 99457 | sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r3, 1); |
| 99458 | } |
| 99459 | sqlite3ReleaseTempReg(pParse, r1); |
| 99460 | sqlite3ReleaseTempReg(pParse, r2); |
| 99461 | } |
| 99462 | if( pKeyInfo ){ |
| @@ -118105,14 +118088,17 @@ | |
| 118088 | assert( pParse->nested==0 ); |
| 118089 | pik_flags |= OPFLAG_NCHANGE; |
| 118090 | pik_flags |= (update_flags & OPFLAG_SAVEPOSITION); |
| 118091 | #ifdef SQLITE_ENABLE_PREUPDATE_HOOK |
| 118092 | if( update_flags==0 ){ |
| 118093 | int r = sqlite3GetTempReg(pParse); |
| 118094 | sqlite3VdbeAddOp2(v, OP_Integer, 0, r); |
| 118095 | sqlite3VdbeAddOp4(v, OP_Insert, |
| 118096 | iIdxCur+i, aRegIdx[i], r, (char*)pTab, P4_TABLE |
| 118097 | ); |
| 118098 | sqlite3VdbeChangeP5(v, OPFLAG_ISNOOP); |
| 118099 | sqlite3ReleaseTempReg(pParse, r); |
| 118100 | } |
| 118101 | #endif |
| 118102 | } |
| 118103 | sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i], |
| 118104 | aRegIdx[i]+1, |
| @@ -136425,11 +136411,10 @@ | |
| 136411 | pIn += i; |
| 136412 | for(i=iEq;i<pLoop->nLTerm; i++){ |
| 136413 | if( pLoop->aLTerm[i]->pExpr==pX ){ |
| 136414 | int iOut = iReg + i - iEq; |
| 136415 | if( eType==IN_INDEX_ROWID ){ |
| 136416 | pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut); |
| 136417 | }else{ |
| 136418 | int iCol = aiMap ? aiMap[iMap++] : 0; |
| 136419 | pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut); |
| 136420 | } |
| @@ -137187,10 +137172,13 @@ | |
| 137172 | if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg); |
| 137173 | addrNxt = pLevel->addrNxt; |
| 137174 | sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg); |
| 137175 | VdbeCoverage(v); |
| 137176 | pLevel->op = OP_Noop; |
| 137177 | if( (pTerm->prereqAll & pLevel->notReady)==0 ){ |
| 137178 | pTerm->wtFlags |= TERM_CODED; |
| 137179 | } |
| 137180 | }else if( (pLoop->wsFlags & WHERE_IPK)!=0 |
| 137181 | && (pLoop->wsFlags & WHERE_COLUMN_RANGE)!=0 |
| 137182 | ){ |
| 137183 | /* Case 3: We have an inequality comparison against the ROWID field. |
| 137184 | */ |
| @@ -217074,11 +217062,11 @@ | |
| 217062 | int nArg, /* Number of args */ |
| 217063 | sqlite3_value **apUnused /* Function arguments */ |
| 217064 | ){ |
| 217065 | assert( nArg==0 ); |
| 217066 | UNUSED_PARAM2(nArg, apUnused); |
| 217067 | sqlite3_result_text(pCtx, "fts5: 2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0f6d7", -1, SQLITE_TRANSIENT); |
| 217068 | } |
| 217069 | |
| 217070 | /* |
| 217071 | ** Return true if zName is the extension on one of the shadow tables used |
| 217072 | ** by this module. |
| @@ -221838,12 +221826,12 @@ | |
| 221826 | } |
| 221827 | #endif /* SQLITE_CORE */ |
| 221828 | #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ |
| 221829 | |
| 221830 | /************** End of stmt.c ************************************************/ |
| 221831 | #if __LINE__!=221831 |
| 221832 | #undef SQLITE_SOURCE_ID |
| 221833 | #define SQLITE_SOURCE_ID "2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0alt2" |
| 221834 | #endif |
| 221835 | /* Return the source-id for this library */ |
| 221836 | SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } |
| 221837 | /************************** End of sqlite3.c ******************************/ |
| 221838 |
+4
-4
| --- src/sqlite3.h | ||
| +++ src/sqlite3.h | ||
| @@ -121,13 +121,13 @@ | ||
| 121 | 121 | ** |
| 122 | 122 | ** See also: [sqlite3_libversion()], |
| 123 | 123 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 124 | 124 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 125 | 125 | */ |
| 126 | -#define SQLITE_VERSION "3.27.1" | |
| 127 | -#define SQLITE_VERSION_NUMBER 3027001 | |
| 128 | -#define SQLITE_SOURCE_ID "2019-02-08 13:17:39 0eca3dd3d38b31c92b49ca2d311128b74584714d9e7de895b1a6286ef959a1dd" | |
| 126 | +#define SQLITE_VERSION "3.27.2" | |
| 127 | +#define SQLITE_VERSION_NUMBER 3027002 | |
| 128 | +#define SQLITE_SOURCE_ID "2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0f6d7" | |
| 129 | 129 | |
| 130 | 130 | /* |
| 131 | 131 | ** CAPI3REF: Run-Time Library Version Numbers |
| 132 | 132 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 133 | 133 | ** |
| @@ -2367,11 +2367,11 @@ | ||
| 2367 | 2367 | ** ^Changes made as part of [foreign key actions] are included in the |
| 2368 | 2368 | ** count, but those made as part of REPLACE constraint resolution are |
| 2369 | 2369 | ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers |
| 2370 | 2370 | ** are not counted. |
| 2371 | 2371 | ** |
| 2372 | -** This the [sqlite3_total_changes(D)] interface only reports the number | |
| 2372 | +** The [sqlite3_total_changes(D)] interface only reports the number | |
| 2373 | 2373 | ** of rows that changed due to SQL statement run against database |
| 2374 | 2374 | ** connection D. Any changes by other database connections are ignored. |
| 2375 | 2375 | ** To detect changes against a database file from other database |
| 2376 | 2376 | ** connections use the [PRAGMA data_version] command or the |
| 2377 | 2377 | ** [SQLITE_FCNTL_DATA_VERSION] [file control]. |
| 2378 | 2378 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -121,13 +121,13 @@ | |
| 121 | ** |
| 122 | ** See also: [sqlite3_libversion()], |
| 123 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 124 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 125 | */ |
| 126 | #define SQLITE_VERSION "3.27.1" |
| 127 | #define SQLITE_VERSION_NUMBER 3027001 |
| 128 | #define SQLITE_SOURCE_ID "2019-02-08 13:17:39 0eca3dd3d38b31c92b49ca2d311128b74584714d9e7de895b1a6286ef959a1dd" |
| 129 | |
| 130 | /* |
| 131 | ** CAPI3REF: Run-Time Library Version Numbers |
| 132 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 133 | ** |
| @@ -2367,11 +2367,11 @@ | |
| 2367 | ** ^Changes made as part of [foreign key actions] are included in the |
| 2368 | ** count, but those made as part of REPLACE constraint resolution are |
| 2369 | ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers |
| 2370 | ** are not counted. |
| 2371 | ** |
| 2372 | ** This the [sqlite3_total_changes(D)] interface only reports the number |
| 2373 | ** of rows that changed due to SQL statement run against database |
| 2374 | ** connection D. Any changes by other database connections are ignored. |
| 2375 | ** To detect changes against a database file from other database |
| 2376 | ** connections use the [PRAGMA data_version] command or the |
| 2377 | ** [SQLITE_FCNTL_DATA_VERSION] [file control]. |
| 2378 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -121,13 +121,13 @@ | |
| 121 | ** |
| 122 | ** See also: [sqlite3_libversion()], |
| 123 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 124 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 125 | */ |
| 126 | #define SQLITE_VERSION "3.27.2" |
| 127 | #define SQLITE_VERSION_NUMBER 3027002 |
| 128 | #define SQLITE_SOURCE_ID "2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0f6d7" |
| 129 | |
| 130 | /* |
| 131 | ** CAPI3REF: Run-Time Library Version Numbers |
| 132 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 133 | ** |
| @@ -2367,11 +2367,11 @@ | |
| 2367 | ** ^Changes made as part of [foreign key actions] are included in the |
| 2368 | ** count, but those made as part of REPLACE constraint resolution are |
| 2369 | ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers |
| 2370 | ** are not counted. |
| 2371 | ** |
| 2372 | ** The [sqlite3_total_changes(D)] interface only reports the number |
| 2373 | ** of rows that changed due to SQL statement run against database |
| 2374 | ** connection D. Any changes by other database connections are ignored. |
| 2375 | ** To detect changes against a database file from other database |
| 2376 | ** connections use the [PRAGMA data_version] command or the |
| 2377 | ** [SQLITE_FCNTL_DATA_VERSION] [file control]. |
| 2378 |