Fossil SCM

Update the built-in SQLite to the 3.54.0 release candidate for final testing.

drh 2026-10-09 14:14 UTC trunk
Commit 40c5397698246caa76a46f111fbef004a9c1c11b276118b387116583f5433227
3 files changed +209 -109 +343 -345 +2 -2
+209 -109
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -20222,10 +20222,11 @@
2022220222
sqlite3_value **argv
2022320223
){
2022420224
int rc;
2022520225
sqlite3_stmt *pStmt;
2022620226
int n;
20227
+ char *z;
2022720228
sqlite3_int64 ii;
2022820229
sqlite3_int64 pgsz;
2022920230
sqlite3_int64 nPage;
2023020231
sqlite3_int64 nPageInUse;
2023120232
sqlite3_int64 nFreeList;
@@ -20545,13 +20546,15 @@
2054520546
*/
2054620547
diskusedTitle(&s, "Raw data used to generate this report");
2054720548
sqlite3_str_appendf(s.pOut,
2054820549
"The following SQL will create a table named \"space_used\" which\n"
2054920550
"contains most of the information used to generate the report above.\n"
20550
- "*/\n"
2055120551
);
20552
+ z = sqlite3_str_value(s.pOut);
20553
+ while( z && (z = strstr(z,"*/"))!=0 ){ z[0] = '+'; }
2055220554
sqlite3_str_appendf(s.pOut,
20555
+ "*/\n"
2055320556
"BEGIN;\n"
2055420557
"CREATE TABLE space_used(\n"
2055520558
" name text, -- A table or index\n" /* 0 */
2055620559
" tblname text, -- Table that owns name\n" /* 1 */
2055720560
" is_index boolean, -- TRUE if it is an index\n" /* 2 */
@@ -25713,11 +25716,28 @@
2571325716
}
2571425717
return "";
2571525718
}
2571625719
#endif /* !defined(SQLITE_PS_APPDEF) */
2571725720
25718
-
25721
+#ifdef SQLITE_DEBUG
25722
+/*
25723
+** SQL function: sqlite3_incomplete(TEXT)
25724
+**
25725
+** For use internally and for debugging and testing only. This function
25726
+** is subject to change or removal in future versions.
25727
+**
25728
+** Invoke the sqlite3_incomplete() interface and return its result.
25729
+*/
25730
+static void shellIncompleteFunc(
25731
+ sqlite3_context *pCtx,
25732
+ int nVal,
25733
+ sqlite3_value **apVal
25734
+){
25735
+ const char *zSql = (const char*)sqlite3_value_text(apVal[0]);
25736
+ sqlite3_result_int64(pCtx, zSql?sqlite3_incomplete(zSql):SQLITE_MISUSE);
25737
+}
25738
+#endif /* SQLITE_DEBUG */
2571925739
2572025740
/*
2572125741
** Return the raw (unexpanded) prompt string. This will be the
2572225742
** first of the following that exist:
2572325743
**
@@ -25814,10 +25834,93 @@
2581425834
if( z[k]<0x40 || z[k]>0x7e ) break;
2581525835
i = k+1;
2581625836
}
2581725837
return i;
2581825838
}
25839
+
25840
+/*
25841
+** Append text on pOut that is sufficient to complete the statement zBase
25842
+** (according to sqlite3_complete()). eFlags:
25843
+**
25844
+** 0x01 Include the final ";" if needed
25845
+** 0x04 Assume zBase ends with '\n'
25846
+*/
25847
+static void appendCompletion(
25848
+ sqlite3_str *pOut, /* Append the completion here */
25849
+ const char *zBase, /* Existing SQL text */
25850
+ int eFlags /* 0x01: Include ";", 0x04: Assume '\n' */
25851
+){
25852
+ sqlite3_int64 R = zBase ? sqlite3_incomplete(zBase) : 0;
25853
+ int cc = (R>>16)&0xff;
25854
+ int nParen = R>>32;
25855
+ int eSemi = (R>>8)&0xff;
25856
+ int eStat = R&0xff;
25857
+ int bSemi = (eFlags & 0x01)!=0;
25858
+ if( cc==0 ){
25859
+ /* no-op */
25860
+ }else if( cc=='-' ){
25861
+ if( (eFlags & 0x04)==0 ) sqlite3_str_appendchar(pOut, 1, '\n');
25862
+ }else if( cc=='/' ){
25863
+ sqlite3_str_append(pOut,"*/",2);
25864
+ }else{
25865
+ sqlite3_str_appendchar(pOut, 1, cc);
25866
+ }
25867
+ if( nParen>0 ){
25868
+ sqlite3_str_appendf(pOut, "%.*c",nParen,')');
25869
+ }
25870
+ if( eStat==SQLITE_OK || eStat==SQLITE_EMPTY ){
25871
+ /* Nothing to add */
25872
+ }else if( eSemi==1 ){
25873
+ if( bSemi ) sqlite3_str_append(pOut, ";", 1);
25874
+ }else if( eSemi==2 ){
25875
+ sqlite3_str_append(pOut, "END;", 3+(bSemi!=0));
25876
+ }else if( eSemi==3 ){
25877
+ sqlite3_str_append(pOut, ";END;", 4+(bSemi!=0));
25878
+ }
25879
+}
25880
+
25881
+/*
25882
+** SQL function: shell_complete_sql(SQL)
25883
+** shell_complete_sql(SQL, FLAGS)
25884
+**
25885
+** For use internally and for debugging and testing only. This function
25886
+** is subject to change or removal in future versions.
25887
+**
25888
+** If the SQL input is a string, return a new string which is the same
25889
+** text with all pending quotes and comments finish, so that the
25890
+** SQL is ready to receive its final semicolon. The optional FLAGS
25891
+** parameter can be an integer where bits mean:
25892
+**
25893
+** 0x01 Include the final semicolon
25894
+** 0x02 Only return the completion text. Omit the original SQL.
25895
+** 0x04 Assume that SQL has a \n at the end.
25896
+**
25897
+** The /C substitution in the CLI prompt is computed using the
25898
+** equivalent of shell_complete_sql(SQL,3);
25899
+*/
25900
+static void shell_complete_sql(
25901
+ sqlite3_context *pCtx,
25902
+ int nVal,
25903
+ sqlite3_value **apVal
25904
+){
25905
+ const char *zSql; /* Input SQL text */
25906
+ sqlite3_str *pOut; /* Completed SQL */
25907
+ int flags;
25908
+
25909
+ if( nVal!=1 && nVal!=2 ) return;
25910
+ if( nVal==2 ){
25911
+ flags = 0x7 & sqlite3_value_int64(apVal[1]);
25912
+ }else{
25913
+ flags = 0;
25914
+ }
25915
+ zSql = (const char*)sqlite3_value_text(apVal[0]);
25916
+ if( zSql==0 ) return;
25917
+ pOut = sqlite3_str_new(sqlite3_context_db_handle(pCtx));
25918
+ if( (flags & 0x02)==0 ) sqlite3_str_appendall(pOut, zSql);
25919
+ appendCompletion(pOut, zSql, flags & 0x05);
25920
+ sqlite3_result_str(pCtx, pOut, SQLITE_FINISH);
25921
+}
2581925922
2582025923
/*
2582125924
** Expand escapes in the given input prompt string. Return the
2582225925
** expanded prompt in memory obtained from sqlite3_malloc(). The
2582325926
** caller is responsible for freeing the memory.
@@ -25991,31 +26094,11 @@
2599126094
}
2599226095
2599326096
if( c=='C' ){
2599426097
/* /C becomes text needed to terminate current input */
2599526098
if( !mOff ){
25996
- sqlite3_int64 R = zPrior ? sqlite3_incomplete(zPrior) : 0;
25997
- int cc = (R>>16)&0xff;
25998
- int nParen = R>>32;
25999
- int eSemi = (R>>8)&0xff;
26000
- if( cc==0 || cc=='-' ){
26001
- /* no-op */
26002
- }else if( cc=='/' ){
26003
- sqlite3_str_append(pOut,"*/",2);
26004
- }else{
26005
- sqlite3_str_appendchar(pOut, 1, cc);
26006
- }
26007
- if( nParen>0 ){
26008
- sqlite3_str_appendf(pOut, "%.*c",nParen,')');
26009
- }
26010
- if( eSemi==1 ){
26011
- sqlite3_str_append(pOut, ";", 1);
26012
- }else if( eSemi==2 ){
26013
- sqlite3_str_append(pOut, "END;", 4);
26014
- }else if( eSemi==3 ){
26015
- sqlite3_str_append(pOut, ";END;", 5);
26016
- }
26099
+ appendCompletion(pOut, zPrior, 0x5);
2601726100
}
2601826101
zPrompt += 2;
2601926102
i = -1;
2602026103
continue;
2602126104
}
@@ -26377,10 +26460,13 @@
2637726460
return s.zTxt;
2637826461
}
2637926462
2638026463
/*
2638126464
** SQL function: strtod(X)
26465
+**
26466
+** For use internally and for debugging and testing only. This function
26467
+** is subject to change or removal in future versions.
2638226468
**
2638326469
** Use the C-library strtod() function to convert string X into a double.
2638426470
** Used for comparing the accuracy of SQLite's internal text-to-float conversion
2638526471
** routines against the C-library.
2638626472
*/
@@ -26395,10 +26481,13 @@
2639526481
sqlite3_result_double(pCtx, strtod(z,0));
2639626482
}
2639726483
2639826484
/*
2639926485
** SQL function: dtostr(X)
26486
+**
26487
+** For use internally and for debugging and testing only. This function
26488
+** is subject to change or removal in future versions.
2640026489
**
2640126490
** Use the C-library printf() function to convert real value X into a string.
2640226491
** Used for comparing the accuracy of SQLite's internal float-to-text conversion
2640326492
** routines against the C-library.
2640426493
*/
@@ -26416,13 +26505,18 @@
2641626505
snprintf(z, sizeof(z)-1, "%#+.*e", n, r);
2641726506
sqlite3_result_text(pCtx, z, -1, SQLITE_TRANSIENT);
2641826507
}
2641926508
2642026509
/*
26421
-** SQL function: shell_add_schema(S,X)
26510
+** SQL function: shell_add_schema(S,X,N)
2642226511
**
26423
-** Add the schema name X to the CREATE statement in S and return the result.
26512
+** For use internally and for debugging and testing only. This function
26513
+** is subject to change or removal in future versions.
26514
+**
26515
+** Add the schema X to the CREATE statement in S for table N and return
26516
+** the result.
26517
+**
2642426518
** Examples:
2642526519
**
2642626520
** CREATE TABLE t1(x) -> CREATE TABLE xyz.t1(x);
2642726521
**
2642826522
** Also works on
@@ -26457,44 +26551,43 @@
2645726551
UNUSED_PARAMETER(nVal);
2645826552
if( zIn!=0 && cli_strncmp(zIn, "CREATE ", 7)==0 ){
2645926553
for(i=0; i<ArraySize(aPrefix); i++){
2646026554
int n = strlen30(aPrefix[i]);
2646126555
if( cli_strncmp(zIn+7, aPrefix[i], n)==0 && zIn[n+7]==' ' ){
26462
- char *z = 0;
26556
+ sqlite3_str *pOut = sqlite3_str_new(db);
2646326557
char *zFake = 0;
2646426558
if( zSchema ){
2646526559
char cQuote = quoteChar(zSchema);
2646626560
if( cQuote && sqlite3_stricmp(zSchema,"temp")!=0 ){
26467
- z = sqlite3_mprintf("%.*s \"%w\".%s", n+7, zIn, zSchema, zIn+n+8);
26561
+ sqlite3_str_appendf(pOut, "%.*s \"%w\".%s", n+7,zIn,zSchema,zIn+n+8);
2646826562
}else{
26469
- z = sqlite3_mprintf("%.*s %s.%s", n+7, zIn, zSchema, zIn+n+8);
26563
+ sqlite3_str_appendf(pOut, "%.*s %s.%s", n+7, zIn, zSchema, zIn+n+8);
2647026564
}
26565
+ }else{
26566
+ sqlite3_str_appendall(pOut, zIn);
2647126567
}
26568
+ appendCompletion(pOut, sqlite3_str_value(pOut), 1);
2647226569
if( zName
2647326570
&& aPrefix[i][0]=='V'
2647426571
&& (zFake = shellFakeSchema(db, zSchema, zName))!=0
2647526572
){
2647626573
assert( strstr(zFake,"*/")==0 );
26477
- if( z==0 ){
26478
- z = sqlite3_mprintf("%s\n/* %s */", zIn, zFake);
26479
- }else{
26480
- z = sqlite3_mprintf("%z\n/* %s */", z, zFake);
26481
- }
26482
- sqlite3_free(zFake);
26483
- }
26484
- if( z ){
26485
- sqlite3_result_text(pCtx, z, -1, sqlite3_free);
26486
- return;
26487
- }
26574
+ sqlite3_str_appendf(pOut, "\n/* %z */", zFake);
26575
+ }
26576
+ sqlite3_result_str(pCtx, pOut, SQLITE_FINISH);
26577
+ return;
2648826578
}
2648926579
}
2649026580
}
2649126581
sqlite3_result_value(pCtx, apVal[0]);
2649226582
}
2649326583
2649426584
/*
2649526585
** SQL function: shell_prompt_test(PROMPT,PRIOR,FILENAME,FLAGS)
26586
+**
26587
+** For use internally and for debugging and testing only. This function
26588
+** is subject to change or removal in future versions.
2649626589
**
2649726590
** Return the shell prompt, with escapes expanded, for testing purposes.
2649826591
** The first argument is the raw (unexpanded) prompt string. Or if the
2649926592
** first argument is NULL, then use whatever prompt string is currently
2650026593
** configured. If the second argument exists and is not NULL, then the
@@ -26977,10 +27070,13 @@
2697727070
fflush(p->pLog);
2697827071
}
2697927072
2698027073
/*
2698127074
** SQL function: shell_putsnl(X)
27075
+**
27076
+** For use internally and for debugging and testing only. This function
27077
+** is subject to change or removal in future versions.
2698227078
**
2698327079
** Write the text X to the screen (or whatever output is being directed)
2698427080
** adding a newline at the end, and then return X.
2698527081
*/
2698627082
static void shellPutsFunc(
@@ -27534,36 +27630,17 @@
2753427630
** If the schema statement in z[] contains a start-of-comment and if
2753527631
** sqlite3_complete() returns false, try to terminate the comment before
2753627632
** printing the result. https://sqlite.org/forum/forumpost/d7be961c5c
2753727633
*/
2753827634
static void printSchemaLine(FILE *out, const char *z, const char *zTail){
27539
- char *zToFree = 0;
2754027635
if( z==0 ) return;
2754127636
if( zTail==0 ) return;
27542
- if( zTail[0]==';' && (strstr(z, "/*")!=0 || strstr(z,"--")!=0) ){
27543
- const char *zOrig = z;
27544
- static const char *azTerm[] = { "", "*/", "\n" };
27545
- int i;
27546
- for(i=0; i<ArraySize(azTerm); i++){
27547
- char *zNew = sqlite3_mprintf("%s%s;", zOrig, azTerm[i]);
27548
- shell_check_oom(zNew);
27549
- if( sqlite3_complete(zNew) ){
27550
- size_t n = strlen(zNew);
27551
- zNew[n-1] = 0;
27552
- zToFree = zNew;
27553
- z = zNew;
27554
- break;
27555
- }
27556
- sqlite3_free(zNew);
27557
- }
27558
- }
2755927637
if( sqlite3_strglob("CREATE TABLE ['\"]*", z)==0 ){
2756027638
cli_printf(out, "CREATE TABLE IF NOT EXISTS %s%s", z+13, zTail);
2756127639
}else{
2756227640
cli_printf(out, "%s%s", z, zTail);
2756327641
}
27564
- sqlite3_free(zToFree);
2756527642
}
2756627643
2756727644
/*
2756827645
** Return true if string z[] has nothing but whitespace and comments to the
2756927646
** end of the first line.
@@ -27579,18 +27656,21 @@
2757927656
return 1;
2758027657
}
2758127658
2758227659
/*
2758327660
** SQL Function: shell_format_schema(SQL,FLAGS)
27661
+**
27662
+** For use internally and for debugging and testing only. This function
27663
+** is subject to change or removal in future versions.
2758427664
**
2758527665
** This function is internally by the CLI to assist with the
2758627666
** ".schema", ".fullschema", and ".dump" commands. The first
2758727667
** argument is the value from sqlite_schema.sql. The value returned
2758827668
** is a modification of the input that can actually be run as SQL
2758927669
** to recreate the schema object.
2759027670
**
27591
-** When FLAGS is zero, the only changes is to append ";". If the
27671
+** When FLAGS is zero, this routine is a no-op. If the
2759227672
** 0x01 bit of FLAGS is set, then transformations are made to implement
2759327673
** ".schema --indent".
2759427674
*/
2759527675
static void shellFormatSchema(
2759627676
sqlite3_context *pCtx,
@@ -27597,11 +27677,10 @@
2759727677
int nVal,
2759827678
sqlite3_value **apVal
2759927679
){
2760027680
int flags; /* Value of 2nd parameter */
2760127681
const char *zSql; /* Value of 1st parameter */
27602
- int nSql; /* Bytes of text in zSql[] */
2760327682
sqlite3_str *pOut; /* Output buffer */
2760427683
char *z; /* Writable copy of zSql */
2760527684
int i, j; /* Loop counters */
2760627685
int nParen = 0;
2760727686
char cEnd = 0;
@@ -27609,27 +27688,27 @@
2760927688
int nLine = 0;
2761027689
int isIndex;
2761127690
int isWhere = 0;
2761227691
2761327692
assert( nVal==2 );
27614
- pOut = sqlite3_str_new(sqlite3_context_db_handle(pCtx));
27615
- nSql = sqlite3_value_bytes(apVal[0]);
27616
- zSql = (const char*)sqlite3_value_text(apVal[0]);
27617
- if( zSql==0 || zSql[0]==0 ) goto shellFormatSchema_finish;
2761827693
flags = sqlite3_value_int(apVal[1]);
2761927694
if( (flags & 0x01)==0 ){
27620
- sqlite3_str_append(pOut, zSql, nSql);
27621
- sqlite3_str_append(pOut, ";", 1);
27622
- goto shellFormatSchema_finish;
27695
+ sqlite3_result_value(pCtx, apVal[0]);
27696
+ return;
27697
+ }
27698
+ zSql = (const char*)sqlite3_value_text(apVal[0]);
27699
+ if( zSql==0 || zSql[0]==0 ){
27700
+ sqlite3_result_text(pCtx, "", 0, SQLITE_STATIC);
27701
+ return;
2762327702
}
2762427703
if( sqlite3_strlike("CREATE VIEW%", zSql, 0)==0
2762527704
|| sqlite3_strlike("CREATE TRIG%", zSql, 0)==0
2762627705
){
27627
- sqlite3_str_append(pOut, zSql, nSql);
27628
- sqlite3_str_append(pOut, ";", 1);
27629
- goto shellFormatSchema_finish;
27706
+ sqlite3_result_value(pCtx, apVal[0]);
27707
+ return;
2763027708
}
27709
+ pOut = sqlite3_str_new(sqlite3_context_db_handle(pCtx));
2763127710
isIndex = sqlite3_strlike("CREATE INDEX%", zSql, 0)==0
2763227711
|| sqlite3_strlike("CREATE UNIQUE INDEX%", zSql, 0)==0;
2763327712
z = sqlite3_mprintf("%s", zSql);
2763427713
if( z==0 ){
2763527714
sqlite3_str_free(pOut);
@@ -27697,14 +27776,11 @@
2769727776
}
2769827777
}
2769927778
z[j] = 0;
2770027779
}
2770127780
sqlite3_str_appendall(pOut, z);
27702
- sqlite3_str_append(pOut, ";", 1);
2770327781
sqlite3_free(z);
27704
-
27705
-shellFormatSchema_finish:
2770627782
sqlite3_result_text(pCtx, sqlite3_str_finish(pOut), -1, sqlite3_free);
2770727783
}
2770827784
2770927785
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
2771027786
/*
@@ -29876,10 +29952,13 @@
2987629952
sqlite3_result_int(context, sleep);
2987729953
}
2987829954
2987929955
/*
2988029956
** SQL function: shell_module_schema(X)
29957
+**
29958
+** For use internally and for debugging and testing only. This function
29959
+** is subject to change or removal in future versions.
2988129960
**
2988229961
** Return a fake schema for the table-valued function or eponymous virtual
2988329962
** table X.
2988429963
*/
2988529964
static void shellModuleSchema(
@@ -30083,10 +30162,14 @@
3008330162
shellModuleSchema, 0, 0);
3008430163
sqlite3_create_function(p->db, "shell_putsnl", 1, SQLITE_UTF8, p,
3008530164
shellPutsFunc, 0, 0);
3008630165
sqlite3_create_function(p->db, "shell_format_schema", 2, SQLITE_UTF8, p,
3008730166
shellFormatSchema, 0, 0);
30167
+ sqlite3_create_function(p->db, "shell_complete_sql", 1, SQLITE_UTF8, p,
30168
+ shell_complete_sql, 0, 0);
30169
+ sqlite3_create_function(p->db, "shell_complete_sql", 2, SQLITE_UTF8, p,
30170
+ shell_complete_sql, 0, 0);
3008830171
sqlite3_create_function(p->db, "usleep",1,SQLITE_UTF8,0,
3008930172
shellUSleepFunc, 0, 0);
3009030173
#ifndef SQLITE_NOHAVE_SYSTEM
3009130174
sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0,
3009230175
editFunc, 0, 0);
@@ -30095,10 +30178,14 @@
3009530178
#endif
3009630179
sqlite3_create_function(p->db, "shell_prompt_test", -1, SQLITE_UTF8,
3009730180
p, shellExpandPrompt, 0, 0);
3009830181
sqlite3_create_function(p->db, "shell_temp_filename", 1, SQLITE_UTF8,
3009930182
p, shellTempFilenameFunc, 0, 0);
30183
+#ifdef SQLITE_DEBUG
30184
+ sqlite3_create_function(p->db, "sqlite3_incomplete", 1, SQLITE_UTF8,
30185
+ p, shellIncompleteFunc, 0, 0);
30186
+#endif
3010030187
3010130188
3010230189
if( p->openMode==SHELL_OPEN_ZIPFILE ){
3010330190
char *zSql = sqlite3_mprintf(
3010430191
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);
@@ -31480,10 +31567,13 @@
3148031567
}
3148131568
3148231569
/*
3148331570
** SQL function: shell_temp_filename(SUFFIX)
3148431571
**
31572
+** For use internally and for debugging and testing only. This function
31573
+** is subject to change or removal in future versions.
31574
+**
3148531575
** Return a randomly generated temporary filename.
3148631576
*/
3148731577
static void shellTempFilenameFunc(
3148831578
sqlite3_context *pCtx,
3148931579
int nVal,
@@ -32651,12 +32741,23 @@
3265132741
** This function is used as a callback by the recover extension. Simply
3265232742
** print the supplied SQL statement to stdout.
3265332743
*/
3265432744
static int recoverSqlCb(void *pCtx, const char *zSql){
3265532745
ShellState *pState = (ShellState*)pCtx;
32656
- cli_printf(pState->out, "%s;\n", zSql);
32657
- return SQLITE_OK;
32746
+ sqlite3_str *pOut = sqlite3_str_new(pState->db);
32747
+ char *zOut;
32748
+ int rc = SQLITE_OK;
32749
+ sqlite3_str_appendall(pOut, zSql);
32750
+ appendCompletion(pOut, zSql, 0);
32751
+ zOut = sqlite3_str_value(pOut);
32752
+ if( zOut ){
32753
+ cli_printf(pState->out, "%s;\n", zOut);
32754
+ }else{
32755
+ rc = SQLITE_NOMEM;
32756
+ }
32757
+ sqlite3_str_free(pOut);
32758
+ return rc;
3265832759
}
3265932760
3266032761
/*
3266132762
** This function is called to recover data from the database. A script
3266232763
** to construct a new database containing all recovered data is output
@@ -35329,21 +35430,21 @@
3532935430
** corrupt. */
3533035431
sqlite3_exec(p->db, "SAVEPOINT dump; PRAGMA writable_schema=ON", 0, 0, 0);
3533135432
p->nErr = 0;
3533235433
if( zLike==0 ) zLike = sqlite3_mprintf("true");
3533335434
zSql = sqlite3_mprintf(
35334
- "SELECT name, type, sql FROM sqlite_schema AS o "
35435
+ "SELECT name, type, shell_complete_sql(sql) FROM sqlite_schema AS o "
3533535436
"WHERE (%s) AND type=='table'"
3533635437
" AND sql NOT NULL"
3533735438
" ORDER BY tbl_name='sqlite_sequence', rowid",
3533835439
zLike
3533935440
);
3534035441
run_schema_dump_query(p,zSql);
3534135442
sqlite3_free(zSql);
3534235443
if( (p->shellFlgs & SHFLG_DumpDataOnly)==0 ){
3534335444
zSql = sqlite3_mprintf(
35344
- "SELECT sql FROM sqlite_schema AS o "
35445
+ "SELECT shell_complete_sql(sql) FROM sqlite_schema AS o "
3534535446
"WHERE (%s) AND sql NOT NULL"
3534635447
" AND type IN ('index','trigger','view') "
3534735448
"ORDER BY type COLLATE NOCASE DESC",
3534835449
zLike
3534935450
);
@@ -35601,11 +35702,11 @@
3560135702
rc = 1;
3560235703
goto meta_command_exit;
3560335704
}
3560435705
open_db(p, 0);
3560535706
zSql = sqlite3_mprintf(
35606
- "SELECT shell_format_schema(sql,%d) FROM"
35707
+ "SELECT shell_format_schema(shell_complete_sql(sql),%d) FROM"
3560735708
" (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
3560835709
" FROM sqlite_schema UNION ALL"
3560935710
" SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_schema) "
3561035711
"WHERE type!='meta' AND sql NOTNULL"
3561135712
" AND name NOT LIKE 'sqlite__%%' ESCAPE '_' "
@@ -35613,11 +35714,11 @@
3561335714
memcpy(&data, p, sizeof(data));
3561435715
data.mode.spec.bTitles = QRF_No;
3561535716
data.mode.eMode = MODE_List;
3561635717
data.mode.spec.eText = QRF_TEXT_Plain;
3561735718
data.mode.spec.nCharLimit = 0;
35618
- data.mode.spec.zRowSep = "\n";
35719
+ data.mode.spec.zRowSep = ";\n";
3561935720
rc = shell_exec(&data,zSql,0);
3562035721
sqlite3_free(zSql);
3562135722
if( rc==SQLITE_OK ){
3562235723
sqlite3_stmt *pStmt;
3562335724
memset(hasStat, 0, sizeof(hasStat));
@@ -36617,11 +36718,11 @@
3661736718
3661836719
rc = 1;
3661936720
goto meta_command_exit;
3662036721
}
3662136722
pSql = sqlite3_str_new(p->db);
36622
- sqlite3_str_appendf(pSql, "SELECT sql FROM", 0);
36723
+ sqlite3_str_appendf(pSql, "SELECT shell_complete_sql(sql,1) FROM", 0);
3662336724
iSchema = 0;
3662436725
while( sqlite3_step(pStmt)==SQLITE_ROW ){
3662536726
const char *zDb = (const char*)sqlite3_column_text(pStmt, 1);
3662636727
char zScNum[30];
3662736728
sqlite3_snprintf(sizeof(zScNum), zScNum, "%d", ++iSchema);
@@ -38092,48 +38193,45 @@
3809238193
return 0;
3809338194
}
3809438195
return 1;
3809538196
}
3809638197
38097
-/*
38098
-** Return TRUE if the line typed in is an SQL command terminator other
38099
-** than a semi-colon. The SQL Server style "go" command is understood
38100
-** as is the Oracle "/".
38101
-*/
38102
-static int line_is_command_terminator(const char *zLine){
38103
- while( IsSpace(zLine[0]) ){ zLine++; };
38104
- if( zLine[0]=='/' && line_is_all_whitespace(&zLine[1]) ){
38105
- return 1; /* Oracle */
38106
- }
38107
- if( ToLower(zLine[0])=='g' && ToLower(zLine[1])=='o'
38108
- && line_is_all_whitespace(&zLine[2]) ){
38109
- return 1; /* SQL Server */
38110
- }
38111
- return 0;
38112
-}
38113
-
3811438198
/*
3811538199
** The CLI needs a working sqlite3_complete() to work properly. So error
3811638200
** out of the build if compiling with SQLITE_OMIT_COMPLETE.
3811738201
*/
3811838202
#ifdef SQLITE_OMIT_COMPLETE
3811938203
# error the CLI application is incompatible with SQLITE_OMIT_COMPLETE.
3812038204
#endif
3812138205
38206
+#ifdef SQLITE_SHELL_LEGACY_COMMAND_TERMINATOR
3812238207
/*
38123
-** Return true if zSql is a complete SQL statement. Return false if it
38124
-** ends in the middle of a string literal or C-style comment.
38208
+** Return TRUE if the line typed in is an SQL command terminator other
38209
+** than a semi-colon. The SQL Server style "go" command is understood
38210
+** as is the Oracle "/".
3812538211
*/
38126
-static int line_is_complete(char *zSql, int nSql){
38127
- int rc;
38128
- if( zSql==0 ) return 1;
38129
- zSql[nSql] = ';';
38130
- zSql[nSql+1] = 0;
38131
- rc = sqlite3_complete(zSql);
38132
- zSql[nSql] = 0;
38133
- return rc;
38134
-}
38212
+static int line_is_command_terminator(
38213
+ const char *zLine, /* Current line of input */
38214
+ char *zSql, /* Total accumulated input text */
38215
+ int nSql /* Bytes of accumulated input text */
38216
+){
38217
+ while( IsSpace(zLine[0]) ){ zLine++; };
38218
+ if( (zLine[0]=='/' && line_is_all_whitespace(&zLine[1])) /* Oracle */
38219
+ || (sqlite3_strnicmp(zLine,"go",2)==0
38220
+ && line_is_all_whitespace(&zLine[2])) /* SQL Server */
38221
+ }{
38222
+ int rc;
38223
+ if( zSql==0 ) return 1;
38224
+ zSql[nSql] = ';';
38225
+ zSql[nSql+1] = 0;
38226
+ rc = sqlite3_complete(zSql);
38227
+ zSql[nSql] = 0;
38228
+ return rc;
38229
+ }
38230
+ return 0;
38231
+}
38232
+#endif
3813538233
3813638234
/*
3813738235
** This function is called after processing each line of SQL in the
3813838236
** runOneSqlLine() function. Its purpose is to detect scenarios where
3813938237
** defensive mode should be automatically turned off. Specifically, when
@@ -38392,13 +38490,15 @@
3839238490
errCnt++;
3839338491
}
3839438492
}
3839538493
continue;
3839638494
}
38397
- if( line_is_command_terminator(zLine) && line_is_complete(zSql, nSql) ){
38495
+#ifdef SQLITE_SHELL_LEGACY_COMMAND_TERMINATOR
38496
+ if( line_is_command_terminator(zLine, zSql, nSql) ){
3839838497
memcpy(zLine,";",2);
3839938498
}
38499
+#endif
3840038500
hasSemi = strchr(zLine,';')!=0;
3840138501
nLine = strlen(zLine);
3840238502
if( nSql+nLine+2>=nAlloc ){
3840338503
/* Grow buffer by half-again increments when big. */
3840438504
nAlloc = nSql+(nSql>>1)+nLine+100;
3840538505
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -20222,10 +20222,11 @@
20222 sqlite3_value **argv
20223 ){
20224 int rc;
20225 sqlite3_stmt *pStmt;
20226 int n;
 
20227 sqlite3_int64 ii;
20228 sqlite3_int64 pgsz;
20229 sqlite3_int64 nPage;
20230 sqlite3_int64 nPageInUse;
20231 sqlite3_int64 nFreeList;
@@ -20545,13 +20546,15 @@
20545 */
20546 diskusedTitle(&s, "Raw data used to generate this report");
20547 sqlite3_str_appendf(s.pOut,
20548 "The following SQL will create a table named \"space_used\" which\n"
20549 "contains most of the information used to generate the report above.\n"
20550 "*/\n"
20551 );
 
 
20552 sqlite3_str_appendf(s.pOut,
 
20553 "BEGIN;\n"
20554 "CREATE TABLE space_used(\n"
20555 " name text, -- A table or index\n" /* 0 */
20556 " tblname text, -- Table that owns name\n" /* 1 */
20557 " is_index boolean, -- TRUE if it is an index\n" /* 2 */
@@ -25713,11 +25716,28 @@
25713 }
25714 return "";
25715 }
25716 #endif /* !defined(SQLITE_PS_APPDEF) */
25717
25718
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25719
25720 /*
25721 ** Return the raw (unexpanded) prompt string. This will be the
25722 ** first of the following that exist:
25723 **
@@ -25814,10 +25834,93 @@
25814 if( z[k]<0x40 || z[k]>0x7e ) break;
25815 i = k+1;
25816 }
25817 return i;
25818 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25819
25820 /*
25821 ** Expand escapes in the given input prompt string. Return the
25822 ** expanded prompt in memory obtained from sqlite3_malloc(). The
25823 ** caller is responsible for freeing the memory.
@@ -25991,31 +26094,11 @@
25991 }
25992
25993 if( c=='C' ){
25994 /* /C becomes text needed to terminate current input */
25995 if( !mOff ){
25996 sqlite3_int64 R = zPrior ? sqlite3_incomplete(zPrior) : 0;
25997 int cc = (R>>16)&0xff;
25998 int nParen = R>>32;
25999 int eSemi = (R>>8)&0xff;
26000 if( cc==0 || cc=='-' ){
26001 /* no-op */
26002 }else if( cc=='/' ){
26003 sqlite3_str_append(pOut,"*/",2);
26004 }else{
26005 sqlite3_str_appendchar(pOut, 1, cc);
26006 }
26007 if( nParen>0 ){
26008 sqlite3_str_appendf(pOut, "%.*c",nParen,')');
26009 }
26010 if( eSemi==1 ){
26011 sqlite3_str_append(pOut, ";", 1);
26012 }else if( eSemi==2 ){
26013 sqlite3_str_append(pOut, "END;", 4);
26014 }else if( eSemi==3 ){
26015 sqlite3_str_append(pOut, ";END;", 5);
26016 }
26017 }
26018 zPrompt += 2;
26019 i = -1;
26020 continue;
26021 }
@@ -26377,10 +26460,13 @@
26377 return s.zTxt;
26378 }
26379
26380 /*
26381 ** SQL function: strtod(X)
 
 
 
26382 **
26383 ** Use the C-library strtod() function to convert string X into a double.
26384 ** Used for comparing the accuracy of SQLite's internal text-to-float conversion
26385 ** routines against the C-library.
26386 */
@@ -26395,10 +26481,13 @@
26395 sqlite3_result_double(pCtx, strtod(z,0));
26396 }
26397
26398 /*
26399 ** SQL function: dtostr(X)
 
 
 
26400 **
26401 ** Use the C-library printf() function to convert real value X into a string.
26402 ** Used for comparing the accuracy of SQLite's internal float-to-text conversion
26403 ** routines against the C-library.
26404 */
@@ -26416,13 +26505,18 @@
26416 snprintf(z, sizeof(z)-1, "%#+.*e", n, r);
26417 sqlite3_result_text(pCtx, z, -1, SQLITE_TRANSIENT);
26418 }
26419
26420 /*
26421 ** SQL function: shell_add_schema(S,X)
26422 **
26423 ** Add the schema name X to the CREATE statement in S and return the result.
 
 
 
 
 
26424 ** Examples:
26425 **
26426 ** CREATE TABLE t1(x) -> CREATE TABLE xyz.t1(x);
26427 **
26428 ** Also works on
@@ -26457,44 +26551,43 @@
26457 UNUSED_PARAMETER(nVal);
26458 if( zIn!=0 && cli_strncmp(zIn, "CREATE ", 7)==0 ){
26459 for(i=0; i<ArraySize(aPrefix); i++){
26460 int n = strlen30(aPrefix[i]);
26461 if( cli_strncmp(zIn+7, aPrefix[i], n)==0 && zIn[n+7]==' ' ){
26462 char *z = 0;
26463 char *zFake = 0;
26464 if( zSchema ){
26465 char cQuote = quoteChar(zSchema);
26466 if( cQuote && sqlite3_stricmp(zSchema,"temp")!=0 ){
26467 z = sqlite3_mprintf("%.*s \"%w\".%s", n+7, zIn, zSchema, zIn+n+8);
26468 }else{
26469 z = sqlite3_mprintf("%.*s %s.%s", n+7, zIn, zSchema, zIn+n+8);
26470 }
 
 
26471 }
 
26472 if( zName
26473 && aPrefix[i][0]=='V'
26474 && (zFake = shellFakeSchema(db, zSchema, zName))!=0
26475 ){
26476 assert( strstr(zFake,"*/")==0 );
26477 if( z==0 ){
26478 z = sqlite3_mprintf("%s\n/* %s */", zIn, zFake);
26479 }else{
26480 z = sqlite3_mprintf("%z\n/* %s */", z, zFake);
26481 }
26482 sqlite3_free(zFake);
26483 }
26484 if( z ){
26485 sqlite3_result_text(pCtx, z, -1, sqlite3_free);
26486 return;
26487 }
26488 }
26489 }
26490 }
26491 sqlite3_result_value(pCtx, apVal[0]);
26492 }
26493
26494 /*
26495 ** SQL function: shell_prompt_test(PROMPT,PRIOR,FILENAME,FLAGS)
 
 
 
26496 **
26497 ** Return the shell prompt, with escapes expanded, for testing purposes.
26498 ** The first argument is the raw (unexpanded) prompt string. Or if the
26499 ** first argument is NULL, then use whatever prompt string is currently
26500 ** configured. If the second argument exists and is not NULL, then the
@@ -26977,10 +27070,13 @@
26977 fflush(p->pLog);
26978 }
26979
26980 /*
26981 ** SQL function: shell_putsnl(X)
 
 
 
26982 **
26983 ** Write the text X to the screen (or whatever output is being directed)
26984 ** adding a newline at the end, and then return X.
26985 */
26986 static void shellPutsFunc(
@@ -27534,36 +27630,17 @@
27534 ** If the schema statement in z[] contains a start-of-comment and if
27535 ** sqlite3_complete() returns false, try to terminate the comment before
27536 ** printing the result. https://sqlite.org/forum/forumpost/d7be961c5c
27537 */
27538 static void printSchemaLine(FILE *out, const char *z, const char *zTail){
27539 char *zToFree = 0;
27540 if( z==0 ) return;
27541 if( zTail==0 ) return;
27542 if( zTail[0]==';' && (strstr(z, "/*")!=0 || strstr(z,"--")!=0) ){
27543 const char *zOrig = z;
27544 static const char *azTerm[] = { "", "*/", "\n" };
27545 int i;
27546 for(i=0; i<ArraySize(azTerm); i++){
27547 char *zNew = sqlite3_mprintf("%s%s;", zOrig, azTerm[i]);
27548 shell_check_oom(zNew);
27549 if( sqlite3_complete(zNew) ){
27550 size_t n = strlen(zNew);
27551 zNew[n-1] = 0;
27552 zToFree = zNew;
27553 z = zNew;
27554 break;
27555 }
27556 sqlite3_free(zNew);
27557 }
27558 }
27559 if( sqlite3_strglob("CREATE TABLE ['\"]*", z)==0 ){
27560 cli_printf(out, "CREATE TABLE IF NOT EXISTS %s%s", z+13, zTail);
27561 }else{
27562 cli_printf(out, "%s%s", z, zTail);
27563 }
27564 sqlite3_free(zToFree);
27565 }
27566
27567 /*
27568 ** Return true if string z[] has nothing but whitespace and comments to the
27569 ** end of the first line.
@@ -27579,18 +27656,21 @@
27579 return 1;
27580 }
27581
27582 /*
27583 ** SQL Function: shell_format_schema(SQL,FLAGS)
 
 
 
27584 **
27585 ** This function is internally by the CLI to assist with the
27586 ** ".schema", ".fullschema", and ".dump" commands. The first
27587 ** argument is the value from sqlite_schema.sql. The value returned
27588 ** is a modification of the input that can actually be run as SQL
27589 ** to recreate the schema object.
27590 **
27591 ** When FLAGS is zero, the only changes is to append ";". If the
27592 ** 0x01 bit of FLAGS is set, then transformations are made to implement
27593 ** ".schema --indent".
27594 */
27595 static void shellFormatSchema(
27596 sqlite3_context *pCtx,
@@ -27597,11 +27677,10 @@
27597 int nVal,
27598 sqlite3_value **apVal
27599 ){
27600 int flags; /* Value of 2nd parameter */
27601 const char *zSql; /* Value of 1st parameter */
27602 int nSql; /* Bytes of text in zSql[] */
27603 sqlite3_str *pOut; /* Output buffer */
27604 char *z; /* Writable copy of zSql */
27605 int i, j; /* Loop counters */
27606 int nParen = 0;
27607 char cEnd = 0;
@@ -27609,27 +27688,27 @@
27609 int nLine = 0;
27610 int isIndex;
27611 int isWhere = 0;
27612
27613 assert( nVal==2 );
27614 pOut = sqlite3_str_new(sqlite3_context_db_handle(pCtx));
27615 nSql = sqlite3_value_bytes(apVal[0]);
27616 zSql = (const char*)sqlite3_value_text(apVal[0]);
27617 if( zSql==0 || zSql[0]==0 ) goto shellFormatSchema_finish;
27618 flags = sqlite3_value_int(apVal[1]);
27619 if( (flags & 0x01)==0 ){
27620 sqlite3_str_append(pOut, zSql, nSql);
27621 sqlite3_str_append(pOut, ";", 1);
27622 goto shellFormatSchema_finish;
 
 
 
 
27623 }
27624 if( sqlite3_strlike("CREATE VIEW%", zSql, 0)==0
27625 || sqlite3_strlike("CREATE TRIG%", zSql, 0)==0
27626 ){
27627 sqlite3_str_append(pOut, zSql, nSql);
27628 sqlite3_str_append(pOut, ";", 1);
27629 goto shellFormatSchema_finish;
27630 }
 
27631 isIndex = sqlite3_strlike("CREATE INDEX%", zSql, 0)==0
27632 || sqlite3_strlike("CREATE UNIQUE INDEX%", zSql, 0)==0;
27633 z = sqlite3_mprintf("%s", zSql);
27634 if( z==0 ){
27635 sqlite3_str_free(pOut);
@@ -27697,14 +27776,11 @@
27697 }
27698 }
27699 z[j] = 0;
27700 }
27701 sqlite3_str_appendall(pOut, z);
27702 sqlite3_str_append(pOut, ";", 1);
27703 sqlite3_free(z);
27704
27705 shellFormatSchema_finish:
27706 sqlite3_result_text(pCtx, sqlite3_str_finish(pOut), -1, sqlite3_free);
27707 }
27708
27709 #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
27710 /*
@@ -29876,10 +29952,13 @@
29876 sqlite3_result_int(context, sleep);
29877 }
29878
29879 /*
29880 ** SQL function: shell_module_schema(X)
 
 
 
29881 **
29882 ** Return a fake schema for the table-valued function or eponymous virtual
29883 ** table X.
29884 */
29885 static void shellModuleSchema(
@@ -30083,10 +30162,14 @@
30083 shellModuleSchema, 0, 0);
30084 sqlite3_create_function(p->db, "shell_putsnl", 1, SQLITE_UTF8, p,
30085 shellPutsFunc, 0, 0);
30086 sqlite3_create_function(p->db, "shell_format_schema", 2, SQLITE_UTF8, p,
30087 shellFormatSchema, 0, 0);
 
 
 
 
30088 sqlite3_create_function(p->db, "usleep",1,SQLITE_UTF8,0,
30089 shellUSleepFunc, 0, 0);
30090 #ifndef SQLITE_NOHAVE_SYSTEM
30091 sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0,
30092 editFunc, 0, 0);
@@ -30095,10 +30178,14 @@
30095 #endif
30096 sqlite3_create_function(p->db, "shell_prompt_test", -1, SQLITE_UTF8,
30097 p, shellExpandPrompt, 0, 0);
30098 sqlite3_create_function(p->db, "shell_temp_filename", 1, SQLITE_UTF8,
30099 p, shellTempFilenameFunc, 0, 0);
 
 
 
 
30100
30101
30102 if( p->openMode==SHELL_OPEN_ZIPFILE ){
30103 char *zSql = sqlite3_mprintf(
30104 "CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);
@@ -31480,10 +31567,13 @@
31480 }
31481
31482 /*
31483 ** SQL function: shell_temp_filename(SUFFIX)
31484 **
 
 
 
31485 ** Return a randomly generated temporary filename.
31486 */
31487 static void shellTempFilenameFunc(
31488 sqlite3_context *pCtx,
31489 int nVal,
@@ -32651,12 +32741,23 @@
32651 ** This function is used as a callback by the recover extension. Simply
32652 ** print the supplied SQL statement to stdout.
32653 */
32654 static int recoverSqlCb(void *pCtx, const char *zSql){
32655 ShellState *pState = (ShellState*)pCtx;
32656 cli_printf(pState->out, "%s;\n", zSql);
32657 return SQLITE_OK;
 
 
 
 
 
 
 
 
 
 
 
32658 }
32659
32660 /*
32661 ** This function is called to recover data from the database. A script
32662 ** to construct a new database containing all recovered data is output
@@ -35329,21 +35430,21 @@
35329 ** corrupt. */
35330 sqlite3_exec(p->db, "SAVEPOINT dump; PRAGMA writable_schema=ON", 0, 0, 0);
35331 p->nErr = 0;
35332 if( zLike==0 ) zLike = sqlite3_mprintf("true");
35333 zSql = sqlite3_mprintf(
35334 "SELECT name, type, sql FROM sqlite_schema AS o "
35335 "WHERE (%s) AND type=='table'"
35336 " AND sql NOT NULL"
35337 " ORDER BY tbl_name='sqlite_sequence', rowid",
35338 zLike
35339 );
35340 run_schema_dump_query(p,zSql);
35341 sqlite3_free(zSql);
35342 if( (p->shellFlgs & SHFLG_DumpDataOnly)==0 ){
35343 zSql = sqlite3_mprintf(
35344 "SELECT sql FROM sqlite_schema AS o "
35345 "WHERE (%s) AND sql NOT NULL"
35346 " AND type IN ('index','trigger','view') "
35347 "ORDER BY type COLLATE NOCASE DESC",
35348 zLike
35349 );
@@ -35601,11 +35702,11 @@
35601 rc = 1;
35602 goto meta_command_exit;
35603 }
35604 open_db(p, 0);
35605 zSql = sqlite3_mprintf(
35606 "SELECT shell_format_schema(sql,%d) FROM"
35607 " (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
35608 " FROM sqlite_schema UNION ALL"
35609 " SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_schema) "
35610 "WHERE type!='meta' AND sql NOTNULL"
35611 " AND name NOT LIKE 'sqlite__%%' ESCAPE '_' "
@@ -35613,11 +35714,11 @@
35613 memcpy(&data, p, sizeof(data));
35614 data.mode.spec.bTitles = QRF_No;
35615 data.mode.eMode = MODE_List;
35616 data.mode.spec.eText = QRF_TEXT_Plain;
35617 data.mode.spec.nCharLimit = 0;
35618 data.mode.spec.zRowSep = "\n";
35619 rc = shell_exec(&data,zSql,0);
35620 sqlite3_free(zSql);
35621 if( rc==SQLITE_OK ){
35622 sqlite3_stmt *pStmt;
35623 memset(hasStat, 0, sizeof(hasStat));
@@ -36617,11 +36718,11 @@
36617
36618 rc = 1;
36619 goto meta_command_exit;
36620 }
36621 pSql = sqlite3_str_new(p->db);
36622 sqlite3_str_appendf(pSql, "SELECT sql FROM", 0);
36623 iSchema = 0;
36624 while( sqlite3_step(pStmt)==SQLITE_ROW ){
36625 const char *zDb = (const char*)sqlite3_column_text(pStmt, 1);
36626 char zScNum[30];
36627 sqlite3_snprintf(sizeof(zScNum), zScNum, "%d", ++iSchema);
@@ -38092,48 +38193,45 @@
38092 return 0;
38093 }
38094 return 1;
38095 }
38096
38097 /*
38098 ** Return TRUE if the line typed in is an SQL command terminator other
38099 ** than a semi-colon. The SQL Server style "go" command is understood
38100 ** as is the Oracle "/".
38101 */
38102 static int line_is_command_terminator(const char *zLine){
38103 while( IsSpace(zLine[0]) ){ zLine++; };
38104 if( zLine[0]=='/' && line_is_all_whitespace(&zLine[1]) ){
38105 return 1; /* Oracle */
38106 }
38107 if( ToLower(zLine[0])=='g' && ToLower(zLine[1])=='o'
38108 && line_is_all_whitespace(&zLine[2]) ){
38109 return 1; /* SQL Server */
38110 }
38111 return 0;
38112 }
38113
38114 /*
38115 ** The CLI needs a working sqlite3_complete() to work properly. So error
38116 ** out of the build if compiling with SQLITE_OMIT_COMPLETE.
38117 */
38118 #ifdef SQLITE_OMIT_COMPLETE
38119 # error the CLI application is incompatible with SQLITE_OMIT_COMPLETE.
38120 #endif
38121
 
38122 /*
38123 ** Return true if zSql is a complete SQL statement. Return false if it
38124 ** ends in the middle of a string literal or C-style comment.
 
38125 */
38126 static int line_is_complete(char *zSql, int nSql){
38127 int rc;
38128 if( zSql==0 ) return 1;
38129 zSql[nSql] = ';';
38130 zSql[nSql+1] = 0;
38131 rc = sqlite3_complete(zSql);
38132 zSql[nSql] = 0;
38133 return rc;
38134 }
 
 
 
 
 
 
 
 
 
 
 
 
38135
38136 /*
38137 ** This function is called after processing each line of SQL in the
38138 ** runOneSqlLine() function. Its purpose is to detect scenarios where
38139 ** defensive mode should be automatically turned off. Specifically, when
@@ -38392,13 +38490,15 @@
38392 errCnt++;
38393 }
38394 }
38395 continue;
38396 }
38397 if( line_is_command_terminator(zLine) && line_is_complete(zSql, nSql) ){
 
38398 memcpy(zLine,";",2);
38399 }
 
38400 hasSemi = strchr(zLine,';')!=0;
38401 nLine = strlen(zLine);
38402 if( nSql+nLine+2>=nAlloc ){
38403 /* Grow buffer by half-again increments when big. */
38404 nAlloc = nSql+(nSql>>1)+nLine+100;
38405
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -20222,10 +20222,11 @@
20222 sqlite3_value **argv
20223 ){
20224 int rc;
20225 sqlite3_stmt *pStmt;
20226 int n;
20227 char *z;
20228 sqlite3_int64 ii;
20229 sqlite3_int64 pgsz;
20230 sqlite3_int64 nPage;
20231 sqlite3_int64 nPageInUse;
20232 sqlite3_int64 nFreeList;
@@ -20545,13 +20546,15 @@
20546 */
20547 diskusedTitle(&s, "Raw data used to generate this report");
20548 sqlite3_str_appendf(s.pOut,
20549 "The following SQL will create a table named \"space_used\" which\n"
20550 "contains most of the information used to generate the report above.\n"
 
20551 );
20552 z = sqlite3_str_value(s.pOut);
20553 while( z && (z = strstr(z,"*/"))!=0 ){ z[0] = '+'; }
20554 sqlite3_str_appendf(s.pOut,
20555 "*/\n"
20556 "BEGIN;\n"
20557 "CREATE TABLE space_used(\n"
20558 " name text, -- A table or index\n" /* 0 */
20559 " tblname text, -- Table that owns name\n" /* 1 */
20560 " is_index boolean, -- TRUE if it is an index\n" /* 2 */
@@ -25713,11 +25716,28 @@
25716 }
25717 return "";
25718 }
25719 #endif /* !defined(SQLITE_PS_APPDEF) */
25720
25721 #ifdef SQLITE_DEBUG
25722 /*
25723 ** SQL function: sqlite3_incomplete(TEXT)
25724 **
25725 ** For use internally and for debugging and testing only. This function
25726 ** is subject to change or removal in future versions.
25727 **
25728 ** Invoke the sqlite3_incomplete() interface and return its result.
25729 */
25730 static void shellIncompleteFunc(
25731 sqlite3_context *pCtx,
25732 int nVal,
25733 sqlite3_value **apVal
25734 ){
25735 const char *zSql = (const char*)sqlite3_value_text(apVal[0]);
25736 sqlite3_result_int64(pCtx, zSql?sqlite3_incomplete(zSql):SQLITE_MISUSE);
25737 }
25738 #endif /* SQLITE_DEBUG */
25739
25740 /*
25741 ** Return the raw (unexpanded) prompt string. This will be the
25742 ** first of the following that exist:
25743 **
@@ -25814,10 +25834,93 @@
25834 if( z[k]<0x40 || z[k]>0x7e ) break;
25835 i = k+1;
25836 }
25837 return i;
25838 }
25839
25840 /*
25841 ** Append text on pOut that is sufficient to complete the statement zBase
25842 ** (according to sqlite3_complete()). eFlags:
25843 **
25844 ** 0x01 Include the final ";" if needed
25845 ** 0x04 Assume zBase ends with '\n'
25846 */
25847 static void appendCompletion(
25848 sqlite3_str *pOut, /* Append the completion here */
25849 const char *zBase, /* Existing SQL text */
25850 int eFlags /* 0x01: Include ";", 0x04: Assume '\n' */
25851 ){
25852 sqlite3_int64 R = zBase ? sqlite3_incomplete(zBase) : 0;
25853 int cc = (R>>16)&0xff;
25854 int nParen = R>>32;
25855 int eSemi = (R>>8)&0xff;
25856 int eStat = R&0xff;
25857 int bSemi = (eFlags & 0x01)!=0;
25858 if( cc==0 ){
25859 /* no-op */
25860 }else if( cc=='-' ){
25861 if( (eFlags & 0x04)==0 ) sqlite3_str_appendchar(pOut, 1, '\n');
25862 }else if( cc=='/' ){
25863 sqlite3_str_append(pOut,"*/",2);
25864 }else{
25865 sqlite3_str_appendchar(pOut, 1, cc);
25866 }
25867 if( nParen>0 ){
25868 sqlite3_str_appendf(pOut, "%.*c",nParen,')');
25869 }
25870 if( eStat==SQLITE_OK || eStat==SQLITE_EMPTY ){
25871 /* Nothing to add */
25872 }else if( eSemi==1 ){
25873 if( bSemi ) sqlite3_str_append(pOut, ";", 1);
25874 }else if( eSemi==2 ){
25875 sqlite3_str_append(pOut, "END;", 3+(bSemi!=0));
25876 }else if( eSemi==3 ){
25877 sqlite3_str_append(pOut, ";END;", 4+(bSemi!=0));
25878 }
25879 }
25880
25881 /*
25882 ** SQL function: shell_complete_sql(SQL)
25883 ** shell_complete_sql(SQL, FLAGS)
25884 **
25885 ** For use internally and for debugging and testing only. This function
25886 ** is subject to change or removal in future versions.
25887 **
25888 ** If the SQL input is a string, return a new string which is the same
25889 ** text with all pending quotes and comments finish, so that the
25890 ** SQL is ready to receive its final semicolon. The optional FLAGS
25891 ** parameter can be an integer where bits mean:
25892 **
25893 ** 0x01 Include the final semicolon
25894 ** 0x02 Only return the completion text. Omit the original SQL.
25895 ** 0x04 Assume that SQL has a \n at the end.
25896 **
25897 ** The /C substitution in the CLI prompt is computed using the
25898 ** equivalent of shell_complete_sql(SQL,3);
25899 */
25900 static void shell_complete_sql(
25901 sqlite3_context *pCtx,
25902 int nVal,
25903 sqlite3_value **apVal
25904 ){
25905 const char *zSql; /* Input SQL text */
25906 sqlite3_str *pOut; /* Completed SQL */
25907 int flags;
25908
25909 if( nVal!=1 && nVal!=2 ) return;
25910 if( nVal==2 ){
25911 flags = 0x7 & sqlite3_value_int64(apVal[1]);
25912 }else{
25913 flags = 0;
25914 }
25915 zSql = (const char*)sqlite3_value_text(apVal[0]);
25916 if( zSql==0 ) return;
25917 pOut = sqlite3_str_new(sqlite3_context_db_handle(pCtx));
25918 if( (flags & 0x02)==0 ) sqlite3_str_appendall(pOut, zSql);
25919 appendCompletion(pOut, zSql, flags & 0x05);
25920 sqlite3_result_str(pCtx, pOut, SQLITE_FINISH);
25921 }
25922
25923 /*
25924 ** Expand escapes in the given input prompt string. Return the
25925 ** expanded prompt in memory obtained from sqlite3_malloc(). The
25926 ** caller is responsible for freeing the memory.
@@ -25991,31 +26094,11 @@
26094 }
26095
26096 if( c=='C' ){
26097 /* /C becomes text needed to terminate current input */
26098 if( !mOff ){
26099 appendCompletion(pOut, zPrior, 0x5);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26100 }
26101 zPrompt += 2;
26102 i = -1;
26103 continue;
26104 }
@@ -26377,10 +26460,13 @@
26460 return s.zTxt;
26461 }
26462
26463 /*
26464 ** SQL function: strtod(X)
26465 **
26466 ** For use internally and for debugging and testing only. This function
26467 ** is subject to change or removal in future versions.
26468 **
26469 ** Use the C-library strtod() function to convert string X into a double.
26470 ** Used for comparing the accuracy of SQLite's internal text-to-float conversion
26471 ** routines against the C-library.
26472 */
@@ -26395,10 +26481,13 @@
26481 sqlite3_result_double(pCtx, strtod(z,0));
26482 }
26483
26484 /*
26485 ** SQL function: dtostr(X)
26486 **
26487 ** For use internally and for debugging and testing only. This function
26488 ** is subject to change or removal in future versions.
26489 **
26490 ** Use the C-library printf() function to convert real value X into a string.
26491 ** Used for comparing the accuracy of SQLite's internal float-to-text conversion
26492 ** routines against the C-library.
26493 */
@@ -26416,13 +26505,18 @@
26505 snprintf(z, sizeof(z)-1, "%#+.*e", n, r);
26506 sqlite3_result_text(pCtx, z, -1, SQLITE_TRANSIENT);
26507 }
26508
26509 /*
26510 ** SQL function: shell_add_schema(S,X,N)
26511 **
26512 ** For use internally and for debugging and testing only. This function
26513 ** is subject to change or removal in future versions.
26514 **
26515 ** Add the schema X to the CREATE statement in S for table N and return
26516 ** the result.
26517 **
26518 ** Examples:
26519 **
26520 ** CREATE TABLE t1(x) -> CREATE TABLE xyz.t1(x);
26521 **
26522 ** Also works on
@@ -26457,44 +26551,43 @@
26551 UNUSED_PARAMETER(nVal);
26552 if( zIn!=0 && cli_strncmp(zIn, "CREATE ", 7)==0 ){
26553 for(i=0; i<ArraySize(aPrefix); i++){
26554 int n = strlen30(aPrefix[i]);
26555 if( cli_strncmp(zIn+7, aPrefix[i], n)==0 && zIn[n+7]==' ' ){
26556 sqlite3_str *pOut = sqlite3_str_new(db);
26557 char *zFake = 0;
26558 if( zSchema ){
26559 char cQuote = quoteChar(zSchema);
26560 if( cQuote && sqlite3_stricmp(zSchema,"temp")!=0 ){
26561 sqlite3_str_appendf(pOut, "%.*s \"%w\".%s", n+7,zIn,zSchema,zIn+n+8);
26562 }else{
26563 sqlite3_str_appendf(pOut, "%.*s %s.%s", n+7, zIn, zSchema, zIn+n+8);
26564 }
26565 }else{
26566 sqlite3_str_appendall(pOut, zIn);
26567 }
26568 appendCompletion(pOut, sqlite3_str_value(pOut), 1);
26569 if( zName
26570 && aPrefix[i][0]=='V'
26571 && (zFake = shellFakeSchema(db, zSchema, zName))!=0
26572 ){
26573 assert( strstr(zFake,"*/")==0 );
26574 sqlite3_str_appendf(pOut, "\n/* %z */", zFake);
26575 }
26576 sqlite3_result_str(pCtx, pOut, SQLITE_FINISH);
26577 return;
 
 
 
 
 
 
 
26578 }
26579 }
26580 }
26581 sqlite3_result_value(pCtx, apVal[0]);
26582 }
26583
26584 /*
26585 ** SQL function: shell_prompt_test(PROMPT,PRIOR,FILENAME,FLAGS)
26586 **
26587 ** For use internally and for debugging and testing only. This function
26588 ** is subject to change or removal in future versions.
26589 **
26590 ** Return the shell prompt, with escapes expanded, for testing purposes.
26591 ** The first argument is the raw (unexpanded) prompt string. Or if the
26592 ** first argument is NULL, then use whatever prompt string is currently
26593 ** configured. If the second argument exists and is not NULL, then the
@@ -26977,10 +27070,13 @@
27070 fflush(p->pLog);
27071 }
27072
27073 /*
27074 ** SQL function: shell_putsnl(X)
27075 **
27076 ** For use internally and for debugging and testing only. This function
27077 ** is subject to change or removal in future versions.
27078 **
27079 ** Write the text X to the screen (or whatever output is being directed)
27080 ** adding a newline at the end, and then return X.
27081 */
27082 static void shellPutsFunc(
@@ -27534,36 +27630,17 @@
27630 ** If the schema statement in z[] contains a start-of-comment and if
27631 ** sqlite3_complete() returns false, try to terminate the comment before
27632 ** printing the result. https://sqlite.org/forum/forumpost/d7be961c5c
27633 */
27634 static void printSchemaLine(FILE *out, const char *z, const char *zTail){
 
27635 if( z==0 ) return;
27636 if( zTail==0 ) return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27637 if( sqlite3_strglob("CREATE TABLE ['\"]*", z)==0 ){
27638 cli_printf(out, "CREATE TABLE IF NOT EXISTS %s%s", z+13, zTail);
27639 }else{
27640 cli_printf(out, "%s%s", z, zTail);
27641 }
 
27642 }
27643
27644 /*
27645 ** Return true if string z[] has nothing but whitespace and comments to the
27646 ** end of the first line.
@@ -27579,18 +27656,21 @@
27656 return 1;
27657 }
27658
27659 /*
27660 ** SQL Function: shell_format_schema(SQL,FLAGS)
27661 **
27662 ** For use internally and for debugging and testing only. This function
27663 ** is subject to change or removal in future versions.
27664 **
27665 ** This function is internally by the CLI to assist with the
27666 ** ".schema", ".fullschema", and ".dump" commands. The first
27667 ** argument is the value from sqlite_schema.sql. The value returned
27668 ** is a modification of the input that can actually be run as SQL
27669 ** to recreate the schema object.
27670 **
27671 ** When FLAGS is zero, this routine is a no-op. If the
27672 ** 0x01 bit of FLAGS is set, then transformations are made to implement
27673 ** ".schema --indent".
27674 */
27675 static void shellFormatSchema(
27676 sqlite3_context *pCtx,
@@ -27597,11 +27677,10 @@
27677 int nVal,
27678 sqlite3_value **apVal
27679 ){
27680 int flags; /* Value of 2nd parameter */
27681 const char *zSql; /* Value of 1st parameter */
 
27682 sqlite3_str *pOut; /* Output buffer */
27683 char *z; /* Writable copy of zSql */
27684 int i, j; /* Loop counters */
27685 int nParen = 0;
27686 char cEnd = 0;
@@ -27609,27 +27688,27 @@
27688 int nLine = 0;
27689 int isIndex;
27690 int isWhere = 0;
27691
27692 assert( nVal==2 );
 
 
 
 
27693 flags = sqlite3_value_int(apVal[1]);
27694 if( (flags & 0x01)==0 ){
27695 sqlite3_result_value(pCtx, apVal[0]);
27696 return;
27697 }
27698 zSql = (const char*)sqlite3_value_text(apVal[0]);
27699 if( zSql==0 || zSql[0]==0 ){
27700 sqlite3_result_text(pCtx, "", 0, SQLITE_STATIC);
27701 return;
27702 }
27703 if( sqlite3_strlike("CREATE VIEW%", zSql, 0)==0
27704 || sqlite3_strlike("CREATE TRIG%", zSql, 0)==0
27705 ){
27706 sqlite3_result_value(pCtx, apVal[0]);
27707 return;
 
27708 }
27709 pOut = sqlite3_str_new(sqlite3_context_db_handle(pCtx));
27710 isIndex = sqlite3_strlike("CREATE INDEX%", zSql, 0)==0
27711 || sqlite3_strlike("CREATE UNIQUE INDEX%", zSql, 0)==0;
27712 z = sqlite3_mprintf("%s", zSql);
27713 if( z==0 ){
27714 sqlite3_str_free(pOut);
@@ -27697,14 +27776,11 @@
27776 }
27777 }
27778 z[j] = 0;
27779 }
27780 sqlite3_str_appendall(pOut, z);
 
27781 sqlite3_free(z);
 
 
27782 sqlite3_result_text(pCtx, sqlite3_str_finish(pOut), -1, sqlite3_free);
27783 }
27784
27785 #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
27786 /*
@@ -29876,10 +29952,13 @@
29952 sqlite3_result_int(context, sleep);
29953 }
29954
29955 /*
29956 ** SQL function: shell_module_schema(X)
29957 **
29958 ** For use internally and for debugging and testing only. This function
29959 ** is subject to change or removal in future versions.
29960 **
29961 ** Return a fake schema for the table-valued function or eponymous virtual
29962 ** table X.
29963 */
29964 static void shellModuleSchema(
@@ -30083,10 +30162,14 @@
30162 shellModuleSchema, 0, 0);
30163 sqlite3_create_function(p->db, "shell_putsnl", 1, SQLITE_UTF8, p,
30164 shellPutsFunc, 0, 0);
30165 sqlite3_create_function(p->db, "shell_format_schema", 2, SQLITE_UTF8, p,
30166 shellFormatSchema, 0, 0);
30167 sqlite3_create_function(p->db, "shell_complete_sql", 1, SQLITE_UTF8, p,
30168 shell_complete_sql, 0, 0);
30169 sqlite3_create_function(p->db, "shell_complete_sql", 2, SQLITE_UTF8, p,
30170 shell_complete_sql, 0, 0);
30171 sqlite3_create_function(p->db, "usleep",1,SQLITE_UTF8,0,
30172 shellUSleepFunc, 0, 0);
30173 #ifndef SQLITE_NOHAVE_SYSTEM
30174 sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0,
30175 editFunc, 0, 0);
@@ -30095,10 +30178,14 @@
30178 #endif
30179 sqlite3_create_function(p->db, "shell_prompt_test", -1, SQLITE_UTF8,
30180 p, shellExpandPrompt, 0, 0);
30181 sqlite3_create_function(p->db, "shell_temp_filename", 1, SQLITE_UTF8,
30182 p, shellTempFilenameFunc, 0, 0);
30183 #ifdef SQLITE_DEBUG
30184 sqlite3_create_function(p->db, "sqlite3_incomplete", 1, SQLITE_UTF8,
30185 p, shellIncompleteFunc, 0, 0);
30186 #endif
30187
30188
30189 if( p->openMode==SHELL_OPEN_ZIPFILE ){
30190 char *zSql = sqlite3_mprintf(
30191 "CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);
@@ -31480,10 +31567,13 @@
31567 }
31568
31569 /*
31570 ** SQL function: shell_temp_filename(SUFFIX)
31571 **
31572 ** For use internally and for debugging and testing only. This function
31573 ** is subject to change or removal in future versions.
31574 **
31575 ** Return a randomly generated temporary filename.
31576 */
31577 static void shellTempFilenameFunc(
31578 sqlite3_context *pCtx,
31579 int nVal,
@@ -32651,12 +32741,23 @@
32741 ** This function is used as a callback by the recover extension. Simply
32742 ** print the supplied SQL statement to stdout.
32743 */
32744 static int recoverSqlCb(void *pCtx, const char *zSql){
32745 ShellState *pState = (ShellState*)pCtx;
32746 sqlite3_str *pOut = sqlite3_str_new(pState->db);
32747 char *zOut;
32748 int rc = SQLITE_OK;
32749 sqlite3_str_appendall(pOut, zSql);
32750 appendCompletion(pOut, zSql, 0);
32751 zOut = sqlite3_str_value(pOut);
32752 if( zOut ){
32753 cli_printf(pState->out, "%s;\n", zOut);
32754 }else{
32755 rc = SQLITE_NOMEM;
32756 }
32757 sqlite3_str_free(pOut);
32758 return rc;
32759 }
32760
32761 /*
32762 ** This function is called to recover data from the database. A script
32763 ** to construct a new database containing all recovered data is output
@@ -35329,21 +35430,21 @@
35430 ** corrupt. */
35431 sqlite3_exec(p->db, "SAVEPOINT dump; PRAGMA writable_schema=ON", 0, 0, 0);
35432 p->nErr = 0;
35433 if( zLike==0 ) zLike = sqlite3_mprintf("true");
35434 zSql = sqlite3_mprintf(
35435 "SELECT name, type, shell_complete_sql(sql) FROM sqlite_schema AS o "
35436 "WHERE (%s) AND type=='table'"
35437 " AND sql NOT NULL"
35438 " ORDER BY tbl_name='sqlite_sequence', rowid",
35439 zLike
35440 );
35441 run_schema_dump_query(p,zSql);
35442 sqlite3_free(zSql);
35443 if( (p->shellFlgs & SHFLG_DumpDataOnly)==0 ){
35444 zSql = sqlite3_mprintf(
35445 "SELECT shell_complete_sql(sql) FROM sqlite_schema AS o "
35446 "WHERE (%s) AND sql NOT NULL"
35447 " AND type IN ('index','trigger','view') "
35448 "ORDER BY type COLLATE NOCASE DESC",
35449 zLike
35450 );
@@ -35601,11 +35702,11 @@
35702 rc = 1;
35703 goto meta_command_exit;
35704 }
35705 open_db(p, 0);
35706 zSql = sqlite3_mprintf(
35707 "SELECT shell_format_schema(shell_complete_sql(sql),%d) FROM"
35708 " (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
35709 " FROM sqlite_schema UNION ALL"
35710 " SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_schema) "
35711 "WHERE type!='meta' AND sql NOTNULL"
35712 " AND name NOT LIKE 'sqlite__%%' ESCAPE '_' "
@@ -35613,11 +35714,11 @@
35714 memcpy(&data, p, sizeof(data));
35715 data.mode.spec.bTitles = QRF_No;
35716 data.mode.eMode = MODE_List;
35717 data.mode.spec.eText = QRF_TEXT_Plain;
35718 data.mode.spec.nCharLimit = 0;
35719 data.mode.spec.zRowSep = ";\n";
35720 rc = shell_exec(&data,zSql,0);
35721 sqlite3_free(zSql);
35722 if( rc==SQLITE_OK ){
35723 sqlite3_stmt *pStmt;
35724 memset(hasStat, 0, sizeof(hasStat));
@@ -36617,11 +36718,11 @@
36718
36719 rc = 1;
36720 goto meta_command_exit;
36721 }
36722 pSql = sqlite3_str_new(p->db);
36723 sqlite3_str_appendf(pSql, "SELECT shell_complete_sql(sql,1) FROM", 0);
36724 iSchema = 0;
36725 while( sqlite3_step(pStmt)==SQLITE_ROW ){
36726 const char *zDb = (const char*)sqlite3_column_text(pStmt, 1);
36727 char zScNum[30];
36728 sqlite3_snprintf(sizeof(zScNum), zScNum, "%d", ++iSchema);
@@ -38092,48 +38193,45 @@
38193 return 0;
38194 }
38195 return 1;
38196 }
38197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38198 /*
38199 ** The CLI needs a working sqlite3_complete() to work properly. So error
38200 ** out of the build if compiling with SQLITE_OMIT_COMPLETE.
38201 */
38202 #ifdef SQLITE_OMIT_COMPLETE
38203 # error the CLI application is incompatible with SQLITE_OMIT_COMPLETE.
38204 #endif
38205
38206 #ifdef SQLITE_SHELL_LEGACY_COMMAND_TERMINATOR
38207 /*
38208 ** Return TRUE if the line typed in is an SQL command terminator other
38209 ** than a semi-colon. The SQL Server style "go" command is understood
38210 ** as is the Oracle "/".
38211 */
38212 static int line_is_command_terminator(
38213 const char *zLine, /* Current line of input */
38214 char *zSql, /* Total accumulated input text */
38215 int nSql /* Bytes of accumulated input text */
38216 ){
38217 while( IsSpace(zLine[0]) ){ zLine++; };
38218 if( (zLine[0]=='/' && line_is_all_whitespace(&zLine[1])) /* Oracle */
38219 || (sqlite3_strnicmp(zLine,"go",2)==0
38220 && line_is_all_whitespace(&zLine[2])) /* SQL Server */
38221 }{
38222 int rc;
38223 if( zSql==0 ) return 1;
38224 zSql[nSql] = ';';
38225 zSql[nSql+1] = 0;
38226 rc = sqlite3_complete(zSql);
38227 zSql[nSql] = 0;
38228 return rc;
38229 }
38230 return 0;
38231 }
38232 #endif
38233
38234 /*
38235 ** This function is called after processing each line of SQL in the
38236 ** runOneSqlLine() function. Its purpose is to detect scenarios where
38237 ** defensive mode should be automatically turned off. Specifically, when
@@ -38392,13 +38490,15 @@
38490 errCnt++;
38491 }
38492 }
38493 continue;
38494 }
38495 #ifdef SQLITE_SHELL_LEGACY_COMMAND_TERMINATOR
38496 if( line_is_command_terminator(zLine, zSql, nSql) ){
38497 memcpy(zLine,";",2);
38498 }
38499 #endif
38500 hasSemi = strchr(zLine,';')!=0;
38501 nLine = strlen(zLine);
38502 if( nSql+nLine+2>=nAlloc ){
38503 /* Grow buffer by half-again increments when big. */
38504 nAlloc = nSql+(nSql>>1)+nLine+100;
38505
+343 -345
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -16,11 +16,11 @@
1616
** if you want a wrapper to interface SQLite with your choice of programming
1717
** language. The code for the "sqlite3" command-line shell is also in a
1818
** separate file. This file contains only code for the core SQLite library.
1919
**
2020
** The content in this amalgamation comes from Fossil check-in
21
-** a435d786fe0e245e352d08d2e2ddf8c1e151 with changes in files:
21
+** a3332bd623d997921c3186433cd1eab0c941 with changes in files:
2222
**
2323
**
2424
*/
2525
#ifndef SQLITE_AMALGAMATION
2626
#define SQLITE_CORE 1
@@ -467,14 +467,14 @@
467467
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
468468
** [sqlite_version()] and [sqlite_source_id()].
469469
*/
470470
#define SQLITE_VERSION "3.54.0"
471471
#define SQLITE_VERSION_NUMBER 3054000
472
-#define SQLITE_SOURCE_ID "2026-10-06 18:52:47 a435d786fe0e245e352d08d2e2ddf8c1e15154809e3b471810cc327e9d90ef85"
472
+#define SQLITE_SOURCE_ID "2026-10-09 11:47:51 a3332bd623d997921c3186433cd1eab0c9413aa0f68d93b1731cf80128ec3a36"
473473
#define SQLITE_SCM_BRANCH "trunk"
474474
#define SQLITE_SCM_TAGS ""
475
-#define SQLITE_SCM_DATETIME "2026-10-06T18:52:47.576Z"
475
+#define SQLITE_SCM_DATETIME "2026-10-09T11:47:51.732Z"
476476
477477
/*
478478
** CAPI3REF: Run-Time Library Version Numbers
479479
** KEYWORDS: sqlite3_version sqlite3_sourceid
480480
**
@@ -17890,88 +17890,88 @@
1789017890
#define OP_IfNullRow 20 /* jump, synopsis: if P1.nullRow then r[P3]=NULL, goto P2 */
1789117891
#define OP_SeekLT 21 /* jump0, synopsis: key=r[P3@P4] */
1789217892
#define OP_SeekLE 22 /* jump0, synopsis: key=r[P3@P4] */
1789317893
#define OP_SeekGE 23 /* jump0, synopsis: key=r[P3@P4] */
1789417894
#define OP_SeekGT 24 /* jump0, synopsis: key=r[P3@P4] */
17895
-#define OP_IfNotOpen 25 /* jump, synopsis: if( !csr[P1] ) goto P2 */
17896
-#define OP_IfNoHope 26 /* jump, synopsis: key=r[P3@P4] */
17897
-#define OP_NoConflict 27 /* jump, synopsis: key=r[P3@P4] */
17898
-#define OP_NotFound 28 /* jump, synopsis: key=r[P3@P4] */
17899
-#define OP_Found 29 /* jump, synopsis: key=r[P3@P4] */
17900
-#define OP_SeekRowid 30 /* jump0, synopsis: intkey=r[P3] */
17901
-#define OP_NotExists 31 /* jump, synopsis: intkey=r[P3] */
17902
-#define OP_Last 32 /* jump0 */
17903
-#define OP_IfSizeBetween 33 /* jump */
17904
-#define OP_SorterSort 34 /* jump */
17905
-#define OP_Sort 35 /* jump */
17906
-#define OP_Rewind 36 /* jump0 */
17907
-#define OP_IfEmpty 37 /* jump, synopsis: if( empty(P1) ) goto P2 */
17908
-#define OP_SorterNext 38 /* jump */
17909
-#define OP_Prev 39 /* jump */
17910
-#define OP_Next 40 /* jump */
17911
-#define OP_IdxLE 41 /* jump, synopsis: key=r[P3@P4] */
17912
-#define OP_IdxGT 42 /* jump, synopsis: key=r[P3@P4] */
17895
+#define OP_IfNoHope 25 /* jump, synopsis: key=r[P3@P4] */
17896
+#define OP_NoConflict 26 /* jump, synopsis: key=r[P3@P4] */
17897
+#define OP_NotFound 27 /* jump, synopsis: key=r[P3@P4] */
17898
+#define OP_Found 28 /* jump, synopsis: key=r[P3@P4] */
17899
+#define OP_SeekRowid 29 /* jump0, synopsis: intkey=r[P3] */
17900
+#define OP_NotExists 30 /* jump, synopsis: intkey=r[P3] */
17901
+#define OP_Last 31 /* jump0 */
17902
+#define OP_IfSizeBetween 32 /* jump */
17903
+#define OP_SorterSort 33 /* jump */
17904
+#define OP_Sort 34 /* jump */
17905
+#define OP_Rewind 35 /* jump0 */
17906
+#define OP_IfEmpty 36 /* jump, synopsis: if( empty(P1) ) goto P2 */
17907
+#define OP_SorterNext 37 /* jump */
17908
+#define OP_Prev 38 /* jump */
17909
+#define OP_Next 39 /* jump */
17910
+#define OP_IdxLE 40 /* jump, synopsis: key=r[P3@P4] */
17911
+#define OP_IdxGT 41 /* jump, synopsis: key=r[P3@P4] */
17912
+#define OP_IdxLT 42 /* jump, synopsis: key=r[P3@P4] */
1791317913
#define OP_Or 43 /* same as TK_OR, synopsis: r[P3]=(r[P1] || r[P2]) */
1791417914
#define OP_And 44 /* same as TK_AND, synopsis: r[P3]=(r[P1] && r[P2]) */
17915
-#define OP_IdxLT 45 /* jump, synopsis: key=r[P3@P4] */
17916
-#define OP_IdxGE 46 /* jump, synopsis: key=r[P3@P4] */
17917
-#define OP_IFindKey 47 /* jump */
17918
-#define OP_RowSetRead 48 /* jump, synopsis: r[P3]=rowset(P1) */
17919
-#define OP_RowSetTest 49 /* jump, synopsis: if r[P3] in rowset(P1) goto P2 */
17920
-#define OP_Program 50 /* jump0 */
17915
+#define OP_IdxGE 45 /* jump, synopsis: key=r[P3@P4] */
17916
+#define OP_IFindKey 46 /* jump */
17917
+#define OP_RowSetRead 47 /* jump, synopsis: r[P3]=rowset(P1) */
17918
+#define OP_RowSetTest 48 /* jump, synopsis: if r[P3] in rowset(P1) goto P2 */
17919
+#define OP_Program 49 /* jump0 */
17920
+#define OP_FkIfZero 50 /* jump, synopsis: if fkctr[P1]==0 goto P2 */
1792117921
#define OP_IsNull 51 /* jump, same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */
1792217922
#define OP_NotNull 52 /* jump, same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */
1792317923
#define OP_Ne 53 /* jump, same as TK_NE, synopsis: IF r[P3]!=r[P1] */
1792417924
#define OP_Eq 54 /* jump, same as TK_EQ, synopsis: IF r[P3]==r[P1] */
1792517925
#define OP_Gt 55 /* jump, same as TK_GT, synopsis: IF r[P3]>r[P1] */
1792617926
#define OP_Le 56 /* jump, same as TK_LE, synopsis: IF r[P3]<=r[P1] */
1792717927
#define OP_Lt 57 /* jump, same as TK_LT, synopsis: IF r[P3]<r[P1] */
1792817928
#define OP_Ge 58 /* jump, same as TK_GE, synopsis: IF r[P3]>=r[P1] */
1792917929
#define OP_ElseEq 59 /* jump, same as TK_ESCAPE */
17930
-#define OP_FkIfZero 60 /* jump, synopsis: if fkctr[P1]==0 goto P2 */
17931
-#define OP_IfPos 61 /* jump, synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
17932
-#define OP_IfNotZero 62 /* jump, synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
17933
-#define OP_DecrJumpZero 63 /* jump, synopsis: if (--r[P1])==0 goto P2 */
17934
-#define OP_IncrVacuum 64 /* jump */
17935
-#define OP_VNext 65 /* jump */
17936
-#define OP_Filter 66 /* jump, synopsis: if key(P3@P4) not in filter(P1) goto P2 */
17937
-#define OP_PureFunc 67 /* synopsis: r[P3]=func(r[P2@NP]) */
17938
-#define OP_Function 68 /* synopsis: r[P3]=func(r[P2@NP]) */
17939
-#define OP_Return 69
17940
-#define OP_EndCoroutine 70
17941
-#define OP_HaltIfNull 71 /* synopsis: if r[P3]=null halt */
17942
-#define OP_Halt 72
17943
-#define OP_Integer 73 /* synopsis: r[P2]=P1 */
17944
-#define OP_Int64 74 /* synopsis: r[P2]=PINT13 */
17945
-#define OP_String 75 /* synopsis: r[P2]='P4' (len=P1) */
17946
-#define OP_BeginSubrtn 76 /* synopsis: r[P2]=NULL */
17947
-#define OP_Null 77 /* synopsis: r[P2..P3]=NULL */
17948
-#define OP_SoftNull 78 /* synopsis: r[P1]=NULL */
17949
-#define OP_Blob 79 /* synopsis: r[P2]=P4 (len=P1) */
17950
-#define OP_Variable 80 /* synopsis: r[P2]=parameter(P1) */
17951
-#define OP_Move 81 /* synopsis: r[P2@P3]=r[P1@P3] */
17952
-#define OP_Copy 82 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
17953
-#define OP_SCopy 83 /* synopsis: r[P2]=r[P1] */
17954
-#define OP_IntCopy 84 /* synopsis: r[P2]=r[P1] */
17955
-#define OP_FkCheck 85
17956
-#define OP_ResultRow 86 /* synopsis: output=r[P1@P2] */
17957
-#define OP_CollSeq 87
17958
-#define OP_AddImm 88 /* synopsis: r[P1]=r[P1]+P2 */
17959
-#define OP_RealAffinity 89
17960
-#define OP_Cast 90 /* synopsis: affinity(r[P1]) */
17961
-#define OP_Permutation 91
17962
-#define OP_Compare 92 /* synopsis: r[P1@P3] <-> r[P2@P3] */
17963
-#define OP_IsTrue 93 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
17964
-#define OP_ZeroOrNull 94 /* synopsis: r[P2] = 0 OR NULL */
17965
-#define OP_Offset 95 /* synopsis: r[P3] = sqlite_offset(P1) */
17966
-#define OP_Column 96 /* synopsis: r[P3]=PX cursor P1 column P2 */
17967
-#define OP_TypeCheck 97 /* synopsis: typecheck(r[P1@P2]) */
17968
-#define OP_Affinity 98 /* synopsis: affinity(r[P1@P2]) */
17969
-#define OP_MakeRecord 99 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
17970
-#define OP_Count 100 /* synopsis: r[P2]=count() */
17971
-#define OP_ReadCookie 101
17972
-#define OP_SetCookie 102
17930
+#define OP_IfPos 60 /* jump, synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
17931
+#define OP_IfNotZero 61 /* jump, synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
17932
+#define OP_DecrJumpZero 62 /* jump, synopsis: if (--r[P1])==0 goto P2 */
17933
+#define OP_IncrVacuum 63 /* jump */
17934
+#define OP_VNext 64 /* jump */
17935
+#define OP_Filter 65 /* jump, synopsis: if key(P3@P4) not in filter(P1) goto P2 */
17936
+#define OP_PureFunc 66 /* synopsis: r[P3]=func(r[P2@NP]) */
17937
+#define OP_Function 67 /* synopsis: r[P3]=func(r[P2@NP]) */
17938
+#define OP_Return 68
17939
+#define OP_EndCoroutine 69
17940
+#define OP_HaltIfNull 70 /* synopsis: if r[P3]=null halt */
17941
+#define OP_Halt 71
17942
+#define OP_Integer 72 /* synopsis: r[P2]=P1 */
17943
+#define OP_Int64 73 /* synopsis: r[P2]=PINT13 */
17944
+#define OP_String 74 /* synopsis: r[P2]='P4' (len=P1) */
17945
+#define OP_BeginSubrtn 75 /* synopsis: r[P2]=NULL */
17946
+#define OP_Null 76 /* synopsis: r[P2..P3]=NULL */
17947
+#define OP_SoftNull 77 /* synopsis: r[P1]=NULL */
17948
+#define OP_Blob 78 /* synopsis: r[P2]=P4 (len=P1) */
17949
+#define OP_Variable 79 /* synopsis: r[P2]=parameter(P1) */
17950
+#define OP_Move 80 /* synopsis: r[P2@P3]=r[P1@P3] */
17951
+#define OP_Copy 81 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
17952
+#define OP_SCopy 82 /* synopsis: r[P2]=r[P1] */
17953
+#define OP_IntCopy 83 /* synopsis: r[P2]=r[P1] */
17954
+#define OP_FkCheck 84
17955
+#define OP_ResultRow 85 /* synopsis: output=r[P1@P2] */
17956
+#define OP_CollSeq 86
17957
+#define OP_AddImm 87 /* synopsis: r[P1]=r[P1]+P2 */
17958
+#define OP_RealAffinity 88
17959
+#define OP_Cast 89 /* synopsis: affinity(r[P1]) */
17960
+#define OP_Permutation 90
17961
+#define OP_Compare 91 /* synopsis: r[P1@P3] <-> r[P2@P3] */
17962
+#define OP_IsTrue 92 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
17963
+#define OP_ZeroOrNull 93 /* synopsis: r[P2] = 0 OR NULL */
17964
+#define OP_Offset 94 /* synopsis: r[P3] = sqlite_offset(P1) */
17965
+#define OP_Column 95 /* synopsis: r[P3]=PX cursor P1 column P2 */
17966
+#define OP_TypeCheck 96 /* synopsis: typecheck(r[P1@P2]) */
17967
+#define OP_Affinity 97 /* synopsis: affinity(r[P1@P2]) */
17968
+#define OP_MakeRecord 98 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
17969
+#define OP_Count 99 /* synopsis: r[P2]=count() */
17970
+#define OP_ReadCookie 100
17971
+#define OP_SetCookie 101
17972
+#define OP_ReopenIdx 102 /* synopsis: root=P2 iDb=P3 */
1797317973
#define OP_BitAnd 103 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
1797417974
#define OP_BitOr 104 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
1797517975
#define OP_ShiftLeft 105 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
1797617976
#define OP_ShiftRight 106 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
1797717977
#define OP_Add 107 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
@@ -17978,89 +17978,88 @@
1797817978
#define OP_Subtract 108 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
1797917979
#define OP_Multiply 109 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
1798017980
#define OP_Divide 110 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
1798117981
#define OP_Remainder 111 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
1798217982
#define OP_Concat 112 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
17983
-#define OP_ReopenIdx 113 /* synopsis: root=P2 iDb=P3 */
17984
-#define OP_OpenRead 114 /* synopsis: root=P2 iDb=P3 */
17983
+#define OP_OpenRead 113 /* synopsis: root=P2 iDb=P3 */
17984
+#define OP_OpenWrite 114 /* synopsis: root=P2 iDb=P3 */
1798517985
#define OP_BitNot 115 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
17986
-#define OP_OpenWrite 116 /* synopsis: root=P2 iDb=P3 */
17987
-#define OP_OpenDup 117
17986
+#define OP_OpenDup 116
17987
+#define OP_OpenAutoindex 117 /* synopsis: nColumn=P2 */
1798817988
#define OP_String8 118 /* same as TK_STRING, synopsis: r[P2]='P4' */
17989
-#define OP_OpenAutoindex 119 /* synopsis: nColumn=P2 */
17990
-#define OP_OpenEphemeral 120 /* synopsis: nColumn=P2 */
17991
-#define OP_SorterOpen 121
17992
-#define OP_SequenceTest 122 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
17993
-#define OP_OpenPseudo 123 /* synopsis: P3 columns in r[P2] */
17994
-#define OP_Close 124
17995
-#define OP_ColumnsUsed 125 /* synopsis: Cursor P1 uses columns PHEX23 */
17996
-#define OP_SeekScan 126 /* synopsis: Scan-ahead up to P1 rows */
17997
-#define OP_SeekHit 127 /* synopsis: set P2<=seekHit<=P3 */
17998
-#define OP_Sequence 128 /* synopsis: r[P2]=cursor[P1].ctr++ */
17999
-#define OP_NewRowid 129 /* synopsis: r[P2]=rowid */
18000
-#define OP_Insert 130 /* synopsis: intkey=r[P3] data=r[P2] */
18001
-#define OP_RowCell 131
18002
-#define OP_Delete 132
18003
-#define OP_ResetCount 133
18004
-#define OP_SorterCompare 134 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
18005
-#define OP_SorterData 135 /* synopsis: r[P2]=data */
18006
-#define OP_RowData 136 /* synopsis: r[P2]=data */
18007
-#define OP_Rowid 137 /* synopsis: r[P2]=PX rowid of P1 */
18008
-#define OP_NullRow 138
18009
-#define OP_SeekEnd 139
18010
-#define OP_IdxInsert 140 /* synopsis: key=r[P2] */
18011
-#define OP_SorterInsert 141 /* synopsis: key=r[P2] */
18012
-#define OP_IdxDelete 142 /* synopsis: key=r[P2@P5] */
18013
-#define OP_DeferredSeek 143 /* synopsis: Move P3 to P1.rowid if needed */
18014
-#define OP_IdxRowid 144 /* synopsis: r[P2]=rowid */
18015
-#define OP_FinishSeek 145
18016
-#define OP_Destroy 146
18017
-#define OP_Clear 147
18018
-#define OP_ResetSorter 148
18019
-#define OP_CreateBtree 149 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
18020
-#define OP_SqlExec 150
18021
-#define OP_ParseSchema 151
18022
-#define OP_LoadAnalysis 152
18023
-#define OP_DropTable 153
17989
+#define OP_OpenEphemeral 119 /* synopsis: nColumn=P2 */
17990
+#define OP_SorterOpen 120
17991
+#define OP_SequenceTest 121 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
17992
+#define OP_OpenPseudo 122 /* synopsis: P3 columns in r[P2] */
17993
+#define OP_Close 123
17994
+#define OP_ColumnsUsed 124 /* synopsis: Cursor P1 uses columns PHEX23 */
17995
+#define OP_SeekScan 125 /* synopsis: Scan-ahead up to P1 rows */
17996
+#define OP_SeekHit 126 /* synopsis: set P2<=seekHit<=P3 */
17997
+#define OP_Sequence 127 /* synopsis: r[P2]=cursor[P1].ctr++ */
17998
+#define OP_NewRowid 128 /* synopsis: r[P2]=rowid */
17999
+#define OP_Insert 129 /* synopsis: intkey=r[P3] data=r[P2] */
18000
+#define OP_RowCell 130
18001
+#define OP_Delete 131
18002
+#define OP_ResetCount 132
18003
+#define OP_SorterCompare 133 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
18004
+#define OP_SorterData 134 /* synopsis: r[P2]=data */
18005
+#define OP_RowData 135 /* synopsis: r[P2]=data */
18006
+#define OP_Rowid 136 /* synopsis: r[P2]=PX rowid of P1 */
18007
+#define OP_NullRow 137
18008
+#define OP_SeekEnd 138
18009
+#define OP_IdxInsert 139 /* synopsis: key=r[P2] */
18010
+#define OP_SorterInsert 140 /* synopsis: key=r[P2] */
18011
+#define OP_IdxDelete 141 /* synopsis: key=r[P2@P5] */
18012
+#define OP_DeferredSeek 142 /* synopsis: Move P3 to P1.rowid if needed */
18013
+#define OP_IdxRowid 143 /* synopsis: r[P2]=rowid */
18014
+#define OP_FinishSeek 144
18015
+#define OP_Destroy 145
18016
+#define OP_Clear 146
18017
+#define OP_ResetSorter 147
18018
+#define OP_CreateBtree 148 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
18019
+#define OP_SqlExec 149
18020
+#define OP_ParseSchema 150
18021
+#define OP_LoadAnalysis 151
18022
+#define OP_DropTable 152
18023
+#define OP_DropIndex 153
1802418024
#define OP_Real 154 /* same as TK_FLOAT, synopsis: r[P2]=PDBL13 */
18025
-#define OP_DropIndex 155
18026
-#define OP_DropTrigger 156
18027
-#define OP_IntegrityCk 157
18028
-#define OP_RowSetAdd 158 /* synopsis: rowset(P1)=r[P2] */
18029
-#define OP_Param 159
18030
-#define OP_FkCounter 160 /* synopsis: fkctr[P1]+=P2 */
18031
-#define OP_MemMax 161 /* synopsis: r[P1]=max(r[P1],r[P2]) */
18032
-#define OP_OffsetLimit 162 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
18033
-#define OP_AggInverse 163 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
18034
-#define OP_AggStep 164 /* synopsis: accum=r[P3] step(r[P2@P5]) */
18035
-#define OP_AggStep1 165 /* synopsis: accum=r[P3] step(r[P2@P5]) */
18036
-#define OP_AggValue 166 /* synopsis: r[P3]=value N=P2 */
18037
-#define OP_AggFinal 167 /* synopsis: accum=r[P1] N=P2 */
18038
-#define OP_Expire 168
18039
-#define OP_CursorLock 169
18040
-#define OP_CursorUnlock 170
18041
-#define OP_TableLock 171 /* synopsis: iDb=P1 root=P2 write=P3 */
18042
-#define OP_VBegin 172
18043
-#define OP_VCreate 173
18044
-#define OP_VDestroy 174
18045
-#define OP_VOpen 175
18046
-#define OP_VCheck 176
18047
-#define OP_VInitIn 177 /* synopsis: r[P2]=ValueList(P1,P3) */
18048
-#define OP_VColumn 178 /* synopsis: r[P3]=vcolumn(P2) */
18049
-#define OP_VRename 179
18050
-#define OP_Pagecount 180
18051
-#define OP_MaxPgcnt 181
18052
-#define OP_ClrSubtype 182 /* synopsis: r[P1].subtype = 0 */
18053
-#define OP_GetSubtype 183 /* synopsis: r[P2] = r[P1].subtype */
18054
-#define OP_SetSubtype 184 /* synopsis: r[P2].subtype = r[P1] */
18055
-#define OP_FilterAdd 185 /* synopsis: filter(P1) += key(P3@P4) */
18056
-#define OP_Trace 186
18057
-#define OP_CursorHint 187
18058
-#define OP_ReleaseReg 188 /* synopsis: release r[P1@P2] mask P3 */
18059
-#define OP_Noop 189
18060
-#define OP_Explain 190
18061
-#define OP_Abortable 191
18025
+#define OP_DropTrigger 155
18026
+#define OP_IntegrityCk 156
18027
+#define OP_RowSetAdd 157 /* synopsis: rowset(P1)=r[P2] */
18028
+#define OP_Param 158
18029
+#define OP_FkCounter 159 /* synopsis: fkctr[P1]+=P2 */
18030
+#define OP_MemMax 160 /* synopsis: r[P1]=max(r[P1],r[P2]) */
18031
+#define OP_OffsetLimit 161 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
18032
+#define OP_AggInverse 162 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
18033
+#define OP_AggStep 163 /* synopsis: accum=r[P3] step(r[P2@P5]) */
18034
+#define OP_AggStep1 164 /* synopsis: accum=r[P3] step(r[P2@P5]) */
18035
+#define OP_AggValue 165 /* synopsis: r[P3]=value N=P2 */
18036
+#define OP_AggFinal 166 /* synopsis: accum=r[P1] N=P2 */
18037
+#define OP_Expire 167
18038
+#define OP_CursorLock 168
18039
+#define OP_CursorUnlock 169
18040
+#define OP_TableLock 170 /* synopsis: iDb=P1 root=P2 write=P3 */
18041
+#define OP_VBegin 171
18042
+#define OP_VCreate 172
18043
+#define OP_VDestroy 173
18044
+#define OP_VOpen 174
18045
+#define OP_VCheck 175
18046
+#define OP_VInitIn 176 /* synopsis: r[P2]=ValueList(P1,P3) */
18047
+#define OP_VColumn 177 /* synopsis: r[P3]=vcolumn(P2) */
18048
+#define OP_VRename 178
18049
+#define OP_Pagecount 179
18050
+#define OP_MaxPgcnt 180
18051
+#define OP_ClrSubtype 181 /* synopsis: r[P1].subtype = 0 */
18052
+#define OP_GetSubtype 182 /* synopsis: r[P2] = r[P1].subtype */
18053
+#define OP_SetSubtype 183 /* synopsis: r[P2].subtype = r[P1] */
18054
+#define OP_FilterAdd 184 /* synopsis: filter(P1) += key(P3@P4) */
18055
+#define OP_Trace 185
18056
+#define OP_CursorHint 186
18057
+#define OP_ReleaseReg 187 /* synopsis: release r[P1@P2] mask P3 */
18058
+#define OP_Noop 188
18059
+#define OP_Explain 189
18060
+#define OP_Abortable 190
1806218061
1806318062
/* Properties such as "out2" or "jump" that are specified in
1806418063
** comments following the "case" for each opcode in the vdbe.c
1806518064
** are encoded into bitvectors as follows:
1806618065
*/
@@ -18074,40 +18073,39 @@
1807418073
#define OPFLG_JUMP0 0x80 /* jump0: P2 might be zero */
1807518074
#define OPFLG_INITIALIZER {\
1807618075
/* 0 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x41, 0x00,\
1807718076
/* 8 */ 0x81, 0x01, 0x01, 0x81, 0x83, 0x83, 0x01, 0x01,\
1807818077
/* 16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0xc9, 0xc9, 0xc9,\
18079
-/* 24 */ 0xc9, 0x01, 0x49, 0x49, 0x49, 0x49, 0xc9, 0x49,\
18080
-/* 32 */ 0xc1, 0x01, 0x41, 0x41, 0xc1, 0x01, 0x01, 0x41,\
18081
-/* 40 */ 0x41, 0x41, 0x41, 0x26, 0x26, 0x41, 0x41, 0x09,\
18082
-/* 48 */ 0x23, 0x0b, 0x81, 0x03, 0x03, 0x0b, 0x0b, 0x0b,\
18083
-/* 56 */ 0x0b, 0x0b, 0x0b, 0x01, 0x01, 0x03, 0x03, 0x03,\
18084
-/* 64 */ 0x01, 0x41, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08,\
18085
-/* 72 */ 0x00, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x10,\
18086
-/* 80 */ 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00,\
18087
-/* 88 */ 0x02, 0x02, 0x02, 0x00, 0x00, 0x12, 0x1e, 0x20,\
18088
-/* 96 */ 0x40, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x26,\
18078
+/* 24 */ 0xc9, 0x49, 0x49, 0x49, 0x49, 0xc9, 0x49, 0xc1,\
18079
+/* 32 */ 0x01, 0x41, 0x41, 0xc1, 0x01, 0x01, 0x41, 0x41,\
18080
+/* 40 */ 0x41, 0x41, 0x41, 0x26, 0x26, 0x41, 0x09, 0x23,\
18081
+/* 48 */ 0x0b, 0x81, 0x01, 0x03, 0x03, 0x0b, 0x0b, 0x0b,\
18082
+/* 56 */ 0x0b, 0x0b, 0x0b, 0x01, 0x03, 0x03, 0x03, 0x01,\
18083
+/* 64 */ 0x41, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x00,\
18084
+/* 72 */ 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x10, 0x10,\
18085
+/* 80 */ 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x02,\
18086
+/* 88 */ 0x02, 0x02, 0x00, 0x00, 0x12, 0x1e, 0x20, 0x40,\
18087
+/* 96 */ 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x40, 0x26,\
1808918088
/* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\
18090
-/* 112 */ 0x26, 0x40, 0x40, 0x12, 0x00, 0x40, 0x10, 0x40,\
18091
-/* 120 */ 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x40,\
18092
-/* 128 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,\
18093
-/* 136 */ 0x00, 0x50, 0x00, 0x40, 0x04, 0x04, 0x00, 0x40,\
18094
-/* 144 */ 0x50, 0x40, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00,\
18095
-/* 152 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x06, 0x10,\
18096
-/* 160 */ 0x00, 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00,\
18097
-/* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,\
18098
-/* 176 */ 0x10, 0x50, 0x40, 0x00, 0x10, 0x10, 0x02, 0x12,\
18099
-/* 184 */ 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
18100
-}
18089
+/* 112 */ 0x26, 0x40, 0x00, 0x12, 0x40, 0x40, 0x10, 0x40,\
18090
+/* 120 */ 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x40, 0x10,\
18091
+/* 128 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00,\
18092
+/* 136 */ 0x50, 0x00, 0x40, 0x04, 0x04, 0x00, 0x40, 0x50,\
18093
+/* 144 */ 0x40, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,\
18094
+/* 152 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x06, 0x10, 0x00,\
18095
+/* 160 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
18096
+/* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x10,\
18097
+/* 176 */ 0x50, 0x40, 0x00, 0x10, 0x10, 0x02, 0x12, 0x12,\
18098
+/* 184 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}
1810118099
1810218100
/* The resolve3P2Values() routine is able to run faster if it knows
1810318101
** the value of the largest JUMP opcode. The smaller the maximum
1810418102
** JUMP opcode the better, so the mkopcodeh.tcl script that
1810518103
** generated this include file strives to group all JUMP opcodes
1810618104
** together near the beginning of the list.
1810718105
*/
18108
-#define SQLITE_MX_JUMP_OPCODE 66 /* Maximum JUMP opcode */
18106
+#define SQLITE_MX_JUMP_OPCODE 65 /* Maximum JUMP opcode */
1810918107
1811018108
/************** End of opcodes.h *********************************************/
1811118109
/************** Continuing where we left off in vdbe.h ***********************/
1811218110
1811318111
/*
@@ -35061,10 +35059,14 @@
3506135059
}
3506235060
case TK_ID: {
3506335061
assert( !ExprHasProperty(pExpr, EP_IntValue) );
3506435062
sqlite3TreeViewLine(pView,"ID \"%w\"", pExpr->u.zToken);
3506535063
break;
35064
+ }
35065
+ case TK_ASTERISK: {
35066
+ sqlite3TreeViewLine(pView,"ASKTERISK");
35067
+ break;
3506635068
}
3506735069
#ifndef SQLITE_OMIT_CAST
3506835070
case TK_CAST: {
3506935071
/* Expressions of the form: CAST(pLeft AS token) */
3507035072
assert( !ExprHasProperty(pExpr, EP_IntValue) );
@@ -39359,88 +39361,88 @@
3935939361
/* 20 */ "IfNullRow" OpHelp("if P1.nullRow then r[P3]=NULL, goto P2"),
3936039362
/* 21 */ "SeekLT" OpHelp("key=r[P3@P4]"),
3936139363
/* 22 */ "SeekLE" OpHelp("key=r[P3@P4]"),
3936239364
/* 23 */ "SeekGE" OpHelp("key=r[P3@P4]"),
3936339365
/* 24 */ "SeekGT" OpHelp("key=r[P3@P4]"),
39364
- /* 25 */ "IfNotOpen" OpHelp("if( !csr[P1] ) goto P2"),
39365
- /* 26 */ "IfNoHope" OpHelp("key=r[P3@P4]"),
39366
- /* 27 */ "NoConflict" OpHelp("key=r[P3@P4]"),
39367
- /* 28 */ "NotFound" OpHelp("key=r[P3@P4]"),
39368
- /* 29 */ "Found" OpHelp("key=r[P3@P4]"),
39369
- /* 30 */ "SeekRowid" OpHelp("intkey=r[P3]"),
39370
- /* 31 */ "NotExists" OpHelp("intkey=r[P3]"),
39371
- /* 32 */ "Last" OpHelp(""),
39372
- /* 33 */ "IfSizeBetween" OpHelp(""),
39373
- /* 34 */ "SorterSort" OpHelp(""),
39374
- /* 35 */ "Sort" OpHelp(""),
39375
- /* 36 */ "Rewind" OpHelp(""),
39376
- /* 37 */ "IfEmpty" OpHelp("if( empty(P1) ) goto P2"),
39377
- /* 38 */ "SorterNext" OpHelp(""),
39378
- /* 39 */ "Prev" OpHelp(""),
39379
- /* 40 */ "Next" OpHelp(""),
39380
- /* 41 */ "IdxLE" OpHelp("key=r[P3@P4]"),
39381
- /* 42 */ "IdxGT" OpHelp("key=r[P3@P4]"),
39366
+ /* 25 */ "IfNoHope" OpHelp("key=r[P3@P4]"),
39367
+ /* 26 */ "NoConflict" OpHelp("key=r[P3@P4]"),
39368
+ /* 27 */ "NotFound" OpHelp("key=r[P3@P4]"),
39369
+ /* 28 */ "Found" OpHelp("key=r[P3@P4]"),
39370
+ /* 29 */ "SeekRowid" OpHelp("intkey=r[P3]"),
39371
+ /* 30 */ "NotExists" OpHelp("intkey=r[P3]"),
39372
+ /* 31 */ "Last" OpHelp(""),
39373
+ /* 32 */ "IfSizeBetween" OpHelp(""),
39374
+ /* 33 */ "SorterSort" OpHelp(""),
39375
+ /* 34 */ "Sort" OpHelp(""),
39376
+ /* 35 */ "Rewind" OpHelp(""),
39377
+ /* 36 */ "IfEmpty" OpHelp("if( empty(P1) ) goto P2"),
39378
+ /* 37 */ "SorterNext" OpHelp(""),
39379
+ /* 38 */ "Prev" OpHelp(""),
39380
+ /* 39 */ "Next" OpHelp(""),
39381
+ /* 40 */ "IdxLE" OpHelp("key=r[P3@P4]"),
39382
+ /* 41 */ "IdxGT" OpHelp("key=r[P3@P4]"),
39383
+ /* 42 */ "IdxLT" OpHelp("key=r[P3@P4]"),
3938239384
/* 43 */ "Or" OpHelp("r[P3]=(r[P1] || r[P2])"),
3938339385
/* 44 */ "And" OpHelp("r[P3]=(r[P1] && r[P2])"),
39384
- /* 45 */ "IdxLT" OpHelp("key=r[P3@P4]"),
39385
- /* 46 */ "IdxGE" OpHelp("key=r[P3@P4]"),
39386
- /* 47 */ "IFindKey" OpHelp(""),
39387
- /* 48 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"),
39388
- /* 49 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"),
39389
- /* 50 */ "Program" OpHelp(""),
39386
+ /* 45 */ "IdxGE" OpHelp("key=r[P3@P4]"),
39387
+ /* 46 */ "IFindKey" OpHelp(""),
39388
+ /* 47 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"),
39389
+ /* 48 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"),
39390
+ /* 49 */ "Program" OpHelp(""),
39391
+ /* 50 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
3939039392
/* 51 */ "IsNull" OpHelp("if r[P1]==NULL goto P2"),
3939139393
/* 52 */ "NotNull" OpHelp("if r[P1]!=NULL goto P2"),
3939239394
/* 53 */ "Ne" OpHelp("IF r[P3]!=r[P1]"),
3939339395
/* 54 */ "Eq" OpHelp("IF r[P3]==r[P1]"),
3939439396
/* 55 */ "Gt" OpHelp("IF r[P3]>r[P1]"),
3939539397
/* 56 */ "Le" OpHelp("IF r[P3]<=r[P1]"),
3939639398
/* 57 */ "Lt" OpHelp("IF r[P3]<r[P1]"),
3939739399
/* 58 */ "Ge" OpHelp("IF r[P3]>=r[P1]"),
3939839400
/* 59 */ "ElseEq" OpHelp(""),
39399
- /* 60 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
39400
- /* 61 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"),
39401
- /* 62 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
39402
- /* 63 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
39403
- /* 64 */ "IncrVacuum" OpHelp(""),
39404
- /* 65 */ "VNext" OpHelp(""),
39405
- /* 66 */ "Filter" OpHelp("if key(P3@P4) not in filter(P1) goto P2"),
39406
- /* 67 */ "PureFunc" OpHelp("r[P3]=func(r[P2@NP])"),
39407
- /* 68 */ "Function" OpHelp("r[P3]=func(r[P2@NP])"),
39408
- /* 69 */ "Return" OpHelp(""),
39409
- /* 70 */ "EndCoroutine" OpHelp(""),
39410
- /* 71 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
39411
- /* 72 */ "Halt" OpHelp(""),
39412
- /* 73 */ "Integer" OpHelp("r[P2]=P1"),
39413
- /* 74 */ "Int64" OpHelp("r[P2]=PINT13"),
39414
- /* 75 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
39415
- /* 76 */ "BeginSubrtn" OpHelp("r[P2]=NULL"),
39416
- /* 77 */ "Null" OpHelp("r[P2..P3]=NULL"),
39417
- /* 78 */ "SoftNull" OpHelp("r[P1]=NULL"),
39418
- /* 79 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
39419
- /* 80 */ "Variable" OpHelp("r[P2]=parameter(P1)"),
39420
- /* 81 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
39421
- /* 82 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
39422
- /* 83 */ "SCopy" OpHelp("r[P2]=r[P1]"),
39423
- /* 84 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
39424
- /* 85 */ "FkCheck" OpHelp(""),
39425
- /* 86 */ "ResultRow" OpHelp("output=r[P1@P2]"),
39426
- /* 87 */ "CollSeq" OpHelp(""),
39427
- /* 88 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
39428
- /* 89 */ "RealAffinity" OpHelp(""),
39429
- /* 90 */ "Cast" OpHelp("affinity(r[P1])"),
39430
- /* 91 */ "Permutation" OpHelp(""),
39431
- /* 92 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
39432
- /* 93 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
39433
- /* 94 */ "ZeroOrNull" OpHelp("r[P2] = 0 OR NULL"),
39434
- /* 95 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
39435
- /* 96 */ "Column" OpHelp("r[P3]=PX cursor P1 column P2"),
39436
- /* 97 */ "TypeCheck" OpHelp("typecheck(r[P1@P2])"),
39437
- /* 98 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
39438
- /* 99 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
39439
- /* 100 */ "Count" OpHelp("r[P2]=count()"),
39440
- /* 101 */ "ReadCookie" OpHelp(""),
39441
- /* 102 */ "SetCookie" OpHelp(""),
39401
+ /* 60 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"),
39402
+ /* 61 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
39403
+ /* 62 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
39404
+ /* 63 */ "IncrVacuum" OpHelp(""),
39405
+ /* 64 */ "VNext" OpHelp(""),
39406
+ /* 65 */ "Filter" OpHelp("if key(P3@P4) not in filter(P1) goto P2"),
39407
+ /* 66 */ "PureFunc" OpHelp("r[P3]=func(r[P2@NP])"),
39408
+ /* 67 */ "Function" OpHelp("r[P3]=func(r[P2@NP])"),
39409
+ /* 68 */ "Return" OpHelp(""),
39410
+ /* 69 */ "EndCoroutine" OpHelp(""),
39411
+ /* 70 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
39412
+ /* 71 */ "Halt" OpHelp(""),
39413
+ /* 72 */ "Integer" OpHelp("r[P2]=P1"),
39414
+ /* 73 */ "Int64" OpHelp("r[P2]=PINT13"),
39415
+ /* 74 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
39416
+ /* 75 */ "BeginSubrtn" OpHelp("r[P2]=NULL"),
39417
+ /* 76 */ "Null" OpHelp("r[P2..P3]=NULL"),
39418
+ /* 77 */ "SoftNull" OpHelp("r[P1]=NULL"),
39419
+ /* 78 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
39420
+ /* 79 */ "Variable" OpHelp("r[P2]=parameter(P1)"),
39421
+ /* 80 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
39422
+ /* 81 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
39423
+ /* 82 */ "SCopy" OpHelp("r[P2]=r[P1]"),
39424
+ /* 83 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
39425
+ /* 84 */ "FkCheck" OpHelp(""),
39426
+ /* 85 */ "ResultRow" OpHelp("output=r[P1@P2]"),
39427
+ /* 86 */ "CollSeq" OpHelp(""),
39428
+ /* 87 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
39429
+ /* 88 */ "RealAffinity" OpHelp(""),
39430
+ /* 89 */ "Cast" OpHelp("affinity(r[P1])"),
39431
+ /* 90 */ "Permutation" OpHelp(""),
39432
+ /* 91 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
39433
+ /* 92 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
39434
+ /* 93 */ "ZeroOrNull" OpHelp("r[P2] = 0 OR NULL"),
39435
+ /* 94 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
39436
+ /* 95 */ "Column" OpHelp("r[P3]=PX cursor P1 column P2"),
39437
+ /* 96 */ "TypeCheck" OpHelp("typecheck(r[P1@P2])"),
39438
+ /* 97 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
39439
+ /* 98 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
39440
+ /* 99 */ "Count" OpHelp("r[P2]=count()"),
39441
+ /* 100 */ "ReadCookie" OpHelp(""),
39442
+ /* 101 */ "SetCookie" OpHelp(""),
39443
+ /* 102 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
3944239444
/* 103 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
3944339445
/* 104 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
3944439446
/* 105 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
3944539447
/* 106 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
3944639448
/* 107 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
@@ -39447,89 +39449,88 @@
3944739449
/* 108 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
3944839450
/* 109 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
3944939451
/* 110 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
3945039452
/* 111 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
3945139453
/* 112 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
39452
- /* 113 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
39453
- /* 114 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
39454
+ /* 113 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
39455
+ /* 114 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
3945439456
/* 115 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
39455
- /* 116 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
39456
- /* 117 */ "OpenDup" OpHelp(""),
39457
+ /* 116 */ "OpenDup" OpHelp(""),
39458
+ /* 117 */ "OpenAutoindex" OpHelp("nColumn=P2"),
3945739459
/* 118 */ "String8" OpHelp("r[P2]='P4'"),
39458
- /* 119 */ "OpenAutoindex" OpHelp("nColumn=P2"),
39459
- /* 120 */ "OpenEphemeral" OpHelp("nColumn=P2"),
39460
- /* 121 */ "SorterOpen" OpHelp(""),
39461
- /* 122 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
39462
- /* 123 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
39463
- /* 124 */ "Close" OpHelp(""),
39464
- /* 125 */ "ColumnsUsed" OpHelp("Cursor P1 uses columns PHEX23"),
39465
- /* 126 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
39466
- /* 127 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
39467
- /* 128 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
39468
- /* 129 */ "NewRowid" OpHelp("r[P2]=rowid"),
39469
- /* 130 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
39470
- /* 131 */ "RowCell" OpHelp(""),
39471
- /* 132 */ "Delete" OpHelp(""),
39472
- /* 133 */ "ResetCount" OpHelp(""),
39473
- /* 134 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
39474
- /* 135 */ "SorterData" OpHelp("r[P2]=data"),
39475
- /* 136 */ "RowData" OpHelp("r[P2]=data"),
39476
- /* 137 */ "Rowid" OpHelp("r[P2]=PX rowid of P1"),
39477
- /* 138 */ "NullRow" OpHelp(""),
39478
- /* 139 */ "SeekEnd" OpHelp(""),
39479
- /* 140 */ "IdxInsert" OpHelp("key=r[P2]"),
39480
- /* 141 */ "SorterInsert" OpHelp("key=r[P2]"),
39481
- /* 142 */ "IdxDelete" OpHelp("key=r[P2@P5]"),
39482
- /* 143 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
39483
- /* 144 */ "IdxRowid" OpHelp("r[P2]=rowid"),
39484
- /* 145 */ "FinishSeek" OpHelp(""),
39485
- /* 146 */ "Destroy" OpHelp(""),
39486
- /* 147 */ "Clear" OpHelp(""),
39487
- /* 148 */ "ResetSorter" OpHelp(""),
39488
- /* 149 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
39489
- /* 150 */ "SqlExec" OpHelp(""),
39490
- /* 151 */ "ParseSchema" OpHelp(""),
39491
- /* 152 */ "LoadAnalysis" OpHelp(""),
39492
- /* 153 */ "DropTable" OpHelp(""),
39460
+ /* 119 */ "OpenEphemeral" OpHelp("nColumn=P2"),
39461
+ /* 120 */ "SorterOpen" OpHelp(""),
39462
+ /* 121 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
39463
+ /* 122 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
39464
+ /* 123 */ "Close" OpHelp(""),
39465
+ /* 124 */ "ColumnsUsed" OpHelp("Cursor P1 uses columns PHEX23"),
39466
+ /* 125 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
39467
+ /* 126 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
39468
+ /* 127 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
39469
+ /* 128 */ "NewRowid" OpHelp("r[P2]=rowid"),
39470
+ /* 129 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
39471
+ /* 130 */ "RowCell" OpHelp(""),
39472
+ /* 131 */ "Delete" OpHelp(""),
39473
+ /* 132 */ "ResetCount" OpHelp(""),
39474
+ /* 133 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
39475
+ /* 134 */ "SorterData" OpHelp("r[P2]=data"),
39476
+ /* 135 */ "RowData" OpHelp("r[P2]=data"),
39477
+ /* 136 */ "Rowid" OpHelp("r[P2]=PX rowid of P1"),
39478
+ /* 137 */ "NullRow" OpHelp(""),
39479
+ /* 138 */ "SeekEnd" OpHelp(""),
39480
+ /* 139 */ "IdxInsert" OpHelp("key=r[P2]"),
39481
+ /* 140 */ "SorterInsert" OpHelp("key=r[P2]"),
39482
+ /* 141 */ "IdxDelete" OpHelp("key=r[P2@P5]"),
39483
+ /* 142 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
39484
+ /* 143 */ "IdxRowid" OpHelp("r[P2]=rowid"),
39485
+ /* 144 */ "FinishSeek" OpHelp(""),
39486
+ /* 145 */ "Destroy" OpHelp(""),
39487
+ /* 146 */ "Clear" OpHelp(""),
39488
+ /* 147 */ "ResetSorter" OpHelp(""),
39489
+ /* 148 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
39490
+ /* 149 */ "SqlExec" OpHelp(""),
39491
+ /* 150 */ "ParseSchema" OpHelp(""),
39492
+ /* 151 */ "LoadAnalysis" OpHelp(""),
39493
+ /* 152 */ "DropTable" OpHelp(""),
39494
+ /* 153 */ "DropIndex" OpHelp(""),
3949339495
/* 154 */ "Real" OpHelp("r[P2]=PDBL13"),
39494
- /* 155 */ "DropIndex" OpHelp(""),
39495
- /* 156 */ "DropTrigger" OpHelp(""),
39496
- /* 157 */ "IntegrityCk" OpHelp(""),
39497
- /* 158 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
39498
- /* 159 */ "Param" OpHelp(""),
39499
- /* 160 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
39500
- /* 161 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
39501
- /* 162 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
39502
- /* 163 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
39503
- /* 164 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
39504
- /* 165 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
39505
- /* 166 */ "AggValue" OpHelp("r[P3]=value N=P2"),
39506
- /* 167 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
39507
- /* 168 */ "Expire" OpHelp(""),
39508
- /* 169 */ "CursorLock" OpHelp(""),
39509
- /* 170 */ "CursorUnlock" OpHelp(""),
39510
- /* 171 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
39511
- /* 172 */ "VBegin" OpHelp(""),
39512
- /* 173 */ "VCreate" OpHelp(""),
39513
- /* 174 */ "VDestroy" OpHelp(""),
39514
- /* 175 */ "VOpen" OpHelp(""),
39515
- /* 176 */ "VCheck" OpHelp(""),
39516
- /* 177 */ "VInitIn" OpHelp("r[P2]=ValueList(P1,P3)"),
39517
- /* 178 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
39518
- /* 179 */ "VRename" OpHelp(""),
39519
- /* 180 */ "Pagecount" OpHelp(""),
39520
- /* 181 */ "MaxPgcnt" OpHelp(""),
39521
- /* 182 */ "ClrSubtype" OpHelp("r[P1].subtype = 0"),
39522
- /* 183 */ "GetSubtype" OpHelp("r[P2] = r[P1].subtype"),
39523
- /* 184 */ "SetSubtype" OpHelp("r[P2].subtype = r[P1]"),
39524
- /* 185 */ "FilterAdd" OpHelp("filter(P1) += key(P3@P4)"),
39525
- /* 186 */ "Trace" OpHelp(""),
39526
- /* 187 */ "CursorHint" OpHelp(""),
39527
- /* 188 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"),
39528
- /* 189 */ "Noop" OpHelp(""),
39529
- /* 190 */ "Explain" OpHelp(""),
39530
- /* 191 */ "Abortable" OpHelp(""),
39496
+ /* 155 */ "DropTrigger" OpHelp(""),
39497
+ /* 156 */ "IntegrityCk" OpHelp(""),
39498
+ /* 157 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
39499
+ /* 158 */ "Param" OpHelp(""),
39500
+ /* 159 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
39501
+ /* 160 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
39502
+ /* 161 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
39503
+ /* 162 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
39504
+ /* 163 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
39505
+ /* 164 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
39506
+ /* 165 */ "AggValue" OpHelp("r[P3]=value N=P2"),
39507
+ /* 166 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
39508
+ /* 167 */ "Expire" OpHelp(""),
39509
+ /* 168 */ "CursorLock" OpHelp(""),
39510
+ /* 169 */ "CursorUnlock" OpHelp(""),
39511
+ /* 170 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
39512
+ /* 171 */ "VBegin" OpHelp(""),
39513
+ /* 172 */ "VCreate" OpHelp(""),
39514
+ /* 173 */ "VDestroy" OpHelp(""),
39515
+ /* 174 */ "VOpen" OpHelp(""),
39516
+ /* 175 */ "VCheck" OpHelp(""),
39517
+ /* 176 */ "VInitIn" OpHelp("r[P2]=ValueList(P1,P3)"),
39518
+ /* 177 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
39519
+ /* 178 */ "VRename" OpHelp(""),
39520
+ /* 179 */ "Pagecount" OpHelp(""),
39521
+ /* 180 */ "MaxPgcnt" OpHelp(""),
39522
+ /* 181 */ "ClrSubtype" OpHelp("r[P1].subtype = 0"),
39523
+ /* 182 */ "GetSubtype" OpHelp("r[P2] = r[P1].subtype"),
39524
+ /* 183 */ "SetSubtype" OpHelp("r[P2].subtype = r[P1]"),
39525
+ /* 184 */ "FilterAdd" OpHelp("filter(P1) += key(P3@P4)"),
39526
+ /* 185 */ "Trace" OpHelp(""),
39527
+ /* 186 */ "CursorHint" OpHelp(""),
39528
+ /* 187 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"),
39529
+ /* 188 */ "Noop" OpHelp(""),
39530
+ /* 189 */ "Explain" OpHelp(""),
39531
+ /* 190 */ "Abortable" OpHelp(""),
3953139532
};
3953239533
return azName[i];
3953339534
}
3953439535
#endif
3953539536
@@ -97040,10 +97041,11 @@
9704097041
sqlite3RCStrUnref);
9704197042
pDest->flags |= MEM_Term;
9704297043
}else{
9704397044
rc = sqlite3VdbeMemSetStr(pDest, pBuf, len, 0,
9704497045
sqlite3RCStrUnref);
97046
+ pDest->enc = encoding;
9704597047
}
9704697048
}else{
9704797049
rc = sqlite3VdbeMemFromBtree(pC->uc.pCursor, iOffset, len, pDest);
9704897050
if( rc ) return rc;
9704997051
sqlite3VdbeSerialGet((const u8*)pDest->z, t, pDest);
@@ -101615,28 +101617,10 @@
101615101617
printf("seekHit changes from %d to %d\n", pC->seekHit, pOp->p3);
101616101618
}
101617101619
#endif
101618101620
pC->seekHit = pOp->p3;
101619101621
}
101620
- break;
101621
-}
101622
-
101623
-/* Opcode: IfNotOpen P1 P2 * * *
101624
-** Synopsis: if( !csr[P1] ) goto P2
101625
-**
101626
-** If cursor P1 is not open or if P1 is set to a NULL row using the
101627
-** OP_NullRow opcode, then jump to instruction P2. Otherwise, fall through.
101628
-*/
101629
-case OP_IfNotOpen: { /* jump */
101630
- VdbeCursor *pCur;
101631
-
101632
- assert( pOp->p1>=0 && pOp->p1<p->nCursor );
101633
- pCur = p->apCsr[pOp->p1];
101634
- VdbeBranchTaken(pCur==0 || pCur->nullRow, 2);
101635
- if( pCur==0 || pCur->nullRow ){
101636
- goto jump_to_p2_and_check_for_interrupt;
101637
- }
101638101622
break;
101639101623
}
101640101624
101641101625
/* Opcode: Found P1 P2 P3 P4 *
101642101626
** Synopsis: key=r[P3@P4]
@@ -154169,11 +154153,11 @@
154169154153
** elements we are now copying in.
154170154154
*/
154171154155
pSub = pSub1;
154172154156
for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){
154173154157
int nSubSrc;
154174
- u8 jointype = pSubitem->fg.jointype;
154158
+ u8 jointype = pParent->pSrc->a[iFrom].fg.jointype;
154175154159
assert( pSub!=0 );
154176154160
pSubSrc = pSub->pSrc; /* FROM clause of subquery */
154177154161
nSubSrc = pSubSrc->nSrc; /* Number of terms in subquery FROM clause */
154178154162
pSrc = pParent->pSrc; /* FROM clause of the outer query */
154179154163
@@ -154194,11 +154178,10 @@
154194154178
*/
154195154179
if( nSubSrc>1 ){
154196154180
pSrc = sqlite3SrcListEnlarge(pParse, pSrc, nSubSrc-1,iFrom+1);
154197154181
if( pSrc==0 ) break;
154198154182
pParent->pSrc = pSrc;
154199
- pSubitem = &pSrc->a[iFrom];
154200154183
}
154201154184
154202154185
/* Transfer the FROM clause terms from the subquery into the
154203154186
** outer query.
154204154187
*/
@@ -154212,11 +154195,11 @@
154212154195
if( pItem->fg.isUsing ) sqlite3IdListDelete(db, pItem->u3.pUsing);
154213154196
*pItem = pSubSrc->a[i];
154214154197
pItem->fg.jointype |= (jointype & JT_LTORJ);
154215154198
memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i]));
154216154199
}
154217
- pSubitem->fg.jointype |= jointype;
154200
+ pSrc->a[iFrom].fg.jointype |= jointype;
154218154201
154219154202
/* Begin substituting subquery result set expressions for
154220154203
** references to the iParent in the outer query.
154221154204
**
154222154205
** Example:
@@ -155882,10 +155865,11 @@
155882155865
}
155883155866
}
155884155867
pRight = sqlite3Expr(db, TK_ID, zName);
155885155868
if( (pTabList->nSrc>1
155886155869
&& ( (pFrom->fg.jointype & JT_LTORJ)==0
155870
+ || zTName!=0
155887155871
|| (selFlags & SF_NestedFrom)!=0
155888155872
|| !inAnyUsingClause(zName,pFrom,pTabList->nSrc-i-1)
155889155873
)
155890155874
)
155891155875
|| IN_RENAME_OBJECT
@@ -177300,20 +177284,18 @@
177300177284
if( pIn->nPrefix ){
177301177285
int bEarlyOut =
177302177286
(pLoop->wsFlags & WHERE_VIRTUALTABLE)==0
177303177287
&& (pLoop->wsFlags & WHERE_IN_EARLYOUT)!=0;
177304177288
if( pLevel->iLeftJoin ){
177305
- /* For LEFT JOIN queries, cursor pIn->iCur may not have been
177306
- ** opened yet. This occurs for WHERE clauses such as
177307
- ** "a = ? AND b IN (...)", where the index is on (a, b). If
177308
- ** the RHS of the (a=?) is NULL, then the "b IN (...)" may
177309
- ** never have been coded, but the body of the loop run to
177310
- ** return the null-row. So, if the cursor is not open yet,
177311
- ** jump over the OP_Next or OP_Prev instruction about to
177312
- ** be coded. */
177313
- sqlite3VdbeAddOp2(v, OP_IfNotOpen, pIn->iCur,
177314
- sqlite3VdbeCurrentAddr(v) + 2 + bEarlyOut);
177289
+ /* For LEFT JOIN queries, cursor pIn->iCur might have been
177290
+ ** disabled by OP_NullRow. This occurs for WHERE clauses such
177291
+ ** as "a = ? AND b IN (...)", where the index is on (a, b).
177292
+ ** When the OP_IfNullRow jump is taken, the pIn->iBase register
177293
+ ** is NULLed out as a side effect. But as that register is not
177294
+ ** used when the jump is taken, the side-effect is harmless. */
177295
+ sqlite3VdbeAddOp3(v, OP_IfNullRow, pIn->iCur,
177296
+ sqlite3VdbeCurrentAddr(v) + 2 + bEarlyOut, pIn->iBase);
177315177297
VdbeCoverage(v);
177316177298
}
177317177299
if( bEarlyOut ){
177318177300
sqlite3VdbeAddOp4Int(v, OP_IfNoHope, pLevel->iIdxCur,
177319177301
sqlite3VdbeCurrentAddr(v)+2,
@@ -177377,10 +177359,19 @@
177377177359
int iDb = sqlite3SchemaToIndex(db, pIx->pSchema);
177378177360
sqlite3VdbeAddOp3(v, OP_ReopenIdx, pLevel->iIdxCur, pIx->tnum, iDb);
177379177361
sqlite3VdbeSetP4KeyInfo(pParse, pIx);
177380177362
}
177381177363
sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iIdxCur);
177364
+ }
177365
+ if( ws & WHERE_IN_ABLE ){
177366
+ int m;
177367
+ for(m=0; m<pLevel->u.in.nIn; m++){
177368
+ struct InLoop *pIn = &pLevel->u.in.aInLoop[m];
177369
+ if( pIn->eEndLoopOp!=OP_Noop ){
177370
+ sqlite3VdbeAddOp1(v, OP_NullRow, pIn->iCur);
177371
+ }
177372
+ }
177382177373
}
177383177374
if( pLevel->op==OP_Return ){
177384177375
sqlite3VdbeAddOp2(v, OP_Gosub, pLevel->p1, pLevel->addrFirst);
177385177376
}else{
177386177377
sqlite3VdbeGoto(v, pLevel->addrFirst);
@@ -178372,11 +178363,13 @@
178372178363
Expr *pDup = sqlite3ExprDup(pParse->db, pExpr, 0);
178373178364
if( pDup && pDup->op==TK_AGG_FUNCTION ) pDup->op = TK_FUNCTION;
178374178365
p->pSub = sqlite3ExprListAppend(pParse, p->pSub, pDup);
178375178366
}
178376178367
if( p->pSub ){
178377
- int f = pExpr->flags & EP_Collate;
178368
+ int f = pExpr->flags & (EP_Collate|EP_OuterON|EP_InnerON);
178369
+ int iJoin = pExpr->w.iJoin;
178370
+
178378178371
assert( ExprHasProperty(pExpr, EP_Static)==0 );
178379178372
ExprSetProperty(pExpr, EP_Static);
178380178373
sqlite3ExprDelete(pParse->db, pExpr);
178381178374
ExprClearProperty(pExpr, EP_Static);
178382178375
memset(pExpr, 0, sizeof(Expr));
@@ -178384,10 +178377,11 @@
178384178377
pExpr->op = TK_COLUMN;
178385178378
pExpr->iColumn = (iCol<0 ? p->pSub->nExpr-1: iCol);
178386178379
pExpr->iTable = p->pWin->iEphCsr;
178387178380
pExpr->y.pTab = p->pTab;
178388178381
pExpr->flags = f;
178382
+ if( (f & (EP_OuterON|EP_InnerON)) ) pExpr->w.iJoin = iJoin;
178389178383
}
178390178384
if( pParse->db->mallocFailed ) return WRC_Abort;
178391178385
break;
178392178386
}
178393178387
@@ -185494,11 +185488,15 @@
185494185488
}else{
185495185489
yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, yymsp[-3].minor.yy144 ? TK_OR : TK_AND, pB, yymsp[-4].minor.yy454);
185496185490
}
185497185491
}else{
185498185492
Expr *pRHS = yymsp[-1].minor.yy14->a[0].pExpr;
185499
- if( yymsp[-1].minor.yy14->nExpr==1 && sqlite3ExprIsConstant(pParse,pRHS) && yymsp[-4].minor.yy454->op!=TK_VECTOR ){
185493
+ if( yymsp[-1].minor.yy14->nExpr==1
185494
+ && sqlite3ExprIsConstant(pParse,pRHS)
185495
+ && pRHS->op!=TK_COLLATE
185496
+ && yymsp[-4].minor.yy454->op!=TK_VECTOR
185497
+ ){
185500185498
yymsp[-1].minor.yy14->a[0].pExpr = 0;
185501185499
sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14);
185502185500
pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0);
185503185501
yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy454, pRHS);
185504185502
}else if( yymsp[-1].minor.yy14->nExpr==1 && pRHS->op==TK_SELECT ){
@@ -265409,11 +265407,11 @@
265409265407
int nArg, /* Number of args */
265410265408
sqlite3_value **apUnused /* Function arguments */
265411265409
){
265412265410
assert( nArg==0 );
265413265411
UNUSED_PARAM2(nArg, apUnused);
265414
- sqlite3_result_text(pCtx, "fts5: 2026-10-06 14:34:02 adacd1423f159fa4698f7e40dd1488256a13dff0b31cc90e28c3441109596ef4", -1, SQLITE_TRANSIENT);
265412
+ sqlite3_result_text(pCtx, "fts5: 2026-10-09 11:47:51 a3332bd623d997921c3186433cd1eab0c9413aa0f68d93b1731cf80128ec3a36", -1, SQLITE_TRANSIENT);
265415265413
}
265416265414
265417265415
/*
265418265416
** Implementation of fts5_locale(LOCALE, TEXT) function.
265419265417
**
265420265418
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -16,11 +16,11 @@
16 ** if you want a wrapper to interface SQLite with your choice of programming
17 ** language. The code for the "sqlite3" command-line shell is also in a
18 ** separate file. This file contains only code for the core SQLite library.
19 **
20 ** The content in this amalgamation comes from Fossil check-in
21 ** a435d786fe0e245e352d08d2e2ddf8c1e151 with changes in files:
22 **
23 **
24 */
25 #ifndef SQLITE_AMALGAMATION
26 #define SQLITE_CORE 1
@@ -467,14 +467,14 @@
467 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
468 ** [sqlite_version()] and [sqlite_source_id()].
469 */
470 #define SQLITE_VERSION "3.54.0"
471 #define SQLITE_VERSION_NUMBER 3054000
472 #define SQLITE_SOURCE_ID "2026-10-06 18:52:47 a435d786fe0e245e352d08d2e2ddf8c1e15154809e3b471810cc327e9d90ef85"
473 #define SQLITE_SCM_BRANCH "trunk"
474 #define SQLITE_SCM_TAGS ""
475 #define SQLITE_SCM_DATETIME "2026-10-06T18:52:47.576Z"
476
477 /*
478 ** CAPI3REF: Run-Time Library Version Numbers
479 ** KEYWORDS: sqlite3_version sqlite3_sourceid
480 **
@@ -17890,88 +17890,88 @@
17890 #define OP_IfNullRow 20 /* jump, synopsis: if P1.nullRow then r[P3]=NULL, goto P2 */
17891 #define OP_SeekLT 21 /* jump0, synopsis: key=r[P3@P4] */
17892 #define OP_SeekLE 22 /* jump0, synopsis: key=r[P3@P4] */
17893 #define OP_SeekGE 23 /* jump0, synopsis: key=r[P3@P4] */
17894 #define OP_SeekGT 24 /* jump0, synopsis: key=r[P3@P4] */
17895 #define OP_IfNotOpen 25 /* jump, synopsis: if( !csr[P1] ) goto P2 */
17896 #define OP_IfNoHope 26 /* jump, synopsis: key=r[P3@P4] */
17897 #define OP_NoConflict 27 /* jump, synopsis: key=r[P3@P4] */
17898 #define OP_NotFound 28 /* jump, synopsis: key=r[P3@P4] */
17899 #define OP_Found 29 /* jump, synopsis: key=r[P3@P4] */
17900 #define OP_SeekRowid 30 /* jump0, synopsis: intkey=r[P3] */
17901 #define OP_NotExists 31 /* jump, synopsis: intkey=r[P3] */
17902 #define OP_Last 32 /* jump0 */
17903 #define OP_IfSizeBetween 33 /* jump */
17904 #define OP_SorterSort 34 /* jump */
17905 #define OP_Sort 35 /* jump */
17906 #define OP_Rewind 36 /* jump0 */
17907 #define OP_IfEmpty 37 /* jump, synopsis: if( empty(P1) ) goto P2 */
17908 #define OP_SorterNext 38 /* jump */
17909 #define OP_Prev 39 /* jump */
17910 #define OP_Next 40 /* jump */
17911 #define OP_IdxLE 41 /* jump, synopsis: key=r[P3@P4] */
17912 #define OP_IdxGT 42 /* jump, synopsis: key=r[P3@P4] */
17913 #define OP_Or 43 /* same as TK_OR, synopsis: r[P3]=(r[P1] || r[P2]) */
17914 #define OP_And 44 /* same as TK_AND, synopsis: r[P3]=(r[P1] && r[P2]) */
17915 #define OP_IdxLT 45 /* jump, synopsis: key=r[P3@P4] */
17916 #define OP_IdxGE 46 /* jump, synopsis: key=r[P3@P4] */
17917 #define OP_IFindKey 47 /* jump */
17918 #define OP_RowSetRead 48 /* jump, synopsis: r[P3]=rowset(P1) */
17919 #define OP_RowSetTest 49 /* jump, synopsis: if r[P3] in rowset(P1) goto P2 */
17920 #define OP_Program 50 /* jump0 */
17921 #define OP_IsNull 51 /* jump, same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */
17922 #define OP_NotNull 52 /* jump, same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */
17923 #define OP_Ne 53 /* jump, same as TK_NE, synopsis: IF r[P3]!=r[P1] */
17924 #define OP_Eq 54 /* jump, same as TK_EQ, synopsis: IF r[P3]==r[P1] */
17925 #define OP_Gt 55 /* jump, same as TK_GT, synopsis: IF r[P3]>r[P1] */
17926 #define OP_Le 56 /* jump, same as TK_LE, synopsis: IF r[P3]<=r[P1] */
17927 #define OP_Lt 57 /* jump, same as TK_LT, synopsis: IF r[P3]<r[P1] */
17928 #define OP_Ge 58 /* jump, same as TK_GE, synopsis: IF r[P3]>=r[P1] */
17929 #define OP_ElseEq 59 /* jump, same as TK_ESCAPE */
17930 #define OP_FkIfZero 60 /* jump, synopsis: if fkctr[P1]==0 goto P2 */
17931 #define OP_IfPos 61 /* jump, synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
17932 #define OP_IfNotZero 62 /* jump, synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
17933 #define OP_DecrJumpZero 63 /* jump, synopsis: if (--r[P1])==0 goto P2 */
17934 #define OP_IncrVacuum 64 /* jump */
17935 #define OP_VNext 65 /* jump */
17936 #define OP_Filter 66 /* jump, synopsis: if key(P3@P4) not in filter(P1) goto P2 */
17937 #define OP_PureFunc 67 /* synopsis: r[P3]=func(r[P2@NP]) */
17938 #define OP_Function 68 /* synopsis: r[P3]=func(r[P2@NP]) */
17939 #define OP_Return 69
17940 #define OP_EndCoroutine 70
17941 #define OP_HaltIfNull 71 /* synopsis: if r[P3]=null halt */
17942 #define OP_Halt 72
17943 #define OP_Integer 73 /* synopsis: r[P2]=P1 */
17944 #define OP_Int64 74 /* synopsis: r[P2]=PINT13 */
17945 #define OP_String 75 /* synopsis: r[P2]='P4' (len=P1) */
17946 #define OP_BeginSubrtn 76 /* synopsis: r[P2]=NULL */
17947 #define OP_Null 77 /* synopsis: r[P2..P3]=NULL */
17948 #define OP_SoftNull 78 /* synopsis: r[P1]=NULL */
17949 #define OP_Blob 79 /* synopsis: r[P2]=P4 (len=P1) */
17950 #define OP_Variable 80 /* synopsis: r[P2]=parameter(P1) */
17951 #define OP_Move 81 /* synopsis: r[P2@P3]=r[P1@P3] */
17952 #define OP_Copy 82 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
17953 #define OP_SCopy 83 /* synopsis: r[P2]=r[P1] */
17954 #define OP_IntCopy 84 /* synopsis: r[P2]=r[P1] */
17955 #define OP_FkCheck 85
17956 #define OP_ResultRow 86 /* synopsis: output=r[P1@P2] */
17957 #define OP_CollSeq 87
17958 #define OP_AddImm 88 /* synopsis: r[P1]=r[P1]+P2 */
17959 #define OP_RealAffinity 89
17960 #define OP_Cast 90 /* synopsis: affinity(r[P1]) */
17961 #define OP_Permutation 91
17962 #define OP_Compare 92 /* synopsis: r[P1@P3] <-> r[P2@P3] */
17963 #define OP_IsTrue 93 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
17964 #define OP_ZeroOrNull 94 /* synopsis: r[P2] = 0 OR NULL */
17965 #define OP_Offset 95 /* synopsis: r[P3] = sqlite_offset(P1) */
17966 #define OP_Column 96 /* synopsis: r[P3]=PX cursor P1 column P2 */
17967 #define OP_TypeCheck 97 /* synopsis: typecheck(r[P1@P2]) */
17968 #define OP_Affinity 98 /* synopsis: affinity(r[P1@P2]) */
17969 #define OP_MakeRecord 99 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
17970 #define OP_Count 100 /* synopsis: r[P2]=count() */
17971 #define OP_ReadCookie 101
17972 #define OP_SetCookie 102
17973 #define OP_BitAnd 103 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
17974 #define OP_BitOr 104 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
17975 #define OP_ShiftLeft 105 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
17976 #define OP_ShiftRight 106 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
17977 #define OP_Add 107 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
@@ -17978,89 +17978,88 @@
17978 #define OP_Subtract 108 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
17979 #define OP_Multiply 109 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
17980 #define OP_Divide 110 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
17981 #define OP_Remainder 111 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
17982 #define OP_Concat 112 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
17983 #define OP_ReopenIdx 113 /* synopsis: root=P2 iDb=P3 */
17984 #define OP_OpenRead 114 /* synopsis: root=P2 iDb=P3 */
17985 #define OP_BitNot 115 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
17986 #define OP_OpenWrite 116 /* synopsis: root=P2 iDb=P3 */
17987 #define OP_OpenDup 117
17988 #define OP_String8 118 /* same as TK_STRING, synopsis: r[P2]='P4' */
17989 #define OP_OpenAutoindex 119 /* synopsis: nColumn=P2 */
17990 #define OP_OpenEphemeral 120 /* synopsis: nColumn=P2 */
17991 #define OP_SorterOpen 121
17992 #define OP_SequenceTest 122 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
17993 #define OP_OpenPseudo 123 /* synopsis: P3 columns in r[P2] */
17994 #define OP_Close 124
17995 #define OP_ColumnsUsed 125 /* synopsis: Cursor P1 uses columns PHEX23 */
17996 #define OP_SeekScan 126 /* synopsis: Scan-ahead up to P1 rows */
17997 #define OP_SeekHit 127 /* synopsis: set P2<=seekHit<=P3 */
17998 #define OP_Sequence 128 /* synopsis: r[P2]=cursor[P1].ctr++ */
17999 #define OP_NewRowid 129 /* synopsis: r[P2]=rowid */
18000 #define OP_Insert 130 /* synopsis: intkey=r[P3] data=r[P2] */
18001 #define OP_RowCell 131
18002 #define OP_Delete 132
18003 #define OP_ResetCount 133
18004 #define OP_SorterCompare 134 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
18005 #define OP_SorterData 135 /* synopsis: r[P2]=data */
18006 #define OP_RowData 136 /* synopsis: r[P2]=data */
18007 #define OP_Rowid 137 /* synopsis: r[P2]=PX rowid of P1 */
18008 #define OP_NullRow 138
18009 #define OP_SeekEnd 139
18010 #define OP_IdxInsert 140 /* synopsis: key=r[P2] */
18011 #define OP_SorterInsert 141 /* synopsis: key=r[P2] */
18012 #define OP_IdxDelete 142 /* synopsis: key=r[P2@P5] */
18013 #define OP_DeferredSeek 143 /* synopsis: Move P3 to P1.rowid if needed */
18014 #define OP_IdxRowid 144 /* synopsis: r[P2]=rowid */
18015 #define OP_FinishSeek 145
18016 #define OP_Destroy 146
18017 #define OP_Clear 147
18018 #define OP_ResetSorter 148
18019 #define OP_CreateBtree 149 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
18020 #define OP_SqlExec 150
18021 #define OP_ParseSchema 151
18022 #define OP_LoadAnalysis 152
18023 #define OP_DropTable 153
18024 #define OP_Real 154 /* same as TK_FLOAT, synopsis: r[P2]=PDBL13 */
18025 #define OP_DropIndex 155
18026 #define OP_DropTrigger 156
18027 #define OP_IntegrityCk 157
18028 #define OP_RowSetAdd 158 /* synopsis: rowset(P1)=r[P2] */
18029 #define OP_Param 159
18030 #define OP_FkCounter 160 /* synopsis: fkctr[P1]+=P2 */
18031 #define OP_MemMax 161 /* synopsis: r[P1]=max(r[P1],r[P2]) */
18032 #define OP_OffsetLimit 162 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
18033 #define OP_AggInverse 163 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
18034 #define OP_AggStep 164 /* synopsis: accum=r[P3] step(r[P2@P5]) */
18035 #define OP_AggStep1 165 /* synopsis: accum=r[P3] step(r[P2@P5]) */
18036 #define OP_AggValue 166 /* synopsis: r[P3]=value N=P2 */
18037 #define OP_AggFinal 167 /* synopsis: accum=r[P1] N=P2 */
18038 #define OP_Expire 168
18039 #define OP_CursorLock 169
18040 #define OP_CursorUnlock 170
18041 #define OP_TableLock 171 /* synopsis: iDb=P1 root=P2 write=P3 */
18042 #define OP_VBegin 172
18043 #define OP_VCreate 173
18044 #define OP_VDestroy 174
18045 #define OP_VOpen 175
18046 #define OP_VCheck 176
18047 #define OP_VInitIn 177 /* synopsis: r[P2]=ValueList(P1,P3) */
18048 #define OP_VColumn 178 /* synopsis: r[P3]=vcolumn(P2) */
18049 #define OP_VRename 179
18050 #define OP_Pagecount 180
18051 #define OP_MaxPgcnt 181
18052 #define OP_ClrSubtype 182 /* synopsis: r[P1].subtype = 0 */
18053 #define OP_GetSubtype 183 /* synopsis: r[P2] = r[P1].subtype */
18054 #define OP_SetSubtype 184 /* synopsis: r[P2].subtype = r[P1] */
18055 #define OP_FilterAdd 185 /* synopsis: filter(P1) += key(P3@P4) */
18056 #define OP_Trace 186
18057 #define OP_CursorHint 187
18058 #define OP_ReleaseReg 188 /* synopsis: release r[P1@P2] mask P3 */
18059 #define OP_Noop 189
18060 #define OP_Explain 190
18061 #define OP_Abortable 191
18062
18063 /* Properties such as "out2" or "jump" that are specified in
18064 ** comments following the "case" for each opcode in the vdbe.c
18065 ** are encoded into bitvectors as follows:
18066 */
@@ -18074,40 +18073,39 @@
18074 #define OPFLG_JUMP0 0x80 /* jump0: P2 might be zero */
18075 #define OPFLG_INITIALIZER {\
18076 /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x41, 0x00,\
18077 /* 8 */ 0x81, 0x01, 0x01, 0x81, 0x83, 0x83, 0x01, 0x01,\
18078 /* 16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0xc9, 0xc9, 0xc9,\
18079 /* 24 */ 0xc9, 0x01, 0x49, 0x49, 0x49, 0x49, 0xc9, 0x49,\
18080 /* 32 */ 0xc1, 0x01, 0x41, 0x41, 0xc1, 0x01, 0x01, 0x41,\
18081 /* 40 */ 0x41, 0x41, 0x41, 0x26, 0x26, 0x41, 0x41, 0x09,\
18082 /* 48 */ 0x23, 0x0b, 0x81, 0x03, 0x03, 0x0b, 0x0b, 0x0b,\
18083 /* 56 */ 0x0b, 0x0b, 0x0b, 0x01, 0x01, 0x03, 0x03, 0x03,\
18084 /* 64 */ 0x01, 0x41, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08,\
18085 /* 72 */ 0x00, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x10,\
18086 /* 80 */ 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00,\
18087 /* 88 */ 0x02, 0x02, 0x02, 0x00, 0x00, 0x12, 0x1e, 0x20,\
18088 /* 96 */ 0x40, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x26,\
18089 /* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\
18090 /* 112 */ 0x26, 0x40, 0x40, 0x12, 0x00, 0x40, 0x10, 0x40,\
18091 /* 120 */ 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x40,\
18092 /* 128 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,\
18093 /* 136 */ 0x00, 0x50, 0x00, 0x40, 0x04, 0x04, 0x00, 0x40,\
18094 /* 144 */ 0x50, 0x40, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00,\
18095 /* 152 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x06, 0x10,\
18096 /* 160 */ 0x00, 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00,\
18097 /* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,\
18098 /* 176 */ 0x10, 0x50, 0x40, 0x00, 0x10, 0x10, 0x02, 0x12,\
18099 /* 184 */ 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
18100 }
18101
18102 /* The resolve3P2Values() routine is able to run faster if it knows
18103 ** the value of the largest JUMP opcode. The smaller the maximum
18104 ** JUMP opcode the better, so the mkopcodeh.tcl script that
18105 ** generated this include file strives to group all JUMP opcodes
18106 ** together near the beginning of the list.
18107 */
18108 #define SQLITE_MX_JUMP_OPCODE 66 /* Maximum JUMP opcode */
18109
18110 /************** End of opcodes.h *********************************************/
18111 /************** Continuing where we left off in vdbe.h ***********************/
18112
18113 /*
@@ -35061,10 +35059,14 @@
35061 }
35062 case TK_ID: {
35063 assert( !ExprHasProperty(pExpr, EP_IntValue) );
35064 sqlite3TreeViewLine(pView,"ID \"%w\"", pExpr->u.zToken);
35065 break;
 
 
 
 
35066 }
35067 #ifndef SQLITE_OMIT_CAST
35068 case TK_CAST: {
35069 /* Expressions of the form: CAST(pLeft AS token) */
35070 assert( !ExprHasProperty(pExpr, EP_IntValue) );
@@ -39359,88 +39361,88 @@
39359 /* 20 */ "IfNullRow" OpHelp("if P1.nullRow then r[P3]=NULL, goto P2"),
39360 /* 21 */ "SeekLT" OpHelp("key=r[P3@P4]"),
39361 /* 22 */ "SeekLE" OpHelp("key=r[P3@P4]"),
39362 /* 23 */ "SeekGE" OpHelp("key=r[P3@P4]"),
39363 /* 24 */ "SeekGT" OpHelp("key=r[P3@P4]"),
39364 /* 25 */ "IfNotOpen" OpHelp("if( !csr[P1] ) goto P2"),
39365 /* 26 */ "IfNoHope" OpHelp("key=r[P3@P4]"),
39366 /* 27 */ "NoConflict" OpHelp("key=r[P3@P4]"),
39367 /* 28 */ "NotFound" OpHelp("key=r[P3@P4]"),
39368 /* 29 */ "Found" OpHelp("key=r[P3@P4]"),
39369 /* 30 */ "SeekRowid" OpHelp("intkey=r[P3]"),
39370 /* 31 */ "NotExists" OpHelp("intkey=r[P3]"),
39371 /* 32 */ "Last" OpHelp(""),
39372 /* 33 */ "IfSizeBetween" OpHelp(""),
39373 /* 34 */ "SorterSort" OpHelp(""),
39374 /* 35 */ "Sort" OpHelp(""),
39375 /* 36 */ "Rewind" OpHelp(""),
39376 /* 37 */ "IfEmpty" OpHelp("if( empty(P1) ) goto P2"),
39377 /* 38 */ "SorterNext" OpHelp(""),
39378 /* 39 */ "Prev" OpHelp(""),
39379 /* 40 */ "Next" OpHelp(""),
39380 /* 41 */ "IdxLE" OpHelp("key=r[P3@P4]"),
39381 /* 42 */ "IdxGT" OpHelp("key=r[P3@P4]"),
39382 /* 43 */ "Or" OpHelp("r[P3]=(r[P1] || r[P2])"),
39383 /* 44 */ "And" OpHelp("r[P3]=(r[P1] && r[P2])"),
39384 /* 45 */ "IdxLT" OpHelp("key=r[P3@P4]"),
39385 /* 46 */ "IdxGE" OpHelp("key=r[P3@P4]"),
39386 /* 47 */ "IFindKey" OpHelp(""),
39387 /* 48 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"),
39388 /* 49 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"),
39389 /* 50 */ "Program" OpHelp(""),
39390 /* 51 */ "IsNull" OpHelp("if r[P1]==NULL goto P2"),
39391 /* 52 */ "NotNull" OpHelp("if r[P1]!=NULL goto P2"),
39392 /* 53 */ "Ne" OpHelp("IF r[P3]!=r[P1]"),
39393 /* 54 */ "Eq" OpHelp("IF r[P3]==r[P1]"),
39394 /* 55 */ "Gt" OpHelp("IF r[P3]>r[P1]"),
39395 /* 56 */ "Le" OpHelp("IF r[P3]<=r[P1]"),
39396 /* 57 */ "Lt" OpHelp("IF r[P3]<r[P1]"),
39397 /* 58 */ "Ge" OpHelp("IF r[P3]>=r[P1]"),
39398 /* 59 */ "ElseEq" OpHelp(""),
39399 /* 60 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
39400 /* 61 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"),
39401 /* 62 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
39402 /* 63 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
39403 /* 64 */ "IncrVacuum" OpHelp(""),
39404 /* 65 */ "VNext" OpHelp(""),
39405 /* 66 */ "Filter" OpHelp("if key(P3@P4) not in filter(P1) goto P2"),
39406 /* 67 */ "PureFunc" OpHelp("r[P3]=func(r[P2@NP])"),
39407 /* 68 */ "Function" OpHelp("r[P3]=func(r[P2@NP])"),
39408 /* 69 */ "Return" OpHelp(""),
39409 /* 70 */ "EndCoroutine" OpHelp(""),
39410 /* 71 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
39411 /* 72 */ "Halt" OpHelp(""),
39412 /* 73 */ "Integer" OpHelp("r[P2]=P1"),
39413 /* 74 */ "Int64" OpHelp("r[P2]=PINT13"),
39414 /* 75 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
39415 /* 76 */ "BeginSubrtn" OpHelp("r[P2]=NULL"),
39416 /* 77 */ "Null" OpHelp("r[P2..P3]=NULL"),
39417 /* 78 */ "SoftNull" OpHelp("r[P1]=NULL"),
39418 /* 79 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
39419 /* 80 */ "Variable" OpHelp("r[P2]=parameter(P1)"),
39420 /* 81 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
39421 /* 82 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
39422 /* 83 */ "SCopy" OpHelp("r[P2]=r[P1]"),
39423 /* 84 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
39424 /* 85 */ "FkCheck" OpHelp(""),
39425 /* 86 */ "ResultRow" OpHelp("output=r[P1@P2]"),
39426 /* 87 */ "CollSeq" OpHelp(""),
39427 /* 88 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
39428 /* 89 */ "RealAffinity" OpHelp(""),
39429 /* 90 */ "Cast" OpHelp("affinity(r[P1])"),
39430 /* 91 */ "Permutation" OpHelp(""),
39431 /* 92 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
39432 /* 93 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
39433 /* 94 */ "ZeroOrNull" OpHelp("r[P2] = 0 OR NULL"),
39434 /* 95 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
39435 /* 96 */ "Column" OpHelp("r[P3]=PX cursor P1 column P2"),
39436 /* 97 */ "TypeCheck" OpHelp("typecheck(r[P1@P2])"),
39437 /* 98 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
39438 /* 99 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
39439 /* 100 */ "Count" OpHelp("r[P2]=count()"),
39440 /* 101 */ "ReadCookie" OpHelp(""),
39441 /* 102 */ "SetCookie" OpHelp(""),
39442 /* 103 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
39443 /* 104 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
39444 /* 105 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
39445 /* 106 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
39446 /* 107 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
@@ -39447,89 +39449,88 @@
39447 /* 108 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
39448 /* 109 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
39449 /* 110 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
39450 /* 111 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
39451 /* 112 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
39452 /* 113 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
39453 /* 114 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
39454 /* 115 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
39455 /* 116 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
39456 /* 117 */ "OpenDup" OpHelp(""),
39457 /* 118 */ "String8" OpHelp("r[P2]='P4'"),
39458 /* 119 */ "OpenAutoindex" OpHelp("nColumn=P2"),
39459 /* 120 */ "OpenEphemeral" OpHelp("nColumn=P2"),
39460 /* 121 */ "SorterOpen" OpHelp(""),
39461 /* 122 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
39462 /* 123 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
39463 /* 124 */ "Close" OpHelp(""),
39464 /* 125 */ "ColumnsUsed" OpHelp("Cursor P1 uses columns PHEX23"),
39465 /* 126 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
39466 /* 127 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
39467 /* 128 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
39468 /* 129 */ "NewRowid" OpHelp("r[P2]=rowid"),
39469 /* 130 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
39470 /* 131 */ "RowCell" OpHelp(""),
39471 /* 132 */ "Delete" OpHelp(""),
39472 /* 133 */ "ResetCount" OpHelp(""),
39473 /* 134 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
39474 /* 135 */ "SorterData" OpHelp("r[P2]=data"),
39475 /* 136 */ "RowData" OpHelp("r[P2]=data"),
39476 /* 137 */ "Rowid" OpHelp("r[P2]=PX rowid of P1"),
39477 /* 138 */ "NullRow" OpHelp(""),
39478 /* 139 */ "SeekEnd" OpHelp(""),
39479 /* 140 */ "IdxInsert" OpHelp("key=r[P2]"),
39480 /* 141 */ "SorterInsert" OpHelp("key=r[P2]"),
39481 /* 142 */ "IdxDelete" OpHelp("key=r[P2@P5]"),
39482 /* 143 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
39483 /* 144 */ "IdxRowid" OpHelp("r[P2]=rowid"),
39484 /* 145 */ "FinishSeek" OpHelp(""),
39485 /* 146 */ "Destroy" OpHelp(""),
39486 /* 147 */ "Clear" OpHelp(""),
39487 /* 148 */ "ResetSorter" OpHelp(""),
39488 /* 149 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
39489 /* 150 */ "SqlExec" OpHelp(""),
39490 /* 151 */ "ParseSchema" OpHelp(""),
39491 /* 152 */ "LoadAnalysis" OpHelp(""),
39492 /* 153 */ "DropTable" OpHelp(""),
39493 /* 154 */ "Real" OpHelp("r[P2]=PDBL13"),
39494 /* 155 */ "DropIndex" OpHelp(""),
39495 /* 156 */ "DropTrigger" OpHelp(""),
39496 /* 157 */ "IntegrityCk" OpHelp(""),
39497 /* 158 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
39498 /* 159 */ "Param" OpHelp(""),
39499 /* 160 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
39500 /* 161 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
39501 /* 162 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
39502 /* 163 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
39503 /* 164 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
39504 /* 165 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
39505 /* 166 */ "AggValue" OpHelp("r[P3]=value N=P2"),
39506 /* 167 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
39507 /* 168 */ "Expire" OpHelp(""),
39508 /* 169 */ "CursorLock" OpHelp(""),
39509 /* 170 */ "CursorUnlock" OpHelp(""),
39510 /* 171 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
39511 /* 172 */ "VBegin" OpHelp(""),
39512 /* 173 */ "VCreate" OpHelp(""),
39513 /* 174 */ "VDestroy" OpHelp(""),
39514 /* 175 */ "VOpen" OpHelp(""),
39515 /* 176 */ "VCheck" OpHelp(""),
39516 /* 177 */ "VInitIn" OpHelp("r[P2]=ValueList(P1,P3)"),
39517 /* 178 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
39518 /* 179 */ "VRename" OpHelp(""),
39519 /* 180 */ "Pagecount" OpHelp(""),
39520 /* 181 */ "MaxPgcnt" OpHelp(""),
39521 /* 182 */ "ClrSubtype" OpHelp("r[P1].subtype = 0"),
39522 /* 183 */ "GetSubtype" OpHelp("r[P2] = r[P1].subtype"),
39523 /* 184 */ "SetSubtype" OpHelp("r[P2].subtype = r[P1]"),
39524 /* 185 */ "FilterAdd" OpHelp("filter(P1) += key(P3@P4)"),
39525 /* 186 */ "Trace" OpHelp(""),
39526 /* 187 */ "CursorHint" OpHelp(""),
39527 /* 188 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"),
39528 /* 189 */ "Noop" OpHelp(""),
39529 /* 190 */ "Explain" OpHelp(""),
39530 /* 191 */ "Abortable" OpHelp(""),
39531 };
39532 return azName[i];
39533 }
39534 #endif
39535
@@ -97040,10 +97041,11 @@
97040 sqlite3RCStrUnref);
97041 pDest->flags |= MEM_Term;
97042 }else{
97043 rc = sqlite3VdbeMemSetStr(pDest, pBuf, len, 0,
97044 sqlite3RCStrUnref);
 
97045 }
97046 }else{
97047 rc = sqlite3VdbeMemFromBtree(pC->uc.pCursor, iOffset, len, pDest);
97048 if( rc ) return rc;
97049 sqlite3VdbeSerialGet((const u8*)pDest->z, t, pDest);
@@ -101615,28 +101617,10 @@
101615 printf("seekHit changes from %d to %d\n", pC->seekHit, pOp->p3);
101616 }
101617 #endif
101618 pC->seekHit = pOp->p3;
101619 }
101620 break;
101621 }
101622
101623 /* Opcode: IfNotOpen P1 P2 * * *
101624 ** Synopsis: if( !csr[P1] ) goto P2
101625 **
101626 ** If cursor P1 is not open or if P1 is set to a NULL row using the
101627 ** OP_NullRow opcode, then jump to instruction P2. Otherwise, fall through.
101628 */
101629 case OP_IfNotOpen: { /* jump */
101630 VdbeCursor *pCur;
101631
101632 assert( pOp->p1>=0 && pOp->p1<p->nCursor );
101633 pCur = p->apCsr[pOp->p1];
101634 VdbeBranchTaken(pCur==0 || pCur->nullRow, 2);
101635 if( pCur==0 || pCur->nullRow ){
101636 goto jump_to_p2_and_check_for_interrupt;
101637 }
101638 break;
101639 }
101640
101641 /* Opcode: Found P1 P2 P3 P4 *
101642 ** Synopsis: key=r[P3@P4]
@@ -154169,11 +154153,11 @@
154169 ** elements we are now copying in.
154170 */
154171 pSub = pSub1;
154172 for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){
154173 int nSubSrc;
154174 u8 jointype = pSubitem->fg.jointype;
154175 assert( pSub!=0 );
154176 pSubSrc = pSub->pSrc; /* FROM clause of subquery */
154177 nSubSrc = pSubSrc->nSrc; /* Number of terms in subquery FROM clause */
154178 pSrc = pParent->pSrc; /* FROM clause of the outer query */
154179
@@ -154194,11 +154178,10 @@
154194 */
154195 if( nSubSrc>1 ){
154196 pSrc = sqlite3SrcListEnlarge(pParse, pSrc, nSubSrc-1,iFrom+1);
154197 if( pSrc==0 ) break;
154198 pParent->pSrc = pSrc;
154199 pSubitem = &pSrc->a[iFrom];
154200 }
154201
154202 /* Transfer the FROM clause terms from the subquery into the
154203 ** outer query.
154204 */
@@ -154212,11 +154195,11 @@
154212 if( pItem->fg.isUsing ) sqlite3IdListDelete(db, pItem->u3.pUsing);
154213 *pItem = pSubSrc->a[i];
154214 pItem->fg.jointype |= (jointype & JT_LTORJ);
154215 memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i]));
154216 }
154217 pSubitem->fg.jointype |= jointype;
154218
154219 /* Begin substituting subquery result set expressions for
154220 ** references to the iParent in the outer query.
154221 **
154222 ** Example:
@@ -155882,10 +155865,11 @@
155882 }
155883 }
155884 pRight = sqlite3Expr(db, TK_ID, zName);
155885 if( (pTabList->nSrc>1
155886 && ( (pFrom->fg.jointype & JT_LTORJ)==0
 
155887 || (selFlags & SF_NestedFrom)!=0
155888 || !inAnyUsingClause(zName,pFrom,pTabList->nSrc-i-1)
155889 )
155890 )
155891 || IN_RENAME_OBJECT
@@ -177300,20 +177284,18 @@
177300 if( pIn->nPrefix ){
177301 int bEarlyOut =
177302 (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0
177303 && (pLoop->wsFlags & WHERE_IN_EARLYOUT)!=0;
177304 if( pLevel->iLeftJoin ){
177305 /* For LEFT JOIN queries, cursor pIn->iCur may not have been
177306 ** opened yet. This occurs for WHERE clauses such as
177307 ** "a = ? AND b IN (...)", where the index is on (a, b). If
177308 ** the RHS of the (a=?) is NULL, then the "b IN (...)" may
177309 ** never have been coded, but the body of the loop run to
177310 ** return the null-row. So, if the cursor is not open yet,
177311 ** jump over the OP_Next or OP_Prev instruction about to
177312 ** be coded. */
177313 sqlite3VdbeAddOp2(v, OP_IfNotOpen, pIn->iCur,
177314 sqlite3VdbeCurrentAddr(v) + 2 + bEarlyOut);
177315 VdbeCoverage(v);
177316 }
177317 if( bEarlyOut ){
177318 sqlite3VdbeAddOp4Int(v, OP_IfNoHope, pLevel->iIdxCur,
177319 sqlite3VdbeCurrentAddr(v)+2,
@@ -177377,10 +177359,19 @@
177377 int iDb = sqlite3SchemaToIndex(db, pIx->pSchema);
177378 sqlite3VdbeAddOp3(v, OP_ReopenIdx, pLevel->iIdxCur, pIx->tnum, iDb);
177379 sqlite3VdbeSetP4KeyInfo(pParse, pIx);
177380 }
177381 sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iIdxCur);
 
 
 
 
 
 
 
 
 
177382 }
177383 if( pLevel->op==OP_Return ){
177384 sqlite3VdbeAddOp2(v, OP_Gosub, pLevel->p1, pLevel->addrFirst);
177385 }else{
177386 sqlite3VdbeGoto(v, pLevel->addrFirst);
@@ -178372,11 +178363,13 @@
178372 Expr *pDup = sqlite3ExprDup(pParse->db, pExpr, 0);
178373 if( pDup && pDup->op==TK_AGG_FUNCTION ) pDup->op = TK_FUNCTION;
178374 p->pSub = sqlite3ExprListAppend(pParse, p->pSub, pDup);
178375 }
178376 if( p->pSub ){
178377 int f = pExpr->flags & EP_Collate;
 
 
178378 assert( ExprHasProperty(pExpr, EP_Static)==0 );
178379 ExprSetProperty(pExpr, EP_Static);
178380 sqlite3ExprDelete(pParse->db, pExpr);
178381 ExprClearProperty(pExpr, EP_Static);
178382 memset(pExpr, 0, sizeof(Expr));
@@ -178384,10 +178377,11 @@
178384 pExpr->op = TK_COLUMN;
178385 pExpr->iColumn = (iCol<0 ? p->pSub->nExpr-1: iCol);
178386 pExpr->iTable = p->pWin->iEphCsr;
178387 pExpr->y.pTab = p->pTab;
178388 pExpr->flags = f;
 
178389 }
178390 if( pParse->db->mallocFailed ) return WRC_Abort;
178391 break;
178392 }
178393
@@ -185494,11 +185488,15 @@
185494 }else{
185495 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, yymsp[-3].minor.yy144 ? TK_OR : TK_AND, pB, yymsp[-4].minor.yy454);
185496 }
185497 }else{
185498 Expr *pRHS = yymsp[-1].minor.yy14->a[0].pExpr;
185499 if( yymsp[-1].minor.yy14->nExpr==1 && sqlite3ExprIsConstant(pParse,pRHS) && yymsp[-4].minor.yy454->op!=TK_VECTOR ){
 
 
 
 
185500 yymsp[-1].minor.yy14->a[0].pExpr = 0;
185501 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14);
185502 pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0);
185503 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy454, pRHS);
185504 }else if( yymsp[-1].minor.yy14->nExpr==1 && pRHS->op==TK_SELECT ){
@@ -265409,11 +265407,11 @@
265409 int nArg, /* Number of args */
265410 sqlite3_value **apUnused /* Function arguments */
265411 ){
265412 assert( nArg==0 );
265413 UNUSED_PARAM2(nArg, apUnused);
265414 sqlite3_result_text(pCtx, "fts5: 2026-10-06 14:34:02 adacd1423f159fa4698f7e40dd1488256a13dff0b31cc90e28c3441109596ef4", -1, SQLITE_TRANSIENT);
265415 }
265416
265417 /*
265418 ** Implementation of fts5_locale(LOCALE, TEXT) function.
265419 **
265420
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -16,11 +16,11 @@
16 ** if you want a wrapper to interface SQLite with your choice of programming
17 ** language. The code for the "sqlite3" command-line shell is also in a
18 ** separate file. This file contains only code for the core SQLite library.
19 **
20 ** The content in this amalgamation comes from Fossil check-in
21 ** a3332bd623d997921c3186433cd1eab0c941 with changes in files:
22 **
23 **
24 */
25 #ifndef SQLITE_AMALGAMATION
26 #define SQLITE_CORE 1
@@ -467,14 +467,14 @@
467 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
468 ** [sqlite_version()] and [sqlite_source_id()].
469 */
470 #define SQLITE_VERSION "3.54.0"
471 #define SQLITE_VERSION_NUMBER 3054000
472 #define SQLITE_SOURCE_ID "2026-10-09 11:47:51 a3332bd623d997921c3186433cd1eab0c9413aa0f68d93b1731cf80128ec3a36"
473 #define SQLITE_SCM_BRANCH "trunk"
474 #define SQLITE_SCM_TAGS ""
475 #define SQLITE_SCM_DATETIME "2026-10-09T11:47:51.732Z"
476
477 /*
478 ** CAPI3REF: Run-Time Library Version Numbers
479 ** KEYWORDS: sqlite3_version sqlite3_sourceid
480 **
@@ -17890,88 +17890,88 @@
17890 #define OP_IfNullRow 20 /* jump, synopsis: if P1.nullRow then r[P3]=NULL, goto P2 */
17891 #define OP_SeekLT 21 /* jump0, synopsis: key=r[P3@P4] */
17892 #define OP_SeekLE 22 /* jump0, synopsis: key=r[P3@P4] */
17893 #define OP_SeekGE 23 /* jump0, synopsis: key=r[P3@P4] */
17894 #define OP_SeekGT 24 /* jump0, synopsis: key=r[P3@P4] */
17895 #define OP_IfNoHope 25 /* jump, synopsis: key=r[P3@P4] */
17896 #define OP_NoConflict 26 /* jump, synopsis: key=r[P3@P4] */
17897 #define OP_NotFound 27 /* jump, synopsis: key=r[P3@P4] */
17898 #define OP_Found 28 /* jump, synopsis: key=r[P3@P4] */
17899 #define OP_SeekRowid 29 /* jump0, synopsis: intkey=r[P3] */
17900 #define OP_NotExists 30 /* jump, synopsis: intkey=r[P3] */
17901 #define OP_Last 31 /* jump0 */
17902 #define OP_IfSizeBetween 32 /* jump */
17903 #define OP_SorterSort 33 /* jump */
17904 #define OP_Sort 34 /* jump */
17905 #define OP_Rewind 35 /* jump0 */
17906 #define OP_IfEmpty 36 /* jump, synopsis: if( empty(P1) ) goto P2 */
17907 #define OP_SorterNext 37 /* jump */
17908 #define OP_Prev 38 /* jump */
17909 #define OP_Next 39 /* jump */
17910 #define OP_IdxLE 40 /* jump, synopsis: key=r[P3@P4] */
17911 #define OP_IdxGT 41 /* jump, synopsis: key=r[P3@P4] */
17912 #define OP_IdxLT 42 /* jump, synopsis: key=r[P3@P4] */
17913 #define OP_Or 43 /* same as TK_OR, synopsis: r[P3]=(r[P1] || r[P2]) */
17914 #define OP_And 44 /* same as TK_AND, synopsis: r[P3]=(r[P1] && r[P2]) */
17915 #define OP_IdxGE 45 /* jump, synopsis: key=r[P3@P4] */
17916 #define OP_IFindKey 46 /* jump */
17917 #define OP_RowSetRead 47 /* jump, synopsis: r[P3]=rowset(P1) */
17918 #define OP_RowSetTest 48 /* jump, synopsis: if r[P3] in rowset(P1) goto P2 */
17919 #define OP_Program 49 /* jump0 */
17920 #define OP_FkIfZero 50 /* jump, synopsis: if fkctr[P1]==0 goto P2 */
17921 #define OP_IsNull 51 /* jump, same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */
17922 #define OP_NotNull 52 /* jump, same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */
17923 #define OP_Ne 53 /* jump, same as TK_NE, synopsis: IF r[P3]!=r[P1] */
17924 #define OP_Eq 54 /* jump, same as TK_EQ, synopsis: IF r[P3]==r[P1] */
17925 #define OP_Gt 55 /* jump, same as TK_GT, synopsis: IF r[P3]>r[P1] */
17926 #define OP_Le 56 /* jump, same as TK_LE, synopsis: IF r[P3]<=r[P1] */
17927 #define OP_Lt 57 /* jump, same as TK_LT, synopsis: IF r[P3]<r[P1] */
17928 #define OP_Ge 58 /* jump, same as TK_GE, synopsis: IF r[P3]>=r[P1] */
17929 #define OP_ElseEq 59 /* jump, same as TK_ESCAPE */
17930 #define OP_IfPos 60 /* jump, synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
17931 #define OP_IfNotZero 61 /* jump, synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
17932 #define OP_DecrJumpZero 62 /* jump, synopsis: if (--r[P1])==0 goto P2 */
17933 #define OP_IncrVacuum 63 /* jump */
17934 #define OP_VNext 64 /* jump */
17935 #define OP_Filter 65 /* jump, synopsis: if key(P3@P4) not in filter(P1) goto P2 */
17936 #define OP_PureFunc 66 /* synopsis: r[P3]=func(r[P2@NP]) */
17937 #define OP_Function 67 /* synopsis: r[P3]=func(r[P2@NP]) */
17938 #define OP_Return 68
17939 #define OP_EndCoroutine 69
17940 #define OP_HaltIfNull 70 /* synopsis: if r[P3]=null halt */
17941 #define OP_Halt 71
17942 #define OP_Integer 72 /* synopsis: r[P2]=P1 */
17943 #define OP_Int64 73 /* synopsis: r[P2]=PINT13 */
17944 #define OP_String 74 /* synopsis: r[P2]='P4' (len=P1) */
17945 #define OP_BeginSubrtn 75 /* synopsis: r[P2]=NULL */
17946 #define OP_Null 76 /* synopsis: r[P2..P3]=NULL */
17947 #define OP_SoftNull 77 /* synopsis: r[P1]=NULL */
17948 #define OP_Blob 78 /* synopsis: r[P2]=P4 (len=P1) */
17949 #define OP_Variable 79 /* synopsis: r[P2]=parameter(P1) */
17950 #define OP_Move 80 /* synopsis: r[P2@P3]=r[P1@P3] */
17951 #define OP_Copy 81 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
17952 #define OP_SCopy 82 /* synopsis: r[P2]=r[P1] */
17953 #define OP_IntCopy 83 /* synopsis: r[P2]=r[P1] */
17954 #define OP_FkCheck 84
17955 #define OP_ResultRow 85 /* synopsis: output=r[P1@P2] */
17956 #define OP_CollSeq 86
17957 #define OP_AddImm 87 /* synopsis: r[P1]=r[P1]+P2 */
17958 #define OP_RealAffinity 88
17959 #define OP_Cast 89 /* synopsis: affinity(r[P1]) */
17960 #define OP_Permutation 90
17961 #define OP_Compare 91 /* synopsis: r[P1@P3] <-> r[P2@P3] */
17962 #define OP_IsTrue 92 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
17963 #define OP_ZeroOrNull 93 /* synopsis: r[P2] = 0 OR NULL */
17964 #define OP_Offset 94 /* synopsis: r[P3] = sqlite_offset(P1) */
17965 #define OP_Column 95 /* synopsis: r[P3]=PX cursor P1 column P2 */
17966 #define OP_TypeCheck 96 /* synopsis: typecheck(r[P1@P2]) */
17967 #define OP_Affinity 97 /* synopsis: affinity(r[P1@P2]) */
17968 #define OP_MakeRecord 98 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
17969 #define OP_Count 99 /* synopsis: r[P2]=count() */
17970 #define OP_ReadCookie 100
17971 #define OP_SetCookie 101
17972 #define OP_ReopenIdx 102 /* synopsis: root=P2 iDb=P3 */
17973 #define OP_BitAnd 103 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
17974 #define OP_BitOr 104 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
17975 #define OP_ShiftLeft 105 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
17976 #define OP_ShiftRight 106 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
17977 #define OP_Add 107 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
@@ -17978,89 +17978,88 @@
17978 #define OP_Subtract 108 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
17979 #define OP_Multiply 109 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
17980 #define OP_Divide 110 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
17981 #define OP_Remainder 111 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
17982 #define OP_Concat 112 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
17983 #define OP_OpenRead 113 /* synopsis: root=P2 iDb=P3 */
17984 #define OP_OpenWrite 114 /* synopsis: root=P2 iDb=P3 */
17985 #define OP_BitNot 115 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
17986 #define OP_OpenDup 116
17987 #define OP_OpenAutoindex 117 /* synopsis: nColumn=P2 */
17988 #define OP_String8 118 /* same as TK_STRING, synopsis: r[P2]='P4' */
17989 #define OP_OpenEphemeral 119 /* synopsis: nColumn=P2 */
17990 #define OP_SorterOpen 120
17991 #define OP_SequenceTest 121 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
17992 #define OP_OpenPseudo 122 /* synopsis: P3 columns in r[P2] */
17993 #define OP_Close 123
17994 #define OP_ColumnsUsed 124 /* synopsis: Cursor P1 uses columns PHEX23 */
17995 #define OP_SeekScan 125 /* synopsis: Scan-ahead up to P1 rows */
17996 #define OP_SeekHit 126 /* synopsis: set P2<=seekHit<=P3 */
17997 #define OP_Sequence 127 /* synopsis: r[P2]=cursor[P1].ctr++ */
17998 #define OP_NewRowid 128 /* synopsis: r[P2]=rowid */
17999 #define OP_Insert 129 /* synopsis: intkey=r[P3] data=r[P2] */
18000 #define OP_RowCell 130
18001 #define OP_Delete 131
18002 #define OP_ResetCount 132
18003 #define OP_SorterCompare 133 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
18004 #define OP_SorterData 134 /* synopsis: r[P2]=data */
18005 #define OP_RowData 135 /* synopsis: r[P2]=data */
18006 #define OP_Rowid 136 /* synopsis: r[P2]=PX rowid of P1 */
18007 #define OP_NullRow 137
18008 #define OP_SeekEnd 138
18009 #define OP_IdxInsert 139 /* synopsis: key=r[P2] */
18010 #define OP_SorterInsert 140 /* synopsis: key=r[P2] */
18011 #define OP_IdxDelete 141 /* synopsis: key=r[P2@P5] */
18012 #define OP_DeferredSeek 142 /* synopsis: Move P3 to P1.rowid if needed */
18013 #define OP_IdxRowid 143 /* synopsis: r[P2]=rowid */
18014 #define OP_FinishSeek 144
18015 #define OP_Destroy 145
18016 #define OP_Clear 146
18017 #define OP_ResetSorter 147
18018 #define OP_CreateBtree 148 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
18019 #define OP_SqlExec 149
18020 #define OP_ParseSchema 150
18021 #define OP_LoadAnalysis 151
18022 #define OP_DropTable 152
18023 #define OP_DropIndex 153
18024 #define OP_Real 154 /* same as TK_FLOAT, synopsis: r[P2]=PDBL13 */
18025 #define OP_DropTrigger 155
18026 #define OP_IntegrityCk 156
18027 #define OP_RowSetAdd 157 /* synopsis: rowset(P1)=r[P2] */
18028 #define OP_Param 158
18029 #define OP_FkCounter 159 /* synopsis: fkctr[P1]+=P2 */
18030 #define OP_MemMax 160 /* synopsis: r[P1]=max(r[P1],r[P2]) */
18031 #define OP_OffsetLimit 161 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
18032 #define OP_AggInverse 162 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
18033 #define OP_AggStep 163 /* synopsis: accum=r[P3] step(r[P2@P5]) */
18034 #define OP_AggStep1 164 /* synopsis: accum=r[P3] step(r[P2@P5]) */
18035 #define OP_AggValue 165 /* synopsis: r[P3]=value N=P2 */
18036 #define OP_AggFinal 166 /* synopsis: accum=r[P1] N=P2 */
18037 #define OP_Expire 167
18038 #define OP_CursorLock 168
18039 #define OP_CursorUnlock 169
18040 #define OP_TableLock 170 /* synopsis: iDb=P1 root=P2 write=P3 */
18041 #define OP_VBegin 171
18042 #define OP_VCreate 172
18043 #define OP_VDestroy 173
18044 #define OP_VOpen 174
18045 #define OP_VCheck 175
18046 #define OP_VInitIn 176 /* synopsis: r[P2]=ValueList(P1,P3) */
18047 #define OP_VColumn 177 /* synopsis: r[P3]=vcolumn(P2) */
18048 #define OP_VRename 178
18049 #define OP_Pagecount 179
18050 #define OP_MaxPgcnt 180
18051 #define OP_ClrSubtype 181 /* synopsis: r[P1].subtype = 0 */
18052 #define OP_GetSubtype 182 /* synopsis: r[P2] = r[P1].subtype */
18053 #define OP_SetSubtype 183 /* synopsis: r[P2].subtype = r[P1] */
18054 #define OP_FilterAdd 184 /* synopsis: filter(P1) += key(P3@P4) */
18055 #define OP_Trace 185
18056 #define OP_CursorHint 186
18057 #define OP_ReleaseReg 187 /* synopsis: release r[P1@P2] mask P3 */
18058 #define OP_Noop 188
18059 #define OP_Explain 189
18060 #define OP_Abortable 190
 
18061
18062 /* Properties such as "out2" or "jump" that are specified in
18063 ** comments following the "case" for each opcode in the vdbe.c
18064 ** are encoded into bitvectors as follows:
18065 */
@@ -18074,40 +18073,39 @@
18073 #define OPFLG_JUMP0 0x80 /* jump0: P2 might be zero */
18074 #define OPFLG_INITIALIZER {\
18075 /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x41, 0x00,\
18076 /* 8 */ 0x81, 0x01, 0x01, 0x81, 0x83, 0x83, 0x01, 0x01,\
18077 /* 16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0xc9, 0xc9, 0xc9,\
18078 /* 24 */ 0xc9, 0x49, 0x49, 0x49, 0x49, 0xc9, 0x49, 0xc1,\
18079 /* 32 */ 0x01, 0x41, 0x41, 0xc1, 0x01, 0x01, 0x41, 0x41,\
18080 /* 40 */ 0x41, 0x41, 0x41, 0x26, 0x26, 0x41, 0x09, 0x23,\
18081 /* 48 */ 0x0b, 0x81, 0x01, 0x03, 0x03, 0x0b, 0x0b, 0x0b,\
18082 /* 56 */ 0x0b, 0x0b, 0x0b, 0x01, 0x03, 0x03, 0x03, 0x01,\
18083 /* 64 */ 0x41, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x00,\
18084 /* 72 */ 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x10, 0x10,\
18085 /* 80 */ 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x02,\
18086 /* 88 */ 0x02, 0x02, 0x00, 0x00, 0x12, 0x1e, 0x20, 0x40,\
18087 /* 96 */ 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x40, 0x26,\
18088 /* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\
18089 /* 112 */ 0x26, 0x40, 0x00, 0x12, 0x40, 0x40, 0x10, 0x40,\
18090 /* 120 */ 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x40, 0x10,\
18091 /* 128 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00,\
18092 /* 136 */ 0x50, 0x00, 0x40, 0x04, 0x04, 0x00, 0x40, 0x50,\
18093 /* 144 */ 0x40, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,\
18094 /* 152 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x06, 0x10, 0x00,\
18095 /* 160 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
18096 /* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x10,\
18097 /* 176 */ 0x50, 0x40, 0x00, 0x10, 0x10, 0x02, 0x12, 0x12,\
18098 /* 184 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}
 
18099
18100 /* The resolve3P2Values() routine is able to run faster if it knows
18101 ** the value of the largest JUMP opcode. The smaller the maximum
18102 ** JUMP opcode the better, so the mkopcodeh.tcl script that
18103 ** generated this include file strives to group all JUMP opcodes
18104 ** together near the beginning of the list.
18105 */
18106 #define SQLITE_MX_JUMP_OPCODE 65 /* Maximum JUMP opcode */
18107
18108 /************** End of opcodes.h *********************************************/
18109 /************** Continuing where we left off in vdbe.h ***********************/
18110
18111 /*
@@ -35061,10 +35059,14 @@
35059 }
35060 case TK_ID: {
35061 assert( !ExprHasProperty(pExpr, EP_IntValue) );
35062 sqlite3TreeViewLine(pView,"ID \"%w\"", pExpr->u.zToken);
35063 break;
35064 }
35065 case TK_ASTERISK: {
35066 sqlite3TreeViewLine(pView,"ASKTERISK");
35067 break;
35068 }
35069 #ifndef SQLITE_OMIT_CAST
35070 case TK_CAST: {
35071 /* Expressions of the form: CAST(pLeft AS token) */
35072 assert( !ExprHasProperty(pExpr, EP_IntValue) );
@@ -39359,88 +39361,88 @@
39361 /* 20 */ "IfNullRow" OpHelp("if P1.nullRow then r[P3]=NULL, goto P2"),
39362 /* 21 */ "SeekLT" OpHelp("key=r[P3@P4]"),
39363 /* 22 */ "SeekLE" OpHelp("key=r[P3@P4]"),
39364 /* 23 */ "SeekGE" OpHelp("key=r[P3@P4]"),
39365 /* 24 */ "SeekGT" OpHelp("key=r[P3@P4]"),
39366 /* 25 */ "IfNoHope" OpHelp("key=r[P3@P4]"),
39367 /* 26 */ "NoConflict" OpHelp("key=r[P3@P4]"),
39368 /* 27 */ "NotFound" OpHelp("key=r[P3@P4]"),
39369 /* 28 */ "Found" OpHelp("key=r[P3@P4]"),
39370 /* 29 */ "SeekRowid" OpHelp("intkey=r[P3]"),
39371 /* 30 */ "NotExists" OpHelp("intkey=r[P3]"),
39372 /* 31 */ "Last" OpHelp(""),
39373 /* 32 */ "IfSizeBetween" OpHelp(""),
39374 /* 33 */ "SorterSort" OpHelp(""),
39375 /* 34 */ "Sort" OpHelp(""),
39376 /* 35 */ "Rewind" OpHelp(""),
39377 /* 36 */ "IfEmpty" OpHelp("if( empty(P1) ) goto P2"),
39378 /* 37 */ "SorterNext" OpHelp(""),
39379 /* 38 */ "Prev" OpHelp(""),
39380 /* 39 */ "Next" OpHelp(""),
39381 /* 40 */ "IdxLE" OpHelp("key=r[P3@P4]"),
39382 /* 41 */ "IdxGT" OpHelp("key=r[P3@P4]"),
39383 /* 42 */ "IdxLT" OpHelp("key=r[P3@P4]"),
39384 /* 43 */ "Or" OpHelp("r[P3]=(r[P1] || r[P2])"),
39385 /* 44 */ "And" OpHelp("r[P3]=(r[P1] && r[P2])"),
39386 /* 45 */ "IdxGE" OpHelp("key=r[P3@P4]"),
39387 /* 46 */ "IFindKey" OpHelp(""),
39388 /* 47 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"),
39389 /* 48 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"),
39390 /* 49 */ "Program" OpHelp(""),
39391 /* 50 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
39392 /* 51 */ "IsNull" OpHelp("if r[P1]==NULL goto P2"),
39393 /* 52 */ "NotNull" OpHelp("if r[P1]!=NULL goto P2"),
39394 /* 53 */ "Ne" OpHelp("IF r[P3]!=r[P1]"),
39395 /* 54 */ "Eq" OpHelp("IF r[P3]==r[P1]"),
39396 /* 55 */ "Gt" OpHelp("IF r[P3]>r[P1]"),
39397 /* 56 */ "Le" OpHelp("IF r[P3]<=r[P1]"),
39398 /* 57 */ "Lt" OpHelp("IF r[P3]<r[P1]"),
39399 /* 58 */ "Ge" OpHelp("IF r[P3]>=r[P1]"),
39400 /* 59 */ "ElseEq" OpHelp(""),
39401 /* 60 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"),
39402 /* 61 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
39403 /* 62 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
39404 /* 63 */ "IncrVacuum" OpHelp(""),
39405 /* 64 */ "VNext" OpHelp(""),
39406 /* 65 */ "Filter" OpHelp("if key(P3@P4) not in filter(P1) goto P2"),
39407 /* 66 */ "PureFunc" OpHelp("r[P3]=func(r[P2@NP])"),
39408 /* 67 */ "Function" OpHelp("r[P3]=func(r[P2@NP])"),
39409 /* 68 */ "Return" OpHelp(""),
39410 /* 69 */ "EndCoroutine" OpHelp(""),
39411 /* 70 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
39412 /* 71 */ "Halt" OpHelp(""),
39413 /* 72 */ "Integer" OpHelp("r[P2]=P1"),
39414 /* 73 */ "Int64" OpHelp("r[P2]=PINT13"),
39415 /* 74 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
39416 /* 75 */ "BeginSubrtn" OpHelp("r[P2]=NULL"),
39417 /* 76 */ "Null" OpHelp("r[P2..P3]=NULL"),
39418 /* 77 */ "SoftNull" OpHelp("r[P1]=NULL"),
39419 /* 78 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
39420 /* 79 */ "Variable" OpHelp("r[P2]=parameter(P1)"),
39421 /* 80 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
39422 /* 81 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
39423 /* 82 */ "SCopy" OpHelp("r[P2]=r[P1]"),
39424 /* 83 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
39425 /* 84 */ "FkCheck" OpHelp(""),
39426 /* 85 */ "ResultRow" OpHelp("output=r[P1@P2]"),
39427 /* 86 */ "CollSeq" OpHelp(""),
39428 /* 87 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
39429 /* 88 */ "RealAffinity" OpHelp(""),
39430 /* 89 */ "Cast" OpHelp("affinity(r[P1])"),
39431 /* 90 */ "Permutation" OpHelp(""),
39432 /* 91 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
39433 /* 92 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
39434 /* 93 */ "ZeroOrNull" OpHelp("r[P2] = 0 OR NULL"),
39435 /* 94 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
39436 /* 95 */ "Column" OpHelp("r[P3]=PX cursor P1 column P2"),
39437 /* 96 */ "TypeCheck" OpHelp("typecheck(r[P1@P2])"),
39438 /* 97 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
39439 /* 98 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
39440 /* 99 */ "Count" OpHelp("r[P2]=count()"),
39441 /* 100 */ "ReadCookie" OpHelp(""),
39442 /* 101 */ "SetCookie" OpHelp(""),
39443 /* 102 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
39444 /* 103 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
39445 /* 104 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
39446 /* 105 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
39447 /* 106 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
39448 /* 107 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
@@ -39447,89 +39449,88 @@
39449 /* 108 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
39450 /* 109 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
39451 /* 110 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
39452 /* 111 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
39453 /* 112 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
39454 /* 113 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
39455 /* 114 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
39456 /* 115 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
39457 /* 116 */ "OpenDup" OpHelp(""),
39458 /* 117 */ "OpenAutoindex" OpHelp("nColumn=P2"),
39459 /* 118 */ "String8" OpHelp("r[P2]='P4'"),
39460 /* 119 */ "OpenEphemeral" OpHelp("nColumn=P2"),
39461 /* 120 */ "SorterOpen" OpHelp(""),
39462 /* 121 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
39463 /* 122 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
39464 /* 123 */ "Close" OpHelp(""),
39465 /* 124 */ "ColumnsUsed" OpHelp("Cursor P1 uses columns PHEX23"),
39466 /* 125 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
39467 /* 126 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
39468 /* 127 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
39469 /* 128 */ "NewRowid" OpHelp("r[P2]=rowid"),
39470 /* 129 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
39471 /* 130 */ "RowCell" OpHelp(""),
39472 /* 131 */ "Delete" OpHelp(""),
39473 /* 132 */ "ResetCount" OpHelp(""),
39474 /* 133 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
39475 /* 134 */ "SorterData" OpHelp("r[P2]=data"),
39476 /* 135 */ "RowData" OpHelp("r[P2]=data"),
39477 /* 136 */ "Rowid" OpHelp("r[P2]=PX rowid of P1"),
39478 /* 137 */ "NullRow" OpHelp(""),
39479 /* 138 */ "SeekEnd" OpHelp(""),
39480 /* 139 */ "IdxInsert" OpHelp("key=r[P2]"),
39481 /* 140 */ "SorterInsert" OpHelp("key=r[P2]"),
39482 /* 141 */ "IdxDelete" OpHelp("key=r[P2@P5]"),
39483 /* 142 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
39484 /* 143 */ "IdxRowid" OpHelp("r[P2]=rowid"),
39485 /* 144 */ "FinishSeek" OpHelp(""),
39486 /* 145 */ "Destroy" OpHelp(""),
39487 /* 146 */ "Clear" OpHelp(""),
39488 /* 147 */ "ResetSorter" OpHelp(""),
39489 /* 148 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
39490 /* 149 */ "SqlExec" OpHelp(""),
39491 /* 150 */ "ParseSchema" OpHelp(""),
39492 /* 151 */ "LoadAnalysis" OpHelp(""),
39493 /* 152 */ "DropTable" OpHelp(""),
39494 /* 153 */ "DropIndex" OpHelp(""),
39495 /* 154 */ "Real" OpHelp("r[P2]=PDBL13"),
39496 /* 155 */ "DropTrigger" OpHelp(""),
39497 /* 156 */ "IntegrityCk" OpHelp(""),
39498 /* 157 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
39499 /* 158 */ "Param" OpHelp(""),
39500 /* 159 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
39501 /* 160 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
39502 /* 161 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
39503 /* 162 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
39504 /* 163 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
39505 /* 164 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
39506 /* 165 */ "AggValue" OpHelp("r[P3]=value N=P2"),
39507 /* 166 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
39508 /* 167 */ "Expire" OpHelp(""),
39509 /* 168 */ "CursorLock" OpHelp(""),
39510 /* 169 */ "CursorUnlock" OpHelp(""),
39511 /* 170 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
39512 /* 171 */ "VBegin" OpHelp(""),
39513 /* 172 */ "VCreate" OpHelp(""),
39514 /* 173 */ "VDestroy" OpHelp(""),
39515 /* 174 */ "VOpen" OpHelp(""),
39516 /* 175 */ "VCheck" OpHelp(""),
39517 /* 176 */ "VInitIn" OpHelp("r[P2]=ValueList(P1,P3)"),
39518 /* 177 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
39519 /* 178 */ "VRename" OpHelp(""),
39520 /* 179 */ "Pagecount" OpHelp(""),
39521 /* 180 */ "MaxPgcnt" OpHelp(""),
39522 /* 181 */ "ClrSubtype" OpHelp("r[P1].subtype = 0"),
39523 /* 182 */ "GetSubtype" OpHelp("r[P2] = r[P1].subtype"),
39524 /* 183 */ "SetSubtype" OpHelp("r[P2].subtype = r[P1]"),
39525 /* 184 */ "FilterAdd" OpHelp("filter(P1) += key(P3@P4)"),
39526 /* 185 */ "Trace" OpHelp(""),
39527 /* 186 */ "CursorHint" OpHelp(""),
39528 /* 187 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"),
39529 /* 188 */ "Noop" OpHelp(""),
39530 /* 189 */ "Explain" OpHelp(""),
39531 /* 190 */ "Abortable" OpHelp(""),
 
39532 };
39533 return azName[i];
39534 }
39535 #endif
39536
@@ -97040,10 +97041,11 @@
97041 sqlite3RCStrUnref);
97042 pDest->flags |= MEM_Term;
97043 }else{
97044 rc = sqlite3VdbeMemSetStr(pDest, pBuf, len, 0,
97045 sqlite3RCStrUnref);
97046 pDest->enc = encoding;
97047 }
97048 }else{
97049 rc = sqlite3VdbeMemFromBtree(pC->uc.pCursor, iOffset, len, pDest);
97050 if( rc ) return rc;
97051 sqlite3VdbeSerialGet((const u8*)pDest->z, t, pDest);
@@ -101615,28 +101617,10 @@
101617 printf("seekHit changes from %d to %d\n", pC->seekHit, pOp->p3);
101618 }
101619 #endif
101620 pC->seekHit = pOp->p3;
101621 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101622 break;
101623 }
101624
101625 /* Opcode: Found P1 P2 P3 P4 *
101626 ** Synopsis: key=r[P3@P4]
@@ -154169,11 +154153,11 @@
154153 ** elements we are now copying in.
154154 */
154155 pSub = pSub1;
154156 for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){
154157 int nSubSrc;
154158 u8 jointype = pParent->pSrc->a[iFrom].fg.jointype;
154159 assert( pSub!=0 );
154160 pSubSrc = pSub->pSrc; /* FROM clause of subquery */
154161 nSubSrc = pSubSrc->nSrc; /* Number of terms in subquery FROM clause */
154162 pSrc = pParent->pSrc; /* FROM clause of the outer query */
154163
@@ -154194,11 +154178,10 @@
154178 */
154179 if( nSubSrc>1 ){
154180 pSrc = sqlite3SrcListEnlarge(pParse, pSrc, nSubSrc-1,iFrom+1);
154181 if( pSrc==0 ) break;
154182 pParent->pSrc = pSrc;
 
154183 }
154184
154185 /* Transfer the FROM clause terms from the subquery into the
154186 ** outer query.
154187 */
@@ -154212,11 +154195,11 @@
154195 if( pItem->fg.isUsing ) sqlite3IdListDelete(db, pItem->u3.pUsing);
154196 *pItem = pSubSrc->a[i];
154197 pItem->fg.jointype |= (jointype & JT_LTORJ);
154198 memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i]));
154199 }
154200 pSrc->a[iFrom].fg.jointype |= jointype;
154201
154202 /* Begin substituting subquery result set expressions for
154203 ** references to the iParent in the outer query.
154204 **
154205 ** Example:
@@ -155882,10 +155865,11 @@
155865 }
155866 }
155867 pRight = sqlite3Expr(db, TK_ID, zName);
155868 if( (pTabList->nSrc>1
155869 && ( (pFrom->fg.jointype & JT_LTORJ)==0
155870 || zTName!=0
155871 || (selFlags & SF_NestedFrom)!=0
155872 || !inAnyUsingClause(zName,pFrom,pTabList->nSrc-i-1)
155873 )
155874 )
155875 || IN_RENAME_OBJECT
@@ -177300,20 +177284,18 @@
177284 if( pIn->nPrefix ){
177285 int bEarlyOut =
177286 (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0
177287 && (pLoop->wsFlags & WHERE_IN_EARLYOUT)!=0;
177288 if( pLevel->iLeftJoin ){
177289 /* For LEFT JOIN queries, cursor pIn->iCur might have been
177290 ** disabled by OP_NullRow. This occurs for WHERE clauses such
177291 ** as "a = ? AND b IN (...)", where the index is on (a, b).
177292 ** When the OP_IfNullRow jump is taken, the pIn->iBase register
177293 ** is NULLed out as a side effect. But as that register is not
177294 ** used when the jump is taken, the side-effect is harmless. */
177295 sqlite3VdbeAddOp3(v, OP_IfNullRow, pIn->iCur,
177296 sqlite3VdbeCurrentAddr(v) + 2 + bEarlyOut, pIn->iBase);
 
 
177297 VdbeCoverage(v);
177298 }
177299 if( bEarlyOut ){
177300 sqlite3VdbeAddOp4Int(v, OP_IfNoHope, pLevel->iIdxCur,
177301 sqlite3VdbeCurrentAddr(v)+2,
@@ -177377,10 +177359,19 @@
177359 int iDb = sqlite3SchemaToIndex(db, pIx->pSchema);
177360 sqlite3VdbeAddOp3(v, OP_ReopenIdx, pLevel->iIdxCur, pIx->tnum, iDb);
177361 sqlite3VdbeSetP4KeyInfo(pParse, pIx);
177362 }
177363 sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iIdxCur);
177364 }
177365 if( ws & WHERE_IN_ABLE ){
177366 int m;
177367 for(m=0; m<pLevel->u.in.nIn; m++){
177368 struct InLoop *pIn = &pLevel->u.in.aInLoop[m];
177369 if( pIn->eEndLoopOp!=OP_Noop ){
177370 sqlite3VdbeAddOp1(v, OP_NullRow, pIn->iCur);
177371 }
177372 }
177373 }
177374 if( pLevel->op==OP_Return ){
177375 sqlite3VdbeAddOp2(v, OP_Gosub, pLevel->p1, pLevel->addrFirst);
177376 }else{
177377 sqlite3VdbeGoto(v, pLevel->addrFirst);
@@ -178372,11 +178363,13 @@
178363 Expr *pDup = sqlite3ExprDup(pParse->db, pExpr, 0);
178364 if( pDup && pDup->op==TK_AGG_FUNCTION ) pDup->op = TK_FUNCTION;
178365 p->pSub = sqlite3ExprListAppend(pParse, p->pSub, pDup);
178366 }
178367 if( p->pSub ){
178368 int f = pExpr->flags & (EP_Collate|EP_OuterON|EP_InnerON);
178369 int iJoin = pExpr->w.iJoin;
178370
178371 assert( ExprHasProperty(pExpr, EP_Static)==0 );
178372 ExprSetProperty(pExpr, EP_Static);
178373 sqlite3ExprDelete(pParse->db, pExpr);
178374 ExprClearProperty(pExpr, EP_Static);
178375 memset(pExpr, 0, sizeof(Expr));
@@ -178384,10 +178377,11 @@
178377 pExpr->op = TK_COLUMN;
178378 pExpr->iColumn = (iCol<0 ? p->pSub->nExpr-1: iCol);
178379 pExpr->iTable = p->pWin->iEphCsr;
178380 pExpr->y.pTab = p->pTab;
178381 pExpr->flags = f;
178382 if( (f & (EP_OuterON|EP_InnerON)) ) pExpr->w.iJoin = iJoin;
178383 }
178384 if( pParse->db->mallocFailed ) return WRC_Abort;
178385 break;
178386 }
178387
@@ -185494,11 +185488,15 @@
185488 }else{
185489 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, yymsp[-3].minor.yy144 ? TK_OR : TK_AND, pB, yymsp[-4].minor.yy454);
185490 }
185491 }else{
185492 Expr *pRHS = yymsp[-1].minor.yy14->a[0].pExpr;
185493 if( yymsp[-1].minor.yy14->nExpr==1
185494 && sqlite3ExprIsConstant(pParse,pRHS)
185495 && pRHS->op!=TK_COLLATE
185496 && yymsp[-4].minor.yy454->op!=TK_VECTOR
185497 ){
185498 yymsp[-1].minor.yy14->a[0].pExpr = 0;
185499 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14);
185500 pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0);
185501 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy454, pRHS);
185502 }else if( yymsp[-1].minor.yy14->nExpr==1 && pRHS->op==TK_SELECT ){
@@ -265409,11 +265407,11 @@
265407 int nArg, /* Number of args */
265408 sqlite3_value **apUnused /* Function arguments */
265409 ){
265410 assert( nArg==0 );
265411 UNUSED_PARAM2(nArg, apUnused);
265412 sqlite3_result_text(pCtx, "fts5: 2026-10-09 11:47:51 a3332bd623d997921c3186433cd1eab0c9413aa0f68d93b1731cf80128ec3a36", -1, SQLITE_TRANSIENT);
265413 }
265414
265415 /*
265416 ** Implementation of fts5_locale(LOCALE, TEXT) function.
265417 **
265418
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,14 +146,14 @@
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149149
#define SQLITE_VERSION "3.54.0"
150150
#define SQLITE_VERSION_NUMBER 3054000
151
-#define SQLITE_SOURCE_ID "2026-10-06 18:52:47 a435d786fe0e245e352d08d2e2ddf8c1e15154809e3b471810cc327e9d90ef85"
151
+#define SQLITE_SOURCE_ID "2026-10-09 11:47:51 a3332bd623d997921c3186433cd1eab0c9413aa0f68d93b1731cf80128ec3a36"
152152
#define SQLITE_SCM_BRANCH "trunk"
153153
#define SQLITE_SCM_TAGS ""
154
-#define SQLITE_SCM_DATETIME "2026-10-06T18:52:47.576Z"
154
+#define SQLITE_SCM_DATETIME "2026-10-09T11:47:51.732Z"
155155
156156
/*
157157
** CAPI3REF: Run-Time Library Version Numbers
158158
** KEYWORDS: sqlite3_version sqlite3_sourceid
159159
**
160160
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,14 +146,14 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.54.0"
150 #define SQLITE_VERSION_NUMBER 3054000
151 #define SQLITE_SOURCE_ID "2026-10-06 18:52:47 a435d786fe0e245e352d08d2e2ddf8c1e15154809e3b471810cc327e9d90ef85"
152 #define SQLITE_SCM_BRANCH "trunk"
153 #define SQLITE_SCM_TAGS ""
154 #define SQLITE_SCM_DATETIME "2026-10-06T18:52:47.576Z"
155
156 /*
157 ** CAPI3REF: Run-Time Library Version Numbers
158 ** KEYWORDS: sqlite3_version sqlite3_sourceid
159 **
160
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,14 +146,14 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.54.0"
150 #define SQLITE_VERSION_NUMBER 3054000
151 #define SQLITE_SOURCE_ID "2026-10-09 11:47:51 a3332bd623d997921c3186433cd1eab0c9413aa0f68d93b1731cf80128ec3a36"
152 #define SQLITE_SCM_BRANCH "trunk"
153 #define SQLITE_SCM_TAGS ""
154 #define SQLITE_SCM_DATETIME "2026-10-09T11:47:51.732Z"
155
156 /*
157 ** CAPI3REF: Run-Time Library Version Numbers
158 ** KEYWORDS: sqlite3_version sqlite3_sourceid
159 **
160

Keyboard Shortcuts

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