Fossil SCM

Merge in the latest 3.24.0 alpha version of SQLite including the ORDER BY LIMIT performance enhancement.

drh 2018-04-26 19:23 trunk
Commit 7b1599884cba7e0b138ca8a48db61ebe851da8430ee9c9a6ecae24fa0d79f41b
3 files changed +10 -79 +111 -58 +53 -2
+10 -79
--- src/shell.c
+++ src/shell.c
@@ -790,49 +790,16 @@
790790
** that quoting is required.
791791
**
792792
** Return '"' if quoting is required. Return 0 if no quoting is required.
793793
*/
794794
static char quoteChar(const char *zName){
795
- /* All SQLite keywords, in alphabetical order */
796
- static const char *azKeywords[] = {
797
- "ABORT", "ACTION", "ADD", "AFTER", "ALL", "ALTER", "ANALYZE", "AND", "AS",
798
- "ASC", "ATTACH", "AUTOINCREMENT", "BEFORE", "BEGIN", "BETWEEN", "BY",
799
- "CASCADE", "CASE", "CAST", "CHECK", "COLLATE", "COLUMN", "COMMIT",
800
- "CONFLICT", "CONSTRAINT", "CREATE", "CROSS", "CURRENT_DATE",
801
- "CURRENT_TIME", "CURRENT_TIMESTAMP", "DATABASE", "DEFAULT", "DEFERRABLE",
802
- "DEFERRED", "DELETE", "DESC", "DETACH", "DISTINCT", "DROP", "EACH",
803
- "ELSE", "END", "ESCAPE", "EXCEPT", "EXCLUSIVE", "EXISTS", "EXPLAIN",
804
- "FAIL", "FOR", "FOREIGN", "FROM", "FULL", "GLOB", "GROUP", "HAVING", "IF",
805
- "IGNORE", "IMMEDIATE", "IN", "INDEX", "INDEXED", "INITIALLY", "INNER",
806
- "INSERT", "INSTEAD", "INTERSECT", "INTO", "IS", "ISNULL", "JOIN", "KEY",
807
- "LEFT", "LIKE", "LIMIT", "MATCH", "NATURAL", "NO", "NOT", "NOTNULL",
808
- "NULL", "OF", "OFFSET", "ON", "OR", "ORDER", "OUTER", "PLAN", "PRAGMA",
809
- "PRIMARY", "QUERY", "RAISE", "RECURSIVE", "REFERENCES", "REGEXP",
810
- "REINDEX", "RELEASE", "RENAME", "REPLACE", "RESTRICT", "RIGHT",
811
- "ROLLBACK", "ROW", "SAVEPOINT", "SELECT", "SET", "TABLE", "TEMP",
812
- "TEMPORARY", "THEN", "TO", "TRANSACTION", "TRIGGER", "UNION", "UNIQUE",
813
- "UPDATE", "USING", "VACUUM", "VALUES", "VIEW", "VIRTUAL", "WHEN", "WHERE",
814
- "WITH", "WITHOUT",
815
- };
816
- int i, lwr, upr, mid, c;
795
+ int i;
817796
if( !isalpha((unsigned char)zName[0]) && zName[0]!='_' ) return '"';
818797
for(i=0; zName[i]; i++){
819798
if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ) return '"';
820799
}
821
- lwr = 0;
822
- upr = sizeof(azKeywords)/sizeof(azKeywords[0]) - 1;
823
- while( lwr<=upr ){
824
- mid = (lwr+upr)/2;
825
- c = sqlite3_stricmp(azKeywords[mid], zName);
826
- if( c==0 ) return '"';
827
- if( c<0 ){
828
- lwr = mid+1;
829
- }else{
830
- upr = mid-1;
831
- }
832
- }
833
- return 0;
800
+ return sqlite3_keyword_check(zName, i) ? '"' : 0;
834801
}
835802
836803
/*
837804
** Construct a fake object name and column list to describe the structure
838805
** of the view, virtual table, or table valued function zSchema.zName.
@@ -3046,10 +3013,11 @@
30463013
sqlite3 *db; /* Database connection for this cursor */
30473014
int nPrefix, nLine; /* Number of bytes in zPrefix and zLine */
30483015
char *zPrefix; /* The prefix for the word we want to complete */
30493016
char *zLine; /* The whole that we want to complete */
30503017
const char *zCurrentRow; /* Current output row */
3018
+ int szRow; /* Length of the zCurrentRow string */
30513019
sqlite3_stmt *pStmt; /* Current statement */
30523020
sqlite3_int64 iRowid; /* The rowid */
30533021
int ePhase; /* Current phase */
30543022
int j; /* inter-phase counter */
30553023
};
@@ -3158,36 +3126,10 @@
31583126
completionCursorReset((completion_cursor*)cur);
31593127
sqlite3_free(cur);
31603128
return SQLITE_OK;
31613129
}
31623130
3163
-/*
3164
-** All SQL keywords understood by SQLite
3165
-*/
3166
-static const char *completionKwrds[] = {
3167
- "ABORT", "ACTION", "ADD", "AFTER", "ALL", "ALTER", "ANALYZE", "AND", "AS",
3168
- "ASC", "ATTACH", "AUTOINCREMENT", "BEFORE", "BEGIN", "BETWEEN", "BY",
3169
- "CASCADE", "CASE", "CAST", "CHECK", "COLLATE", "COLUMN", "COMMIT",
3170
- "CONFLICT", "CONSTRAINT", "CREATE", "CROSS", "CURRENT_DATE",
3171
- "CURRENT_TIME", "CURRENT_TIMESTAMP", "DATABASE", "DEFAULT", "DEFERRABLE",
3172
- "DEFERRED", "DELETE", "DESC", "DETACH", "DISTINCT", "DROP", "EACH",
3173
- "ELSE", "END", "ESCAPE", "EXCEPT", "EXCLUSIVE", "EXISTS", "EXPLAIN",
3174
- "FAIL", "FOR", "FOREIGN", "FROM", "FULL", "GLOB", "GROUP", "HAVING", "IF",
3175
- "IGNORE", "IMMEDIATE", "IN", "INDEX", "INDEXED", "INITIALLY", "INNER",
3176
- "INSERT", "INSTEAD", "INTERSECT", "INTO", "IS", "ISNULL", "JOIN", "KEY",
3177
- "LEFT", "LIKE", "LIMIT", "MATCH", "NATURAL", "NO", "NOT", "NOTNULL",
3178
- "NULL", "OF", "OFFSET", "ON", "OR", "ORDER", "OUTER", "PLAN", "PRAGMA",
3179
- "PRIMARY", "QUERY", "RAISE", "RECURSIVE", "REFERENCES", "REGEXP",
3180
- "REINDEX", "RELEASE", "RENAME", "REPLACE", "RESTRICT", "RIGHT",
3181
- "ROLLBACK", "ROW", "SAVEPOINT", "SELECT", "SET", "TABLE", "TEMP",
3182
- "TEMPORARY", "THEN", "TO", "TRANSACTION", "TRIGGER", "UNION", "UNIQUE",
3183
- "UPDATE", "USING", "VACUUM", "VALUES", "VIEW", "VIRTUAL", "WHEN", "WHERE",
3184
- "WITH", "WITHOUT",
3185
-};
3186
-#define completionKwCount \
3187
- (int)(sizeof(completionKwrds)/sizeof(completionKwrds[0]))
3188
-
31893131
/*
31903132
** Advance a completion_cursor to its next row of output.
31913133
**
31923134
** The ->ePhase, ->j, and ->pStmt fields of the completion_cursor object
31933135
** record the current state of the scan. This routine sets ->zCurrentRow
@@ -3206,15 +3148,15 @@
32063148
int iCol = -1; /* If >=0, step pCur->pStmt and use the i-th column */
32073149
pCur->iRowid++;
32083150
while( pCur->ePhase!=COMPLETION_EOF ){
32093151
switch( pCur->ePhase ){
32103152
case COMPLETION_KEYWORDS: {
3211
- if( pCur->j >= completionKwCount ){
3153
+ if( pCur->j >= sqlite3_keyword_count() ){
32123154
pCur->zCurrentRow = 0;
32133155
pCur->ePhase = COMPLETION_DATABASES;
32143156
}else{
3215
- pCur->zCurrentRow = completionKwrds[pCur->j++];
3157
+ sqlite3_keyword_name(pCur->j++, &pCur->zCurrentRow, &pCur->szRow);
32163158
}
32173159
iCol = -1;
32183160
break;
32193161
}
32203162
case COMPLETION_DATABASES: {
@@ -3282,20 +3224,23 @@
32823224
if( pCur->zCurrentRow==0 ) continue;
32833225
}else{
32843226
if( sqlite3_step(pCur->pStmt)==SQLITE_ROW ){
32853227
/* Extract the next row of content */
32863228
pCur->zCurrentRow = (const char*)sqlite3_column_text(pCur->pStmt, iCol);
3229
+ pCur->szRow = sqlite3_column_bytes(pCur->pStmt, iCol);
32873230
}else{
32883231
/* When all rows are finished, advance to the next phase */
32893232
sqlite3_finalize(pCur->pStmt);
32903233
pCur->pStmt = 0;
32913234
pCur->ePhase = eNextPhase;
32923235
continue;
32933236
}
32943237
}
32953238
if( pCur->nPrefix==0 ) break;
3296
- if( sqlite3_strnicmp(pCur->zPrefix, pCur->zCurrentRow, pCur->nPrefix)==0 ){
3239
+ if( pCur->nPrefix<=pCur->szRow
3240
+ && sqlite3_strnicmp(pCur->zPrefix, pCur->zCurrentRow, pCur->nPrefix)==0
3241
+ ){
32973242
break;
32983243
}
32993244
}
33003245
33013246
return SQLITE_OK;
@@ -3311,11 +3256,11 @@
33113256
int i /* Which column to return */
33123257
){
33133258
completion_cursor *pCur = (completion_cursor*)cur;
33143259
switch( i ){
33153260
case COMPLETION_COLUMN_CANDIDATE: {
3316
- sqlite3_result_text(ctx, pCur->zCurrentRow, -1, SQLITE_TRANSIENT);
3261
+ sqlite3_result_text(ctx, pCur->zCurrentRow, pCur->szRow,SQLITE_TRANSIENT);
33173262
break;
33183263
}
33193264
case COMPLETION_COLUMN_PREFIX: {
33203265
sqlite3_result_text(ctx, pCur->zPrefix, -1, SQLITE_TRANSIENT);
33213266
break;
@@ -15018,13 +14963,10 @@
1501814963
/*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, "" },*/
1501914964
/*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, "" },*/
1502014965
{ "byteorder", SQLITE_TESTCTRL_BYTEORDER, "" },
1502114966
/*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, "" }, */
1502214967
{ "imposter", SQLITE_TESTCTRL_IMPOSTER, "SCHEMA ON/OFF ROOTPAGE"},
15023
-#ifdef SQLITE_N_KEYWORD
15024
- { "iskeyword", SQLITE_TESTCTRL_ISKEYWORD, "IDENTIFIER" },
15025
-#endif
1502614968
{ "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,"BOOLEAN" },
1502714969
{ "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT, "BOOLEAN" },
1502814970
{ "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS, "DISABLE-MASK" },
1502914971
#ifdef YYCOVERAGE
1503014972
{ "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE, "" },
@@ -15132,21 +15074,10 @@
1513215074
rc2 = sqlite3_test_control(testctrl, opt);
1513315075
isOk = 3;
1513415076
}
1513515077
break;
1513615078
15137
- /* sqlite3_test_control(int, char *) */
15138
-#ifdef SQLITE_N_KEYWORD
15139
- case SQLITE_TESTCTRL_ISKEYWORD:
15140
- if( nArg==3 ){
15141
- const char *opt = azArg[2];
15142
- rc2 = sqlite3_test_control(testctrl, opt);
15143
- isOk = 1;
15144
- }
15145
- break;
15146
-#endif
15147
-
1514815079
case SQLITE_TESTCTRL_IMPOSTER:
1514915080
if( nArg==5 ){
1515015081
rc2 = sqlite3_test_control(testctrl, p->db,
1515115082
azArg[2],
1515215083
integerValue(azArg[3]),
1515315084
--- src/shell.c
+++ src/shell.c
@@ -790,49 +790,16 @@
790 ** that quoting is required.
791 **
792 ** Return '"' if quoting is required. Return 0 if no quoting is required.
793 */
794 static char quoteChar(const char *zName){
795 /* All SQLite keywords, in alphabetical order */
796 static const char *azKeywords[] = {
797 "ABORT", "ACTION", "ADD", "AFTER", "ALL", "ALTER", "ANALYZE", "AND", "AS",
798 "ASC", "ATTACH", "AUTOINCREMENT", "BEFORE", "BEGIN", "BETWEEN", "BY",
799 "CASCADE", "CASE", "CAST", "CHECK", "COLLATE", "COLUMN", "COMMIT",
800 "CONFLICT", "CONSTRAINT", "CREATE", "CROSS", "CURRENT_DATE",
801 "CURRENT_TIME", "CURRENT_TIMESTAMP", "DATABASE", "DEFAULT", "DEFERRABLE",
802 "DEFERRED", "DELETE", "DESC", "DETACH", "DISTINCT", "DROP", "EACH",
803 "ELSE", "END", "ESCAPE", "EXCEPT", "EXCLUSIVE", "EXISTS", "EXPLAIN",
804 "FAIL", "FOR", "FOREIGN", "FROM", "FULL", "GLOB", "GROUP", "HAVING", "IF",
805 "IGNORE", "IMMEDIATE", "IN", "INDEX", "INDEXED", "INITIALLY", "INNER",
806 "INSERT", "INSTEAD", "INTERSECT", "INTO", "IS", "ISNULL", "JOIN", "KEY",
807 "LEFT", "LIKE", "LIMIT", "MATCH", "NATURAL", "NO", "NOT", "NOTNULL",
808 "NULL", "OF", "OFFSET", "ON", "OR", "ORDER", "OUTER", "PLAN", "PRAGMA",
809 "PRIMARY", "QUERY", "RAISE", "RECURSIVE", "REFERENCES", "REGEXP",
810 "REINDEX", "RELEASE", "RENAME", "REPLACE", "RESTRICT", "RIGHT",
811 "ROLLBACK", "ROW", "SAVEPOINT", "SELECT", "SET", "TABLE", "TEMP",
812 "TEMPORARY", "THEN", "TO", "TRANSACTION", "TRIGGER", "UNION", "UNIQUE",
813 "UPDATE", "USING", "VACUUM", "VALUES", "VIEW", "VIRTUAL", "WHEN", "WHERE",
814 "WITH", "WITHOUT",
815 };
816 int i, lwr, upr, mid, c;
817 if( !isalpha((unsigned char)zName[0]) && zName[0]!='_' ) return '"';
818 for(i=0; zName[i]; i++){
819 if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ) return '"';
820 }
821 lwr = 0;
822 upr = sizeof(azKeywords)/sizeof(azKeywords[0]) - 1;
823 while( lwr<=upr ){
824 mid = (lwr+upr)/2;
825 c = sqlite3_stricmp(azKeywords[mid], zName);
826 if( c==0 ) return '"';
827 if( c<0 ){
828 lwr = mid+1;
829 }else{
830 upr = mid-1;
831 }
832 }
833 return 0;
834 }
835
836 /*
837 ** Construct a fake object name and column list to describe the structure
838 ** of the view, virtual table, or table valued function zSchema.zName.
@@ -3046,10 +3013,11 @@
3046 sqlite3 *db; /* Database connection for this cursor */
3047 int nPrefix, nLine; /* Number of bytes in zPrefix and zLine */
3048 char *zPrefix; /* The prefix for the word we want to complete */
3049 char *zLine; /* The whole that we want to complete */
3050 const char *zCurrentRow; /* Current output row */
 
3051 sqlite3_stmt *pStmt; /* Current statement */
3052 sqlite3_int64 iRowid; /* The rowid */
3053 int ePhase; /* Current phase */
3054 int j; /* inter-phase counter */
3055 };
@@ -3158,36 +3126,10 @@
3158 completionCursorReset((completion_cursor*)cur);
3159 sqlite3_free(cur);
3160 return SQLITE_OK;
3161 }
3162
3163 /*
3164 ** All SQL keywords understood by SQLite
3165 */
3166 static const char *completionKwrds[] = {
3167 "ABORT", "ACTION", "ADD", "AFTER", "ALL", "ALTER", "ANALYZE", "AND", "AS",
3168 "ASC", "ATTACH", "AUTOINCREMENT", "BEFORE", "BEGIN", "BETWEEN", "BY",
3169 "CASCADE", "CASE", "CAST", "CHECK", "COLLATE", "COLUMN", "COMMIT",
3170 "CONFLICT", "CONSTRAINT", "CREATE", "CROSS", "CURRENT_DATE",
3171 "CURRENT_TIME", "CURRENT_TIMESTAMP", "DATABASE", "DEFAULT", "DEFERRABLE",
3172 "DEFERRED", "DELETE", "DESC", "DETACH", "DISTINCT", "DROP", "EACH",
3173 "ELSE", "END", "ESCAPE", "EXCEPT", "EXCLUSIVE", "EXISTS", "EXPLAIN",
3174 "FAIL", "FOR", "FOREIGN", "FROM", "FULL", "GLOB", "GROUP", "HAVING", "IF",
3175 "IGNORE", "IMMEDIATE", "IN", "INDEX", "INDEXED", "INITIALLY", "INNER",
3176 "INSERT", "INSTEAD", "INTERSECT", "INTO", "IS", "ISNULL", "JOIN", "KEY",
3177 "LEFT", "LIKE", "LIMIT", "MATCH", "NATURAL", "NO", "NOT", "NOTNULL",
3178 "NULL", "OF", "OFFSET", "ON", "OR", "ORDER", "OUTER", "PLAN", "PRAGMA",
3179 "PRIMARY", "QUERY", "RAISE", "RECURSIVE", "REFERENCES", "REGEXP",
3180 "REINDEX", "RELEASE", "RENAME", "REPLACE", "RESTRICT", "RIGHT",
3181 "ROLLBACK", "ROW", "SAVEPOINT", "SELECT", "SET", "TABLE", "TEMP",
3182 "TEMPORARY", "THEN", "TO", "TRANSACTION", "TRIGGER", "UNION", "UNIQUE",
3183 "UPDATE", "USING", "VACUUM", "VALUES", "VIEW", "VIRTUAL", "WHEN", "WHERE",
3184 "WITH", "WITHOUT",
3185 };
3186 #define completionKwCount \
3187 (int)(sizeof(completionKwrds)/sizeof(completionKwrds[0]))
3188
3189 /*
3190 ** Advance a completion_cursor to its next row of output.
3191 **
3192 ** The ->ePhase, ->j, and ->pStmt fields of the completion_cursor object
3193 ** record the current state of the scan. This routine sets ->zCurrentRow
@@ -3206,15 +3148,15 @@
3206 int iCol = -1; /* If >=0, step pCur->pStmt and use the i-th column */
3207 pCur->iRowid++;
3208 while( pCur->ePhase!=COMPLETION_EOF ){
3209 switch( pCur->ePhase ){
3210 case COMPLETION_KEYWORDS: {
3211 if( pCur->j >= completionKwCount ){
3212 pCur->zCurrentRow = 0;
3213 pCur->ePhase = COMPLETION_DATABASES;
3214 }else{
3215 pCur->zCurrentRow = completionKwrds[pCur->j++];
3216 }
3217 iCol = -1;
3218 break;
3219 }
3220 case COMPLETION_DATABASES: {
@@ -3282,20 +3224,23 @@
3282 if( pCur->zCurrentRow==0 ) continue;
3283 }else{
3284 if( sqlite3_step(pCur->pStmt)==SQLITE_ROW ){
3285 /* Extract the next row of content */
3286 pCur->zCurrentRow = (const char*)sqlite3_column_text(pCur->pStmt, iCol);
 
3287 }else{
3288 /* When all rows are finished, advance to the next phase */
3289 sqlite3_finalize(pCur->pStmt);
3290 pCur->pStmt = 0;
3291 pCur->ePhase = eNextPhase;
3292 continue;
3293 }
3294 }
3295 if( pCur->nPrefix==0 ) break;
3296 if( sqlite3_strnicmp(pCur->zPrefix, pCur->zCurrentRow, pCur->nPrefix)==0 ){
 
 
3297 break;
3298 }
3299 }
3300
3301 return SQLITE_OK;
@@ -3311,11 +3256,11 @@
3311 int i /* Which column to return */
3312 ){
3313 completion_cursor *pCur = (completion_cursor*)cur;
3314 switch( i ){
3315 case COMPLETION_COLUMN_CANDIDATE: {
3316 sqlite3_result_text(ctx, pCur->zCurrentRow, -1, SQLITE_TRANSIENT);
3317 break;
3318 }
3319 case COMPLETION_COLUMN_PREFIX: {
3320 sqlite3_result_text(ctx, pCur->zPrefix, -1, SQLITE_TRANSIENT);
3321 break;
@@ -15018,13 +14963,10 @@
15018 /*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, "" },*/
15019 /*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, "" },*/
15020 { "byteorder", SQLITE_TESTCTRL_BYTEORDER, "" },
15021 /*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, "" }, */
15022 { "imposter", SQLITE_TESTCTRL_IMPOSTER, "SCHEMA ON/OFF ROOTPAGE"},
15023 #ifdef SQLITE_N_KEYWORD
15024 { "iskeyword", SQLITE_TESTCTRL_ISKEYWORD, "IDENTIFIER" },
15025 #endif
15026 { "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,"BOOLEAN" },
15027 { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT, "BOOLEAN" },
15028 { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS, "DISABLE-MASK" },
15029 #ifdef YYCOVERAGE
15030 { "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE, "" },
@@ -15132,21 +15074,10 @@
15132 rc2 = sqlite3_test_control(testctrl, opt);
15133 isOk = 3;
15134 }
15135 break;
15136
15137 /* sqlite3_test_control(int, char *) */
15138 #ifdef SQLITE_N_KEYWORD
15139 case SQLITE_TESTCTRL_ISKEYWORD:
15140 if( nArg==3 ){
15141 const char *opt = azArg[2];
15142 rc2 = sqlite3_test_control(testctrl, opt);
15143 isOk = 1;
15144 }
15145 break;
15146 #endif
15147
15148 case SQLITE_TESTCTRL_IMPOSTER:
15149 if( nArg==5 ){
15150 rc2 = sqlite3_test_control(testctrl, p->db,
15151 azArg[2],
15152 integerValue(azArg[3]),
15153
--- src/shell.c
+++ src/shell.c
@@ -790,49 +790,16 @@
790 ** that quoting is required.
791 **
792 ** Return '"' if quoting is required. Return 0 if no quoting is required.
793 */
794 static char quoteChar(const char *zName){
795 int i;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
796 if( !isalpha((unsigned char)zName[0]) && zName[0]!='_' ) return '"';
797 for(i=0; zName[i]; i++){
798 if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ) return '"';
799 }
800 return sqlite3_keyword_check(zName, i) ? '"' : 0;
 
 
 
 
 
 
 
 
 
 
 
 
801 }
802
803 /*
804 ** Construct a fake object name and column list to describe the structure
805 ** of the view, virtual table, or table valued function zSchema.zName.
@@ -3046,10 +3013,11 @@
3013 sqlite3 *db; /* Database connection for this cursor */
3014 int nPrefix, nLine; /* Number of bytes in zPrefix and zLine */
3015 char *zPrefix; /* The prefix for the word we want to complete */
3016 char *zLine; /* The whole that we want to complete */
3017 const char *zCurrentRow; /* Current output row */
3018 int szRow; /* Length of the zCurrentRow string */
3019 sqlite3_stmt *pStmt; /* Current statement */
3020 sqlite3_int64 iRowid; /* The rowid */
3021 int ePhase; /* Current phase */
3022 int j; /* inter-phase counter */
3023 };
@@ -3158,36 +3126,10 @@
3126 completionCursorReset((completion_cursor*)cur);
3127 sqlite3_free(cur);
3128 return SQLITE_OK;
3129 }
3130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3131 /*
3132 ** Advance a completion_cursor to its next row of output.
3133 **
3134 ** The ->ePhase, ->j, and ->pStmt fields of the completion_cursor object
3135 ** record the current state of the scan. This routine sets ->zCurrentRow
@@ -3206,15 +3148,15 @@
3148 int iCol = -1; /* If >=0, step pCur->pStmt and use the i-th column */
3149 pCur->iRowid++;
3150 while( pCur->ePhase!=COMPLETION_EOF ){
3151 switch( pCur->ePhase ){
3152 case COMPLETION_KEYWORDS: {
3153 if( pCur->j >= sqlite3_keyword_count() ){
3154 pCur->zCurrentRow = 0;
3155 pCur->ePhase = COMPLETION_DATABASES;
3156 }else{
3157 sqlite3_keyword_name(pCur->j++, &pCur->zCurrentRow, &pCur->szRow);
3158 }
3159 iCol = -1;
3160 break;
3161 }
3162 case COMPLETION_DATABASES: {
@@ -3282,20 +3224,23 @@
3224 if( pCur->zCurrentRow==0 ) continue;
3225 }else{
3226 if( sqlite3_step(pCur->pStmt)==SQLITE_ROW ){
3227 /* Extract the next row of content */
3228 pCur->zCurrentRow = (const char*)sqlite3_column_text(pCur->pStmt, iCol);
3229 pCur->szRow = sqlite3_column_bytes(pCur->pStmt, iCol);
3230 }else{
3231 /* When all rows are finished, advance to the next phase */
3232 sqlite3_finalize(pCur->pStmt);
3233 pCur->pStmt = 0;
3234 pCur->ePhase = eNextPhase;
3235 continue;
3236 }
3237 }
3238 if( pCur->nPrefix==0 ) break;
3239 if( pCur->nPrefix<=pCur->szRow
3240 && sqlite3_strnicmp(pCur->zPrefix, pCur->zCurrentRow, pCur->nPrefix)==0
3241 ){
3242 break;
3243 }
3244 }
3245
3246 return SQLITE_OK;
@@ -3311,11 +3256,11 @@
3256 int i /* Which column to return */
3257 ){
3258 completion_cursor *pCur = (completion_cursor*)cur;
3259 switch( i ){
3260 case COMPLETION_COLUMN_CANDIDATE: {
3261 sqlite3_result_text(ctx, pCur->zCurrentRow, pCur->szRow,SQLITE_TRANSIENT);
3262 break;
3263 }
3264 case COMPLETION_COLUMN_PREFIX: {
3265 sqlite3_result_text(ctx, pCur->zPrefix, -1, SQLITE_TRANSIENT);
3266 break;
@@ -15018,13 +14963,10 @@
14963 /*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, "" },*/
14964 /*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, "" },*/
14965 { "byteorder", SQLITE_TESTCTRL_BYTEORDER, "" },
14966 /*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, "" }, */
14967 { "imposter", SQLITE_TESTCTRL_IMPOSTER, "SCHEMA ON/OFF ROOTPAGE"},
 
 
 
14968 { "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,"BOOLEAN" },
14969 { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT, "BOOLEAN" },
14970 { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS, "DISABLE-MASK" },
14971 #ifdef YYCOVERAGE
14972 { "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE, "" },
@@ -15132,21 +15074,10 @@
15074 rc2 = sqlite3_test_control(testctrl, opt);
15075 isOk = 3;
15076 }
15077 break;
15078
 
 
 
 
 
 
 
 
 
 
 
15079 case SQLITE_TESTCTRL_IMPOSTER:
15080 if( nArg==5 ){
15081 rc2 = sqlite3_test_control(testctrl, p->db,
15082 azArg[2],
15083 integerValue(azArg[3]),
15084
+111 -58
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1150,11 +1150,11 @@
11501150
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
11511151
** [sqlite_version()] and [sqlite_source_id()].
11521152
*/
11531153
#define SQLITE_VERSION "3.24.0"
11541154
#define SQLITE_VERSION_NUMBER 3024000
1155
-#define SQLITE_SOURCE_ID "2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8b4a3"
1155
+#define SQLITE_SOURCE_ID "2018-04-26 18:34:26 9fd0faf517993587d2f54212638545fc85fbbc84a031bcfae8c1e5894825d83b"
11561156
11571157
/*
11581158
** CAPI3REF: Run-Time Library Version Numbers
11591159
** KEYWORDS: sqlite3_version sqlite3_sourceid
11601160
**
@@ -8041,11 +8041,11 @@
80418041
#define SQLITE_TESTCTRL_PENDING_BYTE 11
80428042
#define SQLITE_TESTCTRL_ASSERT 12
80438043
#define SQLITE_TESTCTRL_ALWAYS 13
80448044
#define SQLITE_TESTCTRL_RESERVE 14
80458045
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
8046
-#define SQLITE_TESTCTRL_ISKEYWORD 16
8046
+#define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
80478047
#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
80488048
#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
80498049
#define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
80508050
#define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19
80518051
#define SQLITE_TESTCTRL_NEVER_CORRUPT 20
@@ -8055,10 +8055,61 @@
80558055
#define SQLITE_TESTCTRL_SORTER_MMAP 24
80568056
#define SQLITE_TESTCTRL_IMPOSTER 25
80578057
#define SQLITE_TESTCTRL_PARSER_COVERAGE 26
80588058
#define SQLITE_TESTCTRL_LAST 26 /* Largest TESTCTRL */
80598059
8060
+/*
8061
+** CAPI3REF: SQL Keyword Checking
8062
+**
8063
+** These routines provide access to the set of SQL language keywords
8064
+** recognized by SQLite. Applications can uses these routines to determine
8065
+** whether or not a specific identifier needs to be escaped (for example,
8066
+** by enclosing in double-quotes) so as not to confuse the parser.
8067
+**
8068
+** The sqlite3_keyword_count() interface returns the number of distinct
8069
+** keywords understood by SQLite.
8070
+**
8071
+** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and
8072
+** makes *Z point to that keyword expressed as UTF8 and writes the number
8073
+** of bytes in the keyword into *L. The string that *Z points to is not
8074
+** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns
8075
+** SQLITE_OK if N is within bounds and SQLITE_ERROR if not. If either Z
8076
+** or L are NULL or invalid pointers then calls to
8077
+** sqlite3_keyword_name(N,Z,L) result in undefined behavior.
8078
+**
8079
+** The sqlite3_keyword_check(Z,L) interface checks to see whether or not
8080
+** the L-byte UTF8 identifier that Z points to is a keyword, returning non-zero
8081
+** if it is and zero if not.
8082
+**
8083
+** The parser used by SQLite is forgiving. It is often possible to use
8084
+** a keyword as an identifier as long as such use does not result in a
8085
+** parsing ambiguity. For example, the statement
8086
+** "CREATE TABLE BEGIN(REPLACE,PRAGMA,END);" is accepted by SQLite, and
8087
+** creates a new table named "BEGIN" with three columns named
8088
+** "REPLACE", "PRAGMA", and "END". Nevertheless, best practice is to avoid
8089
+** using keywords as identifiers. Common techniques used to avoid keyword
8090
+** name collisions include:
8091
+** <ul>
8092
+** <li> Put all indentifier names inside double-quotes. This is the official
8093
+** SQL way to escape identifier names.
8094
+** <li> Put identifier names inside &#91;...&#93;. This is not standard SQL,
8095
+** but it is what SQL Server does and so lots of programmers use this
8096
+** technique.
8097
+** <li> Begin every identifier with the letter "Z" as no SQL keywords start
8098
+** with "Z".
8099
+** <li> Include a digit somewhere in every identifier name.
8100
+** </ul>
8101
+**
8102
+** Note that the number of keywords understood by SQLite can depend on
8103
+** compile-time options. For example, "VACUUM" is not a keyword if
8104
+** SQLite is compiled with the [-DSQLITE_OMIT_VACUUM] option. Also,
8105
+** new keywords may be added to future releases of SQLite.
8106
+*/
8107
+SQLITE_API int sqlite3_keyword_count(void);
8108
+SQLITE_API int sqlite3_keyword_name(int,const char**,int*);
8109
+SQLITE_API int sqlite3_keyword_check(const char*,int);
8110
+
80608111
/*
80618112
** CAPI3REF: SQLite Runtime Status
80628113
**
80638114
** ^These interfaces are used to retrieve runtime status information
80648115
** about the performance of SQLite, and optionally to reset various
@@ -98210,14 +98261,13 @@
9821098261
assert( pExpr->iColumn>=-1 && pExpr->iColumn<pTab->nCol );
9821198262
assert( pTab->iPKey<0 || pExpr->iColumn!=pTab->iPKey );
9821298263
assert( p1>=0 && p1<(pTab->nCol*2+2) );
9821398264
9821498265
sqlite3VdbeAddOp2(v, OP_Param, p1, target);
98215
- VdbeComment((v, "%s.%s -> $%d",
98266
+ VdbeComment((v, "r[%d]=%s.%s", target,
9821698267
(pExpr->iTable ? "new" : "old"),
98217
- (pExpr->iColumn<0 ? "rowid" : pExpr->pTab->aCol[pExpr->iColumn].zName),
98218
- target
98268
+ (pExpr->iColumn<0 ? "rowid" : pExpr->pTab->aCol[pExpr->iColumn].zName)
9821998269
));
9822098270
9822198271
#ifndef SQLITE_OMIT_FLOATING_POINT
9822298272
/* If the column has REAL affinity, it may currently be stored as an
9822398273
** integer. Use OP_RealAffinity to make sure it is really real.
@@ -121222,19 +121272,19 @@
121222121272
sqlite3VdbeAddOp2(v, OP_Sequence, pSort->iECursor, regBase+nExpr);
121223121273
}
121224121274
if( nPrefixReg==0 && nData>0 ){
121225121275
sqlite3ExprCodeMove(pParse, regData, regBase+nExpr+bSeq, nData);
121226121276
}
121227
- sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase+nOBSat, nBase-nOBSat, regRecord);
121228121277
if( nOBSat>0 ){
121229121278
int regPrevKey; /* The first nOBSat columns of the previous row */
121230121279
int addrFirst; /* Address of the OP_IfNot opcode */
121231121280
int addrJmp; /* Address of the OP_Jump opcode */
121232121281
VdbeOp *pOp; /* Opcode that opens the sorter */
121233121282
int nKey; /* Number of sorting key columns, including OP_Sequence */
121234121283
KeyInfo *pKI; /* Original KeyInfo on the sorter table */
121235121284
121285
+ sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase+nOBSat, nBase-nOBSat,regRecord);
121236121286
regPrevKey = pParse->nMem+1;
121237121287
pParse->nMem += pSort->nOBSat;
121238121288
nKey = nExpr - pSort->nOBSat + bSeq;
121239121289
if( bSeq ){
121240121290
addrFirst = sqlite3VdbeAddOp1(v, OP_IfNot, regBase+nExpr);
@@ -121264,45 +121314,46 @@
121264121314
}
121265121315
sqlite3VdbeJumpHere(v, addrFirst);
121266121316
sqlite3ExprCodeMove(pParse, regBase, regPrevKey, pSort->nOBSat);
121267121317
sqlite3VdbeJumpHere(v, addrJmp);
121268121318
}
121319
+ if( iLimit ){
121320
+ /* At this point the values for the new sorter entry are stored
121321
+ ** in an array of registers. They need to be composed into a record
121322
+ ** and inserted into the sorter if either (a) there are currently
121323
+ ** less than LIMIT+OFFSET items or (b) the new record is smaller than
121324
+ ** the largest record currently in the sorter. If (b) is true and there
121325
+ ** are already LIMIT+OFFSET items in the sorter, delete the largest
121326
+ ** entry before inserting the new one. This way there are never more
121327
+ ** than LIMIT+OFFSET items in the sorter.
121328
+ **
121329
+ ** If the new record does not need to be inserted into the sorter,
121330
+ ** jump to the next iteration of the loop. Or, if the
121331
+ ** pSort->bOrderedInnerLoop flag is set to indicate that the inner
121332
+ ** loop delivers items in sorted order, jump to the next iteration
121333
+ ** of the outer loop.
121334
+ */
121335
+ int iCsr = pSort->iECursor;
121336
+ int iJmp = sqlite3VdbeCurrentAddr(v)+5+(nOBSat<=0)+pSort->bOrderedInnerLoop;
121337
+ assert( pSort->bOrderedInnerLoop==0 || pSort->bOrderedInnerLoop==1 );
121338
+ sqlite3VdbeAddOp2(v, OP_IfNotZero, iLimit, sqlite3VdbeCurrentAddr(v)+4);
121339
+ VdbeCoverage(v);
121340
+ sqlite3VdbeAddOp2(v, OP_Last, iCsr, 0);
121341
+ sqlite3VdbeAddOp4Int(v, OP_IdxLE, iCsr, iJmp, regBase+nOBSat, nExpr-nOBSat);
121342
+ VdbeCoverage(v);
121343
+ sqlite3VdbeAddOp1(v, OP_Delete, iCsr);
121344
+ }
121345
+ if( nOBSat<=0 ){
121346
+ sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase+nOBSat, nBase-nOBSat,regRecord);
121347
+ }
121269121348
if( pSort->sortFlags & SORTFLAG_UseSorter ){
121270121349
op = OP_SorterInsert;
121271121350
}else{
121272121351
op = OP_IdxInsert;
121273121352
}
121274121353
sqlite3VdbeAddOp4Int(v, op, pSort->iECursor, regRecord,
121275121354
regBase+nOBSat, nBase-nOBSat);
121276
- if( iLimit ){
121277
- int addr;
121278
- int r1 = 0;
121279
- /* Fill the sorter until it contains LIMIT+OFFSET entries. (The iLimit
121280
- ** register is initialized with value of LIMIT+OFFSET.) After the sorter
121281
- ** fills up, delete the least entry in the sorter after each insert.
121282
- ** Thus we never hold more than the LIMIT+OFFSET rows in memory at once */
121283
- addr = sqlite3VdbeAddOp1(v, OP_IfNotZero, iLimit); VdbeCoverage(v);
121284
- sqlite3VdbeAddOp1(v, OP_Last, pSort->iECursor);
121285
- if( pSort->bOrderedInnerLoop ){
121286
- r1 = ++pParse->nMem;
121287
- sqlite3VdbeAddOp3(v, OP_Column, pSort->iECursor, nExpr, r1);
121288
- VdbeComment((v, "seq"));
121289
- }
121290
- sqlite3VdbeAddOp1(v, OP_Delete, pSort->iECursor);
121291
- if( pSort->bOrderedInnerLoop ){
121292
- /* If the inner loop is driven by an index such that values from
121293
- ** the same iteration of the inner loop are in sorted order, then
121294
- ** immediately jump to the next iteration of an inner loop if the
121295
- ** entry from the current iteration does not fit into the top
121296
- ** LIMIT+OFFSET entries of the sorter. */
121297
- int iBrk = sqlite3VdbeCurrentAddr(v) + 2;
121298
- sqlite3VdbeAddOp3(v, OP_Eq, regBase+nExpr, iBrk, r1);
121299
- sqlite3VdbeChangeP5(v, SQLITE_NULLEQ);
121300
- VdbeCoverage(v);
121301
- }
121302
- sqlite3VdbeJumpHere(v, addr);
121303
- }
121304121355
}
121305121356
121306121357
/*
121307121358
** Add code to implement the OFFSET
121308121359
*/
@@ -128898,10 +128949,16 @@
128898128949
** a new.* reference in a trigger program.
128899128950
*/
128900128951
testcase( i==31 );
128901128952
testcase( i==32 );
128902128953
sqlite3ExprCodeGetColumnToReg(pParse, pTab, i, iDataCur, regNew+i);
128954
+ if( tmask & TRIGGER_BEFORE ){
128955
+ /* This value will be recomputed in After-BEFORE-trigger-reload-loop
128956
+ ** below, so make sure that it is not cached and reused.
128957
+ ** Ticket d85fffd6ffe856092ed8daefa811b1e399706b28. */
128958
+ sqlite3ExprCacheRemove(pParse, regNew+i, 1);
128959
+ }
128903128960
}else{
128904128961
sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i);
128905128962
}
128906128963
}
128907128964
}
@@ -128926,14 +128983,18 @@
128926128983
}else{
128927128984
sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, labelContinue, regOldRowid);
128928128985
VdbeCoverage(v);
128929128986
}
128930128987
128931
- /* If it did not delete it, the row-trigger may still have modified
128988
+ /* After-BEFORE-trigger-reload-loop:
128989
+ ** If it did not delete it, the BEFORE trigger may still have modified
128932128990
** some of the columns of the row being updated. Load the values for
128933
- ** all columns not modified by the update statement into their
128934
- ** registers in case this has happened.
128991
+ ** all columns not modified by the update statement into their registers
128992
+ ** in case this has happened. Only unmodified columns are reloaded.
128993
+ ** The values computed for modified columns use the values before the
128994
+ ** BEFORE trigger runs. See test case trigger1-18.0 (added 2018-04-26)
128995
+ ** for an example.
128935128996
*/
128936128997
for(i=0; i<pTab->nCol; i++){
128937128998
if( aXRef[i]<0 && i!=pTab->iPKey ){
128938128999
sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i);
128939129000
}
@@ -145167,10 +145228,20 @@
145167145228
int id = TK_ID;
145168145229
keywordCode((char*)z, n, &id);
145169145230
return id;
145170145231
}
145171145232
#define SQLITE_N_KEYWORD 126
145233
+SQLITE_API int sqlite3_keyword_name(int i,const char **pzName,int *pnName){
145234
+ if( i<0 || i>=SQLITE_N_KEYWORD ) return SQLITE_ERROR;
145235
+ *pzName = zKWText + aKWOffset[i];
145236
+ *pnName = aKWLen[i];
145237
+ return SQLITE_OK;
145238
+}
145239
+SQLITE_API int sqlite3_keyword_count(void){ return SQLITE_N_KEYWORD; }
145240
+SQLITE_API int sqlite3_keyword_check(const char *zName, int nName){
145241
+ return TK_ID!=sqlite3KeywordCode((const u8*)zName, nName);
145242
+}
145172145243
145173145244
/************** End of keywordhash.h *****************************************/
145174145245
/************** Continuing where we left off in tokenize.c *******************/
145175145246
145176145247
@@ -149895,28 +149966,10 @@
149895149966
sqlite3 *db = va_arg(ap, sqlite3*);
149896149967
db->dbOptFlags = (u16)(va_arg(ap, int) & 0xffff);
149897149968
break;
149898149969
}
149899149970
149900
-#ifdef SQLITE_N_KEYWORD
149901
- /* sqlite3_test_control(SQLITE_TESTCTRL_ISKEYWORD, const char *zWord)
149902
- **
149903
- ** If zWord is a keyword recognized by the parser, then return the
149904
- ** number of keywords. Or if zWord is not a keyword, return 0.
149905
- **
149906
- ** This test feature is only available in the amalgamation since
149907
- ** the SQLITE_N_KEYWORD macro is not defined in this file if SQLite
149908
- ** is built using separate source files.
149909
- */
149910
- case SQLITE_TESTCTRL_ISKEYWORD: {
149911
- const char *zWord = va_arg(ap, const char*);
149912
- int n = sqlite3Strlen30(zWord);
149913
- rc = (sqlite3KeywordCode((u8*)zWord, n)!=TK_ID) ? SQLITE_N_KEYWORD : 0;
149914
- break;
149915
- }
149916
-#endif
149917
-
149918149971
/* sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff);
149919149972
**
149920149973
** If parameter onoff is non-zero, configure the wrappers so that all
149921149974
** subsequent calls to localtime() and variants fail. If onoff is zero,
149922149975
** undo this setting.
@@ -206672,11 +206725,11 @@
206672206725
int nArg, /* Number of args */
206673206726
sqlite3_value **apUnused /* Function arguments */
206674206727
){
206675206728
assert( nArg==0 );
206676206729
UNUSED_PARAM2(nArg, apUnused);
206677
- sqlite3_result_text(pCtx, "fts5: 2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8b4a3", -1, SQLITE_TRANSIENT);
206730
+ sqlite3_result_text(pCtx, "fts5: 2018-04-26 12:27:03 368c14da868a843767344f6cc17c499fddd83244c0510337ed9a918e64ee2413", -1, SQLITE_TRANSIENT);
206678206731
}
206679206732
206680206733
static int fts5Init(sqlite3 *db){
206681206734
static const sqlite3_module fts5Mod = {
206682206735
/* iVersion */ 2,
@@ -210942,12 +210995,12 @@
210942210995
}
210943210996
#endif /* SQLITE_CORE */
210944210997
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
210945210998
210946210999
/************** End of stmt.c ************************************************/
210947
-#if __LINE__!=210947
211000
+#if __LINE__!=211000
210948211001
#undef SQLITE_SOURCE_ID
210949
-#define SQLITE_SOURCE_ID "2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8alt2"
211002
+#define SQLITE_SOURCE_ID "2018-04-26 18:34:26 9fd0faf517993587d2f54212638545fc85fbbc84a031bcfae8c1e5894825alt2"
210950211003
#endif
210951211004
/* Return the source-id for this library */
210952211005
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
210953211006
/************************** End of sqlite3.c ******************************/
210954211007
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1150,11 +1150,11 @@
1150 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1151 ** [sqlite_version()] and [sqlite_source_id()].
1152 */
1153 #define SQLITE_VERSION "3.24.0"
1154 #define SQLITE_VERSION_NUMBER 3024000
1155 #define SQLITE_SOURCE_ID "2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8b4a3"
1156
1157 /*
1158 ** CAPI3REF: Run-Time Library Version Numbers
1159 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1160 **
@@ -8041,11 +8041,11 @@
8041 #define SQLITE_TESTCTRL_PENDING_BYTE 11
8042 #define SQLITE_TESTCTRL_ASSERT 12
8043 #define SQLITE_TESTCTRL_ALWAYS 13
8044 #define SQLITE_TESTCTRL_RESERVE 14
8045 #define SQLITE_TESTCTRL_OPTIMIZATIONS 15
8046 #define SQLITE_TESTCTRL_ISKEYWORD 16
8047 #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
8048 #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
8049 #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
8050 #define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19
8051 #define SQLITE_TESTCTRL_NEVER_CORRUPT 20
@@ -8055,10 +8055,61 @@
8055 #define SQLITE_TESTCTRL_SORTER_MMAP 24
8056 #define SQLITE_TESTCTRL_IMPOSTER 25
8057 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26
8058 #define SQLITE_TESTCTRL_LAST 26 /* Largest TESTCTRL */
8059
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8060 /*
8061 ** CAPI3REF: SQLite Runtime Status
8062 **
8063 ** ^These interfaces are used to retrieve runtime status information
8064 ** about the performance of SQLite, and optionally to reset various
@@ -98210,14 +98261,13 @@
98210 assert( pExpr->iColumn>=-1 && pExpr->iColumn<pTab->nCol );
98211 assert( pTab->iPKey<0 || pExpr->iColumn!=pTab->iPKey );
98212 assert( p1>=0 && p1<(pTab->nCol*2+2) );
98213
98214 sqlite3VdbeAddOp2(v, OP_Param, p1, target);
98215 VdbeComment((v, "%s.%s -> $%d",
98216 (pExpr->iTable ? "new" : "old"),
98217 (pExpr->iColumn<0 ? "rowid" : pExpr->pTab->aCol[pExpr->iColumn].zName),
98218 target
98219 ));
98220
98221 #ifndef SQLITE_OMIT_FLOATING_POINT
98222 /* If the column has REAL affinity, it may currently be stored as an
98223 ** integer. Use OP_RealAffinity to make sure it is really real.
@@ -121222,19 +121272,19 @@
121222 sqlite3VdbeAddOp2(v, OP_Sequence, pSort->iECursor, regBase+nExpr);
121223 }
121224 if( nPrefixReg==0 && nData>0 ){
121225 sqlite3ExprCodeMove(pParse, regData, regBase+nExpr+bSeq, nData);
121226 }
121227 sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase+nOBSat, nBase-nOBSat, regRecord);
121228 if( nOBSat>0 ){
121229 int regPrevKey; /* The first nOBSat columns of the previous row */
121230 int addrFirst; /* Address of the OP_IfNot opcode */
121231 int addrJmp; /* Address of the OP_Jump opcode */
121232 VdbeOp *pOp; /* Opcode that opens the sorter */
121233 int nKey; /* Number of sorting key columns, including OP_Sequence */
121234 KeyInfo *pKI; /* Original KeyInfo on the sorter table */
121235
 
121236 regPrevKey = pParse->nMem+1;
121237 pParse->nMem += pSort->nOBSat;
121238 nKey = nExpr - pSort->nOBSat + bSeq;
121239 if( bSeq ){
121240 addrFirst = sqlite3VdbeAddOp1(v, OP_IfNot, regBase+nExpr);
@@ -121264,45 +121314,46 @@
121264 }
121265 sqlite3VdbeJumpHere(v, addrFirst);
121266 sqlite3ExprCodeMove(pParse, regBase, regPrevKey, pSort->nOBSat);
121267 sqlite3VdbeJumpHere(v, addrJmp);
121268 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121269 if( pSort->sortFlags & SORTFLAG_UseSorter ){
121270 op = OP_SorterInsert;
121271 }else{
121272 op = OP_IdxInsert;
121273 }
121274 sqlite3VdbeAddOp4Int(v, op, pSort->iECursor, regRecord,
121275 regBase+nOBSat, nBase-nOBSat);
121276 if( iLimit ){
121277 int addr;
121278 int r1 = 0;
121279 /* Fill the sorter until it contains LIMIT+OFFSET entries. (The iLimit
121280 ** register is initialized with value of LIMIT+OFFSET.) After the sorter
121281 ** fills up, delete the least entry in the sorter after each insert.
121282 ** Thus we never hold more than the LIMIT+OFFSET rows in memory at once */
121283 addr = sqlite3VdbeAddOp1(v, OP_IfNotZero, iLimit); VdbeCoverage(v);
121284 sqlite3VdbeAddOp1(v, OP_Last, pSort->iECursor);
121285 if( pSort->bOrderedInnerLoop ){
121286 r1 = ++pParse->nMem;
121287 sqlite3VdbeAddOp3(v, OP_Column, pSort->iECursor, nExpr, r1);
121288 VdbeComment((v, "seq"));
121289 }
121290 sqlite3VdbeAddOp1(v, OP_Delete, pSort->iECursor);
121291 if( pSort->bOrderedInnerLoop ){
121292 /* If the inner loop is driven by an index such that values from
121293 ** the same iteration of the inner loop are in sorted order, then
121294 ** immediately jump to the next iteration of an inner loop if the
121295 ** entry from the current iteration does not fit into the top
121296 ** LIMIT+OFFSET entries of the sorter. */
121297 int iBrk = sqlite3VdbeCurrentAddr(v) + 2;
121298 sqlite3VdbeAddOp3(v, OP_Eq, regBase+nExpr, iBrk, r1);
121299 sqlite3VdbeChangeP5(v, SQLITE_NULLEQ);
121300 VdbeCoverage(v);
121301 }
121302 sqlite3VdbeJumpHere(v, addr);
121303 }
121304 }
121305
121306 /*
121307 ** Add code to implement the OFFSET
121308 */
@@ -128898,10 +128949,16 @@
128898 ** a new.* reference in a trigger program.
128899 */
128900 testcase( i==31 );
128901 testcase( i==32 );
128902 sqlite3ExprCodeGetColumnToReg(pParse, pTab, i, iDataCur, regNew+i);
 
 
 
 
 
 
128903 }else{
128904 sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i);
128905 }
128906 }
128907 }
@@ -128926,14 +128983,18 @@
128926 }else{
128927 sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, labelContinue, regOldRowid);
128928 VdbeCoverage(v);
128929 }
128930
128931 /* If it did not delete it, the row-trigger may still have modified
 
128932 ** some of the columns of the row being updated. Load the values for
128933 ** all columns not modified by the update statement into their
128934 ** registers in case this has happened.
 
 
 
128935 */
128936 for(i=0; i<pTab->nCol; i++){
128937 if( aXRef[i]<0 && i!=pTab->iPKey ){
128938 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i);
128939 }
@@ -145167,10 +145228,20 @@
145167 int id = TK_ID;
145168 keywordCode((char*)z, n, &id);
145169 return id;
145170 }
145171 #define SQLITE_N_KEYWORD 126
 
 
 
 
 
 
 
 
 
 
145172
145173 /************** End of keywordhash.h *****************************************/
145174 /************** Continuing where we left off in tokenize.c *******************/
145175
145176
@@ -149895,28 +149966,10 @@
149895 sqlite3 *db = va_arg(ap, sqlite3*);
149896 db->dbOptFlags = (u16)(va_arg(ap, int) & 0xffff);
149897 break;
149898 }
149899
149900 #ifdef SQLITE_N_KEYWORD
149901 /* sqlite3_test_control(SQLITE_TESTCTRL_ISKEYWORD, const char *zWord)
149902 **
149903 ** If zWord is a keyword recognized by the parser, then return the
149904 ** number of keywords. Or if zWord is not a keyword, return 0.
149905 **
149906 ** This test feature is only available in the amalgamation since
149907 ** the SQLITE_N_KEYWORD macro is not defined in this file if SQLite
149908 ** is built using separate source files.
149909 */
149910 case SQLITE_TESTCTRL_ISKEYWORD: {
149911 const char *zWord = va_arg(ap, const char*);
149912 int n = sqlite3Strlen30(zWord);
149913 rc = (sqlite3KeywordCode((u8*)zWord, n)!=TK_ID) ? SQLITE_N_KEYWORD : 0;
149914 break;
149915 }
149916 #endif
149917
149918 /* sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff);
149919 **
149920 ** If parameter onoff is non-zero, configure the wrappers so that all
149921 ** subsequent calls to localtime() and variants fail. If onoff is zero,
149922 ** undo this setting.
@@ -206672,11 +206725,11 @@
206672 int nArg, /* Number of args */
206673 sqlite3_value **apUnused /* Function arguments */
206674 ){
206675 assert( nArg==0 );
206676 UNUSED_PARAM2(nArg, apUnused);
206677 sqlite3_result_text(pCtx, "fts5: 2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8b4a3", -1, SQLITE_TRANSIENT);
206678 }
206679
206680 static int fts5Init(sqlite3 *db){
206681 static const sqlite3_module fts5Mod = {
206682 /* iVersion */ 2,
@@ -210942,12 +210995,12 @@
210942 }
210943 #endif /* SQLITE_CORE */
210944 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
210945
210946 /************** End of stmt.c ************************************************/
210947 #if __LINE__!=210947
210948 #undef SQLITE_SOURCE_ID
210949 #define SQLITE_SOURCE_ID "2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8alt2"
210950 #endif
210951 /* Return the source-id for this library */
210952 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
210953 /************************** End of sqlite3.c ******************************/
210954
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1150,11 +1150,11 @@
1150 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1151 ** [sqlite_version()] and [sqlite_source_id()].
1152 */
1153 #define SQLITE_VERSION "3.24.0"
1154 #define SQLITE_VERSION_NUMBER 3024000
1155 #define SQLITE_SOURCE_ID "2018-04-26 18:34:26 9fd0faf517993587d2f54212638545fc85fbbc84a031bcfae8c1e5894825d83b"
1156
1157 /*
1158 ** CAPI3REF: Run-Time Library Version Numbers
1159 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1160 **
@@ -8041,11 +8041,11 @@
8041 #define SQLITE_TESTCTRL_PENDING_BYTE 11
8042 #define SQLITE_TESTCTRL_ASSERT 12
8043 #define SQLITE_TESTCTRL_ALWAYS 13
8044 #define SQLITE_TESTCTRL_RESERVE 14
8045 #define SQLITE_TESTCTRL_OPTIMIZATIONS 15
8046 #define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
8047 #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
8048 #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
8049 #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
8050 #define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19
8051 #define SQLITE_TESTCTRL_NEVER_CORRUPT 20
@@ -8055,10 +8055,61 @@
8055 #define SQLITE_TESTCTRL_SORTER_MMAP 24
8056 #define SQLITE_TESTCTRL_IMPOSTER 25
8057 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26
8058 #define SQLITE_TESTCTRL_LAST 26 /* Largest TESTCTRL */
8059
8060 /*
8061 ** CAPI3REF: SQL Keyword Checking
8062 **
8063 ** These routines provide access to the set of SQL language keywords
8064 ** recognized by SQLite. Applications can uses these routines to determine
8065 ** whether or not a specific identifier needs to be escaped (for example,
8066 ** by enclosing in double-quotes) so as not to confuse the parser.
8067 **
8068 ** The sqlite3_keyword_count() interface returns the number of distinct
8069 ** keywords understood by SQLite.
8070 **
8071 ** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and
8072 ** makes *Z point to that keyword expressed as UTF8 and writes the number
8073 ** of bytes in the keyword into *L. The string that *Z points to is not
8074 ** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns
8075 ** SQLITE_OK if N is within bounds and SQLITE_ERROR if not. If either Z
8076 ** or L are NULL or invalid pointers then calls to
8077 ** sqlite3_keyword_name(N,Z,L) result in undefined behavior.
8078 **
8079 ** The sqlite3_keyword_check(Z,L) interface checks to see whether or not
8080 ** the L-byte UTF8 identifier that Z points to is a keyword, returning non-zero
8081 ** if it is and zero if not.
8082 **
8083 ** The parser used by SQLite is forgiving. It is often possible to use
8084 ** a keyword as an identifier as long as such use does not result in a
8085 ** parsing ambiguity. For example, the statement
8086 ** "CREATE TABLE BEGIN(REPLACE,PRAGMA,END);" is accepted by SQLite, and
8087 ** creates a new table named "BEGIN" with three columns named
8088 ** "REPLACE", "PRAGMA", and "END". Nevertheless, best practice is to avoid
8089 ** using keywords as identifiers. Common techniques used to avoid keyword
8090 ** name collisions include:
8091 ** <ul>
8092 ** <li> Put all indentifier names inside double-quotes. This is the official
8093 ** SQL way to escape identifier names.
8094 ** <li> Put identifier names inside &#91;...&#93;. This is not standard SQL,
8095 ** but it is what SQL Server does and so lots of programmers use this
8096 ** technique.
8097 ** <li> Begin every identifier with the letter "Z" as no SQL keywords start
8098 ** with "Z".
8099 ** <li> Include a digit somewhere in every identifier name.
8100 ** </ul>
8101 **
8102 ** Note that the number of keywords understood by SQLite can depend on
8103 ** compile-time options. For example, "VACUUM" is not a keyword if
8104 ** SQLite is compiled with the [-DSQLITE_OMIT_VACUUM] option. Also,
8105 ** new keywords may be added to future releases of SQLite.
8106 */
8107 SQLITE_API int sqlite3_keyword_count(void);
8108 SQLITE_API int sqlite3_keyword_name(int,const char**,int*);
8109 SQLITE_API int sqlite3_keyword_check(const char*,int);
8110
8111 /*
8112 ** CAPI3REF: SQLite Runtime Status
8113 **
8114 ** ^These interfaces are used to retrieve runtime status information
8115 ** about the performance of SQLite, and optionally to reset various
@@ -98210,14 +98261,13 @@
98261 assert( pExpr->iColumn>=-1 && pExpr->iColumn<pTab->nCol );
98262 assert( pTab->iPKey<0 || pExpr->iColumn!=pTab->iPKey );
98263 assert( p1>=0 && p1<(pTab->nCol*2+2) );
98264
98265 sqlite3VdbeAddOp2(v, OP_Param, p1, target);
98266 VdbeComment((v, "r[%d]=%s.%s", target,
98267 (pExpr->iTable ? "new" : "old"),
98268 (pExpr->iColumn<0 ? "rowid" : pExpr->pTab->aCol[pExpr->iColumn].zName)
 
98269 ));
98270
98271 #ifndef SQLITE_OMIT_FLOATING_POINT
98272 /* If the column has REAL affinity, it may currently be stored as an
98273 ** integer. Use OP_RealAffinity to make sure it is really real.
@@ -121222,19 +121272,19 @@
121272 sqlite3VdbeAddOp2(v, OP_Sequence, pSort->iECursor, regBase+nExpr);
121273 }
121274 if( nPrefixReg==0 && nData>0 ){
121275 sqlite3ExprCodeMove(pParse, regData, regBase+nExpr+bSeq, nData);
121276 }
 
121277 if( nOBSat>0 ){
121278 int regPrevKey; /* The first nOBSat columns of the previous row */
121279 int addrFirst; /* Address of the OP_IfNot opcode */
121280 int addrJmp; /* Address of the OP_Jump opcode */
121281 VdbeOp *pOp; /* Opcode that opens the sorter */
121282 int nKey; /* Number of sorting key columns, including OP_Sequence */
121283 KeyInfo *pKI; /* Original KeyInfo on the sorter table */
121284
121285 sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase+nOBSat, nBase-nOBSat,regRecord);
121286 regPrevKey = pParse->nMem+1;
121287 pParse->nMem += pSort->nOBSat;
121288 nKey = nExpr - pSort->nOBSat + bSeq;
121289 if( bSeq ){
121290 addrFirst = sqlite3VdbeAddOp1(v, OP_IfNot, regBase+nExpr);
@@ -121264,45 +121314,46 @@
121314 }
121315 sqlite3VdbeJumpHere(v, addrFirst);
121316 sqlite3ExprCodeMove(pParse, regBase, regPrevKey, pSort->nOBSat);
121317 sqlite3VdbeJumpHere(v, addrJmp);
121318 }
121319 if( iLimit ){
121320 /* At this point the values for the new sorter entry are stored
121321 ** in an array of registers. They need to be composed into a record
121322 ** and inserted into the sorter if either (a) there are currently
121323 ** less than LIMIT+OFFSET items or (b) the new record is smaller than
121324 ** the largest record currently in the sorter. If (b) is true and there
121325 ** are already LIMIT+OFFSET items in the sorter, delete the largest
121326 ** entry before inserting the new one. This way there are never more
121327 ** than LIMIT+OFFSET items in the sorter.
121328 **
121329 ** If the new record does not need to be inserted into the sorter,
121330 ** jump to the next iteration of the loop. Or, if the
121331 ** pSort->bOrderedInnerLoop flag is set to indicate that the inner
121332 ** loop delivers items in sorted order, jump to the next iteration
121333 ** of the outer loop.
121334 */
121335 int iCsr = pSort->iECursor;
121336 int iJmp = sqlite3VdbeCurrentAddr(v)+5+(nOBSat<=0)+pSort->bOrderedInnerLoop;
121337 assert( pSort->bOrderedInnerLoop==0 || pSort->bOrderedInnerLoop==1 );
121338 sqlite3VdbeAddOp2(v, OP_IfNotZero, iLimit, sqlite3VdbeCurrentAddr(v)+4);
121339 VdbeCoverage(v);
121340 sqlite3VdbeAddOp2(v, OP_Last, iCsr, 0);
121341 sqlite3VdbeAddOp4Int(v, OP_IdxLE, iCsr, iJmp, regBase+nOBSat, nExpr-nOBSat);
121342 VdbeCoverage(v);
121343 sqlite3VdbeAddOp1(v, OP_Delete, iCsr);
121344 }
121345 if( nOBSat<=0 ){
121346 sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase+nOBSat, nBase-nOBSat,regRecord);
121347 }
121348 if( pSort->sortFlags & SORTFLAG_UseSorter ){
121349 op = OP_SorterInsert;
121350 }else{
121351 op = OP_IdxInsert;
121352 }
121353 sqlite3VdbeAddOp4Int(v, op, pSort->iECursor, regRecord,
121354 regBase+nOBSat, nBase-nOBSat);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121355 }
121356
121357 /*
121358 ** Add code to implement the OFFSET
121359 */
@@ -128898,10 +128949,16 @@
128949 ** a new.* reference in a trigger program.
128950 */
128951 testcase( i==31 );
128952 testcase( i==32 );
128953 sqlite3ExprCodeGetColumnToReg(pParse, pTab, i, iDataCur, regNew+i);
128954 if( tmask & TRIGGER_BEFORE ){
128955 /* This value will be recomputed in After-BEFORE-trigger-reload-loop
128956 ** below, so make sure that it is not cached and reused.
128957 ** Ticket d85fffd6ffe856092ed8daefa811b1e399706b28. */
128958 sqlite3ExprCacheRemove(pParse, regNew+i, 1);
128959 }
128960 }else{
128961 sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i);
128962 }
128963 }
128964 }
@@ -128926,14 +128983,18 @@
128983 }else{
128984 sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, labelContinue, regOldRowid);
128985 VdbeCoverage(v);
128986 }
128987
128988 /* After-BEFORE-trigger-reload-loop:
128989 ** If it did not delete it, the BEFORE trigger may still have modified
128990 ** some of the columns of the row being updated. Load the values for
128991 ** all columns not modified by the update statement into their registers
128992 ** in case this has happened. Only unmodified columns are reloaded.
128993 ** The values computed for modified columns use the values before the
128994 ** BEFORE trigger runs. See test case trigger1-18.0 (added 2018-04-26)
128995 ** for an example.
128996 */
128997 for(i=0; i<pTab->nCol; i++){
128998 if( aXRef[i]<0 && i!=pTab->iPKey ){
128999 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i);
129000 }
@@ -145167,10 +145228,20 @@
145228 int id = TK_ID;
145229 keywordCode((char*)z, n, &id);
145230 return id;
145231 }
145232 #define SQLITE_N_KEYWORD 126
145233 SQLITE_API int sqlite3_keyword_name(int i,const char **pzName,int *pnName){
145234 if( i<0 || i>=SQLITE_N_KEYWORD ) return SQLITE_ERROR;
145235 *pzName = zKWText + aKWOffset[i];
145236 *pnName = aKWLen[i];
145237 return SQLITE_OK;
145238 }
145239 SQLITE_API int sqlite3_keyword_count(void){ return SQLITE_N_KEYWORD; }
145240 SQLITE_API int sqlite3_keyword_check(const char *zName, int nName){
145241 return TK_ID!=sqlite3KeywordCode((const u8*)zName, nName);
145242 }
145243
145244 /************** End of keywordhash.h *****************************************/
145245 /************** Continuing where we left off in tokenize.c *******************/
145246
145247
@@ -149895,28 +149966,10 @@
149966 sqlite3 *db = va_arg(ap, sqlite3*);
149967 db->dbOptFlags = (u16)(va_arg(ap, int) & 0xffff);
149968 break;
149969 }
149970
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149971 /* sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff);
149972 **
149973 ** If parameter onoff is non-zero, configure the wrappers so that all
149974 ** subsequent calls to localtime() and variants fail. If onoff is zero,
149975 ** undo this setting.
@@ -206672,11 +206725,11 @@
206725 int nArg, /* Number of args */
206726 sqlite3_value **apUnused /* Function arguments */
206727 ){
206728 assert( nArg==0 );
206729 UNUSED_PARAM2(nArg, apUnused);
206730 sqlite3_result_text(pCtx, "fts5: 2018-04-26 12:27:03 368c14da868a843767344f6cc17c499fddd83244c0510337ed9a918e64ee2413", -1, SQLITE_TRANSIENT);
206731 }
206732
206733 static int fts5Init(sqlite3 *db){
206734 static const sqlite3_module fts5Mod = {
206735 /* iVersion */ 2,
@@ -210942,12 +210995,12 @@
210995 }
210996 #endif /* SQLITE_CORE */
210997 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
210998
210999 /************** End of stmt.c ************************************************/
211000 #if __LINE__!=211000
211001 #undef SQLITE_SOURCE_ID
211002 #define SQLITE_SOURCE_ID "2018-04-26 18:34:26 9fd0faf517993587d2f54212638545fc85fbbc84a031bcfae8c1e5894825alt2"
211003 #endif
211004 /* Return the source-id for this library */
211005 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
211006 /************************** End of sqlite3.c ******************************/
211007
+53 -2
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123123
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124124
** [sqlite_version()] and [sqlite_source_id()].
125125
*/
126126
#define SQLITE_VERSION "3.24.0"
127127
#define SQLITE_VERSION_NUMBER 3024000
128
-#define SQLITE_SOURCE_ID "2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8b4a3"
128
+#define SQLITE_SOURCE_ID "2018-04-26 18:34:26 9fd0faf517993587d2f54212638545fc85fbbc84a031bcfae8c1e5894825d83b"
129129
130130
/*
131131
** CAPI3REF: Run-Time Library Version Numbers
132132
** KEYWORDS: sqlite3_version sqlite3_sourceid
133133
**
@@ -7014,11 +7014,11 @@
70147014
#define SQLITE_TESTCTRL_PENDING_BYTE 11
70157015
#define SQLITE_TESTCTRL_ASSERT 12
70167016
#define SQLITE_TESTCTRL_ALWAYS 13
70177017
#define SQLITE_TESTCTRL_RESERVE 14
70187018
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
7019
-#define SQLITE_TESTCTRL_ISKEYWORD 16
7019
+#define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
70207020
#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
70217021
#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
70227022
#define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
70237023
#define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19
70247024
#define SQLITE_TESTCTRL_NEVER_CORRUPT 20
@@ -7028,10 +7028,61 @@
70287028
#define SQLITE_TESTCTRL_SORTER_MMAP 24
70297029
#define SQLITE_TESTCTRL_IMPOSTER 25
70307030
#define SQLITE_TESTCTRL_PARSER_COVERAGE 26
70317031
#define SQLITE_TESTCTRL_LAST 26 /* Largest TESTCTRL */
70327032
7033
+/*
7034
+** CAPI3REF: SQL Keyword Checking
7035
+**
7036
+** These routines provide access to the set of SQL language keywords
7037
+** recognized by SQLite. Applications can uses these routines to determine
7038
+** whether or not a specific identifier needs to be escaped (for example,
7039
+** by enclosing in double-quotes) so as not to confuse the parser.
7040
+**
7041
+** The sqlite3_keyword_count() interface returns the number of distinct
7042
+** keywords understood by SQLite.
7043
+**
7044
+** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and
7045
+** makes *Z point to that keyword expressed as UTF8 and writes the number
7046
+** of bytes in the keyword into *L. The string that *Z points to is not
7047
+** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns
7048
+** SQLITE_OK if N is within bounds and SQLITE_ERROR if not. If either Z
7049
+** or L are NULL or invalid pointers then calls to
7050
+** sqlite3_keyword_name(N,Z,L) result in undefined behavior.
7051
+**
7052
+** The sqlite3_keyword_check(Z,L) interface checks to see whether or not
7053
+** the L-byte UTF8 identifier that Z points to is a keyword, returning non-zero
7054
+** if it is and zero if not.
7055
+**
7056
+** The parser used by SQLite is forgiving. It is often possible to use
7057
+** a keyword as an identifier as long as such use does not result in a
7058
+** parsing ambiguity. For example, the statement
7059
+** "CREATE TABLE BEGIN(REPLACE,PRAGMA,END);" is accepted by SQLite, and
7060
+** creates a new table named "BEGIN" with three columns named
7061
+** "REPLACE", "PRAGMA", and "END". Nevertheless, best practice is to avoid
7062
+** using keywords as identifiers. Common techniques used to avoid keyword
7063
+** name collisions include:
7064
+** <ul>
7065
+** <li> Put all indentifier names inside double-quotes. This is the official
7066
+** SQL way to escape identifier names.
7067
+** <li> Put identifier names inside &#91;...&#93;. This is not standard SQL,
7068
+** but it is what SQL Server does and so lots of programmers use this
7069
+** technique.
7070
+** <li> Begin every identifier with the letter "Z" as no SQL keywords start
7071
+** with "Z".
7072
+** <li> Include a digit somewhere in every identifier name.
7073
+** </ul>
7074
+**
7075
+** Note that the number of keywords understood by SQLite can depend on
7076
+** compile-time options. For example, "VACUUM" is not a keyword if
7077
+** SQLite is compiled with the [-DSQLITE_OMIT_VACUUM] option. Also,
7078
+** new keywords may be added to future releases of SQLite.
7079
+*/
7080
+SQLITE_API int sqlite3_keyword_count(void);
7081
+SQLITE_API int sqlite3_keyword_name(int,const char**,int*);
7082
+SQLITE_API int sqlite3_keyword_check(const char*,int);
7083
+
70337084
/*
70347085
** CAPI3REF: SQLite Runtime Status
70357086
**
70367087
** ^These interfaces are used to retrieve runtime status information
70377088
** about the performance of SQLite, and optionally to reset various
70387089
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.24.0"
127 #define SQLITE_VERSION_NUMBER 3024000
128 #define SQLITE_SOURCE_ID "2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8b4a3"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
@@ -7014,11 +7014,11 @@
7014 #define SQLITE_TESTCTRL_PENDING_BYTE 11
7015 #define SQLITE_TESTCTRL_ASSERT 12
7016 #define SQLITE_TESTCTRL_ALWAYS 13
7017 #define SQLITE_TESTCTRL_RESERVE 14
7018 #define SQLITE_TESTCTRL_OPTIMIZATIONS 15
7019 #define SQLITE_TESTCTRL_ISKEYWORD 16
7020 #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
7021 #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
7022 #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
7023 #define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19
7024 #define SQLITE_TESTCTRL_NEVER_CORRUPT 20
@@ -7028,10 +7028,61 @@
7028 #define SQLITE_TESTCTRL_SORTER_MMAP 24
7029 #define SQLITE_TESTCTRL_IMPOSTER 25
7030 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26
7031 #define SQLITE_TESTCTRL_LAST 26 /* Largest TESTCTRL */
7032
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7033 /*
7034 ** CAPI3REF: SQLite Runtime Status
7035 **
7036 ** ^These interfaces are used to retrieve runtime status information
7037 ** about the performance of SQLite, and optionally to reset various
7038
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.24.0"
127 #define SQLITE_VERSION_NUMBER 3024000
128 #define SQLITE_SOURCE_ID "2018-04-26 18:34:26 9fd0faf517993587d2f54212638545fc85fbbc84a031bcfae8c1e5894825d83b"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
@@ -7014,11 +7014,11 @@
7014 #define SQLITE_TESTCTRL_PENDING_BYTE 11
7015 #define SQLITE_TESTCTRL_ASSERT 12
7016 #define SQLITE_TESTCTRL_ALWAYS 13
7017 #define SQLITE_TESTCTRL_RESERVE 14
7018 #define SQLITE_TESTCTRL_OPTIMIZATIONS 15
7019 #define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
7020 #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
7021 #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
7022 #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
7023 #define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19
7024 #define SQLITE_TESTCTRL_NEVER_CORRUPT 20
@@ -7028,10 +7028,61 @@
7028 #define SQLITE_TESTCTRL_SORTER_MMAP 24
7029 #define SQLITE_TESTCTRL_IMPOSTER 25
7030 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26
7031 #define SQLITE_TESTCTRL_LAST 26 /* Largest TESTCTRL */
7032
7033 /*
7034 ** CAPI3REF: SQL Keyword Checking
7035 **
7036 ** These routines provide access to the set of SQL language keywords
7037 ** recognized by SQLite. Applications can uses these routines to determine
7038 ** whether or not a specific identifier needs to be escaped (for example,
7039 ** by enclosing in double-quotes) so as not to confuse the parser.
7040 **
7041 ** The sqlite3_keyword_count() interface returns the number of distinct
7042 ** keywords understood by SQLite.
7043 **
7044 ** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and
7045 ** makes *Z point to that keyword expressed as UTF8 and writes the number
7046 ** of bytes in the keyword into *L. The string that *Z points to is not
7047 ** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns
7048 ** SQLITE_OK if N is within bounds and SQLITE_ERROR if not. If either Z
7049 ** or L are NULL or invalid pointers then calls to
7050 ** sqlite3_keyword_name(N,Z,L) result in undefined behavior.
7051 **
7052 ** The sqlite3_keyword_check(Z,L) interface checks to see whether or not
7053 ** the L-byte UTF8 identifier that Z points to is a keyword, returning non-zero
7054 ** if it is and zero if not.
7055 **
7056 ** The parser used by SQLite is forgiving. It is often possible to use
7057 ** a keyword as an identifier as long as such use does not result in a
7058 ** parsing ambiguity. For example, the statement
7059 ** "CREATE TABLE BEGIN(REPLACE,PRAGMA,END);" is accepted by SQLite, and
7060 ** creates a new table named "BEGIN" with three columns named
7061 ** "REPLACE", "PRAGMA", and "END". Nevertheless, best practice is to avoid
7062 ** using keywords as identifiers. Common techniques used to avoid keyword
7063 ** name collisions include:
7064 ** <ul>
7065 ** <li> Put all indentifier names inside double-quotes. This is the official
7066 ** SQL way to escape identifier names.
7067 ** <li> Put identifier names inside &#91;...&#93;. This is not standard SQL,
7068 ** but it is what SQL Server does and so lots of programmers use this
7069 ** technique.
7070 ** <li> Begin every identifier with the letter "Z" as no SQL keywords start
7071 ** with "Z".
7072 ** <li> Include a digit somewhere in every identifier name.
7073 ** </ul>
7074 **
7075 ** Note that the number of keywords understood by SQLite can depend on
7076 ** compile-time options. For example, "VACUUM" is not a keyword if
7077 ** SQLite is compiled with the [-DSQLITE_OMIT_VACUUM] option. Also,
7078 ** new keywords may be added to future releases of SQLite.
7079 */
7080 SQLITE_API int sqlite3_keyword_count(void);
7081 SQLITE_API int sqlite3_keyword_name(int,const char**,int*);
7082 SQLITE_API int sqlite3_keyword_check(const char*,int);
7083
7084 /*
7085 ** CAPI3REF: SQLite Runtime Status
7086 **
7087 ** ^These interfaces are used to retrieve runtime status information
7088 ** about the performance of SQLite, and optionally to reset various
7089

Keyboard Shortcuts

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