Fossil SCM

Merge from trunk

brickviking 2024-12-06 01:42 bv-infotool merge
Commit f826331554a8848e4b9cdac37a2e63855ca055d12a86221f844f40ab6d6c7615
+162 -25
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -457,14 +457,24 @@
457457
** that into UTF-8. Otherwise, non-ASCII characters all get translated
458458
** into '?'.
459459
*/
460460
wchar_t *b1 = sqlite3_malloc( sz*sizeof(wchar_t) );
461461
if( b1==0 ) return 0;
462
- _setmode(_fileno(in), IsConsole(in) ? _O_WTEXT : _O_U8TEXT);
463
- if( fgetws(b1, sz/4, in)==0 ){
464
- sqlite3_free(b1);
465
- return 0;
462
+#ifndef SQLITE_USE_STDIO_FOR_CONSOLE
463
+ DWORD nRead = 0;
464
+ if( IsConsole(in)
465
+ && ReadConsoleW(GetStdHandle(STD_INPUT_HANDLE), b1, sz, &nRead, 0)
466
+ ){
467
+ b1[nRead] = 0;
468
+ }else
469
+#endif
470
+ {
471
+ _setmode(_fileno(in), IsConsole(in) ? _O_WTEXT : _O_U8TEXT);
472
+ if( fgetws(b1, sz/4, in)==0 ){
473
+ sqlite3_free(b1);
474
+ return 0;
475
+ }
466476
}
467477
WideCharToMultiByte(CP_UTF8, 0, b1, -1, buf, sz, 0, 0);
468478
sqlite3_free(b1);
469479
return buf;
470480
}else{
@@ -516,24 +526,37 @@
516526
if( !UseWtextForOutput(out) ){
517527
/* Writing to a file or other destination, just write bytes without
518528
** any translation. */
519529
return fputs(z, out);
520530
}else{
521
- /* When writing to the command-prompt in Windows, it is necessary
522
- ** to use O_U8TEXT to render Unicode U+0080 and greater. Go ahead
523
- ** use O_U8TEXT for everything in text mode.
531
+ /* One must use UTF16 in order to get unicode support when writing
532
+ ** to the console on Windows.
524533
*/
525534
int sz = (int)strlen(z);
526535
wchar_t *b1 = sqlite3_malloc( (sz+1)*sizeof(wchar_t) );
527536
if( b1==0 ) return 0;
528537
sz = MultiByteToWideChar(CP_UTF8, 0, z, sz, b1, sz);
529538
b1[sz] = 0;
530
- _setmode(_fileno(out), _O_U8TEXT);
531
- if( UseBinaryWText(out) ){
532
- piecemealOutput(b1, sz, out);
533
- }else{
534
- fputws(b1, out);
539
+
540
+#ifndef SQLITE_STDIO_FOR_CONSOLE
541
+ DWORD nWr = 0;
542
+ if( IsConsole(out)
543
+ && WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE),b1,sz,&nWr,0)
544
+ ){
545
+ /* If writing to the console, then the WriteConsoleW() is all we
546
+ ** need to do. */
547
+ }else
548
+#endif
549
+ {
550
+ /* For non-console I/O, or if SQLITE_USE_STDIO_FOR_CONSOLE is defined
551
+ ** then write using the standard library. */
552
+ _setmode(_fileno(out), _O_U8TEXT);
553
+ if( UseBinaryWText(out) ){
554
+ piecemealOutput(b1, sz, out);
555
+ }else{
556
+ fputws(b1, out);
557
+ }
535558
}
536559
sqlite3_free(b1);
537560
return 0;
538561
}
539562
}
@@ -16757,10 +16780,20 @@
1675716780
1675816781
/*
1675916782
** Shared-memory operations.
1676016783
*/
1676116784
static int vfstraceShmLock(sqlite3_file *pFile, int ofst, int n, int flags){
16785
+ static const char *azLockName[] = {
16786
+ "WRITE",
16787
+ "CKPT",
16788
+ "RECOVER",
16789
+ "READ0",
16790
+ "READ1",
16791
+ "READ2",
16792
+ "READ3",
16793
+ "READ4",
16794
+ };
1676216795
vfstrace_file *p = (vfstrace_file *)pFile;
1676316796
vfstrace_info *pInfo = p->pInfo;
1676416797
int rc;
1676516798
char zLck[100];
1676616799
int i = 0;
@@ -16770,12 +16803,19 @@
1677016803
if( flags & SQLITE_SHM_SHARED ) strappend(zLck, &i, "|SHARED");
1677116804
if( flags & SQLITE_SHM_EXCLUSIVE ) strappend(zLck, &i, "|EXCLUSIVE");
1677216805
if( flags & ~(0xf) ){
1677316806
sqlite3_snprintf(sizeof(zLck)-i, &zLck[i], "|0x%x", flags);
1677416807
}
16775
- vfstrace_printf(pInfo, "%s.xShmLock(%s,ofst=%d,n=%d,%s)",
16776
- pInfo->zVfsName, p->zFName, ofst, n, &zLck[1]);
16808
+ if( ofst>=0 && ofst<sizeof(azLockName)/sizeof(azLockName[0]) ){
16809
+ vfstrace_printf(pInfo, "%s.xShmLock(%s,ofst=%d(%s),n=%d,%s)",
16810
+ pInfo->zVfsName, p->zFName, ofst, azLockName[ofst],
16811
+ n, &zLck[1]);
16812
+ }else{
16813
+ vfstrace_printf(pInfo, "%s.xShmLock(%s,ofst=5d,n=%d,%s)",
16814
+ pInfo->zVfsName, p->zFName, ofst,
16815
+ n, &zLck[1]);
16816
+ }
1677716817
rc = p->pReal->pMethods->xShmLock(p->pReal, ofst, n, flags);
1677816818
vfstrace_print_errcode(pInfo, " -> %s\n", rc);
1677916819
return rc;
1678016820
}
1678116821
static int vfstraceShmMap(
@@ -20231,10 +20271,12 @@
2023120271
apVal[iField] = sqlite3_value_dup( pVal );
2023220272
if( apVal[iField]==0 ){
2023320273
recoverError(p, SQLITE_NOMEM, 0);
2023420274
}
2023520275
p1->nVal = iField+1;
20276
+ }else if( pTab->nCol==0 ){
20277
+ p1->nVal = pTab->nCol;
2023620278
}
2023720279
p1->iPrevCell = iCell;
2023820280
p1->iPrevPage = iPage;
2023920281
}
2024020282
}else{
@@ -22010,11 +22052,11 @@
2201022052
2201122053
/*
2201222054
** Output the given string as quoted according to JSON quoting rules.
2201322055
*/
2201422056
static void output_json_string(FILE *out, const char *z, i64 n){
22015
- char c;
22057
+ unsigned char c;
2201622058
static const char *zq = "\"";
2201722059
static long ctrlMask = ~0L;
2201822060
static const char *zDQBS = "\"\\";
2201922061
const char *pcLimit;
2202022062
char ace[3] = "\\?";
@@ -22030,11 +22072,11 @@
2203022072
if( pcEnd > z ){
2203122073
sqlite3_fprintf(out, "%.*s", (int)(pcEnd-z), z);
2203222074
z = pcEnd;
2203322075
}
2203422076
if( z >= pcLimit ) break;
22035
- c = *(z++);
22077
+ c = (unsigned char)*(z++);
2203622078
switch( c ){
2203722079
case '"': case '\\':
2203822080
cbsSay = (char)c;
2203922081
break;
2204022082
case '\b': cbsSay = 'b'; break;
@@ -22045,11 +22087,11 @@
2204522087
default: cbsSay = 0; break;
2204622088
}
2204722089
if( cbsSay ){
2204822090
ace[1] = cbsSay;
2204922091
sqlite3_fputs(ace, out);
22050
- }else if( c<=0x1f || c==0x7f ){
22092
+ }else if( c<=0x1f || c>=0x7f ){
2205122093
sqlite3_fprintf(out, "\\u%04x", c);
2205222094
}else{
2205322095
ace[1] = (char)c;
2205422096
sqlite3_fputs(ace+1, out);
2205522097
}
@@ -24787,13 +24829,13 @@
2478724829
if( rc ){
2478824830
sqlite3_fprintf(p->out, "/****** ERROR: %s ******/\n", zErr);
2478924831
}else{
2479024832
rc = SQLITE_CORRUPT;
2479124833
}
24792
- sqlite3_free(zErr);
2479324834
free(zQ2);
2479424835
}
24836
+ sqlite3_free(zErr);
2479524837
return rc;
2479624838
}
2479724839
2479824840
/*
2479924841
** Text of help messages.
@@ -24852,10 +24894,11 @@
2485224894
".databases List names and files of attached databases",
2485324895
".dbconfig ?op? ?val? List or change sqlite3_db_config() options",
2485424896
#if SQLITE_SHELL_HAVE_RECOVER
2485524897
".dbinfo ?DB? Show status information about the database",
2485624898
#endif
24899
+ ".dbtotxt Hex dump of the database file",
2485724900
".dump ?OBJECTS? Render database content as SQL",
2485824901
" Options:",
2485924902
" --data-only Output only INSERT statements",
2486024903
" --newlines Allow unescaped newline characters in output",
2486124904
" --nosys Omit system tables (ex: \"sqlite_stat1\")",
@@ -26522,10 +26565,105 @@
2652226565
sqlite3_file_control(p->db, zDb, SQLITE_FCNTL_DATA_VERSION, &iDataVersion);
2652326566
sqlite3_fprintf(p->out, "%-20s %u\n", "data version", iDataVersion);
2652426567
return 0;
2652526568
}
2652626569
#endif /* SQLITE_SHELL_HAVE_RECOVER */
26570
+
26571
+/*
26572
+** Implementation of the ".dbtotxt" command.
26573
+**
26574
+** Return 1 on error, 2 to exit, and 0 otherwise.
26575
+*/
26576
+static int shell_dbtotxt_command(ShellState *p, int nArg, char **azArg){
26577
+ sqlite3_stmt *pStmt = 0;
26578
+ sqlite3_int64 nPage = 0;
26579
+ int pgSz = 0;
26580
+ const char *zFilename;
26581
+ const char *zTail;
26582
+ char *zName = 0;
26583
+ int rc, i, j;
26584
+ unsigned char bShow[256]; /* Characters ok to display */
26585
+
26586
+ memset(bShow, '.', sizeof(bShow));
26587
+ for(i=' '; i<='~'; i++){
26588
+ if( i!='{' && i!='}' && i!='"' && i!='\\' ) bShow[i] = (unsigned char)i;
26589
+ }
26590
+ rc = sqlite3_prepare_v2(p->db, "PRAGMA page_size", -1, &pStmt, 0);
26591
+ if( rc ) goto dbtotxt_error;
26592
+ rc = 0;
26593
+ if( sqlite3_step(pStmt)!=SQLITE_ROW ) goto dbtotxt_error;
26594
+ pgSz = sqlite3_column_int(pStmt, 0);
26595
+ sqlite3_finalize(pStmt);
26596
+ pStmt = 0;
26597
+ if( pgSz<512 || pgSz>65536 || (pgSz&(pgSz-1))!=0 ) goto dbtotxt_error;
26598
+ rc = sqlite3_prepare_v2(p->db, "PRAGMA page_count", -1, &pStmt, 0);
26599
+ if( rc ) goto dbtotxt_error;
26600
+ rc = 0;
26601
+ if( sqlite3_step(pStmt)!=SQLITE_ROW ) goto dbtotxt_error;
26602
+ nPage = sqlite3_column_int64(pStmt, 0);
26603
+ sqlite3_finalize(pStmt);
26604
+ pStmt = 0;
26605
+ if( nPage<1 ) goto dbtotxt_error;
26606
+ rc = sqlite3_prepare_v2(p->db, "PRAGMA databases", -1, &pStmt, 0);
26607
+ if( rc ) goto dbtotxt_error;
26608
+ rc = 0;
26609
+ if( sqlite3_step(pStmt)!=SQLITE_ROW ){
26610
+ zTail = zFilename = "unk.db";
26611
+ }else{
26612
+ zFilename = (const char*)sqlite3_column_text(pStmt, 2);
26613
+ if( zFilename==0 || zFilename[0]==0 ) zFilename = "unk.db";
26614
+ zTail = strrchr(zFilename, '/');
26615
+#if defined(_WIN32)
26616
+ if( zTail==0 ) zTail = strrchr(zFilename, '\\');
26617
+#endif
26618
+ if( zTail ) zFilename = zTail;
26619
+ }
26620
+ zName = strdup(zTail);
26621
+ shell_check_oom(zName);
26622
+ sqlite3_fprintf(p->out, "| size %lld pagesize %d filename %s\n",
26623
+ nPage*pgSz, pgSz, zName);
26624
+ sqlite3_finalize(pStmt);
26625
+ pStmt = 0;
26626
+ rc = sqlite3_prepare_v2(p->db,
26627
+ "SELECT pgno, data FROM sqlite_dbpage ORDER BY pgno", -1, &pStmt, 0);
26628
+ if( rc ) goto dbtotxt_error;
26629
+ rc = 0;
26630
+ while( sqlite3_step(pStmt)==SQLITE_ROW ){
26631
+ sqlite3_int64 pgno = sqlite3_column_int64(pStmt, 0);
26632
+ const u8 *aData = sqlite3_column_blob(pStmt, 1);
26633
+ int seenPageLabel = 0;
26634
+ for(i=0; i<pgSz; i+=16){
26635
+ const u8 *aLine = aData+i;
26636
+ for(j=0; j<16 && aLine[j]==0; j++){}
26637
+ if( j==16 ) continue;
26638
+ if( !seenPageLabel ){
26639
+ sqlite3_fprintf(p->out, "| page %lld offset %lld\n", pgno, pgno*pgSz);
26640
+ seenPageLabel = 1;
26641
+ }
26642
+ sqlite3_fprintf(p->out, "| %5d:", i);
26643
+ for(j=0; j<16; j++) sqlite3_fprintf(p->out, " %02x", aLine[j]);
26644
+ sqlite3_fprintf(p->out, " ");
26645
+ for(j=0; j<16; j++){
26646
+ unsigned char c = (unsigned char)aLine[j];
26647
+ sqlite3_fprintf(p->out, "%c", bShow[c]);
26648
+ }
26649
+ sqlite3_fprintf(p->out, "\n");
26650
+ }
26651
+ }
26652
+ sqlite3_finalize(pStmt);
26653
+ sqlite3_fprintf(p->out, "| end %s\n", zName);
26654
+ free(zName);
26655
+ return 0;
26656
+
26657
+dbtotxt_error:
26658
+ if( rc ){
26659
+ sqlite3_fprintf(stderr, "ERROR: %s\n", sqlite3_errmsg(p->db));
26660
+ }
26661
+ sqlite3_finalize(pStmt);
26662
+ free(zName);
26663
+ return 1;
26664
+}
2652726665
2652826666
/*
2652926667
** Print the given string as an error message.
2653026668
*/
2653126669
static void shellEmitError(const char *zErr){
@@ -28699,10 +28837,14 @@
2869928837
}else{
2870028838
eputz("Usage: .echo on|off\n");
2870128839
rc = 1;
2870228840
}
2870328841
}else
28842
+
28843
+ if( c=='d' && n>=3 && cli_strncmp(azArg[0], "dbtotxt", n)==0 ){
28844
+ rc = shell_dbtotxt_command(p, nArg, azArg);
28845
+ }else
2870428846
2870528847
if( c=='e' && cli_strncmp(azArg[0], "eqp", n)==0 ){
2870628848
if( nArg==2 ){
2870728849
p->autoEQPtest = 0;
2870828850
if( p->autoEQPtrace ){
@@ -33077,19 +33219,14 @@
3307733219
*/
3307833220
if( stdin_is_interactive ){
3307933221
char *zHome;
3308033222
char *zHistory;
3308133223
int nHistory;
33082
-#if CIO_WIN_WC_XLATE
33083
-# define SHELL_CIO_CHAR_SET (stdout_is_console? " (UTF-16 console I/O)" : "")
33084
-#else
33085
-# define SHELL_CIO_CHAR_SET ""
33086
-#endif
3308733224
sqlite3_fprintf(stdout,
33088
- "SQLite version %s %.19s%s\n" /*extra-version-info*/
33225
+ "SQLite version %s %.19s\n" /*extra-version-info*/
3308933226
"Enter \".help\" for usage hints.\n",
33090
- sqlite3_libversion(), sqlite3_sourceid(), SHELL_CIO_CHAR_SET);
33227
+ sqlite3_libversion(), sqlite3_sourceid());
3309133228
if( warnInmemoryDb ){
3309233229
sputz(stdout, "Connected to a ");
3309333230
printBold("transient in-memory database");
3309433231
sputz(stdout, ".\nUse \".open FILENAME\" to reopen on a"
3309533232
" persistent database.\n");
3309633233
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -457,14 +457,24 @@
457 ** that into UTF-8. Otherwise, non-ASCII characters all get translated
458 ** into '?'.
459 */
460 wchar_t *b1 = sqlite3_malloc( sz*sizeof(wchar_t) );
461 if( b1==0 ) return 0;
462 _setmode(_fileno(in), IsConsole(in) ? _O_WTEXT : _O_U8TEXT);
463 if( fgetws(b1, sz/4, in)==0 ){
464 sqlite3_free(b1);
465 return 0;
 
 
 
 
 
 
 
 
 
 
466 }
467 WideCharToMultiByte(CP_UTF8, 0, b1, -1, buf, sz, 0, 0);
468 sqlite3_free(b1);
469 return buf;
470 }else{
@@ -516,24 +526,37 @@
516 if( !UseWtextForOutput(out) ){
517 /* Writing to a file or other destination, just write bytes without
518 ** any translation. */
519 return fputs(z, out);
520 }else{
521 /* When writing to the command-prompt in Windows, it is necessary
522 ** to use O_U8TEXT to render Unicode U+0080 and greater. Go ahead
523 ** use O_U8TEXT for everything in text mode.
524 */
525 int sz = (int)strlen(z);
526 wchar_t *b1 = sqlite3_malloc( (sz+1)*sizeof(wchar_t) );
527 if( b1==0 ) return 0;
528 sz = MultiByteToWideChar(CP_UTF8, 0, z, sz, b1, sz);
529 b1[sz] = 0;
530 _setmode(_fileno(out), _O_U8TEXT);
531 if( UseBinaryWText(out) ){
532 piecemealOutput(b1, sz, out);
533 }else{
534 fputws(b1, out);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
535 }
536 sqlite3_free(b1);
537 return 0;
538 }
539 }
@@ -16757,10 +16780,20 @@
16757
16758 /*
16759 ** Shared-memory operations.
16760 */
16761 static int vfstraceShmLock(sqlite3_file *pFile, int ofst, int n, int flags){
 
 
 
 
 
 
 
 
 
 
16762 vfstrace_file *p = (vfstrace_file *)pFile;
16763 vfstrace_info *pInfo = p->pInfo;
16764 int rc;
16765 char zLck[100];
16766 int i = 0;
@@ -16770,12 +16803,19 @@
16770 if( flags & SQLITE_SHM_SHARED ) strappend(zLck, &i, "|SHARED");
16771 if( flags & SQLITE_SHM_EXCLUSIVE ) strappend(zLck, &i, "|EXCLUSIVE");
16772 if( flags & ~(0xf) ){
16773 sqlite3_snprintf(sizeof(zLck)-i, &zLck[i], "|0x%x", flags);
16774 }
16775 vfstrace_printf(pInfo, "%s.xShmLock(%s,ofst=%d,n=%d,%s)",
16776 pInfo->zVfsName, p->zFName, ofst, n, &zLck[1]);
 
 
 
 
 
 
 
16777 rc = p->pReal->pMethods->xShmLock(p->pReal, ofst, n, flags);
16778 vfstrace_print_errcode(pInfo, " -> %s\n", rc);
16779 return rc;
16780 }
16781 static int vfstraceShmMap(
@@ -20231,10 +20271,12 @@
20231 apVal[iField] = sqlite3_value_dup( pVal );
20232 if( apVal[iField]==0 ){
20233 recoverError(p, SQLITE_NOMEM, 0);
20234 }
20235 p1->nVal = iField+1;
 
 
20236 }
20237 p1->iPrevCell = iCell;
20238 p1->iPrevPage = iPage;
20239 }
20240 }else{
@@ -22010,11 +22052,11 @@
22010
22011 /*
22012 ** Output the given string as quoted according to JSON quoting rules.
22013 */
22014 static void output_json_string(FILE *out, const char *z, i64 n){
22015 char c;
22016 static const char *zq = "\"";
22017 static long ctrlMask = ~0L;
22018 static const char *zDQBS = "\"\\";
22019 const char *pcLimit;
22020 char ace[3] = "\\?";
@@ -22030,11 +22072,11 @@
22030 if( pcEnd > z ){
22031 sqlite3_fprintf(out, "%.*s", (int)(pcEnd-z), z);
22032 z = pcEnd;
22033 }
22034 if( z >= pcLimit ) break;
22035 c = *(z++);
22036 switch( c ){
22037 case '"': case '\\':
22038 cbsSay = (char)c;
22039 break;
22040 case '\b': cbsSay = 'b'; break;
@@ -22045,11 +22087,11 @@
22045 default: cbsSay = 0; break;
22046 }
22047 if( cbsSay ){
22048 ace[1] = cbsSay;
22049 sqlite3_fputs(ace, out);
22050 }else if( c<=0x1f || c==0x7f ){
22051 sqlite3_fprintf(out, "\\u%04x", c);
22052 }else{
22053 ace[1] = (char)c;
22054 sqlite3_fputs(ace+1, out);
22055 }
@@ -24787,13 +24829,13 @@
24787 if( rc ){
24788 sqlite3_fprintf(p->out, "/****** ERROR: %s ******/\n", zErr);
24789 }else{
24790 rc = SQLITE_CORRUPT;
24791 }
24792 sqlite3_free(zErr);
24793 free(zQ2);
24794 }
 
24795 return rc;
24796 }
24797
24798 /*
24799 ** Text of help messages.
@@ -24852,10 +24894,11 @@
24852 ".databases List names and files of attached databases",
24853 ".dbconfig ?op? ?val? List or change sqlite3_db_config() options",
24854 #if SQLITE_SHELL_HAVE_RECOVER
24855 ".dbinfo ?DB? Show status information about the database",
24856 #endif
 
24857 ".dump ?OBJECTS? Render database content as SQL",
24858 " Options:",
24859 " --data-only Output only INSERT statements",
24860 " --newlines Allow unescaped newline characters in output",
24861 " --nosys Omit system tables (ex: \"sqlite_stat1\")",
@@ -26522,10 +26565,105 @@
26522 sqlite3_file_control(p->db, zDb, SQLITE_FCNTL_DATA_VERSION, &iDataVersion);
26523 sqlite3_fprintf(p->out, "%-20s %u\n", "data version", iDataVersion);
26524 return 0;
26525 }
26526 #endif /* SQLITE_SHELL_HAVE_RECOVER */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26527
26528 /*
26529 ** Print the given string as an error message.
26530 */
26531 static void shellEmitError(const char *zErr){
@@ -28699,10 +28837,14 @@
28699 }else{
28700 eputz("Usage: .echo on|off\n");
28701 rc = 1;
28702 }
28703 }else
 
 
 
 
28704
28705 if( c=='e' && cli_strncmp(azArg[0], "eqp", n)==0 ){
28706 if( nArg==2 ){
28707 p->autoEQPtest = 0;
28708 if( p->autoEQPtrace ){
@@ -33077,19 +33219,14 @@
33077 */
33078 if( stdin_is_interactive ){
33079 char *zHome;
33080 char *zHistory;
33081 int nHistory;
33082 #if CIO_WIN_WC_XLATE
33083 # define SHELL_CIO_CHAR_SET (stdout_is_console? " (UTF-16 console I/O)" : "")
33084 #else
33085 # define SHELL_CIO_CHAR_SET ""
33086 #endif
33087 sqlite3_fprintf(stdout,
33088 "SQLite version %s %.19s%s\n" /*extra-version-info*/
33089 "Enter \".help\" for usage hints.\n",
33090 sqlite3_libversion(), sqlite3_sourceid(), SHELL_CIO_CHAR_SET);
33091 if( warnInmemoryDb ){
33092 sputz(stdout, "Connected to a ");
33093 printBold("transient in-memory database");
33094 sputz(stdout, ".\nUse \".open FILENAME\" to reopen on a"
33095 " persistent database.\n");
33096
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -457,14 +457,24 @@
457 ** that into UTF-8. Otherwise, non-ASCII characters all get translated
458 ** into '?'.
459 */
460 wchar_t *b1 = sqlite3_malloc( sz*sizeof(wchar_t) );
461 if( b1==0 ) return 0;
462 #ifndef SQLITE_USE_STDIO_FOR_CONSOLE
463 DWORD nRead = 0;
464 if( IsConsole(in)
465 && ReadConsoleW(GetStdHandle(STD_INPUT_HANDLE), b1, sz, &nRead, 0)
466 ){
467 b1[nRead] = 0;
468 }else
469 #endif
470 {
471 _setmode(_fileno(in), IsConsole(in) ? _O_WTEXT : _O_U8TEXT);
472 if( fgetws(b1, sz/4, in)==0 ){
473 sqlite3_free(b1);
474 return 0;
475 }
476 }
477 WideCharToMultiByte(CP_UTF8, 0, b1, -1, buf, sz, 0, 0);
478 sqlite3_free(b1);
479 return buf;
480 }else{
@@ -516,24 +526,37 @@
526 if( !UseWtextForOutput(out) ){
527 /* Writing to a file or other destination, just write bytes without
528 ** any translation. */
529 return fputs(z, out);
530 }else{
531 /* One must use UTF16 in order to get unicode support when writing
532 ** to the console on Windows.
 
533 */
534 int sz = (int)strlen(z);
535 wchar_t *b1 = sqlite3_malloc( (sz+1)*sizeof(wchar_t) );
536 if( b1==0 ) return 0;
537 sz = MultiByteToWideChar(CP_UTF8, 0, z, sz, b1, sz);
538 b1[sz] = 0;
539
540 #ifndef SQLITE_STDIO_FOR_CONSOLE
541 DWORD nWr = 0;
542 if( IsConsole(out)
543 && WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE),b1,sz,&nWr,0)
544 ){
545 /* If writing to the console, then the WriteConsoleW() is all we
546 ** need to do. */
547 }else
548 #endif
549 {
550 /* For non-console I/O, or if SQLITE_USE_STDIO_FOR_CONSOLE is defined
551 ** then write using the standard library. */
552 _setmode(_fileno(out), _O_U8TEXT);
553 if( UseBinaryWText(out) ){
554 piecemealOutput(b1, sz, out);
555 }else{
556 fputws(b1, out);
557 }
558 }
559 sqlite3_free(b1);
560 return 0;
561 }
562 }
@@ -16757,10 +16780,20 @@
16780
16781 /*
16782 ** Shared-memory operations.
16783 */
16784 static int vfstraceShmLock(sqlite3_file *pFile, int ofst, int n, int flags){
16785 static const char *azLockName[] = {
16786 "WRITE",
16787 "CKPT",
16788 "RECOVER",
16789 "READ0",
16790 "READ1",
16791 "READ2",
16792 "READ3",
16793 "READ4",
16794 };
16795 vfstrace_file *p = (vfstrace_file *)pFile;
16796 vfstrace_info *pInfo = p->pInfo;
16797 int rc;
16798 char zLck[100];
16799 int i = 0;
@@ -16770,12 +16803,19 @@
16803 if( flags & SQLITE_SHM_SHARED ) strappend(zLck, &i, "|SHARED");
16804 if( flags & SQLITE_SHM_EXCLUSIVE ) strappend(zLck, &i, "|EXCLUSIVE");
16805 if( flags & ~(0xf) ){
16806 sqlite3_snprintf(sizeof(zLck)-i, &zLck[i], "|0x%x", flags);
16807 }
16808 if( ofst>=0 && ofst<sizeof(azLockName)/sizeof(azLockName[0]) ){
16809 vfstrace_printf(pInfo, "%s.xShmLock(%s,ofst=%d(%s),n=%d,%s)",
16810 pInfo->zVfsName, p->zFName, ofst, azLockName[ofst],
16811 n, &zLck[1]);
16812 }else{
16813 vfstrace_printf(pInfo, "%s.xShmLock(%s,ofst=5d,n=%d,%s)",
16814 pInfo->zVfsName, p->zFName, ofst,
16815 n, &zLck[1]);
16816 }
16817 rc = p->pReal->pMethods->xShmLock(p->pReal, ofst, n, flags);
16818 vfstrace_print_errcode(pInfo, " -> %s\n", rc);
16819 return rc;
16820 }
16821 static int vfstraceShmMap(
@@ -20231,10 +20271,12 @@
20271 apVal[iField] = sqlite3_value_dup( pVal );
20272 if( apVal[iField]==0 ){
20273 recoverError(p, SQLITE_NOMEM, 0);
20274 }
20275 p1->nVal = iField+1;
20276 }else if( pTab->nCol==0 ){
20277 p1->nVal = pTab->nCol;
20278 }
20279 p1->iPrevCell = iCell;
20280 p1->iPrevPage = iPage;
20281 }
20282 }else{
@@ -22010,11 +22052,11 @@
22052
22053 /*
22054 ** Output the given string as quoted according to JSON quoting rules.
22055 */
22056 static void output_json_string(FILE *out, const char *z, i64 n){
22057 unsigned char c;
22058 static const char *zq = "\"";
22059 static long ctrlMask = ~0L;
22060 static const char *zDQBS = "\"\\";
22061 const char *pcLimit;
22062 char ace[3] = "\\?";
@@ -22030,11 +22072,11 @@
22072 if( pcEnd > z ){
22073 sqlite3_fprintf(out, "%.*s", (int)(pcEnd-z), z);
22074 z = pcEnd;
22075 }
22076 if( z >= pcLimit ) break;
22077 c = (unsigned char)*(z++);
22078 switch( c ){
22079 case '"': case '\\':
22080 cbsSay = (char)c;
22081 break;
22082 case '\b': cbsSay = 'b'; break;
@@ -22045,11 +22087,11 @@
22087 default: cbsSay = 0; break;
22088 }
22089 if( cbsSay ){
22090 ace[1] = cbsSay;
22091 sqlite3_fputs(ace, out);
22092 }else if( c<=0x1f || c>=0x7f ){
22093 sqlite3_fprintf(out, "\\u%04x", c);
22094 }else{
22095 ace[1] = (char)c;
22096 sqlite3_fputs(ace+1, out);
22097 }
@@ -24787,13 +24829,13 @@
24829 if( rc ){
24830 sqlite3_fprintf(p->out, "/****** ERROR: %s ******/\n", zErr);
24831 }else{
24832 rc = SQLITE_CORRUPT;
24833 }
 
24834 free(zQ2);
24835 }
24836 sqlite3_free(zErr);
24837 return rc;
24838 }
24839
24840 /*
24841 ** Text of help messages.
@@ -24852,10 +24894,11 @@
24894 ".databases List names and files of attached databases",
24895 ".dbconfig ?op? ?val? List or change sqlite3_db_config() options",
24896 #if SQLITE_SHELL_HAVE_RECOVER
24897 ".dbinfo ?DB? Show status information about the database",
24898 #endif
24899 ".dbtotxt Hex dump of the database file",
24900 ".dump ?OBJECTS? Render database content as SQL",
24901 " Options:",
24902 " --data-only Output only INSERT statements",
24903 " --newlines Allow unescaped newline characters in output",
24904 " --nosys Omit system tables (ex: \"sqlite_stat1\")",
@@ -26522,10 +26565,105 @@
26565 sqlite3_file_control(p->db, zDb, SQLITE_FCNTL_DATA_VERSION, &iDataVersion);
26566 sqlite3_fprintf(p->out, "%-20s %u\n", "data version", iDataVersion);
26567 return 0;
26568 }
26569 #endif /* SQLITE_SHELL_HAVE_RECOVER */
26570
26571 /*
26572 ** Implementation of the ".dbtotxt" command.
26573 **
26574 ** Return 1 on error, 2 to exit, and 0 otherwise.
26575 */
26576 static int shell_dbtotxt_command(ShellState *p, int nArg, char **azArg){
26577 sqlite3_stmt *pStmt = 0;
26578 sqlite3_int64 nPage = 0;
26579 int pgSz = 0;
26580 const char *zFilename;
26581 const char *zTail;
26582 char *zName = 0;
26583 int rc, i, j;
26584 unsigned char bShow[256]; /* Characters ok to display */
26585
26586 memset(bShow, '.', sizeof(bShow));
26587 for(i=' '; i<='~'; i++){
26588 if( i!='{' && i!='}' && i!='"' && i!='\\' ) bShow[i] = (unsigned char)i;
26589 }
26590 rc = sqlite3_prepare_v2(p->db, "PRAGMA page_size", -1, &pStmt, 0);
26591 if( rc ) goto dbtotxt_error;
26592 rc = 0;
26593 if( sqlite3_step(pStmt)!=SQLITE_ROW ) goto dbtotxt_error;
26594 pgSz = sqlite3_column_int(pStmt, 0);
26595 sqlite3_finalize(pStmt);
26596 pStmt = 0;
26597 if( pgSz<512 || pgSz>65536 || (pgSz&(pgSz-1))!=0 ) goto dbtotxt_error;
26598 rc = sqlite3_prepare_v2(p->db, "PRAGMA page_count", -1, &pStmt, 0);
26599 if( rc ) goto dbtotxt_error;
26600 rc = 0;
26601 if( sqlite3_step(pStmt)!=SQLITE_ROW ) goto dbtotxt_error;
26602 nPage = sqlite3_column_int64(pStmt, 0);
26603 sqlite3_finalize(pStmt);
26604 pStmt = 0;
26605 if( nPage<1 ) goto dbtotxt_error;
26606 rc = sqlite3_prepare_v2(p->db, "PRAGMA databases", -1, &pStmt, 0);
26607 if( rc ) goto dbtotxt_error;
26608 rc = 0;
26609 if( sqlite3_step(pStmt)!=SQLITE_ROW ){
26610 zTail = zFilename = "unk.db";
26611 }else{
26612 zFilename = (const char*)sqlite3_column_text(pStmt, 2);
26613 if( zFilename==0 || zFilename[0]==0 ) zFilename = "unk.db";
26614 zTail = strrchr(zFilename, '/');
26615 #if defined(_WIN32)
26616 if( zTail==0 ) zTail = strrchr(zFilename, '\\');
26617 #endif
26618 if( zTail ) zFilename = zTail;
26619 }
26620 zName = strdup(zTail);
26621 shell_check_oom(zName);
26622 sqlite3_fprintf(p->out, "| size %lld pagesize %d filename %s\n",
26623 nPage*pgSz, pgSz, zName);
26624 sqlite3_finalize(pStmt);
26625 pStmt = 0;
26626 rc = sqlite3_prepare_v2(p->db,
26627 "SELECT pgno, data FROM sqlite_dbpage ORDER BY pgno", -1, &pStmt, 0);
26628 if( rc ) goto dbtotxt_error;
26629 rc = 0;
26630 while( sqlite3_step(pStmt)==SQLITE_ROW ){
26631 sqlite3_int64 pgno = sqlite3_column_int64(pStmt, 0);
26632 const u8 *aData = sqlite3_column_blob(pStmt, 1);
26633 int seenPageLabel = 0;
26634 for(i=0; i<pgSz; i+=16){
26635 const u8 *aLine = aData+i;
26636 for(j=0; j<16 && aLine[j]==0; j++){}
26637 if( j==16 ) continue;
26638 if( !seenPageLabel ){
26639 sqlite3_fprintf(p->out, "| page %lld offset %lld\n", pgno, pgno*pgSz);
26640 seenPageLabel = 1;
26641 }
26642 sqlite3_fprintf(p->out, "| %5d:", i);
26643 for(j=0; j<16; j++) sqlite3_fprintf(p->out, " %02x", aLine[j]);
26644 sqlite3_fprintf(p->out, " ");
26645 for(j=0; j<16; j++){
26646 unsigned char c = (unsigned char)aLine[j];
26647 sqlite3_fprintf(p->out, "%c", bShow[c]);
26648 }
26649 sqlite3_fprintf(p->out, "\n");
26650 }
26651 }
26652 sqlite3_finalize(pStmt);
26653 sqlite3_fprintf(p->out, "| end %s\n", zName);
26654 free(zName);
26655 return 0;
26656
26657 dbtotxt_error:
26658 if( rc ){
26659 sqlite3_fprintf(stderr, "ERROR: %s\n", sqlite3_errmsg(p->db));
26660 }
26661 sqlite3_finalize(pStmt);
26662 free(zName);
26663 return 1;
26664 }
26665
26666 /*
26667 ** Print the given string as an error message.
26668 */
26669 static void shellEmitError(const char *zErr){
@@ -28699,10 +28837,14 @@
28837 }else{
28838 eputz("Usage: .echo on|off\n");
28839 rc = 1;
28840 }
28841 }else
28842
28843 if( c=='d' && n>=3 && cli_strncmp(azArg[0], "dbtotxt", n)==0 ){
28844 rc = shell_dbtotxt_command(p, nArg, azArg);
28845 }else
28846
28847 if( c=='e' && cli_strncmp(azArg[0], "eqp", n)==0 ){
28848 if( nArg==2 ){
28849 p->autoEQPtest = 0;
28850 if( p->autoEQPtrace ){
@@ -33077,19 +33219,14 @@
33219 */
33220 if( stdin_is_interactive ){
33221 char *zHome;
33222 char *zHistory;
33223 int nHistory;
 
 
 
 
 
33224 sqlite3_fprintf(stdout,
33225 "SQLite version %s %.19s\n" /*extra-version-info*/
33226 "Enter \".help\" for usage hints.\n",
33227 sqlite3_libversion(), sqlite3_sourceid());
33228 if( warnInmemoryDb ){
33229 sputz(stdout, "Connected to a ");
33230 printBold("transient in-memory database");
33231 sputz(stdout, ".\nUse \".open FILENAME\" to reopen on a"
33232 " persistent database.\n");
33233
+56 -862
--- 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
-** 5495b12569c318d5020b4b5a625a392ef8e7 with changes in files:
21
+** 81202d2ab5963fdcf20555b6d0b31cc955ac with changes in files:
2222
**
2323
**
2424
*/
2525
#ifndef SQLITE_AMALGAMATION
2626
#define SQLITE_CORE 1
@@ -27,11 +27,10 @@
2727
#define SQLITE_AMALGAMATION 1
2828
#ifndef SQLITE_PRIVATE
2929
# define SQLITE_PRIVATE static
3030
#endif
3131
/************** Begin file sqliteInt.h ***************************************/
32
-#line 1 "tsrc/sqliteInt.h"
3332
/*
3433
** 2001 September 15
3534
**
3635
** The author disclaims copyright to this source code. In place of
3736
** a legal notice, here is a blessing:
@@ -88,11 +87,10 @@
8887
** compiler warnings due to subsequent content in this file and other files
8988
** that are included by this file.
9089
*/
9190
/************** Include msvc.h in the middle of sqliteInt.h ******************/
9291
/************** Begin file msvc.h ********************************************/
93
-#line 1 "tsrc/msvc.h"
9492
/*
9593
** 2015 January 12
9694
**
9795
** The author disclaims copyright to this source code. In place of
9896
** a legal notice, here is a blessing:
@@ -137,18 +135,16 @@
137135
138136
#endif /* SQLITE_MSVC_H */
139137
140138
/************** End of msvc.h ************************************************/
141139
/************** Continuing where we left off in sqliteInt.h ******************/
142
-#line 60 "tsrc/sqliteInt.h"
143140
144141
/*
145142
** Special setup for VxWorks
146143
*/
147144
/************** Include vxworks.h in the middle of sqliteInt.h ***************/
148145
/************** Begin file vxworks.h *****************************************/
149
-#line 1 "tsrc/vxworks.h"
150146
/*
151147
** 2015-03-02
152148
**
153149
** The author disclaims copyright to this source code. In place of
154150
** a legal notice, here is a blessing:
@@ -180,11 +176,10 @@
180176
#define HAVE_LSTAT 1
181177
#endif /* defined(_WRS_KERNEL) */
182178
183179
/************** End of vxworks.h *********************************************/
184180
/************** Continuing where we left off in sqliteInt.h ******************/
185
-#line 65 "tsrc/sqliteInt.h"
186181
187182
/*
188183
** These #defines should enable >2GB file support on POSIX if the
189184
** underlying operating system supports it. If the OS lacks
190185
** large file support, or if the OS is windows, these should be no-ops.
@@ -320,11 +315,10 @@
320315
** first in QNX. Also, the _USE_32BIT_TIME_T macro must appear first for
321316
** MinGW.
322317
*/
323318
/************** Include sqlite3.h in the middle of sqliteInt.h ***************/
324319
/************** Begin file sqlite3.h *****************************************/
325
-#line 1 "tsrc/sqlite3.h"
326320
/*
327321
** 2001-09-15
328322
**
329323
** The author disclaims copyright to this source code. In place of
330324
** a legal notice, here is a blessing:
@@ -471,11 +465,11 @@
471465
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
472466
** [sqlite_version()] and [sqlite_source_id()].
473467
*/
474468
#define SQLITE_VERSION "3.48.0"
475469
#define SQLITE_VERSION_NUMBER 3048000
476
-#define SQLITE_SOURCE_ID "2024-11-06 12:58:31 5495b12569c318d5020b4b5a625a392ef8e777b81c0200624fbbc2a6b5eddef9"
470
+#define SQLITE_SOURCE_ID "2024-11-14 19:34:28 81202d2ab5963fdcf20555b6d0b31cc955ac27f1cd87656faea5c0611c9a2ee8"
477471
478472
/*
479473
** CAPI3REF: Run-Time Library Version Numbers
480474
** KEYWORDS: sqlite3_version sqlite3_sourceid
481475
**
@@ -1423,10 +1417,15 @@
14231417
** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This
14241418
** opcode causes the xFileControl method to swap the file handle with the one
14251419
** pointed to by the pArg argument. This capability is used during testing
14261420
** and only needs to be supported when SQLITE_TEST is defined.
14271421
**
1422
+** <li>[[SQLITE_FCNTL_NULL_IO]]
1423
+** The [SQLITE_FCNTL_NULL_IO] opcode sets the low-level file descriptor
1424
+** or file handle for the [sqlite3_file] object such that it will no longer
1425
+** read or write to the database file.
1426
+**
14281427
** <li>[[SQLITE_FCNTL_WAL_BLOCK]]
14291428
** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
14301429
** be advantageous to block on the next WAL lock if the lock is not immediately
14311430
** available. The WAL subsystem issues this signal during rare
14321431
** circumstances in order to fix a problem with priority inversion.
@@ -1576,10 +1575,11 @@
15761575
#define SQLITE_FCNTL_RESERVE_BYTES 38
15771576
#define SQLITE_FCNTL_CKPT_START 39
15781577
#define SQLITE_FCNTL_EXTERNAL_READER 40
15791578
#define SQLITE_FCNTL_CKSM_FILE 41
15801579
#define SQLITE_FCNTL_RESET_CACHE 42
1580
+#define SQLITE_FCNTL_NULL_IO 43
15811581
15821582
/* deprecated names */
15831583
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
15841584
#define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
15851585
#define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
@@ -2954,14 +2954,18 @@
29542954
**
29552955
** ^These functions return the number of rows modified, inserted or
29562956
** deleted by the most recently completed INSERT, UPDATE or DELETE
29572957
** statement on the database connection specified by the only parameter.
29582958
** The two functions are identical except for the type of the return value
2959
-** and that if the number of rows modified by the most recent INSERT, UPDATE
2959
+** and that if the number of rows modified by the most recent INSERT, UPDATE,
29602960
** or DELETE is greater than the maximum value supported by type "int", then
29612961
** the return value of sqlite3_changes() is undefined. ^Executing any other
29622962
** type of SQL statement does not modify the value returned by these functions.
2963
+** For the purposes of this interface, a CREATE TABLE AS SELECT statement
2964
+** does not count as an INSERT, UPDATE or DELETE statement and hence the rows
2965
+** added to the new table by the CREATE TABLE AS SELECT statement are not
2966
+** counted.
29632967
**
29642968
** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
29652969
** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
29662970
** [foreign key actions] or [REPLACE] constraint resolution are not counted.
29672971
**
@@ -13908,11 +13912,10 @@
1390813912
/******** End of fts5.h *********/
1390913913
#endif /* SQLITE3_H */
1391013914
1391113915
/************** End of sqlite3.h *********************************************/
1391213916
/************** Continuing where we left off in sqliteInt.h ******************/
13913
-#line 203 "tsrc/sqliteInt.h"
1391413917
1391513918
/*
1391613919
** Reuse the STATIC_LRU for mutex access to sqlite3_temp_directory.
1391713920
*/
1391813921
#define SQLITE_MUTEX_STATIC_TEMPDIR SQLITE_MUTEX_STATIC_VFS1
@@ -13926,11 +13929,10 @@
1392613929
#define SQLITECONFIG_H 1
1392713930
#endif
1392813931
1392913932
/************** Include sqliteLimit.h in the middle of sqliteInt.h ***********/
1393013933
/************** Begin file sqliteLimit.h *************************************/
13931
-#line 1 "tsrc/sqliteLimit.h"
1393213934
/*
1393313935
** 2007 May 7
1393413936
**
1393513937
** The author disclaims copyright to this source code. In place of
1393613938
** a legal notice, here is a blessing:
@@ -13952,10 +13954,11 @@
1395213954
** to count the size: 2^31-1 or 2147483647.
1395313955
*/
1395413956
#ifndef SQLITE_MAX_LENGTH
1395513957
# define SQLITE_MAX_LENGTH 1000000000
1395613958
#endif
13959
+#define SQLITE_MIN_LENGTH 30 /* Minimum value for the length limit */
1395713960
1395813961
/*
1395913962
** This is the maximum number of
1396013963
**
1396113964
** * Columns in a table
@@ -14140,11 +14143,10 @@
1414014143
# define SQLITE_MAX_TRIGGER_DEPTH 1000
1414114144
#endif
1414214145
1414314146
/************** End of sqliteLimit.h *****************************************/
1414414147
/************** Continuing where we left off in sqliteInt.h ******************/
14145
-#line 219 "tsrc/sqliteInt.h"
1414614148
1414714149
/* Disable nuisance warnings on Borland compilers */
1414814150
#if defined(__BORLANDC__)
1414914151
#pragma warn -rch /* unreachable code */
1415014152
#pragma warn -ccc /* Condition is always true or false */
@@ -14558,11 +14560,10 @@
1455814560
#define likely(X) (X)
1455914561
#define unlikely(X) (X)
1456014562
1456114563
/************** Include hash.h in the middle of sqliteInt.h ******************/
1456214564
/************** Begin file hash.h ********************************************/
14563
-#line 1 "tsrc/hash.h"
1456414565
/*
1456514566
** 2001 September 22
1456614567
**
1456714568
** The author disclaims copyright to this source code. In place of
1456814569
** a legal notice, here is a blessing:
@@ -14658,14 +14659,12 @@
1465814659
1465914660
#endif /* SQLITE_HASH_H */
1466014661
1466114662
/************** End of hash.h ************************************************/
1466214663
/************** Continuing where we left off in sqliteInt.h ******************/
14663
-#line 635 "tsrc/sqliteInt.h"
1466414664
/************** Include parse.h in the middle of sqliteInt.h *****************/
1466514665
/************** Begin file parse.h *******************************************/
14666
-#line 1 "tsrc/parse.h"
1466714666
#define TK_SEMI 1
1466814667
#define TK_EXPLAIN 2
1466914668
#define TK_QUERY 3
1467014669
#define TK_PLAN 4
1467114670
#define TK_BEGIN 5
@@ -14850,11 +14849,10 @@
1485014849
#define TK_SPACE 184
1485114850
#define TK_ILLEGAL 185
1485214851
1485314852
/************** End of parse.h ***********************************************/
1485414853
/************** Continuing where we left off in sqliteInt.h ******************/
14855
-#line 636 "tsrc/sqliteInt.h"
1485614854
#include <stdio.h>
1485714855
#include <stdlib.h>
1485814856
#include <string.h>
1485914857
#include <assert.h>
1486014858
#include <stddef.h>
@@ -15616,11 +15614,10 @@
1561615614
** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque
1561715615
** pointer types (i.e. FuncDef) defined above.
1561815616
*/
1561915617
/************** Include os.h in the middle of sqliteInt.h ********************/
1562015618
/************** Begin file os.h **********************************************/
15621
-#line 1 "tsrc/os.h"
1562215619
/*
1562315620
** 2001 September 16
1562415621
**
1562515622
** The author disclaims copyright to this source code. In place of
1562615623
** a legal notice, here is a blessing:
@@ -15645,11 +15642,10 @@
1564515642
** Attempt to automatically detect the operating system and setup the
1564615643
** necessary pre-processor macros for it.
1564715644
*/
1564815645
/************** Include os_setup.h in the middle of os.h *********************/
1564915646
/************** Begin file os_setup.h ****************************************/
15650
-#line 1 "tsrc/os_setup.h"
1565115647
/*
1565215648
** 2013 November 25
1565315649
**
1565415650
** The author disclaims copyright to this source code. In place of
1565515651
** a legal notice, here is a blessing:
@@ -15740,11 +15736,10 @@
1574015736
1574115737
#endif /* SQLITE_OS_SETUP_H */
1574215738
1574315739
/************** End of os_setup.h ********************************************/
1574415740
/************** Continuing where we left off in os.h *************************/
15745
-#line 28 "tsrc/os.h"
1574615741
1574715742
/* If the SET_FULLSYNC macro is not defined above, then make it
1574815743
** a no-op
1574915744
*/
1575015745
#ifndef SET_FULLSYNC
@@ -15942,14 +15937,12 @@
1594215937
1594315938
#endif /* _SQLITE_OS_H_ */
1594415939
1594515940
/************** End of os.h **************************************************/
1594615941
/************** Continuing where we left off in sqliteInt.h ******************/
15947
-#line 1400 "tsrc/sqliteInt.h"
1594815942
/************** Include pager.h in the middle of sqliteInt.h *****************/
1594915943
/************** Begin file pager.h *******************************************/
15950
-#line 1 "tsrc/pager.h"
1595115944
/*
1595215945
** 2001 September 15
1595315946
**
1595415947
** The author disclaims copyright to this source code. In place of
1595515948
** a legal notice, here is a blessing:
@@ -16196,14 +16189,12 @@
1619616189
1619716190
#endif /* SQLITE_PAGER_H */
1619816191
1619916192
/************** End of pager.h ***********************************************/
1620016193
/************** Continuing where we left off in sqliteInt.h ******************/
16201
-#line 1401 "tsrc/sqliteInt.h"
1620216194
/************** Include btree.h in the middle of sqliteInt.h *****************/
1620316195
/************** Begin file btree.h *******************************************/
16204
-#line 1 "tsrc/btree.h"
1620516196
/*
1620616197
** 2001 September 15
1620716198
**
1620816199
** The author disclaims copyright to this source code. In place of
1620916200
** a legal notice, here is a blessing:
@@ -16627,14 +16618,12 @@
1662716618
1662816619
#endif /* SQLITE_BTREE_H */
1662916620
1663016621
/************** End of btree.h ***********************************************/
1663116622
/************** Continuing where we left off in sqliteInt.h ******************/
16632
-#line 1402 "tsrc/sqliteInt.h"
1663316623
/************** Include vdbe.h in the middle of sqliteInt.h ******************/
1663416624
/************** Begin file vdbe.h ********************************************/
16635
-#line 1 "tsrc/vdbe.h"
1663616625
/*
1663716626
** 2001 September 15
1663816627
**
1663916628
** The author disclaims copyright to this source code. In place of
1664016629
** a legal notice, here is a blessing:
@@ -16814,11 +16803,10 @@
1681416803
** The makefile scans the vdbe.c source file and creates the "opcodes.h"
1681516804
** header file that defines a number for each opcode used by the VDBE.
1681616805
*/
1681716806
/************** Include opcodes.h in the middle of vdbe.h ********************/
1681816807
/************** Begin file opcodes.h *****************************************/
16819
-#line 1 "tsrc/opcodes.h"
1682016808
/* Automatically generated. Do not edit */
1682116809
/* See the tool/mkopcodeh.tcl script for details */
1682216810
#define OP_Savepoint 0
1682316811
#define OP_AutoCommit 1
1682416812
#define OP_Transaction 2
@@ -17056,11 +17044,10 @@
1705617044
*/
1705717045
#define SQLITE_MX_JUMP_OPCODE 64 /* Maximum JUMP opcode */
1705817046
1705917047
/************** End of opcodes.h *********************************************/
1706017048
/************** Continuing where we left off in vdbe.h ***********************/
17061
-#line 183 "tsrc/vdbe.h"
1706217049
1706317050
/*
1706417051
** Additional non-public SQLITE_PREPARE_* flags
1706517052
*/
1706617053
#define SQLITE_PREPARE_SAVESQL 0x80 /* Preserve SQL text */
@@ -17306,14 +17293,12 @@
1730617293
1730717294
#endif /* SQLITE_VDBE_H */
1730817295
1730917296
/************** End of vdbe.h ************************************************/
1731017297
/************** Continuing where we left off in sqliteInt.h ******************/
17311
-#line 1403 "tsrc/sqliteInt.h"
1731217298
/************** Include pcache.h in the middle of sqliteInt.h ****************/
1731317299
/************** Begin file pcache.h ******************************************/
17314
-#line 1 "tsrc/pcache.h"
1731517300
/*
1731617301
** 2008 August 05
1731717302
**
1731817303
** The author disclaims copyright to this source code. In place of
1731917304
** a legal notice, here is a blessing:
@@ -17503,14 +17488,12 @@
1750317488
1750417489
#endif /* _PCACHE_H_ */
1750517490
1750617491
/************** End of pcache.h **********************************************/
1750717492
/************** Continuing where we left off in sqliteInt.h ******************/
17508
-#line 1404 "tsrc/sqliteInt.h"
1750917493
/************** Include mutex.h in the middle of sqliteInt.h *****************/
1751017494
/************** Begin file mutex.h *******************************************/
17511
-#line 1 "tsrc/mutex.h"
1751217495
/*
1751317496
** 2007 August 28
1751417497
**
1751517498
** The author disclaims copyright to this source code. In place of
1751617499
** a legal notice, here is a blessing:
@@ -17581,11 +17564,10 @@
1758117564
SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
1758217565
#endif /* defined(SQLITE_MUTEX_OMIT) */
1758317566
1758417567
/************** End of mutex.h ***********************************************/
1758517568
/************** Continuing where we left off in sqliteInt.h ******************/
17586
-#line 1405 "tsrc/sqliteInt.h"
1758717569
1758817570
/* The SQLITE_EXTRA_DURABLE compile-time option used to set the default
1758917571
** synchronous setting to EXTRA. It is no longer supported.
1759017572
*/
1759117573
#ifdef SQLITE_EXTRA_DURABLE
@@ -21982,11 +21964,10 @@
2198221964
2198321965
#endif /* SQLITEINT_H */
2198421966
2198521967
/************** End of sqliteInt.h *******************************************/
2198621968
/************** Begin file os_common.h ***************************************/
21987
-#line 1 "tsrc/os_common.h"
2198821969
/*
2198921970
** 2004 May 22
2199021971
**
2199121972
** The author disclaims copyright to this source code. In place of
2199221973
** a legal notice, here is a blessing:
@@ -22085,11 +22066,10 @@
2208522066
2208622067
#endif /* !defined(_OS_COMMON_H_) */
2208722068
2208822069
/************** End of os_common.h *******************************************/
2208922070
/************** Begin file ctime.c *******************************************/
22090
-#line 1 "tsrc/ctime.c"
2209122071
/* DO NOT EDIT!
2209222072
** This file is automatically generated by the script in the canonical
2209322073
** SQLite source tree at tool/mkctimec.tcl.
2209422074
**
2209522075
** To modify this header, edit any of the various lists in that script
@@ -22885,11 +22865,10 @@
2288522865
2288622866
#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
2288722867
2288822868
/************** End of ctime.c ***********************************************/
2288922869
/************** Begin file global.c ******************************************/
22890
-#line 1 "tsrc/global.c"
2289122870
/*
2289222871
** 2008 June 13
2289322872
**
2289422873
** The author disclaims copyright to this source code. In place of
2289522874
** a legal notice, here is a blessing:
@@ -23290,11 +23269,10 @@
2329023269
"TEXT"
2329123270
};
2329223271
2329323272
/************** End of global.c **********************************************/
2329423273
/************** Begin file status.c ******************************************/
23295
-#line 1 "tsrc/status.c"
2329623274
/*
2329723275
** 2008 June 18
2329823276
**
2329923277
** The author disclaims copyright to this source code. In place of
2330023278
** a legal notice, here is a blessing:
@@ -23309,11 +23287,10 @@
2330923287
** functionality.
2331023288
*/
2331123289
/* #include "sqliteInt.h" */
2331223290
/************** Include vdbeInt.h in the middle of status.c ******************/
2331323291
/************** Begin file vdbeInt.h *****************************************/
23314
-#line 1 "tsrc/vdbeInt.h"
2331523292
/*
2331623293
** 2003 September 6
2331723294
**
2331823295
** The author disclaims copyright to this source code. In place of
2331923296
** a legal notice, here is a blessing:
@@ -24046,11 +24023,10 @@
2404624023
2404724024
#endif /* !defined(SQLITE_VDBEINT_H) */
2404824025
2404924026
/************** End of vdbeInt.h *********************************************/
2405024027
/************** Continuing where we left off in status.c *********************/
24051
-#line 18 "tsrc/status.c"
2405224028
2405324029
/*
2405424030
** Variables in which to record status information.
2405524031
*/
2405624032
#if SQLITE_PTRSIZE>4
@@ -24431,11 +24407,10 @@
2443124407
return rc;
2443224408
}
2443324409
2443424410
/************** End of status.c **********************************************/
2443524411
/************** Begin file date.c ********************************************/
24436
-#line 1 "tsrc/date.c"
2443724412
/*
2443824413
** 2003 October 31
2443924414
**
2444024415
** The author disclaims copyright to this source code. In place of
2444124416
** a legal notice, here is a blessing:
@@ -26250,11 +26225,10 @@
2625026225
sqlite3InsertBuiltinFuncs(aDateTimeFuncs, ArraySize(aDateTimeFuncs));
2625126226
}
2625226227
2625326228
/************** End of date.c ************************************************/
2625426229
/************** Begin file os.c **********************************************/
26255
-#line 1 "tsrc/os.c"
2625626230
/*
2625726231
** 2005 November 29
2625826232
**
2625926233
** The author disclaims copyright to this source code. In place of
2626026234
** a legal notice, here is a blessing:
@@ -26701,11 +26675,10 @@
2670126675
return SQLITE_OK;
2670226676
}
2670326677
2670426678
/************** End of os.c **************************************************/
2670526679
/************** Begin file fault.c *******************************************/
26706
-#line 1 "tsrc/fault.c"
2670726680
/*
2670826681
** 2008 Jan 22
2670926682
**
2671026683
** The author disclaims copyright to this source code. In place of
2671126684
** a legal notice, here is a blessing:
@@ -26792,11 +26765,10 @@
2679226765
2679326766
#endif /* #ifndef SQLITE_UNTESTABLE */
2679426767
2679526768
/************** End of fault.c ***********************************************/
2679626769
/************** Begin file mem0.c ********************************************/
26797
-#line 1 "tsrc/mem0.c"
2679826770
/*
2679926771
** 2008 October 28
2680026772
**
2680126773
** The author disclaims copyright to this source code. In place of
2680226774
** a legal notice, here is a blessing:
@@ -26855,11 +26827,10 @@
2685526827
2685626828
#endif /* SQLITE_ZERO_MALLOC */
2685726829
2685826830
/************** End of mem0.c ************************************************/
2685926831
/************** Begin file mem1.c ********************************************/
26860
-#line 1 "tsrc/mem1.c"
2686126832
/*
2686226833
** 2007 August 14
2686326834
**
2686426835
** The author disclaims copyright to this source code. In place of
2686526836
** a legal notice, here is a blessing:
@@ -27150,11 +27121,10 @@
2715027121
2715127122
#endif /* SQLITE_SYSTEM_MALLOC */
2715227123
2715327124
/************** End of mem1.c ************************************************/
2715427125
/************** Begin file mem2.c ********************************************/
27155
-#line 1 "tsrc/mem2.c"
2715627126
/*
2715727127
** 2007 August 15
2715827128
**
2715927129
** The author disclaims copyright to this source code. In place of
2716027130
** a legal notice, here is a blessing:
@@ -27682,11 +27652,10 @@
2768227652
2768327653
#endif /* SQLITE_MEMDEBUG */
2768427654
2768527655
/************** End of mem2.c ************************************************/
2768627656
/************** Begin file mem3.c ********************************************/
27687
-#line 1 "tsrc/mem3.c"
2768827657
/*
2768927658
** 2007 October 14
2769027659
**
2769127660
** The author disclaims copyright to this source code. In place of
2769227661
** a legal notice, here is a blessing:
@@ -28373,11 +28342,10 @@
2837328342
2837428343
#endif /* SQLITE_ENABLE_MEMSYS3 */
2837528344
2837628345
/************** End of mem3.c ************************************************/
2837728346
/************** Begin file mem5.c ********************************************/
28378
-#line 1 "tsrc/mem5.c"
2837928347
/*
2838028348
** 2007 October 14
2838128349
**
2838228350
** The author disclaims copyright to this source code. In place of
2838328351
** a legal notice, here is a blessing:
@@ -28962,11 +28930,10 @@
2896228930
2896328931
#endif /* SQLITE_ENABLE_MEMSYS5 */
2896428932
2896528933
/************** End of mem5.c ************************************************/
2896628934
/************** Begin file mutex.c *******************************************/
28967
-#line 1 "tsrc/mutex.c"
2896828935
/*
2896928936
** 2007 August 14
2897028937
**
2897128938
** The author disclaims copyright to this source code. In place of
2897228939
** a legal notice, here is a blessing:
@@ -29340,11 +29307,10 @@
2934029307
2934129308
#endif /* !defined(SQLITE_MUTEX_OMIT) */
2934229309
2934329310
/************** End of mutex.c ***********************************************/
2934429311
/************** Begin file mutex_noop.c **************************************/
29345
-#line 1 "tsrc/mutex_noop.c"
2934629312
/*
2934729313
** 2008 October 07
2934829314
**
2934929315
** The author disclaims copyright to this source code. In place of
2935029316
** a legal notice, here is a blessing:
@@ -29559,11 +29525,10 @@
2955929525
#endif /* defined(SQLITE_MUTEX_NOOP) */
2956029526
#endif /* !defined(SQLITE_MUTEX_OMIT) */
2956129527
2956229528
/************** End of mutex_noop.c ******************************************/
2956329529
/************** Begin file mutex_unix.c **************************************/
29564
-#line 1 "tsrc/mutex_unix.c"
2956529530
/*
2956629531
** 2007 August 28
2956729532
**
2956829533
** The author disclaims copyright to this source code. In place of
2956929534
** a legal notice, here is a blessing:
@@ -29957,11 +29922,10 @@
2995729922
2995829923
#endif /* SQLITE_MUTEX_PTHREADS */
2995929924
2996029925
/************** End of mutex_unix.c ******************************************/
2996129926
/************** Begin file mutex_w32.c ***************************************/
29962
-#line 1 "tsrc/mutex_w32.c"
2996329927
/*
2996429928
** 2007 August 14
2996529929
**
2996629930
** The author disclaims copyright to this source code. In place of
2996729931
** a legal notice, here is a blessing:
@@ -29984,11 +29948,10 @@
2998429948
/*
2998529949
** Include the header file for the Windows VFS.
2998629950
*/
2998729951
/************** Include os_win.h in the middle of mutex_w32.c ****************/
2998829952
/************** Begin file os_win.h ******************************************/
29989
-#line 1 "tsrc/os_win.h"
2999029953
/*
2999129954
** 2013 November 25
2999229955
**
2999329956
** The author disclaims copyright to this source code. In place of
2999429957
** a legal notice, here is a blessing:
@@ -30076,11 +30039,10 @@
3007630039
3007730040
#endif /* SQLITE_OS_WIN_H */
3007830041
3007930042
/************** End of os_win.h **********************************************/
3008030043
/************** Continuing where we left off in mutex_w32.c ******************/
30081
-#line 26 "tsrc/mutex_w32.c"
3008230044
#endif
3008330045
3008430046
/*
3008530047
** The code in this file is only used if we are compiling multithreaded
3008630048
** on a Win32 system.
@@ -30454,11 +30416,10 @@
3045430416
3045530417
#endif /* SQLITE_MUTEX_W32 */
3045630418
3045730419
/************** End of mutex_w32.c *******************************************/
3045830420
/************** Begin file malloc.c ******************************************/
30459
-#line 1 "tsrc/malloc.c"
3046030421
/*
3046130422
** 2001 September 15
3046230423
**
3046330424
** The author disclaims copyright to this source code. In place of
3046430425
** a legal notice, here is a blessing:
@@ -31378,11 +31339,10 @@
3137831339
return 0;
3137931340
}
3138031341
3138131342
/************** End of malloc.c **********************************************/
3138231343
/************** Begin file printf.c ******************************************/
31383
-#line 1 "tsrc/printf.c"
3138431344
/*
3138531345
** The "printf" code that follows dates from the 1980's. It is in
3138631346
** the public domain.
3138731347
**
3138831348
**************************************************************************
@@ -32828,11 +32788,10 @@
3282832788
}
3282932789
}
3283032790
3283132791
/************** End of printf.c **********************************************/
3283232792
/************** Begin file treeview.c ****************************************/
32833
-#line 1 "tsrc/treeview.c"
3283432793
/*
3283532794
** 2015-06-08
3283632795
**
3283732796
** The author disclaims copyright to this source code. In place of
3283832797
** a legal notice, here is a blessing:
@@ -34160,11 +34119,10 @@
3416034119
3416134120
#endif /* SQLITE_DEBUG */
3416234121
3416334122
/************** End of treeview.c ********************************************/
3416434123
/************** Begin file random.c ******************************************/
34165
-#line 1 "tsrc/random.c"
3416634124
/*
3416734125
** 2001 September 15
3416834126
**
3416934127
** The author disclaims copyright to this source code. In place of
3417034128
** a legal notice, here is a blessing:
@@ -34321,11 +34279,10 @@
3432134279
}
3432234280
#endif /* SQLITE_UNTESTABLE */
3432334281
3432434282
/************** End of random.c **********************************************/
3432534283
/************** Begin file threads.c *****************************************/
34326
-#line 1 "tsrc/threads.c"
3432734284
/*
3432834285
** 2012 July 21
3432934286
**
3433034287
** The author disclaims copyright to this source code. In place of
3433134288
** a legal notice, here is a blessing:
@@ -34599,11 +34556,10 @@
3459934556
/****************************** End Single-Threaded *************************/
3460034557
#endif /* SQLITE_MAX_WORKER_THREADS>0 */
3460134558
3460234559
/************** End of threads.c *********************************************/
3460334560
/************** Begin file utf.c *********************************************/
34604
-#line 1 "tsrc/utf.c"
3460534561
/*
3460634562
** 2004 April 13
3460734563
**
3460834564
** The author disclaims copyright to this source code. In place of
3460934565
** a legal notice, here is a blessing:
@@ -35171,11 +35127,10 @@
3517135127
#endif /* SQLITE_TEST */
3517235128
#endif /* SQLITE_OMIT_UTF16 */
3517335129
3517435130
/************** End of utf.c *************************************************/
3517535131
/************** Begin file util.c ********************************************/
35176
-#line 1 "tsrc/util.c"
3517735132
/*
3517835133
** 2001 September 15
3517935134
**
3518035135
** The author disclaims copyright to this source code. In place of
3518135136
** a legal notice, here is a blessing:
@@ -37023,11 +36978,10 @@
3702336978
return 0;
3702436979
}
3702536980
3702636981
/************** End of util.c ************************************************/
3702736982
/************** Begin file hash.c ********************************************/
37028
-#line 1 "tsrc/hash.c"
3702936983
/*
3703036984
** 2001 September 22
3703136985
**
3703236986
** The author disclaims copyright to this source code. In place of
3703336987
** a legal notice, here is a blessing:
@@ -37297,11 +37251,10 @@
3729737251
return 0;
3729837252
}
3729937253
3730037254
/************** End of hash.c ************************************************/
3730137255
/************** Begin file opcodes.c *****************************************/
37302
-#line 1 "tsrc/opcodes.c"
3730337256
/* Automatically generated. Do not edit */
3730437257
/* See the tool/mkopcodec.tcl script for details. */
3730537258
#if !defined(SQLITE_OMIT_EXPLAIN) \
3730637259
|| defined(VDBE_PROFILE) \
3730737260
|| defined(SQLITE_DEBUG)
@@ -37507,11 +37460,10 @@
3750737460
}
3750837461
#endif
3750937462
3751037463
/************** End of opcodes.c *********************************************/
3751137464
/************** Begin file os_kv.c *******************************************/
37512
-#line 1 "tsrc/os_kv.c"
3751337465
/*
3751437466
** 2022-09-06
3751537467
**
3751637468
** The author disclaims copyright to this source code. In place of
3751737469
** a legal notice, here is a blessing:
@@ -38490,11 +38442,10 @@
3849038442
}
3849138443
#endif
3849238444
3849338445
/************** End of os_kv.c ***********************************************/
3849438446
/************** Begin file os_unix.c *****************************************/
38495
-#line 1 "tsrc/os_unix.c"
3849638447
/*
3849738448
** 2004 May 22
3849838449
**
3849938450
** The author disclaims copyright to this source code. In place of
3850038451
** a legal notice, here is a blessing:
@@ -42480,10 +42431,15 @@
4248042431
int rc = osIoctl(pFile->h, F2FS_IOC_ABORT_VOLATILE_WRITE);
4248142432
return rc ? SQLITE_IOERR_ROLLBACK_ATOMIC : SQLITE_OK;
4248242433
}
4248342434
#endif /* __linux__ && SQLITE_ENABLE_BATCH_ATOMIC_WRITE */
4248442435
42436
+ case SQLITE_FCNTL_NULL_IO: {
42437
+ osClose(pFile->h);
42438
+ pFile->h = -1;
42439
+ return SQLITE_OK;
42440
+ }
4248542441
case SQLITE_FCNTL_LOCKSTATE: {
4248642442
*(int*)pArg = pFile->eFileLock;
4248742443
return SQLITE_OK;
4248842444
}
4248942445
case SQLITE_FCNTL_LAST_ERRNO: {
@@ -46760,11 +46716,10 @@
4676046716
4676146717
#endif /* SQLITE_OS_UNIX */
4676246718
4676346719
/************** End of os_unix.c *********************************************/
4676446720
/************** Begin file os_win.c ******************************************/
46765
-#line 1 "tsrc/os_win.c"
4676646721
/*
4676746722
** 2004 May 22
4676846723
**
4676946724
** The author disclaims copyright to this source code. In place of
4677046725
** a legal notice, here is a blessing:
@@ -50362,10 +50317,15 @@
5036250317
OSTRACE(("FCNTL oldFile=%p, newFile=%p, rc=SQLITE_OK\n",
5036350318
hOldFile, pFile->h));
5036450319
return SQLITE_OK;
5036550320
}
5036650321
#endif
50322
+ case SQLITE_FCNTL_NULL_IO: {
50323
+ (void)osCloseHandle(pFile->h);
50324
+ pFile->h = NULL;
50325
+ return SQLITE_OK;
50326
+ }
5036750327
case SQLITE_FCNTL_TEMPFILENAME: {
5036850328
char *zTFile = 0;
5036950329
int rc = winGetTempname(pFile->pVfs, &zTFile);
5037050330
if( rc==SQLITE_OK ){
5037150331
*(char**)pArg = zTFile;
@@ -52975,11 +52935,10 @@
5297552935
5297652936
#endif /* SQLITE_OS_WIN */
5297752937
5297852938
/************** End of os_win.c **********************************************/
5297952939
/************** Begin file memdb.c *******************************************/
52980
-#line 1 "tsrc/memdb.c"
5298152940
/*
5298252941
** 2016-09-07
5298352942
**
5298452943
** The author disclaims copyright to this source code. In place of
5298552944
** a legal notice, here is a blessing:
@@ -53915,11 +53874,10 @@
5391553874
}
5391653875
#endif /* SQLITE_OMIT_DESERIALIZE */
5391753876
5391853877
/************** End of memdb.c ***********************************************/
5391953878
/************** Begin file bitvec.c ******************************************/
53920
-#line 1 "tsrc/bitvec.c"
5392153879
/*
5392253880
** 2008 February 16
5392353881
**
5392453882
** The author disclaims copyright to this source code. In place of
5392553883
** a legal notice, here is a blessing:
@@ -54330,11 +54288,10 @@
5433054288
}
5433154289
#endif /* SQLITE_UNTESTABLE */
5433254290
5433354291
/************** End of bitvec.c **********************************************/
5433454292
/************** Begin file pcache.c ******************************************/
54335
-#line 1 "tsrc/pcache.c"
5433654293
/*
5433754294
** 2008 August 05
5433854295
**
5433954296
** The author disclaims copyright to this source code. In place of
5434054297
** a legal notice, here is a blessing:
@@ -55270,11 +55227,10 @@
5527055227
}
5527155228
#endif
5527255229
5527355230
/************** End of pcache.c **********************************************/
5527455231
/************** Begin file pcache1.c *****************************************/
55275
-#line 1 "tsrc/pcache1.c"
5527655232
/*
5527755233
** 2008 November 05
5527855234
**
5527955235
** The author disclaims copyright to this source code. In place of
5528055236
** a legal notice, here is a blessing:
@@ -56556,11 +56512,10 @@
5655656512
}
5655756513
#endif
5655856514
5655956515
/************** End of pcache1.c *********************************************/
5656056516
/************** Begin file rowset.c ******************************************/
56561
-#line 1 "tsrc/rowset.c"
5656256517
/*
5656356518
** 2008 December 3
5656456519
**
5656556520
** The author disclaims copyright to this source code. In place of
5656656521
** a legal notice, here is a blessing:
@@ -57062,11 +57017,10 @@
5706257017
return 0;
5706357018
}
5706457019
5706557020
/************** End of rowset.c **********************************************/
5706657021
/************** Begin file pager.c *******************************************/
57067
-#line 1 "tsrc/pager.c"
5706857022
/*
5706957023
** 2001 September 15
5707057024
**
5707157025
** The author disclaims copyright to this source code. In place of
5707257026
** a legal notice, here is a blessing:
@@ -57087,11 +57041,10 @@
5708757041
*/
5708857042
#ifndef SQLITE_OMIT_DISKIO
5708957043
/* #include "sqliteInt.h" */
5709057044
/************** Include wal.h in the middle of pager.c ***********************/
5709157045
/************** Begin file wal.h *********************************************/
57092
-#line 1 "tsrc/wal.h"
5709357046
/*
5709457047
** 2010 February 1
5709557048
**
5709657049
** The author disclaims copyright to this source code. In place of
5709757050
** a legal notice, here is a blessing:
@@ -57251,11 +57204,10 @@
5725157204
#endif /* ifndef SQLITE_OMIT_WAL */
5725257205
#endif /* SQLITE_WAL_H */
5725357206
5725457207
/************** End of wal.h *************************************************/
5725557208
/************** Continuing where we left off in pager.c **********************/
57256
-#line 24 "tsrc/pager.c"
5725757209
5725857210
5725957211
/******************* NOTES ON THE DESIGN OF THE PAGER ************************
5726057212
**
5726157213
** This comment block describes invariants that hold when using a rollback
@@ -65041,11 +64993,10 @@
6504164993
6504264994
#endif /* SQLITE_OMIT_DISKIO */
6504364995
6504464996
/************** End of pager.c ***********************************************/
6504564997
/************** Begin file wal.c *********************************************/
65046
-#line 1 "tsrc/wal.c"
6504764998
/*
6504864999
** 2010 February 1
6504965000
**
6505065001
** The author disclaims copyright to this source code. In place of
6505165002
** a legal notice, here is a blessing:
@@ -69638,11 +69589,10 @@
6963869589
6963969590
#endif /* #ifndef SQLITE_OMIT_WAL */
6964069591
6964169592
/************** End of wal.c *************************************************/
6964269593
/************** Begin file btmutex.c *****************************************/
69643
-#line 1 "tsrc/btmutex.c"
6964469594
/*
6964569595
** 2007 August 27
6964669596
**
6964769597
** The author disclaims copyright to this source code. In place of
6964869598
** a legal notice, here is a blessing:
@@ -69658,11 +69608,10 @@
6965869608
** big and we want to break it down some. This packaged seemed like
6965969609
** a good breakout.
6966069610
*/
6966169611
/************** Include btreeInt.h in the middle of btmutex.c ****************/
6966269612
/************** Begin file btreeInt.h ****************************************/
69663
-#line 1 "tsrc/btreeInt.h"
6966469613
/*
6966569614
** 2004 April 6
6966669615
**
6966769616
** The author disclaims copyright to this source code. In place of
6966869617
** a legal notice, here is a blessing:
@@ -70396,11 +70345,10 @@
7039670345
# define get2byteAligned(x) ((x)[0]<<8 | (x)[1])
7039770346
#endif
7039870347
7039970348
/************** End of btreeInt.h ********************************************/
7040070349
/************** Continuing where we left off in btmutex.c ********************/
70401
-#line 19 "tsrc/btmutex.c"
7040270350
#ifndef SQLITE_OMIT_SHARED_CACHE
7040370351
#if SQLITE_THREADSAFE
7040470352
7040570353
/*
7040670354
** Obtain the BtShared mutex associated with B-Tree handle p. Also,
@@ -70691,11 +70639,10 @@
7069170639
7069270640
#endif /* ifndef SQLITE_OMIT_SHARED_CACHE */
7069370641
7069470642
/************** End of btmutex.c *********************************************/
7069570643
/************** Begin file btree.c *******************************************/
70696
-#line 1 "tsrc/btree.c"
7069770644
/*
7069870645
** 2004 April 6
7069970646
**
7070070647
** The author disclaims copyright to this source code. In place of
7070170648
** a legal notice, here is a blessing:
@@ -82186,11 +82133,10 @@
8218682133
}
8218782134
#endif
8218882135
8218982136
/************** End of btree.c ***********************************************/
8219082137
/************** Begin file backup.c ******************************************/
82191
-#line 1 "tsrc/backup.c"
8219282138
/*
8219382139
** 2009 January 28
8219482140
**
8219582141
** The author disclaims copyright to this source code. In place of
8219682142
** a legal notice, here is a blessing:
@@ -82957,11 +82903,10 @@
8295782903
}
8295882904
#endif /* SQLITE_OMIT_VACUUM */
8295982905
8296082906
/************** End of backup.c **********************************************/
8296182907
/************** Begin file vdbemem.c *****************************************/
82962
-#line 1 "tsrc/vdbemem.c"
8296382908
/*
8296482909
** 2004 May 26
8296582910
**
8296682911
** The author disclaims copyright to this source code. In place of
8296782912
** a legal notice, here is a blessing:
@@ -85014,11 +84959,10 @@
8501484959
return valueBytes(pVal, enc);
8501584960
}
8501684961
8501784962
/************** End of vdbemem.c *********************************************/
8501884963
/************** Begin file vdbeaux.c *****************************************/
85019
-#line 1 "tsrc/vdbeaux.c"
8502084964
/*
8502184965
** 2003 September 6
8502284966
**
8502384967
** The author disclaims copyright to this source code. In place of
8502484968
** a legal notice, here is a blessing:
@@ -90566,11 +90510,10 @@
9056690510
}
9056790511
#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
9056890512
9056990513
/************** End of vdbeaux.c *********************************************/
9057090514
/************** Begin file vdbeapi.c *****************************************/
90571
-#line 1 "tsrc/vdbeapi.c"
9057290515
/*
9057390516
** 2004 May 26
9057490517
**
9057590518
** The author disclaims copyright to this source code. In place of
9057690519
** a legal notice, here is a blessing:
@@ -93153,11 +93096,10 @@
9315393096
}
9315493097
#endif /* SQLITE_ENABLE_STMT_SCANSTATUS */
9315593098
9315693099
/************** End of vdbeapi.c *********************************************/
9315793100
/************** Begin file vdbetrace.c ***************************************/
93158
-#line 1 "tsrc/vdbetrace.c"
9315993101
/*
9316093102
** 2009 November 25
9316193103
**
9316293104
** The author disclaims copyright to this source code. In place of
9316393105
** a legal notice, here is a blessing:
@@ -93349,11 +93291,10 @@
9334993291
9335093292
#endif /* #ifndef SQLITE_OMIT_TRACE */
9335193293
9335293294
/************** End of vdbetrace.c *******************************************/
9335393295
/************** Begin file vdbe.c ********************************************/
93354
-#line 1 "tsrc/vdbe.c"
9335593296
/*
9335693297
** 2001 September 15
9335793298
**
9335893299
** The author disclaims copyright to this source code. In place of
9335993300
** a legal notice, here is a blessing:
@@ -93381,11 +93322,10 @@
9338193322
#if defined(VDBE_PROFILE) \
9338293323
|| defined(SQLITE_PERFORMANCE_TRACE) \
9338393324
|| defined(SQLITE_ENABLE_STMT_SCANSTATUS)
9338493325
/************** Include hwtime.h in the middle of vdbe.c *********************/
9338593326
/************** Begin file hwtime.h ******************************************/
93386
-#line 1 "tsrc/hwtime.h"
9338793327
/*
9338893328
** 2008 May 27
9338993329
**
9339093330
** The author disclaims copyright to this source code. In place of
9339193331
** a legal notice, here is a blessing:
@@ -93470,11 +93410,10 @@
9347093410
9347193411
#endif /* !defined(SQLITE_HWTIME_H) */
9347293412
9347393413
/************** End of hwtime.h **********************************************/
9347493414
/************** Continuing where we left off in vdbe.c ***********************/
93475
-#line 31 "tsrc/vdbe.c"
9347693415
#endif
9347793416
9347893417
/*
9347993418
** Invoke this macro on memory cells just prior to changing the
9348093419
** value of the cell. This macro verifies that shallow copies are
@@ -102664,11 +102603,10 @@
102664102603
}
102665102604
102666102605
102667102606
/************** End of vdbe.c ************************************************/
102668102607
/************** Begin file vdbeblob.c ****************************************/
102669
-#line 1 "tsrc/vdbeblob.c"
102670102608
/*
102671102609
** 2007 May 1
102672102610
**
102673102611
** The author disclaims copyright to this source code. In place of
102674102612
** a legal notice, here is a blessing:
@@ -103188,11 +103126,10 @@
103188103126
103189103127
#endif /* #ifndef SQLITE_OMIT_INCRBLOB */
103190103128
103191103129
/************** End of vdbeblob.c ********************************************/
103192103130
/************** Begin file vdbesort.c ****************************************/
103193
-#line 1 "tsrc/vdbesort.c"
103194103131
/*
103195103132
** 2011-07-09
103196103133
**
103197103134
** The author disclaims copyright to this source code. In place of
103198103135
** a legal notice, here is a blessing:
@@ -105959,11 +105896,10 @@
105959105896
return SQLITE_OK;
105960105897
}
105961105898
105962105899
/************** End of vdbesort.c ********************************************/
105963105900
/************** Begin file vdbevtab.c ****************************************/
105964
-#line 1 "tsrc/vdbevtab.c"
105965105901
/*
105966105902
** 2020-03-23
105967105903
**
105968105904
** The author disclaims copyright to this source code. In place of
105969105905
** a legal notice, here is a blessing:
@@ -106409,11 +106345,10 @@
106409106345
SQLITE_PRIVATE int sqlite3VdbeBytecodeVtabInit(sqlite3 *db){ return SQLITE_OK; }
106410106346
#endif /* SQLITE_ENABLE_BYTECODE_VTAB */
106411106347
106412106348
/************** End of vdbevtab.c ********************************************/
106413106349
/************** Begin file memjournal.c **************************************/
106414
-#line 1 "tsrc/memjournal.c"
106415106350
/*
106416106351
** 2008 October 7
106417106352
**
106418106353
** The author disclaims copyright to this source code. In place of
106419106354
** a legal notice, here is a blessing:
@@ -106853,11 +106788,10 @@
106853106788
return MAX(pVfs->szOsFile, (int)sizeof(MemJournal));
106854106789
}
106855106790
106856106791
/************** End of memjournal.c ******************************************/
106857106792
/************** Begin file walker.c ******************************************/
106858
-#line 1 "tsrc/walker.c"
106859106793
/*
106860106794
** 2008 August 16
106861106795
**
106862106796
** The author disclaims copyright to this source code. In place of
106863106797
** a legal notice, here is a blessing:
@@ -107118,11 +107052,10 @@
107118107052
return WRC_Continue;
107119107053
}
107120107054
107121107055
/************** End of walker.c **********************************************/
107122107056
/************** Begin file resolve.c *****************************************/
107123
-#line 1 "tsrc/resolve.c"
107124107057
/*
107125107058
** 2008 August 18
107126107059
**
107127107060
** The author disclaims copyright to this source code. In place of
107128107061
** a legal notice, here is a blessing:
@@ -109440,11 +109373,10 @@
109440109373
return rc;
109441109374
}
109442109375
109443109376
/************** End of resolve.c *********************************************/
109444109377
/************** Begin file expr.c ********************************************/
109445
-#line 1 "tsrc/expr.c"
109446109378
/*
109447109379
** 2001 September 15
109448109380
**
109449109381
** The author disclaims copyright to this source code. In place of
109450109382
** a legal notice, here is a blessing:
@@ -116770,11 +116702,10 @@
116770116702
}
116771116703
#endif /* SQLITE_DEBUG */
116772116704
116773116705
/************** End of expr.c ************************************************/
116774116706
/************** Begin file alter.c *******************************************/
116775
-#line 1 "tsrc/alter.c"
116776116707
/*
116777116708
** 2005 February 15
116778116709
**
116779116710
** The author disclaims copyright to this source code. In place of
116780116711
** a legal notice, here is a blessing:
@@ -119090,11 +119021,10 @@
119090119021
}
119091119022
#endif /* SQLITE_ALTER_TABLE */
119092119023
119093119024
/************** End of alter.c ***********************************************/
119094119025
/************** Begin file analyze.c *****************************************/
119095
-#line 1 "tsrc/analyze.c"
119096119026
/*
119097119027
** 2005-07-08
119098119028
**
119099119029
** The author disclaims copyright to this source code. In place of
119100119030
** a legal notice, here is a blessing:
@@ -121115,11 +121045,10 @@
121115121045
121116121046
#endif /* SQLITE_OMIT_ANALYZE */
121117121047
121118121048
/************** End of analyze.c *********************************************/
121119121049
/************** Begin file attach.c ******************************************/
121120
-#line 1 "tsrc/attach.c"
121121121050
/*
121122121051
** 2003 April 6
121123121052
**
121124121053
** The author disclaims copyright to this source code. In place of
121125121054
** a legal notice, here is a blessing:
@@ -121728,11 +121657,10 @@
121728121657
}
121729121658
#endif
121730121659
121731121660
/************** End of attach.c **********************************************/
121732121661
/************** Begin file auth.c ********************************************/
121733
-#line 1 "tsrc/auth.c"
121734121662
/*
121735121663
** 2003 January 11
121736121664
**
121737121665
** The author disclaims copyright to this source code. In place of
121738121666
** a legal notice, here is a blessing:
@@ -121992,11 +121920,10 @@
121992121920
121993121921
#endif /* SQLITE_OMIT_AUTHORIZATION */
121994121922
121995121923
/************** End of auth.c ************************************************/
121996121924
/************** Begin file build.c *******************************************/
121997
-#line 1 "tsrc/build.c"
121998121925
/*
121999121926
** 2001 September 15
122000121927
**
122001121928
** The author disclaims copyright to this source code. In place of
122002121929
** a legal notice, here is a blessing:
@@ -127763,11 +127690,10 @@
127763127690
}
127764127691
#endif /* !defined(SQLITE_OMIT_CTE) */
127765127692
127766127693
/************** End of build.c ***********************************************/
127767127694
/************** Begin file callback.c ****************************************/
127768
-#line 1 "tsrc/callback.c"
127769127695
/*
127770127696
** 2005 May 23
127771127697
**
127772127698
** The author disclaims copyright to this source code. In place of
127773127699
** a legal notice, here is a blessing:
@@ -128307,11 +128233,10 @@
128307128233
return p;
128308128234
}
128309128235
128310128236
/************** End of callback.c ********************************************/
128311128237
/************** Begin file delete.c ******************************************/
128312
-#line 1 "tsrc/delete.c"
128313128238
/*
128314128239
** 2001 September 15
128315128240
**
128316128241
** The author disclaims copyright to this source code. In place of
128317128242
** a legal notice, here is a blessing:
@@ -129341,11 +129266,10 @@
129341129266
}
129342129267
}
129343129268
129344129269
/************** End of delete.c **********************************************/
129345129270
/************** Begin file func.c ********************************************/
129346
-#line 1 "tsrc/func.c"
129347129271
/*
129348129272
** 2002 February 23
129349129273
**
129350129274
** The author disclaims copyright to this source code. In place of
129351129275
** a legal notice, here is a blessing:
@@ -132188,11 +132112,10 @@
132188132112
#endif
132189132113
}
132190132114
132191132115
/************** End of func.c ************************************************/
132192132116
/************** Begin file fkey.c ********************************************/
132193
-#line 1 "tsrc/fkey.c"
132194132117
/*
132195132118
**
132196132119
** The author disclaims copyright to this source code. In place of
132197132120
** a legal notice, here is a blessing:
132198132121
**
@@ -133676,11 +133599,10 @@
133676133599
}
133677133600
#endif /* ifndef SQLITE_OMIT_FOREIGN_KEY */
133678133601
133679133602
/************** End of fkey.c ************************************************/
133680133603
/************** Begin file insert.c ******************************************/
133681
-#line 1 "tsrc/insert.c"
133682133604
/*
133683133605
** 2001 September 15
133684133606
**
133685133607
** The author disclaims copyright to this source code. In place of
133686133608
** a legal notice, here is a blessing:
@@ -137072,11 +136994,10 @@
137072136994
}
137073136995
#endif /* SQLITE_OMIT_XFER_OPT */
137074136996
137075136997
/************** End of insert.c **********************************************/
137076136998
/************** Begin file legacy.c ******************************************/
137077
-#line 1 "tsrc/legacy.c"
137078136999
/*
137079137000
** 2001 September 15
137080137001
**
137081137002
** The author disclaims copyright to this source code. In place of
137082137003
** a legal notice, here is a blessing:
@@ -137217,11 +137138,10 @@
137217137138
return rc;
137218137139
}
137219137140
137220137141
/************** End of legacy.c **********************************************/
137221137142
/************** Begin file loadext.c *****************************************/
137222
-#line 1 "tsrc/loadext.c"
137223137143
/*
137224137144
** 2006 June 7
137225137145
**
137226137146
** The author disclaims copyright to this source code. In place of
137227137147
** a legal notice, here is a blessing:
@@ -137238,11 +137158,10 @@
137238137158
#ifndef SQLITE_CORE
137239137159
#define SQLITE_CORE 1 /* Disable the API redefinition in sqlite3ext.h */
137240137160
#endif
137241137161
/************** Include sqlite3ext.h in the middle of loadext.c **************/
137242137162
/************** Begin file sqlite3ext.h **************************************/
137243
-#line 1 "tsrc/sqlite3ext.h"
137244137163
/*
137245137164
** 2006 June 7
137246137165
**
137247137166
** The author disclaims copyright to this source code. In place of
137248137167
** a legal notice, here is a blessing:
@@ -137961,11 +137880,10 @@
137961137880
137962137881
#endif /* SQLITE3EXT_H */
137963137882
137964137883
/************** End of sqlite3ext.h ******************************************/
137965137884
/************** Continuing where we left off in loadext.c ********************/
137966
-#line 20 "tsrc/loadext.c"
137967137885
/* #include "sqliteInt.h" */
137968137886
137969137887
#ifndef SQLITE_OMIT_LOAD_EXTENSION
137970137888
/*
137971137889
** Some API routines are omitted when various features are
@@ -138867,11 +138785,10 @@
138867138785
}
138868138786
}
138869138787
138870138788
/************** End of loadext.c *********************************************/
138871138789
/************** Begin file pragma.c ******************************************/
138872
-#line 1 "tsrc/pragma.c"
138873138790
/*
138874138791
** 2003 April 6
138875138792
**
138876138793
** The author disclaims copyright to this source code. In place of
138877138794
** a legal notice, here is a blessing:
@@ -138900,11 +138817,10 @@
138900138817
** lexicographical order to facility a binary search of the pragma name.
138901138818
** Do not edit pragma.h directly. Edit and rerun the script in at
138902138819
** ../tool/mkpragmatab.tcl. */
138903138820
/************** Include pragma.h in the middle of pragma.c *******************/
138904138821
/************** Begin file pragma.h ******************************************/
138905
-#line 1 "tsrc/pragma.h"
138906138822
/* DO NOT EDIT!
138907138823
** This file is automatically generated by the script at
138908138824
** ../tool/mkpragmatab.tcl. To update the set of pragmas, edit
138909138825
** that script and rerun it.
138910138826
*/
@@ -139564,11 +139480,10 @@
139564139480
};
139565139481
/* Number of pragmas: 68 on by default, 78 total. */
139566139482
139567139483
/************** End of pragma.h **********************************************/
139568139484
/************** Continuing where we left off in pragma.c *********************/
139569
-#line 32 "tsrc/pragma.c"
139570139485
139571139486
/*
139572139487
** When the 0x10 bit of PRAGMA optimize is set, any ANALYZE commands
139573139488
** will be run with an analysis_limit set to the lessor of the value of
139574139489
** the following macro or to the actual analysis_limit if it is non-zero,
@@ -142608,11 +142523,10 @@
142608142523
142609142524
#endif /* SQLITE_OMIT_PRAGMA */
142610142525
142611142526
/************** End of pragma.c **********************************************/
142612142527
/************** Begin file prepare.c *****************************************/
142613
-#line 1 "tsrc/prepare.c"
142614142528
/*
142615142529
** 2005 May 25
142616142530
**
142617142531
** The author disclaims copyright to this source code. In place of
142618142532
** a legal notice, here is a blessing:
@@ -143702,11 +143616,10 @@
143702143616
143703143617
#endif /* SQLITE_OMIT_UTF16 */
143704143618
143705143619
/************** End of prepare.c *********************************************/
143706143620
/************** Begin file select.c ******************************************/
143707
-#line 1 "tsrc/select.c"
143708143621
/*
143709143622
** 2001 September 15
143710143623
**
143711143624
** The author disclaims copyright to this source code. In place of
143712143625
** a legal notice, here is a blessing:
@@ -152475,11 +152388,10 @@
152475152388
return rc;
152476152389
}
152477152390
152478152391
/************** End of select.c **********************************************/
152479152392
/************** Begin file table.c *******************************************/
152480
-#line 1 "tsrc/table.c"
152481152393
/*
152482152394
** 2001 September 15
152483152395
**
152484152396
** The author disclaims copyright to this source code. In place of
152485152397
** a legal notice, here is a blessing:
@@ -152677,11 +152589,10 @@
152677152589
152678152590
#endif /* SQLITE_OMIT_GET_TABLE */
152679152591
152680152592
/************** End of table.c ***********************************************/
152681152593
/************** Begin file trigger.c *****************************************/
152682
-#line 1 "tsrc/trigger.c"
152683152594
/*
152684152595
**
152685152596
** The author disclaims copyright to this source code. In place of
152686152597
** a legal notice, here is a blessing:
152687152598
**
@@ -154244,11 +154155,10 @@
154244154155
154245154156
#endif /* !defined(SQLITE_OMIT_TRIGGER) */
154246154157
154247154158
/************** End of trigger.c *********************************************/
154248154159
/************** Begin file update.c ******************************************/
154249
-#line 1 "tsrc/update.c"
154250154160
/*
154251154161
** 2001 September 15
154252154162
**
154253154163
** The author disclaims copyright to this source code. In place of
154254154164
** a legal notice, here is a blessing:
@@ -155616,11 +155526,10 @@
155616155526
}
155617155527
#endif /* SQLITE_OMIT_VIRTUALTABLE */
155618155528
155619155529
/************** End of update.c **********************************************/
155620155530
/************** Begin file upsert.c ******************************************/
155621
-#line 1 "tsrc/upsert.c"
155622155531
/*
155623155532
** 2018-04-12
155624155533
**
155625155534
** The author disclaims copyright to this source code. In place of
155626155535
** a legal notice, here is a blessing:
@@ -155949,11 +155858,10 @@
155949155858
155950155859
#endif /* SQLITE_OMIT_UPSERT */
155951155860
155952155861
/************** End of upsert.c **********************************************/
155953155862
/************** Begin file vacuum.c ******************************************/
155954
-#line 1 "tsrc/vacuum.c"
155955155863
/*
155956155864
** 2003 April 6
155957155865
**
155958155866
** The author disclaims copyright to this source code. In place of
155959155867
** a legal notice, here is a blessing:
@@ -156371,11 +156279,10 @@
156371156279
156372156280
#endif /* SQLITE_OMIT_VACUUM && SQLITE_OMIT_ATTACH */
156373156281
156374156282
/************** End of vacuum.c **********************************************/
156375156283
/************** Begin file vtab.c ********************************************/
156376
-#line 1 "tsrc/vtab.c"
156377156284
/*
156378156285
** 2006 June 10
156379156286
**
156380156287
** The author disclaims copyright to this source code. In place of
156381156288
** a legal notice, here is a blessing:
@@ -157749,11 +157656,10 @@
157749157656
157750157657
#endif /* SQLITE_OMIT_VIRTUALTABLE */
157751157658
157752157659
/************** End of vtab.c ************************************************/
157753157660
/************** Begin file wherecode.c ***************************************/
157754
-#line 1 "tsrc/wherecode.c"
157755157661
/*
157756157662
** 2015-06-06
157757157663
**
157758157664
** The author disclaims copyright to this source code. In place of
157759157665
** a legal notice, here is a blessing:
@@ -157772,11 +157678,10 @@
157772157678
** file retains the code that does query planning and analysis.
157773157679
*/
157774157680
/* #include "sqliteInt.h" */
157775157681
/************** Include whereInt.h in the middle of wherecode.c **************/
157776157682
/************** Begin file whereInt.h ****************************************/
157777
-#line 1 "tsrc/whereInt.h"
157778157683
/*
157779157684
** 2013-11-12
157780157685
**
157781157686
** The author disclaims copyright to this source code. In place of
157782157687
** a legal notice, here is a blessing:
@@ -158429,11 +158334,10 @@
158429158334
158430158335
#endif /* !defined(SQLITE_WHEREINT_H) */
158431158336
158432158337
/************** End of whereInt.h ********************************************/
158433158338
/************** Continuing where we left off in wherecode.c ******************/
158434
-#line 22 "tsrc/wherecode.c"
158435158339
158436158340
#ifndef SQLITE_OMIT_EXPLAIN
158437158341
158438158342
/*
158439158343
** Return the name of the i-th column of the pIdx index.
@@ -161352,11 +161256,10 @@
161352161256
pParse->withinRJSubrtn--;
161353161257
}
161354161258
161355161259
/************** End of wherecode.c *******************************************/
161356161260
/************** Begin file whereexpr.c ***************************************/
161357
-#line 1 "tsrc/whereexpr.c"
161358161261
/*
161359161262
** 2015-06-08
161360161263
**
161361161264
** The author disclaims copyright to this source code. In place of
161362161265
** a legal notice, here is a blessing:
@@ -163258,11 +163161,10 @@
163258163161
}
163259163162
}
163260163163
163261163164
/************** End of whereexpr.c *******************************************/
163262163165
/************** Begin file where.c *******************************************/
163263
-#line 1 "tsrc/where.c"
163264163166
/*
163265163167
** 2001 September 15
163266163168
**
163267163169
** The author disclaims copyright to this source code. In place of
163268163170
** a legal notice, here is a blessing:
@@ -170759,11 +170661,10 @@
170759170661
return;
170760170662
}
170761170663
170762170664
/************** End of where.c ***********************************************/
170763170665
/************** Begin file window.c ******************************************/
170764
-#line 1 "tsrc/window.c"
170765170666
/*
170766170667
** 2018 May 08
170767170668
**
170768170669
** The author disclaims copyright to this source code. In place of
170769170670
** a legal notice, here is a blessing:
@@ -172432,10 +172333,11 @@
172432172333
for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
172433172334
FuncDef *pFunc = pWin->pWFunc;
172434172335
int regArg;
172435172336
int nArg = pWin->bExprArgs ? 0 : windowArgCount(pWin);
172436172337
int i;
172338
+ int addrIf = 0;
172437172339
172438172340
assert( bInverse==0 || pWin->eStart!=TK_UNBOUNDED );
172439172341
172440172342
/* All OVER clauses in the same window function aggregate step must
172441172343
** be the same. */
@@ -172447,10 +172349,22 @@
172447172349
}else{
172448172350
sqlite3VdbeAddOp3(v, OP_Column, pMWin->iEphCsr, pWin->iArgCol+i, reg+i);
172449172351
}
172450172352
}
172451172353
regArg = reg;
172354
+
172355
+ if( pWin->pFilter ){
172356
+ int regTmp;
172357
+ assert( ExprUseXList(pWin->pOwner) );
172358
+ assert( pWin->bExprArgs || !nArg ||nArg==pWin->pOwner->x.pList->nExpr );
172359
+ assert( pWin->bExprArgs || nArg ||pWin->pOwner->x.pList==0 );
172360
+ regTmp = sqlite3GetTempReg(pParse);
172361
+ sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol+nArg,regTmp);
172362
+ addrIf = sqlite3VdbeAddOp3(v, OP_IfNot, regTmp, 0, 1);
172363
+ VdbeCoverage(v);
172364
+ sqlite3ReleaseTempReg(pParse, regTmp);
172365
+ }
172452172366
172453172367
if( pMWin->regStartRowid==0
172454172368
&& (pFunc->funcFlags & SQLITE_FUNC_MINMAX)
172455172369
&& (pWin->eStart!=TK_UNBOUNDED)
172456172370
){
@@ -172467,29 +172381,17 @@
172467172381
sqlite3VdbeAddOp1(v, OP_Delete, pWin->csrApp);
172468172382
sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2);
172469172383
}
172470172384
sqlite3VdbeJumpHere(v, addrIsNull);
172471172385
}else if( pWin->regApp ){
172386
+ assert( pWin->pFilter==0 );
172472172387
assert( pFunc->zName==nth_valueName
172473172388
|| pFunc->zName==first_valueName
172474172389
);
172475172390
assert( bInverse==0 || bInverse==1 );
172476172391
sqlite3VdbeAddOp2(v, OP_AddImm, pWin->regApp+1-bInverse, 1);
172477172392
}else if( pFunc->xSFunc!=noopStepFunc ){
172478
- int addrIf = 0;
172479
- if( pWin->pFilter ){
172480
- int regTmp;
172481
- assert( ExprUseXList(pWin->pOwner) );
172482
- assert( pWin->bExprArgs || !nArg ||nArg==pWin->pOwner->x.pList->nExpr );
172483
- assert( pWin->bExprArgs || nArg ||pWin->pOwner->x.pList==0 );
172484
- regTmp = sqlite3GetTempReg(pParse);
172485
- sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol+nArg,regTmp);
172486
- addrIf = sqlite3VdbeAddOp3(v, OP_IfNot, regTmp, 0, 1);
172487
- VdbeCoverage(v);
172488
- sqlite3ReleaseTempReg(pParse, regTmp);
172489
- }
172490
-
172491172393
if( pWin->bExprArgs ){
172492172394
int iOp = sqlite3VdbeCurrentAddr(v);
172493172395
int iEnd;
172494172396
172495172397
assert( ExprUseXList(pWin->pOwner) );
@@ -172516,12 +172418,13 @@
172516172418
sqlite3VdbeAppendP4(v, pFunc, P4_FUNCDEF);
172517172419
sqlite3VdbeChangeP5(v, (u8)nArg);
172518172420
if( pWin->bExprArgs ){
172519172421
sqlite3ReleaseTempRange(pParse, regArg, nArg);
172520172422
}
172521
- if( addrIf ) sqlite3VdbeJumpHere(v, addrIf);
172522172423
}
172424
+
172425
+ if( addrIf ) sqlite3VdbeJumpHere(v, addrIf);
172523172426
}
172524172427
}
172525172428
172526172429
/*
172527172430
** Values that may be passed as the second argument to windowCodeOp().
@@ -173869,11 +173772,10 @@
173869173772
173870173773
#endif /* SQLITE_OMIT_WINDOWFUNC */
173871173774
173872173775
/************** End of window.c **********************************************/
173873173776
/************** Begin file parse.c *******************************************/
173874
-#line 1 "tsrc/parse.c"
173875173777
/* This file is automatically generated by Lemon from input grammar
173876173778
** source file "parse.y".
173877173779
*/
173878173780
/*
173879173781
** 2001-09-15
@@ -173893,11 +173795,10 @@
173893173795
** That input file is processed by Lemon to generate a C-language
173894173796
** implementation of a parser for the given grammar. You might be reading
173895173797
** this comment as part of the translated C-code. Edits should be made
173896173798
** to the original parse.y sources.
173897173799
*/
173898
-#line 62 "parse.y"
173899173800
173900173801
/* #include "sqliteInt.h" */
173901173802
173902173803
/*
173903173804
** Disable all error recovery processing in the parser push-down
@@ -173977,11 +173878,10 @@
173977173878
sqlite3ExprListDelete(pParse->db, pOrderBy);
173978173879
sqlite3ExprDelete(pParse->db, pLimit);
173979173880
}
173980173881
#endif /* SQLITE_ENABLE_UPDATE_DELETE_LIMIT */
173981173882
173982
-#line 517 "parse.y"
173983173883
173984173884
/*
173985173885
** For a compound SELECT statement, make sure p->pPrior->pNext==p for
173986173886
** all elements in the list. And make sure list length does not exceed
173987173887
** SQLITE_LIMIT_COMPOUND_SELECT.
@@ -174032,11 +173932,10 @@
174032173932
** testing.
174033173933
*/
174034173934
static void *parserStackRealloc(void *pOld, sqlite3_uint64 newSize){
174035173935
return sqlite3FaultSim(700) ? 0 : sqlite3_realloc(pOld, newSize);
174036173936
}
174037
-#line 1085 "parse.y"
174038173937
174039173938
174040173939
/* Construct a new Expr object from a single token */
174041173940
static Expr *tokenExpr(Parse *pParse, int op, Token t){
174042173941
Expr *p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr)+t.n+1);
@@ -174069,11 +173968,10 @@
174069173968
}
174070173969
}
174071173970
return p;
174072173971
}
174073173972
174074
-#line 1329 "parse.y"
174075173973
174076173974
/* A routine to convert a binary TK_IS or TK_ISNOT expression into a
174077173975
** unary TK_ISNULL or TK_NOTNULL expression. */
174078173976
static void binaryToUnaryIfNull(Parse *pParse, Expr *pY, Expr *pA, int op){
174079173977
sqlite3 *db = pParse->db;
@@ -174081,11 +173979,10 @@
174081173979
pA->op = (u8)op;
174082173980
sqlite3ExprDelete(db, pA->pRight);
174083173981
pA->pRight = 0;
174084173982
}
174085173983
}
174086
-#line 1564 "parse.y"
174087173984
174088173985
/* Add a single new term to an ExprList that is used to store a
174089173986
** list of identifiers. Report an error if the ID list contains
174090173987
** a COLLATE clause or an ASC or DESC keyword, except ignore the
174091173988
** error while parsing a legacy schema.
@@ -174105,16 +174002,14 @@
174105174002
pIdToken->n, pIdToken->z);
174106174003
}
174107174004
sqlite3ExprListSetName(pParse, p, pIdToken, 1);
174108174005
return p;
174109174006
}
174110
-#line 2048 "parse.y"
174111174007
174112174008
#if TK_SPAN>255
174113174009
# error too many tokens in the grammar
174114174010
#endif
174115
-#line 267 "parse.sql"
174116174011
/**************** End of %include directives **********************************/
174117174012
/* These constants specify the various numeric values for terminal symbols.
174118174013
***************** Begin token definitions *************************************/
174119174014
#ifndef TK_SEMI
174120174015
#define TK_SEMI 1
@@ -176295,13 +176190,11 @@
176295176190
case 240: /* selectnowith */
176296176191
case 241: /* oneselect */
176297176192
case 253: /* values */
176298176193
case 255: /* mvalues */
176299176194
{
176300
-#line 511 "parse.y"
176301176195
sqlite3SelectDelete(pParse->db, (yypminor->yy555));
176302
-#line 2453 "parse.sql"
176303176196
}
176304176197
break;
176305176198
case 217: /* term */
176306176199
case 218: /* expr */
176307176200
case 247: /* where_opt */
@@ -176312,13 +176205,11 @@
176312176205
case 285: /* vinto */
176313176206
case 292: /* when_clause */
176314176207
case 297: /* key_opt */
176315176208
case 314: /* filter_clause */
176316176209
{
176317
-#line 1083 "parse.y"
176318176210
sqlite3ExprDelete(pParse->db, (yypminor->yy454));
176319
-#line 2470 "parse.sql"
176320176211
}
176321176212
break;
176322176213
case 222: /* eidlist_opt */
176323176214
case 232: /* sortlist */
176324176215
case 233: /* eidlist */
@@ -176331,82 +176222,64 @@
176331176222
case 270: /* setlist */
176332176223
case 279: /* paren_exprlist */
176333176224
case 281: /* case_exprlist */
176334176225
case 313: /* part_opt */
176335176226
{
176336
-#line 1562 "parse.y"
176337176227
sqlite3ExprListDelete(pParse->db, (yypminor->yy14));
176338
-#line 2489 "parse.sql"
176339176228
}
176340176229
break;
176341176230
case 239: /* fullname */
176342176231
case 246: /* from */
176343176232
case 258: /* seltablist */
176344176233
case 259: /* stl_prefix */
176345176234
case 264: /* xfullname */
176346176235
{
176347
-#line 789 "parse.y"
176348176236
sqlite3SrcListDelete(pParse->db, (yypminor->yy203));
176349
-#line 2500 "parse.sql"
176350176237
}
176351176238
break;
176352176239
case 242: /* wqlist */
176353176240
{
176354
-#line 1849 "parse.y"
176355176241
sqlite3WithDelete(pParse->db, (yypminor->yy59));
176356
-#line 2507 "parse.sql"
176357176242
}
176358176243
break;
176359176244
case 252: /* window_clause */
176360176245
case 309: /* windowdefn_list */
176361176246
{
176362
-#line 1977 "parse.y"
176363176247
sqlite3WindowListDelete(pParse->db, (yypminor->yy211));
176364
-#line 2515 "parse.sql"
176365176248
}
176366176249
break;
176367176250
case 265: /* idlist */
176368176251
case 272: /* idlist_opt */
176369176252
{
176370
-#line 1068 "parse.y"
176371176253
sqlite3IdListDelete(pParse->db, (yypminor->yy132));
176372
-#line 2523 "parse.sql"
176373176254
}
176374176255
break;
176375176256
case 275: /* filter_over */
176376176257
case 310: /* windowdefn */
176377176258
case 311: /* window */
176378176259
case 312: /* frame_opt */
176379176260
case 315: /* over_clause */
176380176261
{
176381
-#line 1916 "parse.y"
176382176262
sqlite3WindowDelete(pParse->db, (yypminor->yy211));
176383
-#line 2534 "parse.sql"
176384176263
}
176385176264
break;
176386176265
case 288: /* trigger_cmd_list */
176387176266
case 293: /* trigger_cmd */
176388176267
{
176389
-#line 1677 "parse.y"
176390176268
sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy427));
176391
-#line 2542 "parse.sql"
176392176269
}
176393176270
break;
176394176271
case 290: /* trigger_event */
176395176272
{
176396
-#line 1663 "parse.y"
176397176273
sqlite3IdListDelete(pParse->db, (yypminor->yy286).b);
176398
-#line 2549 "parse.sql"
176399176274
}
176400176275
break;
176401176276
case 317: /* frame_bound */
176402176277
case 318: /* frame_bound_s */
176403176278
case 319: /* frame_bound_e */
176404176279
{
176405
-#line 1921 "parse.y"
176406176280
sqlite3ExprDelete(pParse->db, (yypminor->yy509).pExpr);
176407
-#line 2558 "parse.sql"
176408176281
}
176409176282
break;
176410176283
/********* End destructor definitions *****************************************/
176411176284
default: break; /* If no destructor action specified: do nothing */
176412176285
}
@@ -176637,14 +176510,12 @@
176637176510
#endif
176638176511
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
176639176512
/* Here code is inserted which will execute if the parser
176640176513
** stack every overflows */
176641176514
/******** Begin %stack_overflow code ******************************************/
176642
-#line 51 "parse.y"
176643176515
176644176516
sqlite3OomFault(pParse->db);
176645
-#line 2796 "parse.sql"
176646176517
/******** End %stack_overflow code ********************************************/
176647176518
sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument var */
176648176519
sqlite3ParserCTX_STORE
176649176520
}
176650176521
@@ -177571,481 +177442,330 @@
177571177442
** break;
177572177443
*/
177573177444
/********** Begin reduce actions **********************************************/
177574177445
YYMINORTYPE yylhsminor;
177575177446
case 0: /* explain ::= EXPLAIN */
177576
-#line 155 "parse.y"
177577177447
{ if( pParse->pReprepare==0 ) pParse->explain = 1; }
177578
-#line 3729 "parse.sql"
177579177448
break;
177580177449
case 1: /* explain ::= EXPLAIN QUERY PLAN */
177581
-#line 156 "parse.y"
177582177450
{ if( pParse->pReprepare==0 ) pParse->explain = 2; }
177583
-#line 3734 "parse.sql"
177584177451
break;
177585177452
case 2: /* cmdx ::= cmd */
177586
-#line 158 "parse.y"
177587177453
{ sqlite3FinishCoding(pParse); }
177588
-#line 3739 "parse.sql"
177589177454
break;
177590177455
case 3: /* cmd ::= BEGIN transtype trans_opt */
177591
-#line 163 "parse.y"
177592177456
{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy144);}
177593
-#line 3744 "parse.sql"
177594177457
break;
177595177458
case 4: /* transtype ::= */
177596
-#line 168 "parse.y"
177597177459
{yymsp[1].minor.yy144 = TK_DEFERRED;}
177598
-#line 3749 "parse.sql"
177599177460
break;
177600177461
case 5: /* transtype ::= DEFERRED */
177601177462
case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
177602177463
case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
177603177464
case 324: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==324);
177604
-#line 169 "parse.y"
177605177465
{yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-X*/}
177606
-#line 3757 "parse.sql"
177607177466
break;
177608177467
case 8: /* cmd ::= COMMIT|END trans_opt */
177609177468
case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
177610
-#line 172 "parse.y"
177611177469
{sqlite3EndTransaction(pParse,yymsp[-1].major);}
177612
-#line 3763 "parse.sql"
177613177470
break;
177614177471
case 10: /* cmd ::= SAVEPOINT nm */
177615
-#line 177 "parse.y"
177616177472
{
177617177473
sqlite3Savepoint(pParse, SAVEPOINT_BEGIN, &yymsp[0].minor.yy0);
177618177474
}
177619
-#line 3770 "parse.sql"
177620177475
break;
177621177476
case 11: /* cmd ::= RELEASE savepoint_opt nm */
177622
-#line 180 "parse.y"
177623177477
{
177624177478
sqlite3Savepoint(pParse, SAVEPOINT_RELEASE, &yymsp[0].minor.yy0);
177625177479
}
177626
-#line 3777 "parse.sql"
177627177480
break;
177628177481
case 12: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
177629
-#line 183 "parse.y"
177630177482
{
177631177483
sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
177632177484
}
177633
-#line 3784 "parse.sql"
177634177485
break;
177635177486
case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
177636
-#line 190 "parse.y"
177637177487
{
177638177488
sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy144,0,0,yymsp[-2].minor.yy144);
177639177489
}
177640
-#line 3791 "parse.sql"
177641177490
break;
177642177491
case 14: /* createkw ::= CREATE */
177643
-#line 193 "parse.y"
177644177492
{disableLookaside(pParse);}
177645
-#line 3796 "parse.sql"
177646177493
break;
177647177494
case 15: /* ifnotexists ::= */
177648177495
case 18: /* temp ::= */ yytestcase(yyruleno==18);
177649177496
case 47: /* autoinc ::= */ yytestcase(yyruleno==47);
177650177497
case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62);
177651177498
case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72);
177652177499
case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
177653177500
case 100: /* distinct ::= */ yytestcase(yyruleno==100);
177654177501
case 246: /* collate ::= */ yytestcase(yyruleno==246);
177655
-#line 196 "parse.y"
177656177502
{yymsp[1].minor.yy144 = 0;}
177657
-#line 3808 "parse.sql"
177658177503
break;
177659177504
case 16: /* ifnotexists ::= IF NOT EXISTS */
177660
-#line 197 "parse.y"
177661177505
{yymsp[-2].minor.yy144 = 1;}
177662
-#line 3813 "parse.sql"
177663177506
break;
177664177507
case 17: /* temp ::= TEMP */
177665
-#line 200 "parse.y"
177666177508
{yymsp[0].minor.yy144 = pParse->db->init.busy==0;}
177667
-#line 3818 "parse.sql"
177668177509
break;
177669177510
case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */
177670
-#line 203 "parse.y"
177671177511
{
177672177512
sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy391,0);
177673177513
}
177674
-#line 3825 "parse.sql"
177675177514
break;
177676177515
case 20: /* create_table_args ::= AS select */
177677
-#line 206 "parse.y"
177678177516
{
177679177517
sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy555);
177680177518
sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy555);
177681177519
}
177682
-#line 3833 "parse.sql"
177683177520
break;
177684177521
case 21: /* table_option_set ::= */
177685
-#line 212 "parse.y"
177686177522
{yymsp[1].minor.yy391 = 0;}
177687
-#line 3838 "parse.sql"
177688177523
break;
177689177524
case 22: /* table_option_set ::= table_option_set COMMA table_option */
177690
-#line 214 "parse.y"
177691177525
{yylhsminor.yy391 = yymsp[-2].minor.yy391|yymsp[0].minor.yy391;}
177692
-#line 3843 "parse.sql"
177693177526
yymsp[-2].minor.yy391 = yylhsminor.yy391;
177694177527
break;
177695177528
case 23: /* table_option ::= WITHOUT nm */
177696
-#line 215 "parse.y"
177697177529
{
177698177530
if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
177699177531
yymsp[-1].minor.yy391 = TF_WithoutRowid | TF_NoVisibleRowid;
177700177532
}else{
177701177533
yymsp[-1].minor.yy391 = 0;
177702177534
sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
177703177535
}
177704177536
}
177705
-#line 3856 "parse.sql"
177706177537
break;
177707177538
case 24: /* table_option ::= nm */
177708
-#line 223 "parse.y"
177709177539
{
177710177540
if( yymsp[0].minor.yy0.n==6 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"strict",6)==0 ){
177711177541
yylhsminor.yy391 = TF_Strict;
177712177542
}else{
177713177543
yylhsminor.yy391 = 0;
177714177544
sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
177715177545
}
177716177546
}
177717
-#line 3868 "parse.sql"
177718177547
yymsp[0].minor.yy391 = yylhsminor.yy391;
177719177548
break;
177720177549
case 25: /* columnname ::= nm typetoken */
177721
-#line 233 "parse.y"
177722177550
{sqlite3AddColumn(pParse,yymsp[-1].minor.yy0,yymsp[0].minor.yy0);}
177723
-#line 3874 "parse.sql"
177724177551
break;
177725177552
case 26: /* typetoken ::= */
177726177553
case 65: /* conslist_opt ::= */ yytestcase(yyruleno==65);
177727177554
case 106: /* as ::= */ yytestcase(yyruleno==106);
177728
-#line 327 "parse.y"
177729177555
{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;}
177730
-#line 3881 "parse.sql"
177731177556
break;
177732177557
case 27: /* typetoken ::= typename LP signed RP */
177733
-#line 329 "parse.y"
177734177558
{
177735177559
yymsp[-3].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z);
177736177560
}
177737
-#line 3888 "parse.sql"
177738177561
break;
177739177562
case 28: /* typetoken ::= typename LP signed COMMA signed RP */
177740
-#line 332 "parse.y"
177741177563
{
177742177564
yymsp[-5].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy0.z);
177743177565
}
177744
-#line 3895 "parse.sql"
177745177566
break;
177746177567
case 29: /* typename ::= typename ID|STRING */
177747
-#line 337 "parse.y"
177748177568
{yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
177749
-#line 3900 "parse.sql"
177750177569
break;
177751177570
case 30: /* scanpt ::= */
177752
-#line 355 "parse.y"
177753177571
{
177754177572
assert( yyLookahead!=YYNOCODE );
177755177573
yymsp[1].minor.yy168 = yyLookaheadToken.z;
177756177574
}
177757
-#line 3908 "parse.sql"
177758177575
break;
177759177576
case 31: /* scantok ::= */
177760
-#line 359 "parse.y"
177761177577
{
177762177578
assert( yyLookahead!=YYNOCODE );
177763177579
yymsp[1].minor.yy0 = yyLookaheadToken;
177764177580
}
177765
-#line 3916 "parse.sql"
177766177581
break;
177767177582
case 32: /* ccons ::= CONSTRAINT nm */
177768177583
case 67: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==67);
177769
-#line 369 "parse.y"
177770177584
{pParse->constraintName = yymsp[0].minor.yy0;}
177771
-#line 3922 "parse.sql"
177772177585
break;
177773177586
case 33: /* ccons ::= DEFAULT scantok term */
177774
-#line 371 "parse.y"
177775177587
{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
177776
-#line 3927 "parse.sql"
177777177588
break;
177778177589
case 34: /* ccons ::= DEFAULT LP expr RP */
177779
-#line 373 "parse.y"
177780177590
{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy454,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
177781
-#line 3932 "parse.sql"
177782177591
break;
177783177592
case 35: /* ccons ::= DEFAULT PLUS scantok term */
177784
-#line 375 "parse.y"
177785177593
{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
177786
-#line 3937 "parse.sql"
177787177594
break;
177788177595
case 36: /* ccons ::= DEFAULT MINUS scantok term */
177789
-#line 376 "parse.y"
177790177596
{
177791177597
Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy454, 0);
177792177598
sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);
177793177599
}
177794
-#line 3945 "parse.sql"
177795177600
break;
177796177601
case 37: /* ccons ::= DEFAULT scantok ID|INDEXED */
177797
-#line 380 "parse.y"
177798177602
{
177799177603
Expr *p = tokenExpr(pParse, TK_STRING, yymsp[0].minor.yy0);
177800177604
if( p ){
177801177605
sqlite3ExprIdToTrueFalse(p);
177802177606
testcase( p->op==TK_TRUEFALSE && sqlite3ExprTruthValue(p) );
177803177607
}
177804177608
sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n);
177805177609
}
177806
-#line 3957 "parse.sql"
177807177610
break;
177808177611
case 38: /* ccons ::= NOT NULL onconf */
177809
-#line 393 "parse.y"
177810177612
{sqlite3AddNotNull(pParse, yymsp[0].minor.yy144);}
177811
-#line 3962 "parse.sql"
177812177613
break;
177813177614
case 39: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
177814
-#line 395 "parse.y"
177815177615
{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy144,yymsp[0].minor.yy144,yymsp[-2].minor.yy144);}
177816
-#line 3967 "parse.sql"
177817177616
break;
177818177617
case 40: /* ccons ::= UNIQUE onconf */
177819
-#line 396 "parse.y"
177820177618
{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy144,0,0,0,0,
177821177619
SQLITE_IDXTYPE_UNIQUE);}
177822
-#line 3973 "parse.sql"
177823177620
break;
177824177621
case 41: /* ccons ::= CHECK LP expr RP */
177825
-#line 398 "parse.y"
177826177622
{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy454,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
177827
-#line 3978 "parse.sql"
177828177623
break;
177829177624
case 42: /* ccons ::= REFERENCES nm eidlist_opt refargs */
177830
-#line 400 "parse.y"
177831177625
{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy14,yymsp[0].minor.yy144);}
177832
-#line 3983 "parse.sql"
177833177626
break;
177834177627
case 43: /* ccons ::= defer_subclause */
177835
-#line 401 "parse.y"
177836177628
{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy144);}
177837
-#line 3988 "parse.sql"
177838177629
break;
177839177630
case 44: /* ccons ::= COLLATE ID|STRING */
177840
-#line 402 "parse.y"
177841177631
{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
177842
-#line 3993 "parse.sql"
177843177632
break;
177844177633
case 45: /* generated ::= LP expr RP */
177845
-#line 405 "parse.y"
177846177634
{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy454,0);}
177847
-#line 3998 "parse.sql"
177848177635
break;
177849177636
case 46: /* generated ::= LP expr RP ID */
177850
-#line 406 "parse.y"
177851177637
{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy454,&yymsp[0].minor.yy0);}
177852
-#line 4003 "parse.sql"
177853177638
break;
177854177639
case 48: /* autoinc ::= AUTOINCR */
177855
-#line 411 "parse.y"
177856177640
{yymsp[0].minor.yy144 = 1;}
177857
-#line 4008 "parse.sql"
177858177641
break;
177859177642
case 49: /* refargs ::= */
177860
-#line 419 "parse.y"
177861177643
{ yymsp[1].minor.yy144 = OE_None*0x0101; /* EV: R-19803-45884 */}
177862
-#line 4013 "parse.sql"
177863177644
break;
177864177645
case 50: /* refargs ::= refargs refarg */
177865
-#line 420 "parse.y"
177866177646
{ yymsp[-1].minor.yy144 = (yymsp[-1].minor.yy144 & ~yymsp[0].minor.yy383.mask) | yymsp[0].minor.yy383.value; }
177867
-#line 4018 "parse.sql"
177868177647
break;
177869177648
case 51: /* refarg ::= MATCH nm */
177870
-#line 422 "parse.y"
177871177649
{ yymsp[-1].minor.yy383.value = 0; yymsp[-1].minor.yy383.mask = 0x000000; }
177872
-#line 4023 "parse.sql"
177873177650
break;
177874177651
case 52: /* refarg ::= ON INSERT refact */
177875
-#line 423 "parse.y"
177876177652
{ yymsp[-2].minor.yy383.value = 0; yymsp[-2].minor.yy383.mask = 0x000000; }
177877
-#line 4028 "parse.sql"
177878177653
break;
177879177654
case 53: /* refarg ::= ON DELETE refact */
177880
-#line 424 "parse.y"
177881177655
{ yymsp[-2].minor.yy383.value = yymsp[0].minor.yy144; yymsp[-2].minor.yy383.mask = 0x0000ff; }
177882
-#line 4033 "parse.sql"
177883177656
break;
177884177657
case 54: /* refarg ::= ON UPDATE refact */
177885
-#line 425 "parse.y"
177886177658
{ yymsp[-2].minor.yy383.value = yymsp[0].minor.yy144<<8; yymsp[-2].minor.yy383.mask = 0x00ff00; }
177887
-#line 4038 "parse.sql"
177888177659
break;
177889177660
case 55: /* refact ::= SET NULL */
177890
-#line 427 "parse.y"
177891177661
{ yymsp[-1].minor.yy144 = OE_SetNull; /* EV: R-33326-45252 */}
177892
-#line 4043 "parse.sql"
177893177662
break;
177894177663
case 56: /* refact ::= SET DEFAULT */
177895
-#line 428 "parse.y"
177896177664
{ yymsp[-1].minor.yy144 = OE_SetDflt; /* EV: R-33326-45252 */}
177897
-#line 4048 "parse.sql"
177898177665
break;
177899177666
case 57: /* refact ::= CASCADE */
177900
-#line 429 "parse.y"
177901177667
{ yymsp[0].minor.yy144 = OE_Cascade; /* EV: R-33326-45252 */}
177902
-#line 4053 "parse.sql"
177903177668
break;
177904177669
case 58: /* refact ::= RESTRICT */
177905
-#line 430 "parse.y"
177906177670
{ yymsp[0].minor.yy144 = OE_Restrict; /* EV: R-33326-45252 */}
177907
-#line 4058 "parse.sql"
177908177671
break;
177909177672
case 59: /* refact ::= NO ACTION */
177910
-#line 431 "parse.y"
177911177673
{ yymsp[-1].minor.yy144 = OE_None; /* EV: R-33326-45252 */}
177912
-#line 4063 "parse.sql"
177913177674
break;
177914177675
case 60: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
177915
-#line 433 "parse.y"
177916177676
{yymsp[-2].minor.yy144 = 0;}
177917
-#line 4068 "parse.sql"
177918177677
break;
177919177678
case 61: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
177920177679
case 76: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==76);
177921177680
case 173: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==173);
177922
-#line 434 "parse.y"
177923177681
{yymsp[-1].minor.yy144 = yymsp[0].minor.yy144;}
177924
-#line 4075 "parse.sql"
177925177682
break;
177926177683
case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
177927177684
case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
177928177685
case 219: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==219);
177929177686
case 222: /* in_op ::= NOT IN */ yytestcase(yyruleno==222);
177930177687
case 247: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==247);
177931
-#line 437 "parse.y"
177932177688
{yymsp[-1].minor.yy144 = 1;}
177933
-#line 4084 "parse.sql"
177934177689
break;
177935177690
case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
177936
-#line 438 "parse.y"
177937177691
{yymsp[-1].minor.yy144 = 0;}
177938
-#line 4089 "parse.sql"
177939177692
break;
177940177693
case 66: /* tconscomma ::= COMMA */
177941
-#line 444 "parse.y"
177942177694
{pParse->constraintName.n = 0;}
177943
-#line 4094 "parse.sql"
177944177695
break;
177945177696
case 68: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
177946
-#line 448 "parse.y"
177947177697
{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy14,yymsp[0].minor.yy144,yymsp[-2].minor.yy144,0);}
177948
-#line 4099 "parse.sql"
177949177698
break;
177950177699
case 69: /* tcons ::= UNIQUE LP sortlist RP onconf */
177951
-#line 450 "parse.y"
177952177700
{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy14,yymsp[0].minor.yy144,0,0,0,0,
177953177701
SQLITE_IDXTYPE_UNIQUE);}
177954
-#line 4105 "parse.sql"
177955177702
break;
177956177703
case 70: /* tcons ::= CHECK LP expr RP onconf */
177957
-#line 453 "parse.y"
177958177704
{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy454,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
177959
-#line 4110 "parse.sql"
177960177705
break;
177961177706
case 71: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
177962
-#line 455 "parse.y"
177963177707
{
177964177708
sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy14, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy14, yymsp[-1].minor.yy144);
177965177709
sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy144);
177966177710
}
177967
-#line 4118 "parse.sql"
177968177711
break;
177969177712
case 73: /* onconf ::= */
177970177713
case 75: /* orconf ::= */ yytestcase(yyruleno==75);
177971
-#line 469 "parse.y"
177972177714
{yymsp[1].minor.yy144 = OE_Default;}
177973
-#line 4124 "parse.sql"
177974177715
break;
177975177716
case 74: /* onconf ::= ON CONFLICT resolvetype */
177976
-#line 470 "parse.y"
177977177717
{yymsp[-2].minor.yy144 = yymsp[0].minor.yy144;}
177978
-#line 4129 "parse.sql"
177979177718
break;
177980177719
case 77: /* resolvetype ::= IGNORE */
177981
-#line 474 "parse.y"
177982177720
{yymsp[0].minor.yy144 = OE_Ignore;}
177983
-#line 4134 "parse.sql"
177984177721
break;
177985177722
case 78: /* resolvetype ::= REPLACE */
177986177723
case 174: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==174);
177987
-#line 475 "parse.y"
177988177724
{yymsp[0].minor.yy144 = OE_Replace;}
177989
-#line 4140 "parse.sql"
177990177725
break;
177991177726
case 79: /* cmd ::= DROP TABLE ifexists fullname */
177992
-#line 479 "parse.y"
177993177727
{
177994177728
sqlite3DropTable(pParse, yymsp[0].minor.yy203, 0, yymsp[-1].minor.yy144);
177995177729
}
177996
-#line 4147 "parse.sql"
177997177730
break;
177998177731
case 82: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
177999
-#line 490 "parse.y"
178000177732
{
178001177733
sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy14, yymsp[0].minor.yy555, yymsp[-7].minor.yy144, yymsp[-5].minor.yy144);
178002177734
}
178003
-#line 4154 "parse.sql"
178004177735
break;
178005177736
case 83: /* cmd ::= DROP VIEW ifexists fullname */
178006
-#line 493 "parse.y"
178007177737
{
178008177738
sqlite3DropTable(pParse, yymsp[0].minor.yy203, 1, yymsp[-1].minor.yy144);
178009177739
}
178010
-#line 4161 "parse.sql"
178011177740
break;
178012177741
case 84: /* cmd ::= select */
178013
-#line 500 "parse.y"
178014177742
{
178015177743
SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0};
178016177744
if( (pParse->db->mDbFlags & DBFLAG_EncodingFixed)!=0
178017177745
|| sqlite3ReadSchema(pParse)==SQLITE_OK
178018177746
){
178019177747
sqlite3Select(pParse, yymsp[0].minor.yy555, &dest);
178020177748
}
178021177749
sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy555);
178022177750
}
178023
-#line 4174 "parse.sql"
178024177751
break;
178025177752
case 85: /* select ::= WITH wqlist selectnowith */
178026
-#line 574 "parse.y"
178027177753
{yymsp[-2].minor.yy555 = attachWithToSelect(pParse,yymsp[0].minor.yy555,yymsp[-1].minor.yy59);}
178028
-#line 4179 "parse.sql"
178029177754
break;
178030177755
case 86: /* select ::= WITH RECURSIVE wqlist selectnowith */
178031
-#line 576 "parse.y"
178032177756
{yymsp[-3].minor.yy555 = attachWithToSelect(pParse,yymsp[0].minor.yy555,yymsp[-1].minor.yy59);}
178033
-#line 4184 "parse.sql"
178034177757
break;
178035177758
case 87: /* select ::= selectnowith */
178036
-#line 579 "parse.y"
178037177759
{
178038177760
Select *p = yymsp[0].minor.yy555;
178039177761
if( p ){
178040177762
parserDoubleLinkSelect(pParse, p);
178041177763
}
178042177764
}
178043
-#line 4194 "parse.sql"
178044177765
break;
178045177766
case 88: /* selectnowith ::= selectnowith multiselect_op oneselect */
178046
-#line 588 "parse.y"
178047177767
{
178048177768
Select *pRhs = yymsp[0].minor.yy555;
178049177769
Select *pLhs = yymsp[-2].minor.yy555;
178050177770
if( pRhs && pRhs->pPrior ){
178051177771
SrcList *pFrom;
@@ -178064,175 +177784,131 @@
178064177784
}else{
178065177785
sqlite3SelectDelete(pParse->db, pLhs);
178066177786
}
178067177787
yymsp[-2].minor.yy555 = pRhs;
178068177788
}
178069
-#line 4220 "parse.sql"
178070177789
break;
178071177790
case 89: /* multiselect_op ::= UNION */
178072177791
case 91: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==91);
178073
-#line 611 "parse.y"
178074177792
{yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-OP*/}
178075
-#line 4226 "parse.sql"
178076177793
break;
178077177794
case 90: /* multiselect_op ::= UNION ALL */
178078
-#line 612 "parse.y"
178079177795
{yymsp[-1].minor.yy144 = TK_ALL;}
178080
-#line 4231 "parse.sql"
178081177796
break;
178082177797
case 92: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
178083
-#line 618 "parse.y"
178084177798
{
178085177799
yymsp[-8].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy14,yymsp[-5].minor.yy203,yymsp[-4].minor.yy454,yymsp[-3].minor.yy14,yymsp[-2].minor.yy454,yymsp[-1].minor.yy14,yymsp[-7].minor.yy144,yymsp[0].minor.yy454);
178086177800
}
178087
-#line 4238 "parse.sql"
178088177801
break;
178089177802
case 93: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
178090
-#line 624 "parse.y"
178091177803
{
178092177804
yymsp[-9].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy14,yymsp[-6].minor.yy203,yymsp[-5].minor.yy454,yymsp[-4].minor.yy14,yymsp[-3].minor.yy454,yymsp[-1].minor.yy14,yymsp[-8].minor.yy144,yymsp[0].minor.yy454);
178093177805
if( yymsp[-9].minor.yy555 ){
178094177806
yymsp[-9].minor.yy555->pWinDefn = yymsp[-2].minor.yy211;
178095177807
}else{
178096177808
sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy211);
178097177809
}
178098177810
}
178099
-#line 4250 "parse.sql"
178100177811
break;
178101177812
case 94: /* values ::= VALUES LP nexprlist RP */
178102
-#line 640 "parse.y"
178103177813
{
178104177814
yymsp[-3].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy14,0,0,0,0,0,SF_Values,0);
178105177815
}
178106
-#line 4257 "parse.sql"
178107177816
break;
178108177817
case 95: /* oneselect ::= mvalues */
178109
-#line 647 "parse.y"
178110177818
{
178111177819
sqlite3MultiValuesEnd(pParse, yymsp[0].minor.yy555);
178112177820
}
178113
-#line 4264 "parse.sql"
178114177821
break;
178115177822
case 96: /* mvalues ::= values COMMA LP nexprlist RP */
178116177823
case 97: /* mvalues ::= mvalues COMMA LP nexprlist RP */ yytestcase(yyruleno==97);
178117
-#line 651 "parse.y"
178118177824
{
178119177825
yymsp[-4].minor.yy555 = sqlite3MultiValues(pParse, yymsp[-4].minor.yy555, yymsp[-1].minor.yy14);
178120177826
}
178121
-#line 4272 "parse.sql"
178122177827
break;
178123177828
case 98: /* distinct ::= DISTINCT */
178124
-#line 662 "parse.y"
178125177829
{yymsp[0].minor.yy144 = SF_Distinct;}
178126
-#line 4277 "parse.sql"
178127177830
break;
178128177831
case 99: /* distinct ::= ALL */
178129
-#line 663 "parse.y"
178130177832
{yymsp[0].minor.yy144 = SF_All;}
178131
-#line 4282 "parse.sql"
178132177833
break;
178133177834
case 101: /* sclp ::= */
178134177835
case 134: /* orderby_opt ::= */ yytestcase(yyruleno==134);
178135177836
case 144: /* groupby_opt ::= */ yytestcase(yyruleno==144);
178136177837
case 234: /* exprlist ::= */ yytestcase(yyruleno==234);
178137177838
case 237: /* paren_exprlist ::= */ yytestcase(yyruleno==237);
178138177839
case 242: /* eidlist_opt ::= */ yytestcase(yyruleno==242);
178139
-#line 676 "parse.y"
178140177840
{yymsp[1].minor.yy14 = 0;}
178141
-#line 4292 "parse.sql"
178142177841
break;
178143177842
case 102: /* selcollist ::= sclp scanpt expr scanpt as */
178144
-#line 677 "parse.y"
178145177843
{
178146177844
yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy14, yymsp[-2].minor.yy454);
178147177845
if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy14, &yymsp[0].minor.yy0, 1);
178148177846
sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy14,yymsp[-3].minor.yy168,yymsp[-1].minor.yy168);
178149177847
}
178150
-#line 4301 "parse.sql"
178151177848
break;
178152177849
case 103: /* selcollist ::= sclp scanpt STAR */
178153
-#line 682 "parse.y"
178154177850
{
178155177851
Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
178156177852
sqlite3ExprSetErrorOffset(p, (int)(yymsp[0].minor.yy0.z - pParse->zTail));
178157177853
yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy14, p);
178158177854
}
178159
-#line 4310 "parse.sql"
178160177855
break;
178161177856
case 104: /* selcollist ::= sclp scanpt nm DOT STAR */
178162
-#line 687 "parse.y"
178163177857
{
178164177858
Expr *pRight, *pLeft, *pDot;
178165177859
pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
178166177860
sqlite3ExprSetErrorOffset(pRight, (int)(yymsp[0].minor.yy0.z - pParse->zTail));
178167177861
pLeft = tokenExpr(pParse, TK_ID, yymsp[-2].minor.yy0);
178168177862
pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
178169177863
yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, pDot);
178170177864
}
178171
-#line 4322 "parse.sql"
178172177865
break;
178173177866
case 105: /* as ::= AS nm */
178174177867
case 117: /* dbnm ::= DOT nm */ yytestcase(yyruleno==117);
178175177868
case 258: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==258);
178176177869
case 259: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==259);
178177
-#line 700 "parse.y"
178178177870
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
178179
-#line 4330 "parse.sql"
178180177871
break;
178181177872
case 107: /* from ::= */
178182177873
case 110: /* stl_prefix ::= */ yytestcase(yyruleno==110);
178183
-#line 714 "parse.y"
178184177874
{yymsp[1].minor.yy203 = 0;}
178185
-#line 4336 "parse.sql"
178186177875
break;
178187177876
case 108: /* from ::= FROM seltablist */
178188
-#line 715 "parse.y"
178189177877
{
178190177878
yymsp[-1].minor.yy203 = yymsp[0].minor.yy203;
178191177879
sqlite3SrcListShiftJoinType(pParse,yymsp[-1].minor.yy203);
178192177880
}
178193
-#line 4344 "parse.sql"
178194177881
break;
178195177882
case 109: /* stl_prefix ::= seltablist joinop */
178196
-#line 723 "parse.y"
178197177883
{
178198177884
if( ALWAYS(yymsp[-1].minor.yy203 && yymsp[-1].minor.yy203->nSrc>0) ) yymsp[-1].minor.yy203->a[yymsp[-1].minor.yy203->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy144;
178199177885
}
178200
-#line 4351 "parse.sql"
178201177886
break;
178202177887
case 111: /* seltablist ::= stl_prefix nm dbnm as on_using */
178203
-#line 727 "parse.y"
178204177888
{
178205177889
yymsp[-4].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-4].minor.yy203,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269);
178206177890
}
178207
-#line 4358 "parse.sql"
178208177891
break;
178209177892
case 112: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */
178210
-#line 730 "parse.y"
178211177893
{
178212177894
yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,0,&yymsp[0].minor.yy269);
178213177895
sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy203, &yymsp[-1].minor.yy0);
178214177896
}
178215
-#line 4366 "parse.sql"
178216177897
break;
178217177898
case 113: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */
178218
-#line 734 "parse.y"
178219177899
{
178220177900
yymsp[-7].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-7].minor.yy203,&yymsp[-6].minor.yy0,&yymsp[-5].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269);
178221177901
sqlite3SrcListFuncArgs(pParse, yymsp[-7].minor.yy203, yymsp[-3].minor.yy14);
178222177902
}
178223
-#line 4374 "parse.sql"
178224177903
break;
178225177904
case 114: /* seltablist ::= stl_prefix LP select RP as on_using */
178226
-#line 739 "parse.y"
178227177905
{
178228177906
yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,yymsp[-3].minor.yy555,&yymsp[0].minor.yy269);
178229177907
}
178230
-#line 4381 "parse.sql"
178231177908
break;
178232177909
case 115: /* seltablist ::= stl_prefix LP seltablist RP as on_using */
178233
-#line 742 "parse.y"
178234177910
{
178235177911
if( yymsp[-5].minor.yy203==0 && yymsp[-1].minor.yy0.n==0 && yymsp[0].minor.yy269.pOn==0 && yymsp[0].minor.yy269.pUsing==0 ){
178236177912
yymsp[-5].minor.yy203 = yymsp[-3].minor.yy203;
178237177913
}else if( ALWAYS(yymsp[-3].minor.yy203!=0) && yymsp[-3].minor.yy203->nSrc==1 ){
178238177914
yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269);
@@ -178269,210 +177945,144 @@
178269177945
sqlite3SrcListShiftJoinType(pParse,yymsp[-3].minor.yy203);
178270177946
pSubquery = sqlite3SelectNew(pParse,0,yymsp[-3].minor.yy203,0,0,0,0,SF_NestedFrom,0);
178271177947
yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,pSubquery,&yymsp[0].minor.yy269);
178272177948
}
178273177949
}
178274
-#line 4425 "parse.sql"
178275177950
break;
178276177951
case 116: /* dbnm ::= */
178277177952
case 131: /* indexed_opt ::= */ yytestcase(yyruleno==131);
178278
-#line 785 "parse.y"
178279177953
{yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
178280
-#line 4431 "parse.sql"
178281177954
break;
178282177955
case 118: /* fullname ::= nm */
178283
-#line 790 "parse.y"
178284177956
{
178285177957
yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
178286177958
if( IN_RENAME_OBJECT && yylhsminor.yy203 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[0].minor.yy0);
178287177959
}
178288
-#line 4439 "parse.sql"
178289177960
yymsp[0].minor.yy203 = yylhsminor.yy203;
178290177961
break;
178291177962
case 119: /* fullname ::= nm DOT nm */
178292
-#line 794 "parse.y"
178293177963
{
178294177964
yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
178295177965
if( IN_RENAME_OBJECT && yylhsminor.yy203 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[0].minor.yy0);
178296177966
}
178297
-#line 4448 "parse.sql"
178298177967
yymsp[-2].minor.yy203 = yylhsminor.yy203;
178299177968
break;
178300177969
case 120: /* xfullname ::= nm */
178301
-#line 802 "parse.y"
178302177970
{yymsp[0].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
178303
-#line 4454 "parse.sql"
178304177971
break;
178305177972
case 121: /* xfullname ::= nm DOT nm */
178306
-#line 804 "parse.y"
178307177973
{yymsp[-2].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
178308
-#line 4459 "parse.sql"
178309177974
break;
178310177975
case 122: /* xfullname ::= nm DOT nm AS nm */
178311
-#line 805 "parse.y"
178312177976
{
178313177977
yymsp[-4].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
178314177978
if( yymsp[-4].minor.yy203 ) yymsp[-4].minor.yy203->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
178315177979
}
178316
-#line 4467 "parse.sql"
178317177980
break;
178318177981
case 123: /* xfullname ::= nm AS nm */
178319
-#line 809 "parse.y"
178320177982
{
178321177983
yymsp[-2].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
178322177984
if( yymsp[-2].minor.yy203 ) yymsp[-2].minor.yy203->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
178323177985
}
178324
-#line 4475 "parse.sql"
178325177986
break;
178326177987
case 124: /* joinop ::= COMMA|JOIN */
178327
-#line 815 "parse.y"
178328177988
{ yymsp[0].minor.yy144 = JT_INNER; }
178329
-#line 4480 "parse.sql"
178330177989
break;
178331177990
case 125: /* joinop ::= JOIN_KW JOIN */
178332
-#line 817 "parse.y"
178333177991
{yymsp[-1].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
178334
-#line 4485 "parse.sql"
178335177992
break;
178336177993
case 126: /* joinop ::= JOIN_KW nm JOIN */
178337
-#line 819 "parse.y"
178338177994
{yymsp[-2].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
178339
-#line 4490 "parse.sql"
178340177995
break;
178341177996
case 127: /* joinop ::= JOIN_KW nm nm JOIN */
178342
-#line 821 "parse.y"
178343177997
{yymsp[-3].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
178344
-#line 4495 "parse.sql"
178345177998
break;
178346177999
case 128: /* on_using ::= ON expr */
178347
-#line 842 "parse.y"
178348178000
{yymsp[-1].minor.yy269.pOn = yymsp[0].minor.yy454; yymsp[-1].minor.yy269.pUsing = 0;}
178349
-#line 4500 "parse.sql"
178350178001
break;
178351178002
case 129: /* on_using ::= USING LP idlist RP */
178352
-#line 843 "parse.y"
178353178003
{yymsp[-3].minor.yy269.pOn = 0; yymsp[-3].minor.yy269.pUsing = yymsp[-1].minor.yy132;}
178354
-#line 4505 "parse.sql"
178355178004
break;
178356178005
case 130: /* on_using ::= */
178357
-#line 844 "parse.y"
178358178006
{yymsp[1].minor.yy269.pOn = 0; yymsp[1].minor.yy269.pUsing = 0;}
178359
-#line 4510 "parse.sql"
178360178007
break;
178361178008
case 132: /* indexed_by ::= INDEXED BY nm */
178362
-#line 860 "parse.y"
178363178009
{yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
178364
-#line 4515 "parse.sql"
178365178010
break;
178366178011
case 133: /* indexed_by ::= NOT INDEXED */
178367
-#line 861 "parse.y"
178368178012
{yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
178369
-#line 4520 "parse.sql"
178370178013
break;
178371178014
case 135: /* orderby_opt ::= ORDER BY sortlist */
178372178015
case 145: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==145);
178373
-#line 874 "parse.y"
178374178016
{yymsp[-2].minor.yy14 = yymsp[0].minor.yy14;}
178375
-#line 4526 "parse.sql"
178376178017
break;
178377178018
case 136: /* sortlist ::= sortlist COMMA expr sortorder nulls */
178378
-#line 875 "parse.y"
178379178019
{
178380178020
yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14,yymsp[-2].minor.yy454);
178381178021
sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy14,yymsp[-1].minor.yy144,yymsp[0].minor.yy144);
178382178022
}
178383
-#line 4534 "parse.sql"
178384178023
break;
178385178024
case 137: /* sortlist ::= expr sortorder nulls */
178386
-#line 879 "parse.y"
178387178025
{
178388178026
yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy454); /*A-overwrites-Y*/
178389178027
sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy14,yymsp[-1].minor.yy144,yymsp[0].minor.yy144);
178390178028
}
178391
-#line 4542 "parse.sql"
178392178029
break;
178393178030
case 138: /* sortorder ::= ASC */
178394
-#line 886 "parse.y"
178395178031
{yymsp[0].minor.yy144 = SQLITE_SO_ASC;}
178396
-#line 4547 "parse.sql"
178397178032
break;
178398178033
case 139: /* sortorder ::= DESC */
178399
-#line 887 "parse.y"
178400178034
{yymsp[0].minor.yy144 = SQLITE_SO_DESC;}
178401
-#line 4552 "parse.sql"
178402178035
break;
178403178036
case 140: /* sortorder ::= */
178404178037
case 143: /* nulls ::= */ yytestcase(yyruleno==143);
178405
-#line 888 "parse.y"
178406178038
{yymsp[1].minor.yy144 = SQLITE_SO_UNDEFINED;}
178407
-#line 4558 "parse.sql"
178408178039
break;
178409178040
case 141: /* nulls ::= NULLS FIRST */
178410
-#line 891 "parse.y"
178411178041
{yymsp[-1].minor.yy144 = SQLITE_SO_ASC;}
178412
-#line 4563 "parse.sql"
178413178042
break;
178414178043
case 142: /* nulls ::= NULLS LAST */
178415
-#line 892 "parse.y"
178416178044
{yymsp[-1].minor.yy144 = SQLITE_SO_DESC;}
178417
-#line 4568 "parse.sql"
178418178045
break;
178419178046
case 146: /* having_opt ::= */
178420178047
case 148: /* limit_opt ::= */ yytestcase(yyruleno==148);
178421178048
case 153: /* where_opt ::= */ yytestcase(yyruleno==153);
178422178049
case 155: /* where_opt_ret ::= */ yytestcase(yyruleno==155);
178423178050
case 232: /* case_else ::= */ yytestcase(yyruleno==232);
178424178051
case 233: /* case_operand ::= */ yytestcase(yyruleno==233);
178425178052
case 252: /* vinto ::= */ yytestcase(yyruleno==252);
178426
-#line 902 "parse.y"
178427178053
{yymsp[1].minor.yy454 = 0;}
178428
-#line 4579 "parse.sql"
178429178054
break;
178430178055
case 147: /* having_opt ::= HAVING expr */
178431178056
case 154: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==154);
178432178057
case 156: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==156);
178433178058
case 231: /* case_else ::= ELSE expr */ yytestcase(yyruleno==231);
178434178059
case 251: /* vinto ::= INTO expr */ yytestcase(yyruleno==251);
178435
-#line 903 "parse.y"
178436178060
{yymsp[-1].minor.yy454 = yymsp[0].minor.yy454;}
178437
-#line 4588 "parse.sql"
178438178061
break;
178439178062
case 149: /* limit_opt ::= LIMIT expr */
178440
-#line 917 "parse.y"
178441178063
{yymsp[-1].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy454,0);}
178442
-#line 4593 "parse.sql"
178443178064
break;
178444178065
case 150: /* limit_opt ::= LIMIT expr OFFSET expr */
178445
-#line 919 "parse.y"
178446178066
{yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
178447
-#line 4598 "parse.sql"
178448178067
break;
178449178068
case 151: /* limit_opt ::= LIMIT expr COMMA expr */
178450
-#line 921 "parse.y"
178451178069
{yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy454,yymsp[-2].minor.yy454);}
178452
-#line 4603 "parse.sql"
178453178070
break;
178454178071
case 152: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
178455
-#line 939 "parse.y"
178456178072
{
178457178073
sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy203, &yymsp[-1].minor.yy0);
178458178074
sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy203,yymsp[0].minor.yy454,0,0);
178459178075
}
178460
-#line 4611 "parse.sql"
178461178076
break;
178462178077
case 157: /* where_opt_ret ::= RETURNING selcollist */
178463
-#line 955 "parse.y"
178464178078
{sqlite3AddReturning(pParse,yymsp[0].minor.yy14); yymsp[-1].minor.yy454 = 0;}
178465
-#line 4616 "parse.sql"
178466178079
break;
178467178080
case 158: /* where_opt_ret ::= WHERE expr RETURNING selcollist */
178468
-#line 957 "parse.y"
178469178081
{sqlite3AddReturning(pParse,yymsp[0].minor.yy14); yymsp[-3].minor.yy454 = yymsp[-2].minor.yy454;}
178470
-#line 4621 "parse.sql"
178471178082
break;
178472178083
case 159: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
178473
-#line 989 "parse.y"
178474178084
{
178475178085
sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy203, &yymsp[-4].minor.yy0);
178476178086
sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy14,"set list");
178477178087
if( yymsp[-1].minor.yy203 ){
178478178088
SrcList *pFromClause = yymsp[-1].minor.yy203;
@@ -178486,134 +178096,92 @@
178486178096
}
178487178097
yymsp[-5].minor.yy203 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy203, pFromClause);
178488178098
}
178489178099
sqlite3Update(pParse,yymsp[-5].minor.yy203,yymsp[-2].minor.yy14,yymsp[0].minor.yy454,yymsp[-6].minor.yy144,0,0,0);
178490178100
}
178491
-#line 4642 "parse.sql"
178492178101
break;
178493178102
case 160: /* setlist ::= setlist COMMA nm EQ expr */
178494
-#line 1013 "parse.y"
178495178103
{
178496178104
yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy14, yymsp[0].minor.yy454);
178497178105
sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy14, &yymsp[-2].minor.yy0, 1);
178498178106
}
178499
-#line 4650 "parse.sql"
178500178107
break;
178501178108
case 161: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
178502
-#line 1017 "parse.y"
178503178109
{
178504178110
yymsp[-6].minor.yy14 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy14, yymsp[-3].minor.yy132, yymsp[0].minor.yy454);
178505178111
}
178506
-#line 4657 "parse.sql"
178507178112
break;
178508178113
case 162: /* setlist ::= nm EQ expr */
178509
-#line 1020 "parse.y"
178510178114
{
178511178115
yylhsminor.yy14 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy454);
178512178116
sqlite3ExprListSetName(pParse, yylhsminor.yy14, &yymsp[-2].minor.yy0, 1);
178513178117
}
178514
-#line 4665 "parse.sql"
178515178118
yymsp[-2].minor.yy14 = yylhsminor.yy14;
178516178119
break;
178517178120
case 163: /* setlist ::= LP idlist RP EQ expr */
178518
-#line 1024 "parse.y"
178519178121
{
178520178122
yymsp[-4].minor.yy14 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy132, yymsp[0].minor.yy454);
178521178123
}
178522
-#line 4673 "parse.sql"
178523178124
break;
178524178125
case 164: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
178525
-#line 1031 "parse.y"
178526178126
{
178527178127
sqlite3Insert(pParse, yymsp[-3].minor.yy203, yymsp[-1].minor.yy555, yymsp[-2].minor.yy132, yymsp[-5].minor.yy144, yymsp[0].minor.yy122);
178528178128
}
178529
-#line 4680 "parse.sql"
178530178129
break;
178531178130
case 165: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
178532
-#line 1035 "parse.y"
178533178131
{
178534178132
sqlite3Insert(pParse, yymsp[-4].minor.yy203, 0, yymsp[-3].minor.yy132, yymsp[-6].minor.yy144, 0);
178535178133
}
178536
-#line 4687 "parse.sql"
178537178134
break;
178538178135
case 166: /* upsert ::= */
178539
-#line 1046 "parse.y"
178540178136
{ yymsp[1].minor.yy122 = 0; }
178541
-#line 4692 "parse.sql"
178542178137
break;
178543178138
case 167: /* upsert ::= RETURNING selcollist */
178544
-#line 1047 "parse.y"
178545178139
{ yymsp[-1].minor.yy122 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy14); }
178546
-#line 4697 "parse.sql"
178547178140
break;
178548178141
case 168: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
178549
-#line 1050 "parse.y"
178550178142
{ yymsp[-11].minor.yy122 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy14,yymsp[-6].minor.yy454,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454,yymsp[0].minor.yy122);}
178551
-#line 4702 "parse.sql"
178552178143
break;
178553178144
case 169: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
178554
-#line 1052 "parse.y"
178555178145
{ yymsp[-8].minor.yy122 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy14,yymsp[-3].minor.yy454,0,0,yymsp[0].minor.yy122); }
178556
-#line 4707 "parse.sql"
178557178146
break;
178558178147
case 170: /* upsert ::= ON CONFLICT DO NOTHING returning */
178559
-#line 1054 "parse.y"
178560178148
{ yymsp[-4].minor.yy122 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
178561
-#line 4712 "parse.sql"
178562178149
break;
178563178150
case 171: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
178564
-#line 1056 "parse.y"
178565178151
{ yymsp[-7].minor.yy122 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454,0);}
178566
-#line 4717 "parse.sql"
178567178152
break;
178568178153
case 172: /* returning ::= RETURNING selcollist */
178569
-#line 1058 "parse.y"
178570178154
{sqlite3AddReturning(pParse,yymsp[0].minor.yy14);}
178571
-#line 4722 "parse.sql"
178572178155
break;
178573178156
case 175: /* idlist_opt ::= */
178574
-#line 1070 "parse.y"
178575178157
{yymsp[1].minor.yy132 = 0;}
178576
-#line 4727 "parse.sql"
178577178158
break;
178578178159
case 176: /* idlist_opt ::= LP idlist RP */
178579
-#line 1071 "parse.y"
178580178160
{yymsp[-2].minor.yy132 = yymsp[-1].minor.yy132;}
178581
-#line 4732 "parse.sql"
178582178161
break;
178583178162
case 177: /* idlist ::= idlist COMMA nm */
178584
-#line 1073 "parse.y"
178585178163
{yymsp[-2].minor.yy132 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy132,&yymsp[0].minor.yy0);}
178586
-#line 4737 "parse.sql"
178587178164
break;
178588178165
case 178: /* idlist ::= nm */
178589
-#line 1075 "parse.y"
178590178166
{yymsp[0].minor.yy132 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
178591
-#line 4742 "parse.sql"
178592178167
break;
178593178168
case 179: /* expr ::= LP expr RP */
178594
-#line 1124 "parse.y"
178595178169
{yymsp[-2].minor.yy454 = yymsp[-1].minor.yy454;}
178596
-#line 4747 "parse.sql"
178597178170
break;
178598178171
case 180: /* expr ::= ID|INDEXED|JOIN_KW */
178599
-#line 1125 "parse.y"
178600178172
{yymsp[0].minor.yy454=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
178601
-#line 4752 "parse.sql"
178602178173
break;
178603178174
case 181: /* expr ::= nm DOT nm */
178604
-#line 1126 "parse.y"
178605178175
{
178606178176
Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
178607178177
Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
178608178178
yylhsminor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
178609178179
}
178610
-#line 4761 "parse.sql"
178611178180
yymsp[-2].minor.yy454 = yylhsminor.yy454;
178612178181
break;
178613178182
case 182: /* expr ::= nm DOT nm DOT nm */
178614
-#line 1131 "parse.y"
178615178183
{
178616178184
Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0);
178617178185
Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
178618178186
Expr *temp3 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
178619178187
Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
@@ -178620,30 +178188,24 @@
178620178188
if( IN_RENAME_OBJECT ){
178621178189
sqlite3RenameTokenRemap(pParse, 0, temp1);
178622178190
}
178623178191
yylhsminor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
178624178192
}
178625
-#line 4776 "parse.sql"
178626178193
yymsp[-4].minor.yy454 = yylhsminor.yy454;
178627178194
break;
178628178195
case 183: /* term ::= NULL|FLOAT|BLOB */
178629178196
case 184: /* term ::= STRING */ yytestcase(yyruleno==184);
178630
-#line 1141 "parse.y"
178631178197
{yymsp[0].minor.yy454=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
178632
-#line 4783 "parse.sql"
178633178198
break;
178634178199
case 185: /* term ::= INTEGER */
178635
-#line 1143 "parse.y"
178636178200
{
178637178201
yylhsminor.yy454 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
178638178202
if( yylhsminor.yy454 ) yylhsminor.yy454->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
178639178203
}
178640
-#line 4791 "parse.sql"
178641178204
yymsp[0].minor.yy454 = yylhsminor.yy454;
178642178205
break;
178643178206
case 186: /* expr ::= VARIABLE */
178644
-#line 1147 "parse.y"
178645178207
{
178646178208
if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
178647178209
u32 n = yymsp[0].minor.yy0.n;
178648178210
yymsp[0].minor.yy454 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
178649178211
sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy454, n);
@@ -178660,90 +178222,70 @@
178660178222
yymsp[0].minor.yy454 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
178661178223
if( yymsp[0].minor.yy454 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy454->iTable);
178662178224
}
178663178225
}
178664178226
}
178665
-#line 4816 "parse.sql"
178666178227
break;
178667178228
case 187: /* expr ::= expr COLLATE ID|STRING */
178668
-#line 1167 "parse.y"
178669178229
{
178670178230
yymsp[-2].minor.yy454 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy454, &yymsp[0].minor.yy0, 1);
178671178231
}
178672
-#line 4823 "parse.sql"
178673178232
break;
178674178233
case 188: /* expr ::= CAST LP expr AS typetoken RP */
178675
-#line 1171 "parse.y"
178676178234
{
178677178235
yymsp[-5].minor.yy454 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
178678178236
sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy454, yymsp[-3].minor.yy454, 0);
178679178237
}
178680
-#line 4831 "parse.sql"
178681178238
break;
178682178239
case 189: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
178683
-#line 1178 "parse.y"
178684178240
{
178685178241
yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy14, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy144);
178686178242
}
178687
-#line 4838 "parse.sql"
178688178243
yymsp[-4].minor.yy454 = yylhsminor.yy454;
178689178244
break;
178690178245
case 190: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */
178691
-#line 1181 "parse.y"
178692178246
{
178693178247
yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-4].minor.yy14, &yymsp[-7].minor.yy0, yymsp[-5].minor.yy144);
178694178248
sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy454, yymsp[-1].minor.yy14);
178695178249
}
178696
-#line 4847 "parse.sql"
178697178250
yymsp[-7].minor.yy454 = yylhsminor.yy454;
178698178251
break;
178699178252
case 191: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
178700
-#line 1185 "parse.y"
178701178253
{
178702178254
yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
178703178255
}
178704
-#line 4855 "parse.sql"
178705178256
yymsp[-3].minor.yy454 = yylhsminor.yy454;
178706178257
break;
178707178258
case 192: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
178708
-#line 1249 "parse.y"
178709178259
{
178710178260
yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy14, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy144);
178711178261
sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211);
178712178262
}
178713
-#line 4864 "parse.sql"
178714178263
yymsp[-5].minor.yy454 = yylhsminor.yy454;
178715178264
break;
178716178265
case 193: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */
178717
-#line 1253 "parse.y"
178718178266
{
178719178267
yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-5].minor.yy14, &yymsp[-8].minor.yy0, yymsp[-6].minor.yy144);
178720178268
sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211);
178721178269
sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy454, yymsp[-2].minor.yy14);
178722178270
}
178723
-#line 4874 "parse.sql"
178724178271
yymsp[-8].minor.yy454 = yylhsminor.yy454;
178725178272
break;
178726178273
case 194: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
178727
-#line 1258 "parse.y"
178728178274
{
178729178275
yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
178730178276
sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211);
178731178277
}
178732
-#line 4883 "parse.sql"
178733178278
yymsp[-4].minor.yy454 = yylhsminor.yy454;
178734178279
break;
178735178280
case 195: /* term ::= CTIME_KW */
178736
-#line 1272 "parse.y"
178737178281
{
178738178282
yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
178739178283
}
178740
-#line 4891 "parse.sql"
178741178284
yymsp[0].minor.yy454 = yylhsminor.yy454;
178742178285
break;
178743178286
case 196: /* expr ::= LP nexprlist COMMA expr RP */
178744
-#line 1276 "parse.y"
178745178287
{
178746178288
ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy14, yymsp[-1].minor.yy454);
178747178289
yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
178748178290
if( yymsp[-4].minor.yy454 ){
178749178291
yymsp[-4].minor.yy454->x.pList = pList;
@@ -178752,35 +178294,27 @@
178752178294
}
178753178295
}else{
178754178296
sqlite3ExprListDelete(pParse->db, pList);
178755178297
}
178756178298
}
178757
-#line 4908 "parse.sql"
178758178299
break;
178759178300
case 197: /* expr ::= expr AND expr */
178760
-#line 1289 "parse.y"
178761178301
{yymsp[-2].minor.yy454=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
178762
-#line 4913 "parse.sql"
178763178302
break;
178764178303
case 198: /* expr ::= expr OR expr */
178765178304
case 199: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==199);
178766178305
case 200: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==200);
178767178306
case 201: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==201);
178768178307
case 202: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==202);
178769178308
case 203: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==203);
178770178309
case 204: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==204);
178771
-#line 1290 "parse.y"
178772178310
{yymsp[-2].minor.yy454=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
178773
-#line 4924 "parse.sql"
178774178311
break;
178775178312
case 205: /* likeop ::= NOT LIKE_KW|MATCH */
178776
-#line 1303 "parse.y"
178777178313
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
178778
-#line 4929 "parse.sql"
178779178314
break;
178780178315
case 206: /* expr ::= expr likeop expr */
178781
-#line 1304 "parse.y"
178782178316
{
178783178317
ExprList *pList;
178784178318
int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
178785178319
yymsp[-1].minor.yy0.n &= 0x7fffffff;
178786178320
pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy454);
@@ -178787,14 +178321,12 @@
178787178321
pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy454);
178788178322
yymsp[-2].minor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
178789178323
if( bNot ) yymsp[-2].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy454, 0);
178790178324
if( yymsp[-2].minor.yy454 ) yymsp[-2].minor.yy454->flags |= EP_InfixFunc;
178791178325
}
178792
-#line 4943 "parse.sql"
178793178326
break;
178794178327
case 207: /* expr ::= expr likeop expr ESCAPE expr */
178795
-#line 1314 "parse.y"
178796178328
{
178797178329
ExprList *pList;
178798178330
int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
178799178331
yymsp[-3].minor.yy0.n &= 0x7fffffff;
178800178332
pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
@@ -178802,62 +178334,46 @@
178802178334
pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454);
178803178335
yymsp[-4].minor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
178804178336
if( bNot ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
178805178337
if( yymsp[-4].minor.yy454 ) yymsp[-4].minor.yy454->flags |= EP_InfixFunc;
178806178338
}
178807
-#line 4958 "parse.sql"
178808178339
break;
178809178340
case 208: /* expr ::= expr ISNULL|NOTNULL */
178810
-#line 1326 "parse.y"
178811178341
{yymsp[-1].minor.yy454 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy454,0);}
178812
-#line 4963 "parse.sql"
178813178342
break;
178814178343
case 209: /* expr ::= expr NOT NULL */
178815
-#line 1327 "parse.y"
178816178344
{yymsp[-2].minor.yy454 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy454,0);}
178817
-#line 4968 "parse.sql"
178818178345
break;
178819178346
case 210: /* expr ::= expr IS expr */
178820
-#line 1348 "parse.y"
178821178347
{
178822178348
yymsp[-2].minor.yy454 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);
178823178349
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-2].minor.yy454, TK_ISNULL);
178824178350
}
178825
-#line 4976 "parse.sql"
178826178351
break;
178827178352
case 211: /* expr ::= expr IS NOT expr */
178828
-#line 1352 "parse.y"
178829178353
{
178830178354
yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy454,yymsp[0].minor.yy454);
178831178355
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-3].minor.yy454, TK_NOTNULL);
178832178356
}
178833
-#line 4984 "parse.sql"
178834178357
break;
178835178358
case 212: /* expr ::= expr IS NOT DISTINCT FROM expr */
178836
-#line 1356 "parse.y"
178837178359
{
178838178360
yymsp[-5].minor.yy454 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy454,yymsp[0].minor.yy454);
178839178361
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-5].minor.yy454, TK_ISNULL);
178840178362
}
178841
-#line 4992 "parse.sql"
178842178363
break;
178843178364
case 213: /* expr ::= expr IS DISTINCT FROM expr */
178844
-#line 1360 "parse.y"
178845178365
{
178846178366
yymsp[-4].minor.yy454 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy454,yymsp[0].minor.yy454);
178847178367
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-4].minor.yy454, TK_NOTNULL);
178848178368
}
178849
-#line 5000 "parse.sql"
178850178369
break;
178851178370
case 214: /* expr ::= NOT expr */
178852178371
case 215: /* expr ::= BITNOT expr */ yytestcase(yyruleno==215);
178853
-#line 1366 "parse.y"
178854178372
{yymsp[-1].minor.yy454 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy454, 0);/*A-overwrites-B*/}
178855
-#line 5006 "parse.sql"
178856178373
break;
178857178374
case 216: /* expr ::= PLUS|MINUS expr */
178858
-#line 1369 "parse.y"
178859178375
{
178860178376
Expr *p = yymsp[0].minor.yy454;
178861178377
u8 op = yymsp[-1].major + (TK_UPLUS-TK_PLUS);
178862178378
assert( TK_UPLUS>TK_PLUS );
178863178379
assert( TK_UMINUS == TK_MINUS + (TK_UPLUS - TK_PLUS) );
@@ -178867,30 +178383,24 @@
178867178383
}else{
178868178384
yymsp[-1].minor.yy454 = sqlite3PExpr(pParse, op, p, 0);
178869178385
/*A-overwrites-B*/
178870178386
}
178871178387
}
178872
-#line 5023 "parse.sql"
178873178388
break;
178874178389
case 217: /* expr ::= expr PTR expr */
178875
-#line 1383 "parse.y"
178876178390
{
178877178391
ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy454);
178878178392
pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy454);
178879178393
yylhsminor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
178880178394
}
178881
-#line 5032 "parse.sql"
178882178395
yymsp[-2].minor.yy454 = yylhsminor.yy454;
178883178396
break;
178884178397
case 218: /* between_op ::= BETWEEN */
178885178398
case 221: /* in_op ::= IN */ yytestcase(yyruleno==221);
178886
-#line 1390 "parse.y"
178887178399
{yymsp[0].minor.yy144 = 0;}
178888
-#line 5039 "parse.sql"
178889178400
break;
178890178401
case 220: /* expr ::= expr between_op expr AND expr */
178891
-#line 1392 "parse.y"
178892178402
{
178893178403
ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
178894178404
pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454);
178895178405
yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy454, 0);
178896178406
if( yymsp[-4].minor.yy454 ){
@@ -178898,14 +178408,12 @@
178898178408
}else{
178899178409
sqlite3ExprListDelete(pParse->db, pList);
178900178410
}
178901178411
if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
178902178412
}
178903
-#line 5054 "parse.sql"
178904178413
break;
178905178414
case 223: /* expr ::= expr in_op LP exprlist RP */
178906
-#line 1407 "parse.y"
178907178415
{
178908178416
if( yymsp[-1].minor.yy14==0 ){
178909178417
/* Expressions of the form
178910178418
**
178911178419
** expr1 IN ()
@@ -178946,52 +178454,42 @@
178946178454
}
178947178455
}
178948178456
if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
178949178457
}
178950178458
}
178951
-#line 5102 "parse.sql"
178952178459
break;
178953178460
case 224: /* expr ::= LP select RP */
178954
-#line 1451 "parse.y"
178955178461
{
178956178462
yymsp[-2].minor.yy454 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
178957178463
sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy454, yymsp[-1].minor.yy555);
178958178464
}
178959
-#line 5110 "parse.sql"
178960178465
break;
178961178466
case 225: /* expr ::= expr in_op LP select RP */
178962
-#line 1455 "parse.y"
178963178467
{
178964178468
yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
178965178469
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, yymsp[-1].minor.yy555);
178966178470
if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
178967178471
}
178968
-#line 5119 "parse.sql"
178969178472
break;
178970178473
case 226: /* expr ::= expr in_op nm dbnm paren_exprlist */
178971
-#line 1460 "parse.y"
178972178474
{
178973178475
SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
178974178476
Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
178975178477
if( yymsp[0].minor.yy14 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy14);
178976178478
yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
178977178479
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pSelect);
178978178480
if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
178979178481
}
178980
-#line 5131 "parse.sql"
178981178482
break;
178982178483
case 227: /* expr ::= EXISTS LP select RP */
178983
-#line 1468 "parse.y"
178984178484
{
178985178485
Expr *p;
178986178486
p = yymsp[-3].minor.yy454 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
178987178487
sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy555);
178988178488
}
178989
-#line 5140 "parse.sql"
178990178489
break;
178991178490
case 228: /* expr ::= CASE case_operand case_exprlist case_else END */
178992
-#line 1476 "parse.y"
178993178491
{
178994178492
yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy454, 0);
178995178493
if( yymsp[-4].minor.yy454 ){
178996178494
yymsp[-4].minor.yy454->x.pList = yymsp[-1].minor.yy454 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454) : yymsp[-2].minor.yy14;
178997178495
sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy454);
@@ -178998,627 +178496,446 @@
178998178496
}else{
178999178497
sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy14);
179000178498
sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy454);
179001178499
}
179002178500
}
179003
-#line 5154 "parse.sql"
179004178501
break;
179005178502
case 229: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
179006
-#line 1488 "parse.y"
179007178503
{
179008178504
yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, yymsp[-2].minor.yy454);
179009178505
yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, yymsp[0].minor.yy454);
179010178506
}
179011
-#line 5162 "parse.sql"
179012178507
break;
179013178508
case 230: /* case_exprlist ::= WHEN expr THEN expr */
179014
-#line 1492 "parse.y"
179015178509
{
179016178510
yymsp[-3].minor.yy14 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
179017178511
yymsp[-3].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy14, yymsp[0].minor.yy454);
179018178512
}
179019
-#line 5170 "parse.sql"
179020178513
break;
179021178514
case 235: /* nexprlist ::= nexprlist COMMA expr */
179022
-#line 1513 "parse.y"
179023178515
{yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy14,yymsp[0].minor.yy454);}
179024
-#line 5175 "parse.sql"
179025178516
break;
179026178517
case 236: /* nexprlist ::= expr */
179027
-#line 1515 "parse.y"
179028178518
{yymsp[0].minor.yy14 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy454); /*A-overwrites-Y*/}
179029
-#line 5180 "parse.sql"
179030178519
break;
179031178520
case 238: /* paren_exprlist ::= LP exprlist RP */
179032178521
case 243: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==243);
179033
-#line 1523 "parse.y"
179034178522
{yymsp[-2].minor.yy14 = yymsp[-1].minor.yy14;}
179035
-#line 5186 "parse.sql"
179036178523
break;
179037178524
case 239: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
179038
-#line 1530 "parse.y"
179039178525
{
179040178526
sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
179041178527
sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy14, yymsp[-10].minor.yy144,
179042178528
&yymsp[-11].minor.yy0, yymsp[0].minor.yy454, SQLITE_SO_ASC, yymsp[-8].minor.yy144, SQLITE_IDXTYPE_APPDEF);
179043178529
if( IN_RENAME_OBJECT && pParse->pNewIndex ){
179044178530
sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
179045178531
}
179046178532
}
179047
-#line 5198 "parse.sql"
179048178533
break;
179049178534
case 240: /* uniqueflag ::= UNIQUE */
179050178535
case 282: /* raisetype ::= ABORT */ yytestcase(yyruleno==282);
179051
-#line 1540 "parse.y"
179052178536
{yymsp[0].minor.yy144 = OE_Abort;}
179053
-#line 5204 "parse.sql"
179054178537
break;
179055178538
case 241: /* uniqueflag ::= */
179056
-#line 1541 "parse.y"
179057178539
{yymsp[1].minor.yy144 = OE_None;}
179058
-#line 5209 "parse.sql"
179059178540
break;
179060178541
case 244: /* eidlist ::= eidlist COMMA nm collate sortorder */
179061
-#line 1591 "parse.y"
179062178542
{
179063178543
yymsp[-4].minor.yy14 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy14, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy144, yymsp[0].minor.yy144);
179064178544
}
179065
-#line 5216 "parse.sql"
179066178545
break;
179067178546
case 245: /* eidlist ::= nm collate sortorder */
179068
-#line 1594 "parse.y"
179069178547
{
179070178548
yymsp[-2].minor.yy14 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy144, yymsp[0].minor.yy144); /*A-overwrites-Y*/
179071178549
}
179072
-#line 5223 "parse.sql"
179073178550
break;
179074178551
case 248: /* cmd ::= DROP INDEX ifexists fullname */
179075
-#line 1605 "parse.y"
179076178552
{sqlite3DropIndex(pParse, yymsp[0].minor.yy203, yymsp[-1].minor.yy144);}
179077
-#line 5228 "parse.sql"
179078178553
break;
179079178554
case 249: /* cmd ::= VACUUM vinto */
179080
-#line 1612 "parse.y"
179081178555
{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy454);}
179082
-#line 5233 "parse.sql"
179083178556
break;
179084178557
case 250: /* cmd ::= VACUUM nm vinto */
179085
-#line 1613 "parse.y"
179086178558
{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy454);}
179087
-#line 5238 "parse.sql"
179088178559
break;
179089178560
case 253: /* cmd ::= PRAGMA nm dbnm */
179090
-#line 1621 "parse.y"
179091178561
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
179092
-#line 5243 "parse.sql"
179093178562
break;
179094178563
case 254: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
179095
-#line 1622 "parse.y"
179096178564
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
179097
-#line 5248 "parse.sql"
179098178565
break;
179099178566
case 255: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
179100
-#line 1623 "parse.y"
179101178567
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
179102
-#line 5253 "parse.sql"
179103178568
break;
179104178569
case 256: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
179105
-#line 1625 "parse.y"
179106178570
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
179107
-#line 5258 "parse.sql"
179108178571
break;
179109178572
case 257: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
179110
-#line 1627 "parse.y"
179111178573
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
179112
-#line 5263 "parse.sql"
179113178574
break;
179114178575
case 260: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
179115
-#line 1643 "parse.y"
179116178576
{
179117178577
Token all;
179118178578
all.z = yymsp[-3].minor.yy0.z;
179119178579
all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
179120178580
sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy427, &all);
179121178581
}
179122
-#line 5273 "parse.sql"
179123178582
break;
179124178583
case 261: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
179125
-#line 1652 "parse.y"
179126178584
{
179127178585
sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy144, yymsp[-4].minor.yy286.a, yymsp[-4].minor.yy286.b, yymsp[-2].minor.yy203, yymsp[0].minor.yy454, yymsp[-10].minor.yy144, yymsp[-8].minor.yy144);
179128178586
yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
179129178587
}
179130
-#line 5281 "parse.sql"
179131178588
break;
179132178589
case 262: /* trigger_time ::= BEFORE|AFTER */
179133
-#line 1658 "parse.y"
179134178590
{ yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-X*/ }
179135
-#line 5286 "parse.sql"
179136178591
break;
179137178592
case 263: /* trigger_time ::= INSTEAD OF */
179138
-#line 1659 "parse.y"
179139178593
{ yymsp[-1].minor.yy144 = TK_INSTEAD;}
179140
-#line 5291 "parse.sql"
179141178594
break;
179142178595
case 264: /* trigger_time ::= */
179143
-#line 1660 "parse.y"
179144178596
{ yymsp[1].minor.yy144 = TK_BEFORE; }
179145
-#line 5296 "parse.sql"
179146178597
break;
179147178598
case 265: /* trigger_event ::= DELETE|INSERT */
179148178599
case 266: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==266);
179149
-#line 1664 "parse.y"
179150178600
{yymsp[0].minor.yy286.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy286.b = 0;}
179151
-#line 5302 "parse.sql"
179152178601
break;
179153178602
case 267: /* trigger_event ::= UPDATE OF idlist */
179154
-#line 1666 "parse.y"
179155178603
{yymsp[-2].minor.yy286.a = TK_UPDATE; yymsp[-2].minor.yy286.b = yymsp[0].minor.yy132;}
179156
-#line 5307 "parse.sql"
179157178604
break;
179158178605
case 268: /* when_clause ::= */
179159178606
case 287: /* key_opt ::= */ yytestcase(yyruleno==287);
179160
-#line 1673 "parse.y"
179161178607
{ yymsp[1].minor.yy454 = 0; }
179162
-#line 5313 "parse.sql"
179163178608
break;
179164178609
case 269: /* when_clause ::= WHEN expr */
179165178610
case 288: /* key_opt ::= KEY expr */ yytestcase(yyruleno==288);
179166
-#line 1674 "parse.y"
179167178611
{ yymsp[-1].minor.yy454 = yymsp[0].minor.yy454; }
179168
-#line 5319 "parse.sql"
179169178612
break;
179170178613
case 270: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
179171
-#line 1678 "parse.y"
179172178614
{
179173178615
assert( yymsp[-2].minor.yy427!=0 );
179174178616
yymsp[-2].minor.yy427->pLast->pNext = yymsp[-1].minor.yy427;
179175178617
yymsp[-2].minor.yy427->pLast = yymsp[-1].minor.yy427;
179176178618
}
179177
-#line 5328 "parse.sql"
179178178619
break;
179179178620
case 271: /* trigger_cmd_list ::= trigger_cmd SEMI */
179180
-#line 1683 "parse.y"
179181178621
{
179182178622
assert( yymsp[-1].minor.yy427!=0 );
179183178623
yymsp[-1].minor.yy427->pLast = yymsp[-1].minor.yy427;
179184178624
}
179185
-#line 5336 "parse.sql"
179186178625
break;
179187178626
case 272: /* trnm ::= nm DOT nm */
179188
-#line 1694 "parse.y"
179189178627
{
179190178628
yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
179191178629
sqlite3ErrorMsg(pParse,
179192178630
"qualified table names are not allowed on INSERT, UPDATE, and DELETE "
179193178631
"statements within triggers");
179194178632
}
179195
-#line 5346 "parse.sql"
179196178633
break;
179197178634
case 273: /* tridxby ::= INDEXED BY nm */
179198
-#line 1706 "parse.y"
179199178635
{
179200178636
sqlite3ErrorMsg(pParse,
179201178637
"the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
179202178638
"within triggers");
179203178639
}
179204
-#line 5355 "parse.sql"
179205178640
break;
179206178641
case 274: /* tridxby ::= NOT INDEXED */
179207
-#line 1711 "parse.y"
179208178642
{
179209178643
sqlite3ErrorMsg(pParse,
179210178644
"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
179211178645
"within triggers");
179212178646
}
179213
-#line 5364 "parse.sql"
179214178647
break;
179215178648
case 275: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
179216
-#line 1724 "parse.y"
179217178649
{yylhsminor.yy427 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy203, yymsp[-3].minor.yy14, yymsp[-1].minor.yy454, yymsp[-7].minor.yy144, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy168);}
179218
-#line 5369 "parse.sql"
179219178650
yymsp[-8].minor.yy427 = yylhsminor.yy427;
179220178651
break;
179221178652
case 276: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
179222
-#line 1728 "parse.y"
179223178653
{
179224178654
yylhsminor.yy427 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy132,yymsp[-2].minor.yy555,yymsp[-6].minor.yy144,yymsp[-1].minor.yy122,yymsp[-7].minor.yy168,yymsp[0].minor.yy168);/*yylhsminor.yy427-overwrites-yymsp[-6].minor.yy144*/
179225178655
}
179226
-#line 5377 "parse.sql"
179227178656
yymsp[-7].minor.yy427 = yylhsminor.yy427;
179228178657
break;
179229178658
case 277: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
179230
-#line 1733 "parse.y"
179231178659
{yylhsminor.yy427 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy454, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy168);}
179232
-#line 5383 "parse.sql"
179233178660
yymsp[-5].minor.yy427 = yylhsminor.yy427;
179234178661
break;
179235178662
case 278: /* trigger_cmd ::= scanpt select scanpt */
179236
-#line 1737 "parse.y"
179237178663
{yylhsminor.yy427 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy555, yymsp[-2].minor.yy168, yymsp[0].minor.yy168); /*yylhsminor.yy427-overwrites-yymsp[-1].minor.yy555*/}
179238
-#line 5389 "parse.sql"
179239178664
yymsp[-2].minor.yy427 = yylhsminor.yy427;
179240178665
break;
179241178666
case 279: /* expr ::= RAISE LP IGNORE RP */
179242
-#line 1740 "parse.y"
179243178667
{
179244178668
yymsp[-3].minor.yy454 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
179245178669
if( yymsp[-3].minor.yy454 ){
179246178670
yymsp[-3].minor.yy454->affExpr = OE_Ignore;
179247178671
}
179248178672
}
179249
-#line 5400 "parse.sql"
179250178673
break;
179251178674
case 280: /* expr ::= RAISE LP raisetype COMMA expr RP */
179252
-#line 1746 "parse.y"
179253178675
{
179254178676
yymsp[-5].minor.yy454 = sqlite3PExpr(pParse, TK_RAISE, yymsp[-1].minor.yy454, 0);
179255178677
if( yymsp[-5].minor.yy454 ) {
179256178678
yymsp[-5].minor.yy454->affExpr = (char)yymsp[-3].minor.yy144;
179257178679
}
179258178680
}
179259
-#line 5410 "parse.sql"
179260178681
break;
179261178682
case 281: /* raisetype ::= ROLLBACK */
179262
-#line 1755 "parse.y"
179263178683
{yymsp[0].minor.yy144 = OE_Rollback;}
179264
-#line 5415 "parse.sql"
179265178684
break;
179266178685
case 283: /* raisetype ::= FAIL */
179267
-#line 1757 "parse.y"
179268178686
{yymsp[0].minor.yy144 = OE_Fail;}
179269
-#line 5420 "parse.sql"
179270178687
break;
179271178688
case 284: /* cmd ::= DROP TRIGGER ifexists fullname */
179272
-#line 1762 "parse.y"
179273178689
{
179274178690
sqlite3DropTrigger(pParse,yymsp[0].minor.yy203,yymsp[-1].minor.yy144);
179275178691
}
179276
-#line 5427 "parse.sql"
179277178692
break;
179278178693
case 285: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
179279
-#line 1769 "parse.y"
179280178694
{
179281178695
sqlite3Attach(pParse, yymsp[-3].minor.yy454, yymsp[-1].minor.yy454, yymsp[0].minor.yy454);
179282178696
}
179283
-#line 5434 "parse.sql"
179284178697
break;
179285178698
case 286: /* cmd ::= DETACH database_kw_opt expr */
179286
-#line 1772 "parse.y"
179287178699
{
179288178700
sqlite3Detach(pParse, yymsp[0].minor.yy454);
179289178701
}
179290
-#line 5441 "parse.sql"
179291178702
break;
179292178703
case 289: /* cmd ::= REINDEX */
179293
-#line 1787 "parse.y"
179294178704
{sqlite3Reindex(pParse, 0, 0);}
179295
-#line 5446 "parse.sql"
179296178705
break;
179297178706
case 290: /* cmd ::= REINDEX nm dbnm */
179298
-#line 1788 "parse.y"
179299178707
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
179300
-#line 5451 "parse.sql"
179301178708
break;
179302178709
case 291: /* cmd ::= ANALYZE */
179303
-#line 1793 "parse.y"
179304178710
{sqlite3Analyze(pParse, 0, 0);}
179305
-#line 5456 "parse.sql"
179306178711
break;
179307178712
case 292: /* cmd ::= ANALYZE nm dbnm */
179308
-#line 1794 "parse.y"
179309178713
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
179310
-#line 5461 "parse.sql"
179311178714
break;
179312178715
case 293: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
179313
-#line 1800 "parse.y"
179314178716
{
179315178717
sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy203,&yymsp[0].minor.yy0);
179316178718
}
179317
-#line 5468 "parse.sql"
179318178719
break;
179319178720
case 294: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
179320
-#line 1804 "parse.y"
179321178721
{
179322178722
yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
179323178723
sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
179324178724
}
179325
-#line 5476 "parse.sql"
179326178725
break;
179327178726
case 295: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
179328
-#line 1808 "parse.y"
179329178727
{
179330178728
sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy203, &yymsp[0].minor.yy0);
179331178729
}
179332
-#line 5483 "parse.sql"
179333178730
break;
179334178731
case 296: /* add_column_fullname ::= fullname */
179335
-#line 1812 "parse.y"
179336178732
{
179337178733
disableLookaside(pParse);
179338178734
sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy203);
179339178735
}
179340
-#line 5491 "parse.sql"
179341178736
break;
179342178737
case 297: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
179343
-#line 1816 "parse.y"
179344178738
{
179345178739
sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy203, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
179346178740
}
179347
-#line 5498 "parse.sql"
179348178741
break;
179349178742
case 298: /* cmd ::= create_vtab */
179350
-#line 1828 "parse.y"
179351178743
{sqlite3VtabFinishParse(pParse,0);}
179352
-#line 5503 "parse.sql"
179353178744
break;
179354178745
case 299: /* cmd ::= create_vtab LP vtabarglist RP */
179355
-#line 1829 "parse.y"
179356178746
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
179357
-#line 5508 "parse.sql"
179358178747
break;
179359178748
case 300: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
179360
-#line 1831 "parse.y"
179361178749
{
179362178750
sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy144);
179363178751
}
179364
-#line 5515 "parse.sql"
179365178752
break;
179366178753
case 301: /* vtabarg ::= */
179367
-#line 1836 "parse.y"
179368178754
{sqlite3VtabArgInit(pParse);}
179369
-#line 5520 "parse.sql"
179370178755
break;
179371178756
case 302: /* vtabargtoken ::= ANY */
179372178757
case 303: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==303);
179373178758
case 304: /* lp ::= LP */ yytestcase(yyruleno==304);
179374
-#line 1838 "parse.y"
179375178759
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
179376
-#line 5527 "parse.sql"
179377178760
break;
179378178761
case 305: /* with ::= WITH wqlist */
179379178762
case 306: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==306);
179380
-#line 1855 "parse.y"
179381178763
{ sqlite3WithPush(pParse, yymsp[0].minor.yy59, 1); }
179382
-#line 5533 "parse.sql"
179383178764
break;
179384178765
case 307: /* wqas ::= AS */
179385
-#line 1859 "parse.y"
179386178766
{yymsp[0].minor.yy462 = M10d_Any;}
179387
-#line 5538 "parse.sql"
179388178767
break;
179389178768
case 308: /* wqas ::= AS MATERIALIZED */
179390
-#line 1860 "parse.y"
179391178769
{yymsp[-1].minor.yy462 = M10d_Yes;}
179392
-#line 5543 "parse.sql"
179393178770
break;
179394178771
case 309: /* wqas ::= AS NOT MATERIALIZED */
179395
-#line 1861 "parse.y"
179396178772
{yymsp[-2].minor.yy462 = M10d_No;}
179397
-#line 5548 "parse.sql"
179398178773
break;
179399178774
case 310: /* wqitem ::= withnm eidlist_opt wqas LP select RP */
179400
-#line 1862 "parse.y"
179401178775
{
179402178776
yymsp[-5].minor.yy67 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy14, yymsp[-1].minor.yy555, yymsp[-3].minor.yy462); /*A-overwrites-X*/
179403178777
}
179404
-#line 5555 "parse.sql"
179405178778
break;
179406178779
case 311: /* withnm ::= nm */
179407
-#line 1865 "parse.y"
179408178780
{pParse->bHasWith = 1;}
179409
-#line 5560 "parse.sql"
179410178781
break;
179411178782
case 312: /* wqlist ::= wqitem */
179412
-#line 1866 "parse.y"
179413178783
{
179414178784
yymsp[0].minor.yy59 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy67); /*A-overwrites-X*/
179415178785
}
179416
-#line 5567 "parse.sql"
179417178786
break;
179418178787
case 313: /* wqlist ::= wqlist COMMA wqitem */
179419
-#line 1869 "parse.y"
179420178788
{
179421178789
yymsp[-2].minor.yy59 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy59, yymsp[0].minor.yy67);
179422178790
}
179423
-#line 5574 "parse.sql"
179424178791
break;
179425178792
case 314: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
179426
-#line 1884 "parse.y"
179427178793
{
179428178794
assert( yymsp[0].minor.yy211!=0 );
179429178795
sqlite3WindowChain(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy211);
179430178796
yymsp[0].minor.yy211->pNextWin = yymsp[-2].minor.yy211;
179431178797
yylhsminor.yy211 = yymsp[0].minor.yy211;
179432178798
}
179433
-#line 5584 "parse.sql"
179434178799
yymsp[-2].minor.yy211 = yylhsminor.yy211;
179435178800
break;
179436178801
case 315: /* windowdefn ::= nm AS LP window RP */
179437
-#line 1893 "parse.y"
179438178802
{
179439178803
if( ALWAYS(yymsp[-1].minor.yy211) ){
179440178804
yymsp[-1].minor.yy211->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
179441178805
}
179442178806
yylhsminor.yy211 = yymsp[-1].minor.yy211;
179443178807
}
179444
-#line 5595 "parse.sql"
179445178808
yymsp[-4].minor.yy211 = yylhsminor.yy211;
179446178809
break;
179447178810
case 316: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
179448
-#line 1927 "parse.y"
179449178811
{
179450178812
yymsp[-4].minor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy14, yymsp[-1].minor.yy14, 0);
179451178813
}
179452
-#line 5603 "parse.sql"
179453178814
break;
179454178815
case 317: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
179455
-#line 1930 "parse.y"
179456178816
{
179457178817
yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy14, yymsp[-1].minor.yy14, &yymsp[-5].minor.yy0);
179458178818
}
179459
-#line 5610 "parse.sql"
179460178819
yymsp[-5].minor.yy211 = yylhsminor.yy211;
179461178820
break;
179462178821
case 318: /* window ::= ORDER BY sortlist frame_opt */
179463
-#line 1933 "parse.y"
179464178822
{
179465178823
yymsp[-3].minor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, yymsp[-1].minor.yy14, 0);
179466178824
}
179467
-#line 5618 "parse.sql"
179468178825
break;
179469178826
case 319: /* window ::= nm ORDER BY sortlist frame_opt */
179470
-#line 1936 "parse.y"
179471178827
{
179472178828
yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, yymsp[-1].minor.yy14, &yymsp[-4].minor.yy0);
179473178829
}
179474
-#line 5625 "parse.sql"
179475178830
yymsp[-4].minor.yy211 = yylhsminor.yy211;
179476178831
break;
179477178832
case 320: /* window ::= nm frame_opt */
179478
-#line 1940 "parse.y"
179479178833
{
179480178834
yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, 0, &yymsp[-1].minor.yy0);
179481178835
}
179482
-#line 5633 "parse.sql"
179483178836
yymsp[-1].minor.yy211 = yylhsminor.yy211;
179484178837
break;
179485178838
case 321: /* frame_opt ::= */
179486
-#line 1944 "parse.y"
179487178839
{
179488178840
yymsp[1].minor.yy211 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
179489178841
}
179490
-#line 5641 "parse.sql"
179491178842
break;
179492178843
case 322: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
179493
-#line 1947 "parse.y"
179494178844
{
179495178845
yylhsminor.yy211 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy144, yymsp[-1].minor.yy509.eType, yymsp[-1].minor.yy509.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy462);
179496178846
}
179497
-#line 5648 "parse.sql"
179498178847
yymsp[-2].minor.yy211 = yylhsminor.yy211;
179499178848
break;
179500178849
case 323: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
179501
-#line 1951 "parse.y"
179502178850
{
179503178851
yylhsminor.yy211 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy144, yymsp[-3].minor.yy509.eType, yymsp[-3].minor.yy509.pExpr, yymsp[-1].minor.yy509.eType, yymsp[-1].minor.yy509.pExpr, yymsp[0].minor.yy462);
179504178852
}
179505
-#line 5656 "parse.sql"
179506178853
yymsp[-5].minor.yy211 = yylhsminor.yy211;
179507178854
break;
179508178855
case 325: /* frame_bound_s ::= frame_bound */
179509178856
case 327: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==327);
179510
-#line 1957 "parse.y"
179511178857
{yylhsminor.yy509 = yymsp[0].minor.yy509;}
179512
-#line 5663 "parse.sql"
179513178858
yymsp[0].minor.yy509 = yylhsminor.yy509;
179514178859
break;
179515178860
case 326: /* frame_bound_s ::= UNBOUNDED PRECEDING */
179516178861
case 328: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==328);
179517178862
case 330: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==330);
179518
-#line 1958 "parse.y"
179519178863
{yylhsminor.yy509.eType = yymsp[-1].major; yylhsminor.yy509.pExpr = 0;}
179520
-#line 5671 "parse.sql"
179521178864
yymsp[-1].minor.yy509 = yylhsminor.yy509;
179522178865
break;
179523178866
case 329: /* frame_bound ::= expr PRECEDING|FOLLOWING */
179524
-#line 1963 "parse.y"
179525178867
{yylhsminor.yy509.eType = yymsp[0].major; yylhsminor.yy509.pExpr = yymsp[-1].minor.yy454;}
179526
-#line 5677 "parse.sql"
179527178868
yymsp[-1].minor.yy509 = yylhsminor.yy509;
179528178869
break;
179529178870
case 331: /* frame_exclude_opt ::= */
179530
-#line 1967 "parse.y"
179531178871
{yymsp[1].minor.yy462 = 0;}
179532
-#line 5683 "parse.sql"
179533178872
break;
179534178873
case 332: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
179535
-#line 1968 "parse.y"
179536178874
{yymsp[-1].minor.yy462 = yymsp[0].minor.yy462;}
179537
-#line 5688 "parse.sql"
179538178875
break;
179539178876
case 333: /* frame_exclude ::= NO OTHERS */
179540178877
case 334: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==334);
179541
-#line 1971 "parse.y"
179542178878
{yymsp[-1].minor.yy462 = yymsp[-1].major; /*A-overwrites-X*/}
179543
-#line 5694 "parse.sql"
179544178879
break;
179545178880
case 335: /* frame_exclude ::= GROUP|TIES */
179546
-#line 1973 "parse.y"
179547178881
{yymsp[0].minor.yy462 = yymsp[0].major; /*A-overwrites-X*/}
179548
-#line 5699 "parse.sql"
179549178882
break;
179550178883
case 336: /* window_clause ::= WINDOW windowdefn_list */
179551
-#line 1978 "parse.y"
179552178884
{ yymsp[-1].minor.yy211 = yymsp[0].minor.yy211; }
179553
-#line 5704 "parse.sql"
179554178885
break;
179555178886
case 337: /* filter_over ::= filter_clause over_clause */
179556
-#line 1980 "parse.y"
179557178887
{
179558178888
if( yymsp[0].minor.yy211 ){
179559178889
yymsp[0].minor.yy211->pFilter = yymsp[-1].minor.yy454;
179560178890
}else{
179561178891
sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy454);
179562178892
}
179563178893
yylhsminor.yy211 = yymsp[0].minor.yy211;
179564178894
}
179565
-#line 5716 "parse.sql"
179566178895
yymsp[-1].minor.yy211 = yylhsminor.yy211;
179567178896
break;
179568178897
case 338: /* filter_over ::= over_clause */
179569
-#line 1988 "parse.y"
179570178898
{
179571178899
yylhsminor.yy211 = yymsp[0].minor.yy211;
179572178900
}
179573
-#line 5724 "parse.sql"
179574178901
yymsp[0].minor.yy211 = yylhsminor.yy211;
179575178902
break;
179576178903
case 339: /* filter_over ::= filter_clause */
179577
-#line 1991 "parse.y"
179578178904
{
179579178905
yylhsminor.yy211 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
179580178906
if( yylhsminor.yy211 ){
179581178907
yylhsminor.yy211->eFrmType = TK_FILTER;
179582178908
yylhsminor.yy211->pFilter = yymsp[0].minor.yy454;
179583178909
}else{
179584178910
sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy454);
179585178911
}
179586178912
}
179587
-#line 5738 "parse.sql"
179588178913
yymsp[0].minor.yy211 = yylhsminor.yy211;
179589178914
break;
179590178915
case 340: /* over_clause ::= OVER LP window RP */
179591
-#line 2001 "parse.y"
179592178916
{
179593178917
yymsp[-3].minor.yy211 = yymsp[-1].minor.yy211;
179594178918
assert( yymsp[-3].minor.yy211!=0 );
179595178919
}
179596
-#line 5747 "parse.sql"
179597178920
break;
179598178921
case 341: /* over_clause ::= OVER nm */
179599
-#line 2005 "parse.y"
179600178922
{
179601178923
yymsp[-1].minor.yy211 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
179602178924
if( yymsp[-1].minor.yy211 ){
179603178925
yymsp[-1].minor.yy211->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
179604178926
}
179605178927
}
179606
-#line 5757 "parse.sql"
179607178928
break;
179608178929
case 342: /* filter_clause ::= FILTER LP WHERE expr RP */
179609
-#line 2012 "parse.y"
179610178930
{ yymsp[-4].minor.yy454 = yymsp[-1].minor.yy454; }
179611
-#line 5762 "parse.sql"
179612178931
break;
179613178932
case 343: /* term ::= QNUMBER */
179614
-#line 2038 "parse.y"
179615178933
{
179616178934
yylhsminor.yy454=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0);
179617178935
sqlite3DequoteNumber(pParse, yylhsminor.yy454);
179618178936
}
179619
-#line 5770 "parse.sql"
179620178937
yymsp[0].minor.yy454 = yylhsminor.yy454;
179621178938
break;
179622178939
default:
179623178940
/* (344) input ::= cmdlist */ yytestcase(yyruleno==344);
179624178941
/* (345) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==345);
@@ -179742,19 +179059,17 @@
179742179059
){
179743179060
sqlite3ParserARG_FETCH
179744179061
sqlite3ParserCTX_FETCH
179745179062
#define TOKEN yyminor
179746179063
/************ Begin %syntax_error code ****************************************/
179747
-#line 43 "parse.y"
179748179064
179749179065
UNUSED_PARAMETER(yymajor); /* Silence some compiler warnings */
179750179066
if( TOKEN.z[0] ){
179751179067
sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
179752179068
}else{
179753179069
sqlite3ErrorMsg(pParse, "incomplete input");
179754179070
}
179755
-#line 5906 "parse.sql"
179756179071
/************ End %syntax_error code ******************************************/
179757179072
sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
179758179073
sqlite3ParserCTX_STORE
179759179074
}
179760179075
@@ -180022,11 +179337,10 @@
180022179337
#endif
180023179338
}
180024179339
180025179340
/************** End of parse.c ***********************************************/
180026179341
/************** Begin file tokenize.c ****************************************/
180027
-#line 1 "tsrc/tokenize.c"
180028179342
/*
180029179343
** 2001 September 15
180030179344
**
180031179345
** The author disclaims copyright to this source code. In place of
180032179346
** a legal notice, here is a blessing:
@@ -180172,11 +179486,10 @@
180172179486
** named keywordhash.h and then included into this source file by
180173179487
** the #include below.
180174179488
*/
180175179489
/************** Include keywordhash.h in the middle of tokenize.c ************/
180176179490
/************** Begin file keywordhash.h *************************************/
180177
-#line 1 "tsrc/keywordhash.h"
180178179491
/***** This file contains automatically generated code ******
180179179492
**
180180179493
** The code in this file has been automatically generated by
180181179494
**
180182179495
** sqlite/tool/mkkeywordhash.c
@@ -180658,11 +179971,10 @@
180658179971
return TK_ID!=sqlite3KeywordCode((const u8*)zName, nName);
180659179972
}
180660179973
180661179974
/************** End of keywordhash.h *****************************************/
180662179975
/************** Continuing where we left off in tokenize.c *******************/
180663
-#line 149 "tsrc/tokenize.c"
180664179976
180665179977
180666179978
/*
180667179979
** If X is a character that can be used in an identifier then
180668179980
** IdChar(X) will be true. Otherwise it is false.
@@ -181402,11 +180714,10 @@
181402180714
}
181403180715
#endif /* SQLITE_ENABLE_NORMALIZE */
181404180716
181405180717
/************** End of tokenize.c ********************************************/
181406180718
/************** Begin file complete.c ****************************************/
181407
-#line 1 "tsrc/complete.c"
181408180719
/*
181409180720
** 2001 September 15
181410180721
**
181411180722
** The author disclaims copyright to this source code. In place of
181412180723
** a legal notice, here is a blessing:
@@ -181696,11 +181007,10 @@
181696181007
#endif /* SQLITE_OMIT_UTF16 */
181697181008
#endif /* SQLITE_OMIT_COMPLETE */
181698181009
181699181010
/************** End of complete.c ********************************************/
181700181011
/************** Begin file main.c ********************************************/
181701
-#line 1 "tsrc/main.c"
181702181012
/*
181703181013
** 2001 September 15
181704181014
**
181705181015
** The author disclaims copyright to this source code. In place of
181706181016
** a legal notice, here is a blessing:
@@ -181718,11 +181028,10 @@
181718181028
/* #include "sqliteInt.h" */
181719181029
181720181030
#ifdef SQLITE_ENABLE_FTS3
181721181031
/************** Include fts3.h in the middle of main.c ***********************/
181722181032
/************** Begin file fts3.h ********************************************/
181723
-#line 1 "tsrc/fts3.h"
181724181033
/*
181725181034
** 2006 Oct 10
181726181035
**
181727181036
** The author disclaims copyright to this source code. In place of
181728181037
** a legal notice, here is a blessing:
@@ -181748,16 +181057,14 @@
181748181057
} /* extern "C" */
181749181058
#endif /* __cplusplus */
181750181059
181751181060
/************** End of fts3.h ************************************************/
181752181061
/************** Continuing where we left off in main.c ***********************/
181753
-#line 21 "tsrc/main.c"
181754181062
#endif
181755181063
#ifdef SQLITE_ENABLE_RTREE
181756181064
/************** Include rtree.h in the middle of main.c **********************/
181757181065
/************** Begin file rtree.h *******************************************/
181758
-#line 1 "tsrc/rtree.h"
181759181066
/*
181760181067
** 2008 May 26
181761181068
**
181762181069
** The author disclaims copyright to this source code. In place of
181763181070
** a legal notice, here is a blessing:
@@ -181787,16 +181094,14 @@
181787181094
} /* extern "C" */
181788181095
#endif /* __cplusplus */
181789181096
181790181097
/************** End of rtree.h ***********************************************/
181791181098
/************** Continuing where we left off in main.c ***********************/
181792
-#line 24 "tsrc/main.c"
181793181099
#endif
181794181100
#if defined(SQLITE_ENABLE_ICU) || defined(SQLITE_ENABLE_ICU_COLLATIONS)
181795181101
/************** Include sqliteicu.h in the middle of main.c ******************/
181796181102
/************** Begin file sqliteicu.h ***************************************/
181797
-#line 1 "tsrc/sqliteicu.h"
181798181103
/*
181799181104
** 2008 May 26
181800181105
**
181801181106
** The author disclaims copyright to this source code. In place of
181802181107
** a legal notice, here is a blessing:
@@ -181822,11 +181127,10 @@
181822181127
} /* extern "C" */
181823181128
#endif /* __cplusplus */
181824181129
181825181130
/************** End of sqliteicu.h *******************************************/
181826181131
/************** Continuing where we left off in main.c ***********************/
181827
-#line 27 "tsrc/main.c"
181828181132
#endif
181829181133
181830181134
/*
181831181135
** This is an extension initializer that is a no-op and always
181832181136
** succeeds, except that it fails if the fault-simulation is set
@@ -184724,12 +184028,12 @@
184724184028
}
184725184029
oldLimit = db->aLimit[limitId];
184726184030
if( newLimit>=0 ){ /* IMP: R-52476-28732 */
184727184031
if( newLimit>aHardLimit[limitId] ){
184728184032
newLimit = aHardLimit[limitId]; /* IMP: R-51463-25634 */
184729
- }else if( newLimit<1 && limitId==SQLITE_LIMIT_LENGTH ){
184730
- newLimit = 1;
184033
+ }else if( newLimit<SQLITE_MIN_LENGTH && limitId==SQLITE_LIMIT_LENGTH ){
184034
+ newLimit = SQLITE_MIN_LENGTH;
184731184035
}
184732184036
db->aLimit[limitId] = newLimit;
184733184037
}
184734184038
return oldLimit; /* IMP: R-53341-35419 */
184735184039
}
@@ -186873,11 +186177,10 @@
186873186177
}
186874186178
#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
186875186179
186876186180
/************** End of main.c ************************************************/
186877186181
/************** Begin file notify.c ******************************************/
186878
-#line 1 "tsrc/notify.c"
186879186182
/*
186880186183
** 2009 March 3
186881186184
**
186882186185
** The author disclaims copyright to this source code. In place of
186883186186
** a legal notice, here is a blessing:
@@ -187212,11 +186515,10 @@
187212186515
}
187213186516
#endif
187214186517
187215186518
/************** End of notify.c **********************************************/
187216186519
/************** Begin file fts3.c ********************************************/
187217
-#line 1 "tsrc/fts3.c"
187218186520
/*
187219186521
** 2006 Oct 10
187220186522
**
187221186523
** The author disclaims copyright to this source code. In place of
187222186524
** a legal notice, here is a blessing:
@@ -187505,11 +186807,10 @@
187505186807
** older data.
187506186808
*/
187507186809
187508186810
/************** Include fts3Int.h in the middle of fts3.c ********************/
187509186811
/************** Begin file fts3Int.h *****************************************/
187510
-#line 1 "tsrc/fts3Int.h"
187511186812
/*
187512186813
** 2009 Nov 12
187513186814
**
187514186815
** The author disclaims copyright to this source code. In place of
187515186816
** a legal notice, here is a blessing:
@@ -187552,11 +186853,10 @@
187552186853
#endif
187553186854
187554186855
/* #include "sqlite3.h" */
187555186856
/************** Include fts3_tokenizer.h in the middle of fts3Int.h **********/
187556186857
/************** Begin file fts3_tokenizer.h **********************************/
187557
-#line 1 "tsrc/fts3_tokenizer.h"
187558186858
/*
187559186859
** 2006 July 10
187560186860
**
187561186861
** The author disclaims copyright to this source code.
187562186862
**
@@ -187717,14 +187017,12 @@
187717187017
187718187018
#endif /* _FTS3_TOKENIZER_H_ */
187719187019
187720187020
/************** End of fts3_tokenizer.h **************************************/
187721187021
/************** Continuing where we left off in fts3Int.h ********************/
187722
-#line 46 "tsrc/fts3Int.h"
187723187022
/************** Include fts3_hash.h in the middle of fts3Int.h ***************/
187724187023
/************** Begin file fts3_hash.h ***************************************/
187725
-#line 1 "tsrc/fts3_hash.h"
187726187024
/*
187727187025
** 2001 September 22
187728187026
**
187729187027
** The author disclaims copyright to this source code. In place of
187730187028
** a legal notice, here is a blessing:
@@ -187836,11 +187134,10 @@
187836187134
187837187135
#endif /* _FTS3_HASH_H_ */
187838187136
187839187137
/************** End of fts3_hash.h *******************************************/
187840187138
/************** Continuing where we left off in fts3Int.h ********************/
187841
-#line 47 "tsrc/fts3Int.h"
187842187139
187843187140
/*
187844187141
** This constant determines the maximum depth of an FTS expression tree
187845187142
** that the library will create and use. FTS uses recursion to perform
187846187143
** various operations on the query tree, so the disadvantage of a large
@@ -188453,11 +187750,10 @@
188453187750
#endif /* !SQLITE_CORE || SQLITE_ENABLE_FTS3 */
188454187751
#endif /* _FTSINT_H */
188455187752
188456187753
/************** End of fts3Int.h *********************************************/
188457187754
/************** Continuing where we left off in fts3.c ***********************/
188458
-#line 292 "tsrc/fts3.c"
188459187755
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
188460187756
188461187757
#if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_CORE)
188462187758
# define SQLITE_CORE 1
188463187759
#endif
@@ -190509,14 +189805,19 @@
190509189805
190510189806
assert_fts3_nc( p!=0 && *p1!=0 && *p2!=0 );
190511189807
if( *p1==POS_COLUMN ){
190512189808
p1++;
190513189809
p1 += fts3GetVarint32(p1, &iCol1);
189810
+ /* iCol1==0 indicates corruption. Column 0 does not have a POS_COLUMN
189811
+ ** entry, so this is actually end-of-doclist. */
189812
+ if( iCol1==0 ) return 0;
190514189813
}
190515189814
if( *p2==POS_COLUMN ){
190516189815
p2++;
190517189816
p2 += fts3GetVarint32(p2, &iCol2);
189817
+ /* As above, iCol2==0 indicates corruption. */
189818
+ if( iCol2==0 ) return 0;
190518189819
}
190519189820
190520189821
while( 1 ){
190521189822
if( iCol1==iCol2 ){
190522189823
char *pSave = p;
@@ -193683,11 +192984,11 @@
193683192984
for(p=pExpr; p->pLeft; p=p->pLeft){
193684192985
assert( p->pRight->pPhrase->doclist.nList>0 );
193685192986
nTmp += p->pRight->pPhrase->doclist.nList;
193686192987
}
193687192988
nTmp += p->pPhrase->doclist.nList;
193688
- aTmp = sqlite3_malloc64(nTmp*2);
192989
+ aTmp = sqlite3_malloc64(nTmp*2 + FTS3_VARINT_MAX);
193689192990
if( !aTmp ){
193690192991
*pRc = SQLITE_NOMEM;
193691192992
res = 0;
193692192993
}else{
193693192994
char *aPoslist = p->pPhrase->doclist.pList;
@@ -194355,11 +193656,10 @@
194355193656
194356193657
#endif
194357193658
194358193659
/************** End of fts3.c ************************************************/
194359193660
/************** Begin file fts3_aux.c ****************************************/
194360
-#line 1 "tsrc/fts3_aux.c"
194361193661
/*
194362193662
** 2011 Jan 27
194363193663
**
194364193664
** The author disclaims copyright to this source code. In place of
194365193665
** a legal notice, here is a blessing:
@@ -194916,11 +194216,10 @@
194916194216
194917194217
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
194918194218
194919194219
/************** End of fts3_aux.c ********************************************/
194920194220
/************** Begin file fts3_expr.c ***************************************/
194921
-#line 1 "tsrc/fts3_expr.c"
194922194221
/*
194923194222
** 2008 Nov 28
194924194223
**
194925194224
** The author disclaims copyright to this source code. In place of
194926194225
** a legal notice, here is a blessing:
@@ -196213,11 +195512,10 @@
196213195512
#endif
196214195513
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
196215195514
196216195515
/************** End of fts3_expr.c *******************************************/
196217195516
/************** Begin file fts3_hash.c ***************************************/
196218
-#line 1 "tsrc/fts3_hash.c"
196219195517
/*
196220195518
** 2001 September 22
196221195519
**
196222195520
** The author disclaims copyright to this source code. In place of
196223195521
** a legal notice, here is a blessing:
@@ -196600,11 +195898,10 @@
196600195898
196601195899
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
196602195900
196603195901
/************** End of fts3_hash.c *******************************************/
196604195902
/************** Begin file fts3_porter.c *************************************/
196605
-#line 1 "tsrc/fts3_porter.c"
196606195903
/*
196607195904
** 2006 September 30
196608195905
**
196609195906
** The author disclaims copyright to this source code. In place of
196610195907
** a legal notice, here is a blessing:
@@ -197266,11 +196563,10 @@
197266196563
197267196564
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
197268196565
197269196566
/************** End of fts3_porter.c *****************************************/
197270196567
/************** Begin file fts3_tokenizer.c **********************************/
197271
-#line 1 "tsrc/fts3_tokenizer.c"
197272196568
/*
197273196569
** 2007 June 22
197274196570
**
197275196571
** The author disclaims copyright to this source code. In place of
197276196572
** a legal notice, here is a blessing:
@@ -197786,11 +197082,10 @@
197786197082
197787197083
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
197788197084
197789197085
/************** End of fts3_tokenizer.c **************************************/
197790197086
/************** Begin file fts3_tokenizer1.c *********************************/
197791
-#line 1 "tsrc/fts3_tokenizer1.c"
197792197087
/*
197793197088
** 2006 Oct 10
197794197089
**
197795197090
** The author disclaims copyright to this source code. In place of
197796197091
** a legal notice, here is a blessing:
@@ -198024,11 +197319,10 @@
198024197319
198025197320
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
198026197321
198027197322
/************** End of fts3_tokenizer1.c *************************************/
198028197323
/************** Begin file fts3_tokenize_vtab.c ******************************/
198029
-#line 1 "tsrc/fts3_tokenize_vtab.c"
198030197324
/*
198031197325
** 2013 Apr 22
198032197326
**
198033197327
** The author disclaims copyright to this source code. In place of
198034197328
** a legal notice, here is a blessing:
@@ -198487,11 +197781,10 @@
198487197781
198488197782
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
198489197783
198490197784
/************** End of fts3_tokenize_vtab.c **********************************/
198491197785
/************** Begin file fts3_write.c **************************************/
198492
-#line 1 "tsrc/fts3_write.c"
198493197786
/*
198494197787
** 2009 Oct 23
198495197788
**
198496197789
** The author disclaims copyright to this source code. In place of
198497197790
** a legal notice, here is a blessing:
@@ -204325,11 +203618,10 @@
204325203618
204326203619
#endif
204327203620
204328203621
/************** End of fts3_write.c ******************************************/
204329203622
/************** Begin file fts3_snippet.c ************************************/
204330
-#line 1 "tsrc/fts3_snippet.c"
204331203623
/*
204332203624
** 2009 Oct 23
204333203625
**
204334203626
** The author disclaims copyright to this source code. In place of
204335203627
** a legal notice, here is a blessing:
@@ -206085,11 +205377,10 @@
206085205377
206086205378
#endif
206087205379
206088205380
/************** End of fts3_snippet.c ****************************************/
206089205381
/************** Begin file fts3_unicode.c ************************************/
206090
-#line 1 "tsrc/fts3_unicode.c"
206091205382
/*
206092205383
** 2012 May 24
206093205384
**
206094205385
** The author disclaims copyright to this source code. In place of
206095205386
** a legal notice, here is a blessing:
@@ -206486,11 +205777,10 @@
206486205777
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
206487205778
#endif /* ifndef SQLITE_DISABLE_FTS3_UNICODE */
206488205779
206489205780
/************** End of fts3_unicode.c ****************************************/
206490205781
/************** Begin file fts3_unicode2.c ***********************************/
206491
-#line 1 "tsrc/fts3_unicode2.c"
206492205782
/*
206493205783
** 2012-05-25
206494205784
**
206495205785
** The author disclaims copyright to this source code. In place of
206496205786
** a legal notice, here is a blessing:
@@ -206873,11 +206163,10 @@
206873206163
#endif /* defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4) */
206874206164
#endif /* !defined(SQLITE_DISABLE_FTS3_UNICODE) */
206875206165
206876206166
/************** End of fts3_unicode2.c ***************************************/
206877206167
/************** Begin file json.c ********************************************/
206878
-#line 1 "tsrc/json.c"
206879206168
/*
206880206169
** 2015-08-12
206881206170
**
206882206171
** The author disclaims copyright to this source code. In place of
206883206172
** a legal notice, here is a blessing:
@@ -212343,11 +211632,10 @@
212343211632
}
212344211633
#endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON) */
212345211634
212346211635
/************** End of json.c ************************************************/
212347211636
/************** Begin file rtree.c *******************************************/
212348
-#line 1 "tsrc/rtree.c"
212349211637
/*
212350211638
** 2001 September 15
212351211639
**
212352211640
** The author disclaims copyright to this source code. In place of
212353211641
** a legal notice, here is a blessing:
@@ -216632,11 +215920,10 @@
216632215920
216633215921
/* Conditionally include the geopoly code */
216634215922
#ifdef SQLITE_ENABLE_GEOPOLY
216635215923
/************** Include geopoly.c in the middle of rtree.c *******************/
216636215924
/************** Begin file geopoly.c *****************************************/
216637
-#line 1 "tsrc/geopoly.c"
216638215925
/*
216639215926
** 2018-05-25
216640215927
**
216641215928
** The author disclaims copyright to this source code. In place of
216642215929
** a legal notice, here is a blessing:
@@ -218475,11 +217762,10 @@
218475217762
return rc;
218476217763
}
218477217764
218478217765
/************** End of geopoly.c *********************************************/
218479217766
/************** Continuing where we left off in rtree.c **********************/
218480
-#line 4288 "tsrc/rtree.c"
218481217767
#endif
218482217768
218483217769
/*
218484217770
** Register the r-tree module with database handle db. This creates the
218485217771
** virtual table module "rtree" and the debugging/analysis scalar
@@ -218658,11 +217944,10 @@
218658217944
218659217945
#endif
218660217946
218661217947
/************** End of rtree.c ***********************************************/
218662217948
/************** Begin file icu.c *********************************************/
218663
-#line 1 "tsrc/icu.c"
218664217949
/*
218665217950
** 2007 May 6
218666217951
**
218667217952
** The author disclaims copyright to this source code. In place of
218668217953
** a legal notice, here is a blessing:
@@ -219250,11 +218535,10 @@
219250218535
219251218536
#endif
219252218537
219253218538
/************** End of icu.c *************************************************/
219254218539
/************** Begin file fts3_icu.c ****************************************/
219255
-#line 1 "tsrc/fts3_icu.c"
219256218540
/*
219257218541
** 2007 June 22
219258218542
**
219259218543
** The author disclaims copyright to this source code. In place of
219260218544
** a legal notice, here is a blessing:
@@ -219516,11 +218800,10 @@
219516218800
#endif /* defined(SQLITE_ENABLE_ICU) */
219517218801
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
219518218802
219519218803
/************** End of fts3_icu.c ********************************************/
219520218804
/************** Begin file sqlite3rbu.c **************************************/
219521
-#line 1 "tsrc/sqlite3rbu.c"
219522218805
/*
219523218806
** 2014 August 30
219524218807
**
219525218808
** The author disclaims copyright to this source code. In place of
219526218809
** a legal notice, here is a blessing:
@@ -219608,11 +218891,10 @@
219608218891
/* #include "sqlite3.h" */
219609218892
219610218893
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU)
219611218894
/************** Include sqlite3rbu.h in the middle of sqlite3rbu.c ***********/
219612218895
/************** Begin file sqlite3rbu.h **************************************/
219613
-#line 1 "tsrc/sqlite3rbu.h"
219614218896
/*
219615218897
** 2014 August 30
219616218898
**
219617218899
** The author disclaims copyright to this source code. In place of
219618218900
** a legal notice, here is a blessing:
@@ -220245,11 +219527,10 @@
220245219527
220246219528
#endif /* _SQLITE3RBU_H */
220247219529
220248219530
/************** End of sqlite3rbu.h ******************************************/
220249219531
/************** Continuing where we left off in sqlite3rbu.c *****************/
220250
-#line 91 "tsrc/sqlite3rbu.c"
220251219532
220252219533
#if defined(_WIN32_WCE)
220253219534
/* #include "windows.h" */
220254219535
#endif
220255219536
@@ -225606,11 +224887,10 @@
225606224887
225607224888
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU) */
225608224889
225609224890
/************** End of sqlite3rbu.c ******************************************/
225610224891
/************** Begin file dbstat.c ******************************************/
225611
-#line 1 "tsrc/dbstat.c"
225612224892
/*
225613224893
** 2010 July 12
225614224894
**
225615224895
** The author disclaims copyright to this source code. In place of
225616224896
** a legal notice, here is a blessing:
@@ -226516,11 +225796,10 @@
226516225796
SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3 *db){ return SQLITE_OK; }
226517225797
#endif /* SQLITE_ENABLE_DBSTAT_VTAB */
226518225798
226519225799
/************** End of dbstat.c **********************************************/
226520225800
/************** Begin file dbpage.c ******************************************/
226521
-#line 1 "tsrc/dbpage.c"
226522225801
/*
226523225802
** 2017-10-11
226524225803
**
226525225804
** The author disclaims copyright to this source code. In place of
226526225805
** a legal notice, here is a blessing:
@@ -226999,11 +226278,10 @@
226999226278
SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3 *db){ return SQLITE_OK; }
227000226279
#endif /* SQLITE_ENABLE_DBSTAT_VTAB */
227001226280
227002226281
/************** End of dbpage.c **********************************************/
227003226282
/************** Begin file sqlite3session.c **********************************/
227004
-#line 1 "tsrc/sqlite3session.c"
227005226283
227006226284
#if defined(SQLITE_ENABLE_SESSION) && defined(SQLITE_ENABLE_PREUPDATE_HOOK)
227007226285
/* #include "sqlite3session.h" */
227008226286
/* #include <assert.h> */
227009226287
/* #include <string.h> */
@@ -233539,11 +232817,10 @@
233539232817
233540232818
#endif /* SQLITE_ENABLE_SESSION && SQLITE_ENABLE_PREUPDATE_HOOK */
233541232819
233542232820
/************** End of sqlite3session.c **************************************/
233543232821
/************** Begin file fts5.c ********************************************/
233544
-#line 1 "tsrc/fts5.c"
233545232822
233546232823
/*
233547232824
** This, the "fts5.c" source file, is a composite file that is itself
233548232825
** assembled from the following files:
233549232826
**
@@ -233577,11 +232854,10 @@
233577232854
/* #include <stdint.h> */
233578232855
#endif
233579232856
#ifdef HAVE_INTTYPES_H
233580232857
/* #include <inttypes.h> */
233581232858
#endif
233582
-#line 1 "fts5.h"
233583232859
/*
233584232860
** 2014 May 31
233585232861
**
233586232862
** The author disclaims copyright to this source code. In place of
233587232863
** a legal notice, here is a blessing:
@@ -234318,11 +233594,10 @@
234318233594
} /* end of the 'extern "C"' block */
234319233595
#endif
234320233596
234321233597
#endif /* _FTS5_H */
234322233598
234323
-#line 1 "fts5Int.h"
234324233599
/*
234325233600
** 2014 May 31
234326233601
**
234327233602
** The author disclaims copyright to this source code. In place of
234328233603
** a legal notice, here is a blessing:
@@ -235258,11 +234533,10 @@
235258234533
** End of interface to code in fts5_unicode2.c.
235259234534
**************************************************************************/
235260234535
235261234536
#endif
235262234537
235263
-#line 1 "fts5parse.h"
235264234538
#define FTS5_OR 1
235265234539
#define FTS5_AND 2
235266234540
#define FTS5_NOT 3
235267234541
#define FTS5_TERM 4
235268234542
#define FTS5_COLON 5
@@ -235275,11 +234549,10 @@
235275234549
#define FTS5_CARET 12
235276234550
#define FTS5_COMMA 13
235277234551
#define FTS5_PLUS 14
235278234552
#define FTS5_STAR 15
235279234553
235280
-#line 1 "fts5parse.c"
235281234554
/* This file is automatically generated by Lemon from input grammar
235282234555
** source file "fts5parse.y".
235283234556
*/
235284234557
/*
235285234558
** 2000-05-29
@@ -235304,11 +234577,10 @@
235304234577
**
235305234578
** The following is the concatenation of all %include directives from the
235306234579
** input grammar file:
235307234580
*/
235308234581
/************ Begin %include sections from the grammar ************************/
235309
-#line 47 "fts5parse.y"
235310234582
235311234583
/* #include "fts5Int.h" */
235312234584
/* #include "fts5parse.h" */
235313234585
235314234586
/*
@@ -235332,11 +234604,10 @@
235332234604
** Alternative datatype for the argument to the malloc() routine passed
235333234605
** into sqlite3ParserAlloc(). The default is size_t.
235334234606
*/
235335234607
#define fts5YYMALLOCARGTYPE u64
235336234608
235337
-#line 58 "fts5parse.sql"
235338234609
/**************** End of %include directives **********************************/
235339234610
/* These constants specify the various numeric values for terminal symbols.
235340234611
***************** Begin token definitions *************************************/
235341234612
#ifndef FTS5_OR
235342234613
#define FTS5_OR 1
@@ -235879,45 +235150,35 @@
235879235150
** inside the C code.
235880235151
*/
235881235152
/********* Begin destructor definitions ***************************************/
235882235153
case 16: /* input */
235883235154
{
235884
-#line 83 "fts5parse.y"
235885235155
(void)pParse;
235886
-#line 606 "fts5parse.sql"
235887235156
}
235888235157
break;
235889235158
case 17: /* expr */
235890235159
case 18: /* cnearset */
235891235160
case 19: /* exprlist */
235892235161
{
235893
-#line 89 "fts5parse.y"
235894235162
sqlite3Fts5ParseNodeFree((fts5yypminor->fts5yy24));
235895
-#line 615 "fts5parse.sql"
235896235163
}
235897235164
break;
235898235165
case 20: /* colset */
235899235166
case 21: /* colsetlist */
235900235167
{
235901
-#line 93 "fts5parse.y"
235902235168
sqlite3_free((fts5yypminor->fts5yy11));
235903
-#line 623 "fts5parse.sql"
235904235169
}
235905235170
break;
235906235171
case 22: /* nearset */
235907235172
case 23: /* nearphrases */
235908235173
{
235909
-#line 148 "fts5parse.y"
235910235174
sqlite3Fts5ParseNearsetFree((fts5yypminor->fts5yy46));
235911
-#line 631 "fts5parse.sql"
235912235175
}
235913235176
break;
235914235177
case 24: /* phrase */
235915235178
{
235916
-#line 183 "fts5parse.y"
235917235179
sqlite3Fts5ParsePhraseFree((fts5yypminor->fts5yy53));
235918
-#line 638 "fts5parse.sql"
235919235180
}
235920235181
break;
235921235182
/********* End destructor definitions *****************************************/
235922235183
default: break; /* If no destructor action specified: do nothing */
235923235184
}
@@ -236148,14 +235409,12 @@
236148235409
#endif
236149235410
while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser);
236150235411
/* Here code is inserted which will execute if the parser
236151235412
** stack every overflows */
236152235413
/******** Begin %stack_overflow code ******************************************/
236153
-#line 36 "fts5parse.y"
236154235414
236155235415
sqlite3Fts5ParseError(pParse, "fts5: parser stack overflow");
236156
-#line 876 "fts5parse.sql"
236157235416
/******** End %stack_overflow code ********************************************/
236158235417
sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument var */
236159235418
sqlite3Fts5ParserCTX_STORE
236160235419
}
236161235420
@@ -236320,202 +235579,148 @@
236320235579
** break;
236321235580
*/
236322235581
/********** Begin reduce actions **********************************************/
236323235582
fts5YYMINORTYPE fts5yylhsminor;
236324235583
case 0: /* input ::= expr */
236325
-#line 82 "fts5parse.y"
236326235584
{ sqlite3Fts5ParseFinished(pParse, fts5yymsp[0].minor.fts5yy24); }
236327
-#line 1047 "fts5parse.sql"
236328235585
break;
236329235586
case 1: /* colset ::= MINUS LCP colsetlist RCP */
236330
-#line 97 "fts5parse.y"
236331235587
{
236332235588
fts5yymsp[-3].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11);
236333235589
}
236334
-#line 1054 "fts5parse.sql"
236335235590
break;
236336235591
case 2: /* colset ::= LCP colsetlist RCP */
236337
-#line 100 "fts5parse.y"
236338235592
{ fts5yymsp[-2].minor.fts5yy11 = fts5yymsp[-1].minor.fts5yy11; }
236339
-#line 1059 "fts5parse.sql"
236340235593
break;
236341235594
case 3: /* colset ::= STRING */
236342
-#line 101 "fts5parse.y"
236343235595
{
236344235596
fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
236345235597
}
236346
-#line 1066 "fts5parse.sql"
236347235598
fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
236348235599
break;
236349235600
case 4: /* colset ::= MINUS STRING */
236350
-#line 104 "fts5parse.y"
236351235601
{
236352235602
fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
236353235603
fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11);
236354235604
}
236355
-#line 1075 "fts5parse.sql"
236356235605
break;
236357235606
case 5: /* colsetlist ::= colsetlist STRING */
236358
-#line 109 "fts5parse.y"
236359235607
{
236360235608
fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, fts5yymsp[-1].minor.fts5yy11, &fts5yymsp[0].minor.fts5yy0); }
236361
-#line 1081 "fts5parse.sql"
236362235609
fts5yymsp[-1].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
236363235610
break;
236364235611
case 6: /* colsetlist ::= STRING */
236365
-#line 111 "fts5parse.y"
236366235612
{
236367235613
fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
236368235614
}
236369
-#line 1089 "fts5parse.sql"
236370235615
fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
236371235616
break;
236372235617
case 7: /* expr ::= expr AND expr */
236373
-#line 115 "fts5parse.y"
236374235618
{
236375235619
fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_AND, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
236376235620
}
236377
-#line 1097 "fts5parse.sql"
236378235621
fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
236379235622
break;
236380235623
case 8: /* expr ::= expr OR expr */
236381
-#line 118 "fts5parse.y"
236382235624
{
236383235625
fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_OR, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
236384235626
}
236385
-#line 1105 "fts5parse.sql"
236386235627
fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
236387235628
break;
236388235629
case 9: /* expr ::= expr NOT expr */
236389
-#line 121 "fts5parse.y"
236390235630
{
236391235631
fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_NOT, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
236392235632
}
236393
-#line 1113 "fts5parse.sql"
236394235633
fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
236395235634
break;
236396235635
case 10: /* expr ::= colset COLON LP expr RP */
236397
-#line 125 "fts5parse.y"
236398235636
{
236399235637
sqlite3Fts5ParseSetColset(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[-4].minor.fts5yy11);
236400235638
fts5yylhsminor.fts5yy24 = fts5yymsp[-1].minor.fts5yy24;
236401235639
}
236402
-#line 1122 "fts5parse.sql"
236403235640
fts5yymsp[-4].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
236404235641
break;
236405235642
case 11: /* expr ::= LP expr RP */
236406
-#line 129 "fts5parse.y"
236407235643
{fts5yymsp[-2].minor.fts5yy24 = fts5yymsp[-1].minor.fts5yy24;}
236408
-#line 1128 "fts5parse.sql"
236409235644
break;
236410235645
case 12: /* expr ::= exprlist */
236411235646
case 13: /* exprlist ::= cnearset */ fts5yytestcase(fts5yyruleno==13);
236412
-#line 130 "fts5parse.y"
236413235647
{fts5yylhsminor.fts5yy24 = fts5yymsp[0].minor.fts5yy24;}
236414
-#line 1134 "fts5parse.sql"
236415235648
fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
236416235649
break;
236417235650
case 14: /* exprlist ::= exprlist cnearset */
236418
-#line 133 "fts5parse.y"
236419235651
{
236420235652
fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseImplicitAnd(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24);
236421235653
}
236422
-#line 1142 "fts5parse.sql"
236423235654
fts5yymsp[-1].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
236424235655
break;
236425235656
case 15: /* cnearset ::= nearset */
236426
-#line 137 "fts5parse.y"
236427235657
{
236428235658
fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46);
236429235659
}
236430
-#line 1150 "fts5parse.sql"
236431235660
fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
236432235661
break;
236433235662
case 16: /* cnearset ::= colset COLON nearset */
236434
-#line 140 "fts5parse.y"
236435235663
{
236436235664
fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46);
236437235665
sqlite3Fts5ParseSetColset(pParse, fts5yylhsminor.fts5yy24, fts5yymsp[-2].minor.fts5yy11);
236438235666
}
236439
-#line 1159 "fts5parse.sql"
236440235667
fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
236441235668
break;
236442235669
case 17: /* nearset ::= phrase */
236443
-#line 151 "fts5parse.y"
236444235670
{ fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); }
236445
-#line 1165 "fts5parse.sql"
236446235671
fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
236447235672
break;
236448235673
case 18: /* nearset ::= CARET phrase */
236449
-#line 152 "fts5parse.y"
236450235674
{
236451235675
sqlite3Fts5ParseSetCaret(fts5yymsp[0].minor.fts5yy53);
236452235676
fts5yymsp[-1].minor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53);
236453235677
}
236454
-#line 1174 "fts5parse.sql"
236455235678
break;
236456235679
case 19: /* nearset ::= STRING LP nearphrases neardist_opt RP */
236457
-#line 156 "fts5parse.y"
236458235680
{
236459235681
sqlite3Fts5ParseNear(pParse, &fts5yymsp[-4].minor.fts5yy0);
236460235682
sqlite3Fts5ParseSetDistance(pParse, fts5yymsp[-2].minor.fts5yy46, &fts5yymsp[-1].minor.fts5yy0);
236461235683
fts5yylhsminor.fts5yy46 = fts5yymsp[-2].minor.fts5yy46;
236462235684
}
236463
-#line 1183 "fts5parse.sql"
236464235685
fts5yymsp[-4].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
236465235686
break;
236466235687
case 20: /* nearphrases ::= phrase */
236467
-#line 162 "fts5parse.y"
236468235688
{
236469235689
fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53);
236470235690
}
236471
-#line 1191 "fts5parse.sql"
236472235691
fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
236473235692
break;
236474235693
case 21: /* nearphrases ::= nearphrases phrase */
236475
-#line 165 "fts5parse.y"
236476235694
{
236477235695
fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, fts5yymsp[-1].minor.fts5yy46, fts5yymsp[0].minor.fts5yy53);
236478235696
}
236479
-#line 1199 "fts5parse.sql"
236480235697
fts5yymsp[-1].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
236481235698
break;
236482235699
case 22: /* neardist_opt ::= */
236483
-#line 172 "fts5parse.y"
236484235700
{ fts5yymsp[1].minor.fts5yy0.p = 0; fts5yymsp[1].minor.fts5yy0.n = 0; }
236485
-#line 1205 "fts5parse.sql"
236486235701
break;
236487235702
case 23: /* neardist_opt ::= COMMA STRING */
236488
-#line 173 "fts5parse.y"
236489235703
{ fts5yymsp[-1].minor.fts5yy0 = fts5yymsp[0].minor.fts5yy0; }
236490
-#line 1210 "fts5parse.sql"
236491235704
break;
236492235705
case 24: /* phrase ::= phrase PLUS STRING star_opt */
236493
-#line 185 "fts5parse.y"
236494235706
{
236495235707
fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, fts5yymsp[-3].minor.fts5yy53, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);
236496235708
}
236497
-#line 1217 "fts5parse.sql"
236498235709
fts5yymsp[-3].minor.fts5yy53 = fts5yylhsminor.fts5yy53;
236499235710
break;
236500235711
case 25: /* phrase ::= STRING star_opt */
236501
-#line 188 "fts5parse.y"
236502235712
{
236503235713
fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, 0, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);
236504235714
}
236505
-#line 1225 "fts5parse.sql"
236506235715
fts5yymsp[-1].minor.fts5yy53 = fts5yylhsminor.fts5yy53;
236507235716
break;
236508235717
case 26: /* star_opt ::= STAR */
236509
-#line 196 "fts5parse.y"
236510235718
{ fts5yymsp[0].minor.fts5yy4 = 1; }
236511
-#line 1231 "fts5parse.sql"
236512235719
break;
236513235720
case 27: /* star_opt ::= */
236514
-#line 197 "fts5parse.y"
236515235721
{ fts5yymsp[1].minor.fts5yy4 = 0; }
236516
-#line 1236 "fts5parse.sql"
236517235722
break;
236518235723
default:
236519235724
break;
236520235725
/********** End reduce actions ************************************************/
236521235726
};
@@ -236573,17 +235778,15 @@
236573235778
){
236574235779
sqlite3Fts5ParserARG_FETCH
236575235780
sqlite3Fts5ParserCTX_FETCH
236576235781
#define FTS5TOKEN fts5yyminor
236577235782
/************ Begin %syntax_error code ****************************************/
236578
-#line 30 "fts5parse.y"
236579235783
236580235784
UNUSED_PARAM(fts5yymajor); /* Silence a compiler warning */
236581235785
sqlite3Fts5ParseError(
236582235786
pParse, "fts5: syntax error near \"%.*s\"",FTS5TOKEN.n,FTS5TOKEN.p
236583235787
);
236584
-#line 1304 "fts5parse.sql"
236585235788
/************ End %syntax_error code ******************************************/
236586235789
sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
236587235790
sqlite3Fts5ParserCTX_STORE
236588235791
}
236589235792
@@ -236849,11 +236052,10 @@
236849236052
(void)iToken;
236850236053
return 0;
236851236054
#endif
236852236055
}
236853236056
236854
-#line 1 "fts5_aux.c"
236855236057
/*
236856236058
** 2014 May 31
236857236059
**
236858236060
** The author disclaims copyright to this source code. In place of
236859236061
** a legal notice, here is a blessing:
@@ -237672,11 +236874,10 @@
237672236874
}
237673236875
237674236876
return rc;
237675236877
}
237676236878
237677
-#line 1 "fts5_buffer.c"
237678236879
/*
237679236880
** 2014 May 31
237680236881
**
237681236882
** The author disclaims copyright to this source code. In place of
237682236883
** a legal notice, here is a blessing:
@@ -238085,11 +237286,10 @@
238085237286
}
238086237287
sqlite3_free(p);
238087237288
}
238088237289
}
238089237290
238090
-#line 1 "fts5_config.c"
238091237291
/*
238092237292
** 2014 Jun 09
238093237293
**
238094237294
** The author disclaims copyright to this source code. In place of
238095237295
** a legal notice, here is a blessing:
@@ -239201,11 +238401,10 @@
239201238401
va_end(ap);
239202238402
}
239203238403
239204238404
239205238405
239206
-#line 1 "fts5_expr.c"
239207238406
/*
239208238407
** 2014 May 31
239209238408
**
239210238409
** The author disclaims copyright to this source code. In place of
239211238410
** a legal notice, here is a blessing:
@@ -242470,11 +241669,10 @@
242470241669
sqlite3Fts5IndexIterClearTokendata(pT->pIter);
242471241670
}
242472241671
}
242473241672
}
242474241673
242475
-#line 1 "fts5_hash.c"
242476241674
/*
242477241675
** 2014 August 11
242478241676
**
242479241677
** The author disclaims copyright to this source code. In place of
242480241678
** a legal notice, here is a blessing:
@@ -243062,11 +242260,10 @@
243062242260
*ppDoclist = 0;
243063242261
*pnDoclist = 0;
243064242262
}
243065242263
}
243066242264
243067
-#line 1 "fts5_index.c"
243068242265
/*
243069242266
** 2014 May 31
243070242267
**
243071242268
** The author disclaims copyright to this source code. In place of
243072242269
** a legal notice, here is a blessing:
@@ -252140,11 +251337,10 @@
252140251337
fts5StructureInvalidate(p);
252141251338
}
252142251339
return fts5IndexReturn(p);
252143251340
}
252144251341
252145
-#line 1 "fts5_main.c"
252146251342
/*
252147251343
** 2014 Jun 09
252148251344
**
252149251345
** The author disclaims copyright to this source code. In place of
252150251346
** a legal notice, here is a blessing:
@@ -252775,10 +251971,11 @@
252775251971
){
252776251972
/* A MATCH operator or equivalent */
252777251973
if( p->usable==0 || iCol<0 ){
252778251974
/* As there exists an unusable MATCH constraint this is an
252779251975
** unusable plan. Return SQLITE_CONSTRAINT. */
251976
+ idxStr[iIdxStr] = 0;
252780251977
return SQLITE_CONSTRAINT;
252781251978
}else{
252782251979
if( iCol==nCol+1 ){
252783251980
if( bSeenRank ) continue;
252784251981
idxStr[iIdxStr++] = 'r';
@@ -255730,11 +254927,11 @@
255730254927
int nArg, /* Number of args */
255731254928
sqlite3_value **apUnused /* Function arguments */
255732254929
){
255733254930
assert( nArg==0 );
255734254931
UNUSED_PARAM2(nArg, apUnused);
255735
- sqlite3_result_text(pCtx, "fts5: 2024-11-06 12:58:31 5495b12569c318d5020b4b5a625a392ef8e777b81c0200624fbbc2a6b5eddef9", -1, SQLITE_TRANSIENT);
254932
+ sqlite3_result_text(pCtx, "fts5: 2024-11-14 19:34:28 81202d2ab5963fdcf20555b6d0b31cc955ac27f1cd87656faea5c0611c9a2ee8", -1, SQLITE_TRANSIENT);
255736254933
}
255737254934
255738254935
/*
255739254936
** Implementation of fts5_locale(LOCALE, TEXT) function.
255740254937
**
@@ -255983,11 +255180,10 @@
255983255180
SQLITE_PRIVATE int sqlite3Fts5Init(sqlite3 *db){
255984255181
return fts5Init(db);
255985255182
}
255986255183
#endif
255987255184
255988
-#line 1 "fts5_storage.c"
255989255185
/*
255990255186
** 2014 May 31
255991255187
**
255992255188
** The author disclaims copyright to this source code. In place of
255993255189
** a legal notice, here is a blessing:
@@ -257497,11 +256693,10 @@
257497256693
}
257498256694
}
257499256695
return rc;
257500256696
}
257501256697
257502
-#line 1 "fts5_tokenize.c"
257503256698
/*
257504256699
** 2014 May 31
257505256700
**
257506256701
** The author disclaims copyright to this source code. In place of
257507256702
** a legal notice, here is a blessing:
@@ -258854,21 +258049,21 @@
258854258049
char aBuf[32];
258855258050
char *zOut = aBuf;
258856258051
int ii;
258857258052
const unsigned char *zIn = (const unsigned char*)pText;
258858258053
const unsigned char *zEof = &zIn[nText];
258859
- u32 iCode;
258054
+ u32 iCode = 0;
258860258055
int aStart[3]; /* Input offset of each character in aBuf[] */
258861258056
258862258057
UNUSED_PARAM(unusedFlags);
258863258058
258864258059
/* Populate aBuf[] with the characters for the first trigram. */
258865258060
for(ii=0; ii<3; ii++){
258866258061
do {
258867258062
aStart[ii] = zIn - (const unsigned char*)pText;
258063
+ if( zIn>=zEof ) return SQLITE_OK;
258868258064
READ_UTF8(zIn, zEof, iCode);
258869
- if( iCode==0 ) return SQLITE_OK;
258870258065
if( p->bFold ) iCode = sqlite3Fts5UnicodeFold(iCode, p->iFoldParam);
258871258066
}while( iCode==0 );
258872258067
WRITE_UTF8(zOut, iCode);
258873258068
}
258874258069
@@ -258885,12 +258080,15 @@
258885258080
const char *z1;
258886258081
258887258082
/* Read characters from the input up until the first non-diacritic */
258888258083
do {
258889258084
iNext = zIn - (const unsigned char*)pText;
258085
+ if( zIn>=zEof ){
258086
+ iCode = 0;
258087
+ break;
258088
+ }
258890258089
READ_UTF8(zIn, zEof, iCode);
258891
- if( iCode==0 ) break;
258892258090
if( p->bFold ) iCode = sqlite3Fts5UnicodeFold(iCode, p->iFoldParam);
258893258091
}while( iCode==0 );
258894258092
258895258093
/* Pass the current trigram back to fts5 */
258896258094
rc = xToken(pCtx, 0, aBuf, zOut-aBuf, aStart[0], iNext);
@@ -258986,11 +258184,10 @@
258986258184
);
258987258185
}
258988258186
return rc;
258989258187
}
258990258188
258991
-#line 1 "fts5_unicode2.c"
258992258189
/*
258993258190
** 2012-05-25
258994258191
**
258995258192
** The author disclaims copyright to this source code. In place of
258996258193
** a legal notice, here is a blessing:
@@ -259769,11 +258966,10 @@
259769258966
}
259770258967
aAscii[0] = 0; /* 0x00 is never a token character */
259771258968
}
259772258969
259773258970
259774
-#line 1 "fts5_varint.c"
259775258971
/*
259776258972
** 2015 May 30
259777258973
**
259778258974
** The author disclaims copyright to this source code. In place of
259779258975
** a legal notice, here is a blessing:
@@ -260115,11 +259311,10 @@
260115259311
if( iVal<(1 << 21) ) return 3;
260116259312
if( iVal<(1 << 28) ) return 4;
260117259313
return 5;
260118259314
}
260119259315
260120
-#line 1 "fts5_vocab.c"
260121259316
/*
260122259317
** 2015 May 08
260123259318
**
260124259319
** The author disclaims copyright to this source code. In place of
260125259320
** a legal notice, here is a blessing:
@@ -260931,11 +260126,10 @@
260931260126
/* Here ends the fts5.c composite file. */
260932260127
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS5) */
260933260128
260934260129
/************** End of fts5.c ************************************************/
260935260130
/************** Begin file stmt.c ********************************************/
260936
-#line 1 "tsrc/stmt.c"
260937260131
/*
260938260132
** 2017-05-31
260939260133
**
260940260134
** The author disclaims copyright to this source code. In place of
260941260135
** a legal notice, here is a blessing:
260942260136
--- 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 ** 5495b12569c318d5020b4b5a625a392ef8e7 with changes in files:
22 **
23 **
24 */
25 #ifndef SQLITE_AMALGAMATION
26 #define SQLITE_CORE 1
@@ -27,11 +27,10 @@
27 #define SQLITE_AMALGAMATION 1
28 #ifndef SQLITE_PRIVATE
29 # define SQLITE_PRIVATE static
30 #endif
31 /************** Begin file sqliteInt.h ***************************************/
32 #line 1 "tsrc/sqliteInt.h"
33 /*
34 ** 2001 September 15
35 **
36 ** The author disclaims copyright to this source code. In place of
37 ** a legal notice, here is a blessing:
@@ -88,11 +87,10 @@
88 ** compiler warnings due to subsequent content in this file and other files
89 ** that are included by this file.
90 */
91 /************** Include msvc.h in the middle of sqliteInt.h ******************/
92 /************** Begin file msvc.h ********************************************/
93 #line 1 "tsrc/msvc.h"
94 /*
95 ** 2015 January 12
96 **
97 ** The author disclaims copyright to this source code. In place of
98 ** a legal notice, here is a blessing:
@@ -137,18 +135,16 @@
137
138 #endif /* SQLITE_MSVC_H */
139
140 /************** End of msvc.h ************************************************/
141 /************** Continuing where we left off in sqliteInt.h ******************/
142 #line 60 "tsrc/sqliteInt.h"
143
144 /*
145 ** Special setup for VxWorks
146 */
147 /************** Include vxworks.h in the middle of sqliteInt.h ***************/
148 /************** Begin file vxworks.h *****************************************/
149 #line 1 "tsrc/vxworks.h"
150 /*
151 ** 2015-03-02
152 **
153 ** The author disclaims copyright to this source code. In place of
154 ** a legal notice, here is a blessing:
@@ -180,11 +176,10 @@
180 #define HAVE_LSTAT 1
181 #endif /* defined(_WRS_KERNEL) */
182
183 /************** End of vxworks.h *********************************************/
184 /************** Continuing where we left off in sqliteInt.h ******************/
185 #line 65 "tsrc/sqliteInt.h"
186
187 /*
188 ** These #defines should enable >2GB file support on POSIX if the
189 ** underlying operating system supports it. If the OS lacks
190 ** large file support, or if the OS is windows, these should be no-ops.
@@ -320,11 +315,10 @@
320 ** first in QNX. Also, the _USE_32BIT_TIME_T macro must appear first for
321 ** MinGW.
322 */
323 /************** Include sqlite3.h in the middle of sqliteInt.h ***************/
324 /************** Begin file sqlite3.h *****************************************/
325 #line 1 "tsrc/sqlite3.h"
326 /*
327 ** 2001-09-15
328 **
329 ** The author disclaims copyright to this source code. In place of
330 ** a legal notice, here is a blessing:
@@ -471,11 +465,11 @@
471 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
472 ** [sqlite_version()] and [sqlite_source_id()].
473 */
474 #define SQLITE_VERSION "3.48.0"
475 #define SQLITE_VERSION_NUMBER 3048000
476 #define SQLITE_SOURCE_ID "2024-11-06 12:58:31 5495b12569c318d5020b4b5a625a392ef8e777b81c0200624fbbc2a6b5eddef9"
477
478 /*
479 ** CAPI3REF: Run-Time Library Version Numbers
480 ** KEYWORDS: sqlite3_version sqlite3_sourceid
481 **
@@ -1423,10 +1417,15 @@
1423 ** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This
1424 ** opcode causes the xFileControl method to swap the file handle with the one
1425 ** pointed to by the pArg argument. This capability is used during testing
1426 ** and only needs to be supported when SQLITE_TEST is defined.
1427 **
 
 
 
 
 
1428 ** <li>[[SQLITE_FCNTL_WAL_BLOCK]]
1429 ** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
1430 ** be advantageous to block on the next WAL lock if the lock is not immediately
1431 ** available. The WAL subsystem issues this signal during rare
1432 ** circumstances in order to fix a problem with priority inversion.
@@ -1576,10 +1575,11 @@
1576 #define SQLITE_FCNTL_RESERVE_BYTES 38
1577 #define SQLITE_FCNTL_CKPT_START 39
1578 #define SQLITE_FCNTL_EXTERNAL_READER 40
1579 #define SQLITE_FCNTL_CKSM_FILE 41
1580 #define SQLITE_FCNTL_RESET_CACHE 42
 
1581
1582 /* deprecated names */
1583 #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
1584 #define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
1585 #define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
@@ -2954,14 +2954,18 @@
2954 **
2955 ** ^These functions return the number of rows modified, inserted or
2956 ** deleted by the most recently completed INSERT, UPDATE or DELETE
2957 ** statement on the database connection specified by the only parameter.
2958 ** The two functions are identical except for the type of the return value
2959 ** and that if the number of rows modified by the most recent INSERT, UPDATE
2960 ** or DELETE is greater than the maximum value supported by type "int", then
2961 ** the return value of sqlite3_changes() is undefined. ^Executing any other
2962 ** type of SQL statement does not modify the value returned by these functions.
 
 
 
 
2963 **
2964 ** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
2965 ** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
2966 ** [foreign key actions] or [REPLACE] constraint resolution are not counted.
2967 **
@@ -13908,11 +13912,10 @@
13908 /******** End of fts5.h *********/
13909 #endif /* SQLITE3_H */
13910
13911 /************** End of sqlite3.h *********************************************/
13912 /************** Continuing where we left off in sqliteInt.h ******************/
13913 #line 203 "tsrc/sqliteInt.h"
13914
13915 /*
13916 ** Reuse the STATIC_LRU for mutex access to sqlite3_temp_directory.
13917 */
13918 #define SQLITE_MUTEX_STATIC_TEMPDIR SQLITE_MUTEX_STATIC_VFS1
@@ -13926,11 +13929,10 @@
13926 #define SQLITECONFIG_H 1
13927 #endif
13928
13929 /************** Include sqliteLimit.h in the middle of sqliteInt.h ***********/
13930 /************** Begin file sqliteLimit.h *************************************/
13931 #line 1 "tsrc/sqliteLimit.h"
13932 /*
13933 ** 2007 May 7
13934 **
13935 ** The author disclaims copyright to this source code. In place of
13936 ** a legal notice, here is a blessing:
@@ -13952,10 +13954,11 @@
13952 ** to count the size: 2^31-1 or 2147483647.
13953 */
13954 #ifndef SQLITE_MAX_LENGTH
13955 # define SQLITE_MAX_LENGTH 1000000000
13956 #endif
 
13957
13958 /*
13959 ** This is the maximum number of
13960 **
13961 ** * Columns in a table
@@ -14140,11 +14143,10 @@
14140 # define SQLITE_MAX_TRIGGER_DEPTH 1000
14141 #endif
14142
14143 /************** End of sqliteLimit.h *****************************************/
14144 /************** Continuing where we left off in sqliteInt.h ******************/
14145 #line 219 "tsrc/sqliteInt.h"
14146
14147 /* Disable nuisance warnings on Borland compilers */
14148 #if defined(__BORLANDC__)
14149 #pragma warn -rch /* unreachable code */
14150 #pragma warn -ccc /* Condition is always true or false */
@@ -14558,11 +14560,10 @@
14558 #define likely(X) (X)
14559 #define unlikely(X) (X)
14560
14561 /************** Include hash.h in the middle of sqliteInt.h ******************/
14562 /************** Begin file hash.h ********************************************/
14563 #line 1 "tsrc/hash.h"
14564 /*
14565 ** 2001 September 22
14566 **
14567 ** The author disclaims copyright to this source code. In place of
14568 ** a legal notice, here is a blessing:
@@ -14658,14 +14659,12 @@
14658
14659 #endif /* SQLITE_HASH_H */
14660
14661 /************** End of hash.h ************************************************/
14662 /************** Continuing where we left off in sqliteInt.h ******************/
14663 #line 635 "tsrc/sqliteInt.h"
14664 /************** Include parse.h in the middle of sqliteInt.h *****************/
14665 /************** Begin file parse.h *******************************************/
14666 #line 1 "tsrc/parse.h"
14667 #define TK_SEMI 1
14668 #define TK_EXPLAIN 2
14669 #define TK_QUERY 3
14670 #define TK_PLAN 4
14671 #define TK_BEGIN 5
@@ -14850,11 +14849,10 @@
14850 #define TK_SPACE 184
14851 #define TK_ILLEGAL 185
14852
14853 /************** End of parse.h ***********************************************/
14854 /************** Continuing where we left off in sqliteInt.h ******************/
14855 #line 636 "tsrc/sqliteInt.h"
14856 #include <stdio.h>
14857 #include <stdlib.h>
14858 #include <string.h>
14859 #include <assert.h>
14860 #include <stddef.h>
@@ -15616,11 +15614,10 @@
15616 ** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque
15617 ** pointer types (i.e. FuncDef) defined above.
15618 */
15619 /************** Include os.h in the middle of sqliteInt.h ********************/
15620 /************** Begin file os.h **********************************************/
15621 #line 1 "tsrc/os.h"
15622 /*
15623 ** 2001 September 16
15624 **
15625 ** The author disclaims copyright to this source code. In place of
15626 ** a legal notice, here is a blessing:
@@ -15645,11 +15642,10 @@
15645 ** Attempt to automatically detect the operating system and setup the
15646 ** necessary pre-processor macros for it.
15647 */
15648 /************** Include os_setup.h in the middle of os.h *********************/
15649 /************** Begin file os_setup.h ****************************************/
15650 #line 1 "tsrc/os_setup.h"
15651 /*
15652 ** 2013 November 25
15653 **
15654 ** The author disclaims copyright to this source code. In place of
15655 ** a legal notice, here is a blessing:
@@ -15740,11 +15736,10 @@
15740
15741 #endif /* SQLITE_OS_SETUP_H */
15742
15743 /************** End of os_setup.h ********************************************/
15744 /************** Continuing where we left off in os.h *************************/
15745 #line 28 "tsrc/os.h"
15746
15747 /* If the SET_FULLSYNC macro is not defined above, then make it
15748 ** a no-op
15749 */
15750 #ifndef SET_FULLSYNC
@@ -15942,14 +15937,12 @@
15942
15943 #endif /* _SQLITE_OS_H_ */
15944
15945 /************** End of os.h **************************************************/
15946 /************** Continuing where we left off in sqliteInt.h ******************/
15947 #line 1400 "tsrc/sqliteInt.h"
15948 /************** Include pager.h in the middle of sqliteInt.h *****************/
15949 /************** Begin file pager.h *******************************************/
15950 #line 1 "tsrc/pager.h"
15951 /*
15952 ** 2001 September 15
15953 **
15954 ** The author disclaims copyright to this source code. In place of
15955 ** a legal notice, here is a blessing:
@@ -16196,14 +16189,12 @@
16196
16197 #endif /* SQLITE_PAGER_H */
16198
16199 /************** End of pager.h ***********************************************/
16200 /************** Continuing where we left off in sqliteInt.h ******************/
16201 #line 1401 "tsrc/sqliteInt.h"
16202 /************** Include btree.h in the middle of sqliteInt.h *****************/
16203 /************** Begin file btree.h *******************************************/
16204 #line 1 "tsrc/btree.h"
16205 /*
16206 ** 2001 September 15
16207 **
16208 ** The author disclaims copyright to this source code. In place of
16209 ** a legal notice, here is a blessing:
@@ -16627,14 +16618,12 @@
16627
16628 #endif /* SQLITE_BTREE_H */
16629
16630 /************** End of btree.h ***********************************************/
16631 /************** Continuing where we left off in sqliteInt.h ******************/
16632 #line 1402 "tsrc/sqliteInt.h"
16633 /************** Include vdbe.h in the middle of sqliteInt.h ******************/
16634 /************** Begin file vdbe.h ********************************************/
16635 #line 1 "tsrc/vdbe.h"
16636 /*
16637 ** 2001 September 15
16638 **
16639 ** The author disclaims copyright to this source code. In place of
16640 ** a legal notice, here is a blessing:
@@ -16814,11 +16803,10 @@
16814 ** The makefile scans the vdbe.c source file and creates the "opcodes.h"
16815 ** header file that defines a number for each opcode used by the VDBE.
16816 */
16817 /************** Include opcodes.h in the middle of vdbe.h ********************/
16818 /************** Begin file opcodes.h *****************************************/
16819 #line 1 "tsrc/opcodes.h"
16820 /* Automatically generated. Do not edit */
16821 /* See the tool/mkopcodeh.tcl script for details */
16822 #define OP_Savepoint 0
16823 #define OP_AutoCommit 1
16824 #define OP_Transaction 2
@@ -17056,11 +17044,10 @@
17056 */
17057 #define SQLITE_MX_JUMP_OPCODE 64 /* Maximum JUMP opcode */
17058
17059 /************** End of opcodes.h *********************************************/
17060 /************** Continuing where we left off in vdbe.h ***********************/
17061 #line 183 "tsrc/vdbe.h"
17062
17063 /*
17064 ** Additional non-public SQLITE_PREPARE_* flags
17065 */
17066 #define SQLITE_PREPARE_SAVESQL 0x80 /* Preserve SQL text */
@@ -17306,14 +17293,12 @@
17306
17307 #endif /* SQLITE_VDBE_H */
17308
17309 /************** End of vdbe.h ************************************************/
17310 /************** Continuing where we left off in sqliteInt.h ******************/
17311 #line 1403 "tsrc/sqliteInt.h"
17312 /************** Include pcache.h in the middle of sqliteInt.h ****************/
17313 /************** Begin file pcache.h ******************************************/
17314 #line 1 "tsrc/pcache.h"
17315 /*
17316 ** 2008 August 05
17317 **
17318 ** The author disclaims copyright to this source code. In place of
17319 ** a legal notice, here is a blessing:
@@ -17503,14 +17488,12 @@
17503
17504 #endif /* _PCACHE_H_ */
17505
17506 /************** End of pcache.h **********************************************/
17507 /************** Continuing where we left off in sqliteInt.h ******************/
17508 #line 1404 "tsrc/sqliteInt.h"
17509 /************** Include mutex.h in the middle of sqliteInt.h *****************/
17510 /************** Begin file mutex.h *******************************************/
17511 #line 1 "tsrc/mutex.h"
17512 /*
17513 ** 2007 August 28
17514 **
17515 ** The author disclaims copyright to this source code. In place of
17516 ** a legal notice, here is a blessing:
@@ -17581,11 +17564,10 @@
17581 SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
17582 #endif /* defined(SQLITE_MUTEX_OMIT) */
17583
17584 /************** End of mutex.h ***********************************************/
17585 /************** Continuing where we left off in sqliteInt.h ******************/
17586 #line 1405 "tsrc/sqliteInt.h"
17587
17588 /* The SQLITE_EXTRA_DURABLE compile-time option used to set the default
17589 ** synchronous setting to EXTRA. It is no longer supported.
17590 */
17591 #ifdef SQLITE_EXTRA_DURABLE
@@ -21982,11 +21964,10 @@
21982
21983 #endif /* SQLITEINT_H */
21984
21985 /************** End of sqliteInt.h *******************************************/
21986 /************** Begin file os_common.h ***************************************/
21987 #line 1 "tsrc/os_common.h"
21988 /*
21989 ** 2004 May 22
21990 **
21991 ** The author disclaims copyright to this source code. In place of
21992 ** a legal notice, here is a blessing:
@@ -22085,11 +22066,10 @@
22085
22086 #endif /* !defined(_OS_COMMON_H_) */
22087
22088 /************** End of os_common.h *******************************************/
22089 /************** Begin file ctime.c *******************************************/
22090 #line 1 "tsrc/ctime.c"
22091 /* DO NOT EDIT!
22092 ** This file is automatically generated by the script in the canonical
22093 ** SQLite source tree at tool/mkctimec.tcl.
22094 **
22095 ** To modify this header, edit any of the various lists in that script
@@ -22885,11 +22865,10 @@
22885
22886 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
22887
22888 /************** End of ctime.c ***********************************************/
22889 /************** Begin file global.c ******************************************/
22890 #line 1 "tsrc/global.c"
22891 /*
22892 ** 2008 June 13
22893 **
22894 ** The author disclaims copyright to this source code. In place of
22895 ** a legal notice, here is a blessing:
@@ -23290,11 +23269,10 @@
23290 "TEXT"
23291 };
23292
23293 /************** End of global.c **********************************************/
23294 /************** Begin file status.c ******************************************/
23295 #line 1 "tsrc/status.c"
23296 /*
23297 ** 2008 June 18
23298 **
23299 ** The author disclaims copyright to this source code. In place of
23300 ** a legal notice, here is a blessing:
@@ -23309,11 +23287,10 @@
23309 ** functionality.
23310 */
23311 /* #include "sqliteInt.h" */
23312 /************** Include vdbeInt.h in the middle of status.c ******************/
23313 /************** Begin file vdbeInt.h *****************************************/
23314 #line 1 "tsrc/vdbeInt.h"
23315 /*
23316 ** 2003 September 6
23317 **
23318 ** The author disclaims copyright to this source code. In place of
23319 ** a legal notice, here is a blessing:
@@ -24046,11 +24023,10 @@
24046
24047 #endif /* !defined(SQLITE_VDBEINT_H) */
24048
24049 /************** End of vdbeInt.h *********************************************/
24050 /************** Continuing where we left off in status.c *********************/
24051 #line 18 "tsrc/status.c"
24052
24053 /*
24054 ** Variables in which to record status information.
24055 */
24056 #if SQLITE_PTRSIZE>4
@@ -24431,11 +24407,10 @@
24431 return rc;
24432 }
24433
24434 /************** End of status.c **********************************************/
24435 /************** Begin file date.c ********************************************/
24436 #line 1 "tsrc/date.c"
24437 /*
24438 ** 2003 October 31
24439 **
24440 ** The author disclaims copyright to this source code. In place of
24441 ** a legal notice, here is a blessing:
@@ -26250,11 +26225,10 @@
26250 sqlite3InsertBuiltinFuncs(aDateTimeFuncs, ArraySize(aDateTimeFuncs));
26251 }
26252
26253 /************** End of date.c ************************************************/
26254 /************** Begin file os.c **********************************************/
26255 #line 1 "tsrc/os.c"
26256 /*
26257 ** 2005 November 29
26258 **
26259 ** The author disclaims copyright to this source code. In place of
26260 ** a legal notice, here is a blessing:
@@ -26701,11 +26675,10 @@
26701 return SQLITE_OK;
26702 }
26703
26704 /************** End of os.c **************************************************/
26705 /************** Begin file fault.c *******************************************/
26706 #line 1 "tsrc/fault.c"
26707 /*
26708 ** 2008 Jan 22
26709 **
26710 ** The author disclaims copyright to this source code. In place of
26711 ** a legal notice, here is a blessing:
@@ -26792,11 +26765,10 @@
26792
26793 #endif /* #ifndef SQLITE_UNTESTABLE */
26794
26795 /************** End of fault.c ***********************************************/
26796 /************** Begin file mem0.c ********************************************/
26797 #line 1 "tsrc/mem0.c"
26798 /*
26799 ** 2008 October 28
26800 **
26801 ** The author disclaims copyright to this source code. In place of
26802 ** a legal notice, here is a blessing:
@@ -26855,11 +26827,10 @@
26855
26856 #endif /* SQLITE_ZERO_MALLOC */
26857
26858 /************** End of mem0.c ************************************************/
26859 /************** Begin file mem1.c ********************************************/
26860 #line 1 "tsrc/mem1.c"
26861 /*
26862 ** 2007 August 14
26863 **
26864 ** The author disclaims copyright to this source code. In place of
26865 ** a legal notice, here is a blessing:
@@ -27150,11 +27121,10 @@
27150
27151 #endif /* SQLITE_SYSTEM_MALLOC */
27152
27153 /************** End of mem1.c ************************************************/
27154 /************** Begin file mem2.c ********************************************/
27155 #line 1 "tsrc/mem2.c"
27156 /*
27157 ** 2007 August 15
27158 **
27159 ** The author disclaims copyright to this source code. In place of
27160 ** a legal notice, here is a blessing:
@@ -27682,11 +27652,10 @@
27682
27683 #endif /* SQLITE_MEMDEBUG */
27684
27685 /************** End of mem2.c ************************************************/
27686 /************** Begin file mem3.c ********************************************/
27687 #line 1 "tsrc/mem3.c"
27688 /*
27689 ** 2007 October 14
27690 **
27691 ** The author disclaims copyright to this source code. In place of
27692 ** a legal notice, here is a blessing:
@@ -28373,11 +28342,10 @@
28373
28374 #endif /* SQLITE_ENABLE_MEMSYS3 */
28375
28376 /************** End of mem3.c ************************************************/
28377 /************** Begin file mem5.c ********************************************/
28378 #line 1 "tsrc/mem5.c"
28379 /*
28380 ** 2007 October 14
28381 **
28382 ** The author disclaims copyright to this source code. In place of
28383 ** a legal notice, here is a blessing:
@@ -28962,11 +28930,10 @@
28962
28963 #endif /* SQLITE_ENABLE_MEMSYS5 */
28964
28965 /************** End of mem5.c ************************************************/
28966 /************** Begin file mutex.c *******************************************/
28967 #line 1 "tsrc/mutex.c"
28968 /*
28969 ** 2007 August 14
28970 **
28971 ** The author disclaims copyright to this source code. In place of
28972 ** a legal notice, here is a blessing:
@@ -29340,11 +29307,10 @@
29340
29341 #endif /* !defined(SQLITE_MUTEX_OMIT) */
29342
29343 /************** End of mutex.c ***********************************************/
29344 /************** Begin file mutex_noop.c **************************************/
29345 #line 1 "tsrc/mutex_noop.c"
29346 /*
29347 ** 2008 October 07
29348 **
29349 ** The author disclaims copyright to this source code. In place of
29350 ** a legal notice, here is a blessing:
@@ -29559,11 +29525,10 @@
29559 #endif /* defined(SQLITE_MUTEX_NOOP) */
29560 #endif /* !defined(SQLITE_MUTEX_OMIT) */
29561
29562 /************** End of mutex_noop.c ******************************************/
29563 /************** Begin file mutex_unix.c **************************************/
29564 #line 1 "tsrc/mutex_unix.c"
29565 /*
29566 ** 2007 August 28
29567 **
29568 ** The author disclaims copyright to this source code. In place of
29569 ** a legal notice, here is a blessing:
@@ -29957,11 +29922,10 @@
29957
29958 #endif /* SQLITE_MUTEX_PTHREADS */
29959
29960 /************** End of mutex_unix.c ******************************************/
29961 /************** Begin file mutex_w32.c ***************************************/
29962 #line 1 "tsrc/mutex_w32.c"
29963 /*
29964 ** 2007 August 14
29965 **
29966 ** The author disclaims copyright to this source code. In place of
29967 ** a legal notice, here is a blessing:
@@ -29984,11 +29948,10 @@
29984 /*
29985 ** Include the header file for the Windows VFS.
29986 */
29987 /************** Include os_win.h in the middle of mutex_w32.c ****************/
29988 /************** Begin file os_win.h ******************************************/
29989 #line 1 "tsrc/os_win.h"
29990 /*
29991 ** 2013 November 25
29992 **
29993 ** The author disclaims copyright to this source code. In place of
29994 ** a legal notice, here is a blessing:
@@ -30076,11 +30039,10 @@
30076
30077 #endif /* SQLITE_OS_WIN_H */
30078
30079 /************** End of os_win.h **********************************************/
30080 /************** Continuing where we left off in mutex_w32.c ******************/
30081 #line 26 "tsrc/mutex_w32.c"
30082 #endif
30083
30084 /*
30085 ** The code in this file is only used if we are compiling multithreaded
30086 ** on a Win32 system.
@@ -30454,11 +30416,10 @@
30454
30455 #endif /* SQLITE_MUTEX_W32 */
30456
30457 /************** End of mutex_w32.c *******************************************/
30458 /************** Begin file malloc.c ******************************************/
30459 #line 1 "tsrc/malloc.c"
30460 /*
30461 ** 2001 September 15
30462 **
30463 ** The author disclaims copyright to this source code. In place of
30464 ** a legal notice, here is a blessing:
@@ -31378,11 +31339,10 @@
31378 return 0;
31379 }
31380
31381 /************** End of malloc.c **********************************************/
31382 /************** Begin file printf.c ******************************************/
31383 #line 1 "tsrc/printf.c"
31384 /*
31385 ** The "printf" code that follows dates from the 1980's. It is in
31386 ** the public domain.
31387 **
31388 **************************************************************************
@@ -32828,11 +32788,10 @@
32828 }
32829 }
32830
32831 /************** End of printf.c **********************************************/
32832 /************** Begin file treeview.c ****************************************/
32833 #line 1 "tsrc/treeview.c"
32834 /*
32835 ** 2015-06-08
32836 **
32837 ** The author disclaims copyright to this source code. In place of
32838 ** a legal notice, here is a blessing:
@@ -34160,11 +34119,10 @@
34160
34161 #endif /* SQLITE_DEBUG */
34162
34163 /************** End of treeview.c ********************************************/
34164 /************** Begin file random.c ******************************************/
34165 #line 1 "tsrc/random.c"
34166 /*
34167 ** 2001 September 15
34168 **
34169 ** The author disclaims copyright to this source code. In place of
34170 ** a legal notice, here is a blessing:
@@ -34321,11 +34279,10 @@
34321 }
34322 #endif /* SQLITE_UNTESTABLE */
34323
34324 /************** End of random.c **********************************************/
34325 /************** Begin file threads.c *****************************************/
34326 #line 1 "tsrc/threads.c"
34327 /*
34328 ** 2012 July 21
34329 **
34330 ** The author disclaims copyright to this source code. In place of
34331 ** a legal notice, here is a blessing:
@@ -34599,11 +34556,10 @@
34599 /****************************** End Single-Threaded *************************/
34600 #endif /* SQLITE_MAX_WORKER_THREADS>0 */
34601
34602 /************** End of threads.c *********************************************/
34603 /************** Begin file utf.c *********************************************/
34604 #line 1 "tsrc/utf.c"
34605 /*
34606 ** 2004 April 13
34607 **
34608 ** The author disclaims copyright to this source code. In place of
34609 ** a legal notice, here is a blessing:
@@ -35171,11 +35127,10 @@
35171 #endif /* SQLITE_TEST */
35172 #endif /* SQLITE_OMIT_UTF16 */
35173
35174 /************** End of utf.c *************************************************/
35175 /************** Begin file util.c ********************************************/
35176 #line 1 "tsrc/util.c"
35177 /*
35178 ** 2001 September 15
35179 **
35180 ** The author disclaims copyright to this source code. In place of
35181 ** a legal notice, here is a blessing:
@@ -37023,11 +36978,10 @@
37023 return 0;
37024 }
37025
37026 /************** End of util.c ************************************************/
37027 /************** Begin file hash.c ********************************************/
37028 #line 1 "tsrc/hash.c"
37029 /*
37030 ** 2001 September 22
37031 **
37032 ** The author disclaims copyright to this source code. In place of
37033 ** a legal notice, here is a blessing:
@@ -37297,11 +37251,10 @@
37297 return 0;
37298 }
37299
37300 /************** End of hash.c ************************************************/
37301 /************** Begin file opcodes.c *****************************************/
37302 #line 1 "tsrc/opcodes.c"
37303 /* Automatically generated. Do not edit */
37304 /* See the tool/mkopcodec.tcl script for details. */
37305 #if !defined(SQLITE_OMIT_EXPLAIN) \
37306 || defined(VDBE_PROFILE) \
37307 || defined(SQLITE_DEBUG)
@@ -37507,11 +37460,10 @@
37507 }
37508 #endif
37509
37510 /************** End of opcodes.c *********************************************/
37511 /************** Begin file os_kv.c *******************************************/
37512 #line 1 "tsrc/os_kv.c"
37513 /*
37514 ** 2022-09-06
37515 **
37516 ** The author disclaims copyright to this source code. In place of
37517 ** a legal notice, here is a blessing:
@@ -38490,11 +38442,10 @@
38490 }
38491 #endif
38492
38493 /************** End of os_kv.c ***********************************************/
38494 /************** Begin file os_unix.c *****************************************/
38495 #line 1 "tsrc/os_unix.c"
38496 /*
38497 ** 2004 May 22
38498 **
38499 ** The author disclaims copyright to this source code. In place of
38500 ** a legal notice, here is a blessing:
@@ -42480,10 +42431,15 @@
42480 int rc = osIoctl(pFile->h, F2FS_IOC_ABORT_VOLATILE_WRITE);
42481 return rc ? SQLITE_IOERR_ROLLBACK_ATOMIC : SQLITE_OK;
42482 }
42483 #endif /* __linux__ && SQLITE_ENABLE_BATCH_ATOMIC_WRITE */
42484
 
 
 
 
 
42485 case SQLITE_FCNTL_LOCKSTATE: {
42486 *(int*)pArg = pFile->eFileLock;
42487 return SQLITE_OK;
42488 }
42489 case SQLITE_FCNTL_LAST_ERRNO: {
@@ -46760,11 +46716,10 @@
46760
46761 #endif /* SQLITE_OS_UNIX */
46762
46763 /************** End of os_unix.c *********************************************/
46764 /************** Begin file os_win.c ******************************************/
46765 #line 1 "tsrc/os_win.c"
46766 /*
46767 ** 2004 May 22
46768 **
46769 ** The author disclaims copyright to this source code. In place of
46770 ** a legal notice, here is a blessing:
@@ -50362,10 +50317,15 @@
50362 OSTRACE(("FCNTL oldFile=%p, newFile=%p, rc=SQLITE_OK\n",
50363 hOldFile, pFile->h));
50364 return SQLITE_OK;
50365 }
50366 #endif
 
 
 
 
 
50367 case SQLITE_FCNTL_TEMPFILENAME: {
50368 char *zTFile = 0;
50369 int rc = winGetTempname(pFile->pVfs, &zTFile);
50370 if( rc==SQLITE_OK ){
50371 *(char**)pArg = zTFile;
@@ -52975,11 +52935,10 @@
52975
52976 #endif /* SQLITE_OS_WIN */
52977
52978 /************** End of os_win.c **********************************************/
52979 /************** Begin file memdb.c *******************************************/
52980 #line 1 "tsrc/memdb.c"
52981 /*
52982 ** 2016-09-07
52983 **
52984 ** The author disclaims copyright to this source code. In place of
52985 ** a legal notice, here is a blessing:
@@ -53915,11 +53874,10 @@
53915 }
53916 #endif /* SQLITE_OMIT_DESERIALIZE */
53917
53918 /************** End of memdb.c ***********************************************/
53919 /************** Begin file bitvec.c ******************************************/
53920 #line 1 "tsrc/bitvec.c"
53921 /*
53922 ** 2008 February 16
53923 **
53924 ** The author disclaims copyright to this source code. In place of
53925 ** a legal notice, here is a blessing:
@@ -54330,11 +54288,10 @@
54330 }
54331 #endif /* SQLITE_UNTESTABLE */
54332
54333 /************** End of bitvec.c **********************************************/
54334 /************** Begin file pcache.c ******************************************/
54335 #line 1 "tsrc/pcache.c"
54336 /*
54337 ** 2008 August 05
54338 **
54339 ** The author disclaims copyright to this source code. In place of
54340 ** a legal notice, here is a blessing:
@@ -55270,11 +55227,10 @@
55270 }
55271 #endif
55272
55273 /************** End of pcache.c **********************************************/
55274 /************** Begin file pcache1.c *****************************************/
55275 #line 1 "tsrc/pcache1.c"
55276 /*
55277 ** 2008 November 05
55278 **
55279 ** The author disclaims copyright to this source code. In place of
55280 ** a legal notice, here is a blessing:
@@ -56556,11 +56512,10 @@
56556 }
56557 #endif
56558
56559 /************** End of pcache1.c *********************************************/
56560 /************** Begin file rowset.c ******************************************/
56561 #line 1 "tsrc/rowset.c"
56562 /*
56563 ** 2008 December 3
56564 **
56565 ** The author disclaims copyright to this source code. In place of
56566 ** a legal notice, here is a blessing:
@@ -57062,11 +57017,10 @@
57062 return 0;
57063 }
57064
57065 /************** End of rowset.c **********************************************/
57066 /************** Begin file pager.c *******************************************/
57067 #line 1 "tsrc/pager.c"
57068 /*
57069 ** 2001 September 15
57070 **
57071 ** The author disclaims copyright to this source code. In place of
57072 ** a legal notice, here is a blessing:
@@ -57087,11 +57041,10 @@
57087 */
57088 #ifndef SQLITE_OMIT_DISKIO
57089 /* #include "sqliteInt.h" */
57090 /************** Include wal.h in the middle of pager.c ***********************/
57091 /************** Begin file wal.h *********************************************/
57092 #line 1 "tsrc/wal.h"
57093 /*
57094 ** 2010 February 1
57095 **
57096 ** The author disclaims copyright to this source code. In place of
57097 ** a legal notice, here is a blessing:
@@ -57251,11 +57204,10 @@
57251 #endif /* ifndef SQLITE_OMIT_WAL */
57252 #endif /* SQLITE_WAL_H */
57253
57254 /************** End of wal.h *************************************************/
57255 /************** Continuing where we left off in pager.c **********************/
57256 #line 24 "tsrc/pager.c"
57257
57258
57259 /******************* NOTES ON THE DESIGN OF THE PAGER ************************
57260 **
57261 ** This comment block describes invariants that hold when using a rollback
@@ -65041,11 +64993,10 @@
65041
65042 #endif /* SQLITE_OMIT_DISKIO */
65043
65044 /************** End of pager.c ***********************************************/
65045 /************** Begin file wal.c *********************************************/
65046 #line 1 "tsrc/wal.c"
65047 /*
65048 ** 2010 February 1
65049 **
65050 ** The author disclaims copyright to this source code. In place of
65051 ** a legal notice, here is a blessing:
@@ -69638,11 +69589,10 @@
69638
69639 #endif /* #ifndef SQLITE_OMIT_WAL */
69640
69641 /************** End of wal.c *************************************************/
69642 /************** Begin file btmutex.c *****************************************/
69643 #line 1 "tsrc/btmutex.c"
69644 /*
69645 ** 2007 August 27
69646 **
69647 ** The author disclaims copyright to this source code. In place of
69648 ** a legal notice, here is a blessing:
@@ -69658,11 +69608,10 @@
69658 ** big and we want to break it down some. This packaged seemed like
69659 ** a good breakout.
69660 */
69661 /************** Include btreeInt.h in the middle of btmutex.c ****************/
69662 /************** Begin file btreeInt.h ****************************************/
69663 #line 1 "tsrc/btreeInt.h"
69664 /*
69665 ** 2004 April 6
69666 **
69667 ** The author disclaims copyright to this source code. In place of
69668 ** a legal notice, here is a blessing:
@@ -70396,11 +70345,10 @@
70396 # define get2byteAligned(x) ((x)[0]<<8 | (x)[1])
70397 #endif
70398
70399 /************** End of btreeInt.h ********************************************/
70400 /************** Continuing where we left off in btmutex.c ********************/
70401 #line 19 "tsrc/btmutex.c"
70402 #ifndef SQLITE_OMIT_SHARED_CACHE
70403 #if SQLITE_THREADSAFE
70404
70405 /*
70406 ** Obtain the BtShared mutex associated with B-Tree handle p. Also,
@@ -70691,11 +70639,10 @@
70691
70692 #endif /* ifndef SQLITE_OMIT_SHARED_CACHE */
70693
70694 /************** End of btmutex.c *********************************************/
70695 /************** Begin file btree.c *******************************************/
70696 #line 1 "tsrc/btree.c"
70697 /*
70698 ** 2004 April 6
70699 **
70700 ** The author disclaims copyright to this source code. In place of
70701 ** a legal notice, here is a blessing:
@@ -82186,11 +82133,10 @@
82186 }
82187 #endif
82188
82189 /************** End of btree.c ***********************************************/
82190 /************** Begin file backup.c ******************************************/
82191 #line 1 "tsrc/backup.c"
82192 /*
82193 ** 2009 January 28
82194 **
82195 ** The author disclaims copyright to this source code. In place of
82196 ** a legal notice, here is a blessing:
@@ -82957,11 +82903,10 @@
82957 }
82958 #endif /* SQLITE_OMIT_VACUUM */
82959
82960 /************** End of backup.c **********************************************/
82961 /************** Begin file vdbemem.c *****************************************/
82962 #line 1 "tsrc/vdbemem.c"
82963 /*
82964 ** 2004 May 26
82965 **
82966 ** The author disclaims copyright to this source code. In place of
82967 ** a legal notice, here is a blessing:
@@ -85014,11 +84959,10 @@
85014 return valueBytes(pVal, enc);
85015 }
85016
85017 /************** End of vdbemem.c *********************************************/
85018 /************** Begin file vdbeaux.c *****************************************/
85019 #line 1 "tsrc/vdbeaux.c"
85020 /*
85021 ** 2003 September 6
85022 **
85023 ** The author disclaims copyright to this source code. In place of
85024 ** a legal notice, here is a blessing:
@@ -90566,11 +90510,10 @@
90566 }
90567 #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
90568
90569 /************** End of vdbeaux.c *********************************************/
90570 /************** Begin file vdbeapi.c *****************************************/
90571 #line 1 "tsrc/vdbeapi.c"
90572 /*
90573 ** 2004 May 26
90574 **
90575 ** The author disclaims copyright to this source code. In place of
90576 ** a legal notice, here is a blessing:
@@ -93153,11 +93096,10 @@
93153 }
93154 #endif /* SQLITE_ENABLE_STMT_SCANSTATUS */
93155
93156 /************** End of vdbeapi.c *********************************************/
93157 /************** Begin file vdbetrace.c ***************************************/
93158 #line 1 "tsrc/vdbetrace.c"
93159 /*
93160 ** 2009 November 25
93161 **
93162 ** The author disclaims copyright to this source code. In place of
93163 ** a legal notice, here is a blessing:
@@ -93349,11 +93291,10 @@
93349
93350 #endif /* #ifndef SQLITE_OMIT_TRACE */
93351
93352 /************** End of vdbetrace.c *******************************************/
93353 /************** Begin file vdbe.c ********************************************/
93354 #line 1 "tsrc/vdbe.c"
93355 /*
93356 ** 2001 September 15
93357 **
93358 ** The author disclaims copyright to this source code. In place of
93359 ** a legal notice, here is a blessing:
@@ -93381,11 +93322,10 @@
93381 #if defined(VDBE_PROFILE) \
93382 || defined(SQLITE_PERFORMANCE_TRACE) \
93383 || defined(SQLITE_ENABLE_STMT_SCANSTATUS)
93384 /************** Include hwtime.h in the middle of vdbe.c *********************/
93385 /************** Begin file hwtime.h ******************************************/
93386 #line 1 "tsrc/hwtime.h"
93387 /*
93388 ** 2008 May 27
93389 **
93390 ** The author disclaims copyright to this source code. In place of
93391 ** a legal notice, here is a blessing:
@@ -93470,11 +93410,10 @@
93470
93471 #endif /* !defined(SQLITE_HWTIME_H) */
93472
93473 /************** End of hwtime.h **********************************************/
93474 /************** Continuing where we left off in vdbe.c ***********************/
93475 #line 31 "tsrc/vdbe.c"
93476 #endif
93477
93478 /*
93479 ** Invoke this macro on memory cells just prior to changing the
93480 ** value of the cell. This macro verifies that shallow copies are
@@ -102664,11 +102603,10 @@
102664 }
102665
102666
102667 /************** End of vdbe.c ************************************************/
102668 /************** Begin file vdbeblob.c ****************************************/
102669 #line 1 "tsrc/vdbeblob.c"
102670 /*
102671 ** 2007 May 1
102672 **
102673 ** The author disclaims copyright to this source code. In place of
102674 ** a legal notice, here is a blessing:
@@ -103188,11 +103126,10 @@
103188
103189 #endif /* #ifndef SQLITE_OMIT_INCRBLOB */
103190
103191 /************** End of vdbeblob.c ********************************************/
103192 /************** Begin file vdbesort.c ****************************************/
103193 #line 1 "tsrc/vdbesort.c"
103194 /*
103195 ** 2011-07-09
103196 **
103197 ** The author disclaims copyright to this source code. In place of
103198 ** a legal notice, here is a blessing:
@@ -105959,11 +105896,10 @@
105959 return SQLITE_OK;
105960 }
105961
105962 /************** End of vdbesort.c ********************************************/
105963 /************** Begin file vdbevtab.c ****************************************/
105964 #line 1 "tsrc/vdbevtab.c"
105965 /*
105966 ** 2020-03-23
105967 **
105968 ** The author disclaims copyright to this source code. In place of
105969 ** a legal notice, here is a blessing:
@@ -106409,11 +106345,10 @@
106409 SQLITE_PRIVATE int sqlite3VdbeBytecodeVtabInit(sqlite3 *db){ return SQLITE_OK; }
106410 #endif /* SQLITE_ENABLE_BYTECODE_VTAB */
106411
106412 /************** End of vdbevtab.c ********************************************/
106413 /************** Begin file memjournal.c **************************************/
106414 #line 1 "tsrc/memjournal.c"
106415 /*
106416 ** 2008 October 7
106417 **
106418 ** The author disclaims copyright to this source code. In place of
106419 ** a legal notice, here is a blessing:
@@ -106853,11 +106788,10 @@
106853 return MAX(pVfs->szOsFile, (int)sizeof(MemJournal));
106854 }
106855
106856 /************** End of memjournal.c ******************************************/
106857 /************** Begin file walker.c ******************************************/
106858 #line 1 "tsrc/walker.c"
106859 /*
106860 ** 2008 August 16
106861 **
106862 ** The author disclaims copyright to this source code. In place of
106863 ** a legal notice, here is a blessing:
@@ -107118,11 +107052,10 @@
107118 return WRC_Continue;
107119 }
107120
107121 /************** End of walker.c **********************************************/
107122 /************** Begin file resolve.c *****************************************/
107123 #line 1 "tsrc/resolve.c"
107124 /*
107125 ** 2008 August 18
107126 **
107127 ** The author disclaims copyright to this source code. In place of
107128 ** a legal notice, here is a blessing:
@@ -109440,11 +109373,10 @@
109440 return rc;
109441 }
109442
109443 /************** End of resolve.c *********************************************/
109444 /************** Begin file expr.c ********************************************/
109445 #line 1 "tsrc/expr.c"
109446 /*
109447 ** 2001 September 15
109448 **
109449 ** The author disclaims copyright to this source code. In place of
109450 ** a legal notice, here is a blessing:
@@ -116770,11 +116702,10 @@
116770 }
116771 #endif /* SQLITE_DEBUG */
116772
116773 /************** End of expr.c ************************************************/
116774 /************** Begin file alter.c *******************************************/
116775 #line 1 "tsrc/alter.c"
116776 /*
116777 ** 2005 February 15
116778 **
116779 ** The author disclaims copyright to this source code. In place of
116780 ** a legal notice, here is a blessing:
@@ -119090,11 +119021,10 @@
119090 }
119091 #endif /* SQLITE_ALTER_TABLE */
119092
119093 /************** End of alter.c ***********************************************/
119094 /************** Begin file analyze.c *****************************************/
119095 #line 1 "tsrc/analyze.c"
119096 /*
119097 ** 2005-07-08
119098 **
119099 ** The author disclaims copyright to this source code. In place of
119100 ** a legal notice, here is a blessing:
@@ -121115,11 +121045,10 @@
121115
121116 #endif /* SQLITE_OMIT_ANALYZE */
121117
121118 /************** End of analyze.c *********************************************/
121119 /************** Begin file attach.c ******************************************/
121120 #line 1 "tsrc/attach.c"
121121 /*
121122 ** 2003 April 6
121123 **
121124 ** The author disclaims copyright to this source code. In place of
121125 ** a legal notice, here is a blessing:
@@ -121728,11 +121657,10 @@
121728 }
121729 #endif
121730
121731 /************** End of attach.c **********************************************/
121732 /************** Begin file auth.c ********************************************/
121733 #line 1 "tsrc/auth.c"
121734 /*
121735 ** 2003 January 11
121736 **
121737 ** The author disclaims copyright to this source code. In place of
121738 ** a legal notice, here is a blessing:
@@ -121992,11 +121920,10 @@
121992
121993 #endif /* SQLITE_OMIT_AUTHORIZATION */
121994
121995 /************** End of auth.c ************************************************/
121996 /************** Begin file build.c *******************************************/
121997 #line 1 "tsrc/build.c"
121998 /*
121999 ** 2001 September 15
122000 **
122001 ** The author disclaims copyright to this source code. In place of
122002 ** a legal notice, here is a blessing:
@@ -127763,11 +127690,10 @@
127763 }
127764 #endif /* !defined(SQLITE_OMIT_CTE) */
127765
127766 /************** End of build.c ***********************************************/
127767 /************** Begin file callback.c ****************************************/
127768 #line 1 "tsrc/callback.c"
127769 /*
127770 ** 2005 May 23
127771 **
127772 ** The author disclaims copyright to this source code. In place of
127773 ** a legal notice, here is a blessing:
@@ -128307,11 +128233,10 @@
128307 return p;
128308 }
128309
128310 /************** End of callback.c ********************************************/
128311 /************** Begin file delete.c ******************************************/
128312 #line 1 "tsrc/delete.c"
128313 /*
128314 ** 2001 September 15
128315 **
128316 ** The author disclaims copyright to this source code. In place of
128317 ** a legal notice, here is a blessing:
@@ -129341,11 +129266,10 @@
129341 }
129342 }
129343
129344 /************** End of delete.c **********************************************/
129345 /************** Begin file func.c ********************************************/
129346 #line 1 "tsrc/func.c"
129347 /*
129348 ** 2002 February 23
129349 **
129350 ** The author disclaims copyright to this source code. In place of
129351 ** a legal notice, here is a blessing:
@@ -132188,11 +132112,10 @@
132188 #endif
132189 }
132190
132191 /************** End of func.c ************************************************/
132192 /************** Begin file fkey.c ********************************************/
132193 #line 1 "tsrc/fkey.c"
132194 /*
132195 **
132196 ** The author disclaims copyright to this source code. In place of
132197 ** a legal notice, here is a blessing:
132198 **
@@ -133676,11 +133599,10 @@
133676 }
133677 #endif /* ifndef SQLITE_OMIT_FOREIGN_KEY */
133678
133679 /************** End of fkey.c ************************************************/
133680 /************** Begin file insert.c ******************************************/
133681 #line 1 "tsrc/insert.c"
133682 /*
133683 ** 2001 September 15
133684 **
133685 ** The author disclaims copyright to this source code. In place of
133686 ** a legal notice, here is a blessing:
@@ -137072,11 +136994,10 @@
137072 }
137073 #endif /* SQLITE_OMIT_XFER_OPT */
137074
137075 /************** End of insert.c **********************************************/
137076 /************** Begin file legacy.c ******************************************/
137077 #line 1 "tsrc/legacy.c"
137078 /*
137079 ** 2001 September 15
137080 **
137081 ** The author disclaims copyright to this source code. In place of
137082 ** a legal notice, here is a blessing:
@@ -137217,11 +137138,10 @@
137217 return rc;
137218 }
137219
137220 /************** End of legacy.c **********************************************/
137221 /************** Begin file loadext.c *****************************************/
137222 #line 1 "tsrc/loadext.c"
137223 /*
137224 ** 2006 June 7
137225 **
137226 ** The author disclaims copyright to this source code. In place of
137227 ** a legal notice, here is a blessing:
@@ -137238,11 +137158,10 @@
137238 #ifndef SQLITE_CORE
137239 #define SQLITE_CORE 1 /* Disable the API redefinition in sqlite3ext.h */
137240 #endif
137241 /************** Include sqlite3ext.h in the middle of loadext.c **************/
137242 /************** Begin file sqlite3ext.h **************************************/
137243 #line 1 "tsrc/sqlite3ext.h"
137244 /*
137245 ** 2006 June 7
137246 **
137247 ** The author disclaims copyright to this source code. In place of
137248 ** a legal notice, here is a blessing:
@@ -137961,11 +137880,10 @@
137961
137962 #endif /* SQLITE3EXT_H */
137963
137964 /************** End of sqlite3ext.h ******************************************/
137965 /************** Continuing where we left off in loadext.c ********************/
137966 #line 20 "tsrc/loadext.c"
137967 /* #include "sqliteInt.h" */
137968
137969 #ifndef SQLITE_OMIT_LOAD_EXTENSION
137970 /*
137971 ** Some API routines are omitted when various features are
@@ -138867,11 +138785,10 @@
138867 }
138868 }
138869
138870 /************** End of loadext.c *********************************************/
138871 /************** Begin file pragma.c ******************************************/
138872 #line 1 "tsrc/pragma.c"
138873 /*
138874 ** 2003 April 6
138875 **
138876 ** The author disclaims copyright to this source code. In place of
138877 ** a legal notice, here is a blessing:
@@ -138900,11 +138817,10 @@
138900 ** lexicographical order to facility a binary search of the pragma name.
138901 ** Do not edit pragma.h directly. Edit and rerun the script in at
138902 ** ../tool/mkpragmatab.tcl. */
138903 /************** Include pragma.h in the middle of pragma.c *******************/
138904 /************** Begin file pragma.h ******************************************/
138905 #line 1 "tsrc/pragma.h"
138906 /* DO NOT EDIT!
138907 ** This file is automatically generated by the script at
138908 ** ../tool/mkpragmatab.tcl. To update the set of pragmas, edit
138909 ** that script and rerun it.
138910 */
@@ -139564,11 +139480,10 @@
139564 };
139565 /* Number of pragmas: 68 on by default, 78 total. */
139566
139567 /************** End of pragma.h **********************************************/
139568 /************** Continuing where we left off in pragma.c *********************/
139569 #line 32 "tsrc/pragma.c"
139570
139571 /*
139572 ** When the 0x10 bit of PRAGMA optimize is set, any ANALYZE commands
139573 ** will be run with an analysis_limit set to the lessor of the value of
139574 ** the following macro or to the actual analysis_limit if it is non-zero,
@@ -142608,11 +142523,10 @@
142608
142609 #endif /* SQLITE_OMIT_PRAGMA */
142610
142611 /************** End of pragma.c **********************************************/
142612 /************** Begin file prepare.c *****************************************/
142613 #line 1 "tsrc/prepare.c"
142614 /*
142615 ** 2005 May 25
142616 **
142617 ** The author disclaims copyright to this source code. In place of
142618 ** a legal notice, here is a blessing:
@@ -143702,11 +143616,10 @@
143702
143703 #endif /* SQLITE_OMIT_UTF16 */
143704
143705 /************** End of prepare.c *********************************************/
143706 /************** Begin file select.c ******************************************/
143707 #line 1 "tsrc/select.c"
143708 /*
143709 ** 2001 September 15
143710 **
143711 ** The author disclaims copyright to this source code. In place of
143712 ** a legal notice, here is a blessing:
@@ -152475,11 +152388,10 @@
152475 return rc;
152476 }
152477
152478 /************** End of select.c **********************************************/
152479 /************** Begin file table.c *******************************************/
152480 #line 1 "tsrc/table.c"
152481 /*
152482 ** 2001 September 15
152483 **
152484 ** The author disclaims copyright to this source code. In place of
152485 ** a legal notice, here is a blessing:
@@ -152677,11 +152589,10 @@
152677
152678 #endif /* SQLITE_OMIT_GET_TABLE */
152679
152680 /************** End of table.c ***********************************************/
152681 /************** Begin file trigger.c *****************************************/
152682 #line 1 "tsrc/trigger.c"
152683 /*
152684 **
152685 ** The author disclaims copyright to this source code. In place of
152686 ** a legal notice, here is a blessing:
152687 **
@@ -154244,11 +154155,10 @@
154244
154245 #endif /* !defined(SQLITE_OMIT_TRIGGER) */
154246
154247 /************** End of trigger.c *********************************************/
154248 /************** Begin file update.c ******************************************/
154249 #line 1 "tsrc/update.c"
154250 /*
154251 ** 2001 September 15
154252 **
154253 ** The author disclaims copyright to this source code. In place of
154254 ** a legal notice, here is a blessing:
@@ -155616,11 +155526,10 @@
155616 }
155617 #endif /* SQLITE_OMIT_VIRTUALTABLE */
155618
155619 /************** End of update.c **********************************************/
155620 /************** Begin file upsert.c ******************************************/
155621 #line 1 "tsrc/upsert.c"
155622 /*
155623 ** 2018-04-12
155624 **
155625 ** The author disclaims copyright to this source code. In place of
155626 ** a legal notice, here is a blessing:
@@ -155949,11 +155858,10 @@
155949
155950 #endif /* SQLITE_OMIT_UPSERT */
155951
155952 /************** End of upsert.c **********************************************/
155953 /************** Begin file vacuum.c ******************************************/
155954 #line 1 "tsrc/vacuum.c"
155955 /*
155956 ** 2003 April 6
155957 **
155958 ** The author disclaims copyright to this source code. In place of
155959 ** a legal notice, here is a blessing:
@@ -156371,11 +156279,10 @@
156371
156372 #endif /* SQLITE_OMIT_VACUUM && SQLITE_OMIT_ATTACH */
156373
156374 /************** End of vacuum.c **********************************************/
156375 /************** Begin file vtab.c ********************************************/
156376 #line 1 "tsrc/vtab.c"
156377 /*
156378 ** 2006 June 10
156379 **
156380 ** The author disclaims copyright to this source code. In place of
156381 ** a legal notice, here is a blessing:
@@ -157749,11 +157656,10 @@
157749
157750 #endif /* SQLITE_OMIT_VIRTUALTABLE */
157751
157752 /************** End of vtab.c ************************************************/
157753 /************** Begin file wherecode.c ***************************************/
157754 #line 1 "tsrc/wherecode.c"
157755 /*
157756 ** 2015-06-06
157757 **
157758 ** The author disclaims copyright to this source code. In place of
157759 ** a legal notice, here is a blessing:
@@ -157772,11 +157678,10 @@
157772 ** file retains the code that does query planning and analysis.
157773 */
157774 /* #include "sqliteInt.h" */
157775 /************** Include whereInt.h in the middle of wherecode.c **************/
157776 /************** Begin file whereInt.h ****************************************/
157777 #line 1 "tsrc/whereInt.h"
157778 /*
157779 ** 2013-11-12
157780 **
157781 ** The author disclaims copyright to this source code. In place of
157782 ** a legal notice, here is a blessing:
@@ -158429,11 +158334,10 @@
158429
158430 #endif /* !defined(SQLITE_WHEREINT_H) */
158431
158432 /************** End of whereInt.h ********************************************/
158433 /************** Continuing where we left off in wherecode.c ******************/
158434 #line 22 "tsrc/wherecode.c"
158435
158436 #ifndef SQLITE_OMIT_EXPLAIN
158437
158438 /*
158439 ** Return the name of the i-th column of the pIdx index.
@@ -161352,11 +161256,10 @@
161352 pParse->withinRJSubrtn--;
161353 }
161354
161355 /************** End of wherecode.c *******************************************/
161356 /************** Begin file whereexpr.c ***************************************/
161357 #line 1 "tsrc/whereexpr.c"
161358 /*
161359 ** 2015-06-08
161360 **
161361 ** The author disclaims copyright to this source code. In place of
161362 ** a legal notice, here is a blessing:
@@ -163258,11 +163161,10 @@
163258 }
163259 }
163260
163261 /************** End of whereexpr.c *******************************************/
163262 /************** Begin file where.c *******************************************/
163263 #line 1 "tsrc/where.c"
163264 /*
163265 ** 2001 September 15
163266 **
163267 ** The author disclaims copyright to this source code. In place of
163268 ** a legal notice, here is a blessing:
@@ -170759,11 +170661,10 @@
170759 return;
170760 }
170761
170762 /************** End of where.c ***********************************************/
170763 /************** Begin file window.c ******************************************/
170764 #line 1 "tsrc/window.c"
170765 /*
170766 ** 2018 May 08
170767 **
170768 ** The author disclaims copyright to this source code. In place of
170769 ** a legal notice, here is a blessing:
@@ -172432,10 +172333,11 @@
172432 for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
172433 FuncDef *pFunc = pWin->pWFunc;
172434 int regArg;
172435 int nArg = pWin->bExprArgs ? 0 : windowArgCount(pWin);
172436 int i;
 
172437
172438 assert( bInverse==0 || pWin->eStart!=TK_UNBOUNDED );
172439
172440 /* All OVER clauses in the same window function aggregate step must
172441 ** be the same. */
@@ -172447,10 +172349,22 @@
172447 }else{
172448 sqlite3VdbeAddOp3(v, OP_Column, pMWin->iEphCsr, pWin->iArgCol+i, reg+i);
172449 }
172450 }
172451 regArg = reg;
 
 
 
 
 
 
 
 
 
 
 
 
172452
172453 if( pMWin->regStartRowid==0
172454 && (pFunc->funcFlags & SQLITE_FUNC_MINMAX)
172455 && (pWin->eStart!=TK_UNBOUNDED)
172456 ){
@@ -172467,29 +172381,17 @@
172467 sqlite3VdbeAddOp1(v, OP_Delete, pWin->csrApp);
172468 sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2);
172469 }
172470 sqlite3VdbeJumpHere(v, addrIsNull);
172471 }else if( pWin->regApp ){
 
172472 assert( pFunc->zName==nth_valueName
172473 || pFunc->zName==first_valueName
172474 );
172475 assert( bInverse==0 || bInverse==1 );
172476 sqlite3VdbeAddOp2(v, OP_AddImm, pWin->regApp+1-bInverse, 1);
172477 }else if( pFunc->xSFunc!=noopStepFunc ){
172478 int addrIf = 0;
172479 if( pWin->pFilter ){
172480 int regTmp;
172481 assert( ExprUseXList(pWin->pOwner) );
172482 assert( pWin->bExprArgs || !nArg ||nArg==pWin->pOwner->x.pList->nExpr );
172483 assert( pWin->bExprArgs || nArg ||pWin->pOwner->x.pList==0 );
172484 regTmp = sqlite3GetTempReg(pParse);
172485 sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol+nArg,regTmp);
172486 addrIf = sqlite3VdbeAddOp3(v, OP_IfNot, regTmp, 0, 1);
172487 VdbeCoverage(v);
172488 sqlite3ReleaseTempReg(pParse, regTmp);
172489 }
172490
172491 if( pWin->bExprArgs ){
172492 int iOp = sqlite3VdbeCurrentAddr(v);
172493 int iEnd;
172494
172495 assert( ExprUseXList(pWin->pOwner) );
@@ -172516,12 +172418,13 @@
172516 sqlite3VdbeAppendP4(v, pFunc, P4_FUNCDEF);
172517 sqlite3VdbeChangeP5(v, (u8)nArg);
172518 if( pWin->bExprArgs ){
172519 sqlite3ReleaseTempRange(pParse, regArg, nArg);
172520 }
172521 if( addrIf ) sqlite3VdbeJumpHere(v, addrIf);
172522 }
 
 
172523 }
172524 }
172525
172526 /*
172527 ** Values that may be passed as the second argument to windowCodeOp().
@@ -173869,11 +173772,10 @@
173869
173870 #endif /* SQLITE_OMIT_WINDOWFUNC */
173871
173872 /************** End of window.c **********************************************/
173873 /************** Begin file parse.c *******************************************/
173874 #line 1 "tsrc/parse.c"
173875 /* This file is automatically generated by Lemon from input grammar
173876 ** source file "parse.y".
173877 */
173878 /*
173879 ** 2001-09-15
@@ -173893,11 +173795,10 @@
173893 ** That input file is processed by Lemon to generate a C-language
173894 ** implementation of a parser for the given grammar. You might be reading
173895 ** this comment as part of the translated C-code. Edits should be made
173896 ** to the original parse.y sources.
173897 */
173898 #line 62 "parse.y"
173899
173900 /* #include "sqliteInt.h" */
173901
173902 /*
173903 ** Disable all error recovery processing in the parser push-down
@@ -173977,11 +173878,10 @@
173977 sqlite3ExprListDelete(pParse->db, pOrderBy);
173978 sqlite3ExprDelete(pParse->db, pLimit);
173979 }
173980 #endif /* SQLITE_ENABLE_UPDATE_DELETE_LIMIT */
173981
173982 #line 517 "parse.y"
173983
173984 /*
173985 ** For a compound SELECT statement, make sure p->pPrior->pNext==p for
173986 ** all elements in the list. And make sure list length does not exceed
173987 ** SQLITE_LIMIT_COMPOUND_SELECT.
@@ -174032,11 +173932,10 @@
174032 ** testing.
174033 */
174034 static void *parserStackRealloc(void *pOld, sqlite3_uint64 newSize){
174035 return sqlite3FaultSim(700) ? 0 : sqlite3_realloc(pOld, newSize);
174036 }
174037 #line 1085 "parse.y"
174038
174039
174040 /* Construct a new Expr object from a single token */
174041 static Expr *tokenExpr(Parse *pParse, int op, Token t){
174042 Expr *p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr)+t.n+1);
@@ -174069,11 +173968,10 @@
174069 }
174070 }
174071 return p;
174072 }
174073
174074 #line 1329 "parse.y"
174075
174076 /* A routine to convert a binary TK_IS or TK_ISNOT expression into a
174077 ** unary TK_ISNULL or TK_NOTNULL expression. */
174078 static void binaryToUnaryIfNull(Parse *pParse, Expr *pY, Expr *pA, int op){
174079 sqlite3 *db = pParse->db;
@@ -174081,11 +173979,10 @@
174081 pA->op = (u8)op;
174082 sqlite3ExprDelete(db, pA->pRight);
174083 pA->pRight = 0;
174084 }
174085 }
174086 #line 1564 "parse.y"
174087
174088 /* Add a single new term to an ExprList that is used to store a
174089 ** list of identifiers. Report an error if the ID list contains
174090 ** a COLLATE clause or an ASC or DESC keyword, except ignore the
174091 ** error while parsing a legacy schema.
@@ -174105,16 +174002,14 @@
174105 pIdToken->n, pIdToken->z);
174106 }
174107 sqlite3ExprListSetName(pParse, p, pIdToken, 1);
174108 return p;
174109 }
174110 #line 2048 "parse.y"
174111
174112 #if TK_SPAN>255
174113 # error too many tokens in the grammar
174114 #endif
174115 #line 267 "parse.sql"
174116 /**************** End of %include directives **********************************/
174117 /* These constants specify the various numeric values for terminal symbols.
174118 ***************** Begin token definitions *************************************/
174119 #ifndef TK_SEMI
174120 #define TK_SEMI 1
@@ -176295,13 +176190,11 @@
176295 case 240: /* selectnowith */
176296 case 241: /* oneselect */
176297 case 253: /* values */
176298 case 255: /* mvalues */
176299 {
176300 #line 511 "parse.y"
176301 sqlite3SelectDelete(pParse->db, (yypminor->yy555));
176302 #line 2453 "parse.sql"
176303 }
176304 break;
176305 case 217: /* term */
176306 case 218: /* expr */
176307 case 247: /* where_opt */
@@ -176312,13 +176205,11 @@
176312 case 285: /* vinto */
176313 case 292: /* when_clause */
176314 case 297: /* key_opt */
176315 case 314: /* filter_clause */
176316 {
176317 #line 1083 "parse.y"
176318 sqlite3ExprDelete(pParse->db, (yypminor->yy454));
176319 #line 2470 "parse.sql"
176320 }
176321 break;
176322 case 222: /* eidlist_opt */
176323 case 232: /* sortlist */
176324 case 233: /* eidlist */
@@ -176331,82 +176222,64 @@
176331 case 270: /* setlist */
176332 case 279: /* paren_exprlist */
176333 case 281: /* case_exprlist */
176334 case 313: /* part_opt */
176335 {
176336 #line 1562 "parse.y"
176337 sqlite3ExprListDelete(pParse->db, (yypminor->yy14));
176338 #line 2489 "parse.sql"
176339 }
176340 break;
176341 case 239: /* fullname */
176342 case 246: /* from */
176343 case 258: /* seltablist */
176344 case 259: /* stl_prefix */
176345 case 264: /* xfullname */
176346 {
176347 #line 789 "parse.y"
176348 sqlite3SrcListDelete(pParse->db, (yypminor->yy203));
176349 #line 2500 "parse.sql"
176350 }
176351 break;
176352 case 242: /* wqlist */
176353 {
176354 #line 1849 "parse.y"
176355 sqlite3WithDelete(pParse->db, (yypminor->yy59));
176356 #line 2507 "parse.sql"
176357 }
176358 break;
176359 case 252: /* window_clause */
176360 case 309: /* windowdefn_list */
176361 {
176362 #line 1977 "parse.y"
176363 sqlite3WindowListDelete(pParse->db, (yypminor->yy211));
176364 #line 2515 "parse.sql"
176365 }
176366 break;
176367 case 265: /* idlist */
176368 case 272: /* idlist_opt */
176369 {
176370 #line 1068 "parse.y"
176371 sqlite3IdListDelete(pParse->db, (yypminor->yy132));
176372 #line 2523 "parse.sql"
176373 }
176374 break;
176375 case 275: /* filter_over */
176376 case 310: /* windowdefn */
176377 case 311: /* window */
176378 case 312: /* frame_opt */
176379 case 315: /* over_clause */
176380 {
176381 #line 1916 "parse.y"
176382 sqlite3WindowDelete(pParse->db, (yypminor->yy211));
176383 #line 2534 "parse.sql"
176384 }
176385 break;
176386 case 288: /* trigger_cmd_list */
176387 case 293: /* trigger_cmd */
176388 {
176389 #line 1677 "parse.y"
176390 sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy427));
176391 #line 2542 "parse.sql"
176392 }
176393 break;
176394 case 290: /* trigger_event */
176395 {
176396 #line 1663 "parse.y"
176397 sqlite3IdListDelete(pParse->db, (yypminor->yy286).b);
176398 #line 2549 "parse.sql"
176399 }
176400 break;
176401 case 317: /* frame_bound */
176402 case 318: /* frame_bound_s */
176403 case 319: /* frame_bound_e */
176404 {
176405 #line 1921 "parse.y"
176406 sqlite3ExprDelete(pParse->db, (yypminor->yy509).pExpr);
176407 #line 2558 "parse.sql"
176408 }
176409 break;
176410 /********* End destructor definitions *****************************************/
176411 default: break; /* If no destructor action specified: do nothing */
176412 }
@@ -176637,14 +176510,12 @@
176637 #endif
176638 while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
176639 /* Here code is inserted which will execute if the parser
176640 ** stack every overflows */
176641 /******** Begin %stack_overflow code ******************************************/
176642 #line 51 "parse.y"
176643
176644 sqlite3OomFault(pParse->db);
176645 #line 2796 "parse.sql"
176646 /******** End %stack_overflow code ********************************************/
176647 sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument var */
176648 sqlite3ParserCTX_STORE
176649 }
176650
@@ -177571,481 +177442,330 @@
177571 ** break;
177572 */
177573 /********** Begin reduce actions **********************************************/
177574 YYMINORTYPE yylhsminor;
177575 case 0: /* explain ::= EXPLAIN */
177576 #line 155 "parse.y"
177577 { if( pParse->pReprepare==0 ) pParse->explain = 1; }
177578 #line 3729 "parse.sql"
177579 break;
177580 case 1: /* explain ::= EXPLAIN QUERY PLAN */
177581 #line 156 "parse.y"
177582 { if( pParse->pReprepare==0 ) pParse->explain = 2; }
177583 #line 3734 "parse.sql"
177584 break;
177585 case 2: /* cmdx ::= cmd */
177586 #line 158 "parse.y"
177587 { sqlite3FinishCoding(pParse); }
177588 #line 3739 "parse.sql"
177589 break;
177590 case 3: /* cmd ::= BEGIN transtype trans_opt */
177591 #line 163 "parse.y"
177592 {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy144);}
177593 #line 3744 "parse.sql"
177594 break;
177595 case 4: /* transtype ::= */
177596 #line 168 "parse.y"
177597 {yymsp[1].minor.yy144 = TK_DEFERRED;}
177598 #line 3749 "parse.sql"
177599 break;
177600 case 5: /* transtype ::= DEFERRED */
177601 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
177602 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
177603 case 324: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==324);
177604 #line 169 "parse.y"
177605 {yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-X*/}
177606 #line 3757 "parse.sql"
177607 break;
177608 case 8: /* cmd ::= COMMIT|END trans_opt */
177609 case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
177610 #line 172 "parse.y"
177611 {sqlite3EndTransaction(pParse,yymsp[-1].major);}
177612 #line 3763 "parse.sql"
177613 break;
177614 case 10: /* cmd ::= SAVEPOINT nm */
177615 #line 177 "parse.y"
177616 {
177617 sqlite3Savepoint(pParse, SAVEPOINT_BEGIN, &yymsp[0].minor.yy0);
177618 }
177619 #line 3770 "parse.sql"
177620 break;
177621 case 11: /* cmd ::= RELEASE savepoint_opt nm */
177622 #line 180 "parse.y"
177623 {
177624 sqlite3Savepoint(pParse, SAVEPOINT_RELEASE, &yymsp[0].minor.yy0);
177625 }
177626 #line 3777 "parse.sql"
177627 break;
177628 case 12: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
177629 #line 183 "parse.y"
177630 {
177631 sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
177632 }
177633 #line 3784 "parse.sql"
177634 break;
177635 case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
177636 #line 190 "parse.y"
177637 {
177638 sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy144,0,0,yymsp[-2].minor.yy144);
177639 }
177640 #line 3791 "parse.sql"
177641 break;
177642 case 14: /* createkw ::= CREATE */
177643 #line 193 "parse.y"
177644 {disableLookaside(pParse);}
177645 #line 3796 "parse.sql"
177646 break;
177647 case 15: /* ifnotexists ::= */
177648 case 18: /* temp ::= */ yytestcase(yyruleno==18);
177649 case 47: /* autoinc ::= */ yytestcase(yyruleno==47);
177650 case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62);
177651 case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72);
177652 case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
177653 case 100: /* distinct ::= */ yytestcase(yyruleno==100);
177654 case 246: /* collate ::= */ yytestcase(yyruleno==246);
177655 #line 196 "parse.y"
177656 {yymsp[1].minor.yy144 = 0;}
177657 #line 3808 "parse.sql"
177658 break;
177659 case 16: /* ifnotexists ::= IF NOT EXISTS */
177660 #line 197 "parse.y"
177661 {yymsp[-2].minor.yy144 = 1;}
177662 #line 3813 "parse.sql"
177663 break;
177664 case 17: /* temp ::= TEMP */
177665 #line 200 "parse.y"
177666 {yymsp[0].minor.yy144 = pParse->db->init.busy==0;}
177667 #line 3818 "parse.sql"
177668 break;
177669 case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */
177670 #line 203 "parse.y"
177671 {
177672 sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy391,0);
177673 }
177674 #line 3825 "parse.sql"
177675 break;
177676 case 20: /* create_table_args ::= AS select */
177677 #line 206 "parse.y"
177678 {
177679 sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy555);
177680 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy555);
177681 }
177682 #line 3833 "parse.sql"
177683 break;
177684 case 21: /* table_option_set ::= */
177685 #line 212 "parse.y"
177686 {yymsp[1].minor.yy391 = 0;}
177687 #line 3838 "parse.sql"
177688 break;
177689 case 22: /* table_option_set ::= table_option_set COMMA table_option */
177690 #line 214 "parse.y"
177691 {yylhsminor.yy391 = yymsp[-2].minor.yy391|yymsp[0].minor.yy391;}
177692 #line 3843 "parse.sql"
177693 yymsp[-2].minor.yy391 = yylhsminor.yy391;
177694 break;
177695 case 23: /* table_option ::= WITHOUT nm */
177696 #line 215 "parse.y"
177697 {
177698 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
177699 yymsp[-1].minor.yy391 = TF_WithoutRowid | TF_NoVisibleRowid;
177700 }else{
177701 yymsp[-1].minor.yy391 = 0;
177702 sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
177703 }
177704 }
177705 #line 3856 "parse.sql"
177706 break;
177707 case 24: /* table_option ::= nm */
177708 #line 223 "parse.y"
177709 {
177710 if( yymsp[0].minor.yy0.n==6 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"strict",6)==0 ){
177711 yylhsminor.yy391 = TF_Strict;
177712 }else{
177713 yylhsminor.yy391 = 0;
177714 sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
177715 }
177716 }
177717 #line 3868 "parse.sql"
177718 yymsp[0].minor.yy391 = yylhsminor.yy391;
177719 break;
177720 case 25: /* columnname ::= nm typetoken */
177721 #line 233 "parse.y"
177722 {sqlite3AddColumn(pParse,yymsp[-1].minor.yy0,yymsp[0].minor.yy0);}
177723 #line 3874 "parse.sql"
177724 break;
177725 case 26: /* typetoken ::= */
177726 case 65: /* conslist_opt ::= */ yytestcase(yyruleno==65);
177727 case 106: /* as ::= */ yytestcase(yyruleno==106);
177728 #line 327 "parse.y"
177729 {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;}
177730 #line 3881 "parse.sql"
177731 break;
177732 case 27: /* typetoken ::= typename LP signed RP */
177733 #line 329 "parse.y"
177734 {
177735 yymsp[-3].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z);
177736 }
177737 #line 3888 "parse.sql"
177738 break;
177739 case 28: /* typetoken ::= typename LP signed COMMA signed RP */
177740 #line 332 "parse.y"
177741 {
177742 yymsp[-5].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy0.z);
177743 }
177744 #line 3895 "parse.sql"
177745 break;
177746 case 29: /* typename ::= typename ID|STRING */
177747 #line 337 "parse.y"
177748 {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
177749 #line 3900 "parse.sql"
177750 break;
177751 case 30: /* scanpt ::= */
177752 #line 355 "parse.y"
177753 {
177754 assert( yyLookahead!=YYNOCODE );
177755 yymsp[1].minor.yy168 = yyLookaheadToken.z;
177756 }
177757 #line 3908 "parse.sql"
177758 break;
177759 case 31: /* scantok ::= */
177760 #line 359 "parse.y"
177761 {
177762 assert( yyLookahead!=YYNOCODE );
177763 yymsp[1].minor.yy0 = yyLookaheadToken;
177764 }
177765 #line 3916 "parse.sql"
177766 break;
177767 case 32: /* ccons ::= CONSTRAINT nm */
177768 case 67: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==67);
177769 #line 369 "parse.y"
177770 {pParse->constraintName = yymsp[0].minor.yy0;}
177771 #line 3922 "parse.sql"
177772 break;
177773 case 33: /* ccons ::= DEFAULT scantok term */
177774 #line 371 "parse.y"
177775 {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
177776 #line 3927 "parse.sql"
177777 break;
177778 case 34: /* ccons ::= DEFAULT LP expr RP */
177779 #line 373 "parse.y"
177780 {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy454,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
177781 #line 3932 "parse.sql"
177782 break;
177783 case 35: /* ccons ::= DEFAULT PLUS scantok term */
177784 #line 375 "parse.y"
177785 {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
177786 #line 3937 "parse.sql"
177787 break;
177788 case 36: /* ccons ::= DEFAULT MINUS scantok term */
177789 #line 376 "parse.y"
177790 {
177791 Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy454, 0);
177792 sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);
177793 }
177794 #line 3945 "parse.sql"
177795 break;
177796 case 37: /* ccons ::= DEFAULT scantok ID|INDEXED */
177797 #line 380 "parse.y"
177798 {
177799 Expr *p = tokenExpr(pParse, TK_STRING, yymsp[0].minor.yy0);
177800 if( p ){
177801 sqlite3ExprIdToTrueFalse(p);
177802 testcase( p->op==TK_TRUEFALSE && sqlite3ExprTruthValue(p) );
177803 }
177804 sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n);
177805 }
177806 #line 3957 "parse.sql"
177807 break;
177808 case 38: /* ccons ::= NOT NULL onconf */
177809 #line 393 "parse.y"
177810 {sqlite3AddNotNull(pParse, yymsp[0].minor.yy144);}
177811 #line 3962 "parse.sql"
177812 break;
177813 case 39: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
177814 #line 395 "parse.y"
177815 {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy144,yymsp[0].minor.yy144,yymsp[-2].minor.yy144);}
177816 #line 3967 "parse.sql"
177817 break;
177818 case 40: /* ccons ::= UNIQUE onconf */
177819 #line 396 "parse.y"
177820 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy144,0,0,0,0,
177821 SQLITE_IDXTYPE_UNIQUE);}
177822 #line 3973 "parse.sql"
177823 break;
177824 case 41: /* ccons ::= CHECK LP expr RP */
177825 #line 398 "parse.y"
177826 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy454,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
177827 #line 3978 "parse.sql"
177828 break;
177829 case 42: /* ccons ::= REFERENCES nm eidlist_opt refargs */
177830 #line 400 "parse.y"
177831 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy14,yymsp[0].minor.yy144);}
177832 #line 3983 "parse.sql"
177833 break;
177834 case 43: /* ccons ::= defer_subclause */
177835 #line 401 "parse.y"
177836 {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy144);}
177837 #line 3988 "parse.sql"
177838 break;
177839 case 44: /* ccons ::= COLLATE ID|STRING */
177840 #line 402 "parse.y"
177841 {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
177842 #line 3993 "parse.sql"
177843 break;
177844 case 45: /* generated ::= LP expr RP */
177845 #line 405 "parse.y"
177846 {sqlite3AddGenerated(pParse,yymsp[-1].minor.yy454,0);}
177847 #line 3998 "parse.sql"
177848 break;
177849 case 46: /* generated ::= LP expr RP ID */
177850 #line 406 "parse.y"
177851 {sqlite3AddGenerated(pParse,yymsp[-2].minor.yy454,&yymsp[0].minor.yy0);}
177852 #line 4003 "parse.sql"
177853 break;
177854 case 48: /* autoinc ::= AUTOINCR */
177855 #line 411 "parse.y"
177856 {yymsp[0].minor.yy144 = 1;}
177857 #line 4008 "parse.sql"
177858 break;
177859 case 49: /* refargs ::= */
177860 #line 419 "parse.y"
177861 { yymsp[1].minor.yy144 = OE_None*0x0101; /* EV: R-19803-45884 */}
177862 #line 4013 "parse.sql"
177863 break;
177864 case 50: /* refargs ::= refargs refarg */
177865 #line 420 "parse.y"
177866 { yymsp[-1].minor.yy144 = (yymsp[-1].minor.yy144 & ~yymsp[0].minor.yy383.mask) | yymsp[0].minor.yy383.value; }
177867 #line 4018 "parse.sql"
177868 break;
177869 case 51: /* refarg ::= MATCH nm */
177870 #line 422 "parse.y"
177871 { yymsp[-1].minor.yy383.value = 0; yymsp[-1].minor.yy383.mask = 0x000000; }
177872 #line 4023 "parse.sql"
177873 break;
177874 case 52: /* refarg ::= ON INSERT refact */
177875 #line 423 "parse.y"
177876 { yymsp[-2].minor.yy383.value = 0; yymsp[-2].minor.yy383.mask = 0x000000; }
177877 #line 4028 "parse.sql"
177878 break;
177879 case 53: /* refarg ::= ON DELETE refact */
177880 #line 424 "parse.y"
177881 { yymsp[-2].minor.yy383.value = yymsp[0].minor.yy144; yymsp[-2].minor.yy383.mask = 0x0000ff; }
177882 #line 4033 "parse.sql"
177883 break;
177884 case 54: /* refarg ::= ON UPDATE refact */
177885 #line 425 "parse.y"
177886 { yymsp[-2].minor.yy383.value = yymsp[0].minor.yy144<<8; yymsp[-2].minor.yy383.mask = 0x00ff00; }
177887 #line 4038 "parse.sql"
177888 break;
177889 case 55: /* refact ::= SET NULL */
177890 #line 427 "parse.y"
177891 { yymsp[-1].minor.yy144 = OE_SetNull; /* EV: R-33326-45252 */}
177892 #line 4043 "parse.sql"
177893 break;
177894 case 56: /* refact ::= SET DEFAULT */
177895 #line 428 "parse.y"
177896 { yymsp[-1].minor.yy144 = OE_SetDflt; /* EV: R-33326-45252 */}
177897 #line 4048 "parse.sql"
177898 break;
177899 case 57: /* refact ::= CASCADE */
177900 #line 429 "parse.y"
177901 { yymsp[0].minor.yy144 = OE_Cascade; /* EV: R-33326-45252 */}
177902 #line 4053 "parse.sql"
177903 break;
177904 case 58: /* refact ::= RESTRICT */
177905 #line 430 "parse.y"
177906 { yymsp[0].minor.yy144 = OE_Restrict; /* EV: R-33326-45252 */}
177907 #line 4058 "parse.sql"
177908 break;
177909 case 59: /* refact ::= NO ACTION */
177910 #line 431 "parse.y"
177911 { yymsp[-1].minor.yy144 = OE_None; /* EV: R-33326-45252 */}
177912 #line 4063 "parse.sql"
177913 break;
177914 case 60: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
177915 #line 433 "parse.y"
177916 {yymsp[-2].minor.yy144 = 0;}
177917 #line 4068 "parse.sql"
177918 break;
177919 case 61: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
177920 case 76: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==76);
177921 case 173: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==173);
177922 #line 434 "parse.y"
177923 {yymsp[-1].minor.yy144 = yymsp[0].minor.yy144;}
177924 #line 4075 "parse.sql"
177925 break;
177926 case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
177927 case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
177928 case 219: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==219);
177929 case 222: /* in_op ::= NOT IN */ yytestcase(yyruleno==222);
177930 case 247: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==247);
177931 #line 437 "parse.y"
177932 {yymsp[-1].minor.yy144 = 1;}
177933 #line 4084 "parse.sql"
177934 break;
177935 case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
177936 #line 438 "parse.y"
177937 {yymsp[-1].minor.yy144 = 0;}
177938 #line 4089 "parse.sql"
177939 break;
177940 case 66: /* tconscomma ::= COMMA */
177941 #line 444 "parse.y"
177942 {pParse->constraintName.n = 0;}
177943 #line 4094 "parse.sql"
177944 break;
177945 case 68: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
177946 #line 448 "parse.y"
177947 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy14,yymsp[0].minor.yy144,yymsp[-2].minor.yy144,0);}
177948 #line 4099 "parse.sql"
177949 break;
177950 case 69: /* tcons ::= UNIQUE LP sortlist RP onconf */
177951 #line 450 "parse.y"
177952 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy14,yymsp[0].minor.yy144,0,0,0,0,
177953 SQLITE_IDXTYPE_UNIQUE);}
177954 #line 4105 "parse.sql"
177955 break;
177956 case 70: /* tcons ::= CHECK LP expr RP onconf */
177957 #line 453 "parse.y"
177958 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy454,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
177959 #line 4110 "parse.sql"
177960 break;
177961 case 71: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
177962 #line 455 "parse.y"
177963 {
177964 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy14, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy14, yymsp[-1].minor.yy144);
177965 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy144);
177966 }
177967 #line 4118 "parse.sql"
177968 break;
177969 case 73: /* onconf ::= */
177970 case 75: /* orconf ::= */ yytestcase(yyruleno==75);
177971 #line 469 "parse.y"
177972 {yymsp[1].minor.yy144 = OE_Default;}
177973 #line 4124 "parse.sql"
177974 break;
177975 case 74: /* onconf ::= ON CONFLICT resolvetype */
177976 #line 470 "parse.y"
177977 {yymsp[-2].minor.yy144 = yymsp[0].minor.yy144;}
177978 #line 4129 "parse.sql"
177979 break;
177980 case 77: /* resolvetype ::= IGNORE */
177981 #line 474 "parse.y"
177982 {yymsp[0].minor.yy144 = OE_Ignore;}
177983 #line 4134 "parse.sql"
177984 break;
177985 case 78: /* resolvetype ::= REPLACE */
177986 case 174: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==174);
177987 #line 475 "parse.y"
177988 {yymsp[0].minor.yy144 = OE_Replace;}
177989 #line 4140 "parse.sql"
177990 break;
177991 case 79: /* cmd ::= DROP TABLE ifexists fullname */
177992 #line 479 "parse.y"
177993 {
177994 sqlite3DropTable(pParse, yymsp[0].minor.yy203, 0, yymsp[-1].minor.yy144);
177995 }
177996 #line 4147 "parse.sql"
177997 break;
177998 case 82: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
177999 #line 490 "parse.y"
178000 {
178001 sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy14, yymsp[0].minor.yy555, yymsp[-7].minor.yy144, yymsp[-5].minor.yy144);
178002 }
178003 #line 4154 "parse.sql"
178004 break;
178005 case 83: /* cmd ::= DROP VIEW ifexists fullname */
178006 #line 493 "parse.y"
178007 {
178008 sqlite3DropTable(pParse, yymsp[0].minor.yy203, 1, yymsp[-1].minor.yy144);
178009 }
178010 #line 4161 "parse.sql"
178011 break;
178012 case 84: /* cmd ::= select */
178013 #line 500 "parse.y"
178014 {
178015 SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0};
178016 if( (pParse->db->mDbFlags & DBFLAG_EncodingFixed)!=0
178017 || sqlite3ReadSchema(pParse)==SQLITE_OK
178018 ){
178019 sqlite3Select(pParse, yymsp[0].minor.yy555, &dest);
178020 }
178021 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy555);
178022 }
178023 #line 4174 "parse.sql"
178024 break;
178025 case 85: /* select ::= WITH wqlist selectnowith */
178026 #line 574 "parse.y"
178027 {yymsp[-2].minor.yy555 = attachWithToSelect(pParse,yymsp[0].minor.yy555,yymsp[-1].minor.yy59);}
178028 #line 4179 "parse.sql"
178029 break;
178030 case 86: /* select ::= WITH RECURSIVE wqlist selectnowith */
178031 #line 576 "parse.y"
178032 {yymsp[-3].minor.yy555 = attachWithToSelect(pParse,yymsp[0].minor.yy555,yymsp[-1].minor.yy59);}
178033 #line 4184 "parse.sql"
178034 break;
178035 case 87: /* select ::= selectnowith */
178036 #line 579 "parse.y"
178037 {
178038 Select *p = yymsp[0].minor.yy555;
178039 if( p ){
178040 parserDoubleLinkSelect(pParse, p);
178041 }
178042 }
178043 #line 4194 "parse.sql"
178044 break;
178045 case 88: /* selectnowith ::= selectnowith multiselect_op oneselect */
178046 #line 588 "parse.y"
178047 {
178048 Select *pRhs = yymsp[0].minor.yy555;
178049 Select *pLhs = yymsp[-2].minor.yy555;
178050 if( pRhs && pRhs->pPrior ){
178051 SrcList *pFrom;
@@ -178064,175 +177784,131 @@
178064 }else{
178065 sqlite3SelectDelete(pParse->db, pLhs);
178066 }
178067 yymsp[-2].minor.yy555 = pRhs;
178068 }
178069 #line 4220 "parse.sql"
178070 break;
178071 case 89: /* multiselect_op ::= UNION */
178072 case 91: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==91);
178073 #line 611 "parse.y"
178074 {yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-OP*/}
178075 #line 4226 "parse.sql"
178076 break;
178077 case 90: /* multiselect_op ::= UNION ALL */
178078 #line 612 "parse.y"
178079 {yymsp[-1].minor.yy144 = TK_ALL;}
178080 #line 4231 "parse.sql"
178081 break;
178082 case 92: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
178083 #line 618 "parse.y"
178084 {
178085 yymsp[-8].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy14,yymsp[-5].minor.yy203,yymsp[-4].minor.yy454,yymsp[-3].minor.yy14,yymsp[-2].minor.yy454,yymsp[-1].minor.yy14,yymsp[-7].minor.yy144,yymsp[0].minor.yy454);
178086 }
178087 #line 4238 "parse.sql"
178088 break;
178089 case 93: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
178090 #line 624 "parse.y"
178091 {
178092 yymsp[-9].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy14,yymsp[-6].minor.yy203,yymsp[-5].minor.yy454,yymsp[-4].minor.yy14,yymsp[-3].minor.yy454,yymsp[-1].minor.yy14,yymsp[-8].minor.yy144,yymsp[0].minor.yy454);
178093 if( yymsp[-9].minor.yy555 ){
178094 yymsp[-9].minor.yy555->pWinDefn = yymsp[-2].minor.yy211;
178095 }else{
178096 sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy211);
178097 }
178098 }
178099 #line 4250 "parse.sql"
178100 break;
178101 case 94: /* values ::= VALUES LP nexprlist RP */
178102 #line 640 "parse.y"
178103 {
178104 yymsp[-3].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy14,0,0,0,0,0,SF_Values,0);
178105 }
178106 #line 4257 "parse.sql"
178107 break;
178108 case 95: /* oneselect ::= mvalues */
178109 #line 647 "parse.y"
178110 {
178111 sqlite3MultiValuesEnd(pParse, yymsp[0].minor.yy555);
178112 }
178113 #line 4264 "parse.sql"
178114 break;
178115 case 96: /* mvalues ::= values COMMA LP nexprlist RP */
178116 case 97: /* mvalues ::= mvalues COMMA LP nexprlist RP */ yytestcase(yyruleno==97);
178117 #line 651 "parse.y"
178118 {
178119 yymsp[-4].minor.yy555 = sqlite3MultiValues(pParse, yymsp[-4].minor.yy555, yymsp[-1].minor.yy14);
178120 }
178121 #line 4272 "parse.sql"
178122 break;
178123 case 98: /* distinct ::= DISTINCT */
178124 #line 662 "parse.y"
178125 {yymsp[0].minor.yy144 = SF_Distinct;}
178126 #line 4277 "parse.sql"
178127 break;
178128 case 99: /* distinct ::= ALL */
178129 #line 663 "parse.y"
178130 {yymsp[0].minor.yy144 = SF_All;}
178131 #line 4282 "parse.sql"
178132 break;
178133 case 101: /* sclp ::= */
178134 case 134: /* orderby_opt ::= */ yytestcase(yyruleno==134);
178135 case 144: /* groupby_opt ::= */ yytestcase(yyruleno==144);
178136 case 234: /* exprlist ::= */ yytestcase(yyruleno==234);
178137 case 237: /* paren_exprlist ::= */ yytestcase(yyruleno==237);
178138 case 242: /* eidlist_opt ::= */ yytestcase(yyruleno==242);
178139 #line 676 "parse.y"
178140 {yymsp[1].minor.yy14 = 0;}
178141 #line 4292 "parse.sql"
178142 break;
178143 case 102: /* selcollist ::= sclp scanpt expr scanpt as */
178144 #line 677 "parse.y"
178145 {
178146 yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy14, yymsp[-2].minor.yy454);
178147 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy14, &yymsp[0].minor.yy0, 1);
178148 sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy14,yymsp[-3].minor.yy168,yymsp[-1].minor.yy168);
178149 }
178150 #line 4301 "parse.sql"
178151 break;
178152 case 103: /* selcollist ::= sclp scanpt STAR */
178153 #line 682 "parse.y"
178154 {
178155 Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
178156 sqlite3ExprSetErrorOffset(p, (int)(yymsp[0].minor.yy0.z - pParse->zTail));
178157 yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy14, p);
178158 }
178159 #line 4310 "parse.sql"
178160 break;
178161 case 104: /* selcollist ::= sclp scanpt nm DOT STAR */
178162 #line 687 "parse.y"
178163 {
178164 Expr *pRight, *pLeft, *pDot;
178165 pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
178166 sqlite3ExprSetErrorOffset(pRight, (int)(yymsp[0].minor.yy0.z - pParse->zTail));
178167 pLeft = tokenExpr(pParse, TK_ID, yymsp[-2].minor.yy0);
178168 pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
178169 yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, pDot);
178170 }
178171 #line 4322 "parse.sql"
178172 break;
178173 case 105: /* as ::= AS nm */
178174 case 117: /* dbnm ::= DOT nm */ yytestcase(yyruleno==117);
178175 case 258: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==258);
178176 case 259: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==259);
178177 #line 700 "parse.y"
178178 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
178179 #line 4330 "parse.sql"
178180 break;
178181 case 107: /* from ::= */
178182 case 110: /* stl_prefix ::= */ yytestcase(yyruleno==110);
178183 #line 714 "parse.y"
178184 {yymsp[1].minor.yy203 = 0;}
178185 #line 4336 "parse.sql"
178186 break;
178187 case 108: /* from ::= FROM seltablist */
178188 #line 715 "parse.y"
178189 {
178190 yymsp[-1].minor.yy203 = yymsp[0].minor.yy203;
178191 sqlite3SrcListShiftJoinType(pParse,yymsp[-1].minor.yy203);
178192 }
178193 #line 4344 "parse.sql"
178194 break;
178195 case 109: /* stl_prefix ::= seltablist joinop */
178196 #line 723 "parse.y"
178197 {
178198 if( ALWAYS(yymsp[-1].minor.yy203 && yymsp[-1].minor.yy203->nSrc>0) ) yymsp[-1].minor.yy203->a[yymsp[-1].minor.yy203->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy144;
178199 }
178200 #line 4351 "parse.sql"
178201 break;
178202 case 111: /* seltablist ::= stl_prefix nm dbnm as on_using */
178203 #line 727 "parse.y"
178204 {
178205 yymsp[-4].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-4].minor.yy203,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269);
178206 }
178207 #line 4358 "parse.sql"
178208 break;
178209 case 112: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */
178210 #line 730 "parse.y"
178211 {
178212 yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,0,&yymsp[0].minor.yy269);
178213 sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy203, &yymsp[-1].minor.yy0);
178214 }
178215 #line 4366 "parse.sql"
178216 break;
178217 case 113: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */
178218 #line 734 "parse.y"
178219 {
178220 yymsp[-7].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-7].minor.yy203,&yymsp[-6].minor.yy0,&yymsp[-5].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269);
178221 sqlite3SrcListFuncArgs(pParse, yymsp[-7].minor.yy203, yymsp[-3].minor.yy14);
178222 }
178223 #line 4374 "parse.sql"
178224 break;
178225 case 114: /* seltablist ::= stl_prefix LP select RP as on_using */
178226 #line 739 "parse.y"
178227 {
178228 yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,yymsp[-3].minor.yy555,&yymsp[0].minor.yy269);
178229 }
178230 #line 4381 "parse.sql"
178231 break;
178232 case 115: /* seltablist ::= stl_prefix LP seltablist RP as on_using */
178233 #line 742 "parse.y"
178234 {
178235 if( yymsp[-5].minor.yy203==0 && yymsp[-1].minor.yy0.n==0 && yymsp[0].minor.yy269.pOn==0 && yymsp[0].minor.yy269.pUsing==0 ){
178236 yymsp[-5].minor.yy203 = yymsp[-3].minor.yy203;
178237 }else if( ALWAYS(yymsp[-3].minor.yy203!=0) && yymsp[-3].minor.yy203->nSrc==1 ){
178238 yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269);
@@ -178269,210 +177945,144 @@
178269 sqlite3SrcListShiftJoinType(pParse,yymsp[-3].minor.yy203);
178270 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-3].minor.yy203,0,0,0,0,SF_NestedFrom,0);
178271 yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,pSubquery,&yymsp[0].minor.yy269);
178272 }
178273 }
178274 #line 4425 "parse.sql"
178275 break;
178276 case 116: /* dbnm ::= */
178277 case 131: /* indexed_opt ::= */ yytestcase(yyruleno==131);
178278 #line 785 "parse.y"
178279 {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
178280 #line 4431 "parse.sql"
178281 break;
178282 case 118: /* fullname ::= nm */
178283 #line 790 "parse.y"
178284 {
178285 yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
178286 if( IN_RENAME_OBJECT && yylhsminor.yy203 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[0].minor.yy0);
178287 }
178288 #line 4439 "parse.sql"
178289 yymsp[0].minor.yy203 = yylhsminor.yy203;
178290 break;
178291 case 119: /* fullname ::= nm DOT nm */
178292 #line 794 "parse.y"
178293 {
178294 yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
178295 if( IN_RENAME_OBJECT && yylhsminor.yy203 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[0].minor.yy0);
178296 }
178297 #line 4448 "parse.sql"
178298 yymsp[-2].minor.yy203 = yylhsminor.yy203;
178299 break;
178300 case 120: /* xfullname ::= nm */
178301 #line 802 "parse.y"
178302 {yymsp[0].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
178303 #line 4454 "parse.sql"
178304 break;
178305 case 121: /* xfullname ::= nm DOT nm */
178306 #line 804 "parse.y"
178307 {yymsp[-2].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
178308 #line 4459 "parse.sql"
178309 break;
178310 case 122: /* xfullname ::= nm DOT nm AS nm */
178311 #line 805 "parse.y"
178312 {
178313 yymsp[-4].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
178314 if( yymsp[-4].minor.yy203 ) yymsp[-4].minor.yy203->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
178315 }
178316 #line 4467 "parse.sql"
178317 break;
178318 case 123: /* xfullname ::= nm AS nm */
178319 #line 809 "parse.y"
178320 {
178321 yymsp[-2].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
178322 if( yymsp[-2].minor.yy203 ) yymsp[-2].minor.yy203->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
178323 }
178324 #line 4475 "parse.sql"
178325 break;
178326 case 124: /* joinop ::= COMMA|JOIN */
178327 #line 815 "parse.y"
178328 { yymsp[0].minor.yy144 = JT_INNER; }
178329 #line 4480 "parse.sql"
178330 break;
178331 case 125: /* joinop ::= JOIN_KW JOIN */
178332 #line 817 "parse.y"
178333 {yymsp[-1].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
178334 #line 4485 "parse.sql"
178335 break;
178336 case 126: /* joinop ::= JOIN_KW nm JOIN */
178337 #line 819 "parse.y"
178338 {yymsp[-2].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
178339 #line 4490 "parse.sql"
178340 break;
178341 case 127: /* joinop ::= JOIN_KW nm nm JOIN */
178342 #line 821 "parse.y"
178343 {yymsp[-3].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
178344 #line 4495 "parse.sql"
178345 break;
178346 case 128: /* on_using ::= ON expr */
178347 #line 842 "parse.y"
178348 {yymsp[-1].minor.yy269.pOn = yymsp[0].minor.yy454; yymsp[-1].minor.yy269.pUsing = 0;}
178349 #line 4500 "parse.sql"
178350 break;
178351 case 129: /* on_using ::= USING LP idlist RP */
178352 #line 843 "parse.y"
178353 {yymsp[-3].minor.yy269.pOn = 0; yymsp[-3].minor.yy269.pUsing = yymsp[-1].minor.yy132;}
178354 #line 4505 "parse.sql"
178355 break;
178356 case 130: /* on_using ::= */
178357 #line 844 "parse.y"
178358 {yymsp[1].minor.yy269.pOn = 0; yymsp[1].minor.yy269.pUsing = 0;}
178359 #line 4510 "parse.sql"
178360 break;
178361 case 132: /* indexed_by ::= INDEXED BY nm */
178362 #line 860 "parse.y"
178363 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
178364 #line 4515 "parse.sql"
178365 break;
178366 case 133: /* indexed_by ::= NOT INDEXED */
178367 #line 861 "parse.y"
178368 {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
178369 #line 4520 "parse.sql"
178370 break;
178371 case 135: /* orderby_opt ::= ORDER BY sortlist */
178372 case 145: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==145);
178373 #line 874 "parse.y"
178374 {yymsp[-2].minor.yy14 = yymsp[0].minor.yy14;}
178375 #line 4526 "parse.sql"
178376 break;
178377 case 136: /* sortlist ::= sortlist COMMA expr sortorder nulls */
178378 #line 875 "parse.y"
178379 {
178380 yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14,yymsp[-2].minor.yy454);
178381 sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy14,yymsp[-1].minor.yy144,yymsp[0].minor.yy144);
178382 }
178383 #line 4534 "parse.sql"
178384 break;
178385 case 137: /* sortlist ::= expr sortorder nulls */
178386 #line 879 "parse.y"
178387 {
178388 yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy454); /*A-overwrites-Y*/
178389 sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy14,yymsp[-1].minor.yy144,yymsp[0].minor.yy144);
178390 }
178391 #line 4542 "parse.sql"
178392 break;
178393 case 138: /* sortorder ::= ASC */
178394 #line 886 "parse.y"
178395 {yymsp[0].minor.yy144 = SQLITE_SO_ASC;}
178396 #line 4547 "parse.sql"
178397 break;
178398 case 139: /* sortorder ::= DESC */
178399 #line 887 "parse.y"
178400 {yymsp[0].minor.yy144 = SQLITE_SO_DESC;}
178401 #line 4552 "parse.sql"
178402 break;
178403 case 140: /* sortorder ::= */
178404 case 143: /* nulls ::= */ yytestcase(yyruleno==143);
178405 #line 888 "parse.y"
178406 {yymsp[1].minor.yy144 = SQLITE_SO_UNDEFINED;}
178407 #line 4558 "parse.sql"
178408 break;
178409 case 141: /* nulls ::= NULLS FIRST */
178410 #line 891 "parse.y"
178411 {yymsp[-1].minor.yy144 = SQLITE_SO_ASC;}
178412 #line 4563 "parse.sql"
178413 break;
178414 case 142: /* nulls ::= NULLS LAST */
178415 #line 892 "parse.y"
178416 {yymsp[-1].minor.yy144 = SQLITE_SO_DESC;}
178417 #line 4568 "parse.sql"
178418 break;
178419 case 146: /* having_opt ::= */
178420 case 148: /* limit_opt ::= */ yytestcase(yyruleno==148);
178421 case 153: /* where_opt ::= */ yytestcase(yyruleno==153);
178422 case 155: /* where_opt_ret ::= */ yytestcase(yyruleno==155);
178423 case 232: /* case_else ::= */ yytestcase(yyruleno==232);
178424 case 233: /* case_operand ::= */ yytestcase(yyruleno==233);
178425 case 252: /* vinto ::= */ yytestcase(yyruleno==252);
178426 #line 902 "parse.y"
178427 {yymsp[1].minor.yy454 = 0;}
178428 #line 4579 "parse.sql"
178429 break;
178430 case 147: /* having_opt ::= HAVING expr */
178431 case 154: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==154);
178432 case 156: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==156);
178433 case 231: /* case_else ::= ELSE expr */ yytestcase(yyruleno==231);
178434 case 251: /* vinto ::= INTO expr */ yytestcase(yyruleno==251);
178435 #line 903 "parse.y"
178436 {yymsp[-1].minor.yy454 = yymsp[0].minor.yy454;}
178437 #line 4588 "parse.sql"
178438 break;
178439 case 149: /* limit_opt ::= LIMIT expr */
178440 #line 917 "parse.y"
178441 {yymsp[-1].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy454,0);}
178442 #line 4593 "parse.sql"
178443 break;
178444 case 150: /* limit_opt ::= LIMIT expr OFFSET expr */
178445 #line 919 "parse.y"
178446 {yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
178447 #line 4598 "parse.sql"
178448 break;
178449 case 151: /* limit_opt ::= LIMIT expr COMMA expr */
178450 #line 921 "parse.y"
178451 {yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy454,yymsp[-2].minor.yy454);}
178452 #line 4603 "parse.sql"
178453 break;
178454 case 152: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
178455 #line 939 "parse.y"
178456 {
178457 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy203, &yymsp[-1].minor.yy0);
178458 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy203,yymsp[0].minor.yy454,0,0);
178459 }
178460 #line 4611 "parse.sql"
178461 break;
178462 case 157: /* where_opt_ret ::= RETURNING selcollist */
178463 #line 955 "parse.y"
178464 {sqlite3AddReturning(pParse,yymsp[0].minor.yy14); yymsp[-1].minor.yy454 = 0;}
178465 #line 4616 "parse.sql"
178466 break;
178467 case 158: /* where_opt_ret ::= WHERE expr RETURNING selcollist */
178468 #line 957 "parse.y"
178469 {sqlite3AddReturning(pParse,yymsp[0].minor.yy14); yymsp[-3].minor.yy454 = yymsp[-2].minor.yy454;}
178470 #line 4621 "parse.sql"
178471 break;
178472 case 159: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
178473 #line 989 "parse.y"
178474 {
178475 sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy203, &yymsp[-4].minor.yy0);
178476 sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy14,"set list");
178477 if( yymsp[-1].minor.yy203 ){
178478 SrcList *pFromClause = yymsp[-1].minor.yy203;
@@ -178486,134 +178096,92 @@
178486 }
178487 yymsp[-5].minor.yy203 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy203, pFromClause);
178488 }
178489 sqlite3Update(pParse,yymsp[-5].minor.yy203,yymsp[-2].minor.yy14,yymsp[0].minor.yy454,yymsp[-6].minor.yy144,0,0,0);
178490 }
178491 #line 4642 "parse.sql"
178492 break;
178493 case 160: /* setlist ::= setlist COMMA nm EQ expr */
178494 #line 1013 "parse.y"
178495 {
178496 yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy14, yymsp[0].minor.yy454);
178497 sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy14, &yymsp[-2].minor.yy0, 1);
178498 }
178499 #line 4650 "parse.sql"
178500 break;
178501 case 161: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
178502 #line 1017 "parse.y"
178503 {
178504 yymsp[-6].minor.yy14 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy14, yymsp[-3].minor.yy132, yymsp[0].minor.yy454);
178505 }
178506 #line 4657 "parse.sql"
178507 break;
178508 case 162: /* setlist ::= nm EQ expr */
178509 #line 1020 "parse.y"
178510 {
178511 yylhsminor.yy14 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy454);
178512 sqlite3ExprListSetName(pParse, yylhsminor.yy14, &yymsp[-2].minor.yy0, 1);
178513 }
178514 #line 4665 "parse.sql"
178515 yymsp[-2].minor.yy14 = yylhsminor.yy14;
178516 break;
178517 case 163: /* setlist ::= LP idlist RP EQ expr */
178518 #line 1024 "parse.y"
178519 {
178520 yymsp[-4].minor.yy14 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy132, yymsp[0].minor.yy454);
178521 }
178522 #line 4673 "parse.sql"
178523 break;
178524 case 164: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
178525 #line 1031 "parse.y"
178526 {
178527 sqlite3Insert(pParse, yymsp[-3].minor.yy203, yymsp[-1].minor.yy555, yymsp[-2].minor.yy132, yymsp[-5].minor.yy144, yymsp[0].minor.yy122);
178528 }
178529 #line 4680 "parse.sql"
178530 break;
178531 case 165: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
178532 #line 1035 "parse.y"
178533 {
178534 sqlite3Insert(pParse, yymsp[-4].minor.yy203, 0, yymsp[-3].minor.yy132, yymsp[-6].minor.yy144, 0);
178535 }
178536 #line 4687 "parse.sql"
178537 break;
178538 case 166: /* upsert ::= */
178539 #line 1046 "parse.y"
178540 { yymsp[1].minor.yy122 = 0; }
178541 #line 4692 "parse.sql"
178542 break;
178543 case 167: /* upsert ::= RETURNING selcollist */
178544 #line 1047 "parse.y"
178545 { yymsp[-1].minor.yy122 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy14); }
178546 #line 4697 "parse.sql"
178547 break;
178548 case 168: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
178549 #line 1050 "parse.y"
178550 { yymsp[-11].minor.yy122 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy14,yymsp[-6].minor.yy454,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454,yymsp[0].minor.yy122);}
178551 #line 4702 "parse.sql"
178552 break;
178553 case 169: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
178554 #line 1052 "parse.y"
178555 { yymsp[-8].minor.yy122 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy14,yymsp[-3].minor.yy454,0,0,yymsp[0].minor.yy122); }
178556 #line 4707 "parse.sql"
178557 break;
178558 case 170: /* upsert ::= ON CONFLICT DO NOTHING returning */
178559 #line 1054 "parse.y"
178560 { yymsp[-4].minor.yy122 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
178561 #line 4712 "parse.sql"
178562 break;
178563 case 171: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
178564 #line 1056 "parse.y"
178565 { yymsp[-7].minor.yy122 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454,0);}
178566 #line 4717 "parse.sql"
178567 break;
178568 case 172: /* returning ::= RETURNING selcollist */
178569 #line 1058 "parse.y"
178570 {sqlite3AddReturning(pParse,yymsp[0].minor.yy14);}
178571 #line 4722 "parse.sql"
178572 break;
178573 case 175: /* idlist_opt ::= */
178574 #line 1070 "parse.y"
178575 {yymsp[1].minor.yy132 = 0;}
178576 #line 4727 "parse.sql"
178577 break;
178578 case 176: /* idlist_opt ::= LP idlist RP */
178579 #line 1071 "parse.y"
178580 {yymsp[-2].minor.yy132 = yymsp[-1].minor.yy132;}
178581 #line 4732 "parse.sql"
178582 break;
178583 case 177: /* idlist ::= idlist COMMA nm */
178584 #line 1073 "parse.y"
178585 {yymsp[-2].minor.yy132 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy132,&yymsp[0].minor.yy0);}
178586 #line 4737 "parse.sql"
178587 break;
178588 case 178: /* idlist ::= nm */
178589 #line 1075 "parse.y"
178590 {yymsp[0].minor.yy132 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
178591 #line 4742 "parse.sql"
178592 break;
178593 case 179: /* expr ::= LP expr RP */
178594 #line 1124 "parse.y"
178595 {yymsp[-2].minor.yy454 = yymsp[-1].minor.yy454;}
178596 #line 4747 "parse.sql"
178597 break;
178598 case 180: /* expr ::= ID|INDEXED|JOIN_KW */
178599 #line 1125 "parse.y"
178600 {yymsp[0].minor.yy454=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
178601 #line 4752 "parse.sql"
178602 break;
178603 case 181: /* expr ::= nm DOT nm */
178604 #line 1126 "parse.y"
178605 {
178606 Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
178607 Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
178608 yylhsminor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
178609 }
178610 #line 4761 "parse.sql"
178611 yymsp[-2].minor.yy454 = yylhsminor.yy454;
178612 break;
178613 case 182: /* expr ::= nm DOT nm DOT nm */
178614 #line 1131 "parse.y"
178615 {
178616 Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0);
178617 Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
178618 Expr *temp3 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
178619 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
@@ -178620,30 +178188,24 @@
178620 if( IN_RENAME_OBJECT ){
178621 sqlite3RenameTokenRemap(pParse, 0, temp1);
178622 }
178623 yylhsminor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
178624 }
178625 #line 4776 "parse.sql"
178626 yymsp[-4].minor.yy454 = yylhsminor.yy454;
178627 break;
178628 case 183: /* term ::= NULL|FLOAT|BLOB */
178629 case 184: /* term ::= STRING */ yytestcase(yyruleno==184);
178630 #line 1141 "parse.y"
178631 {yymsp[0].minor.yy454=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
178632 #line 4783 "parse.sql"
178633 break;
178634 case 185: /* term ::= INTEGER */
178635 #line 1143 "parse.y"
178636 {
178637 yylhsminor.yy454 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
178638 if( yylhsminor.yy454 ) yylhsminor.yy454->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
178639 }
178640 #line 4791 "parse.sql"
178641 yymsp[0].minor.yy454 = yylhsminor.yy454;
178642 break;
178643 case 186: /* expr ::= VARIABLE */
178644 #line 1147 "parse.y"
178645 {
178646 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
178647 u32 n = yymsp[0].minor.yy0.n;
178648 yymsp[0].minor.yy454 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
178649 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy454, n);
@@ -178660,90 +178222,70 @@
178660 yymsp[0].minor.yy454 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
178661 if( yymsp[0].minor.yy454 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy454->iTable);
178662 }
178663 }
178664 }
178665 #line 4816 "parse.sql"
178666 break;
178667 case 187: /* expr ::= expr COLLATE ID|STRING */
178668 #line 1167 "parse.y"
178669 {
178670 yymsp[-2].minor.yy454 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy454, &yymsp[0].minor.yy0, 1);
178671 }
178672 #line 4823 "parse.sql"
178673 break;
178674 case 188: /* expr ::= CAST LP expr AS typetoken RP */
178675 #line 1171 "parse.y"
178676 {
178677 yymsp[-5].minor.yy454 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
178678 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy454, yymsp[-3].minor.yy454, 0);
178679 }
178680 #line 4831 "parse.sql"
178681 break;
178682 case 189: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
178683 #line 1178 "parse.y"
178684 {
178685 yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy14, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy144);
178686 }
178687 #line 4838 "parse.sql"
178688 yymsp[-4].minor.yy454 = yylhsminor.yy454;
178689 break;
178690 case 190: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */
178691 #line 1181 "parse.y"
178692 {
178693 yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-4].minor.yy14, &yymsp[-7].minor.yy0, yymsp[-5].minor.yy144);
178694 sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy454, yymsp[-1].minor.yy14);
178695 }
178696 #line 4847 "parse.sql"
178697 yymsp[-7].minor.yy454 = yylhsminor.yy454;
178698 break;
178699 case 191: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
178700 #line 1185 "parse.y"
178701 {
178702 yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
178703 }
178704 #line 4855 "parse.sql"
178705 yymsp[-3].minor.yy454 = yylhsminor.yy454;
178706 break;
178707 case 192: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
178708 #line 1249 "parse.y"
178709 {
178710 yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy14, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy144);
178711 sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211);
178712 }
178713 #line 4864 "parse.sql"
178714 yymsp[-5].minor.yy454 = yylhsminor.yy454;
178715 break;
178716 case 193: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */
178717 #line 1253 "parse.y"
178718 {
178719 yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-5].minor.yy14, &yymsp[-8].minor.yy0, yymsp[-6].minor.yy144);
178720 sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211);
178721 sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy454, yymsp[-2].minor.yy14);
178722 }
178723 #line 4874 "parse.sql"
178724 yymsp[-8].minor.yy454 = yylhsminor.yy454;
178725 break;
178726 case 194: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
178727 #line 1258 "parse.y"
178728 {
178729 yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
178730 sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211);
178731 }
178732 #line 4883 "parse.sql"
178733 yymsp[-4].minor.yy454 = yylhsminor.yy454;
178734 break;
178735 case 195: /* term ::= CTIME_KW */
178736 #line 1272 "parse.y"
178737 {
178738 yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
178739 }
178740 #line 4891 "parse.sql"
178741 yymsp[0].minor.yy454 = yylhsminor.yy454;
178742 break;
178743 case 196: /* expr ::= LP nexprlist COMMA expr RP */
178744 #line 1276 "parse.y"
178745 {
178746 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy14, yymsp[-1].minor.yy454);
178747 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
178748 if( yymsp[-4].minor.yy454 ){
178749 yymsp[-4].minor.yy454->x.pList = pList;
@@ -178752,35 +178294,27 @@
178752 }
178753 }else{
178754 sqlite3ExprListDelete(pParse->db, pList);
178755 }
178756 }
178757 #line 4908 "parse.sql"
178758 break;
178759 case 197: /* expr ::= expr AND expr */
178760 #line 1289 "parse.y"
178761 {yymsp[-2].minor.yy454=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
178762 #line 4913 "parse.sql"
178763 break;
178764 case 198: /* expr ::= expr OR expr */
178765 case 199: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==199);
178766 case 200: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==200);
178767 case 201: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==201);
178768 case 202: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==202);
178769 case 203: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==203);
178770 case 204: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==204);
178771 #line 1290 "parse.y"
178772 {yymsp[-2].minor.yy454=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
178773 #line 4924 "parse.sql"
178774 break;
178775 case 205: /* likeop ::= NOT LIKE_KW|MATCH */
178776 #line 1303 "parse.y"
178777 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
178778 #line 4929 "parse.sql"
178779 break;
178780 case 206: /* expr ::= expr likeop expr */
178781 #line 1304 "parse.y"
178782 {
178783 ExprList *pList;
178784 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
178785 yymsp[-1].minor.yy0.n &= 0x7fffffff;
178786 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy454);
@@ -178787,14 +178321,12 @@
178787 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy454);
178788 yymsp[-2].minor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
178789 if( bNot ) yymsp[-2].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy454, 0);
178790 if( yymsp[-2].minor.yy454 ) yymsp[-2].minor.yy454->flags |= EP_InfixFunc;
178791 }
178792 #line 4943 "parse.sql"
178793 break;
178794 case 207: /* expr ::= expr likeop expr ESCAPE expr */
178795 #line 1314 "parse.y"
178796 {
178797 ExprList *pList;
178798 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
178799 yymsp[-3].minor.yy0.n &= 0x7fffffff;
178800 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
@@ -178802,62 +178334,46 @@
178802 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454);
178803 yymsp[-4].minor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
178804 if( bNot ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
178805 if( yymsp[-4].minor.yy454 ) yymsp[-4].minor.yy454->flags |= EP_InfixFunc;
178806 }
178807 #line 4958 "parse.sql"
178808 break;
178809 case 208: /* expr ::= expr ISNULL|NOTNULL */
178810 #line 1326 "parse.y"
178811 {yymsp[-1].minor.yy454 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy454,0);}
178812 #line 4963 "parse.sql"
178813 break;
178814 case 209: /* expr ::= expr NOT NULL */
178815 #line 1327 "parse.y"
178816 {yymsp[-2].minor.yy454 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy454,0);}
178817 #line 4968 "parse.sql"
178818 break;
178819 case 210: /* expr ::= expr IS expr */
178820 #line 1348 "parse.y"
178821 {
178822 yymsp[-2].minor.yy454 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);
178823 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-2].minor.yy454, TK_ISNULL);
178824 }
178825 #line 4976 "parse.sql"
178826 break;
178827 case 211: /* expr ::= expr IS NOT expr */
178828 #line 1352 "parse.y"
178829 {
178830 yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy454,yymsp[0].minor.yy454);
178831 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-3].minor.yy454, TK_NOTNULL);
178832 }
178833 #line 4984 "parse.sql"
178834 break;
178835 case 212: /* expr ::= expr IS NOT DISTINCT FROM expr */
178836 #line 1356 "parse.y"
178837 {
178838 yymsp[-5].minor.yy454 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy454,yymsp[0].minor.yy454);
178839 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-5].minor.yy454, TK_ISNULL);
178840 }
178841 #line 4992 "parse.sql"
178842 break;
178843 case 213: /* expr ::= expr IS DISTINCT FROM expr */
178844 #line 1360 "parse.y"
178845 {
178846 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy454,yymsp[0].minor.yy454);
178847 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-4].minor.yy454, TK_NOTNULL);
178848 }
178849 #line 5000 "parse.sql"
178850 break;
178851 case 214: /* expr ::= NOT expr */
178852 case 215: /* expr ::= BITNOT expr */ yytestcase(yyruleno==215);
178853 #line 1366 "parse.y"
178854 {yymsp[-1].minor.yy454 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy454, 0);/*A-overwrites-B*/}
178855 #line 5006 "parse.sql"
178856 break;
178857 case 216: /* expr ::= PLUS|MINUS expr */
178858 #line 1369 "parse.y"
178859 {
178860 Expr *p = yymsp[0].minor.yy454;
178861 u8 op = yymsp[-1].major + (TK_UPLUS-TK_PLUS);
178862 assert( TK_UPLUS>TK_PLUS );
178863 assert( TK_UMINUS == TK_MINUS + (TK_UPLUS - TK_PLUS) );
@@ -178867,30 +178383,24 @@
178867 }else{
178868 yymsp[-1].minor.yy454 = sqlite3PExpr(pParse, op, p, 0);
178869 /*A-overwrites-B*/
178870 }
178871 }
178872 #line 5023 "parse.sql"
178873 break;
178874 case 217: /* expr ::= expr PTR expr */
178875 #line 1383 "parse.y"
178876 {
178877 ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy454);
178878 pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy454);
178879 yylhsminor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
178880 }
178881 #line 5032 "parse.sql"
178882 yymsp[-2].minor.yy454 = yylhsminor.yy454;
178883 break;
178884 case 218: /* between_op ::= BETWEEN */
178885 case 221: /* in_op ::= IN */ yytestcase(yyruleno==221);
178886 #line 1390 "parse.y"
178887 {yymsp[0].minor.yy144 = 0;}
178888 #line 5039 "parse.sql"
178889 break;
178890 case 220: /* expr ::= expr between_op expr AND expr */
178891 #line 1392 "parse.y"
178892 {
178893 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
178894 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454);
178895 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy454, 0);
178896 if( yymsp[-4].minor.yy454 ){
@@ -178898,14 +178408,12 @@
178898 }else{
178899 sqlite3ExprListDelete(pParse->db, pList);
178900 }
178901 if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
178902 }
178903 #line 5054 "parse.sql"
178904 break;
178905 case 223: /* expr ::= expr in_op LP exprlist RP */
178906 #line 1407 "parse.y"
178907 {
178908 if( yymsp[-1].minor.yy14==0 ){
178909 /* Expressions of the form
178910 **
178911 ** expr1 IN ()
@@ -178946,52 +178454,42 @@
178946 }
178947 }
178948 if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
178949 }
178950 }
178951 #line 5102 "parse.sql"
178952 break;
178953 case 224: /* expr ::= LP select RP */
178954 #line 1451 "parse.y"
178955 {
178956 yymsp[-2].minor.yy454 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
178957 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy454, yymsp[-1].minor.yy555);
178958 }
178959 #line 5110 "parse.sql"
178960 break;
178961 case 225: /* expr ::= expr in_op LP select RP */
178962 #line 1455 "parse.y"
178963 {
178964 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
178965 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, yymsp[-1].minor.yy555);
178966 if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
178967 }
178968 #line 5119 "parse.sql"
178969 break;
178970 case 226: /* expr ::= expr in_op nm dbnm paren_exprlist */
178971 #line 1460 "parse.y"
178972 {
178973 SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
178974 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
178975 if( yymsp[0].minor.yy14 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy14);
178976 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
178977 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pSelect);
178978 if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
178979 }
178980 #line 5131 "parse.sql"
178981 break;
178982 case 227: /* expr ::= EXISTS LP select RP */
178983 #line 1468 "parse.y"
178984 {
178985 Expr *p;
178986 p = yymsp[-3].minor.yy454 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
178987 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy555);
178988 }
178989 #line 5140 "parse.sql"
178990 break;
178991 case 228: /* expr ::= CASE case_operand case_exprlist case_else END */
178992 #line 1476 "parse.y"
178993 {
178994 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy454, 0);
178995 if( yymsp[-4].minor.yy454 ){
178996 yymsp[-4].minor.yy454->x.pList = yymsp[-1].minor.yy454 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454) : yymsp[-2].minor.yy14;
178997 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy454);
@@ -178998,627 +178496,446 @@
178998 }else{
178999 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy14);
179000 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy454);
179001 }
179002 }
179003 #line 5154 "parse.sql"
179004 break;
179005 case 229: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
179006 #line 1488 "parse.y"
179007 {
179008 yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, yymsp[-2].minor.yy454);
179009 yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, yymsp[0].minor.yy454);
179010 }
179011 #line 5162 "parse.sql"
179012 break;
179013 case 230: /* case_exprlist ::= WHEN expr THEN expr */
179014 #line 1492 "parse.y"
179015 {
179016 yymsp[-3].minor.yy14 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
179017 yymsp[-3].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy14, yymsp[0].minor.yy454);
179018 }
179019 #line 5170 "parse.sql"
179020 break;
179021 case 235: /* nexprlist ::= nexprlist COMMA expr */
179022 #line 1513 "parse.y"
179023 {yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy14,yymsp[0].minor.yy454);}
179024 #line 5175 "parse.sql"
179025 break;
179026 case 236: /* nexprlist ::= expr */
179027 #line 1515 "parse.y"
179028 {yymsp[0].minor.yy14 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy454); /*A-overwrites-Y*/}
179029 #line 5180 "parse.sql"
179030 break;
179031 case 238: /* paren_exprlist ::= LP exprlist RP */
179032 case 243: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==243);
179033 #line 1523 "parse.y"
179034 {yymsp[-2].minor.yy14 = yymsp[-1].minor.yy14;}
179035 #line 5186 "parse.sql"
179036 break;
179037 case 239: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
179038 #line 1530 "parse.y"
179039 {
179040 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
179041 sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy14, yymsp[-10].minor.yy144,
179042 &yymsp[-11].minor.yy0, yymsp[0].minor.yy454, SQLITE_SO_ASC, yymsp[-8].minor.yy144, SQLITE_IDXTYPE_APPDEF);
179043 if( IN_RENAME_OBJECT && pParse->pNewIndex ){
179044 sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
179045 }
179046 }
179047 #line 5198 "parse.sql"
179048 break;
179049 case 240: /* uniqueflag ::= UNIQUE */
179050 case 282: /* raisetype ::= ABORT */ yytestcase(yyruleno==282);
179051 #line 1540 "parse.y"
179052 {yymsp[0].minor.yy144 = OE_Abort;}
179053 #line 5204 "parse.sql"
179054 break;
179055 case 241: /* uniqueflag ::= */
179056 #line 1541 "parse.y"
179057 {yymsp[1].minor.yy144 = OE_None;}
179058 #line 5209 "parse.sql"
179059 break;
179060 case 244: /* eidlist ::= eidlist COMMA nm collate sortorder */
179061 #line 1591 "parse.y"
179062 {
179063 yymsp[-4].minor.yy14 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy14, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy144, yymsp[0].minor.yy144);
179064 }
179065 #line 5216 "parse.sql"
179066 break;
179067 case 245: /* eidlist ::= nm collate sortorder */
179068 #line 1594 "parse.y"
179069 {
179070 yymsp[-2].minor.yy14 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy144, yymsp[0].minor.yy144); /*A-overwrites-Y*/
179071 }
179072 #line 5223 "parse.sql"
179073 break;
179074 case 248: /* cmd ::= DROP INDEX ifexists fullname */
179075 #line 1605 "parse.y"
179076 {sqlite3DropIndex(pParse, yymsp[0].minor.yy203, yymsp[-1].minor.yy144);}
179077 #line 5228 "parse.sql"
179078 break;
179079 case 249: /* cmd ::= VACUUM vinto */
179080 #line 1612 "parse.y"
179081 {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy454);}
179082 #line 5233 "parse.sql"
179083 break;
179084 case 250: /* cmd ::= VACUUM nm vinto */
179085 #line 1613 "parse.y"
179086 {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy454);}
179087 #line 5238 "parse.sql"
179088 break;
179089 case 253: /* cmd ::= PRAGMA nm dbnm */
179090 #line 1621 "parse.y"
179091 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
179092 #line 5243 "parse.sql"
179093 break;
179094 case 254: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
179095 #line 1622 "parse.y"
179096 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
179097 #line 5248 "parse.sql"
179098 break;
179099 case 255: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
179100 #line 1623 "parse.y"
179101 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
179102 #line 5253 "parse.sql"
179103 break;
179104 case 256: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
179105 #line 1625 "parse.y"
179106 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
179107 #line 5258 "parse.sql"
179108 break;
179109 case 257: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
179110 #line 1627 "parse.y"
179111 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
179112 #line 5263 "parse.sql"
179113 break;
179114 case 260: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
179115 #line 1643 "parse.y"
179116 {
179117 Token all;
179118 all.z = yymsp[-3].minor.yy0.z;
179119 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
179120 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy427, &all);
179121 }
179122 #line 5273 "parse.sql"
179123 break;
179124 case 261: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
179125 #line 1652 "parse.y"
179126 {
179127 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy144, yymsp[-4].minor.yy286.a, yymsp[-4].minor.yy286.b, yymsp[-2].minor.yy203, yymsp[0].minor.yy454, yymsp[-10].minor.yy144, yymsp[-8].minor.yy144);
179128 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
179129 }
179130 #line 5281 "parse.sql"
179131 break;
179132 case 262: /* trigger_time ::= BEFORE|AFTER */
179133 #line 1658 "parse.y"
179134 { yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-X*/ }
179135 #line 5286 "parse.sql"
179136 break;
179137 case 263: /* trigger_time ::= INSTEAD OF */
179138 #line 1659 "parse.y"
179139 { yymsp[-1].minor.yy144 = TK_INSTEAD;}
179140 #line 5291 "parse.sql"
179141 break;
179142 case 264: /* trigger_time ::= */
179143 #line 1660 "parse.y"
179144 { yymsp[1].minor.yy144 = TK_BEFORE; }
179145 #line 5296 "parse.sql"
179146 break;
179147 case 265: /* trigger_event ::= DELETE|INSERT */
179148 case 266: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==266);
179149 #line 1664 "parse.y"
179150 {yymsp[0].minor.yy286.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy286.b = 0;}
179151 #line 5302 "parse.sql"
179152 break;
179153 case 267: /* trigger_event ::= UPDATE OF idlist */
179154 #line 1666 "parse.y"
179155 {yymsp[-2].minor.yy286.a = TK_UPDATE; yymsp[-2].minor.yy286.b = yymsp[0].minor.yy132;}
179156 #line 5307 "parse.sql"
179157 break;
179158 case 268: /* when_clause ::= */
179159 case 287: /* key_opt ::= */ yytestcase(yyruleno==287);
179160 #line 1673 "parse.y"
179161 { yymsp[1].minor.yy454 = 0; }
179162 #line 5313 "parse.sql"
179163 break;
179164 case 269: /* when_clause ::= WHEN expr */
179165 case 288: /* key_opt ::= KEY expr */ yytestcase(yyruleno==288);
179166 #line 1674 "parse.y"
179167 { yymsp[-1].minor.yy454 = yymsp[0].minor.yy454; }
179168 #line 5319 "parse.sql"
179169 break;
179170 case 270: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
179171 #line 1678 "parse.y"
179172 {
179173 assert( yymsp[-2].minor.yy427!=0 );
179174 yymsp[-2].minor.yy427->pLast->pNext = yymsp[-1].minor.yy427;
179175 yymsp[-2].minor.yy427->pLast = yymsp[-1].minor.yy427;
179176 }
179177 #line 5328 "parse.sql"
179178 break;
179179 case 271: /* trigger_cmd_list ::= trigger_cmd SEMI */
179180 #line 1683 "parse.y"
179181 {
179182 assert( yymsp[-1].minor.yy427!=0 );
179183 yymsp[-1].minor.yy427->pLast = yymsp[-1].minor.yy427;
179184 }
179185 #line 5336 "parse.sql"
179186 break;
179187 case 272: /* trnm ::= nm DOT nm */
179188 #line 1694 "parse.y"
179189 {
179190 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
179191 sqlite3ErrorMsg(pParse,
179192 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
179193 "statements within triggers");
179194 }
179195 #line 5346 "parse.sql"
179196 break;
179197 case 273: /* tridxby ::= INDEXED BY nm */
179198 #line 1706 "parse.y"
179199 {
179200 sqlite3ErrorMsg(pParse,
179201 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
179202 "within triggers");
179203 }
179204 #line 5355 "parse.sql"
179205 break;
179206 case 274: /* tridxby ::= NOT INDEXED */
179207 #line 1711 "parse.y"
179208 {
179209 sqlite3ErrorMsg(pParse,
179210 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
179211 "within triggers");
179212 }
179213 #line 5364 "parse.sql"
179214 break;
179215 case 275: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
179216 #line 1724 "parse.y"
179217 {yylhsminor.yy427 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy203, yymsp[-3].minor.yy14, yymsp[-1].minor.yy454, yymsp[-7].minor.yy144, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy168);}
179218 #line 5369 "parse.sql"
179219 yymsp[-8].minor.yy427 = yylhsminor.yy427;
179220 break;
179221 case 276: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
179222 #line 1728 "parse.y"
179223 {
179224 yylhsminor.yy427 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy132,yymsp[-2].minor.yy555,yymsp[-6].minor.yy144,yymsp[-1].minor.yy122,yymsp[-7].minor.yy168,yymsp[0].minor.yy168);/*yylhsminor.yy427-overwrites-yymsp[-6].minor.yy144*/
179225 }
179226 #line 5377 "parse.sql"
179227 yymsp[-7].minor.yy427 = yylhsminor.yy427;
179228 break;
179229 case 277: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
179230 #line 1733 "parse.y"
179231 {yylhsminor.yy427 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy454, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy168);}
179232 #line 5383 "parse.sql"
179233 yymsp[-5].minor.yy427 = yylhsminor.yy427;
179234 break;
179235 case 278: /* trigger_cmd ::= scanpt select scanpt */
179236 #line 1737 "parse.y"
179237 {yylhsminor.yy427 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy555, yymsp[-2].minor.yy168, yymsp[0].minor.yy168); /*yylhsminor.yy427-overwrites-yymsp[-1].minor.yy555*/}
179238 #line 5389 "parse.sql"
179239 yymsp[-2].minor.yy427 = yylhsminor.yy427;
179240 break;
179241 case 279: /* expr ::= RAISE LP IGNORE RP */
179242 #line 1740 "parse.y"
179243 {
179244 yymsp[-3].minor.yy454 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
179245 if( yymsp[-3].minor.yy454 ){
179246 yymsp[-3].minor.yy454->affExpr = OE_Ignore;
179247 }
179248 }
179249 #line 5400 "parse.sql"
179250 break;
179251 case 280: /* expr ::= RAISE LP raisetype COMMA expr RP */
179252 #line 1746 "parse.y"
179253 {
179254 yymsp[-5].minor.yy454 = sqlite3PExpr(pParse, TK_RAISE, yymsp[-1].minor.yy454, 0);
179255 if( yymsp[-5].minor.yy454 ) {
179256 yymsp[-5].minor.yy454->affExpr = (char)yymsp[-3].minor.yy144;
179257 }
179258 }
179259 #line 5410 "parse.sql"
179260 break;
179261 case 281: /* raisetype ::= ROLLBACK */
179262 #line 1755 "parse.y"
179263 {yymsp[0].minor.yy144 = OE_Rollback;}
179264 #line 5415 "parse.sql"
179265 break;
179266 case 283: /* raisetype ::= FAIL */
179267 #line 1757 "parse.y"
179268 {yymsp[0].minor.yy144 = OE_Fail;}
179269 #line 5420 "parse.sql"
179270 break;
179271 case 284: /* cmd ::= DROP TRIGGER ifexists fullname */
179272 #line 1762 "parse.y"
179273 {
179274 sqlite3DropTrigger(pParse,yymsp[0].minor.yy203,yymsp[-1].minor.yy144);
179275 }
179276 #line 5427 "parse.sql"
179277 break;
179278 case 285: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
179279 #line 1769 "parse.y"
179280 {
179281 sqlite3Attach(pParse, yymsp[-3].minor.yy454, yymsp[-1].minor.yy454, yymsp[0].minor.yy454);
179282 }
179283 #line 5434 "parse.sql"
179284 break;
179285 case 286: /* cmd ::= DETACH database_kw_opt expr */
179286 #line 1772 "parse.y"
179287 {
179288 sqlite3Detach(pParse, yymsp[0].minor.yy454);
179289 }
179290 #line 5441 "parse.sql"
179291 break;
179292 case 289: /* cmd ::= REINDEX */
179293 #line 1787 "parse.y"
179294 {sqlite3Reindex(pParse, 0, 0);}
179295 #line 5446 "parse.sql"
179296 break;
179297 case 290: /* cmd ::= REINDEX nm dbnm */
179298 #line 1788 "parse.y"
179299 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
179300 #line 5451 "parse.sql"
179301 break;
179302 case 291: /* cmd ::= ANALYZE */
179303 #line 1793 "parse.y"
179304 {sqlite3Analyze(pParse, 0, 0);}
179305 #line 5456 "parse.sql"
179306 break;
179307 case 292: /* cmd ::= ANALYZE nm dbnm */
179308 #line 1794 "parse.y"
179309 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
179310 #line 5461 "parse.sql"
179311 break;
179312 case 293: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
179313 #line 1800 "parse.y"
179314 {
179315 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy203,&yymsp[0].minor.yy0);
179316 }
179317 #line 5468 "parse.sql"
179318 break;
179319 case 294: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
179320 #line 1804 "parse.y"
179321 {
179322 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
179323 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
179324 }
179325 #line 5476 "parse.sql"
179326 break;
179327 case 295: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
179328 #line 1808 "parse.y"
179329 {
179330 sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy203, &yymsp[0].minor.yy0);
179331 }
179332 #line 5483 "parse.sql"
179333 break;
179334 case 296: /* add_column_fullname ::= fullname */
179335 #line 1812 "parse.y"
179336 {
179337 disableLookaside(pParse);
179338 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy203);
179339 }
179340 #line 5491 "parse.sql"
179341 break;
179342 case 297: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
179343 #line 1816 "parse.y"
179344 {
179345 sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy203, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
179346 }
179347 #line 5498 "parse.sql"
179348 break;
179349 case 298: /* cmd ::= create_vtab */
179350 #line 1828 "parse.y"
179351 {sqlite3VtabFinishParse(pParse,0);}
179352 #line 5503 "parse.sql"
179353 break;
179354 case 299: /* cmd ::= create_vtab LP vtabarglist RP */
179355 #line 1829 "parse.y"
179356 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
179357 #line 5508 "parse.sql"
179358 break;
179359 case 300: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
179360 #line 1831 "parse.y"
179361 {
179362 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy144);
179363 }
179364 #line 5515 "parse.sql"
179365 break;
179366 case 301: /* vtabarg ::= */
179367 #line 1836 "parse.y"
179368 {sqlite3VtabArgInit(pParse);}
179369 #line 5520 "parse.sql"
179370 break;
179371 case 302: /* vtabargtoken ::= ANY */
179372 case 303: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==303);
179373 case 304: /* lp ::= LP */ yytestcase(yyruleno==304);
179374 #line 1838 "parse.y"
179375 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
179376 #line 5527 "parse.sql"
179377 break;
179378 case 305: /* with ::= WITH wqlist */
179379 case 306: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==306);
179380 #line 1855 "parse.y"
179381 { sqlite3WithPush(pParse, yymsp[0].minor.yy59, 1); }
179382 #line 5533 "parse.sql"
179383 break;
179384 case 307: /* wqas ::= AS */
179385 #line 1859 "parse.y"
179386 {yymsp[0].minor.yy462 = M10d_Any;}
179387 #line 5538 "parse.sql"
179388 break;
179389 case 308: /* wqas ::= AS MATERIALIZED */
179390 #line 1860 "parse.y"
179391 {yymsp[-1].minor.yy462 = M10d_Yes;}
179392 #line 5543 "parse.sql"
179393 break;
179394 case 309: /* wqas ::= AS NOT MATERIALIZED */
179395 #line 1861 "parse.y"
179396 {yymsp[-2].minor.yy462 = M10d_No;}
179397 #line 5548 "parse.sql"
179398 break;
179399 case 310: /* wqitem ::= withnm eidlist_opt wqas LP select RP */
179400 #line 1862 "parse.y"
179401 {
179402 yymsp[-5].minor.yy67 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy14, yymsp[-1].minor.yy555, yymsp[-3].minor.yy462); /*A-overwrites-X*/
179403 }
179404 #line 5555 "parse.sql"
179405 break;
179406 case 311: /* withnm ::= nm */
179407 #line 1865 "parse.y"
179408 {pParse->bHasWith = 1;}
179409 #line 5560 "parse.sql"
179410 break;
179411 case 312: /* wqlist ::= wqitem */
179412 #line 1866 "parse.y"
179413 {
179414 yymsp[0].minor.yy59 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy67); /*A-overwrites-X*/
179415 }
179416 #line 5567 "parse.sql"
179417 break;
179418 case 313: /* wqlist ::= wqlist COMMA wqitem */
179419 #line 1869 "parse.y"
179420 {
179421 yymsp[-2].minor.yy59 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy59, yymsp[0].minor.yy67);
179422 }
179423 #line 5574 "parse.sql"
179424 break;
179425 case 314: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
179426 #line 1884 "parse.y"
179427 {
179428 assert( yymsp[0].minor.yy211!=0 );
179429 sqlite3WindowChain(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy211);
179430 yymsp[0].minor.yy211->pNextWin = yymsp[-2].minor.yy211;
179431 yylhsminor.yy211 = yymsp[0].minor.yy211;
179432 }
179433 #line 5584 "parse.sql"
179434 yymsp[-2].minor.yy211 = yylhsminor.yy211;
179435 break;
179436 case 315: /* windowdefn ::= nm AS LP window RP */
179437 #line 1893 "parse.y"
179438 {
179439 if( ALWAYS(yymsp[-1].minor.yy211) ){
179440 yymsp[-1].minor.yy211->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
179441 }
179442 yylhsminor.yy211 = yymsp[-1].minor.yy211;
179443 }
179444 #line 5595 "parse.sql"
179445 yymsp[-4].minor.yy211 = yylhsminor.yy211;
179446 break;
179447 case 316: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
179448 #line 1927 "parse.y"
179449 {
179450 yymsp[-4].minor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy14, yymsp[-1].minor.yy14, 0);
179451 }
179452 #line 5603 "parse.sql"
179453 break;
179454 case 317: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
179455 #line 1930 "parse.y"
179456 {
179457 yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy14, yymsp[-1].minor.yy14, &yymsp[-5].minor.yy0);
179458 }
179459 #line 5610 "parse.sql"
179460 yymsp[-5].minor.yy211 = yylhsminor.yy211;
179461 break;
179462 case 318: /* window ::= ORDER BY sortlist frame_opt */
179463 #line 1933 "parse.y"
179464 {
179465 yymsp[-3].minor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, yymsp[-1].minor.yy14, 0);
179466 }
179467 #line 5618 "parse.sql"
179468 break;
179469 case 319: /* window ::= nm ORDER BY sortlist frame_opt */
179470 #line 1936 "parse.y"
179471 {
179472 yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, yymsp[-1].minor.yy14, &yymsp[-4].minor.yy0);
179473 }
179474 #line 5625 "parse.sql"
179475 yymsp[-4].minor.yy211 = yylhsminor.yy211;
179476 break;
179477 case 320: /* window ::= nm frame_opt */
179478 #line 1940 "parse.y"
179479 {
179480 yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, 0, &yymsp[-1].minor.yy0);
179481 }
179482 #line 5633 "parse.sql"
179483 yymsp[-1].minor.yy211 = yylhsminor.yy211;
179484 break;
179485 case 321: /* frame_opt ::= */
179486 #line 1944 "parse.y"
179487 {
179488 yymsp[1].minor.yy211 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
179489 }
179490 #line 5641 "parse.sql"
179491 break;
179492 case 322: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
179493 #line 1947 "parse.y"
179494 {
179495 yylhsminor.yy211 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy144, yymsp[-1].minor.yy509.eType, yymsp[-1].minor.yy509.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy462);
179496 }
179497 #line 5648 "parse.sql"
179498 yymsp[-2].minor.yy211 = yylhsminor.yy211;
179499 break;
179500 case 323: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
179501 #line 1951 "parse.y"
179502 {
179503 yylhsminor.yy211 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy144, yymsp[-3].minor.yy509.eType, yymsp[-3].minor.yy509.pExpr, yymsp[-1].minor.yy509.eType, yymsp[-1].minor.yy509.pExpr, yymsp[0].minor.yy462);
179504 }
179505 #line 5656 "parse.sql"
179506 yymsp[-5].minor.yy211 = yylhsminor.yy211;
179507 break;
179508 case 325: /* frame_bound_s ::= frame_bound */
179509 case 327: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==327);
179510 #line 1957 "parse.y"
179511 {yylhsminor.yy509 = yymsp[0].minor.yy509;}
179512 #line 5663 "parse.sql"
179513 yymsp[0].minor.yy509 = yylhsminor.yy509;
179514 break;
179515 case 326: /* frame_bound_s ::= UNBOUNDED PRECEDING */
179516 case 328: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==328);
179517 case 330: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==330);
179518 #line 1958 "parse.y"
179519 {yylhsminor.yy509.eType = yymsp[-1].major; yylhsminor.yy509.pExpr = 0;}
179520 #line 5671 "parse.sql"
179521 yymsp[-1].minor.yy509 = yylhsminor.yy509;
179522 break;
179523 case 329: /* frame_bound ::= expr PRECEDING|FOLLOWING */
179524 #line 1963 "parse.y"
179525 {yylhsminor.yy509.eType = yymsp[0].major; yylhsminor.yy509.pExpr = yymsp[-1].minor.yy454;}
179526 #line 5677 "parse.sql"
179527 yymsp[-1].minor.yy509 = yylhsminor.yy509;
179528 break;
179529 case 331: /* frame_exclude_opt ::= */
179530 #line 1967 "parse.y"
179531 {yymsp[1].minor.yy462 = 0;}
179532 #line 5683 "parse.sql"
179533 break;
179534 case 332: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
179535 #line 1968 "parse.y"
179536 {yymsp[-1].minor.yy462 = yymsp[0].minor.yy462;}
179537 #line 5688 "parse.sql"
179538 break;
179539 case 333: /* frame_exclude ::= NO OTHERS */
179540 case 334: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==334);
179541 #line 1971 "parse.y"
179542 {yymsp[-1].minor.yy462 = yymsp[-1].major; /*A-overwrites-X*/}
179543 #line 5694 "parse.sql"
179544 break;
179545 case 335: /* frame_exclude ::= GROUP|TIES */
179546 #line 1973 "parse.y"
179547 {yymsp[0].minor.yy462 = yymsp[0].major; /*A-overwrites-X*/}
179548 #line 5699 "parse.sql"
179549 break;
179550 case 336: /* window_clause ::= WINDOW windowdefn_list */
179551 #line 1978 "parse.y"
179552 { yymsp[-1].minor.yy211 = yymsp[0].minor.yy211; }
179553 #line 5704 "parse.sql"
179554 break;
179555 case 337: /* filter_over ::= filter_clause over_clause */
179556 #line 1980 "parse.y"
179557 {
179558 if( yymsp[0].minor.yy211 ){
179559 yymsp[0].minor.yy211->pFilter = yymsp[-1].minor.yy454;
179560 }else{
179561 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy454);
179562 }
179563 yylhsminor.yy211 = yymsp[0].minor.yy211;
179564 }
179565 #line 5716 "parse.sql"
179566 yymsp[-1].minor.yy211 = yylhsminor.yy211;
179567 break;
179568 case 338: /* filter_over ::= over_clause */
179569 #line 1988 "parse.y"
179570 {
179571 yylhsminor.yy211 = yymsp[0].minor.yy211;
179572 }
179573 #line 5724 "parse.sql"
179574 yymsp[0].minor.yy211 = yylhsminor.yy211;
179575 break;
179576 case 339: /* filter_over ::= filter_clause */
179577 #line 1991 "parse.y"
179578 {
179579 yylhsminor.yy211 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
179580 if( yylhsminor.yy211 ){
179581 yylhsminor.yy211->eFrmType = TK_FILTER;
179582 yylhsminor.yy211->pFilter = yymsp[0].minor.yy454;
179583 }else{
179584 sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy454);
179585 }
179586 }
179587 #line 5738 "parse.sql"
179588 yymsp[0].minor.yy211 = yylhsminor.yy211;
179589 break;
179590 case 340: /* over_clause ::= OVER LP window RP */
179591 #line 2001 "parse.y"
179592 {
179593 yymsp[-3].minor.yy211 = yymsp[-1].minor.yy211;
179594 assert( yymsp[-3].minor.yy211!=0 );
179595 }
179596 #line 5747 "parse.sql"
179597 break;
179598 case 341: /* over_clause ::= OVER nm */
179599 #line 2005 "parse.y"
179600 {
179601 yymsp[-1].minor.yy211 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
179602 if( yymsp[-1].minor.yy211 ){
179603 yymsp[-1].minor.yy211->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
179604 }
179605 }
179606 #line 5757 "parse.sql"
179607 break;
179608 case 342: /* filter_clause ::= FILTER LP WHERE expr RP */
179609 #line 2012 "parse.y"
179610 { yymsp[-4].minor.yy454 = yymsp[-1].minor.yy454; }
179611 #line 5762 "parse.sql"
179612 break;
179613 case 343: /* term ::= QNUMBER */
179614 #line 2038 "parse.y"
179615 {
179616 yylhsminor.yy454=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0);
179617 sqlite3DequoteNumber(pParse, yylhsminor.yy454);
179618 }
179619 #line 5770 "parse.sql"
179620 yymsp[0].minor.yy454 = yylhsminor.yy454;
179621 break;
179622 default:
179623 /* (344) input ::= cmdlist */ yytestcase(yyruleno==344);
179624 /* (345) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==345);
@@ -179742,19 +179059,17 @@
179742 ){
179743 sqlite3ParserARG_FETCH
179744 sqlite3ParserCTX_FETCH
179745 #define TOKEN yyminor
179746 /************ Begin %syntax_error code ****************************************/
179747 #line 43 "parse.y"
179748
179749 UNUSED_PARAMETER(yymajor); /* Silence some compiler warnings */
179750 if( TOKEN.z[0] ){
179751 sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
179752 }else{
179753 sqlite3ErrorMsg(pParse, "incomplete input");
179754 }
179755 #line 5906 "parse.sql"
179756 /************ End %syntax_error code ******************************************/
179757 sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
179758 sqlite3ParserCTX_STORE
179759 }
179760
@@ -180022,11 +179337,10 @@
180022 #endif
180023 }
180024
180025 /************** End of parse.c ***********************************************/
180026 /************** Begin file tokenize.c ****************************************/
180027 #line 1 "tsrc/tokenize.c"
180028 /*
180029 ** 2001 September 15
180030 **
180031 ** The author disclaims copyright to this source code. In place of
180032 ** a legal notice, here is a blessing:
@@ -180172,11 +179486,10 @@
180172 ** named keywordhash.h and then included into this source file by
180173 ** the #include below.
180174 */
180175 /************** Include keywordhash.h in the middle of tokenize.c ************/
180176 /************** Begin file keywordhash.h *************************************/
180177 #line 1 "tsrc/keywordhash.h"
180178 /***** This file contains automatically generated code ******
180179 **
180180 ** The code in this file has been automatically generated by
180181 **
180182 ** sqlite/tool/mkkeywordhash.c
@@ -180658,11 +179971,10 @@
180658 return TK_ID!=sqlite3KeywordCode((const u8*)zName, nName);
180659 }
180660
180661 /************** End of keywordhash.h *****************************************/
180662 /************** Continuing where we left off in tokenize.c *******************/
180663 #line 149 "tsrc/tokenize.c"
180664
180665
180666 /*
180667 ** If X is a character that can be used in an identifier then
180668 ** IdChar(X) will be true. Otherwise it is false.
@@ -181402,11 +180714,10 @@
181402 }
181403 #endif /* SQLITE_ENABLE_NORMALIZE */
181404
181405 /************** End of tokenize.c ********************************************/
181406 /************** Begin file complete.c ****************************************/
181407 #line 1 "tsrc/complete.c"
181408 /*
181409 ** 2001 September 15
181410 **
181411 ** The author disclaims copyright to this source code. In place of
181412 ** a legal notice, here is a blessing:
@@ -181696,11 +181007,10 @@
181696 #endif /* SQLITE_OMIT_UTF16 */
181697 #endif /* SQLITE_OMIT_COMPLETE */
181698
181699 /************** End of complete.c ********************************************/
181700 /************** Begin file main.c ********************************************/
181701 #line 1 "tsrc/main.c"
181702 /*
181703 ** 2001 September 15
181704 **
181705 ** The author disclaims copyright to this source code. In place of
181706 ** a legal notice, here is a blessing:
@@ -181718,11 +181028,10 @@
181718 /* #include "sqliteInt.h" */
181719
181720 #ifdef SQLITE_ENABLE_FTS3
181721 /************** Include fts3.h in the middle of main.c ***********************/
181722 /************** Begin file fts3.h ********************************************/
181723 #line 1 "tsrc/fts3.h"
181724 /*
181725 ** 2006 Oct 10
181726 **
181727 ** The author disclaims copyright to this source code. In place of
181728 ** a legal notice, here is a blessing:
@@ -181748,16 +181057,14 @@
181748 } /* extern "C" */
181749 #endif /* __cplusplus */
181750
181751 /************** End of fts3.h ************************************************/
181752 /************** Continuing where we left off in main.c ***********************/
181753 #line 21 "tsrc/main.c"
181754 #endif
181755 #ifdef SQLITE_ENABLE_RTREE
181756 /************** Include rtree.h in the middle of main.c **********************/
181757 /************** Begin file rtree.h *******************************************/
181758 #line 1 "tsrc/rtree.h"
181759 /*
181760 ** 2008 May 26
181761 **
181762 ** The author disclaims copyright to this source code. In place of
181763 ** a legal notice, here is a blessing:
@@ -181787,16 +181094,14 @@
181787 } /* extern "C" */
181788 #endif /* __cplusplus */
181789
181790 /************** End of rtree.h ***********************************************/
181791 /************** Continuing where we left off in main.c ***********************/
181792 #line 24 "tsrc/main.c"
181793 #endif
181794 #if defined(SQLITE_ENABLE_ICU) || defined(SQLITE_ENABLE_ICU_COLLATIONS)
181795 /************** Include sqliteicu.h in the middle of main.c ******************/
181796 /************** Begin file sqliteicu.h ***************************************/
181797 #line 1 "tsrc/sqliteicu.h"
181798 /*
181799 ** 2008 May 26
181800 **
181801 ** The author disclaims copyright to this source code. In place of
181802 ** a legal notice, here is a blessing:
@@ -181822,11 +181127,10 @@
181822 } /* extern "C" */
181823 #endif /* __cplusplus */
181824
181825 /************** End of sqliteicu.h *******************************************/
181826 /************** Continuing where we left off in main.c ***********************/
181827 #line 27 "tsrc/main.c"
181828 #endif
181829
181830 /*
181831 ** This is an extension initializer that is a no-op and always
181832 ** succeeds, except that it fails if the fault-simulation is set
@@ -184724,12 +184028,12 @@
184724 }
184725 oldLimit = db->aLimit[limitId];
184726 if( newLimit>=0 ){ /* IMP: R-52476-28732 */
184727 if( newLimit>aHardLimit[limitId] ){
184728 newLimit = aHardLimit[limitId]; /* IMP: R-51463-25634 */
184729 }else if( newLimit<1 && limitId==SQLITE_LIMIT_LENGTH ){
184730 newLimit = 1;
184731 }
184732 db->aLimit[limitId] = newLimit;
184733 }
184734 return oldLimit; /* IMP: R-53341-35419 */
184735 }
@@ -186873,11 +186177,10 @@
186873 }
186874 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
186875
186876 /************** End of main.c ************************************************/
186877 /************** Begin file notify.c ******************************************/
186878 #line 1 "tsrc/notify.c"
186879 /*
186880 ** 2009 March 3
186881 **
186882 ** The author disclaims copyright to this source code. In place of
186883 ** a legal notice, here is a blessing:
@@ -187212,11 +186515,10 @@
187212 }
187213 #endif
187214
187215 /************** End of notify.c **********************************************/
187216 /************** Begin file fts3.c ********************************************/
187217 #line 1 "tsrc/fts3.c"
187218 /*
187219 ** 2006 Oct 10
187220 **
187221 ** The author disclaims copyright to this source code. In place of
187222 ** a legal notice, here is a blessing:
@@ -187505,11 +186807,10 @@
187505 ** older data.
187506 */
187507
187508 /************** Include fts3Int.h in the middle of fts3.c ********************/
187509 /************** Begin file fts3Int.h *****************************************/
187510 #line 1 "tsrc/fts3Int.h"
187511 /*
187512 ** 2009 Nov 12
187513 **
187514 ** The author disclaims copyright to this source code. In place of
187515 ** a legal notice, here is a blessing:
@@ -187552,11 +186853,10 @@
187552 #endif
187553
187554 /* #include "sqlite3.h" */
187555 /************** Include fts3_tokenizer.h in the middle of fts3Int.h **********/
187556 /************** Begin file fts3_tokenizer.h **********************************/
187557 #line 1 "tsrc/fts3_tokenizer.h"
187558 /*
187559 ** 2006 July 10
187560 **
187561 ** The author disclaims copyright to this source code.
187562 **
@@ -187717,14 +187017,12 @@
187717
187718 #endif /* _FTS3_TOKENIZER_H_ */
187719
187720 /************** End of fts3_tokenizer.h **************************************/
187721 /************** Continuing where we left off in fts3Int.h ********************/
187722 #line 46 "tsrc/fts3Int.h"
187723 /************** Include fts3_hash.h in the middle of fts3Int.h ***************/
187724 /************** Begin file fts3_hash.h ***************************************/
187725 #line 1 "tsrc/fts3_hash.h"
187726 /*
187727 ** 2001 September 22
187728 **
187729 ** The author disclaims copyright to this source code. In place of
187730 ** a legal notice, here is a blessing:
@@ -187836,11 +187134,10 @@
187836
187837 #endif /* _FTS3_HASH_H_ */
187838
187839 /************** End of fts3_hash.h *******************************************/
187840 /************** Continuing where we left off in fts3Int.h ********************/
187841 #line 47 "tsrc/fts3Int.h"
187842
187843 /*
187844 ** This constant determines the maximum depth of an FTS expression tree
187845 ** that the library will create and use. FTS uses recursion to perform
187846 ** various operations on the query tree, so the disadvantage of a large
@@ -188453,11 +187750,10 @@
188453 #endif /* !SQLITE_CORE || SQLITE_ENABLE_FTS3 */
188454 #endif /* _FTSINT_H */
188455
188456 /************** End of fts3Int.h *********************************************/
188457 /************** Continuing where we left off in fts3.c ***********************/
188458 #line 292 "tsrc/fts3.c"
188459 #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
188460
188461 #if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_CORE)
188462 # define SQLITE_CORE 1
188463 #endif
@@ -190509,14 +189805,19 @@
190509
190510 assert_fts3_nc( p!=0 && *p1!=0 && *p2!=0 );
190511 if( *p1==POS_COLUMN ){
190512 p1++;
190513 p1 += fts3GetVarint32(p1, &iCol1);
 
 
 
190514 }
190515 if( *p2==POS_COLUMN ){
190516 p2++;
190517 p2 += fts3GetVarint32(p2, &iCol2);
 
 
190518 }
190519
190520 while( 1 ){
190521 if( iCol1==iCol2 ){
190522 char *pSave = p;
@@ -193683,11 +192984,11 @@
193683 for(p=pExpr; p->pLeft; p=p->pLeft){
193684 assert( p->pRight->pPhrase->doclist.nList>0 );
193685 nTmp += p->pRight->pPhrase->doclist.nList;
193686 }
193687 nTmp += p->pPhrase->doclist.nList;
193688 aTmp = sqlite3_malloc64(nTmp*2);
193689 if( !aTmp ){
193690 *pRc = SQLITE_NOMEM;
193691 res = 0;
193692 }else{
193693 char *aPoslist = p->pPhrase->doclist.pList;
@@ -194355,11 +193656,10 @@
194355
194356 #endif
194357
194358 /************** End of fts3.c ************************************************/
194359 /************** Begin file fts3_aux.c ****************************************/
194360 #line 1 "tsrc/fts3_aux.c"
194361 /*
194362 ** 2011 Jan 27
194363 **
194364 ** The author disclaims copyright to this source code. In place of
194365 ** a legal notice, here is a blessing:
@@ -194916,11 +194216,10 @@
194916
194917 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
194918
194919 /************** End of fts3_aux.c ********************************************/
194920 /************** Begin file fts3_expr.c ***************************************/
194921 #line 1 "tsrc/fts3_expr.c"
194922 /*
194923 ** 2008 Nov 28
194924 **
194925 ** The author disclaims copyright to this source code. In place of
194926 ** a legal notice, here is a blessing:
@@ -196213,11 +195512,10 @@
196213 #endif
196214 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
196215
196216 /************** End of fts3_expr.c *******************************************/
196217 /************** Begin file fts3_hash.c ***************************************/
196218 #line 1 "tsrc/fts3_hash.c"
196219 /*
196220 ** 2001 September 22
196221 **
196222 ** The author disclaims copyright to this source code. In place of
196223 ** a legal notice, here is a blessing:
@@ -196600,11 +195898,10 @@
196600
196601 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
196602
196603 /************** End of fts3_hash.c *******************************************/
196604 /************** Begin file fts3_porter.c *************************************/
196605 #line 1 "tsrc/fts3_porter.c"
196606 /*
196607 ** 2006 September 30
196608 **
196609 ** The author disclaims copyright to this source code. In place of
196610 ** a legal notice, here is a blessing:
@@ -197266,11 +196563,10 @@
197266
197267 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
197268
197269 /************** End of fts3_porter.c *****************************************/
197270 /************** Begin file fts3_tokenizer.c **********************************/
197271 #line 1 "tsrc/fts3_tokenizer.c"
197272 /*
197273 ** 2007 June 22
197274 **
197275 ** The author disclaims copyright to this source code. In place of
197276 ** a legal notice, here is a blessing:
@@ -197786,11 +197082,10 @@
197786
197787 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
197788
197789 /************** End of fts3_tokenizer.c **************************************/
197790 /************** Begin file fts3_tokenizer1.c *********************************/
197791 #line 1 "tsrc/fts3_tokenizer1.c"
197792 /*
197793 ** 2006 Oct 10
197794 **
197795 ** The author disclaims copyright to this source code. In place of
197796 ** a legal notice, here is a blessing:
@@ -198024,11 +197319,10 @@
198024
198025 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
198026
198027 /************** End of fts3_tokenizer1.c *************************************/
198028 /************** Begin file fts3_tokenize_vtab.c ******************************/
198029 #line 1 "tsrc/fts3_tokenize_vtab.c"
198030 /*
198031 ** 2013 Apr 22
198032 **
198033 ** The author disclaims copyright to this source code. In place of
198034 ** a legal notice, here is a blessing:
@@ -198487,11 +197781,10 @@
198487
198488 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
198489
198490 /************** End of fts3_tokenize_vtab.c **********************************/
198491 /************** Begin file fts3_write.c **************************************/
198492 #line 1 "tsrc/fts3_write.c"
198493 /*
198494 ** 2009 Oct 23
198495 **
198496 ** The author disclaims copyright to this source code. In place of
198497 ** a legal notice, here is a blessing:
@@ -204325,11 +203618,10 @@
204325
204326 #endif
204327
204328 /************** End of fts3_write.c ******************************************/
204329 /************** Begin file fts3_snippet.c ************************************/
204330 #line 1 "tsrc/fts3_snippet.c"
204331 /*
204332 ** 2009 Oct 23
204333 **
204334 ** The author disclaims copyright to this source code. In place of
204335 ** a legal notice, here is a blessing:
@@ -206085,11 +205377,10 @@
206085
206086 #endif
206087
206088 /************** End of fts3_snippet.c ****************************************/
206089 /************** Begin file fts3_unicode.c ************************************/
206090 #line 1 "tsrc/fts3_unicode.c"
206091 /*
206092 ** 2012 May 24
206093 **
206094 ** The author disclaims copyright to this source code. In place of
206095 ** a legal notice, here is a blessing:
@@ -206486,11 +205777,10 @@
206486 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
206487 #endif /* ifndef SQLITE_DISABLE_FTS3_UNICODE */
206488
206489 /************** End of fts3_unicode.c ****************************************/
206490 /************** Begin file fts3_unicode2.c ***********************************/
206491 #line 1 "tsrc/fts3_unicode2.c"
206492 /*
206493 ** 2012-05-25
206494 **
206495 ** The author disclaims copyright to this source code. In place of
206496 ** a legal notice, here is a blessing:
@@ -206873,11 +206163,10 @@
206873 #endif /* defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4) */
206874 #endif /* !defined(SQLITE_DISABLE_FTS3_UNICODE) */
206875
206876 /************** End of fts3_unicode2.c ***************************************/
206877 /************** Begin file json.c ********************************************/
206878 #line 1 "tsrc/json.c"
206879 /*
206880 ** 2015-08-12
206881 **
206882 ** The author disclaims copyright to this source code. In place of
206883 ** a legal notice, here is a blessing:
@@ -212343,11 +211632,10 @@
212343 }
212344 #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON) */
212345
212346 /************** End of json.c ************************************************/
212347 /************** Begin file rtree.c *******************************************/
212348 #line 1 "tsrc/rtree.c"
212349 /*
212350 ** 2001 September 15
212351 **
212352 ** The author disclaims copyright to this source code. In place of
212353 ** a legal notice, here is a blessing:
@@ -216632,11 +215920,10 @@
216632
216633 /* Conditionally include the geopoly code */
216634 #ifdef SQLITE_ENABLE_GEOPOLY
216635 /************** Include geopoly.c in the middle of rtree.c *******************/
216636 /************** Begin file geopoly.c *****************************************/
216637 #line 1 "tsrc/geopoly.c"
216638 /*
216639 ** 2018-05-25
216640 **
216641 ** The author disclaims copyright to this source code. In place of
216642 ** a legal notice, here is a blessing:
@@ -218475,11 +217762,10 @@
218475 return rc;
218476 }
218477
218478 /************** End of geopoly.c *********************************************/
218479 /************** Continuing where we left off in rtree.c **********************/
218480 #line 4288 "tsrc/rtree.c"
218481 #endif
218482
218483 /*
218484 ** Register the r-tree module with database handle db. This creates the
218485 ** virtual table module "rtree" and the debugging/analysis scalar
@@ -218658,11 +217944,10 @@
218658
218659 #endif
218660
218661 /************** End of rtree.c ***********************************************/
218662 /************** Begin file icu.c *********************************************/
218663 #line 1 "tsrc/icu.c"
218664 /*
218665 ** 2007 May 6
218666 **
218667 ** The author disclaims copyright to this source code. In place of
218668 ** a legal notice, here is a blessing:
@@ -219250,11 +218535,10 @@
219250
219251 #endif
219252
219253 /************** End of icu.c *************************************************/
219254 /************** Begin file fts3_icu.c ****************************************/
219255 #line 1 "tsrc/fts3_icu.c"
219256 /*
219257 ** 2007 June 22
219258 **
219259 ** The author disclaims copyright to this source code. In place of
219260 ** a legal notice, here is a blessing:
@@ -219516,11 +218800,10 @@
219516 #endif /* defined(SQLITE_ENABLE_ICU) */
219517 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
219518
219519 /************** End of fts3_icu.c ********************************************/
219520 /************** Begin file sqlite3rbu.c **************************************/
219521 #line 1 "tsrc/sqlite3rbu.c"
219522 /*
219523 ** 2014 August 30
219524 **
219525 ** The author disclaims copyright to this source code. In place of
219526 ** a legal notice, here is a blessing:
@@ -219608,11 +218891,10 @@
219608 /* #include "sqlite3.h" */
219609
219610 #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU)
219611 /************** Include sqlite3rbu.h in the middle of sqlite3rbu.c ***********/
219612 /************** Begin file sqlite3rbu.h **************************************/
219613 #line 1 "tsrc/sqlite3rbu.h"
219614 /*
219615 ** 2014 August 30
219616 **
219617 ** The author disclaims copyright to this source code. In place of
219618 ** a legal notice, here is a blessing:
@@ -220245,11 +219527,10 @@
220245
220246 #endif /* _SQLITE3RBU_H */
220247
220248 /************** End of sqlite3rbu.h ******************************************/
220249 /************** Continuing where we left off in sqlite3rbu.c *****************/
220250 #line 91 "tsrc/sqlite3rbu.c"
220251
220252 #if defined(_WIN32_WCE)
220253 /* #include "windows.h" */
220254 #endif
220255
@@ -225606,11 +224887,10 @@
225606
225607 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU) */
225608
225609 /************** End of sqlite3rbu.c ******************************************/
225610 /************** Begin file dbstat.c ******************************************/
225611 #line 1 "tsrc/dbstat.c"
225612 /*
225613 ** 2010 July 12
225614 **
225615 ** The author disclaims copyright to this source code. In place of
225616 ** a legal notice, here is a blessing:
@@ -226516,11 +225796,10 @@
226516 SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3 *db){ return SQLITE_OK; }
226517 #endif /* SQLITE_ENABLE_DBSTAT_VTAB */
226518
226519 /************** End of dbstat.c **********************************************/
226520 /************** Begin file dbpage.c ******************************************/
226521 #line 1 "tsrc/dbpage.c"
226522 /*
226523 ** 2017-10-11
226524 **
226525 ** The author disclaims copyright to this source code. In place of
226526 ** a legal notice, here is a blessing:
@@ -226999,11 +226278,10 @@
226999 SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3 *db){ return SQLITE_OK; }
227000 #endif /* SQLITE_ENABLE_DBSTAT_VTAB */
227001
227002 /************** End of dbpage.c **********************************************/
227003 /************** Begin file sqlite3session.c **********************************/
227004 #line 1 "tsrc/sqlite3session.c"
227005
227006 #if defined(SQLITE_ENABLE_SESSION) && defined(SQLITE_ENABLE_PREUPDATE_HOOK)
227007 /* #include "sqlite3session.h" */
227008 /* #include <assert.h> */
227009 /* #include <string.h> */
@@ -233539,11 +232817,10 @@
233539
233540 #endif /* SQLITE_ENABLE_SESSION && SQLITE_ENABLE_PREUPDATE_HOOK */
233541
233542 /************** End of sqlite3session.c **************************************/
233543 /************** Begin file fts5.c ********************************************/
233544 #line 1 "tsrc/fts5.c"
233545
233546 /*
233547 ** This, the "fts5.c" source file, is a composite file that is itself
233548 ** assembled from the following files:
233549 **
@@ -233577,11 +232854,10 @@
233577 /* #include <stdint.h> */
233578 #endif
233579 #ifdef HAVE_INTTYPES_H
233580 /* #include <inttypes.h> */
233581 #endif
233582 #line 1 "fts5.h"
233583 /*
233584 ** 2014 May 31
233585 **
233586 ** The author disclaims copyright to this source code. In place of
233587 ** a legal notice, here is a blessing:
@@ -234318,11 +233594,10 @@
234318 } /* end of the 'extern "C"' block */
234319 #endif
234320
234321 #endif /* _FTS5_H */
234322
234323 #line 1 "fts5Int.h"
234324 /*
234325 ** 2014 May 31
234326 **
234327 ** The author disclaims copyright to this source code. In place of
234328 ** a legal notice, here is a blessing:
@@ -235258,11 +234533,10 @@
235258 ** End of interface to code in fts5_unicode2.c.
235259 **************************************************************************/
235260
235261 #endif
235262
235263 #line 1 "fts5parse.h"
235264 #define FTS5_OR 1
235265 #define FTS5_AND 2
235266 #define FTS5_NOT 3
235267 #define FTS5_TERM 4
235268 #define FTS5_COLON 5
@@ -235275,11 +234549,10 @@
235275 #define FTS5_CARET 12
235276 #define FTS5_COMMA 13
235277 #define FTS5_PLUS 14
235278 #define FTS5_STAR 15
235279
235280 #line 1 "fts5parse.c"
235281 /* This file is automatically generated by Lemon from input grammar
235282 ** source file "fts5parse.y".
235283 */
235284 /*
235285 ** 2000-05-29
@@ -235304,11 +234577,10 @@
235304 **
235305 ** The following is the concatenation of all %include directives from the
235306 ** input grammar file:
235307 */
235308 /************ Begin %include sections from the grammar ************************/
235309 #line 47 "fts5parse.y"
235310
235311 /* #include "fts5Int.h" */
235312 /* #include "fts5parse.h" */
235313
235314 /*
@@ -235332,11 +234604,10 @@
235332 ** Alternative datatype for the argument to the malloc() routine passed
235333 ** into sqlite3ParserAlloc(). The default is size_t.
235334 */
235335 #define fts5YYMALLOCARGTYPE u64
235336
235337 #line 58 "fts5parse.sql"
235338 /**************** End of %include directives **********************************/
235339 /* These constants specify the various numeric values for terminal symbols.
235340 ***************** Begin token definitions *************************************/
235341 #ifndef FTS5_OR
235342 #define FTS5_OR 1
@@ -235879,45 +235150,35 @@
235879 ** inside the C code.
235880 */
235881 /********* Begin destructor definitions ***************************************/
235882 case 16: /* input */
235883 {
235884 #line 83 "fts5parse.y"
235885 (void)pParse;
235886 #line 606 "fts5parse.sql"
235887 }
235888 break;
235889 case 17: /* expr */
235890 case 18: /* cnearset */
235891 case 19: /* exprlist */
235892 {
235893 #line 89 "fts5parse.y"
235894 sqlite3Fts5ParseNodeFree((fts5yypminor->fts5yy24));
235895 #line 615 "fts5parse.sql"
235896 }
235897 break;
235898 case 20: /* colset */
235899 case 21: /* colsetlist */
235900 {
235901 #line 93 "fts5parse.y"
235902 sqlite3_free((fts5yypminor->fts5yy11));
235903 #line 623 "fts5parse.sql"
235904 }
235905 break;
235906 case 22: /* nearset */
235907 case 23: /* nearphrases */
235908 {
235909 #line 148 "fts5parse.y"
235910 sqlite3Fts5ParseNearsetFree((fts5yypminor->fts5yy46));
235911 #line 631 "fts5parse.sql"
235912 }
235913 break;
235914 case 24: /* phrase */
235915 {
235916 #line 183 "fts5parse.y"
235917 sqlite3Fts5ParsePhraseFree((fts5yypminor->fts5yy53));
235918 #line 638 "fts5parse.sql"
235919 }
235920 break;
235921 /********* End destructor definitions *****************************************/
235922 default: break; /* If no destructor action specified: do nothing */
235923 }
@@ -236148,14 +235409,12 @@
236148 #endif
236149 while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser);
236150 /* Here code is inserted which will execute if the parser
236151 ** stack every overflows */
236152 /******** Begin %stack_overflow code ******************************************/
236153 #line 36 "fts5parse.y"
236154
236155 sqlite3Fts5ParseError(pParse, "fts5: parser stack overflow");
236156 #line 876 "fts5parse.sql"
236157 /******** End %stack_overflow code ********************************************/
236158 sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument var */
236159 sqlite3Fts5ParserCTX_STORE
236160 }
236161
@@ -236320,202 +235579,148 @@
236320 ** break;
236321 */
236322 /********** Begin reduce actions **********************************************/
236323 fts5YYMINORTYPE fts5yylhsminor;
236324 case 0: /* input ::= expr */
236325 #line 82 "fts5parse.y"
236326 { sqlite3Fts5ParseFinished(pParse, fts5yymsp[0].minor.fts5yy24); }
236327 #line 1047 "fts5parse.sql"
236328 break;
236329 case 1: /* colset ::= MINUS LCP colsetlist RCP */
236330 #line 97 "fts5parse.y"
236331 {
236332 fts5yymsp[-3].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11);
236333 }
236334 #line 1054 "fts5parse.sql"
236335 break;
236336 case 2: /* colset ::= LCP colsetlist RCP */
236337 #line 100 "fts5parse.y"
236338 { fts5yymsp[-2].minor.fts5yy11 = fts5yymsp[-1].minor.fts5yy11; }
236339 #line 1059 "fts5parse.sql"
236340 break;
236341 case 3: /* colset ::= STRING */
236342 #line 101 "fts5parse.y"
236343 {
236344 fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
236345 }
236346 #line 1066 "fts5parse.sql"
236347 fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
236348 break;
236349 case 4: /* colset ::= MINUS STRING */
236350 #line 104 "fts5parse.y"
236351 {
236352 fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
236353 fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11);
236354 }
236355 #line 1075 "fts5parse.sql"
236356 break;
236357 case 5: /* colsetlist ::= colsetlist STRING */
236358 #line 109 "fts5parse.y"
236359 {
236360 fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, fts5yymsp[-1].minor.fts5yy11, &fts5yymsp[0].minor.fts5yy0); }
236361 #line 1081 "fts5parse.sql"
236362 fts5yymsp[-1].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
236363 break;
236364 case 6: /* colsetlist ::= STRING */
236365 #line 111 "fts5parse.y"
236366 {
236367 fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
236368 }
236369 #line 1089 "fts5parse.sql"
236370 fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
236371 break;
236372 case 7: /* expr ::= expr AND expr */
236373 #line 115 "fts5parse.y"
236374 {
236375 fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_AND, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
236376 }
236377 #line 1097 "fts5parse.sql"
236378 fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
236379 break;
236380 case 8: /* expr ::= expr OR expr */
236381 #line 118 "fts5parse.y"
236382 {
236383 fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_OR, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
236384 }
236385 #line 1105 "fts5parse.sql"
236386 fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
236387 break;
236388 case 9: /* expr ::= expr NOT expr */
236389 #line 121 "fts5parse.y"
236390 {
236391 fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_NOT, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
236392 }
236393 #line 1113 "fts5parse.sql"
236394 fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
236395 break;
236396 case 10: /* expr ::= colset COLON LP expr RP */
236397 #line 125 "fts5parse.y"
236398 {
236399 sqlite3Fts5ParseSetColset(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[-4].minor.fts5yy11);
236400 fts5yylhsminor.fts5yy24 = fts5yymsp[-1].minor.fts5yy24;
236401 }
236402 #line 1122 "fts5parse.sql"
236403 fts5yymsp[-4].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
236404 break;
236405 case 11: /* expr ::= LP expr RP */
236406 #line 129 "fts5parse.y"
236407 {fts5yymsp[-2].minor.fts5yy24 = fts5yymsp[-1].minor.fts5yy24;}
236408 #line 1128 "fts5parse.sql"
236409 break;
236410 case 12: /* expr ::= exprlist */
236411 case 13: /* exprlist ::= cnearset */ fts5yytestcase(fts5yyruleno==13);
236412 #line 130 "fts5parse.y"
236413 {fts5yylhsminor.fts5yy24 = fts5yymsp[0].minor.fts5yy24;}
236414 #line 1134 "fts5parse.sql"
236415 fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
236416 break;
236417 case 14: /* exprlist ::= exprlist cnearset */
236418 #line 133 "fts5parse.y"
236419 {
236420 fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseImplicitAnd(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24);
236421 }
236422 #line 1142 "fts5parse.sql"
236423 fts5yymsp[-1].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
236424 break;
236425 case 15: /* cnearset ::= nearset */
236426 #line 137 "fts5parse.y"
236427 {
236428 fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46);
236429 }
236430 #line 1150 "fts5parse.sql"
236431 fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
236432 break;
236433 case 16: /* cnearset ::= colset COLON nearset */
236434 #line 140 "fts5parse.y"
236435 {
236436 fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46);
236437 sqlite3Fts5ParseSetColset(pParse, fts5yylhsminor.fts5yy24, fts5yymsp[-2].minor.fts5yy11);
236438 }
236439 #line 1159 "fts5parse.sql"
236440 fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
236441 break;
236442 case 17: /* nearset ::= phrase */
236443 #line 151 "fts5parse.y"
236444 { fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); }
236445 #line 1165 "fts5parse.sql"
236446 fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
236447 break;
236448 case 18: /* nearset ::= CARET phrase */
236449 #line 152 "fts5parse.y"
236450 {
236451 sqlite3Fts5ParseSetCaret(fts5yymsp[0].minor.fts5yy53);
236452 fts5yymsp[-1].minor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53);
236453 }
236454 #line 1174 "fts5parse.sql"
236455 break;
236456 case 19: /* nearset ::= STRING LP nearphrases neardist_opt RP */
236457 #line 156 "fts5parse.y"
236458 {
236459 sqlite3Fts5ParseNear(pParse, &fts5yymsp[-4].minor.fts5yy0);
236460 sqlite3Fts5ParseSetDistance(pParse, fts5yymsp[-2].minor.fts5yy46, &fts5yymsp[-1].minor.fts5yy0);
236461 fts5yylhsminor.fts5yy46 = fts5yymsp[-2].minor.fts5yy46;
236462 }
236463 #line 1183 "fts5parse.sql"
236464 fts5yymsp[-4].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
236465 break;
236466 case 20: /* nearphrases ::= phrase */
236467 #line 162 "fts5parse.y"
236468 {
236469 fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53);
236470 }
236471 #line 1191 "fts5parse.sql"
236472 fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
236473 break;
236474 case 21: /* nearphrases ::= nearphrases phrase */
236475 #line 165 "fts5parse.y"
236476 {
236477 fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, fts5yymsp[-1].minor.fts5yy46, fts5yymsp[0].minor.fts5yy53);
236478 }
236479 #line 1199 "fts5parse.sql"
236480 fts5yymsp[-1].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
236481 break;
236482 case 22: /* neardist_opt ::= */
236483 #line 172 "fts5parse.y"
236484 { fts5yymsp[1].minor.fts5yy0.p = 0; fts5yymsp[1].minor.fts5yy0.n = 0; }
236485 #line 1205 "fts5parse.sql"
236486 break;
236487 case 23: /* neardist_opt ::= COMMA STRING */
236488 #line 173 "fts5parse.y"
236489 { fts5yymsp[-1].minor.fts5yy0 = fts5yymsp[0].minor.fts5yy0; }
236490 #line 1210 "fts5parse.sql"
236491 break;
236492 case 24: /* phrase ::= phrase PLUS STRING star_opt */
236493 #line 185 "fts5parse.y"
236494 {
236495 fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, fts5yymsp[-3].minor.fts5yy53, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);
236496 }
236497 #line 1217 "fts5parse.sql"
236498 fts5yymsp[-3].minor.fts5yy53 = fts5yylhsminor.fts5yy53;
236499 break;
236500 case 25: /* phrase ::= STRING star_opt */
236501 #line 188 "fts5parse.y"
236502 {
236503 fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, 0, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);
236504 }
236505 #line 1225 "fts5parse.sql"
236506 fts5yymsp[-1].minor.fts5yy53 = fts5yylhsminor.fts5yy53;
236507 break;
236508 case 26: /* star_opt ::= STAR */
236509 #line 196 "fts5parse.y"
236510 { fts5yymsp[0].minor.fts5yy4 = 1; }
236511 #line 1231 "fts5parse.sql"
236512 break;
236513 case 27: /* star_opt ::= */
236514 #line 197 "fts5parse.y"
236515 { fts5yymsp[1].minor.fts5yy4 = 0; }
236516 #line 1236 "fts5parse.sql"
236517 break;
236518 default:
236519 break;
236520 /********** End reduce actions ************************************************/
236521 };
@@ -236573,17 +235778,15 @@
236573 ){
236574 sqlite3Fts5ParserARG_FETCH
236575 sqlite3Fts5ParserCTX_FETCH
236576 #define FTS5TOKEN fts5yyminor
236577 /************ Begin %syntax_error code ****************************************/
236578 #line 30 "fts5parse.y"
236579
236580 UNUSED_PARAM(fts5yymajor); /* Silence a compiler warning */
236581 sqlite3Fts5ParseError(
236582 pParse, "fts5: syntax error near \"%.*s\"",FTS5TOKEN.n,FTS5TOKEN.p
236583 );
236584 #line 1304 "fts5parse.sql"
236585 /************ End %syntax_error code ******************************************/
236586 sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
236587 sqlite3Fts5ParserCTX_STORE
236588 }
236589
@@ -236849,11 +236052,10 @@
236849 (void)iToken;
236850 return 0;
236851 #endif
236852 }
236853
236854 #line 1 "fts5_aux.c"
236855 /*
236856 ** 2014 May 31
236857 **
236858 ** The author disclaims copyright to this source code. In place of
236859 ** a legal notice, here is a blessing:
@@ -237672,11 +236874,10 @@
237672 }
237673
237674 return rc;
237675 }
237676
237677 #line 1 "fts5_buffer.c"
237678 /*
237679 ** 2014 May 31
237680 **
237681 ** The author disclaims copyright to this source code. In place of
237682 ** a legal notice, here is a blessing:
@@ -238085,11 +237286,10 @@
238085 }
238086 sqlite3_free(p);
238087 }
238088 }
238089
238090 #line 1 "fts5_config.c"
238091 /*
238092 ** 2014 Jun 09
238093 **
238094 ** The author disclaims copyright to this source code. In place of
238095 ** a legal notice, here is a blessing:
@@ -239201,11 +238401,10 @@
239201 va_end(ap);
239202 }
239203
239204
239205
239206 #line 1 "fts5_expr.c"
239207 /*
239208 ** 2014 May 31
239209 **
239210 ** The author disclaims copyright to this source code. In place of
239211 ** a legal notice, here is a blessing:
@@ -242470,11 +241669,10 @@
242470 sqlite3Fts5IndexIterClearTokendata(pT->pIter);
242471 }
242472 }
242473 }
242474
242475 #line 1 "fts5_hash.c"
242476 /*
242477 ** 2014 August 11
242478 **
242479 ** The author disclaims copyright to this source code. In place of
242480 ** a legal notice, here is a blessing:
@@ -243062,11 +242260,10 @@
243062 *ppDoclist = 0;
243063 *pnDoclist = 0;
243064 }
243065 }
243066
243067 #line 1 "fts5_index.c"
243068 /*
243069 ** 2014 May 31
243070 **
243071 ** The author disclaims copyright to this source code. In place of
243072 ** a legal notice, here is a blessing:
@@ -252140,11 +251337,10 @@
252140 fts5StructureInvalidate(p);
252141 }
252142 return fts5IndexReturn(p);
252143 }
252144
252145 #line 1 "fts5_main.c"
252146 /*
252147 ** 2014 Jun 09
252148 **
252149 ** The author disclaims copyright to this source code. In place of
252150 ** a legal notice, here is a blessing:
@@ -252775,10 +251971,11 @@
252775 ){
252776 /* A MATCH operator or equivalent */
252777 if( p->usable==0 || iCol<0 ){
252778 /* As there exists an unusable MATCH constraint this is an
252779 ** unusable plan. Return SQLITE_CONSTRAINT. */
 
252780 return SQLITE_CONSTRAINT;
252781 }else{
252782 if( iCol==nCol+1 ){
252783 if( bSeenRank ) continue;
252784 idxStr[iIdxStr++] = 'r';
@@ -255730,11 +254927,11 @@
255730 int nArg, /* Number of args */
255731 sqlite3_value **apUnused /* Function arguments */
255732 ){
255733 assert( nArg==0 );
255734 UNUSED_PARAM2(nArg, apUnused);
255735 sqlite3_result_text(pCtx, "fts5: 2024-11-06 12:58:31 5495b12569c318d5020b4b5a625a392ef8e777b81c0200624fbbc2a6b5eddef9", -1, SQLITE_TRANSIENT);
255736 }
255737
255738 /*
255739 ** Implementation of fts5_locale(LOCALE, TEXT) function.
255740 **
@@ -255983,11 +255180,10 @@
255983 SQLITE_PRIVATE int sqlite3Fts5Init(sqlite3 *db){
255984 return fts5Init(db);
255985 }
255986 #endif
255987
255988 #line 1 "fts5_storage.c"
255989 /*
255990 ** 2014 May 31
255991 **
255992 ** The author disclaims copyright to this source code. In place of
255993 ** a legal notice, here is a blessing:
@@ -257497,11 +256693,10 @@
257497 }
257498 }
257499 return rc;
257500 }
257501
257502 #line 1 "fts5_tokenize.c"
257503 /*
257504 ** 2014 May 31
257505 **
257506 ** The author disclaims copyright to this source code. In place of
257507 ** a legal notice, here is a blessing:
@@ -258854,21 +258049,21 @@
258854 char aBuf[32];
258855 char *zOut = aBuf;
258856 int ii;
258857 const unsigned char *zIn = (const unsigned char*)pText;
258858 const unsigned char *zEof = &zIn[nText];
258859 u32 iCode;
258860 int aStart[3]; /* Input offset of each character in aBuf[] */
258861
258862 UNUSED_PARAM(unusedFlags);
258863
258864 /* Populate aBuf[] with the characters for the first trigram. */
258865 for(ii=0; ii<3; ii++){
258866 do {
258867 aStart[ii] = zIn - (const unsigned char*)pText;
 
258868 READ_UTF8(zIn, zEof, iCode);
258869 if( iCode==0 ) return SQLITE_OK;
258870 if( p->bFold ) iCode = sqlite3Fts5UnicodeFold(iCode, p->iFoldParam);
258871 }while( iCode==0 );
258872 WRITE_UTF8(zOut, iCode);
258873 }
258874
@@ -258885,12 +258080,15 @@
258885 const char *z1;
258886
258887 /* Read characters from the input up until the first non-diacritic */
258888 do {
258889 iNext = zIn - (const unsigned char*)pText;
 
 
 
 
258890 READ_UTF8(zIn, zEof, iCode);
258891 if( iCode==0 ) break;
258892 if( p->bFold ) iCode = sqlite3Fts5UnicodeFold(iCode, p->iFoldParam);
258893 }while( iCode==0 );
258894
258895 /* Pass the current trigram back to fts5 */
258896 rc = xToken(pCtx, 0, aBuf, zOut-aBuf, aStart[0], iNext);
@@ -258986,11 +258184,10 @@
258986 );
258987 }
258988 return rc;
258989 }
258990
258991 #line 1 "fts5_unicode2.c"
258992 /*
258993 ** 2012-05-25
258994 **
258995 ** The author disclaims copyright to this source code. In place of
258996 ** a legal notice, here is a blessing:
@@ -259769,11 +258966,10 @@
259769 }
259770 aAscii[0] = 0; /* 0x00 is never a token character */
259771 }
259772
259773
259774 #line 1 "fts5_varint.c"
259775 /*
259776 ** 2015 May 30
259777 **
259778 ** The author disclaims copyright to this source code. In place of
259779 ** a legal notice, here is a blessing:
@@ -260115,11 +259311,10 @@
260115 if( iVal<(1 << 21) ) return 3;
260116 if( iVal<(1 << 28) ) return 4;
260117 return 5;
260118 }
260119
260120 #line 1 "fts5_vocab.c"
260121 /*
260122 ** 2015 May 08
260123 **
260124 ** The author disclaims copyright to this source code. In place of
260125 ** a legal notice, here is a blessing:
@@ -260931,11 +260126,10 @@
260931 /* Here ends the fts5.c composite file. */
260932 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS5) */
260933
260934 /************** End of fts5.c ************************************************/
260935 /************** Begin file stmt.c ********************************************/
260936 #line 1 "tsrc/stmt.c"
260937 /*
260938 ** 2017-05-31
260939 **
260940 ** The author disclaims copyright to this source code. In place of
260941 ** a legal notice, here is a blessing:
260942
--- 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 ** 81202d2ab5963fdcf20555b6d0b31cc955ac with changes in files:
22 **
23 **
24 */
25 #ifndef SQLITE_AMALGAMATION
26 #define SQLITE_CORE 1
@@ -27,11 +27,10 @@
27 #define SQLITE_AMALGAMATION 1
28 #ifndef SQLITE_PRIVATE
29 # define SQLITE_PRIVATE static
30 #endif
31 /************** Begin file sqliteInt.h ***************************************/
 
32 /*
33 ** 2001 September 15
34 **
35 ** The author disclaims copyright to this source code. In place of
36 ** a legal notice, here is a blessing:
@@ -88,11 +87,10 @@
87 ** compiler warnings due to subsequent content in this file and other files
88 ** that are included by this file.
89 */
90 /************** Include msvc.h in the middle of sqliteInt.h ******************/
91 /************** Begin file msvc.h ********************************************/
 
92 /*
93 ** 2015 January 12
94 **
95 ** The author disclaims copyright to this source code. In place of
96 ** a legal notice, here is a blessing:
@@ -137,18 +135,16 @@
135
136 #endif /* SQLITE_MSVC_H */
137
138 /************** End of msvc.h ************************************************/
139 /************** Continuing where we left off in sqliteInt.h ******************/
 
140
141 /*
142 ** Special setup for VxWorks
143 */
144 /************** Include vxworks.h in the middle of sqliteInt.h ***************/
145 /************** Begin file vxworks.h *****************************************/
 
146 /*
147 ** 2015-03-02
148 **
149 ** The author disclaims copyright to this source code. In place of
150 ** a legal notice, here is a blessing:
@@ -180,11 +176,10 @@
176 #define HAVE_LSTAT 1
177 #endif /* defined(_WRS_KERNEL) */
178
179 /************** End of vxworks.h *********************************************/
180 /************** Continuing where we left off in sqliteInt.h ******************/
 
181
182 /*
183 ** These #defines should enable >2GB file support on POSIX if the
184 ** underlying operating system supports it. If the OS lacks
185 ** large file support, or if the OS is windows, these should be no-ops.
@@ -320,11 +315,10 @@
315 ** first in QNX. Also, the _USE_32BIT_TIME_T macro must appear first for
316 ** MinGW.
317 */
318 /************** Include sqlite3.h in the middle of sqliteInt.h ***************/
319 /************** Begin file sqlite3.h *****************************************/
 
320 /*
321 ** 2001-09-15
322 **
323 ** The author disclaims copyright to this source code. In place of
324 ** a legal notice, here is a blessing:
@@ -471,11 +465,11 @@
465 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
466 ** [sqlite_version()] and [sqlite_source_id()].
467 */
468 #define SQLITE_VERSION "3.48.0"
469 #define SQLITE_VERSION_NUMBER 3048000
470 #define SQLITE_SOURCE_ID "2024-11-14 19:34:28 81202d2ab5963fdcf20555b6d0b31cc955ac27f1cd87656faea5c0611c9a2ee8"
471
472 /*
473 ** CAPI3REF: Run-Time Library Version Numbers
474 ** KEYWORDS: sqlite3_version sqlite3_sourceid
475 **
@@ -1423,10 +1417,15 @@
1417 ** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This
1418 ** opcode causes the xFileControl method to swap the file handle with the one
1419 ** pointed to by the pArg argument. This capability is used during testing
1420 ** and only needs to be supported when SQLITE_TEST is defined.
1421 **
1422 ** <li>[[SQLITE_FCNTL_NULL_IO]]
1423 ** The [SQLITE_FCNTL_NULL_IO] opcode sets the low-level file descriptor
1424 ** or file handle for the [sqlite3_file] object such that it will no longer
1425 ** read or write to the database file.
1426 **
1427 ** <li>[[SQLITE_FCNTL_WAL_BLOCK]]
1428 ** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
1429 ** be advantageous to block on the next WAL lock if the lock is not immediately
1430 ** available. The WAL subsystem issues this signal during rare
1431 ** circumstances in order to fix a problem with priority inversion.
@@ -1576,10 +1575,11 @@
1575 #define SQLITE_FCNTL_RESERVE_BYTES 38
1576 #define SQLITE_FCNTL_CKPT_START 39
1577 #define SQLITE_FCNTL_EXTERNAL_READER 40
1578 #define SQLITE_FCNTL_CKSM_FILE 41
1579 #define SQLITE_FCNTL_RESET_CACHE 42
1580 #define SQLITE_FCNTL_NULL_IO 43
1581
1582 /* deprecated names */
1583 #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
1584 #define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
1585 #define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
@@ -2954,14 +2954,18 @@
2954 **
2955 ** ^These functions return the number of rows modified, inserted or
2956 ** deleted by the most recently completed INSERT, UPDATE or DELETE
2957 ** statement on the database connection specified by the only parameter.
2958 ** The two functions are identical except for the type of the return value
2959 ** and that if the number of rows modified by the most recent INSERT, UPDATE,
2960 ** or DELETE is greater than the maximum value supported by type "int", then
2961 ** the return value of sqlite3_changes() is undefined. ^Executing any other
2962 ** type of SQL statement does not modify the value returned by these functions.
2963 ** For the purposes of this interface, a CREATE TABLE AS SELECT statement
2964 ** does not count as an INSERT, UPDATE or DELETE statement and hence the rows
2965 ** added to the new table by the CREATE TABLE AS SELECT statement are not
2966 ** counted.
2967 **
2968 ** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
2969 ** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
2970 ** [foreign key actions] or [REPLACE] constraint resolution are not counted.
2971 **
@@ -13908,11 +13912,10 @@
13912 /******** End of fts5.h *********/
13913 #endif /* SQLITE3_H */
13914
13915 /************** End of sqlite3.h *********************************************/
13916 /************** Continuing where we left off in sqliteInt.h ******************/
 
13917
13918 /*
13919 ** Reuse the STATIC_LRU for mutex access to sqlite3_temp_directory.
13920 */
13921 #define SQLITE_MUTEX_STATIC_TEMPDIR SQLITE_MUTEX_STATIC_VFS1
@@ -13926,11 +13929,10 @@
13929 #define SQLITECONFIG_H 1
13930 #endif
13931
13932 /************** Include sqliteLimit.h in the middle of sqliteInt.h ***********/
13933 /************** Begin file sqliteLimit.h *************************************/
 
13934 /*
13935 ** 2007 May 7
13936 **
13937 ** The author disclaims copyright to this source code. In place of
13938 ** a legal notice, here is a blessing:
@@ -13952,10 +13954,11 @@
13954 ** to count the size: 2^31-1 or 2147483647.
13955 */
13956 #ifndef SQLITE_MAX_LENGTH
13957 # define SQLITE_MAX_LENGTH 1000000000
13958 #endif
13959 #define SQLITE_MIN_LENGTH 30 /* Minimum value for the length limit */
13960
13961 /*
13962 ** This is the maximum number of
13963 **
13964 ** * Columns in a table
@@ -14140,11 +14143,10 @@
14143 # define SQLITE_MAX_TRIGGER_DEPTH 1000
14144 #endif
14145
14146 /************** End of sqliteLimit.h *****************************************/
14147 /************** Continuing where we left off in sqliteInt.h ******************/
 
14148
14149 /* Disable nuisance warnings on Borland compilers */
14150 #if defined(__BORLANDC__)
14151 #pragma warn -rch /* unreachable code */
14152 #pragma warn -ccc /* Condition is always true or false */
@@ -14558,11 +14560,10 @@
14560 #define likely(X) (X)
14561 #define unlikely(X) (X)
14562
14563 /************** Include hash.h in the middle of sqliteInt.h ******************/
14564 /************** Begin file hash.h ********************************************/
 
14565 /*
14566 ** 2001 September 22
14567 **
14568 ** The author disclaims copyright to this source code. In place of
14569 ** a legal notice, here is a blessing:
@@ -14658,14 +14659,12 @@
14659
14660 #endif /* SQLITE_HASH_H */
14661
14662 /************** End of hash.h ************************************************/
14663 /************** Continuing where we left off in sqliteInt.h ******************/
 
14664 /************** Include parse.h in the middle of sqliteInt.h *****************/
14665 /************** Begin file parse.h *******************************************/
 
14666 #define TK_SEMI 1
14667 #define TK_EXPLAIN 2
14668 #define TK_QUERY 3
14669 #define TK_PLAN 4
14670 #define TK_BEGIN 5
@@ -14850,11 +14849,10 @@
14849 #define TK_SPACE 184
14850 #define TK_ILLEGAL 185
14851
14852 /************** End of parse.h ***********************************************/
14853 /************** Continuing where we left off in sqliteInt.h ******************/
 
14854 #include <stdio.h>
14855 #include <stdlib.h>
14856 #include <string.h>
14857 #include <assert.h>
14858 #include <stddef.h>
@@ -15616,11 +15614,10 @@
15614 ** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque
15615 ** pointer types (i.e. FuncDef) defined above.
15616 */
15617 /************** Include os.h in the middle of sqliteInt.h ********************/
15618 /************** Begin file os.h **********************************************/
 
15619 /*
15620 ** 2001 September 16
15621 **
15622 ** The author disclaims copyright to this source code. In place of
15623 ** a legal notice, here is a blessing:
@@ -15645,11 +15642,10 @@
15642 ** Attempt to automatically detect the operating system and setup the
15643 ** necessary pre-processor macros for it.
15644 */
15645 /************** Include os_setup.h in the middle of os.h *********************/
15646 /************** Begin file os_setup.h ****************************************/
 
15647 /*
15648 ** 2013 November 25
15649 **
15650 ** The author disclaims copyright to this source code. In place of
15651 ** a legal notice, here is a blessing:
@@ -15740,11 +15736,10 @@
15736
15737 #endif /* SQLITE_OS_SETUP_H */
15738
15739 /************** End of os_setup.h ********************************************/
15740 /************** Continuing where we left off in os.h *************************/
 
15741
15742 /* If the SET_FULLSYNC macro is not defined above, then make it
15743 ** a no-op
15744 */
15745 #ifndef SET_FULLSYNC
@@ -15942,14 +15937,12 @@
15937
15938 #endif /* _SQLITE_OS_H_ */
15939
15940 /************** End of os.h **************************************************/
15941 /************** Continuing where we left off in sqliteInt.h ******************/
 
15942 /************** Include pager.h in the middle of sqliteInt.h *****************/
15943 /************** Begin file pager.h *******************************************/
 
15944 /*
15945 ** 2001 September 15
15946 **
15947 ** The author disclaims copyright to this source code. In place of
15948 ** a legal notice, here is a blessing:
@@ -16196,14 +16189,12 @@
16189
16190 #endif /* SQLITE_PAGER_H */
16191
16192 /************** End of pager.h ***********************************************/
16193 /************** Continuing where we left off in sqliteInt.h ******************/
 
16194 /************** Include btree.h in the middle of sqliteInt.h *****************/
16195 /************** Begin file btree.h *******************************************/
 
16196 /*
16197 ** 2001 September 15
16198 **
16199 ** The author disclaims copyright to this source code. In place of
16200 ** a legal notice, here is a blessing:
@@ -16627,14 +16618,12 @@
16618
16619 #endif /* SQLITE_BTREE_H */
16620
16621 /************** End of btree.h ***********************************************/
16622 /************** Continuing where we left off in sqliteInt.h ******************/
 
16623 /************** Include vdbe.h in the middle of sqliteInt.h ******************/
16624 /************** Begin file vdbe.h ********************************************/
 
16625 /*
16626 ** 2001 September 15
16627 **
16628 ** The author disclaims copyright to this source code. In place of
16629 ** a legal notice, here is a blessing:
@@ -16814,11 +16803,10 @@
16803 ** The makefile scans the vdbe.c source file and creates the "opcodes.h"
16804 ** header file that defines a number for each opcode used by the VDBE.
16805 */
16806 /************** Include opcodes.h in the middle of vdbe.h ********************/
16807 /************** Begin file opcodes.h *****************************************/
 
16808 /* Automatically generated. Do not edit */
16809 /* See the tool/mkopcodeh.tcl script for details */
16810 #define OP_Savepoint 0
16811 #define OP_AutoCommit 1
16812 #define OP_Transaction 2
@@ -17056,11 +17044,10 @@
17044 */
17045 #define SQLITE_MX_JUMP_OPCODE 64 /* Maximum JUMP opcode */
17046
17047 /************** End of opcodes.h *********************************************/
17048 /************** Continuing where we left off in vdbe.h ***********************/
 
17049
17050 /*
17051 ** Additional non-public SQLITE_PREPARE_* flags
17052 */
17053 #define SQLITE_PREPARE_SAVESQL 0x80 /* Preserve SQL text */
@@ -17306,14 +17293,12 @@
17293
17294 #endif /* SQLITE_VDBE_H */
17295
17296 /************** End of vdbe.h ************************************************/
17297 /************** Continuing where we left off in sqliteInt.h ******************/
 
17298 /************** Include pcache.h in the middle of sqliteInt.h ****************/
17299 /************** Begin file pcache.h ******************************************/
 
17300 /*
17301 ** 2008 August 05
17302 **
17303 ** The author disclaims copyright to this source code. In place of
17304 ** a legal notice, here is a blessing:
@@ -17503,14 +17488,12 @@
17488
17489 #endif /* _PCACHE_H_ */
17490
17491 /************** End of pcache.h **********************************************/
17492 /************** Continuing where we left off in sqliteInt.h ******************/
 
17493 /************** Include mutex.h in the middle of sqliteInt.h *****************/
17494 /************** Begin file mutex.h *******************************************/
 
17495 /*
17496 ** 2007 August 28
17497 **
17498 ** The author disclaims copyright to this source code. In place of
17499 ** a legal notice, here is a blessing:
@@ -17581,11 +17564,10 @@
17564 SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
17565 #endif /* defined(SQLITE_MUTEX_OMIT) */
17566
17567 /************** End of mutex.h ***********************************************/
17568 /************** Continuing where we left off in sqliteInt.h ******************/
 
17569
17570 /* The SQLITE_EXTRA_DURABLE compile-time option used to set the default
17571 ** synchronous setting to EXTRA. It is no longer supported.
17572 */
17573 #ifdef SQLITE_EXTRA_DURABLE
@@ -21982,11 +21964,10 @@
21964
21965 #endif /* SQLITEINT_H */
21966
21967 /************** End of sqliteInt.h *******************************************/
21968 /************** Begin file os_common.h ***************************************/
 
21969 /*
21970 ** 2004 May 22
21971 **
21972 ** The author disclaims copyright to this source code. In place of
21973 ** a legal notice, here is a blessing:
@@ -22085,11 +22066,10 @@
22066
22067 #endif /* !defined(_OS_COMMON_H_) */
22068
22069 /************** End of os_common.h *******************************************/
22070 /************** Begin file ctime.c *******************************************/
 
22071 /* DO NOT EDIT!
22072 ** This file is automatically generated by the script in the canonical
22073 ** SQLite source tree at tool/mkctimec.tcl.
22074 **
22075 ** To modify this header, edit any of the various lists in that script
@@ -22885,11 +22865,10 @@
22865
22866 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
22867
22868 /************** End of ctime.c ***********************************************/
22869 /************** Begin file global.c ******************************************/
 
22870 /*
22871 ** 2008 June 13
22872 **
22873 ** The author disclaims copyright to this source code. In place of
22874 ** a legal notice, here is a blessing:
@@ -23290,11 +23269,10 @@
23269 "TEXT"
23270 };
23271
23272 /************** End of global.c **********************************************/
23273 /************** Begin file status.c ******************************************/
 
23274 /*
23275 ** 2008 June 18
23276 **
23277 ** The author disclaims copyright to this source code. In place of
23278 ** a legal notice, here is a blessing:
@@ -23309,11 +23287,10 @@
23287 ** functionality.
23288 */
23289 /* #include "sqliteInt.h" */
23290 /************** Include vdbeInt.h in the middle of status.c ******************/
23291 /************** Begin file vdbeInt.h *****************************************/
 
23292 /*
23293 ** 2003 September 6
23294 **
23295 ** The author disclaims copyright to this source code. In place of
23296 ** a legal notice, here is a blessing:
@@ -24046,11 +24023,10 @@
24023
24024 #endif /* !defined(SQLITE_VDBEINT_H) */
24025
24026 /************** End of vdbeInt.h *********************************************/
24027 /************** Continuing where we left off in status.c *********************/
 
24028
24029 /*
24030 ** Variables in which to record status information.
24031 */
24032 #if SQLITE_PTRSIZE>4
@@ -24431,11 +24407,10 @@
24407 return rc;
24408 }
24409
24410 /************** End of status.c **********************************************/
24411 /************** Begin file date.c ********************************************/
 
24412 /*
24413 ** 2003 October 31
24414 **
24415 ** The author disclaims copyright to this source code. In place of
24416 ** a legal notice, here is a blessing:
@@ -26250,11 +26225,10 @@
26225 sqlite3InsertBuiltinFuncs(aDateTimeFuncs, ArraySize(aDateTimeFuncs));
26226 }
26227
26228 /************** End of date.c ************************************************/
26229 /************** Begin file os.c **********************************************/
 
26230 /*
26231 ** 2005 November 29
26232 **
26233 ** The author disclaims copyright to this source code. In place of
26234 ** a legal notice, here is a blessing:
@@ -26701,11 +26675,10 @@
26675 return SQLITE_OK;
26676 }
26677
26678 /************** End of os.c **************************************************/
26679 /************** Begin file fault.c *******************************************/
 
26680 /*
26681 ** 2008 Jan 22
26682 **
26683 ** The author disclaims copyright to this source code. In place of
26684 ** a legal notice, here is a blessing:
@@ -26792,11 +26765,10 @@
26765
26766 #endif /* #ifndef SQLITE_UNTESTABLE */
26767
26768 /************** End of fault.c ***********************************************/
26769 /************** Begin file mem0.c ********************************************/
 
26770 /*
26771 ** 2008 October 28
26772 **
26773 ** The author disclaims copyright to this source code. In place of
26774 ** a legal notice, here is a blessing:
@@ -26855,11 +26827,10 @@
26827
26828 #endif /* SQLITE_ZERO_MALLOC */
26829
26830 /************** End of mem0.c ************************************************/
26831 /************** Begin file mem1.c ********************************************/
 
26832 /*
26833 ** 2007 August 14
26834 **
26835 ** The author disclaims copyright to this source code. In place of
26836 ** a legal notice, here is a blessing:
@@ -27150,11 +27121,10 @@
27121
27122 #endif /* SQLITE_SYSTEM_MALLOC */
27123
27124 /************** End of mem1.c ************************************************/
27125 /************** Begin file mem2.c ********************************************/
 
27126 /*
27127 ** 2007 August 15
27128 **
27129 ** The author disclaims copyright to this source code. In place of
27130 ** a legal notice, here is a blessing:
@@ -27682,11 +27652,10 @@
27652
27653 #endif /* SQLITE_MEMDEBUG */
27654
27655 /************** End of mem2.c ************************************************/
27656 /************** Begin file mem3.c ********************************************/
 
27657 /*
27658 ** 2007 October 14
27659 **
27660 ** The author disclaims copyright to this source code. In place of
27661 ** a legal notice, here is a blessing:
@@ -28373,11 +28342,10 @@
28342
28343 #endif /* SQLITE_ENABLE_MEMSYS3 */
28344
28345 /************** End of mem3.c ************************************************/
28346 /************** Begin file mem5.c ********************************************/
 
28347 /*
28348 ** 2007 October 14
28349 **
28350 ** The author disclaims copyright to this source code. In place of
28351 ** a legal notice, here is a blessing:
@@ -28962,11 +28930,10 @@
28930
28931 #endif /* SQLITE_ENABLE_MEMSYS5 */
28932
28933 /************** End of mem5.c ************************************************/
28934 /************** Begin file mutex.c *******************************************/
 
28935 /*
28936 ** 2007 August 14
28937 **
28938 ** The author disclaims copyright to this source code. In place of
28939 ** a legal notice, here is a blessing:
@@ -29340,11 +29307,10 @@
29307
29308 #endif /* !defined(SQLITE_MUTEX_OMIT) */
29309
29310 /************** End of mutex.c ***********************************************/
29311 /************** Begin file mutex_noop.c **************************************/
 
29312 /*
29313 ** 2008 October 07
29314 **
29315 ** The author disclaims copyright to this source code. In place of
29316 ** a legal notice, here is a blessing:
@@ -29559,11 +29525,10 @@
29525 #endif /* defined(SQLITE_MUTEX_NOOP) */
29526 #endif /* !defined(SQLITE_MUTEX_OMIT) */
29527
29528 /************** End of mutex_noop.c ******************************************/
29529 /************** Begin file mutex_unix.c **************************************/
 
29530 /*
29531 ** 2007 August 28
29532 **
29533 ** The author disclaims copyright to this source code. In place of
29534 ** a legal notice, here is a blessing:
@@ -29957,11 +29922,10 @@
29922
29923 #endif /* SQLITE_MUTEX_PTHREADS */
29924
29925 /************** End of mutex_unix.c ******************************************/
29926 /************** Begin file mutex_w32.c ***************************************/
 
29927 /*
29928 ** 2007 August 14
29929 **
29930 ** The author disclaims copyright to this source code. In place of
29931 ** a legal notice, here is a blessing:
@@ -29984,11 +29948,10 @@
29948 /*
29949 ** Include the header file for the Windows VFS.
29950 */
29951 /************** Include os_win.h in the middle of mutex_w32.c ****************/
29952 /************** Begin file os_win.h ******************************************/
 
29953 /*
29954 ** 2013 November 25
29955 **
29956 ** The author disclaims copyright to this source code. In place of
29957 ** a legal notice, here is a blessing:
@@ -30076,11 +30039,10 @@
30039
30040 #endif /* SQLITE_OS_WIN_H */
30041
30042 /************** End of os_win.h **********************************************/
30043 /************** Continuing where we left off in mutex_w32.c ******************/
 
30044 #endif
30045
30046 /*
30047 ** The code in this file is only used if we are compiling multithreaded
30048 ** on a Win32 system.
@@ -30454,11 +30416,10 @@
30416
30417 #endif /* SQLITE_MUTEX_W32 */
30418
30419 /************** End of mutex_w32.c *******************************************/
30420 /************** Begin file malloc.c ******************************************/
 
30421 /*
30422 ** 2001 September 15
30423 **
30424 ** The author disclaims copyright to this source code. In place of
30425 ** a legal notice, here is a blessing:
@@ -31378,11 +31339,10 @@
31339 return 0;
31340 }
31341
31342 /************** End of malloc.c **********************************************/
31343 /************** Begin file printf.c ******************************************/
 
31344 /*
31345 ** The "printf" code that follows dates from the 1980's. It is in
31346 ** the public domain.
31347 **
31348 **************************************************************************
@@ -32828,11 +32788,10 @@
32788 }
32789 }
32790
32791 /************** End of printf.c **********************************************/
32792 /************** Begin file treeview.c ****************************************/
 
32793 /*
32794 ** 2015-06-08
32795 **
32796 ** The author disclaims copyright to this source code. In place of
32797 ** a legal notice, here is a blessing:
@@ -34160,11 +34119,10 @@
34119
34120 #endif /* SQLITE_DEBUG */
34121
34122 /************** End of treeview.c ********************************************/
34123 /************** Begin file random.c ******************************************/
 
34124 /*
34125 ** 2001 September 15
34126 **
34127 ** The author disclaims copyright to this source code. In place of
34128 ** a legal notice, here is a blessing:
@@ -34321,11 +34279,10 @@
34279 }
34280 #endif /* SQLITE_UNTESTABLE */
34281
34282 /************** End of random.c **********************************************/
34283 /************** Begin file threads.c *****************************************/
 
34284 /*
34285 ** 2012 July 21
34286 **
34287 ** The author disclaims copyright to this source code. In place of
34288 ** a legal notice, here is a blessing:
@@ -34599,11 +34556,10 @@
34556 /****************************** End Single-Threaded *************************/
34557 #endif /* SQLITE_MAX_WORKER_THREADS>0 */
34558
34559 /************** End of threads.c *********************************************/
34560 /************** Begin file utf.c *********************************************/
 
34561 /*
34562 ** 2004 April 13
34563 **
34564 ** The author disclaims copyright to this source code. In place of
34565 ** a legal notice, here is a blessing:
@@ -35171,11 +35127,10 @@
35127 #endif /* SQLITE_TEST */
35128 #endif /* SQLITE_OMIT_UTF16 */
35129
35130 /************** End of utf.c *************************************************/
35131 /************** Begin file util.c ********************************************/
 
35132 /*
35133 ** 2001 September 15
35134 **
35135 ** The author disclaims copyright to this source code. In place of
35136 ** a legal notice, here is a blessing:
@@ -37023,11 +36978,10 @@
36978 return 0;
36979 }
36980
36981 /************** End of util.c ************************************************/
36982 /************** Begin file hash.c ********************************************/
 
36983 /*
36984 ** 2001 September 22
36985 **
36986 ** The author disclaims copyright to this source code. In place of
36987 ** a legal notice, here is a blessing:
@@ -37297,11 +37251,10 @@
37251 return 0;
37252 }
37253
37254 /************** End of hash.c ************************************************/
37255 /************** Begin file opcodes.c *****************************************/
 
37256 /* Automatically generated. Do not edit */
37257 /* See the tool/mkopcodec.tcl script for details. */
37258 #if !defined(SQLITE_OMIT_EXPLAIN) \
37259 || defined(VDBE_PROFILE) \
37260 || defined(SQLITE_DEBUG)
@@ -37507,11 +37460,10 @@
37460 }
37461 #endif
37462
37463 /************** End of opcodes.c *********************************************/
37464 /************** Begin file os_kv.c *******************************************/
 
37465 /*
37466 ** 2022-09-06
37467 **
37468 ** The author disclaims copyright to this source code. In place of
37469 ** a legal notice, here is a blessing:
@@ -38490,11 +38442,10 @@
38442 }
38443 #endif
38444
38445 /************** End of os_kv.c ***********************************************/
38446 /************** Begin file os_unix.c *****************************************/
 
38447 /*
38448 ** 2004 May 22
38449 **
38450 ** The author disclaims copyright to this source code. In place of
38451 ** a legal notice, here is a blessing:
@@ -42480,10 +42431,15 @@
42431 int rc = osIoctl(pFile->h, F2FS_IOC_ABORT_VOLATILE_WRITE);
42432 return rc ? SQLITE_IOERR_ROLLBACK_ATOMIC : SQLITE_OK;
42433 }
42434 #endif /* __linux__ && SQLITE_ENABLE_BATCH_ATOMIC_WRITE */
42435
42436 case SQLITE_FCNTL_NULL_IO: {
42437 osClose(pFile->h);
42438 pFile->h = -1;
42439 return SQLITE_OK;
42440 }
42441 case SQLITE_FCNTL_LOCKSTATE: {
42442 *(int*)pArg = pFile->eFileLock;
42443 return SQLITE_OK;
42444 }
42445 case SQLITE_FCNTL_LAST_ERRNO: {
@@ -46760,11 +46716,10 @@
46716
46717 #endif /* SQLITE_OS_UNIX */
46718
46719 /************** End of os_unix.c *********************************************/
46720 /************** Begin file os_win.c ******************************************/
 
46721 /*
46722 ** 2004 May 22
46723 **
46724 ** The author disclaims copyright to this source code. In place of
46725 ** a legal notice, here is a blessing:
@@ -50362,10 +50317,15 @@
50317 OSTRACE(("FCNTL oldFile=%p, newFile=%p, rc=SQLITE_OK\n",
50318 hOldFile, pFile->h));
50319 return SQLITE_OK;
50320 }
50321 #endif
50322 case SQLITE_FCNTL_NULL_IO: {
50323 (void)osCloseHandle(pFile->h);
50324 pFile->h = NULL;
50325 return SQLITE_OK;
50326 }
50327 case SQLITE_FCNTL_TEMPFILENAME: {
50328 char *zTFile = 0;
50329 int rc = winGetTempname(pFile->pVfs, &zTFile);
50330 if( rc==SQLITE_OK ){
50331 *(char**)pArg = zTFile;
@@ -52975,11 +52935,10 @@
52935
52936 #endif /* SQLITE_OS_WIN */
52937
52938 /************** End of os_win.c **********************************************/
52939 /************** Begin file memdb.c *******************************************/
 
52940 /*
52941 ** 2016-09-07
52942 **
52943 ** The author disclaims copyright to this source code. In place of
52944 ** a legal notice, here is a blessing:
@@ -53915,11 +53874,10 @@
53874 }
53875 #endif /* SQLITE_OMIT_DESERIALIZE */
53876
53877 /************** End of memdb.c ***********************************************/
53878 /************** Begin file bitvec.c ******************************************/
 
53879 /*
53880 ** 2008 February 16
53881 **
53882 ** The author disclaims copyright to this source code. In place of
53883 ** a legal notice, here is a blessing:
@@ -54330,11 +54288,10 @@
54288 }
54289 #endif /* SQLITE_UNTESTABLE */
54290
54291 /************** End of bitvec.c **********************************************/
54292 /************** Begin file pcache.c ******************************************/
 
54293 /*
54294 ** 2008 August 05
54295 **
54296 ** The author disclaims copyright to this source code. In place of
54297 ** a legal notice, here is a blessing:
@@ -55270,11 +55227,10 @@
55227 }
55228 #endif
55229
55230 /************** End of pcache.c **********************************************/
55231 /************** Begin file pcache1.c *****************************************/
 
55232 /*
55233 ** 2008 November 05
55234 **
55235 ** The author disclaims copyright to this source code. In place of
55236 ** a legal notice, here is a blessing:
@@ -56556,11 +56512,10 @@
56512 }
56513 #endif
56514
56515 /************** End of pcache1.c *********************************************/
56516 /************** Begin file rowset.c ******************************************/
 
56517 /*
56518 ** 2008 December 3
56519 **
56520 ** The author disclaims copyright to this source code. In place of
56521 ** a legal notice, here is a blessing:
@@ -57062,11 +57017,10 @@
57017 return 0;
57018 }
57019
57020 /************** End of rowset.c **********************************************/
57021 /************** Begin file pager.c *******************************************/
 
57022 /*
57023 ** 2001 September 15
57024 **
57025 ** The author disclaims copyright to this source code. In place of
57026 ** a legal notice, here is a blessing:
@@ -57087,11 +57041,10 @@
57041 */
57042 #ifndef SQLITE_OMIT_DISKIO
57043 /* #include "sqliteInt.h" */
57044 /************** Include wal.h in the middle of pager.c ***********************/
57045 /************** Begin file wal.h *********************************************/
 
57046 /*
57047 ** 2010 February 1
57048 **
57049 ** The author disclaims copyright to this source code. In place of
57050 ** a legal notice, here is a blessing:
@@ -57251,11 +57204,10 @@
57204 #endif /* ifndef SQLITE_OMIT_WAL */
57205 #endif /* SQLITE_WAL_H */
57206
57207 /************** End of wal.h *************************************************/
57208 /************** Continuing where we left off in pager.c **********************/
 
57209
57210
57211 /******************* NOTES ON THE DESIGN OF THE PAGER ************************
57212 **
57213 ** This comment block describes invariants that hold when using a rollback
@@ -65041,11 +64993,10 @@
64993
64994 #endif /* SQLITE_OMIT_DISKIO */
64995
64996 /************** End of pager.c ***********************************************/
64997 /************** Begin file wal.c *********************************************/
 
64998 /*
64999 ** 2010 February 1
65000 **
65001 ** The author disclaims copyright to this source code. In place of
65002 ** a legal notice, here is a blessing:
@@ -69638,11 +69589,10 @@
69589
69590 #endif /* #ifndef SQLITE_OMIT_WAL */
69591
69592 /************** End of wal.c *************************************************/
69593 /************** Begin file btmutex.c *****************************************/
 
69594 /*
69595 ** 2007 August 27
69596 **
69597 ** The author disclaims copyright to this source code. In place of
69598 ** a legal notice, here is a blessing:
@@ -69658,11 +69608,10 @@
69608 ** big and we want to break it down some. This packaged seemed like
69609 ** a good breakout.
69610 */
69611 /************** Include btreeInt.h in the middle of btmutex.c ****************/
69612 /************** Begin file btreeInt.h ****************************************/
 
69613 /*
69614 ** 2004 April 6
69615 **
69616 ** The author disclaims copyright to this source code. In place of
69617 ** a legal notice, here is a blessing:
@@ -70396,11 +70345,10 @@
70345 # define get2byteAligned(x) ((x)[0]<<8 | (x)[1])
70346 #endif
70347
70348 /************** End of btreeInt.h ********************************************/
70349 /************** Continuing where we left off in btmutex.c ********************/
 
70350 #ifndef SQLITE_OMIT_SHARED_CACHE
70351 #if SQLITE_THREADSAFE
70352
70353 /*
70354 ** Obtain the BtShared mutex associated with B-Tree handle p. Also,
@@ -70691,11 +70639,10 @@
70639
70640 #endif /* ifndef SQLITE_OMIT_SHARED_CACHE */
70641
70642 /************** End of btmutex.c *********************************************/
70643 /************** Begin file btree.c *******************************************/
 
70644 /*
70645 ** 2004 April 6
70646 **
70647 ** The author disclaims copyright to this source code. In place of
70648 ** a legal notice, here is a blessing:
@@ -82186,11 +82133,10 @@
82133 }
82134 #endif
82135
82136 /************** End of btree.c ***********************************************/
82137 /************** Begin file backup.c ******************************************/
 
82138 /*
82139 ** 2009 January 28
82140 **
82141 ** The author disclaims copyright to this source code. In place of
82142 ** a legal notice, here is a blessing:
@@ -82957,11 +82903,10 @@
82903 }
82904 #endif /* SQLITE_OMIT_VACUUM */
82905
82906 /************** End of backup.c **********************************************/
82907 /************** Begin file vdbemem.c *****************************************/
 
82908 /*
82909 ** 2004 May 26
82910 **
82911 ** The author disclaims copyright to this source code. In place of
82912 ** a legal notice, here is a blessing:
@@ -85014,11 +84959,10 @@
84959 return valueBytes(pVal, enc);
84960 }
84961
84962 /************** End of vdbemem.c *********************************************/
84963 /************** Begin file vdbeaux.c *****************************************/
 
84964 /*
84965 ** 2003 September 6
84966 **
84967 ** The author disclaims copyright to this source code. In place of
84968 ** a legal notice, here is a blessing:
@@ -90566,11 +90510,10 @@
90510 }
90511 #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
90512
90513 /************** End of vdbeaux.c *********************************************/
90514 /************** Begin file vdbeapi.c *****************************************/
 
90515 /*
90516 ** 2004 May 26
90517 **
90518 ** The author disclaims copyright to this source code. In place of
90519 ** a legal notice, here is a blessing:
@@ -93153,11 +93096,10 @@
93096 }
93097 #endif /* SQLITE_ENABLE_STMT_SCANSTATUS */
93098
93099 /************** End of vdbeapi.c *********************************************/
93100 /************** Begin file vdbetrace.c ***************************************/
 
93101 /*
93102 ** 2009 November 25
93103 **
93104 ** The author disclaims copyright to this source code. In place of
93105 ** a legal notice, here is a blessing:
@@ -93349,11 +93291,10 @@
93291
93292 #endif /* #ifndef SQLITE_OMIT_TRACE */
93293
93294 /************** End of vdbetrace.c *******************************************/
93295 /************** Begin file vdbe.c ********************************************/
 
93296 /*
93297 ** 2001 September 15
93298 **
93299 ** The author disclaims copyright to this source code. In place of
93300 ** a legal notice, here is a blessing:
@@ -93381,11 +93322,10 @@
93322 #if defined(VDBE_PROFILE) \
93323 || defined(SQLITE_PERFORMANCE_TRACE) \
93324 || defined(SQLITE_ENABLE_STMT_SCANSTATUS)
93325 /************** Include hwtime.h in the middle of vdbe.c *********************/
93326 /************** Begin file hwtime.h ******************************************/
 
93327 /*
93328 ** 2008 May 27
93329 **
93330 ** The author disclaims copyright to this source code. In place of
93331 ** a legal notice, here is a blessing:
@@ -93470,11 +93410,10 @@
93410
93411 #endif /* !defined(SQLITE_HWTIME_H) */
93412
93413 /************** End of hwtime.h **********************************************/
93414 /************** Continuing where we left off in vdbe.c ***********************/
 
93415 #endif
93416
93417 /*
93418 ** Invoke this macro on memory cells just prior to changing the
93419 ** value of the cell. This macro verifies that shallow copies are
@@ -102664,11 +102603,10 @@
102603 }
102604
102605
102606 /************** End of vdbe.c ************************************************/
102607 /************** Begin file vdbeblob.c ****************************************/
 
102608 /*
102609 ** 2007 May 1
102610 **
102611 ** The author disclaims copyright to this source code. In place of
102612 ** a legal notice, here is a blessing:
@@ -103188,11 +103126,10 @@
103126
103127 #endif /* #ifndef SQLITE_OMIT_INCRBLOB */
103128
103129 /************** End of vdbeblob.c ********************************************/
103130 /************** Begin file vdbesort.c ****************************************/
 
103131 /*
103132 ** 2011-07-09
103133 **
103134 ** The author disclaims copyright to this source code. In place of
103135 ** a legal notice, here is a blessing:
@@ -105959,11 +105896,10 @@
105896 return SQLITE_OK;
105897 }
105898
105899 /************** End of vdbesort.c ********************************************/
105900 /************** Begin file vdbevtab.c ****************************************/
 
105901 /*
105902 ** 2020-03-23
105903 **
105904 ** The author disclaims copyright to this source code. In place of
105905 ** a legal notice, here is a blessing:
@@ -106409,11 +106345,10 @@
106345 SQLITE_PRIVATE int sqlite3VdbeBytecodeVtabInit(sqlite3 *db){ return SQLITE_OK; }
106346 #endif /* SQLITE_ENABLE_BYTECODE_VTAB */
106347
106348 /************** End of vdbevtab.c ********************************************/
106349 /************** Begin file memjournal.c **************************************/
 
106350 /*
106351 ** 2008 October 7
106352 **
106353 ** The author disclaims copyright to this source code. In place of
106354 ** a legal notice, here is a blessing:
@@ -106853,11 +106788,10 @@
106788 return MAX(pVfs->szOsFile, (int)sizeof(MemJournal));
106789 }
106790
106791 /************** End of memjournal.c ******************************************/
106792 /************** Begin file walker.c ******************************************/
 
106793 /*
106794 ** 2008 August 16
106795 **
106796 ** The author disclaims copyright to this source code. In place of
106797 ** a legal notice, here is a blessing:
@@ -107118,11 +107052,10 @@
107052 return WRC_Continue;
107053 }
107054
107055 /************** End of walker.c **********************************************/
107056 /************** Begin file resolve.c *****************************************/
 
107057 /*
107058 ** 2008 August 18
107059 **
107060 ** The author disclaims copyright to this source code. In place of
107061 ** a legal notice, here is a blessing:
@@ -109440,11 +109373,10 @@
109373 return rc;
109374 }
109375
109376 /************** End of resolve.c *********************************************/
109377 /************** Begin file expr.c ********************************************/
 
109378 /*
109379 ** 2001 September 15
109380 **
109381 ** The author disclaims copyright to this source code. In place of
109382 ** a legal notice, here is a blessing:
@@ -116770,11 +116702,10 @@
116702 }
116703 #endif /* SQLITE_DEBUG */
116704
116705 /************** End of expr.c ************************************************/
116706 /************** Begin file alter.c *******************************************/
 
116707 /*
116708 ** 2005 February 15
116709 **
116710 ** The author disclaims copyright to this source code. In place of
116711 ** a legal notice, here is a blessing:
@@ -119090,11 +119021,10 @@
119021 }
119022 #endif /* SQLITE_ALTER_TABLE */
119023
119024 /************** End of alter.c ***********************************************/
119025 /************** Begin file analyze.c *****************************************/
 
119026 /*
119027 ** 2005-07-08
119028 **
119029 ** The author disclaims copyright to this source code. In place of
119030 ** a legal notice, here is a blessing:
@@ -121115,11 +121045,10 @@
121045
121046 #endif /* SQLITE_OMIT_ANALYZE */
121047
121048 /************** End of analyze.c *********************************************/
121049 /************** Begin file attach.c ******************************************/
 
121050 /*
121051 ** 2003 April 6
121052 **
121053 ** The author disclaims copyright to this source code. In place of
121054 ** a legal notice, here is a blessing:
@@ -121728,11 +121657,10 @@
121657 }
121658 #endif
121659
121660 /************** End of attach.c **********************************************/
121661 /************** Begin file auth.c ********************************************/
 
121662 /*
121663 ** 2003 January 11
121664 **
121665 ** The author disclaims copyright to this source code. In place of
121666 ** a legal notice, here is a blessing:
@@ -121992,11 +121920,10 @@
121920
121921 #endif /* SQLITE_OMIT_AUTHORIZATION */
121922
121923 /************** End of auth.c ************************************************/
121924 /************** Begin file build.c *******************************************/
 
121925 /*
121926 ** 2001 September 15
121927 **
121928 ** The author disclaims copyright to this source code. In place of
121929 ** a legal notice, here is a blessing:
@@ -127763,11 +127690,10 @@
127690 }
127691 #endif /* !defined(SQLITE_OMIT_CTE) */
127692
127693 /************** End of build.c ***********************************************/
127694 /************** Begin file callback.c ****************************************/
 
127695 /*
127696 ** 2005 May 23
127697 **
127698 ** The author disclaims copyright to this source code. In place of
127699 ** a legal notice, here is a blessing:
@@ -128307,11 +128233,10 @@
128233 return p;
128234 }
128235
128236 /************** End of callback.c ********************************************/
128237 /************** Begin file delete.c ******************************************/
 
128238 /*
128239 ** 2001 September 15
128240 **
128241 ** The author disclaims copyright to this source code. In place of
128242 ** a legal notice, here is a blessing:
@@ -129341,11 +129266,10 @@
129266 }
129267 }
129268
129269 /************** End of delete.c **********************************************/
129270 /************** Begin file func.c ********************************************/
 
129271 /*
129272 ** 2002 February 23
129273 **
129274 ** The author disclaims copyright to this source code. In place of
129275 ** a legal notice, here is a blessing:
@@ -132188,11 +132112,10 @@
132112 #endif
132113 }
132114
132115 /************** End of func.c ************************************************/
132116 /************** Begin file fkey.c ********************************************/
 
132117 /*
132118 **
132119 ** The author disclaims copyright to this source code. In place of
132120 ** a legal notice, here is a blessing:
132121 **
@@ -133676,11 +133599,10 @@
133599 }
133600 #endif /* ifndef SQLITE_OMIT_FOREIGN_KEY */
133601
133602 /************** End of fkey.c ************************************************/
133603 /************** Begin file insert.c ******************************************/
 
133604 /*
133605 ** 2001 September 15
133606 **
133607 ** The author disclaims copyright to this source code. In place of
133608 ** a legal notice, here is a blessing:
@@ -137072,11 +136994,10 @@
136994 }
136995 #endif /* SQLITE_OMIT_XFER_OPT */
136996
136997 /************** End of insert.c **********************************************/
136998 /************** Begin file legacy.c ******************************************/
 
136999 /*
137000 ** 2001 September 15
137001 **
137002 ** The author disclaims copyright to this source code. In place of
137003 ** a legal notice, here is a blessing:
@@ -137217,11 +137138,10 @@
137138 return rc;
137139 }
137140
137141 /************** End of legacy.c **********************************************/
137142 /************** Begin file loadext.c *****************************************/
 
137143 /*
137144 ** 2006 June 7
137145 **
137146 ** The author disclaims copyright to this source code. In place of
137147 ** a legal notice, here is a blessing:
@@ -137238,11 +137158,10 @@
137158 #ifndef SQLITE_CORE
137159 #define SQLITE_CORE 1 /* Disable the API redefinition in sqlite3ext.h */
137160 #endif
137161 /************** Include sqlite3ext.h in the middle of loadext.c **************/
137162 /************** Begin file sqlite3ext.h **************************************/
 
137163 /*
137164 ** 2006 June 7
137165 **
137166 ** The author disclaims copyright to this source code. In place of
137167 ** a legal notice, here is a blessing:
@@ -137961,11 +137880,10 @@
137880
137881 #endif /* SQLITE3EXT_H */
137882
137883 /************** End of sqlite3ext.h ******************************************/
137884 /************** Continuing where we left off in loadext.c ********************/
 
137885 /* #include "sqliteInt.h" */
137886
137887 #ifndef SQLITE_OMIT_LOAD_EXTENSION
137888 /*
137889 ** Some API routines are omitted when various features are
@@ -138867,11 +138785,10 @@
138785 }
138786 }
138787
138788 /************** End of loadext.c *********************************************/
138789 /************** Begin file pragma.c ******************************************/
 
138790 /*
138791 ** 2003 April 6
138792 **
138793 ** The author disclaims copyright to this source code. In place of
138794 ** a legal notice, here is a blessing:
@@ -138900,11 +138817,10 @@
138817 ** lexicographical order to facility a binary search of the pragma name.
138818 ** Do not edit pragma.h directly. Edit and rerun the script in at
138819 ** ../tool/mkpragmatab.tcl. */
138820 /************** Include pragma.h in the middle of pragma.c *******************/
138821 /************** Begin file pragma.h ******************************************/
 
138822 /* DO NOT EDIT!
138823 ** This file is automatically generated by the script at
138824 ** ../tool/mkpragmatab.tcl. To update the set of pragmas, edit
138825 ** that script and rerun it.
138826 */
@@ -139564,11 +139480,10 @@
139480 };
139481 /* Number of pragmas: 68 on by default, 78 total. */
139482
139483 /************** End of pragma.h **********************************************/
139484 /************** Continuing where we left off in pragma.c *********************/
 
139485
139486 /*
139487 ** When the 0x10 bit of PRAGMA optimize is set, any ANALYZE commands
139488 ** will be run with an analysis_limit set to the lessor of the value of
139489 ** the following macro or to the actual analysis_limit if it is non-zero,
@@ -142608,11 +142523,10 @@
142523
142524 #endif /* SQLITE_OMIT_PRAGMA */
142525
142526 /************** End of pragma.c **********************************************/
142527 /************** Begin file prepare.c *****************************************/
 
142528 /*
142529 ** 2005 May 25
142530 **
142531 ** The author disclaims copyright to this source code. In place of
142532 ** a legal notice, here is a blessing:
@@ -143702,11 +143616,10 @@
143616
143617 #endif /* SQLITE_OMIT_UTF16 */
143618
143619 /************** End of prepare.c *********************************************/
143620 /************** Begin file select.c ******************************************/
 
143621 /*
143622 ** 2001 September 15
143623 **
143624 ** The author disclaims copyright to this source code. In place of
143625 ** a legal notice, here is a blessing:
@@ -152475,11 +152388,10 @@
152388 return rc;
152389 }
152390
152391 /************** End of select.c **********************************************/
152392 /************** Begin file table.c *******************************************/
 
152393 /*
152394 ** 2001 September 15
152395 **
152396 ** The author disclaims copyright to this source code. In place of
152397 ** a legal notice, here is a blessing:
@@ -152677,11 +152589,10 @@
152589
152590 #endif /* SQLITE_OMIT_GET_TABLE */
152591
152592 /************** End of table.c ***********************************************/
152593 /************** Begin file trigger.c *****************************************/
 
152594 /*
152595 **
152596 ** The author disclaims copyright to this source code. In place of
152597 ** a legal notice, here is a blessing:
152598 **
@@ -154244,11 +154155,10 @@
154155
154156 #endif /* !defined(SQLITE_OMIT_TRIGGER) */
154157
154158 /************** End of trigger.c *********************************************/
154159 /************** Begin file update.c ******************************************/
 
154160 /*
154161 ** 2001 September 15
154162 **
154163 ** The author disclaims copyright to this source code. In place of
154164 ** a legal notice, here is a blessing:
@@ -155616,11 +155526,10 @@
155526 }
155527 #endif /* SQLITE_OMIT_VIRTUALTABLE */
155528
155529 /************** End of update.c **********************************************/
155530 /************** Begin file upsert.c ******************************************/
 
155531 /*
155532 ** 2018-04-12
155533 **
155534 ** The author disclaims copyright to this source code. In place of
155535 ** a legal notice, here is a blessing:
@@ -155949,11 +155858,10 @@
155858
155859 #endif /* SQLITE_OMIT_UPSERT */
155860
155861 /************** End of upsert.c **********************************************/
155862 /************** Begin file vacuum.c ******************************************/
 
155863 /*
155864 ** 2003 April 6
155865 **
155866 ** The author disclaims copyright to this source code. In place of
155867 ** a legal notice, here is a blessing:
@@ -156371,11 +156279,10 @@
156279
156280 #endif /* SQLITE_OMIT_VACUUM && SQLITE_OMIT_ATTACH */
156281
156282 /************** End of vacuum.c **********************************************/
156283 /************** Begin file vtab.c ********************************************/
 
156284 /*
156285 ** 2006 June 10
156286 **
156287 ** The author disclaims copyright to this source code. In place of
156288 ** a legal notice, here is a blessing:
@@ -157749,11 +157656,10 @@
157656
157657 #endif /* SQLITE_OMIT_VIRTUALTABLE */
157658
157659 /************** End of vtab.c ************************************************/
157660 /************** Begin file wherecode.c ***************************************/
 
157661 /*
157662 ** 2015-06-06
157663 **
157664 ** The author disclaims copyright to this source code. In place of
157665 ** a legal notice, here is a blessing:
@@ -157772,11 +157678,10 @@
157678 ** file retains the code that does query planning and analysis.
157679 */
157680 /* #include "sqliteInt.h" */
157681 /************** Include whereInt.h in the middle of wherecode.c **************/
157682 /************** Begin file whereInt.h ****************************************/
 
157683 /*
157684 ** 2013-11-12
157685 **
157686 ** The author disclaims copyright to this source code. In place of
157687 ** a legal notice, here is a blessing:
@@ -158429,11 +158334,10 @@
158334
158335 #endif /* !defined(SQLITE_WHEREINT_H) */
158336
158337 /************** End of whereInt.h ********************************************/
158338 /************** Continuing where we left off in wherecode.c ******************/
 
158339
158340 #ifndef SQLITE_OMIT_EXPLAIN
158341
158342 /*
158343 ** Return the name of the i-th column of the pIdx index.
@@ -161352,11 +161256,10 @@
161256 pParse->withinRJSubrtn--;
161257 }
161258
161259 /************** End of wherecode.c *******************************************/
161260 /************** Begin file whereexpr.c ***************************************/
 
161261 /*
161262 ** 2015-06-08
161263 **
161264 ** The author disclaims copyright to this source code. In place of
161265 ** a legal notice, here is a blessing:
@@ -163258,11 +163161,10 @@
163161 }
163162 }
163163
163164 /************** End of whereexpr.c *******************************************/
163165 /************** Begin file where.c *******************************************/
 
163166 /*
163167 ** 2001 September 15
163168 **
163169 ** The author disclaims copyright to this source code. In place of
163170 ** a legal notice, here is a blessing:
@@ -170759,11 +170661,10 @@
170661 return;
170662 }
170663
170664 /************** End of where.c ***********************************************/
170665 /************** Begin file window.c ******************************************/
 
170666 /*
170667 ** 2018 May 08
170668 **
170669 ** The author disclaims copyright to this source code. In place of
170670 ** a legal notice, here is a blessing:
@@ -172432,10 +172333,11 @@
172333 for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
172334 FuncDef *pFunc = pWin->pWFunc;
172335 int regArg;
172336 int nArg = pWin->bExprArgs ? 0 : windowArgCount(pWin);
172337 int i;
172338 int addrIf = 0;
172339
172340 assert( bInverse==0 || pWin->eStart!=TK_UNBOUNDED );
172341
172342 /* All OVER clauses in the same window function aggregate step must
172343 ** be the same. */
@@ -172447,10 +172349,22 @@
172349 }else{
172350 sqlite3VdbeAddOp3(v, OP_Column, pMWin->iEphCsr, pWin->iArgCol+i, reg+i);
172351 }
172352 }
172353 regArg = reg;
172354
172355 if( pWin->pFilter ){
172356 int regTmp;
172357 assert( ExprUseXList(pWin->pOwner) );
172358 assert( pWin->bExprArgs || !nArg ||nArg==pWin->pOwner->x.pList->nExpr );
172359 assert( pWin->bExprArgs || nArg ||pWin->pOwner->x.pList==0 );
172360 regTmp = sqlite3GetTempReg(pParse);
172361 sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol+nArg,regTmp);
172362 addrIf = sqlite3VdbeAddOp3(v, OP_IfNot, regTmp, 0, 1);
172363 VdbeCoverage(v);
172364 sqlite3ReleaseTempReg(pParse, regTmp);
172365 }
172366
172367 if( pMWin->regStartRowid==0
172368 && (pFunc->funcFlags & SQLITE_FUNC_MINMAX)
172369 && (pWin->eStart!=TK_UNBOUNDED)
172370 ){
@@ -172467,29 +172381,17 @@
172381 sqlite3VdbeAddOp1(v, OP_Delete, pWin->csrApp);
172382 sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2);
172383 }
172384 sqlite3VdbeJumpHere(v, addrIsNull);
172385 }else if( pWin->regApp ){
172386 assert( pWin->pFilter==0 );
172387 assert( pFunc->zName==nth_valueName
172388 || pFunc->zName==first_valueName
172389 );
172390 assert( bInverse==0 || bInverse==1 );
172391 sqlite3VdbeAddOp2(v, OP_AddImm, pWin->regApp+1-bInverse, 1);
172392 }else if( pFunc->xSFunc!=noopStepFunc ){
 
 
 
 
 
 
 
 
 
 
 
 
 
172393 if( pWin->bExprArgs ){
172394 int iOp = sqlite3VdbeCurrentAddr(v);
172395 int iEnd;
172396
172397 assert( ExprUseXList(pWin->pOwner) );
@@ -172516,12 +172418,13 @@
172418 sqlite3VdbeAppendP4(v, pFunc, P4_FUNCDEF);
172419 sqlite3VdbeChangeP5(v, (u8)nArg);
172420 if( pWin->bExprArgs ){
172421 sqlite3ReleaseTempRange(pParse, regArg, nArg);
172422 }
 
172423 }
172424
172425 if( addrIf ) sqlite3VdbeJumpHere(v, addrIf);
172426 }
172427 }
172428
172429 /*
172430 ** Values that may be passed as the second argument to windowCodeOp().
@@ -173869,11 +173772,10 @@
173772
173773 #endif /* SQLITE_OMIT_WINDOWFUNC */
173774
173775 /************** End of window.c **********************************************/
173776 /************** Begin file parse.c *******************************************/
 
173777 /* This file is automatically generated by Lemon from input grammar
173778 ** source file "parse.y".
173779 */
173780 /*
173781 ** 2001-09-15
@@ -173893,11 +173795,10 @@
173795 ** That input file is processed by Lemon to generate a C-language
173796 ** implementation of a parser for the given grammar. You might be reading
173797 ** this comment as part of the translated C-code. Edits should be made
173798 ** to the original parse.y sources.
173799 */
 
173800
173801 /* #include "sqliteInt.h" */
173802
173803 /*
173804 ** Disable all error recovery processing in the parser push-down
@@ -173977,11 +173878,10 @@
173878 sqlite3ExprListDelete(pParse->db, pOrderBy);
173879 sqlite3ExprDelete(pParse->db, pLimit);
173880 }
173881 #endif /* SQLITE_ENABLE_UPDATE_DELETE_LIMIT */
173882
 
173883
173884 /*
173885 ** For a compound SELECT statement, make sure p->pPrior->pNext==p for
173886 ** all elements in the list. And make sure list length does not exceed
173887 ** SQLITE_LIMIT_COMPOUND_SELECT.
@@ -174032,11 +173932,10 @@
173932 ** testing.
173933 */
173934 static void *parserStackRealloc(void *pOld, sqlite3_uint64 newSize){
173935 return sqlite3FaultSim(700) ? 0 : sqlite3_realloc(pOld, newSize);
173936 }
 
173937
173938
173939 /* Construct a new Expr object from a single token */
173940 static Expr *tokenExpr(Parse *pParse, int op, Token t){
173941 Expr *p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr)+t.n+1);
@@ -174069,11 +173968,10 @@
173968 }
173969 }
173970 return p;
173971 }
173972
 
173973
173974 /* A routine to convert a binary TK_IS or TK_ISNOT expression into a
173975 ** unary TK_ISNULL or TK_NOTNULL expression. */
173976 static void binaryToUnaryIfNull(Parse *pParse, Expr *pY, Expr *pA, int op){
173977 sqlite3 *db = pParse->db;
@@ -174081,11 +173979,10 @@
173979 pA->op = (u8)op;
173980 sqlite3ExprDelete(db, pA->pRight);
173981 pA->pRight = 0;
173982 }
173983 }
 
173984
173985 /* Add a single new term to an ExprList that is used to store a
173986 ** list of identifiers. Report an error if the ID list contains
173987 ** a COLLATE clause or an ASC or DESC keyword, except ignore the
173988 ** error while parsing a legacy schema.
@@ -174105,16 +174002,14 @@
174002 pIdToken->n, pIdToken->z);
174003 }
174004 sqlite3ExprListSetName(pParse, p, pIdToken, 1);
174005 return p;
174006 }
 
174007
174008 #if TK_SPAN>255
174009 # error too many tokens in the grammar
174010 #endif
 
174011 /**************** End of %include directives **********************************/
174012 /* These constants specify the various numeric values for terminal symbols.
174013 ***************** Begin token definitions *************************************/
174014 #ifndef TK_SEMI
174015 #define TK_SEMI 1
@@ -176295,13 +176190,11 @@
176190 case 240: /* selectnowith */
176191 case 241: /* oneselect */
176192 case 253: /* values */
176193 case 255: /* mvalues */
176194 {
 
176195 sqlite3SelectDelete(pParse->db, (yypminor->yy555));
 
176196 }
176197 break;
176198 case 217: /* term */
176199 case 218: /* expr */
176200 case 247: /* where_opt */
@@ -176312,13 +176205,11 @@
176205 case 285: /* vinto */
176206 case 292: /* when_clause */
176207 case 297: /* key_opt */
176208 case 314: /* filter_clause */
176209 {
 
176210 sqlite3ExprDelete(pParse->db, (yypminor->yy454));
 
176211 }
176212 break;
176213 case 222: /* eidlist_opt */
176214 case 232: /* sortlist */
176215 case 233: /* eidlist */
@@ -176331,82 +176222,64 @@
176222 case 270: /* setlist */
176223 case 279: /* paren_exprlist */
176224 case 281: /* case_exprlist */
176225 case 313: /* part_opt */
176226 {
 
176227 sqlite3ExprListDelete(pParse->db, (yypminor->yy14));
 
176228 }
176229 break;
176230 case 239: /* fullname */
176231 case 246: /* from */
176232 case 258: /* seltablist */
176233 case 259: /* stl_prefix */
176234 case 264: /* xfullname */
176235 {
 
176236 sqlite3SrcListDelete(pParse->db, (yypminor->yy203));
 
176237 }
176238 break;
176239 case 242: /* wqlist */
176240 {
 
176241 sqlite3WithDelete(pParse->db, (yypminor->yy59));
 
176242 }
176243 break;
176244 case 252: /* window_clause */
176245 case 309: /* windowdefn_list */
176246 {
 
176247 sqlite3WindowListDelete(pParse->db, (yypminor->yy211));
 
176248 }
176249 break;
176250 case 265: /* idlist */
176251 case 272: /* idlist_opt */
176252 {
 
176253 sqlite3IdListDelete(pParse->db, (yypminor->yy132));
 
176254 }
176255 break;
176256 case 275: /* filter_over */
176257 case 310: /* windowdefn */
176258 case 311: /* window */
176259 case 312: /* frame_opt */
176260 case 315: /* over_clause */
176261 {
 
176262 sqlite3WindowDelete(pParse->db, (yypminor->yy211));
 
176263 }
176264 break;
176265 case 288: /* trigger_cmd_list */
176266 case 293: /* trigger_cmd */
176267 {
 
176268 sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy427));
 
176269 }
176270 break;
176271 case 290: /* trigger_event */
176272 {
 
176273 sqlite3IdListDelete(pParse->db, (yypminor->yy286).b);
 
176274 }
176275 break;
176276 case 317: /* frame_bound */
176277 case 318: /* frame_bound_s */
176278 case 319: /* frame_bound_e */
176279 {
 
176280 sqlite3ExprDelete(pParse->db, (yypminor->yy509).pExpr);
 
176281 }
176282 break;
176283 /********* End destructor definitions *****************************************/
176284 default: break; /* If no destructor action specified: do nothing */
176285 }
@@ -176637,14 +176510,12 @@
176510 #endif
176511 while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
176512 /* Here code is inserted which will execute if the parser
176513 ** stack every overflows */
176514 /******** Begin %stack_overflow code ******************************************/
 
176515
176516 sqlite3OomFault(pParse->db);
 
176517 /******** End %stack_overflow code ********************************************/
176518 sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument var */
176519 sqlite3ParserCTX_STORE
176520 }
176521
@@ -177571,481 +177442,330 @@
177442 ** break;
177443 */
177444 /********** Begin reduce actions **********************************************/
177445 YYMINORTYPE yylhsminor;
177446 case 0: /* explain ::= EXPLAIN */
 
177447 { if( pParse->pReprepare==0 ) pParse->explain = 1; }
 
177448 break;
177449 case 1: /* explain ::= EXPLAIN QUERY PLAN */
 
177450 { if( pParse->pReprepare==0 ) pParse->explain = 2; }
 
177451 break;
177452 case 2: /* cmdx ::= cmd */
 
177453 { sqlite3FinishCoding(pParse); }
 
177454 break;
177455 case 3: /* cmd ::= BEGIN transtype trans_opt */
 
177456 {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy144);}
 
177457 break;
177458 case 4: /* transtype ::= */
 
177459 {yymsp[1].minor.yy144 = TK_DEFERRED;}
 
177460 break;
177461 case 5: /* transtype ::= DEFERRED */
177462 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
177463 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
177464 case 324: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==324);
 
177465 {yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-X*/}
 
177466 break;
177467 case 8: /* cmd ::= COMMIT|END trans_opt */
177468 case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
 
177469 {sqlite3EndTransaction(pParse,yymsp[-1].major);}
 
177470 break;
177471 case 10: /* cmd ::= SAVEPOINT nm */
 
177472 {
177473 sqlite3Savepoint(pParse, SAVEPOINT_BEGIN, &yymsp[0].minor.yy0);
177474 }
 
177475 break;
177476 case 11: /* cmd ::= RELEASE savepoint_opt nm */
 
177477 {
177478 sqlite3Savepoint(pParse, SAVEPOINT_RELEASE, &yymsp[0].minor.yy0);
177479 }
 
177480 break;
177481 case 12: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
 
177482 {
177483 sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
177484 }
 
177485 break;
177486 case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
 
177487 {
177488 sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy144,0,0,yymsp[-2].minor.yy144);
177489 }
 
177490 break;
177491 case 14: /* createkw ::= CREATE */
 
177492 {disableLookaside(pParse);}
 
177493 break;
177494 case 15: /* ifnotexists ::= */
177495 case 18: /* temp ::= */ yytestcase(yyruleno==18);
177496 case 47: /* autoinc ::= */ yytestcase(yyruleno==47);
177497 case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62);
177498 case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72);
177499 case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
177500 case 100: /* distinct ::= */ yytestcase(yyruleno==100);
177501 case 246: /* collate ::= */ yytestcase(yyruleno==246);
 
177502 {yymsp[1].minor.yy144 = 0;}
 
177503 break;
177504 case 16: /* ifnotexists ::= IF NOT EXISTS */
 
177505 {yymsp[-2].minor.yy144 = 1;}
 
177506 break;
177507 case 17: /* temp ::= TEMP */
 
177508 {yymsp[0].minor.yy144 = pParse->db->init.busy==0;}
 
177509 break;
177510 case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */
 
177511 {
177512 sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy391,0);
177513 }
 
177514 break;
177515 case 20: /* create_table_args ::= AS select */
 
177516 {
177517 sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy555);
177518 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy555);
177519 }
 
177520 break;
177521 case 21: /* table_option_set ::= */
 
177522 {yymsp[1].minor.yy391 = 0;}
 
177523 break;
177524 case 22: /* table_option_set ::= table_option_set COMMA table_option */
 
177525 {yylhsminor.yy391 = yymsp[-2].minor.yy391|yymsp[0].minor.yy391;}
 
177526 yymsp[-2].minor.yy391 = yylhsminor.yy391;
177527 break;
177528 case 23: /* table_option ::= WITHOUT nm */
 
177529 {
177530 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
177531 yymsp[-1].minor.yy391 = TF_WithoutRowid | TF_NoVisibleRowid;
177532 }else{
177533 yymsp[-1].minor.yy391 = 0;
177534 sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
177535 }
177536 }
 
177537 break;
177538 case 24: /* table_option ::= nm */
 
177539 {
177540 if( yymsp[0].minor.yy0.n==6 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"strict",6)==0 ){
177541 yylhsminor.yy391 = TF_Strict;
177542 }else{
177543 yylhsminor.yy391 = 0;
177544 sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
177545 }
177546 }
 
177547 yymsp[0].minor.yy391 = yylhsminor.yy391;
177548 break;
177549 case 25: /* columnname ::= nm typetoken */
 
177550 {sqlite3AddColumn(pParse,yymsp[-1].minor.yy0,yymsp[0].minor.yy0);}
 
177551 break;
177552 case 26: /* typetoken ::= */
177553 case 65: /* conslist_opt ::= */ yytestcase(yyruleno==65);
177554 case 106: /* as ::= */ yytestcase(yyruleno==106);
 
177555 {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;}
 
177556 break;
177557 case 27: /* typetoken ::= typename LP signed RP */
 
177558 {
177559 yymsp[-3].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z);
177560 }
 
177561 break;
177562 case 28: /* typetoken ::= typename LP signed COMMA signed RP */
 
177563 {
177564 yymsp[-5].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy0.z);
177565 }
 
177566 break;
177567 case 29: /* typename ::= typename ID|STRING */
 
177568 {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
 
177569 break;
177570 case 30: /* scanpt ::= */
 
177571 {
177572 assert( yyLookahead!=YYNOCODE );
177573 yymsp[1].minor.yy168 = yyLookaheadToken.z;
177574 }
 
177575 break;
177576 case 31: /* scantok ::= */
 
177577 {
177578 assert( yyLookahead!=YYNOCODE );
177579 yymsp[1].minor.yy0 = yyLookaheadToken;
177580 }
 
177581 break;
177582 case 32: /* ccons ::= CONSTRAINT nm */
177583 case 67: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==67);
 
177584 {pParse->constraintName = yymsp[0].minor.yy0;}
 
177585 break;
177586 case 33: /* ccons ::= DEFAULT scantok term */
 
177587 {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
 
177588 break;
177589 case 34: /* ccons ::= DEFAULT LP expr RP */
 
177590 {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy454,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
 
177591 break;
177592 case 35: /* ccons ::= DEFAULT PLUS scantok term */
 
177593 {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
 
177594 break;
177595 case 36: /* ccons ::= DEFAULT MINUS scantok term */
 
177596 {
177597 Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy454, 0);
177598 sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);
177599 }
 
177600 break;
177601 case 37: /* ccons ::= DEFAULT scantok ID|INDEXED */
 
177602 {
177603 Expr *p = tokenExpr(pParse, TK_STRING, yymsp[0].minor.yy0);
177604 if( p ){
177605 sqlite3ExprIdToTrueFalse(p);
177606 testcase( p->op==TK_TRUEFALSE && sqlite3ExprTruthValue(p) );
177607 }
177608 sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n);
177609 }
 
177610 break;
177611 case 38: /* ccons ::= NOT NULL onconf */
 
177612 {sqlite3AddNotNull(pParse, yymsp[0].minor.yy144);}
 
177613 break;
177614 case 39: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
 
177615 {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy144,yymsp[0].minor.yy144,yymsp[-2].minor.yy144);}
 
177616 break;
177617 case 40: /* ccons ::= UNIQUE onconf */
 
177618 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy144,0,0,0,0,
177619 SQLITE_IDXTYPE_UNIQUE);}
 
177620 break;
177621 case 41: /* ccons ::= CHECK LP expr RP */
 
177622 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy454,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
 
177623 break;
177624 case 42: /* ccons ::= REFERENCES nm eidlist_opt refargs */
 
177625 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy14,yymsp[0].minor.yy144);}
 
177626 break;
177627 case 43: /* ccons ::= defer_subclause */
 
177628 {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy144);}
 
177629 break;
177630 case 44: /* ccons ::= COLLATE ID|STRING */
 
177631 {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
 
177632 break;
177633 case 45: /* generated ::= LP expr RP */
 
177634 {sqlite3AddGenerated(pParse,yymsp[-1].minor.yy454,0);}
 
177635 break;
177636 case 46: /* generated ::= LP expr RP ID */
 
177637 {sqlite3AddGenerated(pParse,yymsp[-2].minor.yy454,&yymsp[0].minor.yy0);}
 
177638 break;
177639 case 48: /* autoinc ::= AUTOINCR */
 
177640 {yymsp[0].minor.yy144 = 1;}
 
177641 break;
177642 case 49: /* refargs ::= */
 
177643 { yymsp[1].minor.yy144 = OE_None*0x0101; /* EV: R-19803-45884 */}
 
177644 break;
177645 case 50: /* refargs ::= refargs refarg */
 
177646 { yymsp[-1].minor.yy144 = (yymsp[-1].minor.yy144 & ~yymsp[0].minor.yy383.mask) | yymsp[0].minor.yy383.value; }
 
177647 break;
177648 case 51: /* refarg ::= MATCH nm */
 
177649 { yymsp[-1].minor.yy383.value = 0; yymsp[-1].minor.yy383.mask = 0x000000; }
 
177650 break;
177651 case 52: /* refarg ::= ON INSERT refact */
 
177652 { yymsp[-2].minor.yy383.value = 0; yymsp[-2].minor.yy383.mask = 0x000000; }
 
177653 break;
177654 case 53: /* refarg ::= ON DELETE refact */
 
177655 { yymsp[-2].minor.yy383.value = yymsp[0].minor.yy144; yymsp[-2].minor.yy383.mask = 0x0000ff; }
 
177656 break;
177657 case 54: /* refarg ::= ON UPDATE refact */
 
177658 { yymsp[-2].minor.yy383.value = yymsp[0].minor.yy144<<8; yymsp[-2].minor.yy383.mask = 0x00ff00; }
 
177659 break;
177660 case 55: /* refact ::= SET NULL */
 
177661 { yymsp[-1].minor.yy144 = OE_SetNull; /* EV: R-33326-45252 */}
 
177662 break;
177663 case 56: /* refact ::= SET DEFAULT */
 
177664 { yymsp[-1].minor.yy144 = OE_SetDflt; /* EV: R-33326-45252 */}
 
177665 break;
177666 case 57: /* refact ::= CASCADE */
 
177667 { yymsp[0].minor.yy144 = OE_Cascade; /* EV: R-33326-45252 */}
 
177668 break;
177669 case 58: /* refact ::= RESTRICT */
 
177670 { yymsp[0].minor.yy144 = OE_Restrict; /* EV: R-33326-45252 */}
 
177671 break;
177672 case 59: /* refact ::= NO ACTION */
 
177673 { yymsp[-1].minor.yy144 = OE_None; /* EV: R-33326-45252 */}
 
177674 break;
177675 case 60: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
 
177676 {yymsp[-2].minor.yy144 = 0;}
 
177677 break;
177678 case 61: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
177679 case 76: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==76);
177680 case 173: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==173);
 
177681 {yymsp[-1].minor.yy144 = yymsp[0].minor.yy144;}
 
177682 break;
177683 case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
177684 case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
177685 case 219: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==219);
177686 case 222: /* in_op ::= NOT IN */ yytestcase(yyruleno==222);
177687 case 247: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==247);
 
177688 {yymsp[-1].minor.yy144 = 1;}
 
177689 break;
177690 case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
 
177691 {yymsp[-1].minor.yy144 = 0;}
 
177692 break;
177693 case 66: /* tconscomma ::= COMMA */
 
177694 {pParse->constraintName.n = 0;}
 
177695 break;
177696 case 68: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
 
177697 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy14,yymsp[0].minor.yy144,yymsp[-2].minor.yy144,0);}
 
177698 break;
177699 case 69: /* tcons ::= UNIQUE LP sortlist RP onconf */
 
177700 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy14,yymsp[0].minor.yy144,0,0,0,0,
177701 SQLITE_IDXTYPE_UNIQUE);}
 
177702 break;
177703 case 70: /* tcons ::= CHECK LP expr RP onconf */
 
177704 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy454,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
 
177705 break;
177706 case 71: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
 
177707 {
177708 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy14, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy14, yymsp[-1].minor.yy144);
177709 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy144);
177710 }
 
177711 break;
177712 case 73: /* onconf ::= */
177713 case 75: /* orconf ::= */ yytestcase(yyruleno==75);
 
177714 {yymsp[1].minor.yy144 = OE_Default;}
 
177715 break;
177716 case 74: /* onconf ::= ON CONFLICT resolvetype */
 
177717 {yymsp[-2].minor.yy144 = yymsp[0].minor.yy144;}
 
177718 break;
177719 case 77: /* resolvetype ::= IGNORE */
 
177720 {yymsp[0].minor.yy144 = OE_Ignore;}
 
177721 break;
177722 case 78: /* resolvetype ::= REPLACE */
177723 case 174: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==174);
 
177724 {yymsp[0].minor.yy144 = OE_Replace;}
 
177725 break;
177726 case 79: /* cmd ::= DROP TABLE ifexists fullname */
 
177727 {
177728 sqlite3DropTable(pParse, yymsp[0].minor.yy203, 0, yymsp[-1].minor.yy144);
177729 }
 
177730 break;
177731 case 82: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
 
177732 {
177733 sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy14, yymsp[0].minor.yy555, yymsp[-7].minor.yy144, yymsp[-5].minor.yy144);
177734 }
 
177735 break;
177736 case 83: /* cmd ::= DROP VIEW ifexists fullname */
 
177737 {
177738 sqlite3DropTable(pParse, yymsp[0].minor.yy203, 1, yymsp[-1].minor.yy144);
177739 }
 
177740 break;
177741 case 84: /* cmd ::= select */
 
177742 {
177743 SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0};
177744 if( (pParse->db->mDbFlags & DBFLAG_EncodingFixed)!=0
177745 || sqlite3ReadSchema(pParse)==SQLITE_OK
177746 ){
177747 sqlite3Select(pParse, yymsp[0].minor.yy555, &dest);
177748 }
177749 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy555);
177750 }
 
177751 break;
177752 case 85: /* select ::= WITH wqlist selectnowith */
 
177753 {yymsp[-2].minor.yy555 = attachWithToSelect(pParse,yymsp[0].minor.yy555,yymsp[-1].minor.yy59);}
 
177754 break;
177755 case 86: /* select ::= WITH RECURSIVE wqlist selectnowith */
 
177756 {yymsp[-3].minor.yy555 = attachWithToSelect(pParse,yymsp[0].minor.yy555,yymsp[-1].minor.yy59);}
 
177757 break;
177758 case 87: /* select ::= selectnowith */
 
177759 {
177760 Select *p = yymsp[0].minor.yy555;
177761 if( p ){
177762 parserDoubleLinkSelect(pParse, p);
177763 }
177764 }
 
177765 break;
177766 case 88: /* selectnowith ::= selectnowith multiselect_op oneselect */
 
177767 {
177768 Select *pRhs = yymsp[0].minor.yy555;
177769 Select *pLhs = yymsp[-2].minor.yy555;
177770 if( pRhs && pRhs->pPrior ){
177771 SrcList *pFrom;
@@ -178064,175 +177784,131 @@
177784 }else{
177785 sqlite3SelectDelete(pParse->db, pLhs);
177786 }
177787 yymsp[-2].minor.yy555 = pRhs;
177788 }
 
177789 break;
177790 case 89: /* multiselect_op ::= UNION */
177791 case 91: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==91);
 
177792 {yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-OP*/}
 
177793 break;
177794 case 90: /* multiselect_op ::= UNION ALL */
 
177795 {yymsp[-1].minor.yy144 = TK_ALL;}
 
177796 break;
177797 case 92: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
 
177798 {
177799 yymsp[-8].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy14,yymsp[-5].minor.yy203,yymsp[-4].minor.yy454,yymsp[-3].minor.yy14,yymsp[-2].minor.yy454,yymsp[-1].minor.yy14,yymsp[-7].minor.yy144,yymsp[0].minor.yy454);
177800 }
 
177801 break;
177802 case 93: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
 
177803 {
177804 yymsp[-9].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy14,yymsp[-6].minor.yy203,yymsp[-5].minor.yy454,yymsp[-4].minor.yy14,yymsp[-3].minor.yy454,yymsp[-1].minor.yy14,yymsp[-8].minor.yy144,yymsp[0].minor.yy454);
177805 if( yymsp[-9].minor.yy555 ){
177806 yymsp[-9].minor.yy555->pWinDefn = yymsp[-2].minor.yy211;
177807 }else{
177808 sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy211);
177809 }
177810 }
 
177811 break;
177812 case 94: /* values ::= VALUES LP nexprlist RP */
 
177813 {
177814 yymsp[-3].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy14,0,0,0,0,0,SF_Values,0);
177815 }
 
177816 break;
177817 case 95: /* oneselect ::= mvalues */
 
177818 {
177819 sqlite3MultiValuesEnd(pParse, yymsp[0].minor.yy555);
177820 }
 
177821 break;
177822 case 96: /* mvalues ::= values COMMA LP nexprlist RP */
177823 case 97: /* mvalues ::= mvalues COMMA LP nexprlist RP */ yytestcase(yyruleno==97);
 
177824 {
177825 yymsp[-4].minor.yy555 = sqlite3MultiValues(pParse, yymsp[-4].minor.yy555, yymsp[-1].minor.yy14);
177826 }
 
177827 break;
177828 case 98: /* distinct ::= DISTINCT */
 
177829 {yymsp[0].minor.yy144 = SF_Distinct;}
 
177830 break;
177831 case 99: /* distinct ::= ALL */
 
177832 {yymsp[0].minor.yy144 = SF_All;}
 
177833 break;
177834 case 101: /* sclp ::= */
177835 case 134: /* orderby_opt ::= */ yytestcase(yyruleno==134);
177836 case 144: /* groupby_opt ::= */ yytestcase(yyruleno==144);
177837 case 234: /* exprlist ::= */ yytestcase(yyruleno==234);
177838 case 237: /* paren_exprlist ::= */ yytestcase(yyruleno==237);
177839 case 242: /* eidlist_opt ::= */ yytestcase(yyruleno==242);
 
177840 {yymsp[1].minor.yy14 = 0;}
 
177841 break;
177842 case 102: /* selcollist ::= sclp scanpt expr scanpt as */
 
177843 {
177844 yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy14, yymsp[-2].minor.yy454);
177845 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy14, &yymsp[0].minor.yy0, 1);
177846 sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy14,yymsp[-3].minor.yy168,yymsp[-1].minor.yy168);
177847 }
 
177848 break;
177849 case 103: /* selcollist ::= sclp scanpt STAR */
 
177850 {
177851 Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
177852 sqlite3ExprSetErrorOffset(p, (int)(yymsp[0].minor.yy0.z - pParse->zTail));
177853 yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy14, p);
177854 }
 
177855 break;
177856 case 104: /* selcollist ::= sclp scanpt nm DOT STAR */
 
177857 {
177858 Expr *pRight, *pLeft, *pDot;
177859 pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
177860 sqlite3ExprSetErrorOffset(pRight, (int)(yymsp[0].minor.yy0.z - pParse->zTail));
177861 pLeft = tokenExpr(pParse, TK_ID, yymsp[-2].minor.yy0);
177862 pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
177863 yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, pDot);
177864 }
 
177865 break;
177866 case 105: /* as ::= AS nm */
177867 case 117: /* dbnm ::= DOT nm */ yytestcase(yyruleno==117);
177868 case 258: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==258);
177869 case 259: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==259);
 
177870 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
 
177871 break;
177872 case 107: /* from ::= */
177873 case 110: /* stl_prefix ::= */ yytestcase(yyruleno==110);
 
177874 {yymsp[1].minor.yy203 = 0;}
 
177875 break;
177876 case 108: /* from ::= FROM seltablist */
 
177877 {
177878 yymsp[-1].minor.yy203 = yymsp[0].minor.yy203;
177879 sqlite3SrcListShiftJoinType(pParse,yymsp[-1].minor.yy203);
177880 }
 
177881 break;
177882 case 109: /* stl_prefix ::= seltablist joinop */
 
177883 {
177884 if( ALWAYS(yymsp[-1].minor.yy203 && yymsp[-1].minor.yy203->nSrc>0) ) yymsp[-1].minor.yy203->a[yymsp[-1].minor.yy203->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy144;
177885 }
 
177886 break;
177887 case 111: /* seltablist ::= stl_prefix nm dbnm as on_using */
 
177888 {
177889 yymsp[-4].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-4].minor.yy203,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269);
177890 }
 
177891 break;
177892 case 112: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */
 
177893 {
177894 yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,0,&yymsp[0].minor.yy269);
177895 sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy203, &yymsp[-1].minor.yy0);
177896 }
 
177897 break;
177898 case 113: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */
 
177899 {
177900 yymsp[-7].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-7].minor.yy203,&yymsp[-6].minor.yy0,&yymsp[-5].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269);
177901 sqlite3SrcListFuncArgs(pParse, yymsp[-7].minor.yy203, yymsp[-3].minor.yy14);
177902 }
 
177903 break;
177904 case 114: /* seltablist ::= stl_prefix LP select RP as on_using */
 
177905 {
177906 yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,yymsp[-3].minor.yy555,&yymsp[0].minor.yy269);
177907 }
 
177908 break;
177909 case 115: /* seltablist ::= stl_prefix LP seltablist RP as on_using */
 
177910 {
177911 if( yymsp[-5].minor.yy203==0 && yymsp[-1].minor.yy0.n==0 && yymsp[0].minor.yy269.pOn==0 && yymsp[0].minor.yy269.pUsing==0 ){
177912 yymsp[-5].minor.yy203 = yymsp[-3].minor.yy203;
177913 }else if( ALWAYS(yymsp[-3].minor.yy203!=0) && yymsp[-3].minor.yy203->nSrc==1 ){
177914 yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269);
@@ -178269,210 +177945,144 @@
177945 sqlite3SrcListShiftJoinType(pParse,yymsp[-3].minor.yy203);
177946 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-3].minor.yy203,0,0,0,0,SF_NestedFrom,0);
177947 yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,pSubquery,&yymsp[0].minor.yy269);
177948 }
177949 }
 
177950 break;
177951 case 116: /* dbnm ::= */
177952 case 131: /* indexed_opt ::= */ yytestcase(yyruleno==131);
 
177953 {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
 
177954 break;
177955 case 118: /* fullname ::= nm */
 
177956 {
177957 yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
177958 if( IN_RENAME_OBJECT && yylhsminor.yy203 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[0].minor.yy0);
177959 }
 
177960 yymsp[0].minor.yy203 = yylhsminor.yy203;
177961 break;
177962 case 119: /* fullname ::= nm DOT nm */
 
177963 {
177964 yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
177965 if( IN_RENAME_OBJECT && yylhsminor.yy203 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[0].minor.yy0);
177966 }
 
177967 yymsp[-2].minor.yy203 = yylhsminor.yy203;
177968 break;
177969 case 120: /* xfullname ::= nm */
 
177970 {yymsp[0].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
 
177971 break;
177972 case 121: /* xfullname ::= nm DOT nm */
 
177973 {yymsp[-2].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
 
177974 break;
177975 case 122: /* xfullname ::= nm DOT nm AS nm */
 
177976 {
177977 yymsp[-4].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
177978 if( yymsp[-4].minor.yy203 ) yymsp[-4].minor.yy203->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
177979 }
 
177980 break;
177981 case 123: /* xfullname ::= nm AS nm */
 
177982 {
177983 yymsp[-2].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
177984 if( yymsp[-2].minor.yy203 ) yymsp[-2].minor.yy203->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
177985 }
 
177986 break;
177987 case 124: /* joinop ::= COMMA|JOIN */
 
177988 { yymsp[0].minor.yy144 = JT_INNER; }
 
177989 break;
177990 case 125: /* joinop ::= JOIN_KW JOIN */
 
177991 {yymsp[-1].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
 
177992 break;
177993 case 126: /* joinop ::= JOIN_KW nm JOIN */
 
177994 {yymsp[-2].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
 
177995 break;
177996 case 127: /* joinop ::= JOIN_KW nm nm JOIN */
 
177997 {yymsp[-3].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
 
177998 break;
177999 case 128: /* on_using ::= ON expr */
 
178000 {yymsp[-1].minor.yy269.pOn = yymsp[0].minor.yy454; yymsp[-1].minor.yy269.pUsing = 0;}
 
178001 break;
178002 case 129: /* on_using ::= USING LP idlist RP */
 
178003 {yymsp[-3].minor.yy269.pOn = 0; yymsp[-3].minor.yy269.pUsing = yymsp[-1].minor.yy132;}
 
178004 break;
178005 case 130: /* on_using ::= */
 
178006 {yymsp[1].minor.yy269.pOn = 0; yymsp[1].minor.yy269.pUsing = 0;}
 
178007 break;
178008 case 132: /* indexed_by ::= INDEXED BY nm */
 
178009 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
 
178010 break;
178011 case 133: /* indexed_by ::= NOT INDEXED */
 
178012 {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
 
178013 break;
178014 case 135: /* orderby_opt ::= ORDER BY sortlist */
178015 case 145: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==145);
 
178016 {yymsp[-2].minor.yy14 = yymsp[0].minor.yy14;}
 
178017 break;
178018 case 136: /* sortlist ::= sortlist COMMA expr sortorder nulls */
 
178019 {
178020 yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14,yymsp[-2].minor.yy454);
178021 sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy14,yymsp[-1].minor.yy144,yymsp[0].minor.yy144);
178022 }
 
178023 break;
178024 case 137: /* sortlist ::= expr sortorder nulls */
 
178025 {
178026 yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy454); /*A-overwrites-Y*/
178027 sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy14,yymsp[-1].minor.yy144,yymsp[0].minor.yy144);
178028 }
 
178029 break;
178030 case 138: /* sortorder ::= ASC */
 
178031 {yymsp[0].minor.yy144 = SQLITE_SO_ASC;}
 
178032 break;
178033 case 139: /* sortorder ::= DESC */
 
178034 {yymsp[0].minor.yy144 = SQLITE_SO_DESC;}
 
178035 break;
178036 case 140: /* sortorder ::= */
178037 case 143: /* nulls ::= */ yytestcase(yyruleno==143);
 
178038 {yymsp[1].minor.yy144 = SQLITE_SO_UNDEFINED;}
 
178039 break;
178040 case 141: /* nulls ::= NULLS FIRST */
 
178041 {yymsp[-1].minor.yy144 = SQLITE_SO_ASC;}
 
178042 break;
178043 case 142: /* nulls ::= NULLS LAST */
 
178044 {yymsp[-1].minor.yy144 = SQLITE_SO_DESC;}
 
178045 break;
178046 case 146: /* having_opt ::= */
178047 case 148: /* limit_opt ::= */ yytestcase(yyruleno==148);
178048 case 153: /* where_opt ::= */ yytestcase(yyruleno==153);
178049 case 155: /* where_opt_ret ::= */ yytestcase(yyruleno==155);
178050 case 232: /* case_else ::= */ yytestcase(yyruleno==232);
178051 case 233: /* case_operand ::= */ yytestcase(yyruleno==233);
178052 case 252: /* vinto ::= */ yytestcase(yyruleno==252);
 
178053 {yymsp[1].minor.yy454 = 0;}
 
178054 break;
178055 case 147: /* having_opt ::= HAVING expr */
178056 case 154: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==154);
178057 case 156: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==156);
178058 case 231: /* case_else ::= ELSE expr */ yytestcase(yyruleno==231);
178059 case 251: /* vinto ::= INTO expr */ yytestcase(yyruleno==251);
 
178060 {yymsp[-1].minor.yy454 = yymsp[0].minor.yy454;}
 
178061 break;
178062 case 149: /* limit_opt ::= LIMIT expr */
 
178063 {yymsp[-1].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy454,0);}
 
178064 break;
178065 case 150: /* limit_opt ::= LIMIT expr OFFSET expr */
 
178066 {yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
 
178067 break;
178068 case 151: /* limit_opt ::= LIMIT expr COMMA expr */
 
178069 {yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy454,yymsp[-2].minor.yy454);}
 
178070 break;
178071 case 152: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
 
178072 {
178073 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy203, &yymsp[-1].minor.yy0);
178074 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy203,yymsp[0].minor.yy454,0,0);
178075 }
 
178076 break;
178077 case 157: /* where_opt_ret ::= RETURNING selcollist */
 
178078 {sqlite3AddReturning(pParse,yymsp[0].minor.yy14); yymsp[-1].minor.yy454 = 0;}
 
178079 break;
178080 case 158: /* where_opt_ret ::= WHERE expr RETURNING selcollist */
 
178081 {sqlite3AddReturning(pParse,yymsp[0].minor.yy14); yymsp[-3].minor.yy454 = yymsp[-2].minor.yy454;}
 
178082 break;
178083 case 159: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
 
178084 {
178085 sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy203, &yymsp[-4].minor.yy0);
178086 sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy14,"set list");
178087 if( yymsp[-1].minor.yy203 ){
178088 SrcList *pFromClause = yymsp[-1].minor.yy203;
@@ -178486,134 +178096,92 @@
178096 }
178097 yymsp[-5].minor.yy203 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy203, pFromClause);
178098 }
178099 sqlite3Update(pParse,yymsp[-5].minor.yy203,yymsp[-2].minor.yy14,yymsp[0].minor.yy454,yymsp[-6].minor.yy144,0,0,0);
178100 }
 
178101 break;
178102 case 160: /* setlist ::= setlist COMMA nm EQ expr */
 
178103 {
178104 yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy14, yymsp[0].minor.yy454);
178105 sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy14, &yymsp[-2].minor.yy0, 1);
178106 }
 
178107 break;
178108 case 161: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
 
178109 {
178110 yymsp[-6].minor.yy14 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy14, yymsp[-3].minor.yy132, yymsp[0].minor.yy454);
178111 }
 
178112 break;
178113 case 162: /* setlist ::= nm EQ expr */
 
178114 {
178115 yylhsminor.yy14 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy454);
178116 sqlite3ExprListSetName(pParse, yylhsminor.yy14, &yymsp[-2].minor.yy0, 1);
178117 }
 
178118 yymsp[-2].minor.yy14 = yylhsminor.yy14;
178119 break;
178120 case 163: /* setlist ::= LP idlist RP EQ expr */
 
178121 {
178122 yymsp[-4].minor.yy14 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy132, yymsp[0].minor.yy454);
178123 }
 
178124 break;
178125 case 164: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
 
178126 {
178127 sqlite3Insert(pParse, yymsp[-3].minor.yy203, yymsp[-1].minor.yy555, yymsp[-2].minor.yy132, yymsp[-5].minor.yy144, yymsp[0].minor.yy122);
178128 }
 
178129 break;
178130 case 165: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
 
178131 {
178132 sqlite3Insert(pParse, yymsp[-4].minor.yy203, 0, yymsp[-3].minor.yy132, yymsp[-6].minor.yy144, 0);
178133 }
 
178134 break;
178135 case 166: /* upsert ::= */
 
178136 { yymsp[1].minor.yy122 = 0; }
 
178137 break;
178138 case 167: /* upsert ::= RETURNING selcollist */
 
178139 { yymsp[-1].minor.yy122 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy14); }
 
178140 break;
178141 case 168: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
 
178142 { yymsp[-11].minor.yy122 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy14,yymsp[-6].minor.yy454,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454,yymsp[0].minor.yy122);}
 
178143 break;
178144 case 169: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
 
178145 { yymsp[-8].minor.yy122 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy14,yymsp[-3].minor.yy454,0,0,yymsp[0].minor.yy122); }
 
178146 break;
178147 case 170: /* upsert ::= ON CONFLICT DO NOTHING returning */
 
178148 { yymsp[-4].minor.yy122 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
 
178149 break;
178150 case 171: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
 
178151 { yymsp[-7].minor.yy122 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454,0);}
 
178152 break;
178153 case 172: /* returning ::= RETURNING selcollist */
 
178154 {sqlite3AddReturning(pParse,yymsp[0].minor.yy14);}
 
178155 break;
178156 case 175: /* idlist_opt ::= */
 
178157 {yymsp[1].minor.yy132 = 0;}
 
178158 break;
178159 case 176: /* idlist_opt ::= LP idlist RP */
 
178160 {yymsp[-2].minor.yy132 = yymsp[-1].minor.yy132;}
 
178161 break;
178162 case 177: /* idlist ::= idlist COMMA nm */
 
178163 {yymsp[-2].minor.yy132 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy132,&yymsp[0].minor.yy0);}
 
178164 break;
178165 case 178: /* idlist ::= nm */
 
178166 {yymsp[0].minor.yy132 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
 
178167 break;
178168 case 179: /* expr ::= LP expr RP */
 
178169 {yymsp[-2].minor.yy454 = yymsp[-1].minor.yy454;}
 
178170 break;
178171 case 180: /* expr ::= ID|INDEXED|JOIN_KW */
 
178172 {yymsp[0].minor.yy454=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
 
178173 break;
178174 case 181: /* expr ::= nm DOT nm */
 
178175 {
178176 Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
178177 Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
178178 yylhsminor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
178179 }
 
178180 yymsp[-2].minor.yy454 = yylhsminor.yy454;
178181 break;
178182 case 182: /* expr ::= nm DOT nm DOT nm */
 
178183 {
178184 Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0);
178185 Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
178186 Expr *temp3 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
178187 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
@@ -178620,30 +178188,24 @@
178188 if( IN_RENAME_OBJECT ){
178189 sqlite3RenameTokenRemap(pParse, 0, temp1);
178190 }
178191 yylhsminor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
178192 }
 
178193 yymsp[-4].minor.yy454 = yylhsminor.yy454;
178194 break;
178195 case 183: /* term ::= NULL|FLOAT|BLOB */
178196 case 184: /* term ::= STRING */ yytestcase(yyruleno==184);
 
178197 {yymsp[0].minor.yy454=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
 
178198 break;
178199 case 185: /* term ::= INTEGER */
 
178200 {
178201 yylhsminor.yy454 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
178202 if( yylhsminor.yy454 ) yylhsminor.yy454->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
178203 }
 
178204 yymsp[0].minor.yy454 = yylhsminor.yy454;
178205 break;
178206 case 186: /* expr ::= VARIABLE */
 
178207 {
178208 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
178209 u32 n = yymsp[0].minor.yy0.n;
178210 yymsp[0].minor.yy454 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
178211 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy454, n);
@@ -178660,90 +178222,70 @@
178222 yymsp[0].minor.yy454 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
178223 if( yymsp[0].minor.yy454 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy454->iTable);
178224 }
178225 }
178226 }
 
178227 break;
178228 case 187: /* expr ::= expr COLLATE ID|STRING */
 
178229 {
178230 yymsp[-2].minor.yy454 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy454, &yymsp[0].minor.yy0, 1);
178231 }
 
178232 break;
178233 case 188: /* expr ::= CAST LP expr AS typetoken RP */
 
178234 {
178235 yymsp[-5].minor.yy454 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
178236 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy454, yymsp[-3].minor.yy454, 0);
178237 }
 
178238 break;
178239 case 189: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
 
178240 {
178241 yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy14, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy144);
178242 }
 
178243 yymsp[-4].minor.yy454 = yylhsminor.yy454;
178244 break;
178245 case 190: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */
 
178246 {
178247 yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-4].minor.yy14, &yymsp[-7].minor.yy0, yymsp[-5].minor.yy144);
178248 sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy454, yymsp[-1].minor.yy14);
178249 }
 
178250 yymsp[-7].minor.yy454 = yylhsminor.yy454;
178251 break;
178252 case 191: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
 
178253 {
178254 yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
178255 }
 
178256 yymsp[-3].minor.yy454 = yylhsminor.yy454;
178257 break;
178258 case 192: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
 
178259 {
178260 yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy14, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy144);
178261 sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211);
178262 }
 
178263 yymsp[-5].minor.yy454 = yylhsminor.yy454;
178264 break;
178265 case 193: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */
 
178266 {
178267 yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-5].minor.yy14, &yymsp[-8].minor.yy0, yymsp[-6].minor.yy144);
178268 sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211);
178269 sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy454, yymsp[-2].minor.yy14);
178270 }
 
178271 yymsp[-8].minor.yy454 = yylhsminor.yy454;
178272 break;
178273 case 194: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
 
178274 {
178275 yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
178276 sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211);
178277 }
 
178278 yymsp[-4].minor.yy454 = yylhsminor.yy454;
178279 break;
178280 case 195: /* term ::= CTIME_KW */
 
178281 {
178282 yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
178283 }
 
178284 yymsp[0].minor.yy454 = yylhsminor.yy454;
178285 break;
178286 case 196: /* expr ::= LP nexprlist COMMA expr RP */
 
178287 {
178288 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy14, yymsp[-1].minor.yy454);
178289 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
178290 if( yymsp[-4].minor.yy454 ){
178291 yymsp[-4].minor.yy454->x.pList = pList;
@@ -178752,35 +178294,27 @@
178294 }
178295 }else{
178296 sqlite3ExprListDelete(pParse->db, pList);
178297 }
178298 }
 
178299 break;
178300 case 197: /* expr ::= expr AND expr */
 
178301 {yymsp[-2].minor.yy454=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
 
178302 break;
178303 case 198: /* expr ::= expr OR expr */
178304 case 199: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==199);
178305 case 200: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==200);
178306 case 201: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==201);
178307 case 202: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==202);
178308 case 203: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==203);
178309 case 204: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==204);
 
178310 {yymsp[-2].minor.yy454=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
 
178311 break;
178312 case 205: /* likeop ::= NOT LIKE_KW|MATCH */
 
178313 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
 
178314 break;
178315 case 206: /* expr ::= expr likeop expr */
 
178316 {
178317 ExprList *pList;
178318 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
178319 yymsp[-1].minor.yy0.n &= 0x7fffffff;
178320 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy454);
@@ -178787,14 +178321,12 @@
178321 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy454);
178322 yymsp[-2].minor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
178323 if( bNot ) yymsp[-2].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy454, 0);
178324 if( yymsp[-2].minor.yy454 ) yymsp[-2].minor.yy454->flags |= EP_InfixFunc;
178325 }
 
178326 break;
178327 case 207: /* expr ::= expr likeop expr ESCAPE expr */
 
178328 {
178329 ExprList *pList;
178330 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
178331 yymsp[-3].minor.yy0.n &= 0x7fffffff;
178332 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
@@ -178802,62 +178334,46 @@
178334 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454);
178335 yymsp[-4].minor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
178336 if( bNot ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
178337 if( yymsp[-4].minor.yy454 ) yymsp[-4].minor.yy454->flags |= EP_InfixFunc;
178338 }
 
178339 break;
178340 case 208: /* expr ::= expr ISNULL|NOTNULL */
 
178341 {yymsp[-1].minor.yy454 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy454,0);}
 
178342 break;
178343 case 209: /* expr ::= expr NOT NULL */
 
178344 {yymsp[-2].minor.yy454 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy454,0);}
 
178345 break;
178346 case 210: /* expr ::= expr IS expr */
 
178347 {
178348 yymsp[-2].minor.yy454 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);
178349 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-2].minor.yy454, TK_ISNULL);
178350 }
 
178351 break;
178352 case 211: /* expr ::= expr IS NOT expr */
 
178353 {
178354 yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy454,yymsp[0].minor.yy454);
178355 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-3].minor.yy454, TK_NOTNULL);
178356 }
 
178357 break;
178358 case 212: /* expr ::= expr IS NOT DISTINCT FROM expr */
 
178359 {
178360 yymsp[-5].minor.yy454 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy454,yymsp[0].minor.yy454);
178361 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-5].minor.yy454, TK_ISNULL);
178362 }
 
178363 break;
178364 case 213: /* expr ::= expr IS DISTINCT FROM expr */
 
178365 {
178366 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy454,yymsp[0].minor.yy454);
178367 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-4].minor.yy454, TK_NOTNULL);
178368 }
 
178369 break;
178370 case 214: /* expr ::= NOT expr */
178371 case 215: /* expr ::= BITNOT expr */ yytestcase(yyruleno==215);
 
178372 {yymsp[-1].minor.yy454 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy454, 0);/*A-overwrites-B*/}
 
178373 break;
178374 case 216: /* expr ::= PLUS|MINUS expr */
 
178375 {
178376 Expr *p = yymsp[0].minor.yy454;
178377 u8 op = yymsp[-1].major + (TK_UPLUS-TK_PLUS);
178378 assert( TK_UPLUS>TK_PLUS );
178379 assert( TK_UMINUS == TK_MINUS + (TK_UPLUS - TK_PLUS) );
@@ -178867,30 +178383,24 @@
178383 }else{
178384 yymsp[-1].minor.yy454 = sqlite3PExpr(pParse, op, p, 0);
178385 /*A-overwrites-B*/
178386 }
178387 }
 
178388 break;
178389 case 217: /* expr ::= expr PTR expr */
 
178390 {
178391 ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy454);
178392 pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy454);
178393 yylhsminor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
178394 }
 
178395 yymsp[-2].minor.yy454 = yylhsminor.yy454;
178396 break;
178397 case 218: /* between_op ::= BETWEEN */
178398 case 221: /* in_op ::= IN */ yytestcase(yyruleno==221);
 
178399 {yymsp[0].minor.yy144 = 0;}
 
178400 break;
178401 case 220: /* expr ::= expr between_op expr AND expr */
 
178402 {
178403 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
178404 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454);
178405 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy454, 0);
178406 if( yymsp[-4].minor.yy454 ){
@@ -178898,14 +178408,12 @@
178408 }else{
178409 sqlite3ExprListDelete(pParse->db, pList);
178410 }
178411 if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
178412 }
 
178413 break;
178414 case 223: /* expr ::= expr in_op LP exprlist RP */
 
178415 {
178416 if( yymsp[-1].minor.yy14==0 ){
178417 /* Expressions of the form
178418 **
178419 ** expr1 IN ()
@@ -178946,52 +178454,42 @@
178454 }
178455 }
178456 if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
178457 }
178458 }
 
178459 break;
178460 case 224: /* expr ::= LP select RP */
 
178461 {
178462 yymsp[-2].minor.yy454 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
178463 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy454, yymsp[-1].minor.yy555);
178464 }
 
178465 break;
178466 case 225: /* expr ::= expr in_op LP select RP */
 
178467 {
178468 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
178469 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, yymsp[-1].minor.yy555);
178470 if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
178471 }
 
178472 break;
178473 case 226: /* expr ::= expr in_op nm dbnm paren_exprlist */
 
178474 {
178475 SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
178476 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
178477 if( yymsp[0].minor.yy14 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy14);
178478 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
178479 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pSelect);
178480 if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
178481 }
 
178482 break;
178483 case 227: /* expr ::= EXISTS LP select RP */
 
178484 {
178485 Expr *p;
178486 p = yymsp[-3].minor.yy454 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
178487 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy555);
178488 }
 
178489 break;
178490 case 228: /* expr ::= CASE case_operand case_exprlist case_else END */
 
178491 {
178492 yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy454, 0);
178493 if( yymsp[-4].minor.yy454 ){
178494 yymsp[-4].minor.yy454->x.pList = yymsp[-1].minor.yy454 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454) : yymsp[-2].minor.yy14;
178495 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy454);
@@ -178998,627 +178496,446 @@
178496 }else{
178497 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy14);
178498 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy454);
178499 }
178500 }
 
178501 break;
178502 case 229: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
 
178503 {
178504 yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, yymsp[-2].minor.yy454);
178505 yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, yymsp[0].minor.yy454);
178506 }
 
178507 break;
178508 case 230: /* case_exprlist ::= WHEN expr THEN expr */
 
178509 {
178510 yymsp[-3].minor.yy14 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
178511 yymsp[-3].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy14, yymsp[0].minor.yy454);
178512 }
 
178513 break;
178514 case 235: /* nexprlist ::= nexprlist COMMA expr */
 
178515 {yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy14,yymsp[0].minor.yy454);}
 
178516 break;
178517 case 236: /* nexprlist ::= expr */
 
178518 {yymsp[0].minor.yy14 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy454); /*A-overwrites-Y*/}
 
178519 break;
178520 case 238: /* paren_exprlist ::= LP exprlist RP */
178521 case 243: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==243);
 
178522 {yymsp[-2].minor.yy14 = yymsp[-1].minor.yy14;}
 
178523 break;
178524 case 239: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
 
178525 {
178526 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
178527 sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy14, yymsp[-10].minor.yy144,
178528 &yymsp[-11].minor.yy0, yymsp[0].minor.yy454, SQLITE_SO_ASC, yymsp[-8].minor.yy144, SQLITE_IDXTYPE_APPDEF);
178529 if( IN_RENAME_OBJECT && pParse->pNewIndex ){
178530 sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
178531 }
178532 }
 
178533 break;
178534 case 240: /* uniqueflag ::= UNIQUE */
178535 case 282: /* raisetype ::= ABORT */ yytestcase(yyruleno==282);
 
178536 {yymsp[0].minor.yy144 = OE_Abort;}
 
178537 break;
178538 case 241: /* uniqueflag ::= */
 
178539 {yymsp[1].minor.yy144 = OE_None;}
 
178540 break;
178541 case 244: /* eidlist ::= eidlist COMMA nm collate sortorder */
 
178542 {
178543 yymsp[-4].minor.yy14 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy14, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy144, yymsp[0].minor.yy144);
178544 }
 
178545 break;
178546 case 245: /* eidlist ::= nm collate sortorder */
 
178547 {
178548 yymsp[-2].minor.yy14 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy144, yymsp[0].minor.yy144); /*A-overwrites-Y*/
178549 }
 
178550 break;
178551 case 248: /* cmd ::= DROP INDEX ifexists fullname */
 
178552 {sqlite3DropIndex(pParse, yymsp[0].minor.yy203, yymsp[-1].minor.yy144);}
 
178553 break;
178554 case 249: /* cmd ::= VACUUM vinto */
 
178555 {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy454);}
 
178556 break;
178557 case 250: /* cmd ::= VACUUM nm vinto */
 
178558 {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy454);}
 
178559 break;
178560 case 253: /* cmd ::= PRAGMA nm dbnm */
 
178561 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
 
178562 break;
178563 case 254: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
 
178564 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
 
178565 break;
178566 case 255: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
 
178567 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
 
178568 break;
178569 case 256: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
 
178570 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
 
178571 break;
178572 case 257: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
 
178573 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
 
178574 break;
178575 case 260: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
 
178576 {
178577 Token all;
178578 all.z = yymsp[-3].minor.yy0.z;
178579 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
178580 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy427, &all);
178581 }
 
178582 break;
178583 case 261: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
 
178584 {
178585 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy144, yymsp[-4].minor.yy286.a, yymsp[-4].minor.yy286.b, yymsp[-2].minor.yy203, yymsp[0].minor.yy454, yymsp[-10].minor.yy144, yymsp[-8].minor.yy144);
178586 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
178587 }
 
178588 break;
178589 case 262: /* trigger_time ::= BEFORE|AFTER */
 
178590 { yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-X*/ }
 
178591 break;
178592 case 263: /* trigger_time ::= INSTEAD OF */
 
178593 { yymsp[-1].minor.yy144 = TK_INSTEAD;}
 
178594 break;
178595 case 264: /* trigger_time ::= */
 
178596 { yymsp[1].minor.yy144 = TK_BEFORE; }
 
178597 break;
178598 case 265: /* trigger_event ::= DELETE|INSERT */
178599 case 266: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==266);
 
178600 {yymsp[0].minor.yy286.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy286.b = 0;}
 
178601 break;
178602 case 267: /* trigger_event ::= UPDATE OF idlist */
 
178603 {yymsp[-2].minor.yy286.a = TK_UPDATE; yymsp[-2].minor.yy286.b = yymsp[0].minor.yy132;}
 
178604 break;
178605 case 268: /* when_clause ::= */
178606 case 287: /* key_opt ::= */ yytestcase(yyruleno==287);
 
178607 { yymsp[1].minor.yy454 = 0; }
 
178608 break;
178609 case 269: /* when_clause ::= WHEN expr */
178610 case 288: /* key_opt ::= KEY expr */ yytestcase(yyruleno==288);
 
178611 { yymsp[-1].minor.yy454 = yymsp[0].minor.yy454; }
 
178612 break;
178613 case 270: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
 
178614 {
178615 assert( yymsp[-2].minor.yy427!=0 );
178616 yymsp[-2].minor.yy427->pLast->pNext = yymsp[-1].minor.yy427;
178617 yymsp[-2].minor.yy427->pLast = yymsp[-1].minor.yy427;
178618 }
 
178619 break;
178620 case 271: /* trigger_cmd_list ::= trigger_cmd SEMI */
 
178621 {
178622 assert( yymsp[-1].minor.yy427!=0 );
178623 yymsp[-1].minor.yy427->pLast = yymsp[-1].minor.yy427;
178624 }
 
178625 break;
178626 case 272: /* trnm ::= nm DOT nm */
 
178627 {
178628 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
178629 sqlite3ErrorMsg(pParse,
178630 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
178631 "statements within triggers");
178632 }
 
178633 break;
178634 case 273: /* tridxby ::= INDEXED BY nm */
 
178635 {
178636 sqlite3ErrorMsg(pParse,
178637 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
178638 "within triggers");
178639 }
 
178640 break;
178641 case 274: /* tridxby ::= NOT INDEXED */
 
178642 {
178643 sqlite3ErrorMsg(pParse,
178644 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
178645 "within triggers");
178646 }
 
178647 break;
178648 case 275: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
 
178649 {yylhsminor.yy427 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy203, yymsp[-3].minor.yy14, yymsp[-1].minor.yy454, yymsp[-7].minor.yy144, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy168);}
 
178650 yymsp[-8].minor.yy427 = yylhsminor.yy427;
178651 break;
178652 case 276: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
 
178653 {
178654 yylhsminor.yy427 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy132,yymsp[-2].minor.yy555,yymsp[-6].minor.yy144,yymsp[-1].minor.yy122,yymsp[-7].minor.yy168,yymsp[0].minor.yy168);/*yylhsminor.yy427-overwrites-yymsp[-6].minor.yy144*/
178655 }
 
178656 yymsp[-7].minor.yy427 = yylhsminor.yy427;
178657 break;
178658 case 277: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
 
178659 {yylhsminor.yy427 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy454, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy168);}
 
178660 yymsp[-5].minor.yy427 = yylhsminor.yy427;
178661 break;
178662 case 278: /* trigger_cmd ::= scanpt select scanpt */
 
178663 {yylhsminor.yy427 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy555, yymsp[-2].minor.yy168, yymsp[0].minor.yy168); /*yylhsminor.yy427-overwrites-yymsp[-1].minor.yy555*/}
 
178664 yymsp[-2].minor.yy427 = yylhsminor.yy427;
178665 break;
178666 case 279: /* expr ::= RAISE LP IGNORE RP */
 
178667 {
178668 yymsp[-3].minor.yy454 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
178669 if( yymsp[-3].minor.yy454 ){
178670 yymsp[-3].minor.yy454->affExpr = OE_Ignore;
178671 }
178672 }
 
178673 break;
178674 case 280: /* expr ::= RAISE LP raisetype COMMA expr RP */
 
178675 {
178676 yymsp[-5].minor.yy454 = sqlite3PExpr(pParse, TK_RAISE, yymsp[-1].minor.yy454, 0);
178677 if( yymsp[-5].minor.yy454 ) {
178678 yymsp[-5].minor.yy454->affExpr = (char)yymsp[-3].minor.yy144;
178679 }
178680 }
 
178681 break;
178682 case 281: /* raisetype ::= ROLLBACK */
 
178683 {yymsp[0].minor.yy144 = OE_Rollback;}
 
178684 break;
178685 case 283: /* raisetype ::= FAIL */
 
178686 {yymsp[0].minor.yy144 = OE_Fail;}
 
178687 break;
178688 case 284: /* cmd ::= DROP TRIGGER ifexists fullname */
 
178689 {
178690 sqlite3DropTrigger(pParse,yymsp[0].minor.yy203,yymsp[-1].minor.yy144);
178691 }
 
178692 break;
178693 case 285: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
 
178694 {
178695 sqlite3Attach(pParse, yymsp[-3].minor.yy454, yymsp[-1].minor.yy454, yymsp[0].minor.yy454);
178696 }
 
178697 break;
178698 case 286: /* cmd ::= DETACH database_kw_opt expr */
 
178699 {
178700 sqlite3Detach(pParse, yymsp[0].minor.yy454);
178701 }
 
178702 break;
178703 case 289: /* cmd ::= REINDEX */
 
178704 {sqlite3Reindex(pParse, 0, 0);}
 
178705 break;
178706 case 290: /* cmd ::= REINDEX nm dbnm */
 
178707 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
 
178708 break;
178709 case 291: /* cmd ::= ANALYZE */
 
178710 {sqlite3Analyze(pParse, 0, 0);}
 
178711 break;
178712 case 292: /* cmd ::= ANALYZE nm dbnm */
 
178713 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
 
178714 break;
178715 case 293: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
 
178716 {
178717 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy203,&yymsp[0].minor.yy0);
178718 }
 
178719 break;
178720 case 294: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
 
178721 {
178722 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
178723 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
178724 }
 
178725 break;
178726 case 295: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
 
178727 {
178728 sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy203, &yymsp[0].minor.yy0);
178729 }
 
178730 break;
178731 case 296: /* add_column_fullname ::= fullname */
 
178732 {
178733 disableLookaside(pParse);
178734 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy203);
178735 }
 
178736 break;
178737 case 297: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
 
178738 {
178739 sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy203, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
178740 }
 
178741 break;
178742 case 298: /* cmd ::= create_vtab */
 
178743 {sqlite3VtabFinishParse(pParse,0);}
 
178744 break;
178745 case 299: /* cmd ::= create_vtab LP vtabarglist RP */
 
178746 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
 
178747 break;
178748 case 300: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
 
178749 {
178750 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy144);
178751 }
 
178752 break;
178753 case 301: /* vtabarg ::= */
 
178754 {sqlite3VtabArgInit(pParse);}
 
178755 break;
178756 case 302: /* vtabargtoken ::= ANY */
178757 case 303: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==303);
178758 case 304: /* lp ::= LP */ yytestcase(yyruleno==304);
 
178759 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
 
178760 break;
178761 case 305: /* with ::= WITH wqlist */
178762 case 306: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==306);
 
178763 { sqlite3WithPush(pParse, yymsp[0].minor.yy59, 1); }
 
178764 break;
178765 case 307: /* wqas ::= AS */
 
178766 {yymsp[0].minor.yy462 = M10d_Any;}
 
178767 break;
178768 case 308: /* wqas ::= AS MATERIALIZED */
 
178769 {yymsp[-1].minor.yy462 = M10d_Yes;}
 
178770 break;
178771 case 309: /* wqas ::= AS NOT MATERIALIZED */
 
178772 {yymsp[-2].minor.yy462 = M10d_No;}
 
178773 break;
178774 case 310: /* wqitem ::= withnm eidlist_opt wqas LP select RP */
 
178775 {
178776 yymsp[-5].minor.yy67 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy14, yymsp[-1].minor.yy555, yymsp[-3].minor.yy462); /*A-overwrites-X*/
178777 }
 
178778 break;
178779 case 311: /* withnm ::= nm */
 
178780 {pParse->bHasWith = 1;}
 
178781 break;
178782 case 312: /* wqlist ::= wqitem */
 
178783 {
178784 yymsp[0].minor.yy59 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy67); /*A-overwrites-X*/
178785 }
 
178786 break;
178787 case 313: /* wqlist ::= wqlist COMMA wqitem */
 
178788 {
178789 yymsp[-2].minor.yy59 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy59, yymsp[0].minor.yy67);
178790 }
 
178791 break;
178792 case 314: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
 
178793 {
178794 assert( yymsp[0].minor.yy211!=0 );
178795 sqlite3WindowChain(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy211);
178796 yymsp[0].minor.yy211->pNextWin = yymsp[-2].minor.yy211;
178797 yylhsminor.yy211 = yymsp[0].minor.yy211;
178798 }
 
178799 yymsp[-2].minor.yy211 = yylhsminor.yy211;
178800 break;
178801 case 315: /* windowdefn ::= nm AS LP window RP */
 
178802 {
178803 if( ALWAYS(yymsp[-1].minor.yy211) ){
178804 yymsp[-1].minor.yy211->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
178805 }
178806 yylhsminor.yy211 = yymsp[-1].minor.yy211;
178807 }
 
178808 yymsp[-4].minor.yy211 = yylhsminor.yy211;
178809 break;
178810 case 316: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
 
178811 {
178812 yymsp[-4].minor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy14, yymsp[-1].minor.yy14, 0);
178813 }
 
178814 break;
178815 case 317: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
 
178816 {
178817 yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy14, yymsp[-1].minor.yy14, &yymsp[-5].minor.yy0);
178818 }
 
178819 yymsp[-5].minor.yy211 = yylhsminor.yy211;
178820 break;
178821 case 318: /* window ::= ORDER BY sortlist frame_opt */
 
178822 {
178823 yymsp[-3].minor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, yymsp[-1].minor.yy14, 0);
178824 }
 
178825 break;
178826 case 319: /* window ::= nm ORDER BY sortlist frame_opt */
 
178827 {
178828 yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, yymsp[-1].minor.yy14, &yymsp[-4].minor.yy0);
178829 }
 
178830 yymsp[-4].minor.yy211 = yylhsminor.yy211;
178831 break;
178832 case 320: /* window ::= nm frame_opt */
 
178833 {
178834 yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, 0, &yymsp[-1].minor.yy0);
178835 }
 
178836 yymsp[-1].minor.yy211 = yylhsminor.yy211;
178837 break;
178838 case 321: /* frame_opt ::= */
 
178839 {
178840 yymsp[1].minor.yy211 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
178841 }
 
178842 break;
178843 case 322: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
 
178844 {
178845 yylhsminor.yy211 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy144, yymsp[-1].minor.yy509.eType, yymsp[-1].minor.yy509.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy462);
178846 }
 
178847 yymsp[-2].minor.yy211 = yylhsminor.yy211;
178848 break;
178849 case 323: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
 
178850 {
178851 yylhsminor.yy211 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy144, yymsp[-3].minor.yy509.eType, yymsp[-3].minor.yy509.pExpr, yymsp[-1].minor.yy509.eType, yymsp[-1].minor.yy509.pExpr, yymsp[0].minor.yy462);
178852 }
 
178853 yymsp[-5].minor.yy211 = yylhsminor.yy211;
178854 break;
178855 case 325: /* frame_bound_s ::= frame_bound */
178856 case 327: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==327);
 
178857 {yylhsminor.yy509 = yymsp[0].minor.yy509;}
 
178858 yymsp[0].minor.yy509 = yylhsminor.yy509;
178859 break;
178860 case 326: /* frame_bound_s ::= UNBOUNDED PRECEDING */
178861 case 328: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==328);
178862 case 330: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==330);
 
178863 {yylhsminor.yy509.eType = yymsp[-1].major; yylhsminor.yy509.pExpr = 0;}
 
178864 yymsp[-1].minor.yy509 = yylhsminor.yy509;
178865 break;
178866 case 329: /* frame_bound ::= expr PRECEDING|FOLLOWING */
 
178867 {yylhsminor.yy509.eType = yymsp[0].major; yylhsminor.yy509.pExpr = yymsp[-1].minor.yy454;}
 
178868 yymsp[-1].minor.yy509 = yylhsminor.yy509;
178869 break;
178870 case 331: /* frame_exclude_opt ::= */
 
178871 {yymsp[1].minor.yy462 = 0;}
 
178872 break;
178873 case 332: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
 
178874 {yymsp[-1].minor.yy462 = yymsp[0].minor.yy462;}
 
178875 break;
178876 case 333: /* frame_exclude ::= NO OTHERS */
178877 case 334: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==334);
 
178878 {yymsp[-1].minor.yy462 = yymsp[-1].major; /*A-overwrites-X*/}
 
178879 break;
178880 case 335: /* frame_exclude ::= GROUP|TIES */
 
178881 {yymsp[0].minor.yy462 = yymsp[0].major; /*A-overwrites-X*/}
 
178882 break;
178883 case 336: /* window_clause ::= WINDOW windowdefn_list */
 
178884 { yymsp[-1].minor.yy211 = yymsp[0].minor.yy211; }
 
178885 break;
178886 case 337: /* filter_over ::= filter_clause over_clause */
 
178887 {
178888 if( yymsp[0].minor.yy211 ){
178889 yymsp[0].minor.yy211->pFilter = yymsp[-1].minor.yy454;
178890 }else{
178891 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy454);
178892 }
178893 yylhsminor.yy211 = yymsp[0].minor.yy211;
178894 }
 
178895 yymsp[-1].minor.yy211 = yylhsminor.yy211;
178896 break;
178897 case 338: /* filter_over ::= over_clause */
 
178898 {
178899 yylhsminor.yy211 = yymsp[0].minor.yy211;
178900 }
 
178901 yymsp[0].minor.yy211 = yylhsminor.yy211;
178902 break;
178903 case 339: /* filter_over ::= filter_clause */
 
178904 {
178905 yylhsminor.yy211 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
178906 if( yylhsminor.yy211 ){
178907 yylhsminor.yy211->eFrmType = TK_FILTER;
178908 yylhsminor.yy211->pFilter = yymsp[0].minor.yy454;
178909 }else{
178910 sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy454);
178911 }
178912 }
 
178913 yymsp[0].minor.yy211 = yylhsminor.yy211;
178914 break;
178915 case 340: /* over_clause ::= OVER LP window RP */
 
178916 {
178917 yymsp[-3].minor.yy211 = yymsp[-1].minor.yy211;
178918 assert( yymsp[-3].minor.yy211!=0 );
178919 }
 
178920 break;
178921 case 341: /* over_clause ::= OVER nm */
 
178922 {
178923 yymsp[-1].minor.yy211 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
178924 if( yymsp[-1].minor.yy211 ){
178925 yymsp[-1].minor.yy211->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
178926 }
178927 }
 
178928 break;
178929 case 342: /* filter_clause ::= FILTER LP WHERE expr RP */
 
178930 { yymsp[-4].minor.yy454 = yymsp[-1].minor.yy454; }
 
178931 break;
178932 case 343: /* term ::= QNUMBER */
 
178933 {
178934 yylhsminor.yy454=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0);
178935 sqlite3DequoteNumber(pParse, yylhsminor.yy454);
178936 }
 
178937 yymsp[0].minor.yy454 = yylhsminor.yy454;
178938 break;
178939 default:
178940 /* (344) input ::= cmdlist */ yytestcase(yyruleno==344);
178941 /* (345) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==345);
@@ -179742,19 +179059,17 @@
179059 ){
179060 sqlite3ParserARG_FETCH
179061 sqlite3ParserCTX_FETCH
179062 #define TOKEN yyminor
179063 /************ Begin %syntax_error code ****************************************/
 
179064
179065 UNUSED_PARAMETER(yymajor); /* Silence some compiler warnings */
179066 if( TOKEN.z[0] ){
179067 sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
179068 }else{
179069 sqlite3ErrorMsg(pParse, "incomplete input");
179070 }
 
179071 /************ End %syntax_error code ******************************************/
179072 sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
179073 sqlite3ParserCTX_STORE
179074 }
179075
@@ -180022,11 +179337,10 @@
179337 #endif
179338 }
179339
179340 /************** End of parse.c ***********************************************/
179341 /************** Begin file tokenize.c ****************************************/
 
179342 /*
179343 ** 2001 September 15
179344 **
179345 ** The author disclaims copyright to this source code. In place of
179346 ** a legal notice, here is a blessing:
@@ -180172,11 +179486,10 @@
179486 ** named keywordhash.h and then included into this source file by
179487 ** the #include below.
179488 */
179489 /************** Include keywordhash.h in the middle of tokenize.c ************/
179490 /************** Begin file keywordhash.h *************************************/
 
179491 /***** This file contains automatically generated code ******
179492 **
179493 ** The code in this file has been automatically generated by
179494 **
179495 ** sqlite/tool/mkkeywordhash.c
@@ -180658,11 +179971,10 @@
179971 return TK_ID!=sqlite3KeywordCode((const u8*)zName, nName);
179972 }
179973
179974 /************** End of keywordhash.h *****************************************/
179975 /************** Continuing where we left off in tokenize.c *******************/
 
179976
179977
179978 /*
179979 ** If X is a character that can be used in an identifier then
179980 ** IdChar(X) will be true. Otherwise it is false.
@@ -181402,11 +180714,10 @@
180714 }
180715 #endif /* SQLITE_ENABLE_NORMALIZE */
180716
180717 /************** End of tokenize.c ********************************************/
180718 /************** Begin file complete.c ****************************************/
 
180719 /*
180720 ** 2001 September 15
180721 **
180722 ** The author disclaims copyright to this source code. In place of
180723 ** a legal notice, here is a blessing:
@@ -181696,11 +181007,10 @@
181007 #endif /* SQLITE_OMIT_UTF16 */
181008 #endif /* SQLITE_OMIT_COMPLETE */
181009
181010 /************** End of complete.c ********************************************/
181011 /************** Begin file main.c ********************************************/
 
181012 /*
181013 ** 2001 September 15
181014 **
181015 ** The author disclaims copyright to this source code. In place of
181016 ** a legal notice, here is a blessing:
@@ -181718,11 +181028,10 @@
181028 /* #include "sqliteInt.h" */
181029
181030 #ifdef SQLITE_ENABLE_FTS3
181031 /************** Include fts3.h in the middle of main.c ***********************/
181032 /************** Begin file fts3.h ********************************************/
 
181033 /*
181034 ** 2006 Oct 10
181035 **
181036 ** The author disclaims copyright to this source code. In place of
181037 ** a legal notice, here is a blessing:
@@ -181748,16 +181057,14 @@
181057 } /* extern "C" */
181058 #endif /* __cplusplus */
181059
181060 /************** End of fts3.h ************************************************/
181061 /************** Continuing where we left off in main.c ***********************/
 
181062 #endif
181063 #ifdef SQLITE_ENABLE_RTREE
181064 /************** Include rtree.h in the middle of main.c **********************/
181065 /************** Begin file rtree.h *******************************************/
 
181066 /*
181067 ** 2008 May 26
181068 **
181069 ** The author disclaims copyright to this source code. In place of
181070 ** a legal notice, here is a blessing:
@@ -181787,16 +181094,14 @@
181094 } /* extern "C" */
181095 #endif /* __cplusplus */
181096
181097 /************** End of rtree.h ***********************************************/
181098 /************** Continuing where we left off in main.c ***********************/
 
181099 #endif
181100 #if defined(SQLITE_ENABLE_ICU) || defined(SQLITE_ENABLE_ICU_COLLATIONS)
181101 /************** Include sqliteicu.h in the middle of main.c ******************/
181102 /************** Begin file sqliteicu.h ***************************************/
 
181103 /*
181104 ** 2008 May 26
181105 **
181106 ** The author disclaims copyright to this source code. In place of
181107 ** a legal notice, here is a blessing:
@@ -181822,11 +181127,10 @@
181127 } /* extern "C" */
181128 #endif /* __cplusplus */
181129
181130 /************** End of sqliteicu.h *******************************************/
181131 /************** Continuing where we left off in main.c ***********************/
 
181132 #endif
181133
181134 /*
181135 ** This is an extension initializer that is a no-op and always
181136 ** succeeds, except that it fails if the fault-simulation is set
@@ -184724,12 +184028,12 @@
184028 }
184029 oldLimit = db->aLimit[limitId];
184030 if( newLimit>=0 ){ /* IMP: R-52476-28732 */
184031 if( newLimit>aHardLimit[limitId] ){
184032 newLimit = aHardLimit[limitId]; /* IMP: R-51463-25634 */
184033 }else if( newLimit<SQLITE_MIN_LENGTH && limitId==SQLITE_LIMIT_LENGTH ){
184034 newLimit = SQLITE_MIN_LENGTH;
184035 }
184036 db->aLimit[limitId] = newLimit;
184037 }
184038 return oldLimit; /* IMP: R-53341-35419 */
184039 }
@@ -186873,11 +186177,10 @@
186177 }
186178 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
186179
186180 /************** End of main.c ************************************************/
186181 /************** Begin file notify.c ******************************************/
 
186182 /*
186183 ** 2009 March 3
186184 **
186185 ** The author disclaims copyright to this source code. In place of
186186 ** a legal notice, here is a blessing:
@@ -187212,11 +186515,10 @@
186515 }
186516 #endif
186517
186518 /************** End of notify.c **********************************************/
186519 /************** Begin file fts3.c ********************************************/
 
186520 /*
186521 ** 2006 Oct 10
186522 **
186523 ** The author disclaims copyright to this source code. In place of
186524 ** a legal notice, here is a blessing:
@@ -187505,11 +186807,10 @@
186807 ** older data.
186808 */
186809
186810 /************** Include fts3Int.h in the middle of fts3.c ********************/
186811 /************** Begin file fts3Int.h *****************************************/
 
186812 /*
186813 ** 2009 Nov 12
186814 **
186815 ** The author disclaims copyright to this source code. In place of
186816 ** a legal notice, here is a blessing:
@@ -187552,11 +186853,10 @@
186853 #endif
186854
186855 /* #include "sqlite3.h" */
186856 /************** Include fts3_tokenizer.h in the middle of fts3Int.h **********/
186857 /************** Begin file fts3_tokenizer.h **********************************/
 
186858 /*
186859 ** 2006 July 10
186860 **
186861 ** The author disclaims copyright to this source code.
186862 **
@@ -187717,14 +187017,12 @@
187017
187018 #endif /* _FTS3_TOKENIZER_H_ */
187019
187020 /************** End of fts3_tokenizer.h **************************************/
187021 /************** Continuing where we left off in fts3Int.h ********************/
 
187022 /************** Include fts3_hash.h in the middle of fts3Int.h ***************/
187023 /************** Begin file fts3_hash.h ***************************************/
 
187024 /*
187025 ** 2001 September 22
187026 **
187027 ** The author disclaims copyright to this source code. In place of
187028 ** a legal notice, here is a blessing:
@@ -187836,11 +187134,10 @@
187134
187135 #endif /* _FTS3_HASH_H_ */
187136
187137 /************** End of fts3_hash.h *******************************************/
187138 /************** Continuing where we left off in fts3Int.h ********************/
 
187139
187140 /*
187141 ** This constant determines the maximum depth of an FTS expression tree
187142 ** that the library will create and use. FTS uses recursion to perform
187143 ** various operations on the query tree, so the disadvantage of a large
@@ -188453,11 +187750,10 @@
187750 #endif /* !SQLITE_CORE || SQLITE_ENABLE_FTS3 */
187751 #endif /* _FTSINT_H */
187752
187753 /************** End of fts3Int.h *********************************************/
187754 /************** Continuing where we left off in fts3.c ***********************/
 
187755 #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
187756
187757 #if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_CORE)
187758 # define SQLITE_CORE 1
187759 #endif
@@ -190509,14 +189805,19 @@
189805
189806 assert_fts3_nc( p!=0 && *p1!=0 && *p2!=0 );
189807 if( *p1==POS_COLUMN ){
189808 p1++;
189809 p1 += fts3GetVarint32(p1, &iCol1);
189810 /* iCol1==0 indicates corruption. Column 0 does not have a POS_COLUMN
189811 ** entry, so this is actually end-of-doclist. */
189812 if( iCol1==0 ) return 0;
189813 }
189814 if( *p2==POS_COLUMN ){
189815 p2++;
189816 p2 += fts3GetVarint32(p2, &iCol2);
189817 /* As above, iCol2==0 indicates corruption. */
189818 if( iCol2==0 ) return 0;
189819 }
189820
189821 while( 1 ){
189822 if( iCol1==iCol2 ){
189823 char *pSave = p;
@@ -193683,11 +192984,11 @@
192984 for(p=pExpr; p->pLeft; p=p->pLeft){
192985 assert( p->pRight->pPhrase->doclist.nList>0 );
192986 nTmp += p->pRight->pPhrase->doclist.nList;
192987 }
192988 nTmp += p->pPhrase->doclist.nList;
192989 aTmp = sqlite3_malloc64(nTmp*2 + FTS3_VARINT_MAX);
192990 if( !aTmp ){
192991 *pRc = SQLITE_NOMEM;
192992 res = 0;
192993 }else{
192994 char *aPoslist = p->pPhrase->doclist.pList;
@@ -194355,11 +193656,10 @@
193656
193657 #endif
193658
193659 /************** End of fts3.c ************************************************/
193660 /************** Begin file fts3_aux.c ****************************************/
 
193661 /*
193662 ** 2011 Jan 27
193663 **
193664 ** The author disclaims copyright to this source code. In place of
193665 ** a legal notice, here is a blessing:
@@ -194916,11 +194216,10 @@
194216
194217 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
194218
194219 /************** End of fts3_aux.c ********************************************/
194220 /************** Begin file fts3_expr.c ***************************************/
 
194221 /*
194222 ** 2008 Nov 28
194223 **
194224 ** The author disclaims copyright to this source code. In place of
194225 ** a legal notice, here is a blessing:
@@ -196213,11 +195512,10 @@
195512 #endif
195513 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
195514
195515 /************** End of fts3_expr.c *******************************************/
195516 /************** Begin file fts3_hash.c ***************************************/
 
195517 /*
195518 ** 2001 September 22
195519 **
195520 ** The author disclaims copyright to this source code. In place of
195521 ** a legal notice, here is a blessing:
@@ -196600,11 +195898,10 @@
195898
195899 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
195900
195901 /************** End of fts3_hash.c *******************************************/
195902 /************** Begin file fts3_porter.c *************************************/
 
195903 /*
195904 ** 2006 September 30
195905 **
195906 ** The author disclaims copyright to this source code. In place of
195907 ** a legal notice, here is a blessing:
@@ -197266,11 +196563,10 @@
196563
196564 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
196565
196566 /************** End of fts3_porter.c *****************************************/
196567 /************** Begin file fts3_tokenizer.c **********************************/
 
196568 /*
196569 ** 2007 June 22
196570 **
196571 ** The author disclaims copyright to this source code. In place of
196572 ** a legal notice, here is a blessing:
@@ -197786,11 +197082,10 @@
197082
197083 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
197084
197085 /************** End of fts3_tokenizer.c **************************************/
197086 /************** Begin file fts3_tokenizer1.c *********************************/
 
197087 /*
197088 ** 2006 Oct 10
197089 **
197090 ** The author disclaims copyright to this source code. In place of
197091 ** a legal notice, here is a blessing:
@@ -198024,11 +197319,10 @@
197319
197320 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
197321
197322 /************** End of fts3_tokenizer1.c *************************************/
197323 /************** Begin file fts3_tokenize_vtab.c ******************************/
 
197324 /*
197325 ** 2013 Apr 22
197326 **
197327 ** The author disclaims copyright to this source code. In place of
197328 ** a legal notice, here is a blessing:
@@ -198487,11 +197781,10 @@
197781
197782 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
197783
197784 /************** End of fts3_tokenize_vtab.c **********************************/
197785 /************** Begin file fts3_write.c **************************************/
 
197786 /*
197787 ** 2009 Oct 23
197788 **
197789 ** The author disclaims copyright to this source code. In place of
197790 ** a legal notice, here is a blessing:
@@ -204325,11 +203618,10 @@
203618
203619 #endif
203620
203621 /************** End of fts3_write.c ******************************************/
203622 /************** Begin file fts3_snippet.c ************************************/
 
203623 /*
203624 ** 2009 Oct 23
203625 **
203626 ** The author disclaims copyright to this source code. In place of
203627 ** a legal notice, here is a blessing:
@@ -206085,11 +205377,10 @@
205377
205378 #endif
205379
205380 /************** End of fts3_snippet.c ****************************************/
205381 /************** Begin file fts3_unicode.c ************************************/
 
205382 /*
205383 ** 2012 May 24
205384 **
205385 ** The author disclaims copyright to this source code. In place of
205386 ** a legal notice, here is a blessing:
@@ -206486,11 +205777,10 @@
205777 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
205778 #endif /* ifndef SQLITE_DISABLE_FTS3_UNICODE */
205779
205780 /************** End of fts3_unicode.c ****************************************/
205781 /************** Begin file fts3_unicode2.c ***********************************/
 
205782 /*
205783 ** 2012-05-25
205784 **
205785 ** The author disclaims copyright to this source code. In place of
205786 ** a legal notice, here is a blessing:
@@ -206873,11 +206163,10 @@
206163 #endif /* defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4) */
206164 #endif /* !defined(SQLITE_DISABLE_FTS3_UNICODE) */
206165
206166 /************** End of fts3_unicode2.c ***************************************/
206167 /************** Begin file json.c ********************************************/
 
206168 /*
206169 ** 2015-08-12
206170 **
206171 ** The author disclaims copyright to this source code. In place of
206172 ** a legal notice, here is a blessing:
@@ -212343,11 +211632,10 @@
211632 }
211633 #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON) */
211634
211635 /************** End of json.c ************************************************/
211636 /************** Begin file rtree.c *******************************************/
 
211637 /*
211638 ** 2001 September 15
211639 **
211640 ** The author disclaims copyright to this source code. In place of
211641 ** a legal notice, here is a blessing:
@@ -216632,11 +215920,10 @@
215920
215921 /* Conditionally include the geopoly code */
215922 #ifdef SQLITE_ENABLE_GEOPOLY
215923 /************** Include geopoly.c in the middle of rtree.c *******************/
215924 /************** Begin file geopoly.c *****************************************/
 
215925 /*
215926 ** 2018-05-25
215927 **
215928 ** The author disclaims copyright to this source code. In place of
215929 ** a legal notice, here is a blessing:
@@ -218475,11 +217762,10 @@
217762 return rc;
217763 }
217764
217765 /************** End of geopoly.c *********************************************/
217766 /************** Continuing where we left off in rtree.c **********************/
 
217767 #endif
217768
217769 /*
217770 ** Register the r-tree module with database handle db. This creates the
217771 ** virtual table module "rtree" and the debugging/analysis scalar
@@ -218658,11 +217944,10 @@
217944
217945 #endif
217946
217947 /************** End of rtree.c ***********************************************/
217948 /************** Begin file icu.c *********************************************/
 
217949 /*
217950 ** 2007 May 6
217951 **
217952 ** The author disclaims copyright to this source code. In place of
217953 ** a legal notice, here is a blessing:
@@ -219250,11 +218535,10 @@
218535
218536 #endif
218537
218538 /************** End of icu.c *************************************************/
218539 /************** Begin file fts3_icu.c ****************************************/
 
218540 /*
218541 ** 2007 June 22
218542 **
218543 ** The author disclaims copyright to this source code. In place of
218544 ** a legal notice, here is a blessing:
@@ -219516,11 +218800,10 @@
218800 #endif /* defined(SQLITE_ENABLE_ICU) */
218801 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
218802
218803 /************** End of fts3_icu.c ********************************************/
218804 /************** Begin file sqlite3rbu.c **************************************/
 
218805 /*
218806 ** 2014 August 30
218807 **
218808 ** The author disclaims copyright to this source code. In place of
218809 ** a legal notice, here is a blessing:
@@ -219608,11 +218891,10 @@
218891 /* #include "sqlite3.h" */
218892
218893 #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU)
218894 /************** Include sqlite3rbu.h in the middle of sqlite3rbu.c ***********/
218895 /************** Begin file sqlite3rbu.h **************************************/
 
218896 /*
218897 ** 2014 August 30
218898 **
218899 ** The author disclaims copyright to this source code. In place of
218900 ** a legal notice, here is a blessing:
@@ -220245,11 +219527,10 @@
219527
219528 #endif /* _SQLITE3RBU_H */
219529
219530 /************** End of sqlite3rbu.h ******************************************/
219531 /************** Continuing where we left off in sqlite3rbu.c *****************/
 
219532
219533 #if defined(_WIN32_WCE)
219534 /* #include "windows.h" */
219535 #endif
219536
@@ -225606,11 +224887,10 @@
224887
224888 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU) */
224889
224890 /************** End of sqlite3rbu.c ******************************************/
224891 /************** Begin file dbstat.c ******************************************/
 
224892 /*
224893 ** 2010 July 12
224894 **
224895 ** The author disclaims copyright to this source code. In place of
224896 ** a legal notice, here is a blessing:
@@ -226516,11 +225796,10 @@
225796 SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3 *db){ return SQLITE_OK; }
225797 #endif /* SQLITE_ENABLE_DBSTAT_VTAB */
225798
225799 /************** End of dbstat.c **********************************************/
225800 /************** Begin file dbpage.c ******************************************/
 
225801 /*
225802 ** 2017-10-11
225803 **
225804 ** The author disclaims copyright to this source code. In place of
225805 ** a legal notice, here is a blessing:
@@ -226999,11 +226278,10 @@
226278 SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3 *db){ return SQLITE_OK; }
226279 #endif /* SQLITE_ENABLE_DBSTAT_VTAB */
226280
226281 /************** End of dbpage.c **********************************************/
226282 /************** Begin file sqlite3session.c **********************************/
 
226283
226284 #if defined(SQLITE_ENABLE_SESSION) && defined(SQLITE_ENABLE_PREUPDATE_HOOK)
226285 /* #include "sqlite3session.h" */
226286 /* #include <assert.h> */
226287 /* #include <string.h> */
@@ -233539,11 +232817,10 @@
232817
232818 #endif /* SQLITE_ENABLE_SESSION && SQLITE_ENABLE_PREUPDATE_HOOK */
232819
232820 /************** End of sqlite3session.c **************************************/
232821 /************** Begin file fts5.c ********************************************/
 
232822
232823 /*
232824 ** This, the "fts5.c" source file, is a composite file that is itself
232825 ** assembled from the following files:
232826 **
@@ -233577,11 +232854,10 @@
232854 /* #include <stdint.h> */
232855 #endif
232856 #ifdef HAVE_INTTYPES_H
232857 /* #include <inttypes.h> */
232858 #endif
 
232859 /*
232860 ** 2014 May 31
232861 **
232862 ** The author disclaims copyright to this source code. In place of
232863 ** a legal notice, here is a blessing:
@@ -234318,11 +233594,10 @@
233594 } /* end of the 'extern "C"' block */
233595 #endif
233596
233597 #endif /* _FTS5_H */
233598
 
233599 /*
233600 ** 2014 May 31
233601 **
233602 ** The author disclaims copyright to this source code. In place of
233603 ** a legal notice, here is a blessing:
@@ -235258,11 +234533,10 @@
234533 ** End of interface to code in fts5_unicode2.c.
234534 **************************************************************************/
234535
234536 #endif
234537
 
234538 #define FTS5_OR 1
234539 #define FTS5_AND 2
234540 #define FTS5_NOT 3
234541 #define FTS5_TERM 4
234542 #define FTS5_COLON 5
@@ -235275,11 +234549,10 @@
234549 #define FTS5_CARET 12
234550 #define FTS5_COMMA 13
234551 #define FTS5_PLUS 14
234552 #define FTS5_STAR 15
234553
 
234554 /* This file is automatically generated by Lemon from input grammar
234555 ** source file "fts5parse.y".
234556 */
234557 /*
234558 ** 2000-05-29
@@ -235304,11 +234577,10 @@
234577 **
234578 ** The following is the concatenation of all %include directives from the
234579 ** input grammar file:
234580 */
234581 /************ Begin %include sections from the grammar ************************/
 
234582
234583 /* #include "fts5Int.h" */
234584 /* #include "fts5parse.h" */
234585
234586 /*
@@ -235332,11 +234604,10 @@
234604 ** Alternative datatype for the argument to the malloc() routine passed
234605 ** into sqlite3ParserAlloc(). The default is size_t.
234606 */
234607 #define fts5YYMALLOCARGTYPE u64
234608
 
234609 /**************** End of %include directives **********************************/
234610 /* These constants specify the various numeric values for terminal symbols.
234611 ***************** Begin token definitions *************************************/
234612 #ifndef FTS5_OR
234613 #define FTS5_OR 1
@@ -235879,45 +235150,35 @@
235150 ** inside the C code.
235151 */
235152 /********* Begin destructor definitions ***************************************/
235153 case 16: /* input */
235154 {
 
235155 (void)pParse;
 
235156 }
235157 break;
235158 case 17: /* expr */
235159 case 18: /* cnearset */
235160 case 19: /* exprlist */
235161 {
 
235162 sqlite3Fts5ParseNodeFree((fts5yypminor->fts5yy24));
 
235163 }
235164 break;
235165 case 20: /* colset */
235166 case 21: /* colsetlist */
235167 {
 
235168 sqlite3_free((fts5yypminor->fts5yy11));
 
235169 }
235170 break;
235171 case 22: /* nearset */
235172 case 23: /* nearphrases */
235173 {
 
235174 sqlite3Fts5ParseNearsetFree((fts5yypminor->fts5yy46));
 
235175 }
235176 break;
235177 case 24: /* phrase */
235178 {
 
235179 sqlite3Fts5ParsePhraseFree((fts5yypminor->fts5yy53));
 
235180 }
235181 break;
235182 /********* End destructor definitions *****************************************/
235183 default: break; /* If no destructor action specified: do nothing */
235184 }
@@ -236148,14 +235409,12 @@
235409 #endif
235410 while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser);
235411 /* Here code is inserted which will execute if the parser
235412 ** stack every overflows */
235413 /******** Begin %stack_overflow code ******************************************/
 
235414
235415 sqlite3Fts5ParseError(pParse, "fts5: parser stack overflow");
 
235416 /******** End %stack_overflow code ********************************************/
235417 sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument var */
235418 sqlite3Fts5ParserCTX_STORE
235419 }
235420
@@ -236320,202 +235579,148 @@
235579 ** break;
235580 */
235581 /********** Begin reduce actions **********************************************/
235582 fts5YYMINORTYPE fts5yylhsminor;
235583 case 0: /* input ::= expr */
 
235584 { sqlite3Fts5ParseFinished(pParse, fts5yymsp[0].minor.fts5yy24); }
 
235585 break;
235586 case 1: /* colset ::= MINUS LCP colsetlist RCP */
 
235587 {
235588 fts5yymsp[-3].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11);
235589 }
 
235590 break;
235591 case 2: /* colset ::= LCP colsetlist RCP */
 
235592 { fts5yymsp[-2].minor.fts5yy11 = fts5yymsp[-1].minor.fts5yy11; }
 
235593 break;
235594 case 3: /* colset ::= STRING */
 
235595 {
235596 fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
235597 }
 
235598 fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
235599 break;
235600 case 4: /* colset ::= MINUS STRING */
 
235601 {
235602 fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
235603 fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11);
235604 }
 
235605 break;
235606 case 5: /* colsetlist ::= colsetlist STRING */
 
235607 {
235608 fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, fts5yymsp[-1].minor.fts5yy11, &fts5yymsp[0].minor.fts5yy0); }
 
235609 fts5yymsp[-1].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
235610 break;
235611 case 6: /* colsetlist ::= STRING */
 
235612 {
235613 fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
235614 }
 
235615 fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
235616 break;
235617 case 7: /* expr ::= expr AND expr */
 
235618 {
235619 fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_AND, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
235620 }
 
235621 fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
235622 break;
235623 case 8: /* expr ::= expr OR expr */
 
235624 {
235625 fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_OR, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
235626 }
 
235627 fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
235628 break;
235629 case 9: /* expr ::= expr NOT expr */
 
235630 {
235631 fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_NOT, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
235632 }
 
235633 fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
235634 break;
235635 case 10: /* expr ::= colset COLON LP expr RP */
 
235636 {
235637 sqlite3Fts5ParseSetColset(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[-4].minor.fts5yy11);
235638 fts5yylhsminor.fts5yy24 = fts5yymsp[-1].minor.fts5yy24;
235639 }
 
235640 fts5yymsp[-4].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
235641 break;
235642 case 11: /* expr ::= LP expr RP */
 
235643 {fts5yymsp[-2].minor.fts5yy24 = fts5yymsp[-1].minor.fts5yy24;}
 
235644 break;
235645 case 12: /* expr ::= exprlist */
235646 case 13: /* exprlist ::= cnearset */ fts5yytestcase(fts5yyruleno==13);
 
235647 {fts5yylhsminor.fts5yy24 = fts5yymsp[0].minor.fts5yy24;}
 
235648 fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
235649 break;
235650 case 14: /* exprlist ::= exprlist cnearset */
 
235651 {
235652 fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseImplicitAnd(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24);
235653 }
 
235654 fts5yymsp[-1].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
235655 break;
235656 case 15: /* cnearset ::= nearset */
 
235657 {
235658 fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46);
235659 }
 
235660 fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
235661 break;
235662 case 16: /* cnearset ::= colset COLON nearset */
 
235663 {
235664 fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46);
235665 sqlite3Fts5ParseSetColset(pParse, fts5yylhsminor.fts5yy24, fts5yymsp[-2].minor.fts5yy11);
235666 }
 
235667 fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
235668 break;
235669 case 17: /* nearset ::= phrase */
 
235670 { fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); }
 
235671 fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
235672 break;
235673 case 18: /* nearset ::= CARET phrase */
 
235674 {
235675 sqlite3Fts5ParseSetCaret(fts5yymsp[0].minor.fts5yy53);
235676 fts5yymsp[-1].minor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53);
235677 }
 
235678 break;
235679 case 19: /* nearset ::= STRING LP nearphrases neardist_opt RP */
 
235680 {
235681 sqlite3Fts5ParseNear(pParse, &fts5yymsp[-4].minor.fts5yy0);
235682 sqlite3Fts5ParseSetDistance(pParse, fts5yymsp[-2].minor.fts5yy46, &fts5yymsp[-1].minor.fts5yy0);
235683 fts5yylhsminor.fts5yy46 = fts5yymsp[-2].minor.fts5yy46;
235684 }
 
235685 fts5yymsp[-4].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
235686 break;
235687 case 20: /* nearphrases ::= phrase */
 
235688 {
235689 fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53);
235690 }
 
235691 fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
235692 break;
235693 case 21: /* nearphrases ::= nearphrases phrase */
 
235694 {
235695 fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, fts5yymsp[-1].minor.fts5yy46, fts5yymsp[0].minor.fts5yy53);
235696 }
 
235697 fts5yymsp[-1].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
235698 break;
235699 case 22: /* neardist_opt ::= */
 
235700 { fts5yymsp[1].minor.fts5yy0.p = 0; fts5yymsp[1].minor.fts5yy0.n = 0; }
 
235701 break;
235702 case 23: /* neardist_opt ::= COMMA STRING */
 
235703 { fts5yymsp[-1].minor.fts5yy0 = fts5yymsp[0].minor.fts5yy0; }
 
235704 break;
235705 case 24: /* phrase ::= phrase PLUS STRING star_opt */
 
235706 {
235707 fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, fts5yymsp[-3].minor.fts5yy53, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);
235708 }
 
235709 fts5yymsp[-3].minor.fts5yy53 = fts5yylhsminor.fts5yy53;
235710 break;
235711 case 25: /* phrase ::= STRING star_opt */
 
235712 {
235713 fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, 0, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);
235714 }
 
235715 fts5yymsp[-1].minor.fts5yy53 = fts5yylhsminor.fts5yy53;
235716 break;
235717 case 26: /* star_opt ::= STAR */
 
235718 { fts5yymsp[0].minor.fts5yy4 = 1; }
 
235719 break;
235720 case 27: /* star_opt ::= */
 
235721 { fts5yymsp[1].minor.fts5yy4 = 0; }
 
235722 break;
235723 default:
235724 break;
235725 /********** End reduce actions ************************************************/
235726 };
@@ -236573,17 +235778,15 @@
235778 ){
235779 sqlite3Fts5ParserARG_FETCH
235780 sqlite3Fts5ParserCTX_FETCH
235781 #define FTS5TOKEN fts5yyminor
235782 /************ Begin %syntax_error code ****************************************/
 
235783
235784 UNUSED_PARAM(fts5yymajor); /* Silence a compiler warning */
235785 sqlite3Fts5ParseError(
235786 pParse, "fts5: syntax error near \"%.*s\"",FTS5TOKEN.n,FTS5TOKEN.p
235787 );
 
235788 /************ End %syntax_error code ******************************************/
235789 sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
235790 sqlite3Fts5ParserCTX_STORE
235791 }
235792
@@ -236849,11 +236052,10 @@
236052 (void)iToken;
236053 return 0;
236054 #endif
236055 }
236056
 
236057 /*
236058 ** 2014 May 31
236059 **
236060 ** The author disclaims copyright to this source code. In place of
236061 ** a legal notice, here is a blessing:
@@ -237672,11 +236874,10 @@
236874 }
236875
236876 return rc;
236877 }
236878
 
236879 /*
236880 ** 2014 May 31
236881 **
236882 ** The author disclaims copyright to this source code. In place of
236883 ** a legal notice, here is a blessing:
@@ -238085,11 +237286,10 @@
237286 }
237287 sqlite3_free(p);
237288 }
237289 }
237290
 
237291 /*
237292 ** 2014 Jun 09
237293 **
237294 ** The author disclaims copyright to this source code. In place of
237295 ** a legal notice, here is a blessing:
@@ -239201,11 +238401,10 @@
238401 va_end(ap);
238402 }
238403
238404
238405
 
238406 /*
238407 ** 2014 May 31
238408 **
238409 ** The author disclaims copyright to this source code. In place of
238410 ** a legal notice, here is a blessing:
@@ -242470,11 +241669,10 @@
241669 sqlite3Fts5IndexIterClearTokendata(pT->pIter);
241670 }
241671 }
241672 }
241673
 
241674 /*
241675 ** 2014 August 11
241676 **
241677 ** The author disclaims copyright to this source code. In place of
241678 ** a legal notice, here is a blessing:
@@ -243062,11 +242260,10 @@
242260 *ppDoclist = 0;
242261 *pnDoclist = 0;
242262 }
242263 }
242264
 
242265 /*
242266 ** 2014 May 31
242267 **
242268 ** The author disclaims copyright to this source code. In place of
242269 ** a legal notice, here is a blessing:
@@ -252140,11 +251337,10 @@
251337 fts5StructureInvalidate(p);
251338 }
251339 return fts5IndexReturn(p);
251340 }
251341
 
251342 /*
251343 ** 2014 Jun 09
251344 **
251345 ** The author disclaims copyright to this source code. In place of
251346 ** a legal notice, here is a blessing:
@@ -252775,10 +251971,11 @@
251971 ){
251972 /* A MATCH operator or equivalent */
251973 if( p->usable==0 || iCol<0 ){
251974 /* As there exists an unusable MATCH constraint this is an
251975 ** unusable plan. Return SQLITE_CONSTRAINT. */
251976 idxStr[iIdxStr] = 0;
251977 return SQLITE_CONSTRAINT;
251978 }else{
251979 if( iCol==nCol+1 ){
251980 if( bSeenRank ) continue;
251981 idxStr[iIdxStr++] = 'r';
@@ -255730,11 +254927,11 @@
254927 int nArg, /* Number of args */
254928 sqlite3_value **apUnused /* Function arguments */
254929 ){
254930 assert( nArg==0 );
254931 UNUSED_PARAM2(nArg, apUnused);
254932 sqlite3_result_text(pCtx, "fts5: 2024-11-14 19:34:28 81202d2ab5963fdcf20555b6d0b31cc955ac27f1cd87656faea5c0611c9a2ee8", -1, SQLITE_TRANSIENT);
254933 }
254934
254935 /*
254936 ** Implementation of fts5_locale(LOCALE, TEXT) function.
254937 **
@@ -255983,11 +255180,10 @@
255180 SQLITE_PRIVATE int sqlite3Fts5Init(sqlite3 *db){
255181 return fts5Init(db);
255182 }
255183 #endif
255184
 
255185 /*
255186 ** 2014 May 31
255187 **
255188 ** The author disclaims copyright to this source code. In place of
255189 ** a legal notice, here is a blessing:
@@ -257497,11 +256693,10 @@
256693 }
256694 }
256695 return rc;
256696 }
256697
 
256698 /*
256699 ** 2014 May 31
256700 **
256701 ** The author disclaims copyright to this source code. In place of
256702 ** a legal notice, here is a blessing:
@@ -258854,21 +258049,21 @@
258049 char aBuf[32];
258050 char *zOut = aBuf;
258051 int ii;
258052 const unsigned char *zIn = (const unsigned char*)pText;
258053 const unsigned char *zEof = &zIn[nText];
258054 u32 iCode = 0;
258055 int aStart[3]; /* Input offset of each character in aBuf[] */
258056
258057 UNUSED_PARAM(unusedFlags);
258058
258059 /* Populate aBuf[] with the characters for the first trigram. */
258060 for(ii=0; ii<3; ii++){
258061 do {
258062 aStart[ii] = zIn - (const unsigned char*)pText;
258063 if( zIn>=zEof ) return SQLITE_OK;
258064 READ_UTF8(zIn, zEof, iCode);
 
258065 if( p->bFold ) iCode = sqlite3Fts5UnicodeFold(iCode, p->iFoldParam);
258066 }while( iCode==0 );
258067 WRITE_UTF8(zOut, iCode);
258068 }
258069
@@ -258885,12 +258080,15 @@
258080 const char *z1;
258081
258082 /* Read characters from the input up until the first non-diacritic */
258083 do {
258084 iNext = zIn - (const unsigned char*)pText;
258085 if( zIn>=zEof ){
258086 iCode = 0;
258087 break;
258088 }
258089 READ_UTF8(zIn, zEof, iCode);
 
258090 if( p->bFold ) iCode = sqlite3Fts5UnicodeFold(iCode, p->iFoldParam);
258091 }while( iCode==0 );
258092
258093 /* Pass the current trigram back to fts5 */
258094 rc = xToken(pCtx, 0, aBuf, zOut-aBuf, aStart[0], iNext);
@@ -258986,11 +258184,10 @@
258184 );
258185 }
258186 return rc;
258187 }
258188
 
258189 /*
258190 ** 2012-05-25
258191 **
258192 ** The author disclaims copyright to this source code. In place of
258193 ** a legal notice, here is a blessing:
@@ -259769,11 +258966,10 @@
258966 }
258967 aAscii[0] = 0; /* 0x00 is never a token character */
258968 }
258969
258970
 
258971 /*
258972 ** 2015 May 30
258973 **
258974 ** The author disclaims copyright to this source code. In place of
258975 ** a legal notice, here is a blessing:
@@ -260115,11 +259311,10 @@
259311 if( iVal<(1 << 21) ) return 3;
259312 if( iVal<(1 << 28) ) return 4;
259313 return 5;
259314 }
259315
 
259316 /*
259317 ** 2015 May 08
259318 **
259319 ** The author disclaims copyright to this source code. In place of
259320 ** a legal notice, here is a blessing:
@@ -260931,11 +260126,10 @@
260126 /* Here ends the fts5.c composite file. */
260127 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS5) */
260128
260129 /************** End of fts5.c ************************************************/
260130 /************** Begin file stmt.c ********************************************/
 
260131 /*
260132 ** 2017-05-31
260133 **
260134 ** The author disclaims copyright to this source code. In place of
260135 ** a legal notice, here is a blessing:
260136
+12 -2
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149149
#define SQLITE_VERSION "3.48.0"
150150
#define SQLITE_VERSION_NUMBER 3048000
151
-#define SQLITE_SOURCE_ID "2024-11-06 12:58:31 5495b12569c318d5020b4b5a625a392ef8e777b81c0200624fbbc2a6b5eddef9"
151
+#define SQLITE_SOURCE_ID "2024-11-14 19:34:28 81202d2ab5963fdcf20555b6d0b31cc955ac27f1cd87656faea5c0611c9a2ee8"
152152
153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
155155
** KEYWORDS: sqlite3_version sqlite3_sourceid
156156
**
@@ -1098,10 +1098,15 @@
10981098
** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This
10991099
** opcode causes the xFileControl method to swap the file handle with the one
11001100
** pointed to by the pArg argument. This capability is used during testing
11011101
** and only needs to be supported when SQLITE_TEST is defined.
11021102
**
1103
+** <li>[[SQLITE_FCNTL_NULL_IO]]
1104
+** The [SQLITE_FCNTL_NULL_IO] opcode sets the low-level file descriptor
1105
+** or file handle for the [sqlite3_file] object such that it will no longer
1106
+** read or write to the database file.
1107
+**
11031108
** <li>[[SQLITE_FCNTL_WAL_BLOCK]]
11041109
** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
11051110
** be advantageous to block on the next WAL lock if the lock is not immediately
11061111
** available. The WAL subsystem issues this signal during rare
11071112
** circumstances in order to fix a problem with priority inversion.
@@ -1251,10 +1256,11 @@
12511256
#define SQLITE_FCNTL_RESERVE_BYTES 38
12521257
#define SQLITE_FCNTL_CKPT_START 39
12531258
#define SQLITE_FCNTL_EXTERNAL_READER 40
12541259
#define SQLITE_FCNTL_CKSM_FILE 41
12551260
#define SQLITE_FCNTL_RESET_CACHE 42
1261
+#define SQLITE_FCNTL_NULL_IO 43
12561262
12571263
/* deprecated names */
12581264
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
12591265
#define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
12601266
#define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
@@ -2629,14 +2635,18 @@
26292635
**
26302636
** ^These functions return the number of rows modified, inserted or
26312637
** deleted by the most recently completed INSERT, UPDATE or DELETE
26322638
** statement on the database connection specified by the only parameter.
26332639
** The two functions are identical except for the type of the return value
2634
-** and that if the number of rows modified by the most recent INSERT, UPDATE
2640
+** and that if the number of rows modified by the most recent INSERT, UPDATE,
26352641
** or DELETE is greater than the maximum value supported by type "int", then
26362642
** the return value of sqlite3_changes() is undefined. ^Executing any other
26372643
** type of SQL statement does not modify the value returned by these functions.
2644
+** For the purposes of this interface, a CREATE TABLE AS SELECT statement
2645
+** does not count as an INSERT, UPDATE or DELETE statement and hence the rows
2646
+** added to the new table by the CREATE TABLE AS SELECT statement are not
2647
+** counted.
26382648
**
26392649
** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
26402650
** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
26412651
** [foreign key actions] or [REPLACE] constraint resolution are not counted.
26422652
**
26432653
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.48.0"
150 #define SQLITE_VERSION_NUMBER 3048000
151 #define SQLITE_SOURCE_ID "2024-11-06 12:58:31 5495b12569c318d5020b4b5a625a392ef8e777b81c0200624fbbc2a6b5eddef9"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -1098,10 +1098,15 @@
1098 ** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This
1099 ** opcode causes the xFileControl method to swap the file handle with the one
1100 ** pointed to by the pArg argument. This capability is used during testing
1101 ** and only needs to be supported when SQLITE_TEST is defined.
1102 **
 
 
 
 
 
1103 ** <li>[[SQLITE_FCNTL_WAL_BLOCK]]
1104 ** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
1105 ** be advantageous to block on the next WAL lock if the lock is not immediately
1106 ** available. The WAL subsystem issues this signal during rare
1107 ** circumstances in order to fix a problem with priority inversion.
@@ -1251,10 +1256,11 @@
1251 #define SQLITE_FCNTL_RESERVE_BYTES 38
1252 #define SQLITE_FCNTL_CKPT_START 39
1253 #define SQLITE_FCNTL_EXTERNAL_READER 40
1254 #define SQLITE_FCNTL_CKSM_FILE 41
1255 #define SQLITE_FCNTL_RESET_CACHE 42
 
1256
1257 /* deprecated names */
1258 #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
1259 #define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
1260 #define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
@@ -2629,14 +2635,18 @@
2629 **
2630 ** ^These functions return the number of rows modified, inserted or
2631 ** deleted by the most recently completed INSERT, UPDATE or DELETE
2632 ** statement on the database connection specified by the only parameter.
2633 ** The two functions are identical except for the type of the return value
2634 ** and that if the number of rows modified by the most recent INSERT, UPDATE
2635 ** or DELETE is greater than the maximum value supported by type "int", then
2636 ** the return value of sqlite3_changes() is undefined. ^Executing any other
2637 ** type of SQL statement does not modify the value returned by these functions.
 
 
 
 
2638 **
2639 ** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
2640 ** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
2641 ** [foreign key actions] or [REPLACE] constraint resolution are not counted.
2642 **
2643
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.48.0"
150 #define SQLITE_VERSION_NUMBER 3048000
151 #define SQLITE_SOURCE_ID "2024-11-14 19:34:28 81202d2ab5963fdcf20555b6d0b31cc955ac27f1cd87656faea5c0611c9a2ee8"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -1098,10 +1098,15 @@
1098 ** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This
1099 ** opcode causes the xFileControl method to swap the file handle with the one
1100 ** pointed to by the pArg argument. This capability is used during testing
1101 ** and only needs to be supported when SQLITE_TEST is defined.
1102 **
1103 ** <li>[[SQLITE_FCNTL_NULL_IO]]
1104 ** The [SQLITE_FCNTL_NULL_IO] opcode sets the low-level file descriptor
1105 ** or file handle for the [sqlite3_file] object such that it will no longer
1106 ** read or write to the database file.
1107 **
1108 ** <li>[[SQLITE_FCNTL_WAL_BLOCK]]
1109 ** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
1110 ** be advantageous to block on the next WAL lock if the lock is not immediately
1111 ** available. The WAL subsystem issues this signal during rare
1112 ** circumstances in order to fix a problem with priority inversion.
@@ -1251,10 +1256,11 @@
1256 #define SQLITE_FCNTL_RESERVE_BYTES 38
1257 #define SQLITE_FCNTL_CKPT_START 39
1258 #define SQLITE_FCNTL_EXTERNAL_READER 40
1259 #define SQLITE_FCNTL_CKSM_FILE 41
1260 #define SQLITE_FCNTL_RESET_CACHE 42
1261 #define SQLITE_FCNTL_NULL_IO 43
1262
1263 /* deprecated names */
1264 #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
1265 #define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
1266 #define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
@@ -2629,14 +2635,18 @@
2635 **
2636 ** ^These functions return the number of rows modified, inserted or
2637 ** deleted by the most recently completed INSERT, UPDATE or DELETE
2638 ** statement on the database connection specified by the only parameter.
2639 ** The two functions are identical except for the type of the return value
2640 ** and that if the number of rows modified by the most recent INSERT, UPDATE,
2641 ** or DELETE is greater than the maximum value supported by type "int", then
2642 ** the return value of sqlite3_changes() is undefined. ^Executing any other
2643 ** type of SQL statement does not modify the value returned by these functions.
2644 ** For the purposes of this interface, a CREATE TABLE AS SELECT statement
2645 ** does not count as an INSERT, UPDATE or DELETE statement and hence the rows
2646 ** added to the new table by the CREATE TABLE AS SELECT statement are not
2647 ** counted.
2648 **
2649 ** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
2650 ** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
2651 ** [foreign key actions] or [REPLACE] constraint resolution are not counted.
2652 **
2653
+23 -6
--- src/allrepo.c
+++ src/allrepo.c
@@ -50,11 +50,10 @@
5050
for(i=iStart; i<g.argc; i++){
5151
blob_appendf(pExtra, " %s", g.argv[i]);
5252
}
5353
}
5454
55
-
5655
/*
5756
** COMMAND: all
5857
**
5958
** Usage: %fossil all SUBCOMMAND ...
6059
**
@@ -429,44 +428,62 @@
429428
"add cache changes clean dbstat extras fts-config git ignore "
430429
"info list ls pull push rebuild remote "
431430
"server settings sync ui unset whatis");
432431
}
433432
verify_all_options();
434
- db_multi_exec("CREATE TEMP TABLE repolist(name,tag);");
433
+ db_multi_exec(
434
+ "CREATE TEMP TABLE repolist(\n"
435
+ " name TEXT, -- Filename\n"
436
+ " tag TEXT, -- Key for the GLOBAL_CONFIG table entry\n"
437
+ " inode TEXT -- Unique identifier for this file\n"
438
+ ");\n"
439
+
440
+ /* The seenFile() table holds inode names for entries that have
441
+ ** already been processed. */
442
+ "CREATE TEMP TABLE seenFile(x TEXT COLLATE nocase);\n"
443
+
444
+ /* The toDel() table holds the "tag" for entries that need to be
445
+ ** deleted because they are redundant or no longer exist */
446
+ "CREATE TEMP TABLE toDel(x TEXT);\n"
447
+ );
448
+ sqlite3_create_function(g.db, "inode", 1, SQLITE_UTF8, 0,
449
+ file_inode_sql_func, 0, 0);
435450
if( useCheckouts ){
436451
db_multi_exec(
437452
"INSERT INTO repolist "
438
- "SELECT DISTINCT substr(name, 7), name COLLATE nocase"
453
+ "SELECT substr(name, 7), name, inode(substr(name,7))"
439454
" FROM global_config"
440455
" WHERE substr(name, 1, 6)=='ckout:'"
441456
" ORDER BY 1"
442457
);
443458
}else{
444459
db_multi_exec(
445460
"INSERT INTO repolist "
446
- "SELECT DISTINCT substr(name, 6), name COLLATE nocase"
461
+ "SELECT substr(name, 6), name, inode(substr(name,6))"
447462
" FROM global_config"
448463
" WHERE substr(name, 1, 5)=='repo:'"
449464
" ORDER BY 1"
450465
);
451466
}
452
- db_multi_exec("CREATE TEMP TABLE toDel(x TEXT)");
453
- db_prepare(&q, "SELECT name, tag FROM repolist ORDER BY 1");
467
+ db_prepare(&q,"SELECT name, tag, inode FROM repolist ORDER BY 1");
454468
while( db_step(&q)==SQLITE_ROW ){
455469
int rc;
456470
const char *zFilename = db_column_text(&q, 0);
471
+ const char *zInode = db_column_text(&q,2);
457472
#if !USE_SEE
458473
if( sqlite3_strglob("*.efossil", zFilename)==0 ) continue;
459474
#endif
460475
if( file_access(zFilename, F_OK)
461476
|| !file_is_canonical(zFilename)
462477
|| (useCheckouts && file_isdir(zFilename, ExtFILE)!=1)
478
+ || db_exists("SELECT 1 FROM temp.seenFile where x=%Q", zInode)
463479
){
464480
db_multi_exec("INSERT INTO toDel VALUES(%Q)", db_column_text(&q, 1));
465481
nToDel++;
466482
continue;
467483
}
484
+ db_multi_exec("INSERT INTO seenFile(x) VALUES(%Q)", zInode);
468485
if( zCmd[0]=='l' ){
469486
fossil_print("%s\n", zFilename);
470487
continue;
471488
}else if( showFile ){
472489
fossil_print("%s: %s\n", useCheckouts ? "check-out" : "repository",
473490
--- src/allrepo.c
+++ src/allrepo.c
@@ -50,11 +50,10 @@
50 for(i=iStart; i<g.argc; i++){
51 blob_appendf(pExtra, " %s", g.argv[i]);
52 }
53 }
54
55
56 /*
57 ** COMMAND: all
58 **
59 ** Usage: %fossil all SUBCOMMAND ...
60 **
@@ -429,44 +428,62 @@
429 "add cache changes clean dbstat extras fts-config git ignore "
430 "info list ls pull push rebuild remote "
431 "server settings sync ui unset whatis");
432 }
433 verify_all_options();
434 db_multi_exec("CREATE TEMP TABLE repolist(name,tag);");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
435 if( useCheckouts ){
436 db_multi_exec(
437 "INSERT INTO repolist "
438 "SELECT DISTINCT substr(name, 7), name COLLATE nocase"
439 " FROM global_config"
440 " WHERE substr(name, 1, 6)=='ckout:'"
441 " ORDER BY 1"
442 );
443 }else{
444 db_multi_exec(
445 "INSERT INTO repolist "
446 "SELECT DISTINCT substr(name, 6), name COLLATE nocase"
447 " FROM global_config"
448 " WHERE substr(name, 1, 5)=='repo:'"
449 " ORDER BY 1"
450 );
451 }
452 db_multi_exec("CREATE TEMP TABLE toDel(x TEXT)");
453 db_prepare(&q, "SELECT name, tag FROM repolist ORDER BY 1");
454 while( db_step(&q)==SQLITE_ROW ){
455 int rc;
456 const char *zFilename = db_column_text(&q, 0);
 
457 #if !USE_SEE
458 if( sqlite3_strglob("*.efossil", zFilename)==0 ) continue;
459 #endif
460 if( file_access(zFilename, F_OK)
461 || !file_is_canonical(zFilename)
462 || (useCheckouts && file_isdir(zFilename, ExtFILE)!=1)
 
463 ){
464 db_multi_exec("INSERT INTO toDel VALUES(%Q)", db_column_text(&q, 1));
465 nToDel++;
466 continue;
467 }
 
468 if( zCmd[0]=='l' ){
469 fossil_print("%s\n", zFilename);
470 continue;
471 }else if( showFile ){
472 fossil_print("%s: %s\n", useCheckouts ? "check-out" : "repository",
473
--- src/allrepo.c
+++ src/allrepo.c
@@ -50,11 +50,10 @@
50 for(i=iStart; i<g.argc; i++){
51 blob_appendf(pExtra, " %s", g.argv[i]);
52 }
53 }
54
 
55 /*
56 ** COMMAND: all
57 **
58 ** Usage: %fossil all SUBCOMMAND ...
59 **
@@ -429,44 +428,62 @@
428 "add cache changes clean dbstat extras fts-config git ignore "
429 "info list ls pull push rebuild remote "
430 "server settings sync ui unset whatis");
431 }
432 verify_all_options();
433 db_multi_exec(
434 "CREATE TEMP TABLE repolist(\n"
435 " name TEXT, -- Filename\n"
436 " tag TEXT, -- Key for the GLOBAL_CONFIG table entry\n"
437 " inode TEXT -- Unique identifier for this file\n"
438 ");\n"
439
440 /* The seenFile() table holds inode names for entries that have
441 ** already been processed. */
442 "CREATE TEMP TABLE seenFile(x TEXT COLLATE nocase);\n"
443
444 /* The toDel() table holds the "tag" for entries that need to be
445 ** deleted because they are redundant or no longer exist */
446 "CREATE TEMP TABLE toDel(x TEXT);\n"
447 );
448 sqlite3_create_function(g.db, "inode", 1, SQLITE_UTF8, 0,
449 file_inode_sql_func, 0, 0);
450 if( useCheckouts ){
451 db_multi_exec(
452 "INSERT INTO repolist "
453 "SELECT substr(name, 7), name, inode(substr(name,7))"
454 " FROM global_config"
455 " WHERE substr(name, 1, 6)=='ckout:'"
456 " ORDER BY 1"
457 );
458 }else{
459 db_multi_exec(
460 "INSERT INTO repolist "
461 "SELECT substr(name, 6), name, inode(substr(name,6))"
462 " FROM global_config"
463 " WHERE substr(name, 1, 5)=='repo:'"
464 " ORDER BY 1"
465 );
466 }
467 db_prepare(&q,"SELECT name, tag, inode FROM repolist ORDER BY 1");
 
468 while( db_step(&q)==SQLITE_ROW ){
469 int rc;
470 const char *zFilename = db_column_text(&q, 0);
471 const char *zInode = db_column_text(&q,2);
472 #if !USE_SEE
473 if( sqlite3_strglob("*.efossil", zFilename)==0 ) continue;
474 #endif
475 if( file_access(zFilename, F_OK)
476 || !file_is_canonical(zFilename)
477 || (useCheckouts && file_isdir(zFilename, ExtFILE)!=1)
478 || db_exists("SELECT 1 FROM temp.seenFile where x=%Q", zInode)
479 ){
480 db_multi_exec("INSERT INTO toDel VALUES(%Q)", db_column_text(&q, 1));
481 nToDel++;
482 continue;
483 }
484 db_multi_exec("INSERT INTO seenFile(x) VALUES(%Q)", zInode);
485 if( zCmd[0]=='l' ){
486 fossil_print("%s\n", zFilename);
487 continue;
488 }else if( showFile ){
489 fossil_print("%s: %s\n", useCheckouts ? "check-out" : "repository",
490
+8 -1
--- src/attach.c
+++ src/attach.c
@@ -634,11 +634,12 @@
634634
/*
635635
** Output HTML to show a list of attachments.
636636
*/
637637
void attachment_list(
638638
const char *zTarget, /* Object that things are attached to */
639
- const char *zHeader /* Header to display with attachments */
639
+ const char *zHeader, /* Header to display with attachments */
640
+ int fHorizontalRule /* Insert <hr> separator above header */
640641
){
641642
int cnt = 0;
642643
Stmt q;
643644
db_prepare(&q,
644645
"SELECT datetime(mtime,toLocal()), filename, user,"
@@ -654,11 +655,16 @@
654655
const char *zUser = db_column_text(&q, 2);
655656
const char *zUuid = db_column_text(&q, 3);
656657
const char *zSrc = db_column_text(&q, 4);
657658
const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous";
658659
if( cnt==0 ){
660
+ @ <section class='attachlist'>
661
+ if( fHorizontalRule ){
662
+ @ <hr>
663
+ }
659664
@ %s(zHeader)
665
+ @ <ul>
660666
}
661667
cnt++;
662668
@ <li>
663669
@ %z(href("%R/artifact/%!S",zSrc))%h(zFile)</a>
664670
@ [<a href="%R/attachdownload/%t(zFile)?page=%t(zTarget)&file=%t(zFile)">download</a>]
@@ -667,10 +673,11 @@
667673
@ [%z(href("%R/ainfo/%!S",zUuid))details</a>]
668674
@ </li>
669675
}
670676
if( cnt ){
671677
@ </ul>
678
+ @ </section>
672679
}
673680
db_finalize(&q);
674681
675682
}
676683
677684
--- src/attach.c
+++ src/attach.c
@@ -634,11 +634,12 @@
634 /*
635 ** Output HTML to show a list of attachments.
636 */
637 void attachment_list(
638 const char *zTarget, /* Object that things are attached to */
639 const char *zHeader /* Header to display with attachments */
 
640 ){
641 int cnt = 0;
642 Stmt q;
643 db_prepare(&q,
644 "SELECT datetime(mtime,toLocal()), filename, user,"
@@ -654,11 +655,16 @@
654 const char *zUser = db_column_text(&q, 2);
655 const char *zUuid = db_column_text(&q, 3);
656 const char *zSrc = db_column_text(&q, 4);
657 const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous";
658 if( cnt==0 ){
 
 
 
 
659 @ %s(zHeader)
 
660 }
661 cnt++;
662 @ <li>
663 @ %z(href("%R/artifact/%!S",zSrc))%h(zFile)</a>
664 @ [<a href="%R/attachdownload/%t(zFile)?page=%t(zTarget)&file=%t(zFile)">download</a>]
@@ -667,10 +673,11 @@
667 @ [%z(href("%R/ainfo/%!S",zUuid))details</a>]
668 @ </li>
669 }
670 if( cnt ){
671 @ </ul>
 
672 }
673 db_finalize(&q);
674
675 }
676
677
--- src/attach.c
+++ src/attach.c
@@ -634,11 +634,12 @@
634 /*
635 ** Output HTML to show a list of attachments.
636 */
637 void attachment_list(
638 const char *zTarget, /* Object that things are attached to */
639 const char *zHeader, /* Header to display with attachments */
640 int fHorizontalRule /* Insert <hr> separator above header */
641 ){
642 int cnt = 0;
643 Stmt q;
644 db_prepare(&q,
645 "SELECT datetime(mtime,toLocal()), filename, user,"
@@ -654,11 +655,16 @@
655 const char *zUser = db_column_text(&q, 2);
656 const char *zUuid = db_column_text(&q, 3);
657 const char *zSrc = db_column_text(&q, 4);
658 const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous";
659 if( cnt==0 ){
660 @ <section class='attachlist'>
661 if( fHorizontalRule ){
662 @ <hr>
663 }
664 @ %s(zHeader)
665 @ <ul>
666 }
667 cnt++;
668 @ <li>
669 @ %z(href("%R/artifact/%!S",zSrc))%h(zFile)</a>
670 @ [<a href="%R/attachdownload/%t(zFile)?page=%t(zTarget)&file=%t(zFile)">download</a>]
@@ -667,10 +673,11 @@
673 @ [%z(href("%R/ainfo/%!S",zUuid))details</a>]
674 @ </li>
675 }
676 if( cnt ){
677 @ </ul>
678 @ </section>
679 }
680 db_finalize(&q);
681
682 }
683
684
+49 -1
--- src/blob.c
+++ src/blob.c
@@ -665,11 +665,12 @@
665665
pBlob->nUsed = dehttpize(pBlob->aData);
666666
}
667667
668668
/*
669669
** Extract N bytes from blob pFrom and use it to initialize blob pTo.
670
-** Return the actual number of bytes extracted.
670
+** Return the actual number of bytes extracted. The cursor position
671
+** is advanced by the number of bytes extracted.
671672
**
672673
** After this call completes, pTo will be an ephemeral blob.
673674
*/
674675
int blob_extract(Blob *pFrom, int N, Blob *pTo){
675676
blob_is_init(pFrom);
@@ -687,10 +688,57 @@
687688
pTo->iCursor = 0;
688689
pTo->xRealloc = blobReallocStatic;
689690
pFrom->iCursor += N;
690691
return N;
691692
}
693
+
694
+/*
695
+** Extract N **lines** of text from blob pFrom beginning at the current
696
+** cursor position and use that text to initialize blob pTo. Unlike the
697
+** blob_extract() routine, the cursor position is unchanged.
698
+**
699
+** pTo is assumed to be uninitialized.
700
+**
701
+** After this call completes, pTo will be an ephemeral blob.
702
+*/
703
+int blob_extract_lines(Blob *pFrom, int N, Blob *pTo){
704
+ int i;
705
+ int mx;
706
+ int iStart;
707
+ int n;
708
+ const char *z;
709
+
710
+ blob_zero(pTo);
711
+ z = pFrom->aData;
712
+ i = pFrom->iCursor;
713
+ mx = pFrom->nUsed;
714
+ while( N>0 ){
715
+ while( i<mx && z[i]!='\n' ){ i++; }
716
+ if( i>=mx ) break;
717
+ i++;
718
+ N--;
719
+ }
720
+ iStart = pFrom->iCursor;
721
+ n = blob_extract(pFrom, i-pFrom->iCursor, pTo);
722
+ pFrom->iCursor = iStart;
723
+ return n;
724
+}
725
+
726
+/*
727
+** Return the number of lines of text in the blob. If the last
728
+** line is incomplete (if it does not have a \n at the end) then
729
+** it still counts.
730
+*/
731
+int blob_linecount(Blob *p){
732
+ int n = 0;
733
+ int i;
734
+ for(i=0; i<p->nUsed; i++){
735
+ if( p->aData[i]=='\n' ) n++;
736
+ }
737
+ if( p->nUsed>0 && p->aData[p->nUsed-1]!='\n' ) n++;
738
+ return n;
739
+}
692740
693741
/*
694742
** Rewind the cursor on a blob back to the beginning.
695743
*/
696744
void blob_rewind(Blob *p){
697745
--- src/blob.c
+++ src/blob.c
@@ -665,11 +665,12 @@
665 pBlob->nUsed = dehttpize(pBlob->aData);
666 }
667
668 /*
669 ** Extract N bytes from blob pFrom and use it to initialize blob pTo.
670 ** Return the actual number of bytes extracted.
 
671 **
672 ** After this call completes, pTo will be an ephemeral blob.
673 */
674 int blob_extract(Blob *pFrom, int N, Blob *pTo){
675 blob_is_init(pFrom);
@@ -687,10 +688,57 @@
687 pTo->iCursor = 0;
688 pTo->xRealloc = blobReallocStatic;
689 pFrom->iCursor += N;
690 return N;
691 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
692
693 /*
694 ** Rewind the cursor on a blob back to the beginning.
695 */
696 void blob_rewind(Blob *p){
697
--- src/blob.c
+++ src/blob.c
@@ -665,11 +665,12 @@
665 pBlob->nUsed = dehttpize(pBlob->aData);
666 }
667
668 /*
669 ** Extract N bytes from blob pFrom and use it to initialize blob pTo.
670 ** Return the actual number of bytes extracted. The cursor position
671 ** is advanced by the number of bytes extracted.
672 **
673 ** After this call completes, pTo will be an ephemeral blob.
674 */
675 int blob_extract(Blob *pFrom, int N, Blob *pTo){
676 blob_is_init(pFrom);
@@ -687,10 +688,57 @@
688 pTo->iCursor = 0;
689 pTo->xRealloc = blobReallocStatic;
690 pFrom->iCursor += N;
691 return N;
692 }
693
694 /*
695 ** Extract N **lines** of text from blob pFrom beginning at the current
696 ** cursor position and use that text to initialize blob pTo. Unlike the
697 ** blob_extract() routine, the cursor position is unchanged.
698 **
699 ** pTo is assumed to be uninitialized.
700 **
701 ** After this call completes, pTo will be an ephemeral blob.
702 */
703 int blob_extract_lines(Blob *pFrom, int N, Blob *pTo){
704 int i;
705 int mx;
706 int iStart;
707 int n;
708 const char *z;
709
710 blob_zero(pTo);
711 z = pFrom->aData;
712 i = pFrom->iCursor;
713 mx = pFrom->nUsed;
714 while( N>0 ){
715 while( i<mx && z[i]!='\n' ){ i++; }
716 if( i>=mx ) break;
717 i++;
718 N--;
719 }
720 iStart = pFrom->iCursor;
721 n = blob_extract(pFrom, i-pFrom->iCursor, pTo);
722 pFrom->iCursor = iStart;
723 return n;
724 }
725
726 /*
727 ** Return the number of lines of text in the blob. If the last
728 ** line is incomplete (if it does not have a \n at the end) then
729 ** it still counts.
730 */
731 int blob_linecount(Blob *p){
732 int n = 0;
733 int i;
734 for(i=0; i<p->nUsed; i++){
735 if( p->aData[i]=='\n' ) n++;
736 }
737 if( p->nUsed>0 && p->aData[p->nUsed-1]!='\n' ) n++;
738 return n;
739 }
740
741 /*
742 ** Rewind the cursor on a blob back to the beginning.
743 */
744 void blob_rewind(Blob *p){
745
+1 -1
--- src/chat.c
+++ src/chat.c
@@ -1202,11 +1202,11 @@
12021202
**
12031203
** --all Download all chat content. Normally only
12041204
** previously undownloaded content is retrieved.
12051205
** --debug Additional debugging output
12061206
** --out DATABASE Store CHAT table in separate database file
1207
-** DATABASE rather that adding to local clone
1207
+** DATABASE rather than adding to local clone
12081208
** --unsafe Allow the use of unencrypted http://
12091209
**
12101210
** > fossil chat send [ARGUMENTS]
12111211
**
12121212
** This command sends a new message to the chatroom. The message
12131213
--- src/chat.c
+++ src/chat.c
@@ -1202,11 +1202,11 @@
1202 **
1203 ** --all Download all chat content. Normally only
1204 ** previously undownloaded content is retrieved.
1205 ** --debug Additional debugging output
1206 ** --out DATABASE Store CHAT table in separate database file
1207 ** DATABASE rather that adding to local clone
1208 ** --unsafe Allow the use of unencrypted http://
1209 **
1210 ** > fossil chat send [ARGUMENTS]
1211 **
1212 ** This command sends a new message to the chatroom. The message
1213
--- src/chat.c
+++ src/chat.c
@@ -1202,11 +1202,11 @@
1202 **
1203 ** --all Download all chat content. Normally only
1204 ** previously undownloaded content is retrieved.
1205 ** --debug Additional debugging output
1206 ** --out DATABASE Store CHAT table in separate database file
1207 ** DATABASE rather than adding to local clone
1208 ** --unsafe Allow the use of unencrypted http://
1209 **
1210 ** > fossil chat send [ARGUMENTS]
1211 **
1212 ** This command sends a new message to the chatroom. The message
1213
+73 -12
--- src/checkin.c
+++ src/checkin.c
@@ -567,11 +567,11 @@
567567
}
568568
569569
/* Confirm current working directory is within check-out. */
570570
db_must_be_within_tree();
571571
572
- /* Get check-out version. l*/
572
+ /* Get check-out version. */
573573
vid = db_lget_int("checkout", 0);
574574
575575
/* Relative path flag determination is done by a shared function. */
576576
if( determine_cwd_relative_option() ){
577577
flags |= C_RELPATH;
@@ -2318,11 +2318,11 @@
23182318
**
23192319
** A check-in is not permitted to fork unless the --allow-fork option
23202320
** appears. An empty check-in (i.e. with nothing changed) is not
23212321
** allowed unless the --allow-empty option appears. A check-in may not
23222322
** be older than its ancestor unless the --allow-older option appears.
2323
-** If any of files in the check-in appear to contain unresolved merge
2323
+** If any files in the check-in appear to contain unresolved merge
23242324
** conflicts, the check-in will not be allowed unless the
23252325
** --allow-conflict option is present. In addition, the entire
23262326
** check-in process may be aborted if a file contains content that
23272327
** appears to be binary, Unicode text, or text with CR/LF line endings
23282328
** unless the interactive user chooses to proceed. If there is no
@@ -2358,11 +2358,11 @@
23582358
** than relying on file mtimes
23592359
** --ignore-clock-skew If a clock skew is detected, ignore it and
23602360
** behave as if the user had entered 'yes' to
23612361
** the question of whether to proceed despite
23622362
** the skew.
2363
-** --ignore-oversize Do not warning the user about oversized files
2363
+** --ignore-oversize Do not warn the user about oversized files
23642364
** --integrate Close all merged-in branches
23652365
** -m|--comment COMMENT-TEXT Use COMMENT-TEXT as commit comment
23662366
** -M|--message-file FILE Read the commit comment from given file
23672367
** --mimetype MIMETYPE Mimetype of check-in comment
23682368
** -n|--dry-run If given, display instead of run actions
@@ -2434,10 +2434,12 @@
24342434
Blob ans; /* Answer to continuation prompts */
24352435
char cReply; /* First character of ans */
24362436
int bRecheck = 0; /* Repeat fork and closed-branch checks*/
24372437
int bIgnoreSkew = 0; /* --ignore-clock-skew flag */
24382438
int mxSize;
2439
+ char *zCurBranch = 0; /* The current branch name of checkout */
2440
+ char *zNewBranch = 0; /* The branch name after update */
24392441
24402442
memset(&sCiInfo, 0, sizeof(sCiInfo));
24412443
url_proxy_options();
24422444
/* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
24432445
useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
@@ -2508,10 +2510,55 @@
25082510
}
25092511
}else{
25102512
privateParent = content_is_private(vid);
25112513
}
25122514
2515
+ user_select();
2516
+ /*
2517
+ ** Check that the user exists.
2518
+ */
2519
+ if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){
2520
+ fossil_fatal("no such user: %s", g.zLogin);
2521
+ }
2522
+
2523
+ /*
2524
+ ** Detect if the branch name has changed from the parent check-in
2525
+ ** and prompt if necessary
2526
+ **/
2527
+ zCurBranch = db_text(0,
2528
+ " SELECT value FROM tagxref AS tx"
2529
+ " WHERE rid=(SELECT pid"
2530
+ " FROM tagxref LEFT JOIN event ON srcid=objid"
2531
+ " LEFT JOIN plink ON rid=cid"
2532
+ " WHERE rid=%d AND tagxref.tagid=%d"
2533
+ " AND srcid!=origid"
2534
+ " AND tagtype=2 AND coalesce(euser,user)!=%Q)"
2535
+ " AND tx.tagid=%d",
2536
+ vid, TAG_BRANCH, g.zLogin, TAG_BRANCH
2537
+ );
2538
+ if( zCurBranch!=0 && zCurBranch[0]!=0
2539
+ && forceFlag==0
2540
+ && noPrompt==0
2541
+ ){
2542
+ zNewBranch = branch_of_rid(vid);
2543
+ fossil_warning(
2544
+ "WARNING: The parent check-in [%.10s] has been moved from branch\n"
2545
+ " '%s' over to branch '%s'.",
2546
+ rid_to_uuid(vid), zCurBranch, zNewBranch
2547
+ );
2548
+ prompt_user("Commit anyway? (y/N) ", &ans);
2549
+ cReply = blob_str(&ans)[0];
2550
+ blob_reset(&ans);
2551
+ if( cReply!='y' && cReply!='Y' ){
2552
+ fossil_fatal("Abandoning commit because branch has changed");
2553
+ }
2554
+ fossil_free(zNewBranch);
2555
+ fossil_free(zCurBranch);
2556
+ zCurBranch = branch_of_rid(vid);
2557
+ }
2558
+ if( zCurBranch==0 ) zCurBranch = branch_of_rid(vid);
2559
+
25132560
/* Track the "private" status */
25142561
g.markPrivate = privateFlag || privateParent;
25152562
if( privateFlag && !privateParent ){
25162563
/* Apply default branch name ("private") and color ("orange") if not
25172564
** specified otherwise on the command-line, and if the parent is not
@@ -2560,11 +2607,11 @@
25602607
**
25612608
** If the remote repository sent an avoid-delta-manifests pragma on
25622609
** the autosync above, then also try to avoid deltas, unless the
25632610
** --delta option is specified. The remote repo will send the
25642611
** avoid-delta-manifests pragma if it has its "forbid-delta-manifests"
2565
- ** setting is enabled.
2612
+ ** setting enabled.
25662613
*/
25672614
if( !db_get_boolean("seen-delta-manifest",0)
25682615
|| db_get_boolean("forbid-delta-manifests",0)
25692616
|| g.bAvoidDeltaManifests
25702617
){
@@ -2639,18 +2686,10 @@
26392686
"'%s' was renamed to '%s'", zFrom, zTo, zFrom, zTo);
26402687
}
26412688
db_finalize(&q);
26422689
}
26432690
2644
- user_select();
2645
- /*
2646
- ** Check that the user exists.
2647
- */
2648
- if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){
2649
- fossil_fatal("no such user: %s", g.zLogin);
2650
- }
2651
-
26522691
hasChanges = unsaved_changes(useHash ? CKSIG_HASH : 0);
26532692
db_begin_transaction();
26542693
db_record_repository_filename(0);
26552694
if( hasChanges==0 && !isAMerge && !allowEmpty && !forceFlag ){
26562695
fossil_fatal("nothing has changed; use --allow-empty to override");
@@ -2713,10 +2752,32 @@
27132752
" WHERE tagid=%d AND rid=%d AND tagtype>0"
27142753
" AND value=%Q", TAG_BRANCH, vid, sCiInfo.zBranch))
27152754
){
27162755
fossil_fatal("cannot commit against a closed leaf");
27172756
}
2757
+
2758
+ /* Require confirmation to continue with the check-in if the branch
2759
+ ** has changed and the committer did not provide the same branch
2760
+ */
2761
+ zNewBranch = branch_of_rid(vid);
2762
+ if( fossil_strcmp(zCurBranch, zNewBranch)!=0
2763
+ && fossil_strcmp(sCiInfo.zBranch, zNewBranch)!=0
2764
+ && forceFlag==0
2765
+ && noPrompt==0
2766
+ ){
2767
+ fossil_warning("parent check-in [%.10s] branch changed from '%s' to '%s'",
2768
+ rid_to_uuid(vid), zCurBranch, zNewBranch);
2769
+ prompt_user("continue (y/N)? ", &ans);
2770
+ cReply = blob_str(&ans)[0];
2771
+ blob_reset(&ans);
2772
+ if( cReply!='y' && cReply!='Y' ){
2773
+ fossil_fatal("Abandoning commit because branch has changed");
2774
+ }
2775
+ fossil_free(zCurBranch);
2776
+ zCurBranch = branch_of_rid(vid);
2777
+ }
2778
+ fossil_free(zNewBranch);
27182779
27192780
/* Always exit the loop on the second pass */
27202781
if( bRecheck ) break;
27212782
27222783
27232784
--- src/checkin.c
+++ src/checkin.c
@@ -567,11 +567,11 @@
567 }
568
569 /* Confirm current working directory is within check-out. */
570 db_must_be_within_tree();
571
572 /* Get check-out version. l*/
573 vid = db_lget_int("checkout", 0);
574
575 /* Relative path flag determination is done by a shared function. */
576 if( determine_cwd_relative_option() ){
577 flags |= C_RELPATH;
@@ -2318,11 +2318,11 @@
2318 **
2319 ** A check-in is not permitted to fork unless the --allow-fork option
2320 ** appears. An empty check-in (i.e. with nothing changed) is not
2321 ** allowed unless the --allow-empty option appears. A check-in may not
2322 ** be older than its ancestor unless the --allow-older option appears.
2323 ** If any of files in the check-in appear to contain unresolved merge
2324 ** conflicts, the check-in will not be allowed unless the
2325 ** --allow-conflict option is present. In addition, the entire
2326 ** check-in process may be aborted if a file contains content that
2327 ** appears to be binary, Unicode text, or text with CR/LF line endings
2328 ** unless the interactive user chooses to proceed. If there is no
@@ -2358,11 +2358,11 @@
2358 ** than relying on file mtimes
2359 ** --ignore-clock-skew If a clock skew is detected, ignore it and
2360 ** behave as if the user had entered 'yes' to
2361 ** the question of whether to proceed despite
2362 ** the skew.
2363 ** --ignore-oversize Do not warning the user about oversized files
2364 ** --integrate Close all merged-in branches
2365 ** -m|--comment COMMENT-TEXT Use COMMENT-TEXT as commit comment
2366 ** -M|--message-file FILE Read the commit comment from given file
2367 ** --mimetype MIMETYPE Mimetype of check-in comment
2368 ** -n|--dry-run If given, display instead of run actions
@@ -2434,10 +2434,12 @@
2434 Blob ans; /* Answer to continuation prompts */
2435 char cReply; /* First character of ans */
2436 int bRecheck = 0; /* Repeat fork and closed-branch checks*/
2437 int bIgnoreSkew = 0; /* --ignore-clock-skew flag */
2438 int mxSize;
 
 
2439
2440 memset(&sCiInfo, 0, sizeof(sCiInfo));
2441 url_proxy_options();
2442 /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
2443 useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
@@ -2508,10 +2510,55 @@
2508 }
2509 }else{
2510 privateParent = content_is_private(vid);
2511 }
2512
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2513 /* Track the "private" status */
2514 g.markPrivate = privateFlag || privateParent;
2515 if( privateFlag && !privateParent ){
2516 /* Apply default branch name ("private") and color ("orange") if not
2517 ** specified otherwise on the command-line, and if the parent is not
@@ -2560,11 +2607,11 @@
2560 **
2561 ** If the remote repository sent an avoid-delta-manifests pragma on
2562 ** the autosync above, then also try to avoid deltas, unless the
2563 ** --delta option is specified. The remote repo will send the
2564 ** avoid-delta-manifests pragma if it has its "forbid-delta-manifests"
2565 ** setting is enabled.
2566 */
2567 if( !db_get_boolean("seen-delta-manifest",0)
2568 || db_get_boolean("forbid-delta-manifests",0)
2569 || g.bAvoidDeltaManifests
2570 ){
@@ -2639,18 +2686,10 @@
2639 "'%s' was renamed to '%s'", zFrom, zTo, zFrom, zTo);
2640 }
2641 db_finalize(&q);
2642 }
2643
2644 user_select();
2645 /*
2646 ** Check that the user exists.
2647 */
2648 if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){
2649 fossil_fatal("no such user: %s", g.zLogin);
2650 }
2651
2652 hasChanges = unsaved_changes(useHash ? CKSIG_HASH : 0);
2653 db_begin_transaction();
2654 db_record_repository_filename(0);
2655 if( hasChanges==0 && !isAMerge && !allowEmpty && !forceFlag ){
2656 fossil_fatal("nothing has changed; use --allow-empty to override");
@@ -2713,10 +2752,32 @@
2713 " WHERE tagid=%d AND rid=%d AND tagtype>0"
2714 " AND value=%Q", TAG_BRANCH, vid, sCiInfo.zBranch))
2715 ){
2716 fossil_fatal("cannot commit against a closed leaf");
2717 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2718
2719 /* Always exit the loop on the second pass */
2720 if( bRecheck ) break;
2721
2722
2723
--- src/checkin.c
+++ src/checkin.c
@@ -567,11 +567,11 @@
567 }
568
569 /* Confirm current working directory is within check-out. */
570 db_must_be_within_tree();
571
572 /* Get check-out version. */
573 vid = db_lget_int("checkout", 0);
574
575 /* Relative path flag determination is done by a shared function. */
576 if( determine_cwd_relative_option() ){
577 flags |= C_RELPATH;
@@ -2318,11 +2318,11 @@
2318 **
2319 ** A check-in is not permitted to fork unless the --allow-fork option
2320 ** appears. An empty check-in (i.e. with nothing changed) is not
2321 ** allowed unless the --allow-empty option appears. A check-in may not
2322 ** be older than its ancestor unless the --allow-older option appears.
2323 ** If any files in the check-in appear to contain unresolved merge
2324 ** conflicts, the check-in will not be allowed unless the
2325 ** --allow-conflict option is present. In addition, the entire
2326 ** check-in process may be aborted if a file contains content that
2327 ** appears to be binary, Unicode text, or text with CR/LF line endings
2328 ** unless the interactive user chooses to proceed. If there is no
@@ -2358,11 +2358,11 @@
2358 ** than relying on file mtimes
2359 ** --ignore-clock-skew If a clock skew is detected, ignore it and
2360 ** behave as if the user had entered 'yes' to
2361 ** the question of whether to proceed despite
2362 ** the skew.
2363 ** --ignore-oversize Do not warn the user about oversized files
2364 ** --integrate Close all merged-in branches
2365 ** -m|--comment COMMENT-TEXT Use COMMENT-TEXT as commit comment
2366 ** -M|--message-file FILE Read the commit comment from given file
2367 ** --mimetype MIMETYPE Mimetype of check-in comment
2368 ** -n|--dry-run If given, display instead of run actions
@@ -2434,10 +2434,12 @@
2434 Blob ans; /* Answer to continuation prompts */
2435 char cReply; /* First character of ans */
2436 int bRecheck = 0; /* Repeat fork and closed-branch checks*/
2437 int bIgnoreSkew = 0; /* --ignore-clock-skew flag */
2438 int mxSize;
2439 char *zCurBranch = 0; /* The current branch name of checkout */
2440 char *zNewBranch = 0; /* The branch name after update */
2441
2442 memset(&sCiInfo, 0, sizeof(sCiInfo));
2443 url_proxy_options();
2444 /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
2445 useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
@@ -2508,10 +2510,55 @@
2510 }
2511 }else{
2512 privateParent = content_is_private(vid);
2513 }
2514
2515 user_select();
2516 /*
2517 ** Check that the user exists.
2518 */
2519 if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){
2520 fossil_fatal("no such user: %s", g.zLogin);
2521 }
2522
2523 /*
2524 ** Detect if the branch name has changed from the parent check-in
2525 ** and prompt if necessary
2526 **/
2527 zCurBranch = db_text(0,
2528 " SELECT value FROM tagxref AS tx"
2529 " WHERE rid=(SELECT pid"
2530 " FROM tagxref LEFT JOIN event ON srcid=objid"
2531 " LEFT JOIN plink ON rid=cid"
2532 " WHERE rid=%d AND tagxref.tagid=%d"
2533 " AND srcid!=origid"
2534 " AND tagtype=2 AND coalesce(euser,user)!=%Q)"
2535 " AND tx.tagid=%d",
2536 vid, TAG_BRANCH, g.zLogin, TAG_BRANCH
2537 );
2538 if( zCurBranch!=0 && zCurBranch[0]!=0
2539 && forceFlag==0
2540 && noPrompt==0
2541 ){
2542 zNewBranch = branch_of_rid(vid);
2543 fossil_warning(
2544 "WARNING: The parent check-in [%.10s] has been moved from branch\n"
2545 " '%s' over to branch '%s'.",
2546 rid_to_uuid(vid), zCurBranch, zNewBranch
2547 );
2548 prompt_user("Commit anyway? (y/N) ", &ans);
2549 cReply = blob_str(&ans)[0];
2550 blob_reset(&ans);
2551 if( cReply!='y' && cReply!='Y' ){
2552 fossil_fatal("Abandoning commit because branch has changed");
2553 }
2554 fossil_free(zNewBranch);
2555 fossil_free(zCurBranch);
2556 zCurBranch = branch_of_rid(vid);
2557 }
2558 if( zCurBranch==0 ) zCurBranch = branch_of_rid(vid);
2559
2560 /* Track the "private" status */
2561 g.markPrivate = privateFlag || privateParent;
2562 if( privateFlag && !privateParent ){
2563 /* Apply default branch name ("private") and color ("orange") if not
2564 ** specified otherwise on the command-line, and if the parent is not
@@ -2560,11 +2607,11 @@
2607 **
2608 ** If the remote repository sent an avoid-delta-manifests pragma on
2609 ** the autosync above, then also try to avoid deltas, unless the
2610 ** --delta option is specified. The remote repo will send the
2611 ** avoid-delta-manifests pragma if it has its "forbid-delta-manifests"
2612 ** setting enabled.
2613 */
2614 if( !db_get_boolean("seen-delta-manifest",0)
2615 || db_get_boolean("forbid-delta-manifests",0)
2616 || g.bAvoidDeltaManifests
2617 ){
@@ -2639,18 +2686,10 @@
2686 "'%s' was renamed to '%s'", zFrom, zTo, zFrom, zTo);
2687 }
2688 db_finalize(&q);
2689 }
2690
 
 
 
 
 
 
 
 
2691 hasChanges = unsaved_changes(useHash ? CKSIG_HASH : 0);
2692 db_begin_transaction();
2693 db_record_repository_filename(0);
2694 if( hasChanges==0 && !isAMerge && !allowEmpty && !forceFlag ){
2695 fossil_fatal("nothing has changed; use --allow-empty to override");
@@ -2713,10 +2752,32 @@
2752 " WHERE tagid=%d AND rid=%d AND tagtype>0"
2753 " AND value=%Q", TAG_BRANCH, vid, sCiInfo.zBranch))
2754 ){
2755 fossil_fatal("cannot commit against a closed leaf");
2756 }
2757
2758 /* Require confirmation to continue with the check-in if the branch
2759 ** has changed and the committer did not provide the same branch
2760 */
2761 zNewBranch = branch_of_rid(vid);
2762 if( fossil_strcmp(zCurBranch, zNewBranch)!=0
2763 && fossil_strcmp(sCiInfo.zBranch, zNewBranch)!=0
2764 && forceFlag==0
2765 && noPrompt==0
2766 ){
2767 fossil_warning("parent check-in [%.10s] branch changed from '%s' to '%s'",
2768 rid_to_uuid(vid), zCurBranch, zNewBranch);
2769 prompt_user("continue (y/N)? ", &ans);
2770 cReply = blob_str(&ans)[0];
2771 blob_reset(&ans);
2772 if( cReply!='y' && cReply!='Y' ){
2773 fossil_fatal("Abandoning commit because branch has changed");
2774 }
2775 fossil_free(zCurBranch);
2776 zCurBranch = branch_of_rid(vid);
2777 }
2778 fossil_free(zNewBranch);
2779
2780 /* Always exit the loop on the second pass */
2781 if( bRecheck ) break;
2782
2783
2784
+5 -10
--- src/db.c
+++ src/db.c
@@ -1557,10 +1557,12 @@
15571557
sqlite3_create_function(db, "url_nouser", 1, SQLITE_UTF8, 0,
15581558
url_nouser_func,0,0);
15591559
sqlite3_create_function(db, "chat_msg_from_event", 4,
15601560
SQLITE_UTF8 | SQLITE_INNOCUOUS, 0,
15611561
chat_msg_from_event, 0, 0);
1562
+ sqlite3_create_function(db, "inode", 1, SQLITE_UTF8, 0,
1563
+ file_inode_sql_func,0,0);
15621564
15631565
}
15641566
15651567
#if USE_SEE
15661568
/*
@@ -4080,11 +4082,11 @@
40804082
** specified then that version is checked out. Otherwise the most recent
40814083
** check-in on the main branch (usually "trunk") is used.
40824084
**
40834085
** REPOSITORY can be the filename for a repository that already exists on the
40844086
** local machine or it can be a URI for a remote repository. If REPOSITORY
4085
-** is a URI in one of the formats recognized by the [[clone]] command, then
4087
+** is a URI in one of the formats recognized by the [[clone]] command, the
40864088
** remote repo is first cloned, then the clone is opened. The clone will be
40874089
** stored in the current directory, or in DIR if the "--repodir DIR" option
40884090
** is used. The name of the clone will be taken from the last term of the URI.
40894091
** For "http:" and "https:" URIs, you can append an extra term to the end of
40904092
** the URI to get any repository name you like. For example:
@@ -4681,17 +4683,10 @@
46814683
** to obtain a check-in lock during auto-sync, the server will
46824684
** send the "pragma avoid-delta-manifests" statement in its reply,
46834685
** which will cause the client to avoid generating a delta
46844686
** manifest.
46854687
*/
4686
-/*
4687
-** SETTING: forum-close-policy boolean default=off
4688
-** If true, forum moderators may close/re-open forum posts, and reply
4689
-** to closed posts. If false, only administrators may do so. Note that
4690
-** this only affects the forum web UI, not post-closing tags which
4691
-** arrive via the command-line or from synchronization with a remote.
4692
-*/
46934688
/*
46944689
** SETTING: gdiff-command width=40 default=gdiff sensitive
46954690
** The value is an external command to run when performing a graphical
46964691
** diff. If undefined, text diff will be used.
46974692
*/
@@ -5362,11 +5357,11 @@
53625357
}
53635358
53645359
/*
53655360
** Compute a "fingerprint" on the repository. A fingerprint is used
53665361
** to verify that that the repository has not been replaced by a clone
5367
-** of the same repository. More precisely, a fingerprint are used to
5362
+** of the same repository. More precisely, a fingerprint is used to
53685363
** verify that the mapping between SHA3 hashes and RID values is unchanged.
53695364
**
53705365
** The check-out database ("localdb") stores RID values. When associating
53715366
** a check-out database against a repository database, it is useful to verify
53725367
** the fingerprint so that we know tha the RID values in the check-out
@@ -5427,11 +5422,11 @@
54275422
** COMMAND: test-fingerprint
54285423
**
54295424
** Usage: %fossil test-fingerprint ?RCVID?
54305425
**
54315426
** Display the repository fingerprint using the supplied RCVID or
5432
-** using the latest RCVID if not is given on the command line.
5427
+** using the latest RCVID if none is given on the command line.
54335428
** Show both the legacy and the newer version of the fingerprint,
54345429
** and the currently stored fingerprint if there is one.
54355430
*/
54365431
void test_fingerprint(void){
54375432
int rcvid = 0;
54385433
--- src/db.c
+++ src/db.c
@@ -1557,10 +1557,12 @@
1557 sqlite3_create_function(db, "url_nouser", 1, SQLITE_UTF8, 0,
1558 url_nouser_func,0,0);
1559 sqlite3_create_function(db, "chat_msg_from_event", 4,
1560 SQLITE_UTF8 | SQLITE_INNOCUOUS, 0,
1561 chat_msg_from_event, 0, 0);
 
 
1562
1563 }
1564
1565 #if USE_SEE
1566 /*
@@ -4080,11 +4082,11 @@
4080 ** specified then that version is checked out. Otherwise the most recent
4081 ** check-in on the main branch (usually "trunk") is used.
4082 **
4083 ** REPOSITORY can be the filename for a repository that already exists on the
4084 ** local machine or it can be a URI for a remote repository. If REPOSITORY
4085 ** is a URI in one of the formats recognized by the [[clone]] command, then
4086 ** remote repo is first cloned, then the clone is opened. The clone will be
4087 ** stored in the current directory, or in DIR if the "--repodir DIR" option
4088 ** is used. The name of the clone will be taken from the last term of the URI.
4089 ** For "http:" and "https:" URIs, you can append an extra term to the end of
4090 ** the URI to get any repository name you like. For example:
@@ -4681,17 +4683,10 @@
4681 ** to obtain a check-in lock during auto-sync, the server will
4682 ** send the "pragma avoid-delta-manifests" statement in its reply,
4683 ** which will cause the client to avoid generating a delta
4684 ** manifest.
4685 */
4686 /*
4687 ** SETTING: forum-close-policy boolean default=off
4688 ** If true, forum moderators may close/re-open forum posts, and reply
4689 ** to closed posts. If false, only administrators may do so. Note that
4690 ** this only affects the forum web UI, not post-closing tags which
4691 ** arrive via the command-line or from synchronization with a remote.
4692 */
4693 /*
4694 ** SETTING: gdiff-command width=40 default=gdiff sensitive
4695 ** The value is an external command to run when performing a graphical
4696 ** diff. If undefined, text diff will be used.
4697 */
@@ -5362,11 +5357,11 @@
5362 }
5363
5364 /*
5365 ** Compute a "fingerprint" on the repository. A fingerprint is used
5366 ** to verify that that the repository has not been replaced by a clone
5367 ** of the same repository. More precisely, a fingerprint are used to
5368 ** verify that the mapping between SHA3 hashes and RID values is unchanged.
5369 **
5370 ** The check-out database ("localdb") stores RID values. When associating
5371 ** a check-out database against a repository database, it is useful to verify
5372 ** the fingerprint so that we know tha the RID values in the check-out
@@ -5427,11 +5422,11 @@
5427 ** COMMAND: test-fingerprint
5428 **
5429 ** Usage: %fossil test-fingerprint ?RCVID?
5430 **
5431 ** Display the repository fingerprint using the supplied RCVID or
5432 ** using the latest RCVID if not is given on the command line.
5433 ** Show both the legacy and the newer version of the fingerprint,
5434 ** and the currently stored fingerprint if there is one.
5435 */
5436 void test_fingerprint(void){
5437 int rcvid = 0;
5438
--- src/db.c
+++ src/db.c
@@ -1557,10 +1557,12 @@
1557 sqlite3_create_function(db, "url_nouser", 1, SQLITE_UTF8, 0,
1558 url_nouser_func,0,0);
1559 sqlite3_create_function(db, "chat_msg_from_event", 4,
1560 SQLITE_UTF8 | SQLITE_INNOCUOUS, 0,
1561 chat_msg_from_event, 0, 0);
1562 sqlite3_create_function(db, "inode", 1, SQLITE_UTF8, 0,
1563 file_inode_sql_func,0,0);
1564
1565 }
1566
1567 #if USE_SEE
1568 /*
@@ -4080,11 +4082,11 @@
4082 ** specified then that version is checked out. Otherwise the most recent
4083 ** check-in on the main branch (usually "trunk") is used.
4084 **
4085 ** REPOSITORY can be the filename for a repository that already exists on the
4086 ** local machine or it can be a URI for a remote repository. If REPOSITORY
4087 ** is a URI in one of the formats recognized by the [[clone]] command, the
4088 ** remote repo is first cloned, then the clone is opened. The clone will be
4089 ** stored in the current directory, or in DIR if the "--repodir DIR" option
4090 ** is used. The name of the clone will be taken from the last term of the URI.
4091 ** For "http:" and "https:" URIs, you can append an extra term to the end of
4092 ** the URI to get any repository name you like. For example:
@@ -4681,17 +4683,10 @@
4683 ** to obtain a check-in lock during auto-sync, the server will
4684 ** send the "pragma avoid-delta-manifests" statement in its reply,
4685 ** which will cause the client to avoid generating a delta
4686 ** manifest.
4687 */
 
 
 
 
 
 
 
4688 /*
4689 ** SETTING: gdiff-command width=40 default=gdiff sensitive
4690 ** The value is an external command to run when performing a graphical
4691 ** diff. If undefined, text diff will be used.
4692 */
@@ -5362,11 +5357,11 @@
5357 }
5358
5359 /*
5360 ** Compute a "fingerprint" on the repository. A fingerprint is used
5361 ** to verify that that the repository has not been replaced by a clone
5362 ** of the same repository. More precisely, a fingerprint is used to
5363 ** verify that the mapping between SHA3 hashes and RID values is unchanged.
5364 **
5365 ** The check-out database ("localdb") stores RID values. When associating
5366 ** a check-out database against a repository database, it is useful to verify
5367 ** the fingerprint so that we know tha the RID values in the check-out
@@ -5427,11 +5422,11 @@
5422 ** COMMAND: test-fingerprint
5423 **
5424 ** Usage: %fossil test-fingerprint ?RCVID?
5425 **
5426 ** Display the repository fingerprint using the supplied RCVID or
5427 ** using the latest RCVID if none is given on the command line.
5428 ** Show both the legacy and the newer version of the fingerprint,
5429 ** and the currently stored fingerprint if there is one.
5430 */
5431 void test_fingerprint(void){
5432 int rcvid = 0;
5433
+50 -48
--- src/delta.c
+++ src/delta.c
@@ -225,59 +225,61 @@
225225
** of four bytes.
226226
*/
227227
static unsigned int checksum(const char *zIn, size_t N){
228228
static const int byteOrderTest = 1;
229229
const unsigned char *z = (const unsigned char *)zIn;
230
- const unsigned char *zEnd = (const unsigned char*)&zIn[N&~3];
231230
unsigned sum = 0;
232
- assert( (z - (const unsigned char*)0)%4==0 ); /* Four-byte alignment */
233
- if( 0==*(char*)&byteOrderTest ){
234
- /* This is a big-endian machine */
235
- while( z<zEnd ){
236
- sum += *(unsigned*)z;
237
- z += 4;
238
- }
239
- }else{
240
- /* A little-endian machine */
241
-#if GCC_VERSION>=4003000
242
- while( z<zEnd ){
243
- sum += __builtin_bswap32(*(unsigned*)z);
244
- z += 4;
245
- }
246
-#elif defined(_MSC_VER) && _MSC_VER>=1300
247
- while( z<zEnd ){
248
- sum += _byteswap_ulong(*(unsigned*)z);
249
- z += 4;
250
- }
251
-#else
252
- unsigned sum0 = 0;
253
- unsigned sum1 = 0;
254
- unsigned sum2 = 0;
255
- while(N >= 16){
256
- sum0 += ((unsigned)z[0] + z[4] + z[8] + z[12]);
257
- sum1 += ((unsigned)z[1] + z[5] + z[9] + z[13]);
258
- sum2 += ((unsigned)z[2] + z[6] + z[10]+ z[14]);
259
- sum += ((unsigned)z[3] + z[7] + z[11]+ z[15]);
260
- z += 16;
261
- N -= 16;
262
- }
263
- while(N >= 4){
264
- sum0 += z[0];
265
- sum1 += z[1];
266
- sum2 += z[2];
267
- sum += z[3];
268
- z += 4;
269
- N -= 4;
270
- }
271
- sum += (sum2 << 8) + (sum1 << 16) + (sum0 << 24);
272
-#endif
273
- }
274
- switch(N&3){
275
- case 3: sum += (z[2] << 8);
276
- case 2: sum += (z[1] << 16);
277
- case 1: sum += (z[0] << 24);
278
- default: ;
231
+ if( N>0 ){
232
+ const unsigned char *zEnd = (const unsigned char*)&zIn[N&~3];
233
+ assert( (z - (const unsigned char*)0)%4==0 ); /* Four-byte alignment */
234
+ if( 0==*(char*)&byteOrderTest ){
235
+ /* This is a big-endian machine */
236
+ while( z<zEnd ){
237
+ sum += *(unsigned*)z;
238
+ z += 4;
239
+ }
240
+ }else{
241
+ /* A little-endian machine */
242
+ #if GCC_VERSION>=4003000
243
+ while( z<zEnd ){
244
+ sum += __builtin_bswap32(*(unsigned*)z);
245
+ z += 4;
246
+ }
247
+ #elif defined(_MSC_VER) && _MSC_VER>=1300
248
+ while( z<zEnd ){
249
+ sum += _byteswap_ulong(*(unsigned*)z);
250
+ z += 4;
251
+ }
252
+ #else
253
+ unsigned sum0 = 0;
254
+ unsigned sum1 = 0;
255
+ unsigned sum2 = 0;
256
+ while(N >= 16){
257
+ sum0 += ((unsigned)z[0] + z[4] + z[8] + z[12]);
258
+ sum1 += ((unsigned)z[1] + z[5] + z[9] + z[13]);
259
+ sum2 += ((unsigned)z[2] + z[6] + z[10]+ z[14]);
260
+ sum += ((unsigned)z[3] + z[7] + z[11]+ z[15]);
261
+ z += 16;
262
+ N -= 16;
263
+ }
264
+ while(N >= 4){
265
+ sum0 += z[0];
266
+ sum1 += z[1];
267
+ sum2 += z[2];
268
+ sum += z[3];
269
+ z += 4;
270
+ N -= 4;
271
+ }
272
+ sum += (sum2 << 8) + (sum1 << 16) + (sum0 << 24);
273
+ #endif
274
+ }
275
+ switch(N&3){
276
+ case 3: sum += (z[2] << 8);
277
+ case 2: sum += (z[1] << 16);
278
+ case 1: sum += (z[0] << 24);
279
+ default: ;
280
+ }
279281
}
280282
return sum;
281283
}
282284
283285
/*
284286
--- src/delta.c
+++ src/delta.c
@@ -225,59 +225,61 @@
225 ** of four bytes.
226 */
227 static unsigned int checksum(const char *zIn, size_t N){
228 static const int byteOrderTest = 1;
229 const unsigned char *z = (const unsigned char *)zIn;
230 const unsigned char *zEnd = (const unsigned char*)&zIn[N&~3];
231 unsigned sum = 0;
232 assert( (z - (const unsigned char*)0)%4==0 ); /* Four-byte alignment */
233 if( 0==*(char*)&byteOrderTest ){
234 /* This is a big-endian machine */
235 while( z<zEnd ){
236 sum += *(unsigned*)z;
237 z += 4;
238 }
239 }else{
240 /* A little-endian machine */
241 #if GCC_VERSION>=4003000
242 while( z<zEnd ){
243 sum += __builtin_bswap32(*(unsigned*)z);
244 z += 4;
245 }
246 #elif defined(_MSC_VER) && _MSC_VER>=1300
247 while( z<zEnd ){
248 sum += _byteswap_ulong(*(unsigned*)z);
249 z += 4;
250 }
251 #else
252 unsigned sum0 = 0;
253 unsigned sum1 = 0;
254 unsigned sum2 = 0;
255 while(N >= 16){
256 sum0 += ((unsigned)z[0] + z[4] + z[8] + z[12]);
257 sum1 += ((unsigned)z[1] + z[5] + z[9] + z[13]);
258 sum2 += ((unsigned)z[2] + z[6] + z[10]+ z[14]);
259 sum += ((unsigned)z[3] + z[7] + z[11]+ z[15]);
260 z += 16;
261 N -= 16;
262 }
263 while(N >= 4){
264 sum0 += z[0];
265 sum1 += z[1];
266 sum2 += z[2];
267 sum += z[3];
268 z += 4;
269 N -= 4;
270 }
271 sum += (sum2 << 8) + (sum1 << 16) + (sum0 << 24);
272 #endif
273 }
274 switch(N&3){
275 case 3: sum += (z[2] << 8);
276 case 2: sum += (z[1] << 16);
277 case 1: sum += (z[0] << 24);
278 default: ;
 
 
 
279 }
280 return sum;
281 }
282
283 /*
284
--- src/delta.c
+++ src/delta.c
@@ -225,59 +225,61 @@
225 ** of four bytes.
226 */
227 static unsigned int checksum(const char *zIn, size_t N){
228 static const int byteOrderTest = 1;
229 const unsigned char *z = (const unsigned char *)zIn;
 
230 unsigned sum = 0;
231 if( N>0 ){
232 const unsigned char *zEnd = (const unsigned char*)&zIn[N&~3];
233 assert( (z - (const unsigned char*)0)%4==0 ); /* Four-byte alignment */
234 if( 0==*(char*)&byteOrderTest ){
235 /* This is a big-endian machine */
236 while( z<zEnd ){
237 sum += *(unsigned*)z;
238 z += 4;
239 }
240 }else{
241 /* A little-endian machine */
242 #if GCC_VERSION>=4003000
243 while( z<zEnd ){
244 sum += __builtin_bswap32(*(unsigned*)z);
245 z += 4;
246 }
247 #elif defined(_MSC_VER) && _MSC_VER>=1300
248 while( z<zEnd ){
249 sum += _byteswap_ulong(*(unsigned*)z);
250 z += 4;
251 }
252 #else
253 unsigned sum0 = 0;
254 unsigned sum1 = 0;
255 unsigned sum2 = 0;
256 while(N >= 16){
257 sum0 += ((unsigned)z[0] + z[4] + z[8] + z[12]);
258 sum1 += ((unsigned)z[1] + z[5] + z[9] + z[13]);
259 sum2 += ((unsigned)z[2] + z[6] + z[10]+ z[14]);
260 sum += ((unsigned)z[3] + z[7] + z[11]+ z[15]);
261 z += 16;
262 N -= 16;
263 }
264 while(N >= 4){
265 sum0 += z[0];
266 sum1 += z[1];
267 sum2 += z[2];
268 sum += z[3];
269 z += 4;
270 N -= 4;
271 }
272 sum += (sum2 << 8) + (sum1 << 16) + (sum0 << 24);
273 #endif
274 }
275 switch(N&3){
276 case 3: sum += (z[2] << 8);
277 case 2: sum += (z[1] << 16);
278 case 1: sum += (z[0] << 24);
279 default: ;
280 }
281 }
282 return sum;
283 }
284
285 /*
286
+135 -5
--- src/diff.c
+++ src/diff.c
@@ -50,10 +50,11 @@
5050
#define DIFF_RAW 0x00040000 /* Raw triples - for debugging */
5151
#define DIFF_TCL 0x00080000 /* For the --tk option */
5252
#define DIFF_INCBINARY 0x00100000 /* The --diff-binary option */
5353
#define DIFF_SHOW_VERS 0x00200000 /* Show compared versions */
5454
#define DIFF_DARKMODE 0x00400000 /* Use dark mode for HTML */
55
+#define DIFF_BY_TOKEN 0x01000000 /* Split on tokens, not lines */
5556
5657
/*
5758
** Per file information that may influence output.
5859
*/
5960
#define DIFF_FILE_ADDED 0x40000000 /* Added or rename destination */
@@ -319,10 +320,113 @@
319320
320321
/* Return results */
321322
*pnLine = nLine;
322323
return a;
323324
}
325
+
326
+/*
327
+** Character classes for the purpose of tokenization.
328
+**
329
+** 1 - alphanumeric
330
+** 2 - whitespace
331
+** 3 - punctuation
332
+*/
333
+static char aTCharClass[256] = {
334
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
335
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
336
+ 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
337
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3,
338
+
339
+ 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
340
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3,
341
+ 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
342
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3,
343
+
344
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
345
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
346
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
347
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
348
+
349
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
350
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
351
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
352
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
353
+};
354
+
355
+/*
356
+** Count the number of tokens in the given string.
357
+*/
358
+static int count_tokens(const unsigned char *p, int n){
359
+ int nToken = 0;
360
+ int iPrev = 0;
361
+ int i;
362
+ for(i=0; i<n; i++){
363
+ char x = aTCharClass[p[i]];
364
+ if( x!=iPrev ){
365
+ iPrev = x;
366
+ nToken++;
367
+ }
368
+ }
369
+ return nToken;
370
+}
371
+
372
+/*
373
+** Return an array of DLine objects containing a pointer to the
374
+** start of each token and a hash of that token. The lower
375
+** bits of the hash store the length of each token.
376
+**
377
+** This is like break_into_lines() except that it works with tokens
378
+** instead of lines. A token is:
379
+**
380
+** * A contiguous sequence of alphanumeric characters.
381
+** * A contiguous sequence of whitespace
382
+** * A contiguous sequence of punctuation characters.
383
+**
384
+** Return 0 if the file is binary or contains a line that is
385
+** too long.
386
+*/
387
+static DLine *break_into_tokens(
388
+ const char *z,
389
+ int n,
390
+ int *pnToken,
391
+ u64 diffFlags
392
+){
393
+ int nToken, i, k;
394
+ u64 h, h2;
395
+ DLine *a;
396
+ unsigned char *p = (unsigned char*)z;
397
+
398
+ nToken = count_tokens(p, n);
399
+ a = fossil_malloc( sizeof(a[0])*(nToken+1) );
400
+ memset(a, 0, sizeof(a[0])*(nToken+1));
401
+ if( n==0 ){
402
+ *pnToken = 0;
403
+ return a;
404
+ }
405
+ i = 0;
406
+ while( n>0 ){
407
+ char x = aTCharClass[*p];
408
+ h = 0xcbf29ce484222325LL;
409
+ for(k=1; k<n && aTCharClass[p[k]]==x; k++){
410
+ h ^= p[k];
411
+ h *= 0x100000001b3LL;
412
+ }
413
+ a[i].z = (char*)p;
414
+ a[i].n = k;
415
+ a[i].h = h = ((h%281474976710597LL)<<LENGTH_MASK_SZ) | k;
416
+ h2 = h % nToken;
417
+ a[i].iNext = a[h2].iHash;
418
+ a[h2].iHash = i+1;
419
+ p += k; n -= k;
420
+ i++;
421
+ };
422
+ assert( i==nToken );
423
+
424
+ /* Return results */
425
+ *pnToken = nToken;
426
+ return a;
427
+}
324428
325429
/*
326430
** Return zero if two DLine elements are identical.
327431
*/
328432
static int compare_dline(const DLine *pA, const DLine *pB){
@@ -2997,14 +3101,21 @@
29973101
if( (pCfg->diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
29983102
c.xDiffer = compare_dline_ignore_allws;
29993103
}else{
30003104
c.xDiffer = compare_dline;
30013105
}
3002
- c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob),
3003
- &c.nFrom, pCfg->diffFlags);
3004
- c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob),
3005
- &c.nTo, pCfg->diffFlags);
3106
+ if( pCfg->diffFlags & DIFF_BY_TOKEN ){
3107
+ c.aFrom = break_into_tokens(blob_str(pA_Blob), blob_size(pA_Blob),
3108
+ &c.nFrom, pCfg->diffFlags);
3109
+ c.aTo = break_into_tokens(blob_str(pB_Blob), blob_size(pB_Blob),
3110
+ &c.nTo, pCfg->diffFlags);
3111
+ }else{
3112
+ c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob),
3113
+ &c.nFrom, pCfg->diffFlags);
3114
+ c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob),
3115
+ &c.nTo, pCfg->diffFlags);
3116
+ }
30063117
if( c.aFrom==0 || c.aTo==0 ){
30073118
fossil_free(c.aFrom);
30083119
fossil_free(c.aTo);
30093120
if( pOut ){
30103121
diff_errmsg(pOut, DIFF_CANNOT_COMPUTE_BINARY, pCfg->diffFlags);
@@ -3035,10 +3146,26 @@
30353146
}
30363147
}
30373148
if( (pCfg->diffFlags & DIFF_NOOPT)==0 ){
30383149
diff_optimize(&c);
30393150
}
3151
+ if( (pCfg->diffFlags & DIFF_BY_TOKEN)!=0 ){
3152
+ /* Convert token counts into byte counts. */
3153
+ int i;
3154
+ int iA = 0;
3155
+ int iB = 0;
3156
+ for(i=0; c.aEdit[i] || c.aEdit[i+1] || c.aEdit[i+2]; i+=3){
3157
+ int k, sum;
3158
+ for(k=0, sum=0; k<c.aEdit[i]; k++) sum += c.aFrom[iA++].n;
3159
+ iB += c.aEdit[i];
3160
+ c.aEdit[i] = sum;
3161
+ for(k=0, sum=0; k<c.aEdit[i+1]; k++) sum += c.aFrom[iA++].n;
3162
+ c.aEdit[i+1] = sum;
3163
+ for(k=0, sum=0; k<c.aEdit[i+2]; k++) sum += c.aTo[iB++].n;
3164
+ c.aEdit[i+2] = sum;
3165
+ }
3166
+ }
30403167
30413168
if( pOut ){
30423169
if( pCfg->diffFlags & DIFF_NUMSTAT ){
30433170
int nDel = 0, nIns = 0, i;
30443171
for(i=0; c.aEdit[i] || c.aEdit[i+1] || c.aEdit[i+2]; i+=3){
@@ -3049,11 +3176,11 @@
30493176
g.diffCnt[2] += nDel;
30503177
if( nIns+nDel ){
30513178
g.diffCnt[0]++;
30523179
blob_appendf(pOut, "%10d %10d", nIns, nDel);
30533180
}
3054
- }else if( pCfg->diffFlags & DIFF_RAW ){
3181
+ }else if( pCfg->diffFlags & (DIFF_RAW|DIFF_BY_TOKEN) ){
30553182
const int *R = c.aEdit;
30563183
unsigned int r;
30573184
for(r=0; R[r] || R[r+1] || R[r+2]; r += 3){
30583185
blob_appendf(pOut, " copy %6d delete %6d insert %6d\n",
30593186
R[r], R[r+1], R[r+2]);
@@ -3157,10 +3284,13 @@
31573284
31583285
/* Undocumented and unsupported flags used for development
31593286
** debugging and analysis: */
31603287
if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG;
31613288
if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW;
3289
+ if( find_option("bytoken",0,0)!=0 ){
3290
+ diffFlags = DIFF_RAW|DIFF_BY_TOKEN;
3291
+ }
31623292
}
31633293
if( (z = find_option("context","c",1))!=0 ){
31643294
char *zEnd;
31653295
f = (int)strtol(z, &zEnd, 10);
31663296
if( zEnd[0]==0 && errno!=ERANGE ){
31673297
--- src/diff.c
+++ src/diff.c
@@ -50,10 +50,11 @@
50 #define DIFF_RAW 0x00040000 /* Raw triples - for debugging */
51 #define DIFF_TCL 0x00080000 /* For the --tk option */
52 #define DIFF_INCBINARY 0x00100000 /* The --diff-binary option */
53 #define DIFF_SHOW_VERS 0x00200000 /* Show compared versions */
54 #define DIFF_DARKMODE 0x00400000 /* Use dark mode for HTML */
 
55
56 /*
57 ** Per file information that may influence output.
58 */
59 #define DIFF_FILE_ADDED 0x40000000 /* Added or rename destination */
@@ -319,10 +320,113 @@
319
320 /* Return results */
321 *pnLine = nLine;
322 return a;
323 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
325 /*
326 ** Return zero if two DLine elements are identical.
327 */
328 static int compare_dline(const DLine *pA, const DLine *pB){
@@ -2997,14 +3101,21 @@
2997 if( (pCfg->diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
2998 c.xDiffer = compare_dline_ignore_allws;
2999 }else{
3000 c.xDiffer = compare_dline;
3001 }
3002 c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob),
3003 &c.nFrom, pCfg->diffFlags);
3004 c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob),
3005 &c.nTo, pCfg->diffFlags);
 
 
 
 
 
 
 
3006 if( c.aFrom==0 || c.aTo==0 ){
3007 fossil_free(c.aFrom);
3008 fossil_free(c.aTo);
3009 if( pOut ){
3010 diff_errmsg(pOut, DIFF_CANNOT_COMPUTE_BINARY, pCfg->diffFlags);
@@ -3035,10 +3146,26 @@
3035 }
3036 }
3037 if( (pCfg->diffFlags & DIFF_NOOPT)==0 ){
3038 diff_optimize(&c);
3039 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3040
3041 if( pOut ){
3042 if( pCfg->diffFlags & DIFF_NUMSTAT ){
3043 int nDel = 0, nIns = 0, i;
3044 for(i=0; c.aEdit[i] || c.aEdit[i+1] || c.aEdit[i+2]; i+=3){
@@ -3049,11 +3176,11 @@
3049 g.diffCnt[2] += nDel;
3050 if( nIns+nDel ){
3051 g.diffCnt[0]++;
3052 blob_appendf(pOut, "%10d %10d", nIns, nDel);
3053 }
3054 }else if( pCfg->diffFlags & DIFF_RAW ){
3055 const int *R = c.aEdit;
3056 unsigned int r;
3057 for(r=0; R[r] || R[r+1] || R[r+2]; r += 3){
3058 blob_appendf(pOut, " copy %6d delete %6d insert %6d\n",
3059 R[r], R[r+1], R[r+2]);
@@ -3157,10 +3284,13 @@
3157
3158 /* Undocumented and unsupported flags used for development
3159 ** debugging and analysis: */
3160 if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG;
3161 if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW;
 
 
 
3162 }
3163 if( (z = find_option("context","c",1))!=0 ){
3164 char *zEnd;
3165 f = (int)strtol(z, &zEnd, 10);
3166 if( zEnd[0]==0 && errno!=ERANGE ){
3167
--- src/diff.c
+++ src/diff.c
@@ -50,10 +50,11 @@
50 #define DIFF_RAW 0x00040000 /* Raw triples - for debugging */
51 #define DIFF_TCL 0x00080000 /* For the --tk option */
52 #define DIFF_INCBINARY 0x00100000 /* The --diff-binary option */
53 #define DIFF_SHOW_VERS 0x00200000 /* Show compared versions */
54 #define DIFF_DARKMODE 0x00400000 /* Use dark mode for HTML */
55 #define DIFF_BY_TOKEN 0x01000000 /* Split on tokens, not lines */
56
57 /*
58 ** Per file information that may influence output.
59 */
60 #define DIFF_FILE_ADDED 0x40000000 /* Added or rename destination */
@@ -319,10 +320,113 @@
320
321 /* Return results */
322 *pnLine = nLine;
323 return a;
324 }
325
326 /*
327 ** Character classes for the purpose of tokenization.
328 **
329 ** 1 - alphanumeric
330 ** 2 - whitespace
331 ** 3 - punctuation
332 */
333 static char aTCharClass[256] = {
334 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
335 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
336 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
337 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3,
338
339 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
340 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3,
341 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
342 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3,
343
344 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
345 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
346 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
347 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
348
349 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
350 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
351 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
352 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
353 };
354
355 /*
356 ** Count the number of tokens in the given string.
357 */
358 static int count_tokens(const unsigned char *p, int n){
359 int nToken = 0;
360 int iPrev = 0;
361 int i;
362 for(i=0; i<n; i++){
363 char x = aTCharClass[p[i]];
364 if( x!=iPrev ){
365 iPrev = x;
366 nToken++;
367 }
368 }
369 return nToken;
370 }
371
372 /*
373 ** Return an array of DLine objects containing a pointer to the
374 ** start of each token and a hash of that token. The lower
375 ** bits of the hash store the length of each token.
376 **
377 ** This is like break_into_lines() except that it works with tokens
378 ** instead of lines. A token is:
379 **
380 ** * A contiguous sequence of alphanumeric characters.
381 ** * A contiguous sequence of whitespace
382 ** * A contiguous sequence of punctuation characters.
383 **
384 ** Return 0 if the file is binary or contains a line that is
385 ** too long.
386 */
387 static DLine *break_into_tokens(
388 const char *z,
389 int n,
390 int *pnToken,
391 u64 diffFlags
392 ){
393 int nToken, i, k;
394 u64 h, h2;
395 DLine *a;
396 unsigned char *p = (unsigned char*)z;
397
398 nToken = count_tokens(p, n);
399 a = fossil_malloc( sizeof(a[0])*(nToken+1) );
400 memset(a, 0, sizeof(a[0])*(nToken+1));
401 if( n==0 ){
402 *pnToken = 0;
403 return a;
404 }
405 i = 0;
406 while( n>0 ){
407 char x = aTCharClass[*p];
408 h = 0xcbf29ce484222325LL;
409 for(k=1; k<n && aTCharClass[p[k]]==x; k++){
410 h ^= p[k];
411 h *= 0x100000001b3LL;
412 }
413 a[i].z = (char*)p;
414 a[i].n = k;
415 a[i].h = h = ((h%281474976710597LL)<<LENGTH_MASK_SZ) | k;
416 h2 = h % nToken;
417 a[i].iNext = a[h2].iHash;
418 a[h2].iHash = i+1;
419 p += k; n -= k;
420 i++;
421 };
422 assert( i==nToken );
423
424 /* Return results */
425 *pnToken = nToken;
426 return a;
427 }
428
429 /*
430 ** Return zero if two DLine elements are identical.
431 */
432 static int compare_dline(const DLine *pA, const DLine *pB){
@@ -2997,14 +3101,21 @@
3101 if( (pCfg->diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
3102 c.xDiffer = compare_dline_ignore_allws;
3103 }else{
3104 c.xDiffer = compare_dline;
3105 }
3106 if( pCfg->diffFlags & DIFF_BY_TOKEN ){
3107 c.aFrom = break_into_tokens(blob_str(pA_Blob), blob_size(pA_Blob),
3108 &c.nFrom, pCfg->diffFlags);
3109 c.aTo = break_into_tokens(blob_str(pB_Blob), blob_size(pB_Blob),
3110 &c.nTo, pCfg->diffFlags);
3111 }else{
3112 c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob),
3113 &c.nFrom, pCfg->diffFlags);
3114 c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob),
3115 &c.nTo, pCfg->diffFlags);
3116 }
3117 if( c.aFrom==0 || c.aTo==0 ){
3118 fossil_free(c.aFrom);
3119 fossil_free(c.aTo);
3120 if( pOut ){
3121 diff_errmsg(pOut, DIFF_CANNOT_COMPUTE_BINARY, pCfg->diffFlags);
@@ -3035,10 +3146,26 @@
3146 }
3147 }
3148 if( (pCfg->diffFlags & DIFF_NOOPT)==0 ){
3149 diff_optimize(&c);
3150 }
3151 if( (pCfg->diffFlags & DIFF_BY_TOKEN)!=0 ){
3152 /* Convert token counts into byte counts. */
3153 int i;
3154 int iA = 0;
3155 int iB = 0;
3156 for(i=0; c.aEdit[i] || c.aEdit[i+1] || c.aEdit[i+2]; i+=3){
3157 int k, sum;
3158 for(k=0, sum=0; k<c.aEdit[i]; k++) sum += c.aFrom[iA++].n;
3159 iB += c.aEdit[i];
3160 c.aEdit[i] = sum;
3161 for(k=0, sum=0; k<c.aEdit[i+1]; k++) sum += c.aFrom[iA++].n;
3162 c.aEdit[i+1] = sum;
3163 for(k=0, sum=0; k<c.aEdit[i+2]; k++) sum += c.aTo[iB++].n;
3164 c.aEdit[i+2] = sum;
3165 }
3166 }
3167
3168 if( pOut ){
3169 if( pCfg->diffFlags & DIFF_NUMSTAT ){
3170 int nDel = 0, nIns = 0, i;
3171 for(i=0; c.aEdit[i] || c.aEdit[i+1] || c.aEdit[i+2]; i+=3){
@@ -3049,11 +3176,11 @@
3176 g.diffCnt[2] += nDel;
3177 if( nIns+nDel ){
3178 g.diffCnt[0]++;
3179 blob_appendf(pOut, "%10d %10d", nIns, nDel);
3180 }
3181 }else if( pCfg->diffFlags & (DIFF_RAW|DIFF_BY_TOKEN) ){
3182 const int *R = c.aEdit;
3183 unsigned int r;
3184 for(r=0; R[r] || R[r+1] || R[r+2]; r += 3){
3185 blob_appendf(pOut, " copy %6d delete %6d insert %6d\n",
3186 R[r], R[r+1], R[r+2]);
@@ -3157,10 +3284,13 @@
3284
3285 /* Undocumented and unsupported flags used for development
3286 ** debugging and analysis: */
3287 if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG;
3288 if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW;
3289 if( find_option("bytoken",0,0)!=0 ){
3290 diffFlags = DIFF_RAW|DIFF_BY_TOKEN;
3291 }
3292 }
3293 if( (z = find_option("context","c",1))!=0 ){
3294 char *zEnd;
3295 f = (int)strtol(z, &zEnd, 10);
3296 if( zEnd[0]==0 && errno!=ERANGE ){
3297
+1 -1
--- src/diff.tcl
+++ src/diff.tcl
@@ -1,11 +1,11 @@
11
# The "diff --tk" command outputs prepends a "set fossilcmd {...}" line
22
# to this file, then runs this file using "tclsh" in order to display the
33
# graphical diff in a separate window. A typical "set fossilcmd" line
44
# looks like this:
55
#
6
-# set fossilcmd {| "./fossil" diff --html -y -i -v}
6
+# set fossilcmd {| "./fossil" diff --tcl -i -v}
77
#
88
# This header comment is stripped off by the "mkbuiltin.c" program.
99
#
1010
set prog {
1111
package require Tk
1212
--- src/diff.tcl
+++ src/diff.tcl
@@ -1,11 +1,11 @@
1 # The "diff --tk" command outputs prepends a "set fossilcmd {...}" line
2 # to this file, then runs this file using "tclsh" in order to display the
3 # graphical diff in a separate window. A typical "set fossilcmd" line
4 # looks like this:
5 #
6 # set fossilcmd {| "./fossil" diff --html -y -i -v}
7 #
8 # This header comment is stripped off by the "mkbuiltin.c" program.
9 #
10 set prog {
11 package require Tk
12
--- src/diff.tcl
+++ src/diff.tcl
@@ -1,11 +1,11 @@
1 # The "diff --tk" command outputs prepends a "set fossilcmd {...}" line
2 # to this file, then runs this file using "tclsh" in order to display the
3 # graphical diff in a separate window. A typical "set fossilcmd" line
4 # looks like this:
5 #
6 # set fossilcmd {| "./fossil" diff --tcl -i -v}
7 #
8 # This header comment is stripped off by the "mkbuiltin.c" program.
9 #
10 set prog {
11 package require Tk
12
+1 -1
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -1266,11 +1266,11 @@
12661266
** -n|--linenum Show line numbers
12671267
** -N|--new-file Alias for --verbose
12681268
** --numstat Show only the number of added and deleted lines
12691269
** -y|--side-by-side Side-by-side diff
12701270
** --strip-trailing-cr Strip trailing CR
1271
-** --tcl Tcl-formated output used internally by --tk
1271
+** --tcl Tcl-formatted output used internally by --tk
12721272
** --tclsh PATH Tcl/Tk shell used for --tk (default: "tclsh")
12731273
** --tk Launch a Tcl/Tk GUI for display
12741274
** --to VERSION Select VERSION as target for the diff
12751275
** --undo Diff against the "undo" buffer
12761276
** --unified Unified diff
12771277
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -1266,11 +1266,11 @@
1266 ** -n|--linenum Show line numbers
1267 ** -N|--new-file Alias for --verbose
1268 ** --numstat Show only the number of added and deleted lines
1269 ** -y|--side-by-side Side-by-side diff
1270 ** --strip-trailing-cr Strip trailing CR
1271 ** --tcl Tcl-formated output used internally by --tk
1272 ** --tclsh PATH Tcl/Tk shell used for --tk (default: "tclsh")
1273 ** --tk Launch a Tcl/Tk GUI for display
1274 ** --to VERSION Select VERSION as target for the diff
1275 ** --undo Diff against the "undo" buffer
1276 ** --unified Unified diff
1277
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -1266,11 +1266,11 @@
1266 ** -n|--linenum Show line numbers
1267 ** -N|--new-file Alias for --verbose
1268 ** --numstat Show only the number of added and deleted lines
1269 ** -y|--side-by-side Side-by-side diff
1270 ** --strip-trailing-cr Strip trailing CR
1271 ** --tcl Tcl-formatted output used internally by --tk
1272 ** --tclsh PATH Tcl/Tk shell used for --tk (default: "tclsh")
1273 ** --tk Launch a Tcl/Tk GUI for display
1274 ** --to VERSION Select VERSION as target for the diff
1275 ** --undo Diff against the "undo" buffer
1276 ** --unified Unified diff
1277
+26 -1
--- src/dispatch.c
+++ src/dispatch.c
@@ -1307,17 +1307,42 @@
13071307
}
13081308
13091309
/*
13101310
** Return a pointer to the setting information array.
13111311
**
1312
-** This routine provides access to the aSetting2[] array which is created
1312
+** This routine provides access to the aSetting[] array which is created
13131313
** by the mkindex utility program and included with <page_index.h>.
13141314
*/
13151315
const Setting *setting_info(int *pnCount){
13161316
if( pnCount ) *pnCount = (int)(sizeof(aSetting)/sizeof(aSetting[0])) - 1;
13171317
return aSetting;
13181318
}
1319
+
1320
+/*
1321
+** Return a pointer to a specific Setting entry for the setting named
1322
+** in the argument. Or return NULL if no such setting exists.
1323
+**
1324
+** The pointer returned points into the middle of the global aSetting[]
1325
+** array that is generated by mkindex. Use setting_info() to fetch the
1326
+** whole array. Use this routine to fetch a specific entry.
1327
+*/
1328
+const Setting *setting_find(const char *zName){
1329
+ int iFirst = 0;
1330
+ int iLast = ArraySize(aSetting)-1;
1331
+ while( iFirst<=iLast ){
1332
+ int iCur = (iFirst+iLast)/2;
1333
+ int c = strcmp(aSetting[iCur].name, zName);
1334
+ if( c<0 ){
1335
+ iFirst = iCur+1;
1336
+ }else if( c>0 ){
1337
+ iLast = iCur-1;
1338
+ }else{
1339
+ return &aSetting[iCur];
1340
+ }
1341
+ }
1342
+ return 0;
1343
+}
13191344
13201345
/*****************************************************************************
13211346
** A virtual table for accessing the information in aCommand[], and
13221347
** especially the help-text
13231348
*/
13241349
--- src/dispatch.c
+++ src/dispatch.c
@@ -1307,17 +1307,42 @@
1307 }
1308
1309 /*
1310 ** Return a pointer to the setting information array.
1311 **
1312 ** This routine provides access to the aSetting2[] array which is created
1313 ** by the mkindex utility program and included with <page_index.h>.
1314 */
1315 const Setting *setting_info(int *pnCount){
1316 if( pnCount ) *pnCount = (int)(sizeof(aSetting)/sizeof(aSetting[0])) - 1;
1317 return aSetting;
1318 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1319
1320 /*****************************************************************************
1321 ** A virtual table for accessing the information in aCommand[], and
1322 ** especially the help-text
1323 */
1324
--- src/dispatch.c
+++ src/dispatch.c
@@ -1307,17 +1307,42 @@
1307 }
1308
1309 /*
1310 ** Return a pointer to the setting information array.
1311 **
1312 ** This routine provides access to the aSetting[] array which is created
1313 ** by the mkindex utility program and included with <page_index.h>.
1314 */
1315 const Setting *setting_info(int *pnCount){
1316 if( pnCount ) *pnCount = (int)(sizeof(aSetting)/sizeof(aSetting[0])) - 1;
1317 return aSetting;
1318 }
1319
1320 /*
1321 ** Return a pointer to a specific Setting entry for the setting named
1322 ** in the argument. Or return NULL if no such setting exists.
1323 **
1324 ** The pointer returned points into the middle of the global aSetting[]
1325 ** array that is generated by mkindex. Use setting_info() to fetch the
1326 ** whole array. Use this routine to fetch a specific entry.
1327 */
1328 const Setting *setting_find(const char *zName){
1329 int iFirst = 0;
1330 int iLast = ArraySize(aSetting)-1;
1331 while( iFirst<=iLast ){
1332 int iCur = (iFirst+iLast)/2;
1333 int c = strcmp(aSetting[iCur].name, zName);
1334 if( c<0 ){
1335 iFirst = iCur+1;
1336 }else if( c>0 ){
1337 iLast = iCur-1;
1338 }else{
1339 return &aSetting[iCur];
1340 }
1341 }
1342 return 0;
1343 }
1344
1345 /*****************************************************************************
1346 ** A virtual table for accessing the information in aCommand[], and
1347 ** especially the help-text
1348 */
1349
+1 -1
--- src/event.c
+++ src/event.c
@@ -229,11 +229,11 @@
229229
}
230230
zFullId = db_text(0, "SELECT SUBSTR(tagname,7)"
231231
" FROM tag"
232232
" WHERE tagname GLOB 'event-%q*'",
233233
zId);
234
- attachment_list(zFullId, "<hr><h2>Attachments:</h2><ul>");
234
+ attachment_list(zFullId, "<h2>Attachments:</h2>", 1);
235235
document_emit_js();
236236
style_finish_page();
237237
manifest_destroy(pTNote);
238238
}
239239
240240
--- src/event.c
+++ src/event.c
@@ -229,11 +229,11 @@
229 }
230 zFullId = db_text(0, "SELECT SUBSTR(tagname,7)"
231 " FROM tag"
232 " WHERE tagname GLOB 'event-%q*'",
233 zId);
234 attachment_list(zFullId, "<hr><h2>Attachments:</h2><ul>");
235 document_emit_js();
236 style_finish_page();
237 manifest_destroy(pTNote);
238 }
239
240
--- src/event.c
+++ src/event.c
@@ -229,11 +229,11 @@
229 }
230 zFullId = db_text(0, "SELECT SUBSTR(tagname,7)"
231 " FROM tag"
232 " WHERE tagname GLOB 'event-%q*'",
233 zId);
234 attachment_list(zFullId, "<h2>Attachments:</h2>", 1);
235 document_emit_js();
236 style_finish_page();
237 manifest_destroy(pTNote);
238 }
239
240
+90 -8
--- src/file.c
+++ src/file.c
@@ -1302,25 +1302,37 @@
13021302
}
13031303
}
13041304
13051305
/*
13061306
** Compute a canonical pathname for a file or directory.
1307
-** Make the name absolute if it is relative.
1308
-** Remove redundant / characters
1309
-** Remove all /./ path elements.
1310
-** Convert /A/../ to just /
1307
+**
1308
+** * Make the name absolute if it is relative.
1309
+** * Remove redundant / characters
1310
+** * Remove all /./ path elements.
1311
+** * Convert /A/../ to just /
1312
+** * On windows, add the drive letter prefix.
1313
+**
13111314
** If the slash parameter is non-zero, the trailing slash, if any,
13121315
** is retained.
13131316
**
13141317
** See also: file_canonical_name_dup()
13151318
*/
13161319
void file_canonical_name(const char *zOrigName, Blob *pOut, int slash){
1320
+ char zPwd[2000];
13171321
blob_zero(pOut);
13181322
if( file_is_absolute_path(zOrigName) ){
1319
- blob_appendf(pOut, "%/", zOrigName);
1323
+#if defined(_WIN32)
1324
+ if( fossil_isdirsep(zOrigName[0]) ){
1325
+ /* Add the drive letter to the full pathname */
1326
+ file_getcwd(zPwd, sizeof(zPwd)-strlen(zOrigName));
1327
+ blob_appendf(pOut, "%.2s%/", zPwd, zOrigName);
1328
+ }else
1329
+#endif
1330
+ {
1331
+ blob_appendf(pOut, "%/", zOrigName);
1332
+ }
13201333
}else{
1321
- char zPwd[2000];
13221334
file_getcwd(zPwd, sizeof(zPwd)-strlen(zOrigName));
13231335
if( zPwd[0]=='/' && strlen(zPwd)==1 ){
13241336
/* when on '/', don't add an extra '/' */
13251337
if( zOrigName[0]=='.' && strlen(zOrigName)==1 ){
13261338
/* '.' when on '/' mean '/' */
@@ -1644,10 +1656,13 @@
16441656
g.allowSymlinks = !is_false(zAllow);
16451657
}
16461658
if( zRoot==0 ) zRoot = g.zLocalRoot==0 ? "" : g.zLocalRoot;
16471659
fossil_print("db_allow_symlinks() = %d\n", db_allow_symlinks());
16481660
fossil_print("local-root = [%s]\n", zRoot);
1661
+ if( g.db==0 ) sqlite3_open(":memory:", &g.db);
1662
+ sqlite3_create_function(g.db, "inode", 1, SQLITE_UTF8, 0,
1663
+ file_inode_sql_func, 0, 0);
16491664
for(i=2; i<g.argc; i++){
16501665
char *z;
16511666
emitFileStat(g.argv[i], slashFlag, resetFlag);
16521667
z = file_canonical_name_dup(g.argv[i]);
16531668
fossil_print(" file_canonical_name = %s\n", z);
@@ -1657,10 +1672,13 @@
16571672
}else{
16581673
int n = file_nondir_objects_on_path(zRoot, z);
16591674
fossil_print("%.*s\n", n, z);
16601675
}
16611676
fossil_free(z);
1677
+ z = db_text(0, "SELECT inode(%Q)", g.argv[i]);
1678
+ fossil_print(" file_inode_sql_func = \"%s\"\n", z);
1679
+ fossil_free(z);
16621680
}
16631681
}
16641682
16651683
/*
16661684
** COMMAND: test-canonical-name
@@ -1699,13 +1717,15 @@
16991717
** Canonical names are full pathnames using "/" not "\" and which
17001718
** contain no "/./" or "/../" terms.
17011719
*/
17021720
int file_is_canonical(const char *z){
17031721
int i;
1704
- if( z[0]!='/'
1722
+ if(
17051723
#if defined(_WIN32) || defined(__CYGWIN__)
1706
- && (!fossil_isupper(z[0]) || z[1]!=':' || z[2]!='/')
1724
+ !fossil_isupper(z[0]) || z[1]!=':' || !fossil_isdirsep(z[2])
1725
+#else
1726
+ z[0]!='/'
17071727
#endif
17081728
) return 0;
17091729
17101730
for(i=0; z[i]; i++){
17111731
if( z[i]=='\\' ) return 0;
@@ -2966,5 +2986,67 @@
29662986
}
29672987
}
29682988
fossil_free(zCkoutDb);
29692989
return rc;
29702990
}
2991
+
2992
+/*
2993
+** This is the implementation of inode(FILENAME) SQL function.
2994
+**
2995
+** dev_inode(FILENAME) returns a string. If FILENAME exists and is
2996
+** a regular file, then the return string is of the form:
2997
+**
2998
+** DEV/INODE
2999
+**
3000
+** Where DEV and INODE are the device number and inode number for
3001
+** the file. On Windows, the volume serial number (DEV) and file
3002
+** identifier (INODE) are used to compute the value, see comments
3003
+** on the win32_file_id() function.
3004
+**
3005
+** If FILENAME does not exist, then the return is an empty string.
3006
+**
3007
+** The value of inode() can be used to eliminate files from a list
3008
+** that have duplicates because they have differing names due to links.
3009
+**
3010
+** Code that wants to use this SQL function needs to first register
3011
+** it using a call such as the following:
3012
+**
3013
+** sqlite3_create_function(g.db, "inode", 1, SQLITE_UTF8, 0,
3014
+** file_inode_sql_func, 0, 0);
3015
+*/
3016
+void file_inode_sql_func(
3017
+ sqlite3_context *context,
3018
+ int argc,
3019
+ sqlite3_value **argv
3020
+){
3021
+ const char *zFilename;
3022
+ assert( argc==1 );
3023
+ zFilename = (const char*)sqlite3_value_text(argv[0]);
3024
+ if( zFilename==0 || zFilename[0]==0 || file_access(zFilename,F_OK) ){
3025
+ sqlite3_result_text(context, "", 0, SQLITE_STATIC);
3026
+ return;
3027
+ }
3028
+#if defined(_WIN32)
3029
+ {
3030
+ char *zFileId = win32_file_id(zFilename);
3031
+ if( zFileId ){
3032
+ sqlite3_result_text(context, zFileId, -1, fossil_free);
3033
+ }else{
3034
+ sqlite3_result_text(context, "", 0, SQLITE_STATIC);
3035
+ }
3036
+ }
3037
+#else
3038
+ {
3039
+ struct stat buf;
3040
+ int rc;
3041
+ memset(&buf, 0, sizeof(buf));
3042
+ rc = stat(zFilename, &buf);
3043
+ if( rc ){
3044
+ sqlite3_result_text(context, "", 0, SQLITE_STATIC);
3045
+ }else{
3046
+ sqlite3_result_text(context,
3047
+ mprintf("%lld/%lld", (i64)buf.st_dev, (i64)buf.st_ino), -1,
3048
+ fossil_free);
3049
+ }
3050
+ }
3051
+#endif
3052
+}
29713053
--- src/file.c
+++ src/file.c
@@ -1302,25 +1302,37 @@
1302 }
1303 }
1304
1305 /*
1306 ** Compute a canonical pathname for a file or directory.
1307 ** Make the name absolute if it is relative.
1308 ** Remove redundant / characters
1309 ** Remove all /./ path elements.
1310 ** Convert /A/../ to just /
 
 
 
1311 ** If the slash parameter is non-zero, the trailing slash, if any,
1312 ** is retained.
1313 **
1314 ** See also: file_canonical_name_dup()
1315 */
1316 void file_canonical_name(const char *zOrigName, Blob *pOut, int slash){
 
1317 blob_zero(pOut);
1318 if( file_is_absolute_path(zOrigName) ){
1319 blob_appendf(pOut, "%/", zOrigName);
 
 
 
 
 
 
 
 
 
1320 }else{
1321 char zPwd[2000];
1322 file_getcwd(zPwd, sizeof(zPwd)-strlen(zOrigName));
1323 if( zPwd[0]=='/' && strlen(zPwd)==1 ){
1324 /* when on '/', don't add an extra '/' */
1325 if( zOrigName[0]=='.' && strlen(zOrigName)==1 ){
1326 /* '.' when on '/' mean '/' */
@@ -1644,10 +1656,13 @@
1644 g.allowSymlinks = !is_false(zAllow);
1645 }
1646 if( zRoot==0 ) zRoot = g.zLocalRoot==0 ? "" : g.zLocalRoot;
1647 fossil_print("db_allow_symlinks() = %d\n", db_allow_symlinks());
1648 fossil_print("local-root = [%s]\n", zRoot);
 
 
 
1649 for(i=2; i<g.argc; i++){
1650 char *z;
1651 emitFileStat(g.argv[i], slashFlag, resetFlag);
1652 z = file_canonical_name_dup(g.argv[i]);
1653 fossil_print(" file_canonical_name = %s\n", z);
@@ -1657,10 +1672,13 @@
1657 }else{
1658 int n = file_nondir_objects_on_path(zRoot, z);
1659 fossil_print("%.*s\n", n, z);
1660 }
1661 fossil_free(z);
 
 
 
1662 }
1663 }
1664
1665 /*
1666 ** COMMAND: test-canonical-name
@@ -1699,13 +1717,15 @@
1699 ** Canonical names are full pathnames using "/" not "\" and which
1700 ** contain no "/./" or "/../" terms.
1701 */
1702 int file_is_canonical(const char *z){
1703 int i;
1704 if( z[0]!='/'
1705 #if defined(_WIN32) || defined(__CYGWIN__)
1706 && (!fossil_isupper(z[0]) || z[1]!=':' || z[2]!='/')
 
 
1707 #endif
1708 ) return 0;
1709
1710 for(i=0; z[i]; i++){
1711 if( z[i]=='\\' ) return 0;
@@ -2966,5 +2986,67 @@
2966 }
2967 }
2968 fossil_free(zCkoutDb);
2969 return rc;
2970 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2971
--- src/file.c
+++ src/file.c
@@ -1302,25 +1302,37 @@
1302 }
1303 }
1304
1305 /*
1306 ** Compute a canonical pathname for a file or directory.
1307 **
1308 ** * Make the name absolute if it is relative.
1309 ** * Remove redundant / characters
1310 ** * Remove all /./ path elements.
1311 ** * Convert /A/../ to just /
1312 ** * On windows, add the drive letter prefix.
1313 **
1314 ** If the slash parameter is non-zero, the trailing slash, if any,
1315 ** is retained.
1316 **
1317 ** See also: file_canonical_name_dup()
1318 */
1319 void file_canonical_name(const char *zOrigName, Blob *pOut, int slash){
1320 char zPwd[2000];
1321 blob_zero(pOut);
1322 if( file_is_absolute_path(zOrigName) ){
1323 #if defined(_WIN32)
1324 if( fossil_isdirsep(zOrigName[0]) ){
1325 /* Add the drive letter to the full pathname */
1326 file_getcwd(zPwd, sizeof(zPwd)-strlen(zOrigName));
1327 blob_appendf(pOut, "%.2s%/", zPwd, zOrigName);
1328 }else
1329 #endif
1330 {
1331 blob_appendf(pOut, "%/", zOrigName);
1332 }
1333 }else{
 
1334 file_getcwd(zPwd, sizeof(zPwd)-strlen(zOrigName));
1335 if( zPwd[0]=='/' && strlen(zPwd)==1 ){
1336 /* when on '/', don't add an extra '/' */
1337 if( zOrigName[0]=='.' && strlen(zOrigName)==1 ){
1338 /* '.' when on '/' mean '/' */
@@ -1644,10 +1656,13 @@
1656 g.allowSymlinks = !is_false(zAllow);
1657 }
1658 if( zRoot==0 ) zRoot = g.zLocalRoot==0 ? "" : g.zLocalRoot;
1659 fossil_print("db_allow_symlinks() = %d\n", db_allow_symlinks());
1660 fossil_print("local-root = [%s]\n", zRoot);
1661 if( g.db==0 ) sqlite3_open(":memory:", &g.db);
1662 sqlite3_create_function(g.db, "inode", 1, SQLITE_UTF8, 0,
1663 file_inode_sql_func, 0, 0);
1664 for(i=2; i<g.argc; i++){
1665 char *z;
1666 emitFileStat(g.argv[i], slashFlag, resetFlag);
1667 z = file_canonical_name_dup(g.argv[i]);
1668 fossil_print(" file_canonical_name = %s\n", z);
@@ -1657,10 +1672,13 @@
1672 }else{
1673 int n = file_nondir_objects_on_path(zRoot, z);
1674 fossil_print("%.*s\n", n, z);
1675 }
1676 fossil_free(z);
1677 z = db_text(0, "SELECT inode(%Q)", g.argv[i]);
1678 fossil_print(" file_inode_sql_func = \"%s\"\n", z);
1679 fossil_free(z);
1680 }
1681 }
1682
1683 /*
1684 ** COMMAND: test-canonical-name
@@ -1699,13 +1717,15 @@
1717 ** Canonical names are full pathnames using "/" not "\" and which
1718 ** contain no "/./" or "/../" terms.
1719 */
1720 int file_is_canonical(const char *z){
1721 int i;
1722 if(
1723 #if defined(_WIN32) || defined(__CYGWIN__)
1724 !fossil_isupper(z[0]) || z[1]!=':' || !fossil_isdirsep(z[2])
1725 #else
1726 z[0]!='/'
1727 #endif
1728 ) return 0;
1729
1730 for(i=0; z[i]; i++){
1731 if( z[i]=='\\' ) return 0;
@@ -2966,5 +2986,67 @@
2986 }
2987 }
2988 fossil_free(zCkoutDb);
2989 return rc;
2990 }
2991
2992 /*
2993 ** This is the implementation of inode(FILENAME) SQL function.
2994 **
2995 ** dev_inode(FILENAME) returns a string. If FILENAME exists and is
2996 ** a regular file, then the return string is of the form:
2997 **
2998 ** DEV/INODE
2999 **
3000 ** Where DEV and INODE are the device number and inode number for
3001 ** the file. On Windows, the volume serial number (DEV) and file
3002 ** identifier (INODE) are used to compute the value, see comments
3003 ** on the win32_file_id() function.
3004 **
3005 ** If FILENAME does not exist, then the return is an empty string.
3006 **
3007 ** The value of inode() can be used to eliminate files from a list
3008 ** that have duplicates because they have differing names due to links.
3009 **
3010 ** Code that wants to use this SQL function needs to first register
3011 ** it using a call such as the following:
3012 **
3013 ** sqlite3_create_function(g.db, "inode", 1, SQLITE_UTF8, 0,
3014 ** file_inode_sql_func, 0, 0);
3015 */
3016 void file_inode_sql_func(
3017 sqlite3_context *context,
3018 int argc,
3019 sqlite3_value **argv
3020 ){
3021 const char *zFilename;
3022 assert( argc==1 );
3023 zFilename = (const char*)sqlite3_value_text(argv[0]);
3024 if( zFilename==0 || zFilename[0]==0 || file_access(zFilename,F_OK) ){
3025 sqlite3_result_text(context, "", 0, SQLITE_STATIC);
3026 return;
3027 }
3028 #if defined(_WIN32)
3029 {
3030 char *zFileId = win32_file_id(zFilename);
3031 if( zFileId ){
3032 sqlite3_result_text(context, zFileId, -1, fossil_free);
3033 }else{
3034 sqlite3_result_text(context, "", 0, SQLITE_STATIC);
3035 }
3036 }
3037 #else
3038 {
3039 struct stat buf;
3040 int rc;
3041 memset(&buf, 0, sizeof(buf));
3042 rc = stat(zFilename, &buf);
3043 if( rc ){
3044 sqlite3_result_text(context, "", 0, SQLITE_STATIC);
3045 }else{
3046 sqlite3_result_text(context,
3047 mprintf("%lld/%lld", (i64)buf.st_dev, (i64)buf.st_ino), -1,
3048 fossil_free);
3049 }
3050 }
3051 #endif
3052 }
3053
+60 -33
--- src/forum.c
+++ src/forum.c
@@ -1761,20 +1761,35 @@
17611761
@ </form>
17621762
forum_emit_js();
17631763
style_finish_page();
17641764
}
17651765
1766
+/*
1767
+** SETTING: forum-close-policy boolean default=off
1768
+** If true, forum moderators may close/re-open forum posts, and reply
1769
+** to closed posts. If false, only administrators may do so. Note that
1770
+** this only affects the forum web UI, not post-closing tags which
1771
+** arrive via the command-line or from synchronization with a remote.
1772
+*/
1773
+/*
1774
+** SETTING: forum-title width=20 default=Forum
1775
+** This is the name or "title" of the Forum for this repository. The
1776
+** default is just "Forum". But in some setups, admins might want to
1777
+** change it to "Developer Forum" or "User Forum" or whatever other name
1778
+** seems more appropriate for the particular usage.
1779
+*/
1780
+
17661781
/*
17671782
** WEBPAGE: setup_forum
17681783
**
17691784
** Forum configuration and metrics.
17701785
*/
17711786
void forum_setup(void){
17721787
/* boolean config settings specific to the forum. */
1773
- const char * zSettingsBool[] = {
1774
- "forum-close-policy",
1775
- NULL /* sentinel entry */
1788
+ static const char *azForumSettings[] = {
1789
+ "forum-close-policy",
1790
+ "forum-title",
17761791
};
17771792
17781793
login_check_credentials();
17791794
if( !g.perm.Setup ){
17801795
login_needed(g.anon.Setup);
@@ -1789,45 +1804,40 @@
17891804
@ <p><a href='%R/forum'>Forum posts</a>:
17901805
@ <a href='%R/timeline?y=f'>%d(nPosts)</a></p>
17911806
}
17921807
17931808
@ <h2>Supervisors</h2>
1794
- @ <p>Users with capabilities 's', 'a', or '6'.</p>
17951809
{
17961810
Stmt q = empty_Stmt;
1797
- int nRows = 0;
17981811
db_prepare(&q, "SELECT uid, login, cap FROM user "
17991812
"WHERE cap GLOB '*[as6]*' ORDER BY login");
18001813
@ <table class='bordered'>
18011814
@ <thead><tr><th>User</th><th>Capabilities</th></tr></thead>
18021815
@ <tbody>
18031816
while( SQLITE_ROW==db_step(&q) ){
18041817
const int iUid = db_column_int(&q, 0);
18051818
const char *zUser = db_column_text(&q, 1);
18061819
const char *zCap = db_column_text(&q, 2);
1807
- ++nRows;
18081820
@ <tr>
18091821
@ <td><a href='%R/setup_uedit?id=%d(iUid)'>%h(zUser)</a></td>
18101822
@ <td>(%h(zCap))</td>
18111823
@ </tr>
18121824
}
18131825
db_finalize(&q);
18141826
@</tbody></table>
1815
- if( 0==nRows ){
1816
- @ No supervisors
1817
- }else{
1818
- @ %d(nRows) supervisor(s)
1819
- }
18201827
}
18211828
18221829
@ <h2>Moderators</h2>
1823
- @ <p>Users with capability '5'.</p>
1824
- {
1830
+ if( db_int(0, "SELECT count(*) FROM user "
1831
+ " WHERE cap GLOB '*5*' AND cap NOT GLOB '*[as6]*'")==0 ){
1832
+ @ <p>No non-supervisor moderators
1833
+ }else{
18251834
Stmt q = empty_Stmt;
18261835
int nRows = 0;
18271836
db_prepare(&q, "SELECT uid, login, cap FROM user "
1828
- "WHERE cap GLOB '*5*' ORDER BY login");
1837
+ "WHERE cap GLOB '*5*' AND cap NOT GLOB '*[as6]*'"
1838
+ " ORDER BY login");
18291839
@ <table class='bordered'>
18301840
@ <thead><tr><th>User</th><th>Capabilities</th></tr></thead>
18311841
@ <tbody>
18321842
while( SQLITE_ROW==db_step(&q) ){
18331843
const int iUid = db_column_int(&q, 0);
@@ -1839,43 +1849,59 @@
18391849
@ <td>(%h(zCap))</td>
18401850
@ </tr>
18411851
}
18421852
db_finalize(&q);
18431853
@ </tbody></table>
1844
- if( 0==nRows ){
1845
- @ No non-supervisor moderators
1846
- }else{
1847
- @ %d(nRows) moderator(s)
1848
- }
18491854
}
18501855
18511856
@ <h2>Settings</h2>
1852
- @ <p>Configuration settings specific to the forum.</p>
18531857
if( P("submit") && cgi_csrf_safe(2) ){
18541858
int i = 0;
1855
- const char *zSetting;
18561859
db_begin_transaction();
1857
- while( (zSetting = zSettingsBool[i++]) ){
1858
- const char *z = P(zSetting);
1859
- if( !z || !z[0] ) z = "off";
1860
- db_set(zSetting/*works-like:"x"*/, z, 0);
1860
+ for(i=0; i<ArraySize(azForumSettings); i++){
1861
+ char zQP[4];
1862
+ const char *z;
1863
+ const Setting *pSetting = setting_find(azForumSettings[i]);
1864
+ if( pSetting==0 ) continue;
1865
+ zQP[0] = 'a'+i;
1866
+ zQP[1] = zQP[0];
1867
+ zQP[2] = 0;
1868
+ z = P(zQP);
1869
+ if( z==0 || z[0]==0 ) continue;
1870
+ db_set(pSetting->name/*works-like:"x"*/, z, 0);
18611871
}
18621872
db_end_transaction(0);
18631873
@ <p><em>Settings saved.</em></p>
18641874
}
18651875
{
18661876
int i = 0;
1867
- const char *zSetting;
18681877
@ <form action="%R/setup_forum" method="post">
18691878
login_insert_csrf_secret();
18701879
@ <table class='forum-settings-list'><tbody>
1871
- while( (zSetting = zSettingsBool[i++]) ){
1872
- @ <tr><td>
1873
- onoff_attribute("", zSetting, zSetting/*works-like:"x"*/, 0, 0);
1874
- @ </td><td>
1875
- @ <a href='%R/help?cmd=%h(zSetting)'>%h(zSetting)</a>
1876
- @ </td></tr>
1880
+ for(i=0; i<ArraySize(azForumSettings); i++){
1881
+ char zQP[4];
1882
+ const Setting *pSetting = setting_find(azForumSettings[i]);
1883
+ if( pSetting==0 ) continue;
1884
+ zQP[0] = 'a'+i;
1885
+ zQP[1] = zQP[0];
1886
+ zQP[2] = 0;
1887
+ if( pSetting->width==0 ){
1888
+ /* Boolean setting */
1889
+ @ <tr><td align="right">
1890
+ @ <a href='%R/help?cmd=%h(pSetting->name)'>%h(pSetting->name)</a>:
1891
+ @ </td><td>
1892
+ onoff_attribute("", zQP, pSetting->name/*works-like:"x"*/, 0, 0);
1893
+ @ </td></tr>
1894
+ }else{
1895
+ /* Text value setting */
1896
+ @ <tr><td align="right">
1897
+ @ <a href='%R/help?cmd=%h(pSetting->name)'>%h(pSetting->name)</a>:
1898
+ @ </td><td>
1899
+ entry_attribute("", 25, pSetting->name, zQP/*works-like:""*/,
1900
+ pSetting->def, 0);
1901
+ @ </td></tr>
1902
+ }
18771903
}
18781904
@ </tbody></table>
18791905
@ <input type='submit' name='submit' value='Apply changes'>
18801906
@ </form>
18811907
}
@@ -1910,11 +1936,12 @@
19101936
login_needed(g.anon.RdForum);
19111937
return;
19121938
}
19131939
cgi_check_for_malice();
19141940
style_set_current_feature("forum");
1915
- style_header( "%s", isSearch ? "Forum Search Results" : "Forum" );
1941
+ style_header("%s%s", db_get("forum-title","Forum"),
1942
+ isSearch ? " Search Results" : "");
19161943
style_submenu_element("Timeline", "%R/timeline?ss=v&y=f&vfx");
19171944
if( g.perm.WrForum ){
19181945
style_submenu_element("New Thread","%R/forumnew");
19191946
}else{
19201947
/* Can't combine this with previous case using the ternary operator
19211948
--- src/forum.c
+++ src/forum.c
@@ -1761,20 +1761,35 @@
1761 @ </form>
1762 forum_emit_js();
1763 style_finish_page();
1764 }
1765
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1766 /*
1767 ** WEBPAGE: setup_forum
1768 **
1769 ** Forum configuration and metrics.
1770 */
1771 void forum_setup(void){
1772 /* boolean config settings specific to the forum. */
1773 const char * zSettingsBool[] = {
1774 "forum-close-policy",
1775 NULL /* sentinel entry */
1776 };
1777
1778 login_check_credentials();
1779 if( !g.perm.Setup ){
1780 login_needed(g.anon.Setup);
@@ -1789,45 +1804,40 @@
1789 @ <p><a href='%R/forum'>Forum posts</a>:
1790 @ <a href='%R/timeline?y=f'>%d(nPosts)</a></p>
1791 }
1792
1793 @ <h2>Supervisors</h2>
1794 @ <p>Users with capabilities 's', 'a', or '6'.</p>
1795 {
1796 Stmt q = empty_Stmt;
1797 int nRows = 0;
1798 db_prepare(&q, "SELECT uid, login, cap FROM user "
1799 "WHERE cap GLOB '*[as6]*' ORDER BY login");
1800 @ <table class='bordered'>
1801 @ <thead><tr><th>User</th><th>Capabilities</th></tr></thead>
1802 @ <tbody>
1803 while( SQLITE_ROW==db_step(&q) ){
1804 const int iUid = db_column_int(&q, 0);
1805 const char *zUser = db_column_text(&q, 1);
1806 const char *zCap = db_column_text(&q, 2);
1807 ++nRows;
1808 @ <tr>
1809 @ <td><a href='%R/setup_uedit?id=%d(iUid)'>%h(zUser)</a></td>
1810 @ <td>(%h(zCap))</td>
1811 @ </tr>
1812 }
1813 db_finalize(&q);
1814 @</tbody></table>
1815 if( 0==nRows ){
1816 @ No supervisors
1817 }else{
1818 @ %d(nRows) supervisor(s)
1819 }
1820 }
1821
1822 @ <h2>Moderators</h2>
1823 @ <p>Users with capability '5'.</p>
1824 {
 
 
1825 Stmt q = empty_Stmt;
1826 int nRows = 0;
1827 db_prepare(&q, "SELECT uid, login, cap FROM user "
1828 "WHERE cap GLOB '*5*' ORDER BY login");
 
1829 @ <table class='bordered'>
1830 @ <thead><tr><th>User</th><th>Capabilities</th></tr></thead>
1831 @ <tbody>
1832 while( SQLITE_ROW==db_step(&q) ){
1833 const int iUid = db_column_int(&q, 0);
@@ -1839,43 +1849,59 @@
1839 @ <td>(%h(zCap))</td>
1840 @ </tr>
1841 }
1842 db_finalize(&q);
1843 @ </tbody></table>
1844 if( 0==nRows ){
1845 @ No non-supervisor moderators
1846 }else{
1847 @ %d(nRows) moderator(s)
1848 }
1849 }
1850
1851 @ <h2>Settings</h2>
1852 @ <p>Configuration settings specific to the forum.</p>
1853 if( P("submit") && cgi_csrf_safe(2) ){
1854 int i = 0;
1855 const char *zSetting;
1856 db_begin_transaction();
1857 while( (zSetting = zSettingsBool[i++]) ){
1858 const char *z = P(zSetting);
1859 if( !z || !z[0] ) z = "off";
1860 db_set(zSetting/*works-like:"x"*/, z, 0);
 
 
 
 
 
 
 
1861 }
1862 db_end_transaction(0);
1863 @ <p><em>Settings saved.</em></p>
1864 }
1865 {
1866 int i = 0;
1867 const char *zSetting;
1868 @ <form action="%R/setup_forum" method="post">
1869 login_insert_csrf_secret();
1870 @ <table class='forum-settings-list'><tbody>
1871 while( (zSetting = zSettingsBool[i++]) ){
1872 @ <tr><td>
1873 onoff_attribute("", zSetting, zSetting/*works-like:"x"*/, 0, 0);
1874 @ </td><td>
1875 @ <a href='%R/help?cmd=%h(zSetting)'>%h(zSetting)</a>
1876 @ </td></tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1877 }
1878 @ </tbody></table>
1879 @ <input type='submit' name='submit' value='Apply changes'>
1880 @ </form>
1881 }
@@ -1910,11 +1936,12 @@
1910 login_needed(g.anon.RdForum);
1911 return;
1912 }
1913 cgi_check_for_malice();
1914 style_set_current_feature("forum");
1915 style_header( "%s", isSearch ? "Forum Search Results" : "Forum" );
 
1916 style_submenu_element("Timeline", "%R/timeline?ss=v&y=f&vfx");
1917 if( g.perm.WrForum ){
1918 style_submenu_element("New Thread","%R/forumnew");
1919 }else{
1920 /* Can't combine this with previous case using the ternary operator
1921
--- src/forum.c
+++ src/forum.c
@@ -1761,20 +1761,35 @@
1761 @ </form>
1762 forum_emit_js();
1763 style_finish_page();
1764 }
1765
1766 /*
1767 ** SETTING: forum-close-policy boolean default=off
1768 ** If true, forum moderators may close/re-open forum posts, and reply
1769 ** to closed posts. If false, only administrators may do so. Note that
1770 ** this only affects the forum web UI, not post-closing tags which
1771 ** arrive via the command-line or from synchronization with a remote.
1772 */
1773 /*
1774 ** SETTING: forum-title width=20 default=Forum
1775 ** This is the name or "title" of the Forum for this repository. The
1776 ** default is just "Forum". But in some setups, admins might want to
1777 ** change it to "Developer Forum" or "User Forum" or whatever other name
1778 ** seems more appropriate for the particular usage.
1779 */
1780
1781 /*
1782 ** WEBPAGE: setup_forum
1783 **
1784 ** Forum configuration and metrics.
1785 */
1786 void forum_setup(void){
1787 /* boolean config settings specific to the forum. */
1788 static const char *azForumSettings[] = {
1789 "forum-close-policy",
1790 "forum-title",
1791 };
1792
1793 login_check_credentials();
1794 if( !g.perm.Setup ){
1795 login_needed(g.anon.Setup);
@@ -1789,45 +1804,40 @@
1804 @ <p><a href='%R/forum'>Forum posts</a>:
1805 @ <a href='%R/timeline?y=f'>%d(nPosts)</a></p>
1806 }
1807
1808 @ <h2>Supervisors</h2>
 
1809 {
1810 Stmt q = empty_Stmt;
 
1811 db_prepare(&q, "SELECT uid, login, cap FROM user "
1812 "WHERE cap GLOB '*[as6]*' ORDER BY login");
1813 @ <table class='bordered'>
1814 @ <thead><tr><th>User</th><th>Capabilities</th></tr></thead>
1815 @ <tbody>
1816 while( SQLITE_ROW==db_step(&q) ){
1817 const int iUid = db_column_int(&q, 0);
1818 const char *zUser = db_column_text(&q, 1);
1819 const char *zCap = db_column_text(&q, 2);
 
1820 @ <tr>
1821 @ <td><a href='%R/setup_uedit?id=%d(iUid)'>%h(zUser)</a></td>
1822 @ <td>(%h(zCap))</td>
1823 @ </tr>
1824 }
1825 db_finalize(&q);
1826 @</tbody></table>
 
 
 
 
 
1827 }
1828
1829 @ <h2>Moderators</h2>
1830 if( db_int(0, "SELECT count(*) FROM user "
1831 " WHERE cap GLOB '*5*' AND cap NOT GLOB '*[as6]*'")==0 ){
1832 @ <p>No non-supervisor moderators
1833 }else{
1834 Stmt q = empty_Stmt;
1835 int nRows = 0;
1836 db_prepare(&q, "SELECT uid, login, cap FROM user "
1837 "WHERE cap GLOB '*5*' AND cap NOT GLOB '*[as6]*'"
1838 " ORDER BY login");
1839 @ <table class='bordered'>
1840 @ <thead><tr><th>User</th><th>Capabilities</th></tr></thead>
1841 @ <tbody>
1842 while( SQLITE_ROW==db_step(&q) ){
1843 const int iUid = db_column_int(&q, 0);
@@ -1839,43 +1849,59 @@
1849 @ <td>(%h(zCap))</td>
1850 @ </tr>
1851 }
1852 db_finalize(&q);
1853 @ </tbody></table>
 
 
 
 
 
1854 }
1855
1856 @ <h2>Settings</h2>
 
1857 if( P("submit") && cgi_csrf_safe(2) ){
1858 int i = 0;
 
1859 db_begin_transaction();
1860 for(i=0; i<ArraySize(azForumSettings); i++){
1861 char zQP[4];
1862 const char *z;
1863 const Setting *pSetting = setting_find(azForumSettings[i]);
1864 if( pSetting==0 ) continue;
1865 zQP[0] = 'a'+i;
1866 zQP[1] = zQP[0];
1867 zQP[2] = 0;
1868 z = P(zQP);
1869 if( z==0 || z[0]==0 ) continue;
1870 db_set(pSetting->name/*works-like:"x"*/, z, 0);
1871 }
1872 db_end_transaction(0);
1873 @ <p><em>Settings saved.</em></p>
1874 }
1875 {
1876 int i = 0;
 
1877 @ <form action="%R/setup_forum" method="post">
1878 login_insert_csrf_secret();
1879 @ <table class='forum-settings-list'><tbody>
1880 for(i=0; i<ArraySize(azForumSettings); i++){
1881 char zQP[4];
1882 const Setting *pSetting = setting_find(azForumSettings[i]);
1883 if( pSetting==0 ) continue;
1884 zQP[0] = 'a'+i;
1885 zQP[1] = zQP[0];
1886 zQP[2] = 0;
1887 if( pSetting->width==0 ){
1888 /* Boolean setting */
1889 @ <tr><td align="right">
1890 @ <a href='%R/help?cmd=%h(pSetting->name)'>%h(pSetting->name)</a>:
1891 @ </td><td>
1892 onoff_attribute("", zQP, pSetting->name/*works-like:"x"*/, 0, 0);
1893 @ </td></tr>
1894 }else{
1895 /* Text value setting */
1896 @ <tr><td align="right">
1897 @ <a href='%R/help?cmd=%h(pSetting->name)'>%h(pSetting->name)</a>:
1898 @ </td><td>
1899 entry_attribute("", 25, pSetting->name, zQP/*works-like:""*/,
1900 pSetting->def, 0);
1901 @ </td></tr>
1902 }
1903 }
1904 @ </tbody></table>
1905 @ <input type='submit' name='submit' value='Apply changes'>
1906 @ </form>
1907 }
@@ -1910,11 +1936,12 @@
1936 login_needed(g.anon.RdForum);
1937 return;
1938 }
1939 cgi_check_for_malice();
1940 style_set_current_feature("forum");
1941 style_header("%s%s", db_get("forum-title","Forum"),
1942 isSearch ? " Search Results" : "");
1943 style_submenu_element("Timeline", "%R/timeline?ss=v&y=f&vfx");
1944 if( g.perm.WrForum ){
1945 style_submenu_element("New Thread","%R/forumnew");
1946 }else{
1947 /* Can't combine this with previous case using the ternary operator
1948
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -2132,11 +2132,11 @@
21322132
s.value ? 'add' : 'remove'
21332133
]('compact');
21342134
Chat.e.inputFields[Chat.e.inputFields.$currentIndex].focus();
21352135
});
21362136
Chat.settings.addListener('edit-ctrl-send',function(s){
2137
- const label = (s.value ? "Ctrl-" : "")+"Enter submits message";
2137
+ const label = (s.value ? "Ctrl-" : "")+"Enter submits message.";
21382138
Chat.e.inputFields.forEach((e)=>{
21392139
const v = e.dataset.placeholder0 + " " +label;
21402140
if(e.isContentEditable) e.dataset.placeholder = v;
21412141
else D.attr(e,'placeholder',v);
21422142
});
21432143
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -2132,11 +2132,11 @@
2132 s.value ? 'add' : 'remove'
2133 ]('compact');
2134 Chat.e.inputFields[Chat.e.inputFields.$currentIndex].focus();
2135 });
2136 Chat.settings.addListener('edit-ctrl-send',function(s){
2137 const label = (s.value ? "Ctrl-" : "")+"Enter submits message";
2138 Chat.e.inputFields.forEach((e)=>{
2139 const v = e.dataset.placeholder0 + " " +label;
2140 if(e.isContentEditable) e.dataset.placeholder = v;
2141 else D.attr(e,'placeholder',v);
2142 });
2143
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -2132,11 +2132,11 @@
2132 s.value ? 'add' : 'remove'
2133 ]('compact');
2134 Chat.e.inputFields[Chat.e.inputFields.$currentIndex].focus();
2135 });
2136 Chat.settings.addListener('edit-ctrl-send',function(s){
2137 const label = (s.value ? "Ctrl-" : "")+"Enter submits message.";
2138 Chat.e.inputFields.forEach((e)=>{
2139 const v = e.dataset.placeholder0 + " " +label;
2140 if(e.isContentEditable) e.dataset.placeholder = v;
2141 else D.attr(e,'placeholder',v);
2142 });
2143
+2
--- src/http.c
+++ src/http.c
@@ -785,11 +785,13 @@
785785
zMimetype = find_option("mimetype",0,1);
786786
zOutFile = find_option("out","o",1);
787787
if( find_option("verbose","v",0)!=0 ) mHttpFlags |= HTTP_VERBOSE;
788788
if( find_option("compress",0,0)!=0 ) mHttpFlags &= ~HTTP_NOCOMPRESS;
789789
if( find_option("no-cert-verify",0,0)!=0 ){
790
+ #ifdef FOSSIL_ENABLE_SSL
790791
ssl_disable_cert_verification();
792
+ #endif
791793
}
792794
if( find_option("xfer",0,0)!=0 ){
793795
mHttpFlags |= HTTP_USE_LOGIN;
794796
mHttpFlags &= ~HTTP_GENERIC;
795797
}
796798
--- src/http.c
+++ src/http.c
@@ -785,11 +785,13 @@
785 zMimetype = find_option("mimetype",0,1);
786 zOutFile = find_option("out","o",1);
787 if( find_option("verbose","v",0)!=0 ) mHttpFlags |= HTTP_VERBOSE;
788 if( find_option("compress",0,0)!=0 ) mHttpFlags &= ~HTTP_NOCOMPRESS;
789 if( find_option("no-cert-verify",0,0)!=0 ){
 
790 ssl_disable_cert_verification();
 
791 }
792 if( find_option("xfer",0,0)!=0 ){
793 mHttpFlags |= HTTP_USE_LOGIN;
794 mHttpFlags &= ~HTTP_GENERIC;
795 }
796
--- src/http.c
+++ src/http.c
@@ -785,11 +785,13 @@
785 zMimetype = find_option("mimetype",0,1);
786 zOutFile = find_option("out","o",1);
787 if( find_option("verbose","v",0)!=0 ) mHttpFlags |= HTTP_VERBOSE;
788 if( find_option("compress",0,0)!=0 ) mHttpFlags &= ~HTTP_NOCOMPRESS;
789 if( find_option("no-cert-verify",0,0)!=0 ){
790 #ifdef FOSSIL_ENABLE_SSL
791 ssl_disable_cert_verification();
792 #endif
793 }
794 if( find_option("xfer",0,0)!=0 ){
795 mHttpFlags |= HTTP_USE_LOGIN;
796 mHttpFlags &= ~HTTP_GENERIC;
797 }
798
--- src/http_transport.c
+++ src/http_transport.c
@@ -103,11 +103,14 @@
103103
/*
104104
** Initialize a Blob to the name of the configured SSH command.
105105
*/
106106
void transport_ssh_command(Blob *p){
107107
char *zSsh; /* The base SSH command */
108
- zSsh = db_get("ssh-command", zDefaultSshCmd);
108
+ zSsh = g.zSshCmd;
109
+ if( zSsh==0 || zSsh[0]==0 ){
110
+ zSsh = db_get("ssh-command", zDefaultSshCmd);
111
+ }
109112
blob_init(p, zSsh, -1);
110113
}
111114
112115
/*
113116
** SSH initialization of the transport layer
114117
--- src/http_transport.c
+++ src/http_transport.c
@@ -103,11 +103,14 @@
103 /*
104 ** Initialize a Blob to the name of the configured SSH command.
105 */
106 void transport_ssh_command(Blob *p){
107 char *zSsh; /* The base SSH command */
108 zSsh = db_get("ssh-command", zDefaultSshCmd);
 
 
 
109 blob_init(p, zSsh, -1);
110 }
111
112 /*
113 ** SSH initialization of the transport layer
114
--- src/http_transport.c
+++ src/http_transport.c
@@ -103,11 +103,14 @@
103 /*
104 ** Initialize a Blob to the name of the configured SSH command.
105 */
106 void transport_ssh_command(Blob *p){
107 char *zSsh; /* The base SSH command */
108 zSsh = g.zSshCmd;
109 if( zSsh==0 || zSsh[0]==0 ){
110 zSsh = db_get("ssh-command", zDefaultSshCmd);
111 }
112 blob_init(p, zSsh, -1);
113 }
114
115 /*
116 ** SSH initialization of the transport layer
117
+2 -1
--- src/interwiki.c
+++ src/interwiki.c
@@ -275,13 +275,14 @@
275275
db_prepare(&q,
276276
"SELECT substr(name,11), value->>'base'"
277277
" FROM config WHERE name glob 'interwiki:*' AND json_valid(value)"
278278
" ORDER BY name;"
279279
);
280
+ blob_append(out, "<blockquote>", -1);
280281
while( db_step(&q)==SQLITE_ROW ){
281282
if( n==0 ){
282
- blob_appendf(out, "<blockquote><table>\n");
283
+ blob_appendf(out, "<table>\n");
283284
}
284285
blob_appendf(out,"<tr><td>%h</td><td>&nbsp;&rarr;&nbsp;</td>",
285286
db_column_text(&q,0));
286287
blob_appendf(out,"<td>%h</td></tr>\n",
287288
db_column_text(&q,1));
288289
--- src/interwiki.c
+++ src/interwiki.c
@@ -275,13 +275,14 @@
275 db_prepare(&q,
276 "SELECT substr(name,11), value->>'base'"
277 " FROM config WHERE name glob 'interwiki:*' AND json_valid(value)"
278 " ORDER BY name;"
279 );
 
280 while( db_step(&q)==SQLITE_ROW ){
281 if( n==0 ){
282 blob_appendf(out, "<blockquote><table>\n");
283 }
284 blob_appendf(out,"<tr><td>%h</td><td>&nbsp;&rarr;&nbsp;</td>",
285 db_column_text(&q,0));
286 blob_appendf(out,"<td>%h</td></tr>\n",
287 db_column_text(&q,1));
288
--- src/interwiki.c
+++ src/interwiki.c
@@ -275,13 +275,14 @@
275 db_prepare(&q,
276 "SELECT substr(name,11), value->>'base'"
277 " FROM config WHERE name glob 'interwiki:*' AND json_valid(value)"
278 " ORDER BY name;"
279 );
280 blob_append(out, "<blockquote>", -1);
281 while( db_step(&q)==SQLITE_ROW ){
282 if( n==0 ){
283 blob_appendf(out, "<table>\n");
284 }
285 blob_appendf(out,"<tr><td>%h</td><td>&nbsp;&rarr;&nbsp;</td>",
286 db_column_text(&q,0));
287 blob_appendf(out,"<td>%h</td></tr>\n",
288 db_column_text(&q,1));
289
+13 -1
--- src/login.c
+++ src/login.c
@@ -1302,20 +1302,32 @@
13021302
*/
13031303
void login_restrict_robot_access(void){
13041304
const char *zReferer;
13051305
const char *zGlob;
13061306
int isMatch = 1;
1307
+ int nQP; /* Number of query parameters other than name= */
13071308
if( g.zLogin!=0 ) return;
13081309
zGlob = db_get("robot-restrict",0);
13091310
if( zGlob==0 || zGlob[0]==0 ) return;
13101311
if( g.isHuman ){
13111312
zReferer = P("HTTP_REFERER");
13121313
if( zReferer && zReferer[0]!=0 ) return;
13131314
}
1314
- if( cgi_qp_count()<1 ) return;
1315
+ nQP = cgi_qp_count();
1316
+ if( nQP<1 ) return;
13151317
isMatch = glob_multi_match(zGlob, g.zPath);
13161318
if( !isMatch ) return;
1319
+
1320
+ /* Check for exceptions to the restriction on the number of query
1321
+ ** parameters. */
1322
+ zGlob = db_get("robot-restrict-qp",0);
1323
+ if( zGlob && zGlob[0] ){
1324
+ char *zPath = mprintf("%s/%d", g.zPath, nQP);
1325
+ isMatch = glob_multi_match(zGlob, zPath);
1326
+ fossil_free(zPath);
1327
+ if( isMatch ) return;
1328
+ }
13171329
13181330
/* If we reach this point, it means we have a situation where we
13191331
** want to restrict the activity of a robot.
13201332
*/
13211333
g.isHuman = 0;
13221334
--- src/login.c
+++ src/login.c
@@ -1302,20 +1302,32 @@
1302 */
1303 void login_restrict_robot_access(void){
1304 const char *zReferer;
1305 const char *zGlob;
1306 int isMatch = 1;
 
1307 if( g.zLogin!=0 ) return;
1308 zGlob = db_get("robot-restrict",0);
1309 if( zGlob==0 || zGlob[0]==0 ) return;
1310 if( g.isHuman ){
1311 zReferer = P("HTTP_REFERER");
1312 if( zReferer && zReferer[0]!=0 ) return;
1313 }
1314 if( cgi_qp_count()<1 ) return;
 
1315 isMatch = glob_multi_match(zGlob, g.zPath);
1316 if( !isMatch ) return;
 
 
 
 
 
 
 
 
 
 
1317
1318 /* If we reach this point, it means we have a situation where we
1319 ** want to restrict the activity of a robot.
1320 */
1321 g.isHuman = 0;
1322
--- src/login.c
+++ src/login.c
@@ -1302,20 +1302,32 @@
1302 */
1303 void login_restrict_robot_access(void){
1304 const char *zReferer;
1305 const char *zGlob;
1306 int isMatch = 1;
1307 int nQP; /* Number of query parameters other than name= */
1308 if( g.zLogin!=0 ) return;
1309 zGlob = db_get("robot-restrict",0);
1310 if( zGlob==0 || zGlob[0]==0 ) return;
1311 if( g.isHuman ){
1312 zReferer = P("HTTP_REFERER");
1313 if( zReferer && zReferer[0]!=0 ) return;
1314 }
1315 nQP = cgi_qp_count();
1316 if( nQP<1 ) return;
1317 isMatch = glob_multi_match(zGlob, g.zPath);
1318 if( !isMatch ) return;
1319
1320 /* Check for exceptions to the restriction on the number of query
1321 ** parameters. */
1322 zGlob = db_get("robot-restrict-qp",0);
1323 if( zGlob && zGlob[0] ){
1324 char *zPath = mprintf("%s/%d", g.zPath, nQP);
1325 isMatch = glob_multi_match(zGlob, zPath);
1326 fossil_free(zPath);
1327 if( isMatch ) return;
1328 }
1329
1330 /* If we reach this point, it means we have a situation where we
1331 ** want to restrict the activity of a robot.
1332 */
1333 g.isHuman = 0;
1334
--- src/main.mk
+++ src/main.mk
@@ -248,10 +248,11 @@
248248
$(SRCDIR)/hbmenu.js \
249249
$(SRCDIR)/href.js \
250250
$(SRCDIR)/login.js \
251251
$(SRCDIR)/markdown.md \
252252
$(SRCDIR)/menu.js \
253
+ $(SRCDIR)/merge.tcl \
253254
$(SRCDIR)/scroll.js \
254255
$(SRCDIR)/skin.js \
255256
$(SRCDIR)/sorttable.js \
256257
$(SRCDIR)/sounds/0.wav \
257258
$(SRCDIR)/sounds/1.wav \
258259
--- src/main.mk
+++ src/main.mk
@@ -248,10 +248,11 @@
248 $(SRCDIR)/hbmenu.js \
249 $(SRCDIR)/href.js \
250 $(SRCDIR)/login.js \
251 $(SRCDIR)/markdown.md \
252 $(SRCDIR)/menu.js \
 
253 $(SRCDIR)/scroll.js \
254 $(SRCDIR)/skin.js \
255 $(SRCDIR)/sorttable.js \
256 $(SRCDIR)/sounds/0.wav \
257 $(SRCDIR)/sounds/1.wav \
258
--- src/main.mk
+++ src/main.mk
@@ -248,10 +248,11 @@
248 $(SRCDIR)/hbmenu.js \
249 $(SRCDIR)/href.js \
250 $(SRCDIR)/login.js \
251 $(SRCDIR)/markdown.md \
252 $(SRCDIR)/menu.js \
253 $(SRCDIR)/merge.tcl \
254 $(SRCDIR)/scroll.js \
255 $(SRCDIR)/skin.js \
256 $(SRCDIR)/sorttable.js \
257 $(SRCDIR)/sounds/0.wav \
258 $(SRCDIR)/sounds/1.wav \
259
+456 -6
--- src/merge.c
+++ src/merge.c
@@ -20,10 +20,363 @@
2020
*/
2121
#include "config.h"
2222
#include "merge.h"
2323
#include <assert.h>
2424
25
+
26
+/*
27
+** Bring up a Tcl/Tk GUI to show details of the most recent merge.
28
+*/
29
+static void merge_info_tk(int bDark, int bAll, int nContext){
30
+ int i;
31
+ Blob script;
32
+ const char *zTempFile = 0;
33
+ char *zCmd;
34
+ const char *zTclsh;
35
+ zTclsh = find_option("tclsh",0,1);
36
+ if( zTclsh==0 ){
37
+ zTclsh = db_get("tclsh",0);
38
+ }
39
+ /* The undocumented --script FILENAME option causes the Tk script to
40
+ ** be written into the FILENAME instead of being run. This is used
41
+ ** for testing and debugging. */
42
+ zTempFile = find_option("script",0,1);
43
+ verify_all_options();
44
+
45
+ blob_zero(&script);
46
+ blob_appendf(&script, "set ncontext %d\n", nContext);
47
+ blob_appendf(&script, "set fossilcmd {| \"%/\" merge-info}\n",
48
+ g.nameOfExe);
49
+ blob_appendf(&script, "set filelist [list");
50
+ if( g.argc==2 ){
51
+ /* No files named on the command-line. Use every file mentioned
52
+ ** in the MERGESTAT table to generate the file list. */
53
+ Stmt q;
54
+ int cnt = 0;
55
+ db_prepare(&q,
56
+ "SELECT coalesce(fnr,fn), op FROM mergestat %s ORDER BY 1",
57
+ bAll ? "" : "WHERE op IN ('MERGE','CONFLICT')" /*safe-for-%s*/
58
+ );
59
+ while( db_step(&q)==SQLITE_ROW ){
60
+ blob_appendf(&script," %s ", db_column_text(&q,1));
61
+ blob_append_tcl_literal(&script, db_column_text(&q,0),
62
+ db_column_bytes(&q,0));
63
+ cnt++;
64
+ }
65
+ db_finalize(&q);
66
+ if( cnt==0 ){
67
+ fossil_print(
68
+ "No interesting changes in this merge. Use --all to see everything\n"
69
+ );
70
+ return;
71
+ }
72
+ }else{
73
+ /* Use only files named on the command-line in the file list.
74
+ ** But verify each file named is actually found in the MERGESTAT
75
+ ** table first. */
76
+ for(i=2; i<g.argc; i++){
77
+ char *zFile; /* Input filename */
78
+ char *zTreename; /* Name of the file in the tree */
79
+ Blob fname; /* Filename relative to root */
80
+ char *zOp; /* Operation on this file */
81
+ zFile = mprintf("%/", g.argv[i]);
82
+ file_tree_name(zFile, &fname, 0, 1);
83
+ fossil_free(zFile);
84
+ zTreename = blob_str(&fname);
85
+ zOp = db_text(0, "SELECT op FROM mergestat WHERE fn=%Q or fnr=%Q",
86
+ zTreename, zTreename);
87
+ blob_appendf(&script, " %s ", zOp);
88
+ fossil_free(zOp);
89
+ blob_append_tcl_literal(&script, zTreename, (int)strlen(zTreename));
90
+ blob_reset(&fname);
91
+ }
92
+ }
93
+ blob_appendf(&script, "]\n");
94
+ blob_appendf(&script, "set darkmode %d\n", bDark!=0);
95
+ blob_appendf(&script, "%s", builtin_file("merge.tcl", 0));
96
+ if( zTempFile ){
97
+ blob_write_to_file(&script, zTempFile);
98
+ fossil_print("To see the merge, run: %s \"%s\"\n", zTclsh, zTempFile);
99
+ }else{
100
+#if defined(FOSSIL_ENABLE_TCL)
101
+ Th_FossilInit(TH_INIT_DEFAULT);
102
+ if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script),
103
+ blob_size(&script), 1, 1, 0)==TCL_OK ){
104
+ blob_reset(&script);
105
+ return;
106
+ }
107
+ /*
108
+ * If evaluation of the Tcl script fails, the reason may be that Tk
109
+ * could not be found by the loaded Tcl, or that Tcl cannot be loaded
110
+ * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback
111
+ * to using the external "tclsh", if available.
112
+ */
113
+#endif
114
+ zTempFile = write_blob_to_temp_file(&script);
115
+ zCmd = mprintf("%$ %$", zTclsh, zTempFile);
116
+ fossil_system(zCmd);
117
+ file_delete(zTempFile);
118
+ fossil_free(zCmd);
119
+ }
120
+ blob_reset(&script);
121
+}
122
+
123
+/*
124
+** Generate a TCL list on standard output that can be fed into the
125
+** merge.tcl script to show the details of the most recent merge
126
+** command associated with file "zFName". zFName must be the filename
127
+** relative to the root of the check-in - in other words a "tree name".
128
+**
129
+** When this routine is called, we know that the mergestat table
130
+** exists, but we do not know if zFName is mentioned in that table.
131
+*/
132
+static void merge_info_tcl(const char *zFName, int nContext){
133
+ const char *zTreename;/* Name of the file in the tree */
134
+ Stmt q; /* To query the MERGESTAT table */
135
+ MergeBuilder mb; /* The merge builder object */
136
+ Blob pivot,v1,v2,out; /* Blobs for holding content */
137
+ const char *zFN; /* A filename */
138
+ int rid; /* RID value */
139
+ int sz; /* File size value */
140
+
141
+ zTreename = zFName;
142
+ db_prepare(&q,
143
+ /* 0 1 2 3 4 5 6 7 */
144
+ "SELECT fnp, ridp, fn, ridv, sz, fnm, ridm, fnr"
145
+ " FROM mergestat"
146
+ " WHERE fnp=%Q OR fnr=%Q",
147
+ zTreename, zTreename
148
+ );
149
+ if( db_step(&q)!=SQLITE_ROW ){
150
+ db_finalize(&q);
151
+ fossil_print("ERROR {don't know anything about file: %s}\n", zTreename);
152
+ return;
153
+ }
154
+ mergebuilder_init_tcl(&mb);
155
+ mb.nContext = nContext;
156
+
157
+ /* Set up the pivot */
158
+ zFN = db_column_text(&q, 0);
159
+ if( zFN==0 ){
160
+ /* No pivot because the file was added */
161
+ mb.zPivot = "(no baseline)";
162
+ blob_zero(&pivot);
163
+ }else{
164
+ mb.zPivot = mprintf("%s (baseline)", file_tail(zFN));
165
+ rid = db_column_int(&q, 1);
166
+ content_get(rid, &pivot);
167
+ }
168
+ mb.pPivot = &pivot;
169
+
170
+ /* Set up the merge-in as V2 */
171
+ zFN = db_column_text(&q, 5);
172
+ if( zFN==0 ){
173
+ /* File deleted in the merged-in branch */
174
+ mb.zV2 = "(deleted file)";
175
+ blob_zero(&v2);
176
+ }else{
177
+ mb.zV2 = mprintf("%s (merge-in)", file_tail(zFN));
178
+ rid = db_column_int(&q, 6);
179
+ content_get(rid, &v2);
180
+ }
181
+ mb.pV2 = &v2;
182
+
183
+ /* Set up the local content as V1 */
184
+ zFN = db_column_text(&q, 2);
185
+ if( zFN==0 ){
186
+ /* File added by merge */
187
+ mb.zV1 = "(no original)";
188
+ blob_zero(&v1);
189
+ }else{
190
+ mb.zV1 = mprintf("%s (local)", file_tail(zFN));
191
+ rid = db_column_int(&q, 3);
192
+ sz = db_column_int(&q, 4);
193
+ if( rid==0 && sz>0 ){
194
+ /* The origin file had been edited so we'll have to pull its
195
+ ** original content out of the undo buffer */
196
+ Stmt q2;
197
+ db_prepare(&q2,
198
+ "SELECT content FROM undo"
199
+ " WHERE pathname=%Q AND octet_length(content)=%d",
200
+ zFN, sz
201
+ );
202
+ blob_zero(&v1);
203
+ if( db_step(&q2)==SQLITE_ROW ){
204
+ db_column_blob(&q, 0, &v1);
205
+ }else{
206
+ mb.zV1 = "(local content missing)";
207
+ }
208
+ db_finalize(&q2);
209
+ }else{
210
+ /* The origin file was unchanged when the merge first occurred */
211
+ content_get(rid, &v1);
212
+ }
213
+ }
214
+ mb.pV1 = &v1;
215
+
216
+ /* Set up the output */
217
+ zFN = db_column_text(&q, 7);
218
+ if( zFN==0 ){
219
+ mb.zOut = "(Merge Result)";
220
+ }else{
221
+ mb.zOut = mprintf("%s (after merge)", file_tail(zFN));
222
+ }
223
+ blob_zero(&out);
224
+ mb.pOut = &out;
225
+
226
+ merge_three_blobs(&mb);
227
+ blob_write_to_file(&out, "-");
228
+
229
+ mb.xDestroy(&mb);
230
+ blob_reset(&pivot);
231
+ blob_reset(&v1);
232
+ blob_reset(&v2);
233
+ blob_reset(&out);
234
+ db_finalize(&q);
235
+}
236
+
237
+/*
238
+** COMMAND: merge-info
239
+**
240
+** Usage: %fossil merge-info [OPTIONS]
241
+**
242
+** Display information about the most recent merge operation.
243
+**
244
+** Options:
245
+** -a|--all Show all all file changes that happened because of
246
+** the merge. Normally only MERGE, CONFLICT, and ERROR
247
+** lines are shown
248
+** -c|--context N Show N lines of context around each change,
249
+** with negative N meaning show all content. Only
250
+** meaningful in combination with --tcl or --tk.
251
+** --dark Use dark mode for the Tcl/Tk-based GUI
252
+** --tcl FILE Generate (to stdout) a TCL list containing
253
+** information needed to display the changes to
254
+** FILE caused by the most recent merge. FILE must
255
+** be a pathname relative to the root of the check-out.
256
+** --tk Bring up a Tcl/Tk GUI that shows the changes
257
+** associated with the most recent merge.
258
+**
259
+*/
260
+void merge_info_cmd(void){
261
+ const char *zCnt;
262
+ const char *zTcl;
263
+ int bTk;
264
+ int bDark;
265
+ int bAll;
266
+ int nContext;
267
+ Stmt q;
268
+ const char *zWhere;
269
+ int cnt = 0;
270
+
271
+ db_must_be_within_tree();
272
+ zTcl = find_option("tcl", 0, 1);
273
+ bTk = find_option("tk", 0, 0)!=0;
274
+ zCnt = find_option("context", "c", 1);
275
+ bDark = find_option("dark", 0, 0)!=0;
276
+ bAll = find_option("all", "a", 0)!=0;
277
+ if( bTk==0 ){
278
+ verify_all_options();
279
+ if( g.argc>2 ){
280
+ usage("[OPTIONS]");
281
+ }
282
+ }
283
+ if( zCnt ){
284
+ nContext = atoi(zCnt);
285
+ if( nContext<0 ) nContext = 0xfffffff;
286
+ }else{
287
+ nContext = 6;
288
+ }
289
+ if( !db_table_exists("localdb","mergestat") ){
290
+ if( zTcl ){
291
+ fossil_print("ERROR {no merge data available}\n");
292
+ }else{
293
+ fossil_print("No merge data is available\n");
294
+ }
295
+ return;
296
+ }
297
+ if( bTk ){
298
+ merge_info_tk(bDark, bAll, nContext);
299
+ return;
300
+ }
301
+ if( zTcl ){
302
+ merge_info_tcl(zTcl, nContext);
303
+ return;
304
+ }
305
+ if( bAll ){
306
+ zWhere = "";
307
+ }else{
308
+ zWhere = "WHERE op IN ('MERGE','CONFLICT','ERROR')";
309
+ }
310
+ db_prepare(&q,
311
+ /* 0 1 2 */
312
+ "SELECT op, coalesce(fnr,fn), msg"
313
+ " FROM mergestat"
314
+ " %s"
315
+ " ORDER BY coalesce(fnr,fn)",
316
+ zWhere /*safe-for-%s*/
317
+ );
318
+ while( db_step(&q)==SQLITE_ROW ){
319
+ const char *zOp = db_column_text(&q, 0);
320
+ const char *zName = db_column_text(&q, 1);
321
+ const char *zErr = db_column_text(&q, 2);
322
+ if( zErr && fossil_strcmp(zOp,"CONFLICT")!=0 ){
323
+ fossil_print("%-9s %s (%s)\n", zOp, zName, zErr);
324
+ }else{
325
+ fossil_print("%-9s %s\n", zOp, zName);
326
+ }
327
+ cnt++;
328
+ }
329
+ db_finalize(&q);
330
+ if( !bAll && cnt==0 ){
331
+ fossil_print(
332
+ "No interesting change in this merge. Use --all to see everything.\n"
333
+ );
334
+ }
335
+}
336
+
337
+/*
338
+** Erase all information about prior merges. Do this, for example, after
339
+** a commit.
340
+*/
341
+void merge_info_forget(void){
342
+ db_multi_exec("DROP TABLE IF EXISTS localdb.mergestat");
343
+}
344
+
345
+
346
+/*
347
+** Initialize the MERGESTAT table.
348
+**
349
+** Notes about mergestat:
350
+**
351
+** * ridv is a positive integer and sz is NULL if the V file contained
352
+** no local edits prior to the merge. If the V file was modified prior
353
+** to the merge then ridv is NULL and sz is the size of the file prior
354
+** to merge.
355
+**
356
+** * fnp, ridp, fn, ridv, and sz are all NULL for a file that was
357
+** added by merge.
358
+*/
359
+void merge_info_init(void){
360
+ db_multi_exec(
361
+ "DROP TABLE IF EXISTS localdb.mergestat;\n"
362
+ "CREATE TABLE localdb.mergestat(\n"
363
+ " op TEXT, -- 'UPDATE', 'ADDED', 'MERGE', etc...\n"
364
+ " fnp TEXT, -- Name of the pivot file (P)\n"
365
+ " ridp INT, -- RID for the pivot file\n"
366
+ " fn TEXT, -- Name of origin file (V)\n"
367
+ " ridv INT, -- RID for origin file, or NULL if previously edited\n"
368
+ " sz INT, -- Size of origin file in bytes, NULL if unedited\n"
369
+ " fnm TEXT, -- Name of the file being merged in (M)\n"
370
+ " ridm INT, -- RID for the merge-in file\n"
371
+ " fnr TEXT, -- Name of the final output file, after all renaming\n"
372
+ " nc INT DEFAULT 0, -- Number of conflicts\n"
373
+ " msg TEXT -- Error message\n"
374
+ ");"
375
+ );
376
+}
377
+
25378
/*
26379
** Print information about a particular check-in.
27380
*/
28381
void print_checkin_description(int rid, int indent, const char *zLabel){
29382
Stmt q;
@@ -295,10 +648,13 @@
295648
** Files which are renamed in the merged-in branch will be renamed in
296649
** the current check-out.
297650
**
298651
** If the VERSION argument is omitted, then Fossil attempts to find
299652
** a recent fork on the current branch to merge.
653
+**
654
+** Note that this command does not commit the merge, as that is a
655
+** separate step.
300656
**
301657
** If there are multiple VERSION arguments, then each VERSION is merged
302658
** (or cherrypicked) in the order that they appear on the command-line.
303659
**
304660
** Options:
@@ -320,11 +676,11 @@
320676
** --force-missing Force the merge even if there is missing content
321677
** --integrate Merged branch will be closed when committing
322678
** -K|--keep-merge-files On merge conflict, retain the temporary files
323679
** used for merging, named *-baseline, *-original,
324680
** and *-merge.
325
-** -n|--dry-run If given, display instead of run actions
681
+** -n|--dry-run Do not actually change files on disk
326682
** --nosync Do not auto-sync prior to merging
327683
** -v|--verbose Show additional details of the merge
328684
*/
329685
void merge_cmd(void){
330686
int vid; /* Current version "V" */
@@ -797,15 +1153,21 @@
7971153
7981154
/************************************************************************
7991155
** All of the information needed to do the merge is now contained in the
8001156
** FV table. Starting here, we begin to actually carry out the merge.
8011157
**
802
- ** First, find files that have changed from P->M but not P->V.
1158
+ ** Begin by constructing the localdb.mergestat table.
1159
+ */
1160
+ merge_info_init();
1161
+
1162
+ /*
1163
+ ** Find files that have changed from P->M but not P->V.
8031164
** Copy the M content over into V.
8041165
*/
8051166
db_prepare(&q,
806
- "SELECT idv, ridm, fn, islinkm FROM fv"
1167
+ /* 0 1 2 3 4 5 6 7 */
1168
+ "SELECT idv, ridm, fn, islinkm, fnp, ridp, ridv, fnm FROM fv"
8071169
" WHERE idp>0 AND idv>0 AND idm>0"
8081170
" AND ridm!=ridp AND ridv=ridp AND NOT chnged"
8091171
);
8101172
while( db_step(&q)==SQLITE_ROW ){
8111173
int idv = db_column_int(&q, 0);
@@ -822,10 +1184,21 @@
8221184
" THEN (SELECT uuid FROM blob WHERE blob.rid=%d) END"
8231185
" WHERE id=%d", ridm, integrateFlag?4:2, islinkm, ridm, ridm, idv
8241186
);
8251187
vfile_to_disk(0, idv, 0, 0);
8261188
}
1189
+ db_multi_exec(
1190
+ "INSERT INTO mergestat(op,fnp,ridp,fn,ridv,fnm,ridm,fnr)"
1191
+ "VALUES('UPDATE',%Q,%d,%Q,%d,%Q,%d,%Q)",
1192
+ /* fnp */ db_column_text(&q, 4),
1193
+ /* ridp */ db_column_int(&q,5),
1194
+ /* fn */ zName,
1195
+ /* ridv */ db_column_int(&q,6),
1196
+ /* fnm */ db_column_text(&q, 7),
1197
+ /* ridm */ ridm,
1198
+ /* fnr */ zName
1199
+ );
8271200
}
8281201
db_finalize(&q);
8291202
8301203
/*
8311204
** Do a three-way merge on files that have changes on both P->M and P->V.
@@ -833,11 +1206,15 @@
8331206
** Proceed even if the file doesn't exist on P, just like the common ancestor
8341207
** of M and V is an empty file. In this case, merge conflict marks will be
8351208
** added to the file and user will be forced to take a decision.
8361209
*/
8371210
db_prepare(&q,
838
- "SELECT ridm, idv, ridp, ridv, %s, fn, isexe, islinkv, islinkm FROM fv"
1211
+ /* 0 1 2 3 4 5 6 7 8 */
1212
+ "SELECT ridm, idv, ridp, ridv, %s, fn, isexe, islinkv, islinkm,"
1213
+ /* 9 10 11 */
1214
+ " fnp, fnm, chnged"
1215
+ " FROM fv"
8391216
" WHERE idv>0 AND idm>0"
8401217
" AND ridm!=ridp AND (ridv!=ridp OR chnged)",
8411218
glob_expr("fv.fn", zBinGlob)
8421219
);
8431220
while( db_step(&q)==SQLITE_ROW ){
@@ -848,12 +1225,14 @@
8481225
int isBinary = db_column_int(&q, 4);
8491226
const char *zName = db_column_text(&q, 5);
8501227
int isExe = db_column_int(&q, 6);
8511228
int islinkv = db_column_int(&q, 7);
8521229
int islinkm = db_column_int(&q, 8);
1230
+ int chnged = db_column_int(&q, 11);
8531231
int rc;
8541232
char *zFullPath;
1233
+ const char *zType = "MERGE";
8551234
Blob m, p, r;
8561235
/* Do a 3-way merge of idp->idm into idp->idv. The results go into idv. */
8571236
if( verboseFlag ){
8581237
fossil_print("MERGE %s (pivot=%d v1=%d v2=%d)\n",
8591238
zName, ridp, ridm, ridv);
@@ -861,13 +1240,29 @@
8611240
fossil_print("MERGE %s\n", zName);
8621241
}
8631242
if( islinkv || islinkm ){
8641243
fossil_print("***** Cannot merge symlink %s\n", zName);
8651244
nConflict++;
1245
+ db_multi_exec(
1246
+ "INSERT INTO mergestat(op,fnp,ridp,fn,ridv,fnm,ridm,fnr,nc,msg)"
1247
+ "VALUES('ERROR',%Q,%d,%Q,%d,%Q,%d,%Q,1,'cannot merge symlink')",
1248
+ /* fnp */ db_column_text(&q, 9),
1249
+ /* ridp */ ridp,
1250
+ /* fn */ zName,
1251
+ /* ridv */ ridv,
1252
+ /* fnm */ db_column_text(&q, 10),
1253
+ /* ridm */ ridm,
1254
+ /* fnr */ zName
1255
+ );
8661256
}else{
1257
+ i64 sz;
1258
+ const char *zErrMsg = 0;
1259
+ int nc = 0;
1260
+
8671261
if( !dryRunFlag ) undo_save(zName);
8681262
zFullPath = mprintf("%s/%s", g.zLocalRoot, zName);
1263
+ sz = file_size(zFullPath, ExtFILE);
8691264
content_get(ridp, &p);
8701265
content_get(ridm, &m);
8711266
if( isBinary ){
8721267
rc = -1;
8731268
blob_zero(&r);
@@ -884,15 +1279,38 @@
8841279
db_multi_exec("UPDATE vfile SET mtime=0 WHERE id=%d", idv);
8851280
if( rc>0 ){
8861281
fossil_print("***** %d merge conflict%s in %s\n",
8871282
rc, rc>1 ? "s" : "", zName);
8881283
nConflict++;
1284
+ nc = rc;
1285
+ zErrMsg = "merge conflicts";
1286
+ zType = "CONFLICT";
8891287
}
8901288
}else{
8911289
fossil_print("***** Cannot merge binary file %s\n", zName);
8921290
nConflict++;
1291
+ nc = 1;
1292
+ zErrMsg = "cannot merge binary file";
1293
+ zType = "ERROR";
8931294
}
1295
+ db_multi_exec(
1296
+ "INSERT INTO mergestat(op,fnp,ridp,fn,ridv,sz,fnm,ridm,fnr,nc,msg)"
1297
+ "VALUES(%Q,%Q,%d,%Q,iif(%d,%d,NULL),iif(%d,%d,NULL),%Q,%d,"
1298
+ "%Q,%d,%Q)",
1299
+ /* op */ zType,
1300
+ /* fnp */ db_column_text(&q, 9),
1301
+ /* ridp */ ridp,
1302
+ /* fn */ zName,
1303
+ /* ridv */ chnged==0, ridv,
1304
+ /* sz */ chnged!=0, sz,
1305
+ /* fnm */ db_column_text(&q, 10),
1306
+ /* ridm */ ridm,
1307
+ /* fnr */ zName,
1308
+ /* nc */ nc,
1309
+ /* msg */ zErrMsg
1310
+ );
1311
+ fossil_free(zFullPath);
8941312
blob_reset(&p);
8951313
blob_reset(&m);
8961314
blob_reset(&r);
8971315
}
8981316
vmerge_insert(idv, ridm);
@@ -901,22 +1319,33 @@
9011319
9021320
/*
9031321
** Drop files that are in P and V but not in M
9041322
*/
9051323
db_prepare(&q,
906
- "SELECT idv, fn, chnged FROM fv"
1324
+ "SELECT idv, fn, chnged, ridv FROM fv"
9071325
" WHERE idp>0 AND idv>0 AND idm=0"
9081326
);
9091327
while( db_step(&q)==SQLITE_ROW ){
9101328
int idv = db_column_int(&q, 0);
9111329
const char *zName = db_column_text(&q, 1);
9121330
int chnged = db_column_int(&q, 2);
1331
+ int ridv = db_column_int(&q, 3);
1332
+ int sz = -1;
1333
+ const char *zErrMsg = 0;
1334
+ int nc = 0;
9131335
/* Delete the file idv */
9141336
fossil_print("DELETE %s\n", zName);
9151337
if( chnged ){
1338
+ char *zFullPath;
9161339
fossil_warning("WARNING: local edits lost for %s", zName);
9171340
nConflict++;
1341
+ ridv = 0;
1342
+ nc = 1;
1343
+ zErrMsg = "local edits lost";
1344
+ zFullPath = mprintf("%s/%s", g.zLocalRoot, zName);
1345
+ sz = file_size(zFullPath, ExtFILE);
1346
+ fossil_free(zFullPath);
9181347
}
9191348
if( !dryRunFlag ) undo_save(zName);
9201349
db_multi_exec(
9211350
"UPDATE vfile SET deleted=1 WHERE id=%d", idv
9221351
);
@@ -923,10 +1352,20 @@
9231352
if( !dryRunFlag ){
9241353
char *zFullPath = mprintf("%s%s", g.zLocalRoot, zName);
9251354
file_delete(zFullPath);
9261355
free(zFullPath);
9271356
}
1357
+ db_multi_exec(
1358
+ "INSERT INTO localdb.mergestat(op,fnp,ridp,fn,ridv,sz,fnm,ridm,nc,msg)"
1359
+ "VALUES('DELETE',NULL,NULL,%Q,iif(%d,%d,NULL),iif(%d,%d,NULL),"
1360
+ "NULL,NULL,%d,%Q)",
1361
+ /* fn */ zName,
1362
+ /* ridv */ chnged==0, ridv,
1363
+ /* sz */ chnged!=0, sz,
1364
+ /* nc */ nc,
1365
+ /* msg */ zErrMsg
1366
+ );
9281367
}
9291368
db_finalize(&q);
9301369
9311370
/* For certain sets of renames (e.g. A -> B and B -> A), a file that is
9321371
** being renamed must first be moved to a temporary location to avoid
@@ -953,10 +1392,14 @@
9531392
const char *zNewName = db_column_text(&q, 2);
9541393
int isExe = db_column_int(&q, 3);
9551394
fossil_print("RENAME %s -> %s\n", zOldName, zNewName);
9561395
if( !dryRunFlag ) undo_save(zOldName);
9571396
if( !dryRunFlag ) undo_save(zNewName);
1397
+ db_multi_exec(
1398
+ "UPDATE mergestat SET fnr=fnm WHERE fnp=%Q",
1399
+ zOldName
1400
+ );
9581401
db_multi_exec(
9591402
"UPDATE vfile SET pathname=NULL, origname=pathname"
9601403
" WHERE vid=%d AND pathname=%Q;"
9611404
"UPDATE vfile SET pathname=%Q, origname=coalesce(origname,pathname)"
9621405
" WHERE id=%d;",
@@ -1006,11 +1449,11 @@
10061449
10071450
/*
10081451
** Insert into V any files that are not in V or P but are in M.
10091452
*/
10101453
db_prepare(&q,
1011
- "SELECT idm, fnm FROM fv"
1454
+ "SELECT idm, fnm, ridm FROM fv"
10121455
" WHERE idp=0 AND idv=0 AND idm>0"
10131456
);
10141457
while( db_step(&q)==SQLITE_ROW ){
10151458
int idm = db_column_int(&q, 0);
10161459
const char *zName;
@@ -1039,10 +1482,17 @@
10391482
nOverwrite++;
10401483
}else{
10411484
fossil_print("ADDED %s\n", zName);
10421485
}
10431486
fossil_free(zFullName);
1487
+ db_multi_exec(
1488
+ "INSERT INTO mergestat(op,fnm,ridm,fnr)"
1489
+ "VALUES('ADDED',%Q,%d,%Q)",
1490
+ /* fnm */ zName,
1491
+ /* ridm */ db_column_int(&q,2),
1492
+ /* fnr */ zName
1493
+ );
10441494
if( !dryRunFlag ){
10451495
undo_save(zName);
10461496
vfile_to_disk(0, idm, 0, 0);
10471497
}
10481498
}
10491499
10501500
ADDED src/merge.tcl
--- src/merge.c
+++ src/merge.c
@@ -20,10 +20,363 @@
20 */
21 #include "config.h"
22 #include "merge.h"
23 #include <assert.h>
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25 /*
26 ** Print information about a particular check-in.
27 */
28 void print_checkin_description(int rid, int indent, const char *zLabel){
29 Stmt q;
@@ -295,10 +648,13 @@
295 ** Files which are renamed in the merged-in branch will be renamed in
296 ** the current check-out.
297 **
298 ** If the VERSION argument is omitted, then Fossil attempts to find
299 ** a recent fork on the current branch to merge.
 
 
 
300 **
301 ** If there are multiple VERSION arguments, then each VERSION is merged
302 ** (or cherrypicked) in the order that they appear on the command-line.
303 **
304 ** Options:
@@ -320,11 +676,11 @@
320 ** --force-missing Force the merge even if there is missing content
321 ** --integrate Merged branch will be closed when committing
322 ** -K|--keep-merge-files On merge conflict, retain the temporary files
323 ** used for merging, named *-baseline, *-original,
324 ** and *-merge.
325 ** -n|--dry-run If given, display instead of run actions
326 ** --nosync Do not auto-sync prior to merging
327 ** -v|--verbose Show additional details of the merge
328 */
329 void merge_cmd(void){
330 int vid; /* Current version "V" */
@@ -797,15 +1153,21 @@
797
798 /************************************************************************
799 ** All of the information needed to do the merge is now contained in the
800 ** FV table. Starting here, we begin to actually carry out the merge.
801 **
802 ** First, find files that have changed from P->M but not P->V.
 
 
 
 
 
803 ** Copy the M content over into V.
804 */
805 db_prepare(&q,
806 "SELECT idv, ridm, fn, islinkm FROM fv"
 
807 " WHERE idp>0 AND idv>0 AND idm>0"
808 " AND ridm!=ridp AND ridv=ridp AND NOT chnged"
809 );
810 while( db_step(&q)==SQLITE_ROW ){
811 int idv = db_column_int(&q, 0);
@@ -822,10 +1184,21 @@
822 " THEN (SELECT uuid FROM blob WHERE blob.rid=%d) END"
823 " WHERE id=%d", ridm, integrateFlag?4:2, islinkm, ridm, ridm, idv
824 );
825 vfile_to_disk(0, idv, 0, 0);
826 }
 
 
 
 
 
 
 
 
 
 
 
827 }
828 db_finalize(&q);
829
830 /*
831 ** Do a three-way merge on files that have changes on both P->M and P->V.
@@ -833,11 +1206,15 @@
833 ** Proceed even if the file doesn't exist on P, just like the common ancestor
834 ** of M and V is an empty file. In this case, merge conflict marks will be
835 ** added to the file and user will be forced to take a decision.
836 */
837 db_prepare(&q,
838 "SELECT ridm, idv, ridp, ridv, %s, fn, isexe, islinkv, islinkm FROM fv"
 
 
 
 
839 " WHERE idv>0 AND idm>0"
840 " AND ridm!=ridp AND (ridv!=ridp OR chnged)",
841 glob_expr("fv.fn", zBinGlob)
842 );
843 while( db_step(&q)==SQLITE_ROW ){
@@ -848,12 +1225,14 @@
848 int isBinary = db_column_int(&q, 4);
849 const char *zName = db_column_text(&q, 5);
850 int isExe = db_column_int(&q, 6);
851 int islinkv = db_column_int(&q, 7);
852 int islinkm = db_column_int(&q, 8);
 
853 int rc;
854 char *zFullPath;
 
855 Blob m, p, r;
856 /* Do a 3-way merge of idp->idm into idp->idv. The results go into idv. */
857 if( verboseFlag ){
858 fossil_print("MERGE %s (pivot=%d v1=%d v2=%d)\n",
859 zName, ridp, ridm, ridv);
@@ -861,13 +1240,29 @@
861 fossil_print("MERGE %s\n", zName);
862 }
863 if( islinkv || islinkm ){
864 fossil_print("***** Cannot merge symlink %s\n", zName);
865 nConflict++;
 
 
 
 
 
 
 
 
 
 
 
866 }else{
 
 
 
 
867 if( !dryRunFlag ) undo_save(zName);
868 zFullPath = mprintf("%s/%s", g.zLocalRoot, zName);
 
869 content_get(ridp, &p);
870 content_get(ridm, &m);
871 if( isBinary ){
872 rc = -1;
873 blob_zero(&r);
@@ -884,15 +1279,38 @@
884 db_multi_exec("UPDATE vfile SET mtime=0 WHERE id=%d", idv);
885 if( rc>0 ){
886 fossil_print("***** %d merge conflict%s in %s\n",
887 rc, rc>1 ? "s" : "", zName);
888 nConflict++;
 
 
 
889 }
890 }else{
891 fossil_print("***** Cannot merge binary file %s\n", zName);
892 nConflict++;
 
 
 
893 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
894 blob_reset(&p);
895 blob_reset(&m);
896 blob_reset(&r);
897 }
898 vmerge_insert(idv, ridm);
@@ -901,22 +1319,33 @@
901
902 /*
903 ** Drop files that are in P and V but not in M
904 */
905 db_prepare(&q,
906 "SELECT idv, fn, chnged FROM fv"
907 " WHERE idp>0 AND idv>0 AND idm=0"
908 );
909 while( db_step(&q)==SQLITE_ROW ){
910 int idv = db_column_int(&q, 0);
911 const char *zName = db_column_text(&q, 1);
912 int chnged = db_column_int(&q, 2);
 
 
 
 
913 /* Delete the file idv */
914 fossil_print("DELETE %s\n", zName);
915 if( chnged ){
 
916 fossil_warning("WARNING: local edits lost for %s", zName);
917 nConflict++;
 
 
 
 
 
 
918 }
919 if( !dryRunFlag ) undo_save(zName);
920 db_multi_exec(
921 "UPDATE vfile SET deleted=1 WHERE id=%d", idv
922 );
@@ -923,10 +1352,20 @@
923 if( !dryRunFlag ){
924 char *zFullPath = mprintf("%s%s", g.zLocalRoot, zName);
925 file_delete(zFullPath);
926 free(zFullPath);
927 }
 
 
 
 
 
 
 
 
 
 
928 }
929 db_finalize(&q);
930
931 /* For certain sets of renames (e.g. A -> B and B -> A), a file that is
932 ** being renamed must first be moved to a temporary location to avoid
@@ -953,10 +1392,14 @@
953 const char *zNewName = db_column_text(&q, 2);
954 int isExe = db_column_int(&q, 3);
955 fossil_print("RENAME %s -> %s\n", zOldName, zNewName);
956 if( !dryRunFlag ) undo_save(zOldName);
957 if( !dryRunFlag ) undo_save(zNewName);
 
 
 
 
958 db_multi_exec(
959 "UPDATE vfile SET pathname=NULL, origname=pathname"
960 " WHERE vid=%d AND pathname=%Q;"
961 "UPDATE vfile SET pathname=%Q, origname=coalesce(origname,pathname)"
962 " WHERE id=%d;",
@@ -1006,11 +1449,11 @@
1006
1007 /*
1008 ** Insert into V any files that are not in V or P but are in M.
1009 */
1010 db_prepare(&q,
1011 "SELECT idm, fnm FROM fv"
1012 " WHERE idp=0 AND idv=0 AND idm>0"
1013 );
1014 while( db_step(&q)==SQLITE_ROW ){
1015 int idm = db_column_int(&q, 0);
1016 const char *zName;
@@ -1039,10 +1482,17 @@
1039 nOverwrite++;
1040 }else{
1041 fossil_print("ADDED %s\n", zName);
1042 }
1043 fossil_free(zFullName);
 
 
 
 
 
 
 
1044 if( !dryRunFlag ){
1045 undo_save(zName);
1046 vfile_to_disk(0, idm, 0, 0);
1047 }
1048 }
1049
1050 DDED src/merge.tcl
--- src/merge.c
+++ src/merge.c
@@ -20,10 +20,363 @@
20 */
21 #include "config.h"
22 #include "merge.h"
23 #include <assert.h>
24
25
26 /*
27 ** Bring up a Tcl/Tk GUI to show details of the most recent merge.
28 */
29 static void merge_info_tk(int bDark, int bAll, int nContext){
30 int i;
31 Blob script;
32 const char *zTempFile = 0;
33 char *zCmd;
34 const char *zTclsh;
35 zTclsh = find_option("tclsh",0,1);
36 if( zTclsh==0 ){
37 zTclsh = db_get("tclsh",0);
38 }
39 /* The undocumented --script FILENAME option causes the Tk script to
40 ** be written into the FILENAME instead of being run. This is used
41 ** for testing and debugging. */
42 zTempFile = find_option("script",0,1);
43 verify_all_options();
44
45 blob_zero(&script);
46 blob_appendf(&script, "set ncontext %d\n", nContext);
47 blob_appendf(&script, "set fossilcmd {| \"%/\" merge-info}\n",
48 g.nameOfExe);
49 blob_appendf(&script, "set filelist [list");
50 if( g.argc==2 ){
51 /* No files named on the command-line. Use every file mentioned
52 ** in the MERGESTAT table to generate the file list. */
53 Stmt q;
54 int cnt = 0;
55 db_prepare(&q,
56 "SELECT coalesce(fnr,fn), op FROM mergestat %s ORDER BY 1",
57 bAll ? "" : "WHERE op IN ('MERGE','CONFLICT')" /*safe-for-%s*/
58 );
59 while( db_step(&q)==SQLITE_ROW ){
60 blob_appendf(&script," %s ", db_column_text(&q,1));
61 blob_append_tcl_literal(&script, db_column_text(&q,0),
62 db_column_bytes(&q,0));
63 cnt++;
64 }
65 db_finalize(&q);
66 if( cnt==0 ){
67 fossil_print(
68 "No interesting changes in this merge. Use --all to see everything\n"
69 );
70 return;
71 }
72 }else{
73 /* Use only files named on the command-line in the file list.
74 ** But verify each file named is actually found in the MERGESTAT
75 ** table first. */
76 for(i=2; i<g.argc; i++){
77 char *zFile; /* Input filename */
78 char *zTreename; /* Name of the file in the tree */
79 Blob fname; /* Filename relative to root */
80 char *zOp; /* Operation on this file */
81 zFile = mprintf("%/", g.argv[i]);
82 file_tree_name(zFile, &fname, 0, 1);
83 fossil_free(zFile);
84 zTreename = blob_str(&fname);
85 zOp = db_text(0, "SELECT op FROM mergestat WHERE fn=%Q or fnr=%Q",
86 zTreename, zTreename);
87 blob_appendf(&script, " %s ", zOp);
88 fossil_free(zOp);
89 blob_append_tcl_literal(&script, zTreename, (int)strlen(zTreename));
90 blob_reset(&fname);
91 }
92 }
93 blob_appendf(&script, "]\n");
94 blob_appendf(&script, "set darkmode %d\n", bDark!=0);
95 blob_appendf(&script, "%s", builtin_file("merge.tcl", 0));
96 if( zTempFile ){
97 blob_write_to_file(&script, zTempFile);
98 fossil_print("To see the merge, run: %s \"%s\"\n", zTclsh, zTempFile);
99 }else{
100 #if defined(FOSSIL_ENABLE_TCL)
101 Th_FossilInit(TH_INIT_DEFAULT);
102 if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script),
103 blob_size(&script), 1, 1, 0)==TCL_OK ){
104 blob_reset(&script);
105 return;
106 }
107 /*
108 * If evaluation of the Tcl script fails, the reason may be that Tk
109 * could not be found by the loaded Tcl, or that Tcl cannot be loaded
110 * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback
111 * to using the external "tclsh", if available.
112 */
113 #endif
114 zTempFile = write_blob_to_temp_file(&script);
115 zCmd = mprintf("%$ %$", zTclsh, zTempFile);
116 fossil_system(zCmd);
117 file_delete(zTempFile);
118 fossil_free(zCmd);
119 }
120 blob_reset(&script);
121 }
122
123 /*
124 ** Generate a TCL list on standard output that can be fed into the
125 ** merge.tcl script to show the details of the most recent merge
126 ** command associated with file "zFName". zFName must be the filename
127 ** relative to the root of the check-in - in other words a "tree name".
128 **
129 ** When this routine is called, we know that the mergestat table
130 ** exists, but we do not know if zFName is mentioned in that table.
131 */
132 static void merge_info_tcl(const char *zFName, int nContext){
133 const char *zTreename;/* Name of the file in the tree */
134 Stmt q; /* To query the MERGESTAT table */
135 MergeBuilder mb; /* The merge builder object */
136 Blob pivot,v1,v2,out; /* Blobs for holding content */
137 const char *zFN; /* A filename */
138 int rid; /* RID value */
139 int sz; /* File size value */
140
141 zTreename = zFName;
142 db_prepare(&q,
143 /* 0 1 2 3 4 5 6 7 */
144 "SELECT fnp, ridp, fn, ridv, sz, fnm, ridm, fnr"
145 " FROM mergestat"
146 " WHERE fnp=%Q OR fnr=%Q",
147 zTreename, zTreename
148 );
149 if( db_step(&q)!=SQLITE_ROW ){
150 db_finalize(&q);
151 fossil_print("ERROR {don't know anything about file: %s}\n", zTreename);
152 return;
153 }
154 mergebuilder_init_tcl(&mb);
155 mb.nContext = nContext;
156
157 /* Set up the pivot */
158 zFN = db_column_text(&q, 0);
159 if( zFN==0 ){
160 /* No pivot because the file was added */
161 mb.zPivot = "(no baseline)";
162 blob_zero(&pivot);
163 }else{
164 mb.zPivot = mprintf("%s (baseline)", file_tail(zFN));
165 rid = db_column_int(&q, 1);
166 content_get(rid, &pivot);
167 }
168 mb.pPivot = &pivot;
169
170 /* Set up the merge-in as V2 */
171 zFN = db_column_text(&q, 5);
172 if( zFN==0 ){
173 /* File deleted in the merged-in branch */
174 mb.zV2 = "(deleted file)";
175 blob_zero(&v2);
176 }else{
177 mb.zV2 = mprintf("%s (merge-in)", file_tail(zFN));
178 rid = db_column_int(&q, 6);
179 content_get(rid, &v2);
180 }
181 mb.pV2 = &v2;
182
183 /* Set up the local content as V1 */
184 zFN = db_column_text(&q, 2);
185 if( zFN==0 ){
186 /* File added by merge */
187 mb.zV1 = "(no original)";
188 blob_zero(&v1);
189 }else{
190 mb.zV1 = mprintf("%s (local)", file_tail(zFN));
191 rid = db_column_int(&q, 3);
192 sz = db_column_int(&q, 4);
193 if( rid==0 && sz>0 ){
194 /* The origin file had been edited so we'll have to pull its
195 ** original content out of the undo buffer */
196 Stmt q2;
197 db_prepare(&q2,
198 "SELECT content FROM undo"
199 " WHERE pathname=%Q AND octet_length(content)=%d",
200 zFN, sz
201 );
202 blob_zero(&v1);
203 if( db_step(&q2)==SQLITE_ROW ){
204 db_column_blob(&q, 0, &v1);
205 }else{
206 mb.zV1 = "(local content missing)";
207 }
208 db_finalize(&q2);
209 }else{
210 /* The origin file was unchanged when the merge first occurred */
211 content_get(rid, &v1);
212 }
213 }
214 mb.pV1 = &v1;
215
216 /* Set up the output */
217 zFN = db_column_text(&q, 7);
218 if( zFN==0 ){
219 mb.zOut = "(Merge Result)";
220 }else{
221 mb.zOut = mprintf("%s (after merge)", file_tail(zFN));
222 }
223 blob_zero(&out);
224 mb.pOut = &out;
225
226 merge_three_blobs(&mb);
227 blob_write_to_file(&out, "-");
228
229 mb.xDestroy(&mb);
230 blob_reset(&pivot);
231 blob_reset(&v1);
232 blob_reset(&v2);
233 blob_reset(&out);
234 db_finalize(&q);
235 }
236
237 /*
238 ** COMMAND: merge-info
239 **
240 ** Usage: %fossil merge-info [OPTIONS]
241 **
242 ** Display information about the most recent merge operation.
243 **
244 ** Options:
245 ** -a|--all Show all all file changes that happened because of
246 ** the merge. Normally only MERGE, CONFLICT, and ERROR
247 ** lines are shown
248 ** -c|--context N Show N lines of context around each change,
249 ** with negative N meaning show all content. Only
250 ** meaningful in combination with --tcl or --tk.
251 ** --dark Use dark mode for the Tcl/Tk-based GUI
252 ** --tcl FILE Generate (to stdout) a TCL list containing
253 ** information needed to display the changes to
254 ** FILE caused by the most recent merge. FILE must
255 ** be a pathname relative to the root of the check-out.
256 ** --tk Bring up a Tcl/Tk GUI that shows the changes
257 ** associated with the most recent merge.
258 **
259 */
260 void merge_info_cmd(void){
261 const char *zCnt;
262 const char *zTcl;
263 int bTk;
264 int bDark;
265 int bAll;
266 int nContext;
267 Stmt q;
268 const char *zWhere;
269 int cnt = 0;
270
271 db_must_be_within_tree();
272 zTcl = find_option("tcl", 0, 1);
273 bTk = find_option("tk", 0, 0)!=0;
274 zCnt = find_option("context", "c", 1);
275 bDark = find_option("dark", 0, 0)!=0;
276 bAll = find_option("all", "a", 0)!=0;
277 if( bTk==0 ){
278 verify_all_options();
279 if( g.argc>2 ){
280 usage("[OPTIONS]");
281 }
282 }
283 if( zCnt ){
284 nContext = atoi(zCnt);
285 if( nContext<0 ) nContext = 0xfffffff;
286 }else{
287 nContext = 6;
288 }
289 if( !db_table_exists("localdb","mergestat") ){
290 if( zTcl ){
291 fossil_print("ERROR {no merge data available}\n");
292 }else{
293 fossil_print("No merge data is available\n");
294 }
295 return;
296 }
297 if( bTk ){
298 merge_info_tk(bDark, bAll, nContext);
299 return;
300 }
301 if( zTcl ){
302 merge_info_tcl(zTcl, nContext);
303 return;
304 }
305 if( bAll ){
306 zWhere = "";
307 }else{
308 zWhere = "WHERE op IN ('MERGE','CONFLICT','ERROR')";
309 }
310 db_prepare(&q,
311 /* 0 1 2 */
312 "SELECT op, coalesce(fnr,fn), msg"
313 " FROM mergestat"
314 " %s"
315 " ORDER BY coalesce(fnr,fn)",
316 zWhere /*safe-for-%s*/
317 );
318 while( db_step(&q)==SQLITE_ROW ){
319 const char *zOp = db_column_text(&q, 0);
320 const char *zName = db_column_text(&q, 1);
321 const char *zErr = db_column_text(&q, 2);
322 if( zErr && fossil_strcmp(zOp,"CONFLICT")!=0 ){
323 fossil_print("%-9s %s (%s)\n", zOp, zName, zErr);
324 }else{
325 fossil_print("%-9s %s\n", zOp, zName);
326 }
327 cnt++;
328 }
329 db_finalize(&q);
330 if( !bAll && cnt==0 ){
331 fossil_print(
332 "No interesting change in this merge. Use --all to see everything.\n"
333 );
334 }
335 }
336
337 /*
338 ** Erase all information about prior merges. Do this, for example, after
339 ** a commit.
340 */
341 void merge_info_forget(void){
342 db_multi_exec("DROP TABLE IF EXISTS localdb.mergestat");
343 }
344
345
346 /*
347 ** Initialize the MERGESTAT table.
348 **
349 ** Notes about mergestat:
350 **
351 ** * ridv is a positive integer and sz is NULL if the V file contained
352 ** no local edits prior to the merge. If the V file was modified prior
353 ** to the merge then ridv is NULL and sz is the size of the file prior
354 ** to merge.
355 **
356 ** * fnp, ridp, fn, ridv, and sz are all NULL for a file that was
357 ** added by merge.
358 */
359 void merge_info_init(void){
360 db_multi_exec(
361 "DROP TABLE IF EXISTS localdb.mergestat;\n"
362 "CREATE TABLE localdb.mergestat(\n"
363 " op TEXT, -- 'UPDATE', 'ADDED', 'MERGE', etc...\n"
364 " fnp TEXT, -- Name of the pivot file (P)\n"
365 " ridp INT, -- RID for the pivot file\n"
366 " fn TEXT, -- Name of origin file (V)\n"
367 " ridv INT, -- RID for origin file, or NULL if previously edited\n"
368 " sz INT, -- Size of origin file in bytes, NULL if unedited\n"
369 " fnm TEXT, -- Name of the file being merged in (M)\n"
370 " ridm INT, -- RID for the merge-in file\n"
371 " fnr TEXT, -- Name of the final output file, after all renaming\n"
372 " nc INT DEFAULT 0, -- Number of conflicts\n"
373 " msg TEXT -- Error message\n"
374 ");"
375 );
376 }
377
378 /*
379 ** Print information about a particular check-in.
380 */
381 void print_checkin_description(int rid, int indent, const char *zLabel){
382 Stmt q;
@@ -295,10 +648,13 @@
648 ** Files which are renamed in the merged-in branch will be renamed in
649 ** the current check-out.
650 **
651 ** If the VERSION argument is omitted, then Fossil attempts to find
652 ** a recent fork on the current branch to merge.
653 **
654 ** Note that this command does not commit the merge, as that is a
655 ** separate step.
656 **
657 ** If there are multiple VERSION arguments, then each VERSION is merged
658 ** (or cherrypicked) in the order that they appear on the command-line.
659 **
660 ** Options:
@@ -320,11 +676,11 @@
676 ** --force-missing Force the merge even if there is missing content
677 ** --integrate Merged branch will be closed when committing
678 ** -K|--keep-merge-files On merge conflict, retain the temporary files
679 ** used for merging, named *-baseline, *-original,
680 ** and *-merge.
681 ** -n|--dry-run Do not actually change files on disk
682 ** --nosync Do not auto-sync prior to merging
683 ** -v|--verbose Show additional details of the merge
684 */
685 void merge_cmd(void){
686 int vid; /* Current version "V" */
@@ -797,15 +1153,21 @@
1153
1154 /************************************************************************
1155 ** All of the information needed to do the merge is now contained in the
1156 ** FV table. Starting here, we begin to actually carry out the merge.
1157 **
1158 ** Begin by constructing the localdb.mergestat table.
1159 */
1160 merge_info_init();
1161
1162 /*
1163 ** Find files that have changed from P->M but not P->V.
1164 ** Copy the M content over into V.
1165 */
1166 db_prepare(&q,
1167 /* 0 1 2 3 4 5 6 7 */
1168 "SELECT idv, ridm, fn, islinkm, fnp, ridp, ridv, fnm FROM fv"
1169 " WHERE idp>0 AND idv>0 AND idm>0"
1170 " AND ridm!=ridp AND ridv=ridp AND NOT chnged"
1171 );
1172 while( db_step(&q)==SQLITE_ROW ){
1173 int idv = db_column_int(&q, 0);
@@ -822,10 +1184,21 @@
1184 " THEN (SELECT uuid FROM blob WHERE blob.rid=%d) END"
1185 " WHERE id=%d", ridm, integrateFlag?4:2, islinkm, ridm, ridm, idv
1186 );
1187 vfile_to_disk(0, idv, 0, 0);
1188 }
1189 db_multi_exec(
1190 "INSERT INTO mergestat(op,fnp,ridp,fn,ridv,fnm,ridm,fnr)"
1191 "VALUES('UPDATE',%Q,%d,%Q,%d,%Q,%d,%Q)",
1192 /* fnp */ db_column_text(&q, 4),
1193 /* ridp */ db_column_int(&q,5),
1194 /* fn */ zName,
1195 /* ridv */ db_column_int(&q,6),
1196 /* fnm */ db_column_text(&q, 7),
1197 /* ridm */ ridm,
1198 /* fnr */ zName
1199 );
1200 }
1201 db_finalize(&q);
1202
1203 /*
1204 ** Do a three-way merge on files that have changes on both P->M and P->V.
@@ -833,11 +1206,15 @@
1206 ** Proceed even if the file doesn't exist on P, just like the common ancestor
1207 ** of M and V is an empty file. In this case, merge conflict marks will be
1208 ** added to the file and user will be forced to take a decision.
1209 */
1210 db_prepare(&q,
1211 /* 0 1 2 3 4 5 6 7 8 */
1212 "SELECT ridm, idv, ridp, ridv, %s, fn, isexe, islinkv, islinkm,"
1213 /* 9 10 11 */
1214 " fnp, fnm, chnged"
1215 " FROM fv"
1216 " WHERE idv>0 AND idm>0"
1217 " AND ridm!=ridp AND (ridv!=ridp OR chnged)",
1218 glob_expr("fv.fn", zBinGlob)
1219 );
1220 while( db_step(&q)==SQLITE_ROW ){
@@ -848,12 +1225,14 @@
1225 int isBinary = db_column_int(&q, 4);
1226 const char *zName = db_column_text(&q, 5);
1227 int isExe = db_column_int(&q, 6);
1228 int islinkv = db_column_int(&q, 7);
1229 int islinkm = db_column_int(&q, 8);
1230 int chnged = db_column_int(&q, 11);
1231 int rc;
1232 char *zFullPath;
1233 const char *zType = "MERGE";
1234 Blob m, p, r;
1235 /* Do a 3-way merge of idp->idm into idp->idv. The results go into idv. */
1236 if( verboseFlag ){
1237 fossil_print("MERGE %s (pivot=%d v1=%d v2=%d)\n",
1238 zName, ridp, ridm, ridv);
@@ -861,13 +1240,29 @@
1240 fossil_print("MERGE %s\n", zName);
1241 }
1242 if( islinkv || islinkm ){
1243 fossil_print("***** Cannot merge symlink %s\n", zName);
1244 nConflict++;
1245 db_multi_exec(
1246 "INSERT INTO mergestat(op,fnp,ridp,fn,ridv,fnm,ridm,fnr,nc,msg)"
1247 "VALUES('ERROR',%Q,%d,%Q,%d,%Q,%d,%Q,1,'cannot merge symlink')",
1248 /* fnp */ db_column_text(&q, 9),
1249 /* ridp */ ridp,
1250 /* fn */ zName,
1251 /* ridv */ ridv,
1252 /* fnm */ db_column_text(&q, 10),
1253 /* ridm */ ridm,
1254 /* fnr */ zName
1255 );
1256 }else{
1257 i64 sz;
1258 const char *zErrMsg = 0;
1259 int nc = 0;
1260
1261 if( !dryRunFlag ) undo_save(zName);
1262 zFullPath = mprintf("%s/%s", g.zLocalRoot, zName);
1263 sz = file_size(zFullPath, ExtFILE);
1264 content_get(ridp, &p);
1265 content_get(ridm, &m);
1266 if( isBinary ){
1267 rc = -1;
1268 blob_zero(&r);
@@ -884,15 +1279,38 @@
1279 db_multi_exec("UPDATE vfile SET mtime=0 WHERE id=%d", idv);
1280 if( rc>0 ){
1281 fossil_print("***** %d merge conflict%s in %s\n",
1282 rc, rc>1 ? "s" : "", zName);
1283 nConflict++;
1284 nc = rc;
1285 zErrMsg = "merge conflicts";
1286 zType = "CONFLICT";
1287 }
1288 }else{
1289 fossil_print("***** Cannot merge binary file %s\n", zName);
1290 nConflict++;
1291 nc = 1;
1292 zErrMsg = "cannot merge binary file";
1293 zType = "ERROR";
1294 }
1295 db_multi_exec(
1296 "INSERT INTO mergestat(op,fnp,ridp,fn,ridv,sz,fnm,ridm,fnr,nc,msg)"
1297 "VALUES(%Q,%Q,%d,%Q,iif(%d,%d,NULL),iif(%d,%d,NULL),%Q,%d,"
1298 "%Q,%d,%Q)",
1299 /* op */ zType,
1300 /* fnp */ db_column_text(&q, 9),
1301 /* ridp */ ridp,
1302 /* fn */ zName,
1303 /* ridv */ chnged==0, ridv,
1304 /* sz */ chnged!=0, sz,
1305 /* fnm */ db_column_text(&q, 10),
1306 /* ridm */ ridm,
1307 /* fnr */ zName,
1308 /* nc */ nc,
1309 /* msg */ zErrMsg
1310 );
1311 fossil_free(zFullPath);
1312 blob_reset(&p);
1313 blob_reset(&m);
1314 blob_reset(&r);
1315 }
1316 vmerge_insert(idv, ridm);
@@ -901,22 +1319,33 @@
1319
1320 /*
1321 ** Drop files that are in P and V but not in M
1322 */
1323 db_prepare(&q,
1324 "SELECT idv, fn, chnged, ridv FROM fv"
1325 " WHERE idp>0 AND idv>0 AND idm=0"
1326 );
1327 while( db_step(&q)==SQLITE_ROW ){
1328 int idv = db_column_int(&q, 0);
1329 const char *zName = db_column_text(&q, 1);
1330 int chnged = db_column_int(&q, 2);
1331 int ridv = db_column_int(&q, 3);
1332 int sz = -1;
1333 const char *zErrMsg = 0;
1334 int nc = 0;
1335 /* Delete the file idv */
1336 fossil_print("DELETE %s\n", zName);
1337 if( chnged ){
1338 char *zFullPath;
1339 fossil_warning("WARNING: local edits lost for %s", zName);
1340 nConflict++;
1341 ridv = 0;
1342 nc = 1;
1343 zErrMsg = "local edits lost";
1344 zFullPath = mprintf("%s/%s", g.zLocalRoot, zName);
1345 sz = file_size(zFullPath, ExtFILE);
1346 fossil_free(zFullPath);
1347 }
1348 if( !dryRunFlag ) undo_save(zName);
1349 db_multi_exec(
1350 "UPDATE vfile SET deleted=1 WHERE id=%d", idv
1351 );
@@ -923,10 +1352,20 @@
1352 if( !dryRunFlag ){
1353 char *zFullPath = mprintf("%s%s", g.zLocalRoot, zName);
1354 file_delete(zFullPath);
1355 free(zFullPath);
1356 }
1357 db_multi_exec(
1358 "INSERT INTO localdb.mergestat(op,fnp,ridp,fn,ridv,sz,fnm,ridm,nc,msg)"
1359 "VALUES('DELETE',NULL,NULL,%Q,iif(%d,%d,NULL),iif(%d,%d,NULL),"
1360 "NULL,NULL,%d,%Q)",
1361 /* fn */ zName,
1362 /* ridv */ chnged==0, ridv,
1363 /* sz */ chnged!=0, sz,
1364 /* nc */ nc,
1365 /* msg */ zErrMsg
1366 );
1367 }
1368 db_finalize(&q);
1369
1370 /* For certain sets of renames (e.g. A -> B and B -> A), a file that is
1371 ** being renamed must first be moved to a temporary location to avoid
@@ -953,10 +1392,14 @@
1392 const char *zNewName = db_column_text(&q, 2);
1393 int isExe = db_column_int(&q, 3);
1394 fossil_print("RENAME %s -> %s\n", zOldName, zNewName);
1395 if( !dryRunFlag ) undo_save(zOldName);
1396 if( !dryRunFlag ) undo_save(zNewName);
1397 db_multi_exec(
1398 "UPDATE mergestat SET fnr=fnm WHERE fnp=%Q",
1399 zOldName
1400 );
1401 db_multi_exec(
1402 "UPDATE vfile SET pathname=NULL, origname=pathname"
1403 " WHERE vid=%d AND pathname=%Q;"
1404 "UPDATE vfile SET pathname=%Q, origname=coalesce(origname,pathname)"
1405 " WHERE id=%d;",
@@ -1006,11 +1449,11 @@
1449
1450 /*
1451 ** Insert into V any files that are not in V or P but are in M.
1452 */
1453 db_prepare(&q,
1454 "SELECT idm, fnm, ridm FROM fv"
1455 " WHERE idp=0 AND idv=0 AND idm>0"
1456 );
1457 while( db_step(&q)==SQLITE_ROW ){
1458 int idm = db_column_int(&q, 0);
1459 const char *zName;
@@ -1039,10 +1482,17 @@
1482 nOverwrite++;
1483 }else{
1484 fossil_print("ADDED %s\n", zName);
1485 }
1486 fossil_free(zFullName);
1487 db_multi_exec(
1488 "INSERT INTO mergestat(op,fnm,ridm,fnr)"
1489 "VALUES('ADDED',%Q,%d,%Q)",
1490 /* fnm */ zName,
1491 /* ridm */ db_column_int(&q,2),
1492 /* fnr */ zName
1493 );
1494 if( !dryRunFlag ){
1495 undo_save(zName);
1496 vfile_to_disk(0, idm, 0, 0);
1497 }
1498 }
1499
1500 DDED src/merge.tcl
+575
--- a/src/merge.tcl
+++ b/src/merge.tcl
@@ -0,0 +1,575 @@
1
+# Show details of a 3-way merge operation. The left-most column is the
2
+# common ancestor. The next two columns are edits of that common ancestor.
3
+# The right-most column is the result of the merge.
4
+#
5
+# There is always a "fossilcmd" variable which tells the script how to
6
+# invoke Fossil to get the information it needs. This script will
7
+# automatically append "-c N" to tell Fossil how much context it wants. True for debugging output
8
+#
9
+# If the "filelist" global variable is defined, then it is a list of
10
+# alternating "merge-type names" (ex: UPDATE, MERGE, CONFLICT, ERROR) and
11
+# filenames. In that case, the initial display shows the changes for
12
+# the first pair on the list and there is a optionmenu that allows the
13
+# useelect otheere should also be a global variable named "ncontext" which is the
14
+# number of lines of context to display. The value of this variable
15
+# controls the "-c N" argument that is appended to fossilcmdht {
16
+ TITLE {Fossil Merge}
17
+ LN_COL_BG #dddddd
18
+ LN_COL_FG #444444
19
+ TXT_COL_BG #ffffff
20
+ TXT_COL_FG #000000
21
+ MKR_COL_BG #444444
22
+ MKR_COL_FG #dddddd
23
+ CHNG_BG #d0d070
24
+ ADD_BG #c0ffc0
25
+ RM_BG #ffc0c0
26
+ HR_FG #444444
27
+ HR_PAD_TOP 4
28
+ HR_PAD_BTM 8
29
+ FN_BG #444444
30
+ FN_FG #ffffff
31
+ FN_PAD 5
32
+ ERR_FG #ee0000
33
+ PADX 5
34
+ WIDTH 80
35
+ HEIGHT 45
36
+ LB_HEIGHT 25
37
+}
38
+
39
+array set CFG_dark {
40
+ TITLE {Fossil Merge}
41
+ LN_COL_BG #dddddd
42
+ LN_COL_FG #444444
43
+ TXT_COL_BG #3f3f3f
44
+ TXT_COL_FG #dcdccc
45
+ MKR_COL_BG #444444
46
+ MKR_COL_FG #dddddd
47
+ CHNG_BG #6a6a00
48
+ ADD_BG #57934c
49
+ RM_BG #ef6767
50
+ HR_FG #444444
51
+ HR_PAD_TOP 4
52
+ HR_PAD_BTM 8
53
+ FN_BG #5e5e5e
54
+ FN_FG #ffffff
55
+ FN_PAD 5
56
+ ERR_FG #ee0000
57
+ PADX 5
58
+ WIDTH 80
59
+ HEIGHT 45
60
+ LB_HEIGHT 25
61
+}
62
+
63
+array set CFG_arr {
64
+ 0 CFG_light
65
+ 1 CFG_dark
66
+}
67
+
68
+array set CFG [array get $CFG_arr($darkmode)]
69
+
70
+if {![namespace exists ttk]} {
71
+ interp alias {} ::ttk::scrollbar {} ::scrollbar
72
+ interp alias {} ::ttk::menubutton {} ::menubutton
73
+}
74
+
75
+proc dehtml {x} {
76
+ set x [regsub -all {<[^>]*>} $x {}]
77
+ return [string map {&amp; & &lt; < &gt; > &#39; ' &quot; \"} $x]
78
+}
79
+
80
+proc cols {} {
81
+ return [list .lnA .txtA .lnB .txtB .lnC .txtC .lnD .txtD]
82
+}
83
+
84
+proc colType {c} {
85
+ regexp {[a-z]+} $c type
86
+ return $type
87
+}
88
+
89
+proc readMercmdes currentails of a 3-way merge operation# Show det for
90
+# the first pair on the list and there is a optionmenu that allows the
91
+# user to select other fiels on the list.
92
+#
93
+# This header comment is stripped off by the "mkbuiltin.c" program.
94
+#
95
+package require Tk
96
+
97
+array set CFG_light {
98
+ TITLE {Fossil Merge}
99
+ LN_COL_BG #dddddd
100
+ LN_COL_FG #444444
101
+ TXT_COL_BG #ffffff
102
+ TXT_COL_FG #000000
103
+ MKR_COL_BG #444444
104
+ MKR_COL_FG #dddddd
105
+ CHNG_BG #d0d070
106
+ ADD_BG #c0ffc0
107
+ RM_BG #ffc0c0
108
+ HR_FG #444444
109
+ HR_PAD_TOP 4
110
+ HR_PAD_BTM 8
111
+ FN_BG #444444
112
+ FN_FG #ffffff
113
+ FN_PAD 5
114
+ ERR_FG #ee0000
115
+ PADX 5
116
+ WIDTH 80
117
+ HEIGHT 45
118
+ LB_HEIGHT 25
119
+}
120
+
121
+array set CFG_dark {
122
+ TITLE {Fossil Merge}
123
+ LN_COL_BG #dddddd
124
+ LN_COL_FG #444444
125
+ TXT_COL_BG #3f3f3f
126
+ TXT_COL_FG #dcdccc
127
+ MKR_COL_BG #444444
128
+ MKR_COL_FG #dddddd
129
+ CHNG_BG #6a6a00
130
+ ADD_BG #57934c
131
+ RM_BG #ef6767
132
+ HR_FG #444444
133
+ HR_PAD_TOP 4
134
+ HR_PAD_BTM 8
135
+ FN_BG #5e5e5e
136
+ FN_FG #ffffff
137
+ FN_PAD 5
138
+ ERR_FG #ee0000
139
+ PADX 5
140
+ WIDTH 80
141
+ HEIGHT 45
142
+ LB_HEIGHT 25
143
+}
144
+
145
+array set CFG_arr {
146
+ 0 CFG_light
147
+ 1 CFG_dark
148
+}
149
+
150
+array set CFG [array get $CFG_arr($darkmode)]
151
+
152
+if {![namespace exists ttk]} {
153
+ interp alias {} ::ttk::scrollbar {} ::scrollbar
154
+ interp alias {} ::ttk::menubutton {} ::menubutton
155
+}
156
+
157
+proc dehtml {x} {
158
+ set x [regsub -all {<[^>]*>} $x {}]
159
+ return [string map {&amp; & &lt; < &gt; > &#39; ' &quot; \"} $x]
160
+}
161
+
162
+proc cols {} {
163
+ return [list .lnA .txtA .lnB .txtB .lnC .txtC .lnD .txtD]
164
+}
165
+
166
+proc colType {c} {
167
+ regexp {[a-z]+} $c type
168
+ return $type
169
+}
170
+
171
+proc readMerge {args} {
172
+ global fossilexe ncontext current_file debug
173
+ if {$ncontext=="All"} {
174
+ set cmd "| $fossilexe merge-info -c -1"
175
+ } else {
176
+ set cmd "| $fossilexe merge-info -c $ncontext"
177
+ }
178
+ if {[info exists current_file]} {
179
+ regsub {^[A-Z]+ } $current_file {} fn
180
+ lappend cmd -tcl $fn
181
+ }
182
+ if {$debug} {
183
+ regsub {^\| +} $cmd {} cmd2
184
+ puts $cmd2
185
+ flush stdout
186
+ }
187
+ if {[catch {
188
+ set in [open $cmd r]
189
+ fconfigure $in -encoding utf-8
190
+ set mergetxt [read $in]
191
+ close $in
192
+ } msg]} {
193
+ tk_messageBox -message "Unable to run command: \"$cmd\""
194
+ set mergetxt {}
195
+ }
196
+ foreach c [cols] {
197
+ $c config -state normal
198
+ $c delete 1.0 end
199
+ }
200
+ set lnA 1
201
+ set lnB 1
202
+ set lnC 1
203
+ set lnD 1
204
+ foreach {A B C D} $mergetxt {
205
+ set key1 [string index $A 0]
206
+ if {$key1=="S"} {
207
+ scan [string range $A 1 end] "%d %d %d %d" nA nB nC nD
208
+ foreach x {A B C D} {
209
+ set N [set n$x]
210
+ incr ln$x $N
211
+ if {$N>0} {
212
+ .ln$x insert end ...\n hrln
213
+ .txt$x insert end [string repeat . 30]\n hrtxt
214
+ } else {
215
+ .ln$x insert end \n hrln
216
+ .txt$x insert end \n hrtxt
217
+ }
218
+ }
219
+ continue
220
+ }
221
+ set key2 [string index $B 0]
222
+ set key3 [string index $C 0]
223
+ set key4 [string index $D 0]
224
+ if {$key1=="."} {
225
+ .lnA insert end \n -
226
+ .txtA insert end \n -
227
+ } elseif {$key1=="N"} {
228
+ .nameA config -text [string range $A 1 end]
229
+ } else {
230
+ .lnA insert end $lnA\n -
231
+ incr lnA
232
+ if {$key1=="X"} {
233
+ .txtA insert end [string range $A 1 end]\n rm
234
+ } else {
235
+ .txtA insert end [string range $A 1 end]\n -
236
+ }
237
+ }
238
+ if {$key2=="."} {
239
+ .lnB insert end \n -
240
+ .txtB insert end \n -
241
+ } elseif {$key2=="N"} {
242
+ .nameB config -text [string range $B 1 end]
243
+ } else {
244
+ .lnB insert end $lnB\n -
245
+ incr lnB
246
+ if {$key4=="2"} {set tag chng} {set tag -}
247
+ if {$key2=="1"} {
248
+ .txtB insert end [string range $A 1 end]\n $tag
249
+ } elseif {$key2=="X"} {
250
+ .txtB insert end [strin%d $mx]]
251
+ if {$::tcl_platform(platform)=="windows"} {incr lnWidth}
252
+ .lndraw .wfiles}
253
+ ge $B 1 end]\n rm
254
+ } else {
255
+ .txtB insert end [string range $B 1 end]\n $tag
256
+ }
257
+ }
258
+ if {$key3=="."} {
259
+ .lnC insert end \n -
260
+ .txtC insert end \n -
261
+ } elseif {$key3=="N"} {
262
+ .nameC config -text [string range $C 1 end]
263
+ } else {
264
+ .lnC insert end $lnC\n -
265
+ incr lnC
266
+ if {$key4=="3"} {set tag add} {set tag -}
267
+ if {$key3=="1"} {
268
+ .txtC insert end [string range $A 1 end]\n $tag
269
+ } elseif {$key3=="2"} {
270
+ .txtC insert end [string range $B 1 end]\n chng
271
+ } elseif {$key3=="X"} {
272
+ .txtC insert end [string range $C 1 end]\n rm
273
+ } else {
274
+ .txtC insert end [string range $C 1 end]\n $tag
275
+ }
276
+ }
277
+ if {$key4=="."} {
278
+ .lnD insert end \n -
279
+ .txtD insert end \n -
280
+ } elseif {$key4=="N"} {
281
+ .nameD config -text [string range $D 1 end]
282
+ } else {
283
+ .lnD insert end $lnD\n -
284
+ incr lnD
285
+ if {$key4=="1"} {
286
+ .txtD insert end [string range $A 1 end]\n -
287
+ } elseif {$key4=="2"} {
288
+ .txtD insert end [string range $B 1 end]\n chng
289
+ } elseif {$key4=="3"} {
290
+ .txtD insert end [string range $C 1 end]\n add
291
+ } elseif {$key4=="X"} {
292
+ .txtD insert end [string range $D 1 end]\n rm
293
+ } else {
294
+ .txtD insert end [string range $D 1 end]\n -
295
+ }
296
+ }
297
+ }
298
+ foreach c [cols] {
299
+ set type [colType $c]
300
+ if {$type ne "txt"} {
301
+ $c config -width 6; # $widths($type)
302
+ }
303
+ $c config -state disabled
304
+ }
305
+ set mx $lnA
306
+ if {$lnB>$mx} {set mx $lnB}
307
+ if {$lnC>$mx} {set mx $lnC}
308
+ if {$lnD>$mx} {set mx $lnD}
309
+ global lnWidth
310
+ set lnWidth [string length [format +%d $mx]]
311
+ .lnA config -width $lnWidth
312
+ .lnB config -width $lnWidth
313
+ .lnC config -width $lnWidth
314
+ .lnD config -width $lnWidth
315
+ grid columnconfig . {0 2 4 6} -minsize $lnWidth
316
+}
317
+
318
+proc viewDiff {idx} {
319
+ .txtA yview $idx
320
+ .txtA xview moveto 0
321
+}
322
+
323
+proc cycleDiffs {{reverse 0}} {
324
+ if {$reverse} {
325
+ set range [.txtA tag prevrange fn @0,0 1.0]
326
+ if {$range eq ""} {
327
+ viewDiff {fn.last -1c}
328
+ } else {
329
+ viewDiff [lindex $range 0]
330
+ }
331
+ } else {
332
+ set range [.txtA tag nextrange fn {@0,0 +1c} end]
333
+ if {$range eq "" || [lindex [.txtA yview] 1] == 1} {
334
+ viewDiff fn.first
335
+ } else {
336
+ viewDiff [lindex $range 0]
337
+ }
338
+ }
339
+}
340
+
341
+proc xvis {col} {
342
+ set view [$col xview]
343
+ return [expr {[lindex $view 1]-[lindex $view 0]}]
344
+}
345
+
346
+proc scroll-x {args} {
347
+ set c .txt[expr {[xvis .txtA] < [xvis .txtB] ? "A" : "B"}]
348
+ eval $c xview $args
349
+}
350
+
351
+interp alias {} scroll-y {} .txtA yview
352
+
353
+proc noop {args} {}
354
+
355
+proc enableSync {axis} {
356
+ update idletasks
357
+ interp alias {} sync-$axis {}
358
+ rename _sync-$axis sync-$axis
359
+}
360
+
361
+proc disableSync {axis} {
362
+ rename sync-$axis _sync-$axis
363
+ interp alias {} sync-$axis {} noop
364
+}
365
+
366
+proc sync-y {first last} {
367
+ disableSync y
368
+ foreach c [cols] {
369
+ $c yview moveto $first
370
+ }
371
+ if {$first > 0 || $last < 1} {
372
+ grid .sby
373
+ .sby set $first $last
374
+ } else {
375
+ grid remove .sby
376
+ }
377
+ enableSync y
378
+}
379
+
380
+wm withdraw .
381
+wm title . $CFG(TITLE)
382
+wm iconname . $CFG(TITLE)
383
+# Keystroke bindings for on the top-level window for navigation and
384
+# control also fire when those same keystrokes are pressed in the
385
+# Search entry box. Disable them, to prevent the diff screen from
386
+# disappearing abruptly and unexpectedly when searching for "q".
387
+#
388
+bind . <Control-q> exit
389
+bind . <Control-p> {catch searchPrev; break}
390
+bind . <Control-n> {catch searchNext; break}
391
+bind . <Escape><Escape> exit
392
+bind . <Destroy> {after 0 exit}
393
+bind . <Tab> {cycleDiffs; break}
394
+bind . <<PrevWindow>> {cycleDiffs 1; break}
395
+bind . <Control-f> {searchOnOff; break}
396
+bind . <Control-g> {catch searchNext; break}
397
+bind . <Return> {
398
+ event generate .bb.files <1>
399
+ event generate .bb.files <ButtonRelease-1>
400
+ break
401
+}
402
+foreach {key axis args} {
403
+ Up y {scroll -5 units}
404
+ k y {scroll -5 units}
405
+ Down y {scroll 5 units}
406
+ j y {scroll 5 units}
407
+ Left x {scroll -5 units}
408
+ h x {scroll -5 units}
409
+ Right x {scroll 5 units}
410
+ l x {scroll 5 units}
411
+ Prior y {scroll -1 page}
412
+ b y {scroll -1 page}
413
+ Next y {scroll 1 page}
414
+ space y {scroll 1 page}
415
+ Home y {moveto 0}
416
+ g y {moveto 0}
417
+ End y {moveto 1}
418
+} {
419
+ bind . <$key> "scroll-$axis $args; break"
420
+ bind . <Shift-$key> continue
421
+}
422
+
423
+frame .bb
424
+::ttk::menubutton .bb.diff2 -text {2-way diffs
425
+.bb.diff2.m add command -label {baseline vs. local} -command {two-way 12}
426
+.bb.diff2.m add command -label {baseline vs. merge-in} -command {two-way 13}
427
+.bb.diff2.m add command -label {local vs. merge-in} -command {two-way 23}
428
+
429
+# Bring up a separate two-way diff between a pair of columns
430
+# the argument is one of:
431
+# 12 Baseline versus Local
432
+# 13 Baseline versus Merge-in
433
+# 23 Local versus Merge-in
434
+#
435
+proc two-way {mode} {
436
+ global current_file fossilexe debug darkmode ncontext
437
+ regsub {^[A-Z]+ } $current_file {} fn
438
+ set cmd $fossilexe
439
+ lappend cmd merge-info --diff$mode $fn -c $ncontext
440
+ if {$darkmode} {
441
+ lappend cmd --dark
442
+ }
443
+ if {$debug} {
444
+ lappend cc {*}$cmd &
445
+}
446
+
447
+set useOptionMenu 1
448
+if {[info exists filelist]} {
449
+ set current_file "[lindex $filelist 0] [lindex $filelist 1]"
450
+ if {[llength $filelist]>2} {
451
+ trace add variable current_file write readMerge
452
+
453
+ if {$tcl_platform(os)=="Darwin" || [llength $filelist]<30} {
454
+ set fnlist {}
455
+ foreach {op fn} $filelist {lappend fnlist "$op $fn"}
456
+ tk_optionMenu .bb.files current_file {*}$fnlist
457
+ } else {
458
+ set useOptionMenu 0
459
+ ::ttk::menubutton .bb.files -text $current_file
460
+ if {[tk windowingsystem] eq "win32"} {
461
+ ::ttk::style theme use winnative
462
+ .bb.files configure -padding {20 1 10 2}
463
+ }
464
+ toplevel .wfiles
465
+ wm withdraw .wfiles
466
+ update idletasks
467
+ wm transient .wfiles .
468
+ B B .txtAy {scroll 1 page}
469
+ sveto 0}
470
+ g y {moveto 0}
471
+ End y {moveto 1}
472
+} {
473
+ bind . <$key> "scroll-$axis $args; break"
474
+ bind . <Shift-$key> continue
475
+}
476
+
477
+frame .bb
478
+::ttk::menubutton .bb.diff2 -text {2-way diffs
479
+.bb.diff2.m add command -label {baseline vs. local} -command {two-way 12}
480
+.bb.diff2.m add command -label {baseline vs. merge-in} -command {two-way 13}
481
+.bb.diff2.m add command -label {local vs. merge-in} -command {two-way 23}
482
+
483
+# Bring up a separate two-way diff between a pair of co44444
484
+ HR_PAD_TOP 4
485
+ set ::current_file [%W get $ii]
486
+ .bb.files config -text $::current_file
487
+ focus .
488
+ break
489
+ }
490
+ }
491
+ bind .wfiles.lb <Motion> {
492
+ %W selection clear 0 end
493
+ %W selection set @%x,%y
494
+ }
495
+ }
496
+ }
497
+}
498
+
499
+label .bb.ctxtag -text "Context:"
500
+set context_choices {3 6 12 25 50 100 All}
501
+if {$ncontext<0} {set ncontext All}
502
+trace add variable ncontext write readMerge
503
+if {$tcl_platform(os)=="Darwin" || $useOptionMenu} {
504
+ tk_optionMenu .bb.ctx ncontext {*}$context_choices
505
+} else {
506
+ ::ttk::menubutton .bb.ctx -text $ncontext
507
+ if {[tk windowingsystem] eq "win32"} {
508
+ ::ttk::style theme use winnative
509
+ .bb.ctx configure -padding {20 1 10 2}
510
+ }
511
+ toplevel .wctx
512
+ wm withdraw .wctx
513
+ update idletasks
514
+ wm transient .wctx .
515
+ wm overrideredirect .wctx 1
516
+ listbox .wctx.lb -width 0 -height 7 -activestyle none
517
+ .wctx.lb insert end {*}$context_choices
518
+ pack .wctx.lb
519
+ bind .bb.ctx <1> {
520
+ set x [winfo rootx %W]
521
+ set y [expr {[winfo rooty %W]+[winfo height %W]}]
522
+ wm geometry .wctx +$x+$y
523
+ wm deiconify .wctx
524
+ focus .wctx.lb
525
+ }
526
+ bind .wctx <FocusOut> {wm withdraw .wctx}
527
+ bind .wctx <Escape> {focus .}
528
+ foreach evt {1 Return} {
529
+ bind .wctx.lb <$evt> {
530
+ set ::ncontext [lindex $::context_choices [%W curselection]]
531
+ .bb.ctx config -text $::ncontext
532
+ focus .
533
+ break
534
+ }
535
+ }
536
+ bind .wctx.lb <Motion> {
537
+ %W selection clear 0 end
538
+ %W selection set @%x,%y
539
+ }
540
+}
541
+
542
+foreach {side syncCol} {A .txtA B .txtB C .txtC D .txtD} {
543
+ set ln .ln$side
544
+ text $ln -width 6
545
+ $ln tag config - -justify right
546
+
547
+ set txt .txt$side
548
+ text $txt -width $CFG(WIDTH) -height $CFG(HEIGHT) -wrap none \
549
+ -xscroll ".sbx$side set"
550
+ catch {$txt config -tabstyle wordprocessor} ;# Required for Tk>=8.5
551
+ foreach tag {add rm chng} {
552
+ $txt tag config $tag -background $CFG([string toupper $tag]_BG)
553
+ $txt tag lower $tag
554
+ }
555
+ $txt tag config fn -background $CFG(FN_BG) -foreground $CFG(FN_FG) \
556
+ -justify center
557
+ $txt tag config err -foreground $CFG(ERR_FG)
558
+}
559
+text .mkr
560
+
561
+set mxwidth [lindex [wm maxsize .] 0]
562
+while {$CFG(WIDTH)>=40} {
563
+ set wanted [expr {([winfo reqwidth .lnA]+[winfo reqwidth .txtA])*4+30}]
564
+ if {$wanted<=$mxwidth} break
565
+ incr CFG(WIDTH) -10
566
+ .txtA config -width $CFG(WIDTH)
567
+ .txtB config -width $CFG(WIDTH)
568
+ .txtC config -width $CFG(WIDTH)
569
+ .txtD config -width $CFG(WIDTH)
570
+}
571
+
572
+foreach c [cols] {
573
+ set keyPrefix [string toupper [colType $c]]_COL_
574
+ if {[tk windowingsystem] eq "win32"} {$c config -font {courier 9}}
575
+ $c co
--- a/src/merge.tcl
+++ b/src/merge.tcl
@@ -0,0 +1,575 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/src/merge.tcl
+++ b/src/merge.tcl
@@ -0,0 +1,575 @@
1 # Show details of a 3-way merge operation. The left-most column is the
2 # common ancestor. The next two columns are edits of that common ancestor.
3 # The right-most column is the result of the merge.
4 #
5 # There is always a "fossilcmd" variable which tells the script how to
6 # invoke Fossil to get the information it needs. This script will
7 # automatically append "-c N" to tell Fossil how much context it wants. True for debugging output
8 #
9 # If the "filelist" global variable is defined, then it is a list of
10 # alternating "merge-type names" (ex: UPDATE, MERGE, CONFLICT, ERROR) and
11 # filenames. In that case, the initial display shows the changes for
12 # the first pair on the list and there is a optionmenu that allows the
13 # useelect otheere should also be a global variable named "ncontext" which is the
14 # number of lines of context to display. The value of this variable
15 # controls the "-c N" argument that is appended to fossilcmdht {
16 TITLE {Fossil Merge}
17 LN_COL_BG #dddddd
18 LN_COL_FG #444444
19 TXT_COL_BG #ffffff
20 TXT_COL_FG #000000
21 MKR_COL_BG #444444
22 MKR_COL_FG #dddddd
23 CHNG_BG #d0d070
24 ADD_BG #c0ffc0
25 RM_BG #ffc0c0
26 HR_FG #444444
27 HR_PAD_TOP 4
28 HR_PAD_BTM 8
29 FN_BG #444444
30 FN_FG #ffffff
31 FN_PAD 5
32 ERR_FG #ee0000
33 PADX 5
34 WIDTH 80
35 HEIGHT 45
36 LB_HEIGHT 25
37 }
38
39 array set CFG_dark {
40 TITLE {Fossil Merge}
41 LN_COL_BG #dddddd
42 LN_COL_FG #444444
43 TXT_COL_BG #3f3f3f
44 TXT_COL_FG #dcdccc
45 MKR_COL_BG #444444
46 MKR_COL_FG #dddddd
47 CHNG_BG #6a6a00
48 ADD_BG #57934c
49 RM_BG #ef6767
50 HR_FG #444444
51 HR_PAD_TOP 4
52 HR_PAD_BTM 8
53 FN_BG #5e5e5e
54 FN_FG #ffffff
55 FN_PAD 5
56 ERR_FG #ee0000
57 PADX 5
58 WIDTH 80
59 HEIGHT 45
60 LB_HEIGHT 25
61 }
62
63 array set CFG_arr {
64 0 CFG_light
65 1 CFG_dark
66 }
67
68 array set CFG [array get $CFG_arr($darkmode)]
69
70 if {![namespace exists ttk]} {
71 interp alias {} ::ttk::scrollbar {} ::scrollbar
72 interp alias {} ::ttk::menubutton {} ::menubutton
73 }
74
75 proc dehtml {x} {
76 set x [regsub -all {<[^>]*>} $x {}]
77 return [string map {&amp; & &lt; < &gt; > &#39; ' &quot; \"} $x]
78 }
79
80 proc cols {} {
81 return [list .lnA .txtA .lnB .txtB .lnC .txtC .lnD .txtD]
82 }
83
84 proc colType {c} {
85 regexp {[a-z]+} $c type
86 return $type
87 }
88
89 proc readMercmdes currentails of a 3-way merge operation# Show det for
90 # the first pair on the list and there is a optionmenu that allows the
91 # user to select other fiels on the list.
92 #
93 # This header comment is stripped off by the "mkbuiltin.c" program.
94 #
95 package require Tk
96
97 array set CFG_light {
98 TITLE {Fossil Merge}
99 LN_COL_BG #dddddd
100 LN_COL_FG #444444
101 TXT_COL_BG #ffffff
102 TXT_COL_FG #000000
103 MKR_COL_BG #444444
104 MKR_COL_FG #dddddd
105 CHNG_BG #d0d070
106 ADD_BG #c0ffc0
107 RM_BG #ffc0c0
108 HR_FG #444444
109 HR_PAD_TOP 4
110 HR_PAD_BTM 8
111 FN_BG #444444
112 FN_FG #ffffff
113 FN_PAD 5
114 ERR_FG #ee0000
115 PADX 5
116 WIDTH 80
117 HEIGHT 45
118 LB_HEIGHT 25
119 }
120
121 array set CFG_dark {
122 TITLE {Fossil Merge}
123 LN_COL_BG #dddddd
124 LN_COL_FG #444444
125 TXT_COL_BG #3f3f3f
126 TXT_COL_FG #dcdccc
127 MKR_COL_BG #444444
128 MKR_COL_FG #dddddd
129 CHNG_BG #6a6a00
130 ADD_BG #57934c
131 RM_BG #ef6767
132 HR_FG #444444
133 HR_PAD_TOP 4
134 HR_PAD_BTM 8
135 FN_BG #5e5e5e
136 FN_FG #ffffff
137 FN_PAD 5
138 ERR_FG #ee0000
139 PADX 5
140 WIDTH 80
141 HEIGHT 45
142 LB_HEIGHT 25
143 }
144
145 array set CFG_arr {
146 0 CFG_light
147 1 CFG_dark
148 }
149
150 array set CFG [array get $CFG_arr($darkmode)]
151
152 if {![namespace exists ttk]} {
153 interp alias {} ::ttk::scrollbar {} ::scrollbar
154 interp alias {} ::ttk::menubutton {} ::menubutton
155 }
156
157 proc dehtml {x} {
158 set x [regsub -all {<[^>]*>} $x {}]
159 return [string map {&amp; & &lt; < &gt; > &#39; ' &quot; \"} $x]
160 }
161
162 proc cols {} {
163 return [list .lnA .txtA .lnB .txtB .lnC .txtC .lnD .txtD]
164 }
165
166 proc colType {c} {
167 regexp {[a-z]+} $c type
168 return $type
169 }
170
171 proc readMerge {args} {
172 global fossilexe ncontext current_file debug
173 if {$ncontext=="All"} {
174 set cmd "| $fossilexe merge-info -c -1"
175 } else {
176 set cmd "| $fossilexe merge-info -c $ncontext"
177 }
178 if {[info exists current_file]} {
179 regsub {^[A-Z]+ } $current_file {} fn
180 lappend cmd -tcl $fn
181 }
182 if {$debug} {
183 regsub {^\| +} $cmd {} cmd2
184 puts $cmd2
185 flush stdout
186 }
187 if {[catch {
188 set in [open $cmd r]
189 fconfigure $in -encoding utf-8
190 set mergetxt [read $in]
191 close $in
192 } msg]} {
193 tk_messageBox -message "Unable to run command: \"$cmd\""
194 set mergetxt {}
195 }
196 foreach c [cols] {
197 $c config -state normal
198 $c delete 1.0 end
199 }
200 set lnA 1
201 set lnB 1
202 set lnC 1
203 set lnD 1
204 foreach {A B C D} $mergetxt {
205 set key1 [string index $A 0]
206 if {$key1=="S"} {
207 scan [string range $A 1 end] "%d %d %d %d" nA nB nC nD
208 foreach x {A B C D} {
209 set N [set n$x]
210 incr ln$x $N
211 if {$N>0} {
212 .ln$x insert end ...\n hrln
213 .txt$x insert end [string repeat . 30]\n hrtxt
214 } else {
215 .ln$x insert end \n hrln
216 .txt$x insert end \n hrtxt
217 }
218 }
219 continue
220 }
221 set key2 [string index $B 0]
222 set key3 [string index $C 0]
223 set key4 [string index $D 0]
224 if {$key1=="."} {
225 .lnA insert end \n -
226 .txtA insert end \n -
227 } elseif {$key1=="N"} {
228 .nameA config -text [string range $A 1 end]
229 } else {
230 .lnA insert end $lnA\n -
231 incr lnA
232 if {$key1=="X"} {
233 .txtA insert end [string range $A 1 end]\n rm
234 } else {
235 .txtA insert end [string range $A 1 end]\n -
236 }
237 }
238 if {$key2=="."} {
239 .lnB insert end \n -
240 .txtB insert end \n -
241 } elseif {$key2=="N"} {
242 .nameB config -text [string range $B 1 end]
243 } else {
244 .lnB insert end $lnB\n -
245 incr lnB
246 if {$key4=="2"} {set tag chng} {set tag -}
247 if {$key2=="1"} {
248 .txtB insert end [string range $A 1 end]\n $tag
249 } elseif {$key2=="X"} {
250 .txtB insert end [strin%d $mx]]
251 if {$::tcl_platform(platform)=="windows"} {incr lnWidth}
252 .lndraw .wfiles}
253 ge $B 1 end]\n rm
254 } else {
255 .txtB insert end [string range $B 1 end]\n $tag
256 }
257 }
258 if {$key3=="."} {
259 .lnC insert end \n -
260 .txtC insert end \n -
261 } elseif {$key3=="N"} {
262 .nameC config -text [string range $C 1 end]
263 } else {
264 .lnC insert end $lnC\n -
265 incr lnC
266 if {$key4=="3"} {set tag add} {set tag -}
267 if {$key3=="1"} {
268 .txtC insert end [string range $A 1 end]\n $tag
269 } elseif {$key3=="2"} {
270 .txtC insert end [string range $B 1 end]\n chng
271 } elseif {$key3=="X"} {
272 .txtC insert end [string range $C 1 end]\n rm
273 } else {
274 .txtC insert end [string range $C 1 end]\n $tag
275 }
276 }
277 if {$key4=="."} {
278 .lnD insert end \n -
279 .txtD insert end \n -
280 } elseif {$key4=="N"} {
281 .nameD config -text [string range $D 1 end]
282 } else {
283 .lnD insert end $lnD\n -
284 incr lnD
285 if {$key4=="1"} {
286 .txtD insert end [string range $A 1 end]\n -
287 } elseif {$key4=="2"} {
288 .txtD insert end [string range $B 1 end]\n chng
289 } elseif {$key4=="3"} {
290 .txtD insert end [string range $C 1 end]\n add
291 } elseif {$key4=="X"} {
292 .txtD insert end [string range $D 1 end]\n rm
293 } else {
294 .txtD insert end [string range $D 1 end]\n -
295 }
296 }
297 }
298 foreach c [cols] {
299 set type [colType $c]
300 if {$type ne "txt"} {
301 $c config -width 6; # $widths($type)
302 }
303 $c config -state disabled
304 }
305 set mx $lnA
306 if {$lnB>$mx} {set mx $lnB}
307 if {$lnC>$mx} {set mx $lnC}
308 if {$lnD>$mx} {set mx $lnD}
309 global lnWidth
310 set lnWidth [string length [format +%d $mx]]
311 .lnA config -width $lnWidth
312 .lnB config -width $lnWidth
313 .lnC config -width $lnWidth
314 .lnD config -width $lnWidth
315 grid columnconfig . {0 2 4 6} -minsize $lnWidth
316 }
317
318 proc viewDiff {idx} {
319 .txtA yview $idx
320 .txtA xview moveto 0
321 }
322
323 proc cycleDiffs {{reverse 0}} {
324 if {$reverse} {
325 set range [.txtA tag prevrange fn @0,0 1.0]
326 if {$range eq ""} {
327 viewDiff {fn.last -1c}
328 } else {
329 viewDiff [lindex $range 0]
330 }
331 } else {
332 set range [.txtA tag nextrange fn {@0,0 +1c} end]
333 if {$range eq "" || [lindex [.txtA yview] 1] == 1} {
334 viewDiff fn.first
335 } else {
336 viewDiff [lindex $range 0]
337 }
338 }
339 }
340
341 proc xvis {col} {
342 set view [$col xview]
343 return [expr {[lindex $view 1]-[lindex $view 0]}]
344 }
345
346 proc scroll-x {args} {
347 set c .txt[expr {[xvis .txtA] < [xvis .txtB] ? "A" : "B"}]
348 eval $c xview $args
349 }
350
351 interp alias {} scroll-y {} .txtA yview
352
353 proc noop {args} {}
354
355 proc enableSync {axis} {
356 update idletasks
357 interp alias {} sync-$axis {}
358 rename _sync-$axis sync-$axis
359 }
360
361 proc disableSync {axis} {
362 rename sync-$axis _sync-$axis
363 interp alias {} sync-$axis {} noop
364 }
365
366 proc sync-y {first last} {
367 disableSync y
368 foreach c [cols] {
369 $c yview moveto $first
370 }
371 if {$first > 0 || $last < 1} {
372 grid .sby
373 .sby set $first $last
374 } else {
375 grid remove .sby
376 }
377 enableSync y
378 }
379
380 wm withdraw .
381 wm title . $CFG(TITLE)
382 wm iconname . $CFG(TITLE)
383 # Keystroke bindings for on the top-level window for navigation and
384 # control also fire when those same keystrokes are pressed in the
385 # Search entry box. Disable them, to prevent the diff screen from
386 # disappearing abruptly and unexpectedly when searching for "q".
387 #
388 bind . <Control-q> exit
389 bind . <Control-p> {catch searchPrev; break}
390 bind . <Control-n> {catch searchNext; break}
391 bind . <Escape><Escape> exit
392 bind . <Destroy> {after 0 exit}
393 bind . <Tab> {cycleDiffs; break}
394 bind . <<PrevWindow>> {cycleDiffs 1; break}
395 bind . <Control-f> {searchOnOff; break}
396 bind . <Control-g> {catch searchNext; break}
397 bind . <Return> {
398 event generate .bb.files <1>
399 event generate .bb.files <ButtonRelease-1>
400 break
401 }
402 foreach {key axis args} {
403 Up y {scroll -5 units}
404 k y {scroll -5 units}
405 Down y {scroll 5 units}
406 j y {scroll 5 units}
407 Left x {scroll -5 units}
408 h x {scroll -5 units}
409 Right x {scroll 5 units}
410 l x {scroll 5 units}
411 Prior y {scroll -1 page}
412 b y {scroll -1 page}
413 Next y {scroll 1 page}
414 space y {scroll 1 page}
415 Home y {moveto 0}
416 g y {moveto 0}
417 End y {moveto 1}
418 } {
419 bind . <$key> "scroll-$axis $args; break"
420 bind . <Shift-$key> continue
421 }
422
423 frame .bb
424 ::ttk::menubutton .bb.diff2 -text {2-way diffs
425 .bb.diff2.m add command -label {baseline vs. local} -command {two-way 12}
426 .bb.diff2.m add command -label {baseline vs. merge-in} -command {two-way 13}
427 .bb.diff2.m add command -label {local vs. merge-in} -command {two-way 23}
428
429 # Bring up a separate two-way diff between a pair of columns
430 # the argument is one of:
431 # 12 Baseline versus Local
432 # 13 Baseline versus Merge-in
433 # 23 Local versus Merge-in
434 #
435 proc two-way {mode} {
436 global current_file fossilexe debug darkmode ncontext
437 regsub {^[A-Z]+ } $current_file {} fn
438 set cmd $fossilexe
439 lappend cmd merge-info --diff$mode $fn -c $ncontext
440 if {$darkmode} {
441 lappend cmd --dark
442 }
443 if {$debug} {
444 lappend cc {*}$cmd &
445 }
446
447 set useOptionMenu 1
448 if {[info exists filelist]} {
449 set current_file "[lindex $filelist 0] [lindex $filelist 1]"
450 if {[llength $filelist]>2} {
451 trace add variable current_file write readMerge
452
453 if {$tcl_platform(os)=="Darwin" || [llength $filelist]<30} {
454 set fnlist {}
455 foreach {op fn} $filelist {lappend fnlist "$op $fn"}
456 tk_optionMenu .bb.files current_file {*}$fnlist
457 } else {
458 set useOptionMenu 0
459 ::ttk::menubutton .bb.files -text $current_file
460 if {[tk windowingsystem] eq "win32"} {
461 ::ttk::style theme use winnative
462 .bb.files configure -padding {20 1 10 2}
463 }
464 toplevel .wfiles
465 wm withdraw .wfiles
466 update idletasks
467 wm transient .wfiles .
468 B B .txtAy {scroll 1 page}
469 sveto 0}
470 g y {moveto 0}
471 End y {moveto 1}
472 } {
473 bind . <$key> "scroll-$axis $args; break"
474 bind . <Shift-$key> continue
475 }
476
477 frame .bb
478 ::ttk::menubutton .bb.diff2 -text {2-way diffs
479 .bb.diff2.m add command -label {baseline vs. local} -command {two-way 12}
480 .bb.diff2.m add command -label {baseline vs. merge-in} -command {two-way 13}
481 .bb.diff2.m add command -label {local vs. merge-in} -command {two-way 23}
482
483 # Bring up a separate two-way diff between a pair of co44444
484 HR_PAD_TOP 4
485 set ::current_file [%W get $ii]
486 .bb.files config -text $::current_file
487 focus .
488 break
489 }
490 }
491 bind .wfiles.lb <Motion> {
492 %W selection clear 0 end
493 %W selection set @%x,%y
494 }
495 }
496 }
497 }
498
499 label .bb.ctxtag -text "Context:"
500 set context_choices {3 6 12 25 50 100 All}
501 if {$ncontext<0} {set ncontext All}
502 trace add variable ncontext write readMerge
503 if {$tcl_platform(os)=="Darwin" || $useOptionMenu} {
504 tk_optionMenu .bb.ctx ncontext {*}$context_choices
505 } else {
506 ::ttk::menubutton .bb.ctx -text $ncontext
507 if {[tk windowingsystem] eq "win32"} {
508 ::ttk::style theme use winnative
509 .bb.ctx configure -padding {20 1 10 2}
510 }
511 toplevel .wctx
512 wm withdraw .wctx
513 update idletasks
514 wm transient .wctx .
515 wm overrideredirect .wctx 1
516 listbox .wctx.lb -width 0 -height 7 -activestyle none
517 .wctx.lb insert end {*}$context_choices
518 pack .wctx.lb
519 bind .bb.ctx <1> {
520 set x [winfo rootx %W]
521 set y [expr {[winfo rooty %W]+[winfo height %W]}]
522 wm geometry .wctx +$x+$y
523 wm deiconify .wctx
524 focus .wctx.lb
525 }
526 bind .wctx <FocusOut> {wm withdraw .wctx}
527 bind .wctx <Escape> {focus .}
528 foreach evt {1 Return} {
529 bind .wctx.lb <$evt> {
530 set ::ncontext [lindex $::context_choices [%W curselection]]
531 .bb.ctx config -text $::ncontext
532 focus .
533 break
534 }
535 }
536 bind .wctx.lb <Motion> {
537 %W selection clear 0 end
538 %W selection set @%x,%y
539 }
540 }
541
542 foreach {side syncCol} {A .txtA B .txtB C .txtC D .txtD} {
543 set ln .ln$side
544 text $ln -width 6
545 $ln tag config - -justify right
546
547 set txt .txt$side
548 text $txt -width $CFG(WIDTH) -height $CFG(HEIGHT) -wrap none \
549 -xscroll ".sbx$side set"
550 catch {$txt config -tabstyle wordprocessor} ;# Required for Tk>=8.5
551 foreach tag {add rm chng} {
552 $txt tag config $tag -background $CFG([string toupper $tag]_BG)
553 $txt tag lower $tag
554 }
555 $txt tag config fn -background $CFG(FN_BG) -foreground $CFG(FN_FG) \
556 -justify center
557 $txt tag config err -foreground $CFG(ERR_FG)
558 }
559 text .mkr
560
561 set mxwidth [lindex [wm maxsize .] 0]
562 while {$CFG(WIDTH)>=40} {
563 set wanted [expr {([winfo reqwidth .lnA]+[winfo reqwidth .txtA])*4+30}]
564 if {$wanted<=$mxwidth} break
565 incr CFG(WIDTH) -10
566 .txtA config -width $CFG(WIDTH)
567 .txtB config -width $CFG(WIDTH)
568 .txtC config -width $CFG(WIDTH)
569 .txtD config -width $CFG(WIDTH)
570 }
571
572 foreach c [cols] {
573 set keyPrefix [string toupper [colType $c]]_COL_
574 if {[tk windowingsystem] eq "win32"} {$c config -font {courier 9}}
575 $c co
+804 -168
--- src/merge3.c
+++ src/merge3.c
@@ -75,75 +75,17 @@
7575
if( aC1[2]!=aC2[2] ) return 0;
7676
if( sameLines(pV1, pV2, aC1[2]) ) return 1;
7777
return 0;
7878
}
7979
80
-/*
81
-** The aC[] array contains triples of integers. Within each triple, the
82
-** elements are:
83
-**
84
-** (0) The number of lines to copy
85
-** (1) The number of lines to delete
86
-** (2) The number of liens to insert
87
-**
88
-** Suppose we want to advance over sz lines of the original file. This routine
89
-** returns true if that advance would land us on a copy operation. It
90
-** returns false if the advance would end on a delete.
91
-*/
92
-static int ends_at_CPY(int *aC, int sz){
93
- while( sz>0 && (aC[0]>0 || aC[1]>0 || aC[2]>0) ){
94
- if( aC[0]>=sz ) return 1;
95
- sz -= aC[0];
96
- if( aC[1]>sz ) return 0;
97
- sz -= aC[1];
98
- aC += 3;
99
- }
100
- return 1;
101
-}
102
-
103
-/*
104
-** pSrc contains an edited file where aC[] describes the edit. Part of
105
-** pSrc has already been output. This routine outputs additional lines
106
-** of pSrc - lines that correspond to the next sz lines of the original
107
-** unedited file.
108
-**
109
-** Note that sz counts the number of lines of text in the original file.
110
-** But text is output from the edited file. So the number of lines transfer
111
-** to pOut might be different from sz. Fewer lines appear in pOut if there
112
-** are deletes. More lines appear if there are inserts.
113
-**
114
-** The aC[] array is updated and the new index into aC[] is returned.
115
-*/
116
-static int output_one_side(
117
- Blob *pOut, /* Write to this blob */
118
- Blob *pSrc, /* The edited file that is to be copied to pOut */
119
- int *aC, /* Array of integer triples describing the edit */
120
- int i, /* Index in aC[] of current location in pSrc */
121
- int sz, /* Number of lines in unedited source to output */
122
- int *pLn /* Line number counter */
123
-){
124
- while( sz>0 ){
125
- if( aC[i]==0 && aC[i+1]==0 && aC[i+2]==0 ) break;
126
- if( aC[i]>=sz ){
127
- blob_copy_lines(pOut, pSrc, sz); *pLn += sz;
128
- aC[i] -= sz;
129
- break;
130
- }
131
- blob_copy_lines(pOut, pSrc, aC[i]); *pLn += aC[i];
132
- blob_copy_lines(pOut, pSrc, aC[i+2]); *pLn += aC[i+2];
133
- sz -= aC[i] + aC[i+1];
134
- i += 3;
135
- }
136
- return i;
137
-}
138
-
13980
/*
14081
** Text of boundary markers for merge conflicts.
14182
*/
14283
static const char *const mergeMarker[] = {
14384
/*123456789 123456789 123456789 123456789 123456789 123456789 123456789*/
14485
"<<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<<",
86
+ "####### SUGGESTED CONFLICT RESOLUTION follows ###################",
14587
"||||||| COMMON ANCESTOR content follows |||||||||||||||||||||||||",
14688
"======= MERGED IN content follows ===============================",
14789
">>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
14890
};
14991
@@ -186,10 +128,615 @@
186128
ensure_line_end(pOut, useCrLf);
187129
blob_append(pOut, mergeMarker[iMark], -1);
188130
if( ln>0 ) blob_appendf(pOut, " (line %d)", ln);
189131
ensure_line_end(pOut, useCrLf);
190132
}
133
+
134
+#if INTERFACE
135
+/*
136
+** This is an abstract class for constructing a merge.
137
+** Subclasses of this object format the merge output in different ways.
138
+**
139
+** To subclass, create an instance of the MergeBuilder object and fill
140
+** in appropriate method implementations.
141
+*/
142
+struct MergeBuilder {
143
+ void (*xStart)(MergeBuilder*);
144
+ void (*xSame)(MergeBuilder*, unsigned int);
145
+ void (*xChngV1)(MergeBuilder*, unsigned int, unsigned int);
146
+ void (*xChngV2)(MergeBuilder*, unsigned int, unsigned int);
147
+ void (*xChngBoth)(MergeBuilder*, unsigned int, unsigned int);
148
+ void (*xConflict)(MergeBuilder*, unsigned int, unsigned int, unsigned int);
149
+ void (*xEnd)(MergeBuilder*);
150
+ void (*xDestroy)(MergeBuilder*);
151
+ const char *zPivot; /* Label or name for the pivot */
152
+ const char *zV1; /* Label or name for the V1 file */
153
+ const char *zV2; /* Label or name for the V2 file */
154
+ const char *zOut; /* Label or name for the output */
155
+ Blob *pPivot; /* The common ancestor */
156
+ Blob *pV1; /* First variant (local copy) */
157
+ Blob *pV2; /* Second variant (merged in) */
158
+ Blob *pOut; /* Write merge results here */
159
+ int useCrLf; /* Use CRLF line endings */
160
+ int nContext; /* Size of unchanged line boundaries */
161
+ unsigned int mxPivot; /* Number of lines in the pivot */
162
+ unsigned int mxV1; /* Number of lines in V1 */
163
+ unsigned int mxV2; /* Number of lines in V2 */
164
+ unsigned int lnPivot; /* Lines read from pivot */
165
+ unsigned int lnV1; /* Lines read from v1 */
166
+ unsigned int lnV2; /* Lines read from v2 */
167
+ unsigned int lnOut; /* Lines written to out */
168
+ unsigned int nConflict; /* Number of conflicts seen */
169
+ u64 diffFlags; /* Flags for difference engine */
170
+};
171
+#endif /* INTERFACE */
172
+
173
+
174
+/************************* Generic MergeBuilder ******************************/
175
+/* These are generic methods for MergeBuilder. They just output debugging
176
+** information. But some of them are useful as base methods for other useful
177
+** implementations of MergeBuilder.
178
+*/
179
+
180
+/* xStart() and xEnd() are called to generate header and fotter information
181
+** in the output. This is a no-op in the generic implementation.
182
+*/
183
+static void dbgStartEnd(MergeBuilder *p){ (void)p; }
184
+
185
+/* The next N lines of PIVOT are unchanged in both V1 and V2
186
+*/
187
+static void dbgSame(MergeBuilder *p, unsigned int N){
188
+ blob_appendf(p->pOut,
189
+ "COPY %u from BASELINE(%u..%u) or V1(%u..%u) or V2(%u..%u)\n",
190
+ N, p->lnPivot+1, p->lnPivot+N, p->lnV1+1, p->lnV1+N,
191
+ p->lnV2+1, p->lnV2+N);
192
+ p->lnPivot += N;
193
+ p->lnV1 += N;
194
+ p->lnV2 += N;
195
+}
196
+
197
+/* The next nPivot lines of the PIVOT are changed into nV1 lines by V1
198
+*/
199
+static void dbgChngV1(MergeBuilder *p, unsigned int nPivot, unsigned int nV1){
200
+ blob_appendf(p->pOut, "COPY %u from V1(%u..%u)\n",
201
+ nV1, p->lnV1+1, p->lnV1+nV1);
202
+ p->lnPivot += nPivot;
203
+ p->lnV2 += nPivot;
204
+ p->lnV1 += nV1;
205
+}
206
+
207
+/* The next nPivot lines of the PIVOT are changed into nV2 lines by V2
208
+*/
209
+static void dbgChngV2(MergeBuilder *p, unsigned int nPivot, unsigned int nV2){
210
+ blob_appendf(p->pOut, "COPY %u lines FROM V2(%u..%u)\n",
211
+ nV2, p->lnV2+1, p->lnV2+nV2);
212
+ p->lnPivot += nPivot;
213
+ p->lnV1 += nPivot;
214
+ p->lnV2 += nV2;
215
+}
216
+
217
+/* The next nPivot lines of the PIVOT are changed into nV lines from V1 and
218
+** V2, which should be the same. In other words, the same change is found
219
+** in both V1 and V2.
220
+*/
221
+static void dbgChngBoth(MergeBuilder *p, unsigned int nPivot, unsigned int nV){
222
+ blob_appendf(p->pOut, "COPY %u lines from V1(%u..%u) or V2(%u..%u)\n",
223
+ nV, p->lnV1+1, p->lnV1+nV, p->lnV2+1, p->lnV2+nV);
224
+ p->lnPivot += nPivot;
225
+ p->lnV1 += nV;
226
+ p->lnV2 += nV;
227
+}
228
+
229
+/* V1 and V2 have different and overlapping changes. The next nPivot lines
230
+** of the PIVOT are converted into nV1 lines of V1 and nV2 lines of V2.
231
+*/
232
+static void dbgConflict(
233
+ MergeBuilder *p,
234
+ unsigned int nPivot,
235
+ unsigned int nV1,
236
+ unsigned int nV2
237
+){
238
+ blob_appendf(p->pOut,
239
+ "CONFLICT %u,%u,%u BASELINE(%u..%u) versus V1(%u..%u) versus V2(%u..%u)\n",
240
+ nPivot, nV1, nV2,
241
+ p->lnPivot+1, p->lnPivot+nPivot,
242
+ p->lnV1+1, p->lnV1+nV1,
243
+ p->lnV2+1, p->lnV2+nV2);
244
+ p->lnV1 += nV1;
245
+ p->lnPivot += nPivot;
246
+ p->lnV2 += nV2;
247
+}
248
+
249
+/* Generic destructor for the MergeBuilder object
250
+*/
251
+static void dbgDestroy(MergeBuilder *p){
252
+ memset(p, 0, sizeof(*p));
253
+}
254
+
255
+/* Generic initializer for a MergeBuilder object
256
+*/
257
+static void mergebuilder_init(MergeBuilder *p){
258
+ memset(p, 0, sizeof(*p));
259
+ p->xStart = dbgStartEnd;
260
+ p->xSame = dbgSame;
261
+ p->xChngV1 = dbgChngV1;
262
+ p->xChngV2 = dbgChngV2;
263
+ p->xChngBoth = dbgChngBoth;
264
+ p->xConflict = dbgConflict;
265
+ p->xEnd = dbgStartEnd;
266
+ p->xDestroy = dbgDestroy;
267
+}
268
+
269
+/************************* MergeBuilderToken ********************************/
270
+/* This version of MergeBuilder actually performs a merge on file that
271
+** are broken up into tokens instead of lines, and puts the result in pOut.
272
+*/
273
+static void tokenSame(MergeBuilder *p, unsigned int N){
274
+ blob_append(p->pOut, p->pPivot->aData+p->pPivot->iCursor, N);
275
+ p->pPivot->iCursor += N;
276
+ p->pV1->iCursor += N;
277
+ p->pV2->iCursor += N;
278
+}
279
+static void tokenChngV1(MergeBuilder *p, unsigned int nPivot, unsigned nV1){
280
+ blob_append(p->pOut, p->pV1->aData+p->pV1->iCursor, nV1);
281
+ p->pPivot->iCursor += nPivot;
282
+ p->pV1->iCursor += nV1;
283
+ p->pV2->iCursor += nPivot;
284
+}
285
+static void tokenChngV2(MergeBuilder *p, unsigned int nPivot, unsigned nV2){
286
+ blob_append(p->pOut, p->pV2->aData+p->pV2->iCursor, nV2);
287
+ p->pPivot->iCursor += nPivot;
288
+ p->pV1->iCursor += nPivot;
289
+ p->pV2->iCursor += nV2;
290
+}
291
+static void tokenChngBoth(MergeBuilder *p, unsigned int nPivot, unsigned nV){
292
+ blob_append(p->pOut, p->pV2->aData+p->pV2->iCursor, nV);
293
+ p->pPivot->iCursor += nPivot;
294
+ p->pV1->iCursor += nV;
295
+ p->pV2->iCursor += nV;
296
+}
297
+static void tokenConflict(
298
+ MergeBuilder *p,
299
+ unsigned int nPivot,
300
+ unsigned int nV1,
301
+ unsigned int nV2
302
+){
303
+ /* For a token-merge conflict, use the text from the merge-in */
304
+ blob_append(p->pOut, p->pV2->aData+p->pV2->iCursor, nV2);
305
+ p->pPivot->iCursor += nPivot;
306
+ p->pV1->iCursor += nV1;
307
+ p->pV2->iCursor += nV2;
308
+}
309
+static void mergebuilder_init_token(MergeBuilder *p){
310
+ mergebuilder_init(p);
311
+ p->xSame = tokenSame;
312
+ p->xChngV1 = tokenChngV1;
313
+ p->xChngV2 = tokenChngV2;
314
+ p->xChngBoth = tokenChngBoth;
315
+ p->xConflict = tokenConflict;
316
+ p->diffFlags = DIFF_BY_TOKEN;
317
+}
318
+
319
+/*
320
+** Attempt to do a low-level merge on a conflict. The conflict is
321
+** described by the first four parameters, which are the same as the
322
+** arguments to the xConflict method of the MergeBuilder object.
323
+** This routine attempts to resolve the conflict by looking at
324
+** elements of the conflict region that are finer grain than complete
325
+** lines of text.
326
+**
327
+** The result is written into Blob pOut. pOut is initialized by this
328
+** routine.
329
+*/
330
+int merge_try_to_resolve_conflict(
331
+ MergeBuilder *pMB, /* MergeBuilder that encounter conflict */
332
+ unsigned int nPivot, /* Lines of conflict in the pivot */
333
+ unsigned int nV1, /* Lines of conflict in V1 */
334
+ unsigned int nV2, /* Lines of conflict in V2 */
335
+ Blob *pOut /* Write resolution text here */
336
+){
337
+ int nConflict;
338
+ MergeBuilder mb;
339
+ Blob pv, v1, v2;
340
+ mergebuilder_init_token(&mb);
341
+ blob_extract_lines(pMB->pPivot, nPivot, &pv);
342
+ blob_extract_lines(pMB->pV1, nV1, &v1);
343
+ blob_extract_lines(pMB->pV2, nV2, &v2);
344
+ blob_zero(pOut);
345
+ blob_materialize(&pv);
346
+ blob_materialize(&v1);
347
+ blob_materialize(&v2);
348
+ mb.pPivot = &pv;
349
+ mb.pV1 = &v1;
350
+ mb.pV2 = &v2;
351
+ mb.pOut = pOut;
352
+ nConflict = merge_three_blobs(&mb);
353
+ blob_reset(&pv);
354
+ blob_reset(&v1);
355
+ blob_reset(&v2);
356
+ /* mb has not allocated any resources, so we do not need to invoke
357
+ ** the xDestroy method. */
358
+ blob_add_final_newline(pOut);
359
+ return nConflict;
360
+}
361
+
362
+
363
+/************************* MergeBuilderText **********************************/
364
+/* This version of MergeBuilder actually performs a merge on file and puts
365
+** the result in pOut
366
+*/
367
+static void txtStart(MergeBuilder *p){
368
+ /* If both pV1 and pV2 start with a UTF-8 byte-order-mark (BOM),
369
+ ** keep it in the output. This should be secure enough not to cause
370
+ ** unintended changes to the merged file and consistent with what
371
+ ** users are using in their source files.
372
+ */
373
+ if( starts_with_utf8_bom(p->pV1, 0) && starts_with_utf8_bom(p->pV2, 0) ){
374
+ blob_append(p->pOut, (char*)get_utf8_bom(0), -1);
375
+ }
376
+ if( contains_crlf(p->pV1) && contains_crlf(p->pV2) ){
377
+ p->useCrLf = 1;
378
+ }
379
+}
380
+static void txtSame(MergeBuilder *p, unsigned int N){
381
+ blob_copy_lines(p->pOut, p->pPivot, N); p->lnPivot += N;
382
+ blob_copy_lines(0, p->pV1, N); p->lnV1 += N;
383
+ blob_copy_lines(0, p->pV2, N); p->lnV2 += N;
384
+}
385
+static void txtChngV1(MergeBuilder *p, unsigned int nPivot, unsigned int nV1){
386
+ blob_copy_lines(0, p->pPivot, nPivot); p->lnPivot += nPivot;
387
+ blob_copy_lines(0, p->pV2, nPivot); p->lnV2 += nPivot;
388
+ blob_copy_lines(p->pOut, p->pV1, nV1); p->lnV1 += nV1;
389
+}
390
+static void txtChngV2(MergeBuilder *p, unsigned int nPivot, unsigned int nV2){
391
+ blob_copy_lines(0, p->pPivot, nPivot); p->lnPivot += nPivot;
392
+ blob_copy_lines(0, p->pV1, nPivot); p->lnV1 += nPivot;
393
+ blob_copy_lines(p->pOut, p->pV2, nV2); p->lnV2 += nV2;
394
+}
395
+static void txtChngBoth(MergeBuilder *p, unsigned int nPivot, unsigned int nV){
396
+ blob_copy_lines(0, p->pPivot, nPivot); p->lnPivot += nPivot;
397
+ blob_copy_lines(0, p->pV1, nPivot); p->lnV1 += nV;
398
+ blob_copy_lines(p->pOut, p->pV2, nV); p->lnV2 += nV;
399
+}
400
+static void txtConflict(
401
+ MergeBuilder *p,
402
+ unsigned int nPivot,
403
+ unsigned int nV1,
404
+ unsigned int nV2
405
+){
406
+ int nRes; /* Lines in the computed conflict resolution */
407
+ Blob res; /* Text of the conflict resolution */
408
+
409
+ merge_try_to_resolve_conflict(p, nPivot, nV1, nV2, &res);
410
+ nRes = blob_linecount(&res);
411
+
412
+ append_merge_mark(p->pOut, 0, p->lnV1+1, p->useCrLf);
413
+ blob_copy_lines(p->pOut, p->pV1, nV1); p->lnV1 += nV1;
414
+
415
+ if( nRes>0 ){
416
+ append_merge_mark(p->pOut, 1, 0, p->useCrLf);
417
+ blob_copy_lines(p->pOut, &res, nRes);
418
+ }
419
+ blob_reset(&res);
420
+
421
+ append_merge_mark(p->pOut, 2, p->lnPivot+1, p->useCrLf);
422
+ blob_copy_lines(p->pOut, p->pPivot, nPivot); p->lnPivot += nPivot;
423
+
424
+ append_merge_mark(p->pOut, 3, p->lnV2+1, p->useCrLf);
425
+ blob_copy_lines(p->pOut, p->pV2, nV2); p->lnV2 += nV2;
426
+
427
+ append_merge_mark(p->pOut, 4, -1, p->useCrLf);
428
+}
429
+static void mergebuilder_init_text(MergeBuilder *p){
430
+ mergebuilder_init(p);
431
+ p->xStart = txtStart;
432
+ p->xSame = txtSame;
433
+ p->xChngV1 = txtChngV1;
434
+ p->xChngV2 = txtChngV2;
435
+ p->xChngBoth = txtChngBoth;
436
+ p->xConflict = txtConflict;
437
+}
438
+
439
+/************************* MergeBuilderTcl **********************************/
440
+/* Generate merge output formatted for reading by a TCL script.
441
+**
442
+** The output consists of lines of text, each with 4 tokens. The tokens
443
+** represent the content for one line from baseline, v1, v2, and output
444
+** respectively. The first character of each token provides auxiliary
445
+** information:
446
+**
447
+** . This line is omitted.
448
+** N Name of the file.
449
+** T Literal text follows that should have a \n terminator.
450
+** R Literal text follows that needs a \r\n terminator.
451
+** X Merge conflict.
452
+** Z Literal text without a line terminator.
453
+** S Skipped lines. Followed by number of lines to skip.
454
+** 1 Text is a copy of token 1
455
+** 2 Use data from data-token 2
456
+** 3 Use data from data-token 3
457
+*/
458
+
459
+/* Write text that goes into the interior of a double-quoted string in TCL */
460
+static void tclWriteQuotedText(Blob *pOut, const char *zIn, int nIn){
461
+ int j;
462
+ for(j=0; j<nIn; j++){
463
+ char c = zIn[j];
464
+ if( c=='\\' ){
465
+ blob_append(pOut, "\\\\", 2);
466
+ }else if( c=='"' ){
467
+ blob_append(pOut, "\\\"", 2);
468
+ }else if( c<' ' || c>0x7e ){
469
+ char z[5];
470
+ z[0] = '\\';
471
+ z[1] = "01234567"[(c>>6)&0x3];
472
+ z[2] = "01234567"[(c>>3)&0x7];
473
+ z[3] = "01234567"[c&0x7];
474
+ z[4] = 0;
475
+ blob_append(pOut, z, 4);
476
+ }else{
477
+ blob_append_char(pOut, c);
478
+ }
479
+ }
480
+}
481
+
482
+/* Copy one line of text from pIn and append to pOut, encoded as TCL */
483
+static void tclLineOfText(Blob *pOut, Blob *pIn, char cType){
484
+ int i, k;
485
+ for(i=pIn->iCursor; i<pIn->nUsed && pIn->aData[i]!='\n'; i++){}
486
+ if( i==pIn->nUsed ){
487
+ k = i;
488
+ }else if( i>pIn->iCursor && pIn->aData[i-1]=='\r' ){
489
+ k = i-1;
490
+ i++;
491
+ }else{
492
+ k = i;
493
+ i++;
494
+ }
495
+ blob_append_char(pOut, '"');
496
+ blob_append_char(pOut, cType);
497
+ tclWriteQuotedText(pOut, pIn->aData+pIn->iCursor, k-pIn->iCursor);
498
+ pIn->iCursor = i;
499
+ blob_append_char(pOut, '"');
500
+}
501
+static void tclStart(MergeBuilder *p){
502
+ Blob *pOut = p->pOut;
503
+ blob_append(pOut, "\"N", 2);
504
+ tclWriteQuotedText(pOut, p->zPivot, (int)strlen(p->zPivot));
505
+ blob_append(pOut, "\" \"N", 4);
506
+ tclWriteQuotedText(pOut, p->zV1, (int)strlen(p->zV1));
507
+ blob_append(pOut, "\" \"N", 4);
508
+ tclWriteQuotedText(pOut, p->zV2, (int)strlen(p->zV2));
509
+ blob_append(pOut, "\" \"N", 4);
510
+ if( p->zOut ){
511
+ tclWriteQuotedText(pOut, p->zOut, (int)strlen(p->zOut));
512
+ }else{
513
+ blob_append(pOut, "(Merge Result)", -1);
514
+ }
515
+ blob_append(pOut, "\"\n", 2);
516
+}
517
+static void tclSame(MergeBuilder *p, unsigned int N){
518
+ int i = 0;
519
+ int nSkip;
520
+
521
+ if( p->lnPivot>=2 || p->lnV1>2 || p->lnV2>2 ){
522
+ while( i<N && i<p->nContext ){
523
+ tclLineOfText(p->pOut, p->pPivot, 'T');
524
+ blob_append(p->pOut, " 1 1 1\n", 7);
525
+ i++;
526
+ }
527
+ nSkip = N - p->nContext*2;
528
+ }else{
529
+ nSkip = N - p->nContext;
530
+ }
531
+ if( nSkip>0 ){
532
+ blob_appendf(p->pOut, "\"S%d %d %d %d\" . . .\n",
533
+ nSkip, nSkip, nSkip, nSkip);
534
+ blob_copy_lines(0, p->pPivot, nSkip);
535
+ i += nSkip;
536
+ }
537
+
538
+ p->lnPivot += N;
539
+ p->lnV1 += N;
540
+ p->lnV2 += N;
541
+
542
+ if( p->lnPivot<p->mxPivot || p->lnV1<p->mxV1 || p->lnV2<p->mxV2 ){
543
+ while( i<N ){
544
+ tclLineOfText(p->pOut, p->pPivot, 'T');
545
+ blob_append(p->pOut, " 1 1 1\n", 7);
546
+ i++;
547
+ }
548
+ }
549
+
550
+ blob_copy_lines(0, p->pV1, N);
551
+ blob_copy_lines(0, p->pV2, N);
552
+}
553
+static void tclChngV1(MergeBuilder *p, unsigned int nPivot, unsigned int nV1){
554
+ int i;
555
+ for(i=0; i<nPivot && i<nV1; i++){
556
+ tclLineOfText(p->pOut, p->pPivot, 'T');
557
+ blob_append_char(p->pOut, ' ');
558
+ tclLineOfText(p->pOut, p->pV1, 'T');
559
+ blob_append(p->pOut, " 1 2\n", 5);
560
+ }
561
+ while( i<nPivot ){
562
+ tclLineOfText(p->pOut, p->pPivot, 'T');
563
+ blob_append(p->pOut, " . 1 .\n", 7);
564
+ i++;
565
+ }
566
+ while( i<nV1 ){
567
+ blob_append(p->pOut, ". ", 2);
568
+ tclLineOfText(p->pOut, p->pV1, 'T');
569
+ blob_append(p->pOut, " . 2\n", 5);
570
+ i++;
571
+ }
572
+ p->lnPivot += nPivot;
573
+ p->lnV1 += nV1;
574
+ p->lnV2 += nPivot;
575
+ blob_copy_lines(0, p->pV2, nPivot);
576
+}
577
+static void tclChngV2(MergeBuilder *p, unsigned int nPivot, unsigned int nV2){
578
+ int i;
579
+ for(i=0; i<nPivot && i<nV2; i++){
580
+ tclLineOfText(p->pOut, p->pPivot, 'T');
581
+ blob_append(p->pOut, " 1 ", 3);
582
+ tclLineOfText(p->pOut, p->pV2, 'T');
583
+ blob_append(p->pOut, " 3\n", 3);
584
+ }
585
+ while( i<nPivot ){
586
+ tclLineOfText(p->pOut, p->pPivot, 'T');
587
+ blob_append(p->pOut, " 1 . .\n", 7);
588
+ i++;
589
+ }
590
+ while( i<nV2 ){
591
+ blob_append(p->pOut, ". . ", 4);
592
+ tclLineOfText(p->pOut, p->pV2, 'T');
593
+ blob_append(p->pOut, " 3\n", 3);
594
+ i++;
595
+ }
596
+ p->lnPivot += nPivot;
597
+ p->lnV1 += nPivot;
598
+ p->lnV2 += nV2;
599
+ blob_copy_lines(0, p->pV1, nPivot);
600
+}
601
+static void tclChngBoth(MergeBuilder *p, unsigned int nPivot, unsigned int nV){
602
+ int i;
603
+ for(i=0; i<nPivot && i<nV; i++){
604
+ tclLineOfText(p->pOut, p->pPivot, 'T');
605
+ blob_append_char(p->pOut, ' ');
606
+ tclLineOfText(p->pOut, p->pV1, 'T');
607
+ blob_append(p->pOut, " 2 2\n", 5);
608
+ }
609
+ while( i<nPivot ){
610
+ tclLineOfText(p->pOut, p->pPivot, 'T');
611
+ blob_append(p->pOut, " . . .\n", 7);
612
+ i++;
613
+ }
614
+ while( i<nV ){
615
+ blob_append(p->pOut, ". ", 2);
616
+ tclLineOfText(p->pOut, p->pV1, 'T');
617
+ blob_append(p->pOut, " 2 2\n", 5);
618
+ i++;
619
+ }
620
+ p->lnPivot += nPivot;
621
+ p->lnV1 += nV;
622
+ p->lnV2 += nV;
623
+ blob_copy_lines(0, p->pV2, nV);
624
+}
625
+static void tclConflict(
626
+ MergeBuilder *p,
627
+ unsigned int nPivot,
628
+ unsigned int nV1,
629
+ unsigned int nV2
630
+){
631
+ int mx = nPivot;
632
+ int i;
633
+ int nRes;
634
+ Blob res;
635
+
636
+ merge_try_to_resolve_conflict(p, nPivot, nV1, nV2, &res);
637
+ nRes = blob_linecount(&res);
638
+ if( nV1>mx ) mx = nV1;
639
+ if( nV2>mx ) mx = nV2;
640
+ if( nRes>mx ) mx = nRes;
641
+ if( nRes>0 ){
642
+ blob_appendf(p->pOut, "\"S0 0 0 %d\" . . .\n", nV2+2);
643
+ }
644
+ for(i=0; i<mx; i++){
645
+ if( i<nPivot ){
646
+ tclLineOfText(p->pOut, p->pPivot, 'X');
647
+ }else{
648
+ blob_append_char(p->pOut, '.');
649
+ }
650
+ blob_append_char(p->pOut, ' ');
651
+ if( i<nV1 ){
652
+ tclLineOfText(p->pOut, p->pV1, 'X');
653
+ }else{
654
+ blob_append_char(p->pOut, '.');
655
+ }
656
+ blob_append_char(p->pOut, ' ');
657
+ if( i<nV2 ){
658
+ tclLineOfText(p->pOut, p->pV2, 'X');
659
+ }else{
660
+ blob_append_char(p->pOut, '.');
661
+ }
662
+ if( i<nRes ){
663
+ blob_append_char(p->pOut, ' ');
664
+ tclLineOfText(p->pOut, &res, 'X');
665
+ blob_append_char(p->pOut, '\n');
666
+ }else{
667
+ blob_append(p->pOut, " .\n", 3);
668
+ }
669
+ if( i==mx-1 ){
670
+ blob_appendf(p->pOut, "\"S0 0 0 %d\" . . .\n", nPivot+nV1+3);
671
+ }
672
+ }
673
+ blob_reset(&res);
674
+ p->lnPivot += nPivot;
675
+ p->lnV1 += nV1;
676
+ p->lnV2 += nV2;
677
+}
678
+void mergebuilder_init_tcl(MergeBuilder *p){
679
+ mergebuilder_init(p);
680
+ p->xStart = tclStart;
681
+ p->xSame = tclSame;
682
+ p->xChngV1 = tclChngV1;
683
+ p->xChngV2 = tclChngV2;
684
+ p->xChngBoth = tclChngBoth;
685
+ p->xConflict = tclConflict;
686
+}
687
+/*****************************************************************************/
688
+
689
+/*
690
+** The aC[] array contains triples of integers. Within each triple, the
691
+** elements are:
692
+**
693
+** (0) The number of lines to copy
694
+** (1) The number of lines to delete
695
+** (2) The number of liens to insert
696
+**
697
+** Suppose we want to advance over sz lines of the original file. This routine
698
+** returns true if that advance would land us on a copy operation. It
699
+** returns false if the advance would end on a delete.
700
+*/
701
+static int ends_with_copy(int *aC, int sz){
702
+ while( sz>0 && (aC[0]>0 || aC[1]>0 || aC[2]>0) ){
703
+ if( aC[0]>=sz ) return 1;
704
+ sz -= aC[0];
705
+ if( aC[1]>sz ) return 0;
706
+ sz -= aC[1];
707
+ aC += 3;
708
+ }
709
+ return 1;
710
+}
711
+
712
+/*
713
+** aC[] is an "edit triple" for changes from A to B. Advance through
714
+** this triple to determine the number of lines to bypass on B in order
715
+** to match an advance of sz lines on A.
716
+*/
717
+static int skip_conflict(
718
+ int *aC, /* Array of integer triples describing the edit */
719
+ int i, /* Index in aC[] of current location */
720
+ int sz, /* Lines of A that have been skipped */
721
+ unsigned int *pLn /* OUT: Lines of B to skip to keep aligment with A */
722
+){
723
+ *pLn = 0;
724
+ while( sz>0 ){
725
+ if( aC[i]==0 && aC[i+1]==0 && aC[i+2]==0 ) break;
726
+ if( aC[i]>=sz ){
727
+ aC[i] -= sz;
728
+ *pLn += sz;
729
+ break;
730
+ }
731
+ *pLn += aC[i];
732
+ *pLn += aC[i+2];
733
+ sz -= aC[i] + aC[i+1];
734
+ i += 3;
735
+ }
736
+ return i;
737
+}
191738
192739
/*
193740
** Do a three-way merge. Initialize pOut to contain the result.
194741
**
195742
** The merge is an edit against pV2. Both pV1 and pV2 have a
@@ -199,156 +746,113 @@
199746
** The return is 0 upon complete success. If any input file is binary,
200747
** -1 is returned and pOut is unmodified. If there are merge
201748
** conflicts, the merge proceeds as best as it can and the number
202749
** of conflicts is returns
203750
*/
204
-static int blob_merge(Blob *pPivot, Blob *pV1, Blob *pV2, Blob *pOut){
751
+int merge_three_blobs(MergeBuilder *p){
205752
int *aC1; /* Changes from pPivot to pV1 */
206753
int *aC2; /* Changes from pPivot to pV2 */
207754
int i1, i2; /* Index into aC1[] and aC2[] */
208755
int nCpy, nDel, nIns; /* Number of lines to copy, delete, or insert */
209756
int limit1, limit2; /* Sizes of aC1[] and aC2[] */
210757
int nConflict = 0; /* Number of merge conflicts seen so far */
211
- int useCrLf = 0;
212
- int ln1, ln2, lnPivot; /* Line numbers for all files */
213758
DiffConfig DCfg;
214759
215
- blob_zero(pOut); /* Merge results stored in pOut */
216
-
217
- /* If both pV1 and pV2 start with a UTF-8 byte-order-mark (BOM),
218
- ** keep it in the output. This should be secure enough not to cause
219
- ** unintended changes to the merged file and consistent with what
220
- ** users are using in their source files.
221
- */
222
- if( starts_with_utf8_bom(pV1, 0) && starts_with_utf8_bom(pV2, 0) ){
223
- blob_append(pOut, (char*)get_utf8_bom(0), -1);
224
- }
225
-
226
- /* Check once to see if both pV1 and pV2 contains CR/LF endings.
227
- ** If true, CR/LF pair will be used later to append the
228
- ** boundary markers for merge conflicts.
229
- */
230
- if( contains_crlf(pV1) && contains_crlf(pV2) ){
231
- useCrLf = 1;
232
- }
233
-
234760
/* Compute the edits that occur from pPivot => pV1 (into aC1)
235761
** and pPivot => pV2 (into aC2). Each of the aC1 and aC2 arrays is
236762
** an array of integer triples. Within each triple, the first integer
237763
** is the number of lines of text to copy directly from the pivot,
238764
** the second integer is the number of lines of text to omit from the
239765
** pivot, and the third integer is the number of lines of text that are
240766
** inserted. The edit array ends with a triple of 0,0,0.
241767
*/
242768
diff_config_init(&DCfg, 0);
243
- aC1 = text_diff(pPivot, pV1, 0, &DCfg);
244
- aC2 = text_diff(pPivot, pV2, 0, &DCfg);
769
+ DCfg.diffFlags = p->diffFlags;
770
+ aC1 = text_diff(p->pPivot, p->pV1, 0, &DCfg);
771
+ aC2 = text_diff(p->pPivot, p->pV2, 0, &DCfg);
245772
if( aC1==0 || aC2==0 ){
246773
free(aC1);
247774
free(aC2);
248775
return -1;
249776
}
250777
251
- blob_rewind(pV1); /* Rewind inputs: Needed to reconstruct output */
252
- blob_rewind(pV2);
253
- blob_rewind(pPivot);
778
+ blob_rewind(p->pV1); /* Rewind inputs: Needed to reconstruct output */
779
+ blob_rewind(p->pV2);
780
+ blob_rewind(p->pPivot);
254781
255782
/* Determine the length of the aC1[] and aC2[] change vectors */
256
- for(i1=0; aC1[i1] || aC1[i1+1] || aC1[i1+2]; i1+=3){}
783
+ p->mxPivot = 0;
784
+ p->mxV1 = 0;
785
+ for(i1=0; aC1[i1] || aC1[i1+1] || aC1[i1+2]; i1+=3){
786
+ p->mxPivot += aC1[i1] + aC1[i1+1];
787
+ p->mxV1 += aC1[i1] + aC1[i1+2];
788
+ }
257789
limit1 = i1;
258
- for(i2=0; aC2[i2] || aC2[i2+1] || aC2[i2+2]; i2+=3){}
790
+ p->mxV2 = 0;
791
+ for(i2=0; aC2[i2] || aC2[i2+1] || aC2[i2+2]; i2+=3){
792
+ p->mxV2 += aC2[i2] + aC2[i2+2];
793
+ }
259794
limit2 = i2;
260795
261
- DEBUG(
262
- for(i1=0; i1<limit1; i1+=3){
263
- printf("c1: %4d %4d %4d\n", aC1[i1], aC1[i1+1], aC1[i1+2]);
264
- }
265
- for(i2=0; i2<limit2; i2+=3){
266
- printf("c2: %4d %4d %4d\n", aC2[i2], aC2[i2+1], aC2[i2+2]);
267
- }
268
- )
796
+ /* Output header text and do any other required initialization */
797
+ p->xStart(p);
269798
270799
/* Loop over the two edit vectors and use them to compute merged text
271800
** which is written into pOut. i1 and i2 are multiples of 3 which are
272801
** indices into aC1[] and aC2[] to the edit triple currently being
273802
** processed
274803
*/
275804
i1 = i2 = 0;
276
- ln1 = ln2 = lnPivot = 1;
277805
while( i1<limit1 && i2<limit2 ){
278
- DEBUG( printf("%d: %2d %2d %2d %d: %2d %2d %2d\n",
279
- i1/3, aC1[i1], aC1[i1+1], aC1[i1+2],
280
- i2/3, aC2[i2], aC2[i2+1], aC2[i2+2]); )
281
-
282806
if( aC1[i1]>0 && aC2[i2]>0 ){
283807
/* Output text that is unchanged in both V1 and V2 */
284808
nCpy = min(aC1[i1], aC2[i2]);
285
- DEBUG( printf("COPY %d\n", nCpy); )
286
- blob_copy_lines(pOut, pPivot, nCpy); lnPivot += nCpy;
287
- blob_copy_lines(0, pV1, nCpy); ln1 += nCpy;
288
- blob_copy_lines(0, pV2, nCpy); ln2 += nCpy;
809
+ p->xSame(p, nCpy);
289810
aC1[i1] -= nCpy;
290811
aC2[i2] -= nCpy;
291812
}else
292813
if( aC1[i1] >= aC2[i2+1] && aC1[i1]>0 && aC2[i2+1]+aC2[i2+2]>0 ){
293814
/* Output edits to V2 that occurs within unchanged regions of V1 */
294815
nDel = aC2[i2+1];
295816
nIns = aC2[i2+2];
296
- DEBUG( printf("EDIT -%d+%d left\n", nDel, nIns); )
297
- blob_copy_lines(0, pPivot, nDel); lnPivot += nDel;
298
- blob_copy_lines(0, pV1, nDel); ln1 += nDel;
299
- blob_copy_lines(pOut, pV2, nIns); ln2 += nIns;
817
+ p->xChngV2(p, nDel, nIns);
300818
aC1[i1] -= nDel;
301819
i2 += 3;
302820
}else
303821
if( aC2[i2] >= aC1[i1+1] && aC2[i2]>0 && aC1[i1+1]+aC1[i1+2]>0 ){
304822
/* Output edits to V1 that occur within unchanged regions of V2 */
305823
nDel = aC1[i1+1];
306824
nIns = aC1[i1+2];
307
- DEBUG( printf("EDIT -%d+%d right\n", nDel, nIns); )
308
- blob_copy_lines(0, pPivot, nDel); lnPivot += nDel;
309
- blob_copy_lines(0, pV2, nDel); ln2 += nDel;
310
- blob_copy_lines(pOut, pV1, nIns); ln1 += nIns;
825
+ p->xChngV1(p, nDel, nIns);
311826
aC2[i2] -= nDel;
312827
i1 += 3;
313828
}else
314
- if( sameEdit(&aC1[i1], &aC2[i2], pV1, pV2) ){
829
+ if( sameEdit(&aC1[i1], &aC2[i2], p->pV1, p->pV2) ){
315830
/* Output edits that are identical in both V1 and V2. */
316831
assert( aC1[i1]==0 );
317832
nDel = aC1[i1+1];
318833
nIns = aC1[i1+2];
319
- DEBUG( printf("EDIT -%d+%d both\n", nDel, nIns); )
320
- blob_copy_lines(0, pPivot, nDel); lnPivot += nDel;
321
- blob_copy_lines(pOut, pV1, nIns); ln1 += nIns;
322
- blob_copy_lines(0, pV2, nIns); ln2 += nIns;
834
+ p->xChngBoth(p, nDel, nIns);
323835
i1 += 3;
324836
i2 += 3;
325837
}else
326838
{
327839
/* We have found a region where different edits to V1 and V2 overlap.
328840
** This is a merge conflict. Find the size of the conflict, then
329841
** output both possible edits separated by distinctive marks.
330842
*/
331
- int sz = 1; /* Size of the conflict in lines */
843
+ unsigned int sz = 1; /* Size of the conflict in the pivot, in lines */
844
+ unsigned int nV1, nV2; /* Size of conflict in V1 and V2, in lines */
332845
nConflict++;
333
- while( !ends_at_CPY(&aC1[i1], sz) || !ends_at_CPY(&aC2[i2], sz) ){
846
+ while( !ends_with_copy(&aC1[i1], sz) || !ends_with_copy(&aC2[i2], sz) ){
334847
sz++;
335848
}
336
- DEBUG( printf("CONFLICT %d\n", sz); )
337
-
338
- append_merge_mark(pOut, 0, ln1, useCrLf);
339
- i1 = output_one_side(pOut, pV1, aC1, i1, sz, &ln1);
340
-
341
- append_merge_mark(pOut, 1, lnPivot, useCrLf);
342
- blob_copy_lines(pOut, pPivot, sz); lnPivot += sz;
343
-
344
- append_merge_mark(pOut, 2, ln2, useCrLf);
345
- i2 = output_one_side(pOut, pV2, aC2, i2, sz, &ln2);
346
-
347
- append_merge_mark(pOut, 3, -1, useCrLf);
348
- }
349
-
849
+ i1 = skip_conflict(aC1, i1, sz, &nV1);
850
+ i2 = skip_conflict(aC2, i2, sz, &nV2);
851
+ p->xConflict(p, sz, nV1, nV2);
852
+ }
853
+
350854
/* If we are finished with an edit triple, advance to the next
351855
** triple.
352856
*/
353857
if( i1<limit1 && aC1[i1]==0 && aC1[i1+1]==0 && aC1[i1+2]==0 ) i1+=3;
354858
if( i2<limit2 && aC2[i2]==0 && aC2[i2+1]==0 && aC2[i2+2]==0 ) i2+=3;
@@ -356,20 +860,18 @@
356860
357861
/* When one of the two edit vectors reaches its end, there might still
358862
** be an insert in the other edit vector. Output this remaining
359863
** insert.
360864
*/
361
- DEBUG( printf("%d: %2d %2d %2d %d: %2d %2d %2d\n",
362
- i1/3, aC1[i1], aC1[i1+1], aC1[i1+2],
363
- i2/3, aC2[i2], aC2[i2+1], aC2[i2+2]); )
364865
if( i1<limit1 && aC1[i1+2]>0 ){
365
- DEBUG( printf("INSERT +%d left\n", aC1[i1+2]); )
366
- blob_copy_lines(pOut, pV1, aC1[i1+2]);
866
+ p->xChngV1(p, 0, aC1[i1+2]);
367867
}else if( i2<limit2 && aC2[i2+2]>0 ){
368
- DEBUG( printf("INSERT +%d right\n", aC2[i2+2]); )
369
- blob_copy_lines(pOut, pV2, aC2[i2+2]);
868
+ p->xChngV2(p, 0, aC2[i2+2]);
370869
}
870
+
871
+ /* Output footer text */
872
+ p->xEnd(p);
371873
372874
free(aC1);
373875
free(aC2);
374876
return nConflict;
375877
}
@@ -384,11 +886,12 @@
384886
const char *z = blob_buffer(p);
385887
int n = blob_size(p) - len + 1;
386888
assert( len==(int)strlen(mergeMarker[1]) );
387889
assert( len==(int)strlen(mergeMarker[2]) );
388890
assert( len==(int)strlen(mergeMarker[3]) );
389
- assert( count(mergeMarker)==4 );
891
+ assert( len==(int)strlen(mergeMarker[4]) );
892
+ assert( count(mergeMarker)==5 );
390893
for(i=0; i<n; ){
391894
for(j=0; j<4; j++){
392895
if( (memcmp(&z[i], mergeMarker[j], len)==0) ){
393896
return 1;
394897
}
@@ -408,18 +911,106 @@
408911
blob_read_from_file(&file, zFullpath, ExtFILE);
409912
rc = contains_merge_marker(&file);
410913
blob_reset(&file);
411914
return rc;
412915
}
916
+
917
+/*
918
+** Show merge output in a Tcl/Tk window, in response to the --tk option
919
+** to the "merge" or "3-way-merge" command.
920
+**
921
+** If fossil has direct access to a Tcl interpreter (either loaded
922
+** dynamically through stubs or linked in statically), we can use it
923
+** directly. Otherwise:
924
+** (1) Write the Tcl/Tk script used for rendering into a temp file.
925
+** (2) Invoke "tclsh" on the temp file using fossil_system().
926
+** (3) Delete the temp file.
927
+*/
928
+void merge_tk(const char *zSubCmd, int firstArg){
929
+ int i;
930
+ Blob script;
931
+ const char *zTempFile = 0;
932
+ char *zCmd;
933
+ const char *zTclsh;
934
+ const char *zCnt;
935
+ int bDarkMode = find_option("dark",0,0)!=0;
936
+ int nContext;
937
+ zCnt = find_option("context", "c", 1);
938
+ if( zCnt==0 ){
939
+ nContext = 6;
940
+ }else{
941
+ nContext = atoi(zCnt);
942
+ if( nContext<0 ) nContext = 0xfffffff;
943
+ }
944
+ blob_zero(&script);
945
+ blob_appendf(&script, "set ncontext %d\n", nContext);
946
+ blob_appendf(&script, "set fossilcmd {| \"%/\" %s -tcl",
947
+ g.nameOfExe, zSubCmd);
948
+ find_option("tcl",0,0);
949
+ find_option("debug",0,0);
950
+ zTclsh = find_option("tclsh",0,1);
951
+ if( zTclsh==0 ){
952
+ zTclsh = db_get("tclsh",0);
953
+ }
954
+ /* The undocumented --script FILENAME option causes the Tk script to
955
+ ** be written into the FILENAME instead of being run. This is used
956
+ ** for testing and debugging. */
957
+ zTempFile = find_option("script",0,1);
958
+ verify_all_options();
959
+
960
+ if( (g.argc - firstArg)!=3 ){
961
+ fossil_fatal("Requires 3 filename arguments");
962
+ }
963
+
964
+ for(i=firstArg; i<g.argc; i++){
965
+ const char *z = g.argv[i];
966
+ if( sqlite3_strglob("*}*",z) ){
967
+ blob_appendf(&script, " {%/}", z);
968
+ }else{
969
+ int j;
970
+ blob_append(&script, " ", 1);
971
+ for(j=0; z[j]; j++) blob_appendf(&script, "\\%03o", (unsigned char)z[j]);
972
+ }
973
+ }
974
+ blob_appendf(&script, "}\nset darkmode %d\n", bDarkMode);
975
+ blob_appendf(&script, "%s", builtin_file("merge.tcl", 0));
976
+ if( zTempFile ){
977
+ blob_write_to_file(&script, zTempFile);
978
+ fossil_print("To see the merge, run: %s \"%s\"\n", zTclsh, zTempFile);
979
+ }else{
980
+#if defined(FOSSIL_ENABLE_TCL)
981
+ Th_FossilInit(TH_INIT_DEFAULT);
982
+ if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script),
983
+ blob_size(&script), 1, 1, 0)==TCL_OK ){
984
+ blob_reset(&script);
985
+ return;
986
+ }
987
+ /*
988
+ * If evaluation of the Tcl script fails, the reason may be that Tk
989
+ * could not be found by the loaded Tcl, or that Tcl cannot be loaded
990
+ * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback
991
+ * to using the external "tclsh", if available.
992
+ */
993
+#endif
994
+ zTempFile = write_blob_to_temp_file(&script);
995
+ zCmd = mprintf("%$ %$", zTclsh, zTempFile);
996
+ fossil_system(zCmd);
997
+ file_delete(zTempFile);
998
+ fossil_free(zCmd);
999
+ }
1000
+ blob_reset(&script);
1001
+}
1002
+
4131003
4141004
/*
4151005
** COMMAND: 3-way-merge*
4161006
**
417
-** Usage: %fossil 3-way-merge BASELINE V1 V2 MERGED
1007
+** Usage: %fossil 3-way-merge BASELINE V1 V2 [MERGED]
4181008
**
4191009
** Inputs are files BASELINE, V1, and V2. The file MERGED is generated
420
-** as output.
1010
+** as output. If no MERGED file is specified, output is sent to
1011
+** stdout.
4211012
**
4221013
** BASELINE is a common ancestor of two files V1 and V2 that have diverging
4231014
** edits. The generated output file MERGED is the combination of all
4241015
** changes in both V1 and V2.
4251016
**
@@ -436,38 +1027,75 @@
4361027
** cp Xup.c Xbase.c
4371028
** # Verify that everything still works
4381029
** fossil commit
4391030
**
4401031
*/
441
-void delta_3waymerge_cmd(void){
442
- Blob pivot, v1, v2, merged;
1032
+void merge_3way_cmd(void){
1033
+ MergeBuilder s;
4431034
int nConflict;
1035
+ Blob pivot, v1, v2, out;
1036
+ int noWarn = 0;
1037
+ const char *zCnt;
1038
+
1039
+ if( find_option("tk", 0, 0)!=0 ){
1040
+ merge_tk("3-way-merge", 2);
1041
+ return;
1042
+ }
1043
+ mergebuilder_init_text(&s);
1044
+ if( find_option("debug", 0, 0) ){
1045
+ mergebuilder_init(&s);
1046
+ }
1047
+ if( find_option("tcl", 0, 0) ){
1048
+ mergebuilder_init_tcl(&s);
1049
+ noWarn = 1;
1050
+ }
1051
+ zCnt = find_option("context", "c", 1);
1052
+ if( zCnt ){
1053
+ s.nContext = atoi(zCnt);
1054
+ if( s.nContext<0 ) s.nContext = 0xfffffff;
1055
+ }else{
1056
+ s.nContext = 6;
1057
+ }
1058
+ blob_zero(&pivot); s.pPivot = &pivot;
1059
+ blob_zero(&v1); s.pV1 = &v1;
1060
+ blob_zero(&v2); s.pV2 = &v2;
1061
+ blob_zero(&out); s.pOut = &out;
4441062
4451063
/* We should be done with options.. */
4461064
verify_all_options();
4471065
448
- if( g.argc!=6 ){
449
- usage("PIVOT V1 V2 MERGED");
1066
+ if( g.argc!=6 && g.argc!=5 ){
1067
+ usage("[OPTIONS] PIVOT V1 V2 [MERGED]");
4501068
}
451
- if( blob_read_from_file(&pivot, g.argv[2], ExtFILE)<0 ){
1069
+ s.zPivot = file_tail(g.argv[2]);
1070
+ s.zV1 = file_tail(g.argv[3]);
1071
+ s.zV2 = file_tail(g.argv[4]);
1072
+ if( blob_read_from_file(s.pPivot, g.argv[2], ExtFILE)<0 ){
4521073
fossil_fatal("cannot read %s", g.argv[2]);
4531074
}
454
- if( blob_read_from_file(&v1, g.argv[3], ExtFILE)<0 ){
1075
+ if( blob_read_from_file(s.pV1, g.argv[3], ExtFILE)<0 ){
4551076
fossil_fatal("cannot read %s", g.argv[3]);
4561077
}
457
- if( blob_read_from_file(&v2, g.argv[4], ExtFILE)<0 ){
1078
+ if( blob_read_from_file(s.pV2, g.argv[4], ExtFILE)<0 ){
4581079
fossil_fatal("cannot read %s", g.argv[4]);
4591080
}
460
- nConflict = blob_merge(&pivot, &v1, &v2, &merged);
461
- if( blob_write_to_file(&merged, g.argv[5])<(int)blob_size(&merged) ){
462
- fossil_fatal("cannot write %s", g.argv[4]);
1081
+ nConflict = merge_three_blobs(&s);
1082
+ if( g.argc==6 ){
1083
+ s.zOut = file_tail(g.argv[5]);
1084
+ blob_write_to_file(s.pOut, g.argv[5]);
1085
+ }else{
1086
+ s.zOut = "(Merge Result)";
1087
+ blob_write_to_file(s.pOut, "-");
4631088
}
1089
+ s.xDestroy(&s);
4641090
blob_reset(&pivot);
4651091
blob_reset(&v1);
4661092
blob_reset(&v2);
467
- blob_reset(&merged);
468
- if( nConflict>0 ) fossil_warning("WARNING: %d merge conflicts", nConflict);
1093
+ blob_reset(&out);
1094
+ if( nConflict>0 && !noWarn ){
1095
+ fossil_warning("WARNING: %d merge conflicts", nConflict);
1096
+ }
4691097
}
4701098
4711099
/*
4721100
** aSubst is an array of string pairs. The first element of each pair is
4731101
** a string that begins with %. The second element is a replacement for that
@@ -505,32 +1133,32 @@
5051133
5061134
#if INTERFACE
5071135
/*
5081136
** Flags to the 3-way merger
5091137
*/
510
-#define MERGE_DRYRUN 0x0001
1138
+#define MERGE_DRYRUN 0x0001
5111139
/*
5121140
** The MERGE_KEEP_FILES flag specifies that merge_3way() should retain
5131141
** its temporary files on error. By default they are removed after the
5141142
** merge, regardless of success or failure.
5151143
*/
516
-#define MERGE_KEEP_FILES 0x0002
1144
+#define MERGE_KEEP_FILES 0x0002
5171145
#endif
5181146
5191147
5201148
/*
521
-** This routine is a wrapper around blob_merge() with the following
1149
+** This routine is a wrapper around merge_three_blobs() with the following
5221150
** enhancements:
5231151
**
5241152
** (1) If the merge-command is defined, then use the external merging
5251153
** program specified instead of the built-in blob-merge to do the
5261154
** merging. Panic if the external merger fails.
5271155
** ** Not currently implemented **
5281156
**
5291157
** (2) If gmerge-command is defined and there are merge conflicts in
530
-** blob_merge() then invoke the external graphical merger to resolve
531
-** the conflicts.
1158
+** merge_three_blobs() then invoke the external graphical merger
1159
+** to resolve the conflicts.
5321160
**
5331161
** (3) If a merge conflict occurs and gmerge-command is not defined,
5341162
** then write the pivot, original, and merge-in files to the
5351163
** filesystem.
5361164
*/
@@ -539,30 +1167,37 @@
5391167
const char *zV1, /* Name of file for version merging into (mine) */
5401168
Blob *pV2, /* Version merging from (yours) */
5411169
Blob *pOut, /* Output written here */
5421170
unsigned mergeFlags /* Flags that control operation */
5431171
){
544
- Blob v1; /* Content of zV1 */
545
- int rc; /* Return code of subroutines and this routine */
1172
+ Blob v1; /* Content of zV1 */
1173
+ int rc; /* Return code of subroutines and this routine */
5461174
const char *zGMerge; /* Name of the gmerge command */
1175
+ MergeBuilder s; /* The merge state */
5471176
548
- blob_read_from_file(&v1, zV1, ExtFILE);
549
- rc = blob_merge(pPivot, &v1, pV2, pOut);
1177
+ mergebuilder_init_text(&s);
1178
+ s.pPivot = pPivot;
1179
+ s.pV1 = &v1;
1180
+ s.pV2 = pV2;
1181
+ blob_zero(pOut);
1182
+ s.pOut = pOut;
1183
+ blob_read_from_file(s.pV1, zV1, ExtFILE);
1184
+ rc = merge_three_blobs(&s);
5501185
zGMerge = rc<=0 ? 0 : db_get("gmerge-command", 0);
5511186
if( (mergeFlags & MERGE_DRYRUN)==0
5521187
&& ((zGMerge!=0 && zGMerge[0]!=0)
5531188
|| (rc!=0 && (mergeFlags & MERGE_KEEP_FILES)!=0)) ){
5541189
char *zPivot; /* Name of the pivot file */
5551190
char *zOrig; /* Name of the original content file */
5561191
char *zOther; /* Name of the merge file */
5571192
5581193
zPivot = file_newname(zV1, "baseline", 1);
559
- blob_write_to_file(pPivot, zPivot);
1194
+ blob_write_to_file(s.pPivot, zPivot);
5601195
zOrig = file_newname(zV1, "original", 1);
561
- blob_write_to_file(&v1, zOrig);
1196
+ blob_write_to_file(s.pV1, zOrig);
5621197
zOther = file_newname(zV1, "merge", 1);
563
- blob_write_to_file(pV2, zOther);
1198
+ blob_write_to_file(s.pV2, zOther);
5641199
if( rc>0 ){
5651200
if( zGMerge && zGMerge[0] ){
5661201
char *zOut; /* Temporary output file */
5671202
char *zCmd; /* Command to invoke */
5681203
const char *azSubst[8]; /* Strings to be substituted */
@@ -590,7 +1225,8 @@
5901225
fossil_free(zPivot);
5911226
fossil_free(zOrig);
5921227
fossil_free(zOther);
5931228
}
5941229
blob_reset(&v1);
1230
+ s.xDestroy(&s);
5951231
return rc;
5961232
}
5971233
--- src/merge3.c
+++ src/merge3.c
@@ -75,75 +75,17 @@
75 if( aC1[2]!=aC2[2] ) return 0;
76 if( sameLines(pV1, pV2, aC1[2]) ) return 1;
77 return 0;
78 }
79
80 /*
81 ** The aC[] array contains triples of integers. Within each triple, the
82 ** elements are:
83 **
84 ** (0) The number of lines to copy
85 ** (1) The number of lines to delete
86 ** (2) The number of liens to insert
87 **
88 ** Suppose we want to advance over sz lines of the original file. This routine
89 ** returns true if that advance would land us on a copy operation. It
90 ** returns false if the advance would end on a delete.
91 */
92 static int ends_at_CPY(int *aC, int sz){
93 while( sz>0 && (aC[0]>0 || aC[1]>0 || aC[2]>0) ){
94 if( aC[0]>=sz ) return 1;
95 sz -= aC[0];
96 if( aC[1]>sz ) return 0;
97 sz -= aC[1];
98 aC += 3;
99 }
100 return 1;
101 }
102
103 /*
104 ** pSrc contains an edited file where aC[] describes the edit. Part of
105 ** pSrc has already been output. This routine outputs additional lines
106 ** of pSrc - lines that correspond to the next sz lines of the original
107 ** unedited file.
108 **
109 ** Note that sz counts the number of lines of text in the original file.
110 ** But text is output from the edited file. So the number of lines transfer
111 ** to pOut might be different from sz. Fewer lines appear in pOut if there
112 ** are deletes. More lines appear if there are inserts.
113 **
114 ** The aC[] array is updated and the new index into aC[] is returned.
115 */
116 static int output_one_side(
117 Blob *pOut, /* Write to this blob */
118 Blob *pSrc, /* The edited file that is to be copied to pOut */
119 int *aC, /* Array of integer triples describing the edit */
120 int i, /* Index in aC[] of current location in pSrc */
121 int sz, /* Number of lines in unedited source to output */
122 int *pLn /* Line number counter */
123 ){
124 while( sz>0 ){
125 if( aC[i]==0 && aC[i+1]==0 && aC[i+2]==0 ) break;
126 if( aC[i]>=sz ){
127 blob_copy_lines(pOut, pSrc, sz); *pLn += sz;
128 aC[i] -= sz;
129 break;
130 }
131 blob_copy_lines(pOut, pSrc, aC[i]); *pLn += aC[i];
132 blob_copy_lines(pOut, pSrc, aC[i+2]); *pLn += aC[i+2];
133 sz -= aC[i] + aC[i+1];
134 i += 3;
135 }
136 return i;
137 }
138
139 /*
140 ** Text of boundary markers for merge conflicts.
141 */
142 static const char *const mergeMarker[] = {
143 /*123456789 123456789 123456789 123456789 123456789 123456789 123456789*/
144 "<<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<<",
 
145 "||||||| COMMON ANCESTOR content follows |||||||||||||||||||||||||",
146 "======= MERGED IN content follows ===============================",
147 ">>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
148 };
149
@@ -186,10 +128,615 @@
186 ensure_line_end(pOut, useCrLf);
187 blob_append(pOut, mergeMarker[iMark], -1);
188 if( ln>0 ) blob_appendf(pOut, " (line %d)", ln);
189 ensure_line_end(pOut, useCrLf);
190 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
192 /*
193 ** Do a three-way merge. Initialize pOut to contain the result.
194 **
195 ** The merge is an edit against pV2. Both pV1 and pV2 have a
@@ -199,156 +746,113 @@
199 ** The return is 0 upon complete success. If any input file is binary,
200 ** -1 is returned and pOut is unmodified. If there are merge
201 ** conflicts, the merge proceeds as best as it can and the number
202 ** of conflicts is returns
203 */
204 static int blob_merge(Blob *pPivot, Blob *pV1, Blob *pV2, Blob *pOut){
205 int *aC1; /* Changes from pPivot to pV1 */
206 int *aC2; /* Changes from pPivot to pV2 */
207 int i1, i2; /* Index into aC1[] and aC2[] */
208 int nCpy, nDel, nIns; /* Number of lines to copy, delete, or insert */
209 int limit1, limit2; /* Sizes of aC1[] and aC2[] */
210 int nConflict = 0; /* Number of merge conflicts seen so far */
211 int useCrLf = 0;
212 int ln1, ln2, lnPivot; /* Line numbers for all files */
213 DiffConfig DCfg;
214
215 blob_zero(pOut); /* Merge results stored in pOut */
216
217 /* If both pV1 and pV2 start with a UTF-8 byte-order-mark (BOM),
218 ** keep it in the output. This should be secure enough not to cause
219 ** unintended changes to the merged file and consistent with what
220 ** users are using in their source files.
221 */
222 if( starts_with_utf8_bom(pV1, 0) && starts_with_utf8_bom(pV2, 0) ){
223 blob_append(pOut, (char*)get_utf8_bom(0), -1);
224 }
225
226 /* Check once to see if both pV1 and pV2 contains CR/LF endings.
227 ** If true, CR/LF pair will be used later to append the
228 ** boundary markers for merge conflicts.
229 */
230 if( contains_crlf(pV1) && contains_crlf(pV2) ){
231 useCrLf = 1;
232 }
233
234 /* Compute the edits that occur from pPivot => pV1 (into aC1)
235 ** and pPivot => pV2 (into aC2). Each of the aC1 and aC2 arrays is
236 ** an array of integer triples. Within each triple, the first integer
237 ** is the number of lines of text to copy directly from the pivot,
238 ** the second integer is the number of lines of text to omit from the
239 ** pivot, and the third integer is the number of lines of text that are
240 ** inserted. The edit array ends with a triple of 0,0,0.
241 */
242 diff_config_init(&DCfg, 0);
243 aC1 = text_diff(pPivot, pV1, 0, &DCfg);
244 aC2 = text_diff(pPivot, pV2, 0, &DCfg);
 
245 if( aC1==0 || aC2==0 ){
246 free(aC1);
247 free(aC2);
248 return -1;
249 }
250
251 blob_rewind(pV1); /* Rewind inputs: Needed to reconstruct output */
252 blob_rewind(pV2);
253 blob_rewind(pPivot);
254
255 /* Determine the length of the aC1[] and aC2[] change vectors */
256 for(i1=0; aC1[i1] || aC1[i1+1] || aC1[i1+2]; i1+=3){}
 
 
 
 
 
257 limit1 = i1;
258 for(i2=0; aC2[i2] || aC2[i2+1] || aC2[i2+2]; i2+=3){}
 
 
 
259 limit2 = i2;
260
261 DEBUG(
262 for(i1=0; i1<limit1; i1+=3){
263 printf("c1: %4d %4d %4d\n", aC1[i1], aC1[i1+1], aC1[i1+2]);
264 }
265 for(i2=0; i2<limit2; i2+=3){
266 printf("c2: %4d %4d %4d\n", aC2[i2], aC2[i2+1], aC2[i2+2]);
267 }
268 )
269
270 /* Loop over the two edit vectors and use them to compute merged text
271 ** which is written into pOut. i1 and i2 are multiples of 3 which are
272 ** indices into aC1[] and aC2[] to the edit triple currently being
273 ** processed
274 */
275 i1 = i2 = 0;
276 ln1 = ln2 = lnPivot = 1;
277 while( i1<limit1 && i2<limit2 ){
278 DEBUG( printf("%d: %2d %2d %2d %d: %2d %2d %2d\n",
279 i1/3, aC1[i1], aC1[i1+1], aC1[i1+2],
280 i2/3, aC2[i2], aC2[i2+1], aC2[i2+2]); )
281
282 if( aC1[i1]>0 && aC2[i2]>0 ){
283 /* Output text that is unchanged in both V1 and V2 */
284 nCpy = min(aC1[i1], aC2[i2]);
285 DEBUG( printf("COPY %d\n", nCpy); )
286 blob_copy_lines(pOut, pPivot, nCpy); lnPivot += nCpy;
287 blob_copy_lines(0, pV1, nCpy); ln1 += nCpy;
288 blob_copy_lines(0, pV2, nCpy); ln2 += nCpy;
289 aC1[i1] -= nCpy;
290 aC2[i2] -= nCpy;
291 }else
292 if( aC1[i1] >= aC2[i2+1] && aC1[i1]>0 && aC2[i2+1]+aC2[i2+2]>0 ){
293 /* Output edits to V2 that occurs within unchanged regions of V1 */
294 nDel = aC2[i2+1];
295 nIns = aC2[i2+2];
296 DEBUG( printf("EDIT -%d+%d left\n", nDel, nIns); )
297 blob_copy_lines(0, pPivot, nDel); lnPivot += nDel;
298 blob_copy_lines(0, pV1, nDel); ln1 += nDel;
299 blob_copy_lines(pOut, pV2, nIns); ln2 += nIns;
300 aC1[i1] -= nDel;
301 i2 += 3;
302 }else
303 if( aC2[i2] >= aC1[i1+1] && aC2[i2]>0 && aC1[i1+1]+aC1[i1+2]>0 ){
304 /* Output edits to V1 that occur within unchanged regions of V2 */
305 nDel = aC1[i1+1];
306 nIns = aC1[i1+2];
307 DEBUG( printf("EDIT -%d+%d right\n", nDel, nIns); )
308 blob_copy_lines(0, pPivot, nDel); lnPivot += nDel;
309 blob_copy_lines(0, pV2, nDel); ln2 += nDel;
310 blob_copy_lines(pOut, pV1, nIns); ln1 += nIns;
311 aC2[i2] -= nDel;
312 i1 += 3;
313 }else
314 if( sameEdit(&aC1[i1], &aC2[i2], pV1, pV2) ){
315 /* Output edits that are identical in both V1 and V2. */
316 assert( aC1[i1]==0 );
317 nDel = aC1[i1+1];
318 nIns = aC1[i1+2];
319 DEBUG( printf("EDIT -%d+%d both\n", nDel, nIns); )
320 blob_copy_lines(0, pPivot, nDel); lnPivot += nDel;
321 blob_copy_lines(pOut, pV1, nIns); ln1 += nIns;
322 blob_copy_lines(0, pV2, nIns); ln2 += nIns;
323 i1 += 3;
324 i2 += 3;
325 }else
326 {
327 /* We have found a region where different edits to V1 and V2 overlap.
328 ** This is a merge conflict. Find the size of the conflict, then
329 ** output both possible edits separated by distinctive marks.
330 */
331 int sz = 1; /* Size of the conflict in lines */
 
332 nConflict++;
333 while( !ends_at_CPY(&aC1[i1], sz) || !ends_at_CPY(&aC2[i2], sz) ){
334 sz++;
335 }
336 DEBUG( printf("CONFLICT %d\n", sz); )
337
338 append_merge_mark(pOut, 0, ln1, useCrLf);
339 i1 = output_one_side(pOut, pV1, aC1, i1, sz, &ln1);
340
341 append_merge_mark(pOut, 1, lnPivot, useCrLf);
342 blob_copy_lines(pOut, pPivot, sz); lnPivot += sz;
343
344 append_merge_mark(pOut, 2, ln2, useCrLf);
345 i2 = output_one_side(pOut, pV2, aC2, i2, sz, &ln2);
346
347 append_merge_mark(pOut, 3, -1, useCrLf);
348 }
349
350 /* If we are finished with an edit triple, advance to the next
351 ** triple.
352 */
353 if( i1<limit1 && aC1[i1]==0 && aC1[i1+1]==0 && aC1[i1+2]==0 ) i1+=3;
354 if( i2<limit2 && aC2[i2]==0 && aC2[i2+1]==0 && aC2[i2+2]==0 ) i2+=3;
@@ -356,20 +860,18 @@
356
357 /* When one of the two edit vectors reaches its end, there might still
358 ** be an insert in the other edit vector. Output this remaining
359 ** insert.
360 */
361 DEBUG( printf("%d: %2d %2d %2d %d: %2d %2d %2d\n",
362 i1/3, aC1[i1], aC1[i1+1], aC1[i1+2],
363 i2/3, aC2[i2], aC2[i2+1], aC2[i2+2]); )
364 if( i1<limit1 && aC1[i1+2]>0 ){
365 DEBUG( printf("INSERT +%d left\n", aC1[i1+2]); )
366 blob_copy_lines(pOut, pV1, aC1[i1+2]);
367 }else if( i2<limit2 && aC2[i2+2]>0 ){
368 DEBUG( printf("INSERT +%d right\n", aC2[i2+2]); )
369 blob_copy_lines(pOut, pV2, aC2[i2+2]);
370 }
 
 
 
371
372 free(aC1);
373 free(aC2);
374 return nConflict;
375 }
@@ -384,11 +886,12 @@
384 const char *z = blob_buffer(p);
385 int n = blob_size(p) - len + 1;
386 assert( len==(int)strlen(mergeMarker[1]) );
387 assert( len==(int)strlen(mergeMarker[2]) );
388 assert( len==(int)strlen(mergeMarker[3]) );
389 assert( count(mergeMarker)==4 );
 
390 for(i=0; i<n; ){
391 for(j=0; j<4; j++){
392 if( (memcmp(&z[i], mergeMarker[j], len)==0) ){
393 return 1;
394 }
@@ -408,18 +911,106 @@
408 blob_read_from_file(&file, zFullpath, ExtFILE);
409 rc = contains_merge_marker(&file);
410 blob_reset(&file);
411 return rc;
412 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
413
414 /*
415 ** COMMAND: 3-way-merge*
416 **
417 ** Usage: %fossil 3-way-merge BASELINE V1 V2 MERGED
418 **
419 ** Inputs are files BASELINE, V1, and V2. The file MERGED is generated
420 ** as output.
 
421 **
422 ** BASELINE is a common ancestor of two files V1 and V2 that have diverging
423 ** edits. The generated output file MERGED is the combination of all
424 ** changes in both V1 and V2.
425 **
@@ -436,38 +1027,75 @@
436 ** cp Xup.c Xbase.c
437 ** # Verify that everything still works
438 ** fossil commit
439 **
440 */
441 void delta_3waymerge_cmd(void){
442 Blob pivot, v1, v2, merged;
443 int nConflict;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
444
445 /* We should be done with options.. */
446 verify_all_options();
447
448 if( g.argc!=6 ){
449 usage("PIVOT V1 V2 MERGED");
450 }
451 if( blob_read_from_file(&pivot, g.argv[2], ExtFILE)<0 ){
 
 
 
452 fossil_fatal("cannot read %s", g.argv[2]);
453 }
454 if( blob_read_from_file(&v1, g.argv[3], ExtFILE)<0 ){
455 fossil_fatal("cannot read %s", g.argv[3]);
456 }
457 if( blob_read_from_file(&v2, g.argv[4], ExtFILE)<0 ){
458 fossil_fatal("cannot read %s", g.argv[4]);
459 }
460 nConflict = blob_merge(&pivot, &v1, &v2, &merged);
461 if( blob_write_to_file(&merged, g.argv[5])<(int)blob_size(&merged) ){
462 fossil_fatal("cannot write %s", g.argv[4]);
 
 
 
 
463 }
 
464 blob_reset(&pivot);
465 blob_reset(&v1);
466 blob_reset(&v2);
467 blob_reset(&merged);
468 if( nConflict>0 ) fossil_warning("WARNING: %d merge conflicts", nConflict);
 
 
469 }
470
471 /*
472 ** aSubst is an array of string pairs. The first element of each pair is
473 ** a string that begins with %. The second element is a replacement for that
@@ -505,32 +1133,32 @@
505
506 #if INTERFACE
507 /*
508 ** Flags to the 3-way merger
509 */
510 #define MERGE_DRYRUN 0x0001
511 /*
512 ** The MERGE_KEEP_FILES flag specifies that merge_3way() should retain
513 ** its temporary files on error. By default they are removed after the
514 ** merge, regardless of success or failure.
515 */
516 #define MERGE_KEEP_FILES 0x0002
517 #endif
518
519
520 /*
521 ** This routine is a wrapper around blob_merge() with the following
522 ** enhancements:
523 **
524 ** (1) If the merge-command is defined, then use the external merging
525 ** program specified instead of the built-in blob-merge to do the
526 ** merging. Panic if the external merger fails.
527 ** ** Not currently implemented **
528 **
529 ** (2) If gmerge-command is defined and there are merge conflicts in
530 ** blob_merge() then invoke the external graphical merger to resolve
531 ** the conflicts.
532 **
533 ** (3) If a merge conflict occurs and gmerge-command is not defined,
534 ** then write the pivot, original, and merge-in files to the
535 ** filesystem.
536 */
@@ -539,30 +1167,37 @@
539 const char *zV1, /* Name of file for version merging into (mine) */
540 Blob *pV2, /* Version merging from (yours) */
541 Blob *pOut, /* Output written here */
542 unsigned mergeFlags /* Flags that control operation */
543 ){
544 Blob v1; /* Content of zV1 */
545 int rc; /* Return code of subroutines and this routine */
546 const char *zGMerge; /* Name of the gmerge command */
 
547
548 blob_read_from_file(&v1, zV1, ExtFILE);
549 rc = blob_merge(pPivot, &v1, pV2, pOut);
 
 
 
 
 
 
550 zGMerge = rc<=0 ? 0 : db_get("gmerge-command", 0);
551 if( (mergeFlags & MERGE_DRYRUN)==0
552 && ((zGMerge!=0 && zGMerge[0]!=0)
553 || (rc!=0 && (mergeFlags & MERGE_KEEP_FILES)!=0)) ){
554 char *zPivot; /* Name of the pivot file */
555 char *zOrig; /* Name of the original content file */
556 char *zOther; /* Name of the merge file */
557
558 zPivot = file_newname(zV1, "baseline", 1);
559 blob_write_to_file(pPivot, zPivot);
560 zOrig = file_newname(zV1, "original", 1);
561 blob_write_to_file(&v1, zOrig);
562 zOther = file_newname(zV1, "merge", 1);
563 blob_write_to_file(pV2, zOther);
564 if( rc>0 ){
565 if( zGMerge && zGMerge[0] ){
566 char *zOut; /* Temporary output file */
567 char *zCmd; /* Command to invoke */
568 const char *azSubst[8]; /* Strings to be substituted */
@@ -590,7 +1225,8 @@
590 fossil_free(zPivot);
591 fossil_free(zOrig);
592 fossil_free(zOther);
593 }
594 blob_reset(&v1);
 
595 return rc;
596 }
597
--- src/merge3.c
+++ src/merge3.c
@@ -75,75 +75,17 @@
75 if( aC1[2]!=aC2[2] ) return 0;
76 if( sameLines(pV1, pV2, aC1[2]) ) return 1;
77 return 0;
78 }
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80 /*
81 ** Text of boundary markers for merge conflicts.
82 */
83 static const char *const mergeMarker[] = {
84 /*123456789 123456789 123456789 123456789 123456789 123456789 123456789*/
85 "<<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<<",
86 "####### SUGGESTED CONFLICT RESOLUTION follows ###################",
87 "||||||| COMMON ANCESTOR content follows |||||||||||||||||||||||||",
88 "======= MERGED IN content follows ===============================",
89 ">>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
90 };
91
@@ -186,10 +128,615 @@
128 ensure_line_end(pOut, useCrLf);
129 blob_append(pOut, mergeMarker[iMark], -1);
130 if( ln>0 ) blob_appendf(pOut, " (line %d)", ln);
131 ensure_line_end(pOut, useCrLf);
132 }
133
134 #if INTERFACE
135 /*
136 ** This is an abstract class for constructing a merge.
137 ** Subclasses of this object format the merge output in different ways.
138 **
139 ** To subclass, create an instance of the MergeBuilder object and fill
140 ** in appropriate method implementations.
141 */
142 struct MergeBuilder {
143 void (*xStart)(MergeBuilder*);
144 void (*xSame)(MergeBuilder*, unsigned int);
145 void (*xChngV1)(MergeBuilder*, unsigned int, unsigned int);
146 void (*xChngV2)(MergeBuilder*, unsigned int, unsigned int);
147 void (*xChngBoth)(MergeBuilder*, unsigned int, unsigned int);
148 void (*xConflict)(MergeBuilder*, unsigned int, unsigned int, unsigned int);
149 void (*xEnd)(MergeBuilder*);
150 void (*xDestroy)(MergeBuilder*);
151 const char *zPivot; /* Label or name for the pivot */
152 const char *zV1; /* Label or name for the V1 file */
153 const char *zV2; /* Label or name for the V2 file */
154 const char *zOut; /* Label or name for the output */
155 Blob *pPivot; /* The common ancestor */
156 Blob *pV1; /* First variant (local copy) */
157 Blob *pV2; /* Second variant (merged in) */
158 Blob *pOut; /* Write merge results here */
159 int useCrLf; /* Use CRLF line endings */
160 int nContext; /* Size of unchanged line boundaries */
161 unsigned int mxPivot; /* Number of lines in the pivot */
162 unsigned int mxV1; /* Number of lines in V1 */
163 unsigned int mxV2; /* Number of lines in V2 */
164 unsigned int lnPivot; /* Lines read from pivot */
165 unsigned int lnV1; /* Lines read from v1 */
166 unsigned int lnV2; /* Lines read from v2 */
167 unsigned int lnOut; /* Lines written to out */
168 unsigned int nConflict; /* Number of conflicts seen */
169 u64 diffFlags; /* Flags for difference engine */
170 };
171 #endif /* INTERFACE */
172
173
174 /************************* Generic MergeBuilder ******************************/
175 /* These are generic methods for MergeBuilder. They just output debugging
176 ** information. But some of them are useful as base methods for other useful
177 ** implementations of MergeBuilder.
178 */
179
180 /* xStart() and xEnd() are called to generate header and fotter information
181 ** in the output. This is a no-op in the generic implementation.
182 */
183 static void dbgStartEnd(MergeBuilder *p){ (void)p; }
184
185 /* The next N lines of PIVOT are unchanged in both V1 and V2
186 */
187 static void dbgSame(MergeBuilder *p, unsigned int N){
188 blob_appendf(p->pOut,
189 "COPY %u from BASELINE(%u..%u) or V1(%u..%u) or V2(%u..%u)\n",
190 N, p->lnPivot+1, p->lnPivot+N, p->lnV1+1, p->lnV1+N,
191 p->lnV2+1, p->lnV2+N);
192 p->lnPivot += N;
193 p->lnV1 += N;
194 p->lnV2 += N;
195 }
196
197 /* The next nPivot lines of the PIVOT are changed into nV1 lines by V1
198 */
199 static void dbgChngV1(MergeBuilder *p, unsigned int nPivot, unsigned int nV1){
200 blob_appendf(p->pOut, "COPY %u from V1(%u..%u)\n",
201 nV1, p->lnV1+1, p->lnV1+nV1);
202 p->lnPivot += nPivot;
203 p->lnV2 += nPivot;
204 p->lnV1 += nV1;
205 }
206
207 /* The next nPivot lines of the PIVOT are changed into nV2 lines by V2
208 */
209 static void dbgChngV2(MergeBuilder *p, unsigned int nPivot, unsigned int nV2){
210 blob_appendf(p->pOut, "COPY %u lines FROM V2(%u..%u)\n",
211 nV2, p->lnV2+1, p->lnV2+nV2);
212 p->lnPivot += nPivot;
213 p->lnV1 += nPivot;
214 p->lnV2 += nV2;
215 }
216
217 /* The next nPivot lines of the PIVOT are changed into nV lines from V1 and
218 ** V2, which should be the same. In other words, the same change is found
219 ** in both V1 and V2.
220 */
221 static void dbgChngBoth(MergeBuilder *p, unsigned int nPivot, unsigned int nV){
222 blob_appendf(p->pOut, "COPY %u lines from V1(%u..%u) or V2(%u..%u)\n",
223 nV, p->lnV1+1, p->lnV1+nV, p->lnV2+1, p->lnV2+nV);
224 p->lnPivot += nPivot;
225 p->lnV1 += nV;
226 p->lnV2 += nV;
227 }
228
229 /* V1 and V2 have different and overlapping changes. The next nPivot lines
230 ** of the PIVOT are converted into nV1 lines of V1 and nV2 lines of V2.
231 */
232 static void dbgConflict(
233 MergeBuilder *p,
234 unsigned int nPivot,
235 unsigned int nV1,
236 unsigned int nV2
237 ){
238 blob_appendf(p->pOut,
239 "CONFLICT %u,%u,%u BASELINE(%u..%u) versus V1(%u..%u) versus V2(%u..%u)\n",
240 nPivot, nV1, nV2,
241 p->lnPivot+1, p->lnPivot+nPivot,
242 p->lnV1+1, p->lnV1+nV1,
243 p->lnV2+1, p->lnV2+nV2);
244 p->lnV1 += nV1;
245 p->lnPivot += nPivot;
246 p->lnV2 += nV2;
247 }
248
249 /* Generic destructor for the MergeBuilder object
250 */
251 static void dbgDestroy(MergeBuilder *p){
252 memset(p, 0, sizeof(*p));
253 }
254
255 /* Generic initializer for a MergeBuilder object
256 */
257 static void mergebuilder_init(MergeBuilder *p){
258 memset(p, 0, sizeof(*p));
259 p->xStart = dbgStartEnd;
260 p->xSame = dbgSame;
261 p->xChngV1 = dbgChngV1;
262 p->xChngV2 = dbgChngV2;
263 p->xChngBoth = dbgChngBoth;
264 p->xConflict = dbgConflict;
265 p->xEnd = dbgStartEnd;
266 p->xDestroy = dbgDestroy;
267 }
268
269 /************************* MergeBuilderToken ********************************/
270 /* This version of MergeBuilder actually performs a merge on file that
271 ** are broken up into tokens instead of lines, and puts the result in pOut.
272 */
273 static void tokenSame(MergeBuilder *p, unsigned int N){
274 blob_append(p->pOut, p->pPivot->aData+p->pPivot->iCursor, N);
275 p->pPivot->iCursor += N;
276 p->pV1->iCursor += N;
277 p->pV2->iCursor += N;
278 }
279 static void tokenChngV1(MergeBuilder *p, unsigned int nPivot, unsigned nV1){
280 blob_append(p->pOut, p->pV1->aData+p->pV1->iCursor, nV1);
281 p->pPivot->iCursor += nPivot;
282 p->pV1->iCursor += nV1;
283 p->pV2->iCursor += nPivot;
284 }
285 static void tokenChngV2(MergeBuilder *p, unsigned int nPivot, unsigned nV2){
286 blob_append(p->pOut, p->pV2->aData+p->pV2->iCursor, nV2);
287 p->pPivot->iCursor += nPivot;
288 p->pV1->iCursor += nPivot;
289 p->pV2->iCursor += nV2;
290 }
291 static void tokenChngBoth(MergeBuilder *p, unsigned int nPivot, unsigned nV){
292 blob_append(p->pOut, p->pV2->aData+p->pV2->iCursor, nV);
293 p->pPivot->iCursor += nPivot;
294 p->pV1->iCursor += nV;
295 p->pV2->iCursor += nV;
296 }
297 static void tokenConflict(
298 MergeBuilder *p,
299 unsigned int nPivot,
300 unsigned int nV1,
301 unsigned int nV2
302 ){
303 /* For a token-merge conflict, use the text from the merge-in */
304 blob_append(p->pOut, p->pV2->aData+p->pV2->iCursor, nV2);
305 p->pPivot->iCursor += nPivot;
306 p->pV1->iCursor += nV1;
307 p->pV2->iCursor += nV2;
308 }
309 static void mergebuilder_init_token(MergeBuilder *p){
310 mergebuilder_init(p);
311 p->xSame = tokenSame;
312 p->xChngV1 = tokenChngV1;
313 p->xChngV2 = tokenChngV2;
314 p->xChngBoth = tokenChngBoth;
315 p->xConflict = tokenConflict;
316 p->diffFlags = DIFF_BY_TOKEN;
317 }
318
319 /*
320 ** Attempt to do a low-level merge on a conflict. The conflict is
321 ** described by the first four parameters, which are the same as the
322 ** arguments to the xConflict method of the MergeBuilder object.
323 ** This routine attempts to resolve the conflict by looking at
324 ** elements of the conflict region that are finer grain than complete
325 ** lines of text.
326 **
327 ** The result is written into Blob pOut. pOut is initialized by this
328 ** routine.
329 */
330 int merge_try_to_resolve_conflict(
331 MergeBuilder *pMB, /* MergeBuilder that encounter conflict */
332 unsigned int nPivot, /* Lines of conflict in the pivot */
333 unsigned int nV1, /* Lines of conflict in V1 */
334 unsigned int nV2, /* Lines of conflict in V2 */
335 Blob *pOut /* Write resolution text here */
336 ){
337 int nConflict;
338 MergeBuilder mb;
339 Blob pv, v1, v2;
340 mergebuilder_init_token(&mb);
341 blob_extract_lines(pMB->pPivot, nPivot, &pv);
342 blob_extract_lines(pMB->pV1, nV1, &v1);
343 blob_extract_lines(pMB->pV2, nV2, &v2);
344 blob_zero(pOut);
345 blob_materialize(&pv);
346 blob_materialize(&v1);
347 blob_materialize(&v2);
348 mb.pPivot = &pv;
349 mb.pV1 = &v1;
350 mb.pV2 = &v2;
351 mb.pOut = pOut;
352 nConflict = merge_three_blobs(&mb);
353 blob_reset(&pv);
354 blob_reset(&v1);
355 blob_reset(&v2);
356 /* mb has not allocated any resources, so we do not need to invoke
357 ** the xDestroy method. */
358 blob_add_final_newline(pOut);
359 return nConflict;
360 }
361
362
363 /************************* MergeBuilderText **********************************/
364 /* This version of MergeBuilder actually performs a merge on file and puts
365 ** the result in pOut
366 */
367 static void txtStart(MergeBuilder *p){
368 /* If both pV1 and pV2 start with a UTF-8 byte-order-mark (BOM),
369 ** keep it in the output. This should be secure enough not to cause
370 ** unintended changes to the merged file and consistent with what
371 ** users are using in their source files.
372 */
373 if( starts_with_utf8_bom(p->pV1, 0) && starts_with_utf8_bom(p->pV2, 0) ){
374 blob_append(p->pOut, (char*)get_utf8_bom(0), -1);
375 }
376 if( contains_crlf(p->pV1) && contains_crlf(p->pV2) ){
377 p->useCrLf = 1;
378 }
379 }
380 static void txtSame(MergeBuilder *p, unsigned int N){
381 blob_copy_lines(p->pOut, p->pPivot, N); p->lnPivot += N;
382 blob_copy_lines(0, p->pV1, N); p->lnV1 += N;
383 blob_copy_lines(0, p->pV2, N); p->lnV2 += N;
384 }
385 static void txtChngV1(MergeBuilder *p, unsigned int nPivot, unsigned int nV1){
386 blob_copy_lines(0, p->pPivot, nPivot); p->lnPivot += nPivot;
387 blob_copy_lines(0, p->pV2, nPivot); p->lnV2 += nPivot;
388 blob_copy_lines(p->pOut, p->pV1, nV1); p->lnV1 += nV1;
389 }
390 static void txtChngV2(MergeBuilder *p, unsigned int nPivot, unsigned int nV2){
391 blob_copy_lines(0, p->pPivot, nPivot); p->lnPivot += nPivot;
392 blob_copy_lines(0, p->pV1, nPivot); p->lnV1 += nPivot;
393 blob_copy_lines(p->pOut, p->pV2, nV2); p->lnV2 += nV2;
394 }
395 static void txtChngBoth(MergeBuilder *p, unsigned int nPivot, unsigned int nV){
396 blob_copy_lines(0, p->pPivot, nPivot); p->lnPivot += nPivot;
397 blob_copy_lines(0, p->pV1, nPivot); p->lnV1 += nV;
398 blob_copy_lines(p->pOut, p->pV2, nV); p->lnV2 += nV;
399 }
400 static void txtConflict(
401 MergeBuilder *p,
402 unsigned int nPivot,
403 unsigned int nV1,
404 unsigned int nV2
405 ){
406 int nRes; /* Lines in the computed conflict resolution */
407 Blob res; /* Text of the conflict resolution */
408
409 merge_try_to_resolve_conflict(p, nPivot, nV1, nV2, &res);
410 nRes = blob_linecount(&res);
411
412 append_merge_mark(p->pOut, 0, p->lnV1+1, p->useCrLf);
413 blob_copy_lines(p->pOut, p->pV1, nV1); p->lnV1 += nV1;
414
415 if( nRes>0 ){
416 append_merge_mark(p->pOut, 1, 0, p->useCrLf);
417 blob_copy_lines(p->pOut, &res, nRes);
418 }
419 blob_reset(&res);
420
421 append_merge_mark(p->pOut, 2, p->lnPivot+1, p->useCrLf);
422 blob_copy_lines(p->pOut, p->pPivot, nPivot); p->lnPivot += nPivot;
423
424 append_merge_mark(p->pOut, 3, p->lnV2+1, p->useCrLf);
425 blob_copy_lines(p->pOut, p->pV2, nV2); p->lnV2 += nV2;
426
427 append_merge_mark(p->pOut, 4, -1, p->useCrLf);
428 }
429 static void mergebuilder_init_text(MergeBuilder *p){
430 mergebuilder_init(p);
431 p->xStart = txtStart;
432 p->xSame = txtSame;
433 p->xChngV1 = txtChngV1;
434 p->xChngV2 = txtChngV2;
435 p->xChngBoth = txtChngBoth;
436 p->xConflict = txtConflict;
437 }
438
439 /************************* MergeBuilderTcl **********************************/
440 /* Generate merge output formatted for reading by a TCL script.
441 **
442 ** The output consists of lines of text, each with 4 tokens. The tokens
443 ** represent the content for one line from baseline, v1, v2, and output
444 ** respectively. The first character of each token provides auxiliary
445 ** information:
446 **
447 ** . This line is omitted.
448 ** N Name of the file.
449 ** T Literal text follows that should have a \n terminator.
450 ** R Literal text follows that needs a \r\n terminator.
451 ** X Merge conflict.
452 ** Z Literal text without a line terminator.
453 ** S Skipped lines. Followed by number of lines to skip.
454 ** 1 Text is a copy of token 1
455 ** 2 Use data from data-token 2
456 ** 3 Use data from data-token 3
457 */
458
459 /* Write text that goes into the interior of a double-quoted string in TCL */
460 static void tclWriteQuotedText(Blob *pOut, const char *zIn, int nIn){
461 int j;
462 for(j=0; j<nIn; j++){
463 char c = zIn[j];
464 if( c=='\\' ){
465 blob_append(pOut, "\\\\", 2);
466 }else if( c=='"' ){
467 blob_append(pOut, "\\\"", 2);
468 }else if( c<' ' || c>0x7e ){
469 char z[5];
470 z[0] = '\\';
471 z[1] = "01234567"[(c>>6)&0x3];
472 z[2] = "01234567"[(c>>3)&0x7];
473 z[3] = "01234567"[c&0x7];
474 z[4] = 0;
475 blob_append(pOut, z, 4);
476 }else{
477 blob_append_char(pOut, c);
478 }
479 }
480 }
481
482 /* Copy one line of text from pIn and append to pOut, encoded as TCL */
483 static void tclLineOfText(Blob *pOut, Blob *pIn, char cType){
484 int i, k;
485 for(i=pIn->iCursor; i<pIn->nUsed && pIn->aData[i]!='\n'; i++){}
486 if( i==pIn->nUsed ){
487 k = i;
488 }else if( i>pIn->iCursor && pIn->aData[i-1]=='\r' ){
489 k = i-1;
490 i++;
491 }else{
492 k = i;
493 i++;
494 }
495 blob_append_char(pOut, '"');
496 blob_append_char(pOut, cType);
497 tclWriteQuotedText(pOut, pIn->aData+pIn->iCursor, k-pIn->iCursor);
498 pIn->iCursor = i;
499 blob_append_char(pOut, '"');
500 }
501 static void tclStart(MergeBuilder *p){
502 Blob *pOut = p->pOut;
503 blob_append(pOut, "\"N", 2);
504 tclWriteQuotedText(pOut, p->zPivot, (int)strlen(p->zPivot));
505 blob_append(pOut, "\" \"N", 4);
506 tclWriteQuotedText(pOut, p->zV1, (int)strlen(p->zV1));
507 blob_append(pOut, "\" \"N", 4);
508 tclWriteQuotedText(pOut, p->zV2, (int)strlen(p->zV2));
509 blob_append(pOut, "\" \"N", 4);
510 if( p->zOut ){
511 tclWriteQuotedText(pOut, p->zOut, (int)strlen(p->zOut));
512 }else{
513 blob_append(pOut, "(Merge Result)", -1);
514 }
515 blob_append(pOut, "\"\n", 2);
516 }
517 static void tclSame(MergeBuilder *p, unsigned int N){
518 int i = 0;
519 int nSkip;
520
521 if( p->lnPivot>=2 || p->lnV1>2 || p->lnV2>2 ){
522 while( i<N && i<p->nContext ){
523 tclLineOfText(p->pOut, p->pPivot, 'T');
524 blob_append(p->pOut, " 1 1 1\n", 7);
525 i++;
526 }
527 nSkip = N - p->nContext*2;
528 }else{
529 nSkip = N - p->nContext;
530 }
531 if( nSkip>0 ){
532 blob_appendf(p->pOut, "\"S%d %d %d %d\" . . .\n",
533 nSkip, nSkip, nSkip, nSkip);
534 blob_copy_lines(0, p->pPivot, nSkip);
535 i += nSkip;
536 }
537
538 p->lnPivot += N;
539 p->lnV1 += N;
540 p->lnV2 += N;
541
542 if( p->lnPivot<p->mxPivot || p->lnV1<p->mxV1 || p->lnV2<p->mxV2 ){
543 while( i<N ){
544 tclLineOfText(p->pOut, p->pPivot, 'T');
545 blob_append(p->pOut, " 1 1 1\n", 7);
546 i++;
547 }
548 }
549
550 blob_copy_lines(0, p->pV1, N);
551 blob_copy_lines(0, p->pV2, N);
552 }
553 static void tclChngV1(MergeBuilder *p, unsigned int nPivot, unsigned int nV1){
554 int i;
555 for(i=0; i<nPivot && i<nV1; i++){
556 tclLineOfText(p->pOut, p->pPivot, 'T');
557 blob_append_char(p->pOut, ' ');
558 tclLineOfText(p->pOut, p->pV1, 'T');
559 blob_append(p->pOut, " 1 2\n", 5);
560 }
561 while( i<nPivot ){
562 tclLineOfText(p->pOut, p->pPivot, 'T');
563 blob_append(p->pOut, " . 1 .\n", 7);
564 i++;
565 }
566 while( i<nV1 ){
567 blob_append(p->pOut, ". ", 2);
568 tclLineOfText(p->pOut, p->pV1, 'T');
569 blob_append(p->pOut, " . 2\n", 5);
570 i++;
571 }
572 p->lnPivot += nPivot;
573 p->lnV1 += nV1;
574 p->lnV2 += nPivot;
575 blob_copy_lines(0, p->pV2, nPivot);
576 }
577 static void tclChngV2(MergeBuilder *p, unsigned int nPivot, unsigned int nV2){
578 int i;
579 for(i=0; i<nPivot && i<nV2; i++){
580 tclLineOfText(p->pOut, p->pPivot, 'T');
581 blob_append(p->pOut, " 1 ", 3);
582 tclLineOfText(p->pOut, p->pV2, 'T');
583 blob_append(p->pOut, " 3\n", 3);
584 }
585 while( i<nPivot ){
586 tclLineOfText(p->pOut, p->pPivot, 'T');
587 blob_append(p->pOut, " 1 . .\n", 7);
588 i++;
589 }
590 while( i<nV2 ){
591 blob_append(p->pOut, ". . ", 4);
592 tclLineOfText(p->pOut, p->pV2, 'T');
593 blob_append(p->pOut, " 3\n", 3);
594 i++;
595 }
596 p->lnPivot += nPivot;
597 p->lnV1 += nPivot;
598 p->lnV2 += nV2;
599 blob_copy_lines(0, p->pV1, nPivot);
600 }
601 static void tclChngBoth(MergeBuilder *p, unsigned int nPivot, unsigned int nV){
602 int i;
603 for(i=0; i<nPivot && i<nV; i++){
604 tclLineOfText(p->pOut, p->pPivot, 'T');
605 blob_append_char(p->pOut, ' ');
606 tclLineOfText(p->pOut, p->pV1, 'T');
607 blob_append(p->pOut, " 2 2\n", 5);
608 }
609 while( i<nPivot ){
610 tclLineOfText(p->pOut, p->pPivot, 'T');
611 blob_append(p->pOut, " . . .\n", 7);
612 i++;
613 }
614 while( i<nV ){
615 blob_append(p->pOut, ". ", 2);
616 tclLineOfText(p->pOut, p->pV1, 'T');
617 blob_append(p->pOut, " 2 2\n", 5);
618 i++;
619 }
620 p->lnPivot += nPivot;
621 p->lnV1 += nV;
622 p->lnV2 += nV;
623 blob_copy_lines(0, p->pV2, nV);
624 }
625 static void tclConflict(
626 MergeBuilder *p,
627 unsigned int nPivot,
628 unsigned int nV1,
629 unsigned int nV2
630 ){
631 int mx = nPivot;
632 int i;
633 int nRes;
634 Blob res;
635
636 merge_try_to_resolve_conflict(p, nPivot, nV1, nV2, &res);
637 nRes = blob_linecount(&res);
638 if( nV1>mx ) mx = nV1;
639 if( nV2>mx ) mx = nV2;
640 if( nRes>mx ) mx = nRes;
641 if( nRes>0 ){
642 blob_appendf(p->pOut, "\"S0 0 0 %d\" . . .\n", nV2+2);
643 }
644 for(i=0; i<mx; i++){
645 if( i<nPivot ){
646 tclLineOfText(p->pOut, p->pPivot, 'X');
647 }else{
648 blob_append_char(p->pOut, '.');
649 }
650 blob_append_char(p->pOut, ' ');
651 if( i<nV1 ){
652 tclLineOfText(p->pOut, p->pV1, 'X');
653 }else{
654 blob_append_char(p->pOut, '.');
655 }
656 blob_append_char(p->pOut, ' ');
657 if( i<nV2 ){
658 tclLineOfText(p->pOut, p->pV2, 'X');
659 }else{
660 blob_append_char(p->pOut, '.');
661 }
662 if( i<nRes ){
663 blob_append_char(p->pOut, ' ');
664 tclLineOfText(p->pOut, &res, 'X');
665 blob_append_char(p->pOut, '\n');
666 }else{
667 blob_append(p->pOut, " .\n", 3);
668 }
669 if( i==mx-1 ){
670 blob_appendf(p->pOut, "\"S0 0 0 %d\" . . .\n", nPivot+nV1+3);
671 }
672 }
673 blob_reset(&res);
674 p->lnPivot += nPivot;
675 p->lnV1 += nV1;
676 p->lnV2 += nV2;
677 }
678 void mergebuilder_init_tcl(MergeBuilder *p){
679 mergebuilder_init(p);
680 p->xStart = tclStart;
681 p->xSame = tclSame;
682 p->xChngV1 = tclChngV1;
683 p->xChngV2 = tclChngV2;
684 p->xChngBoth = tclChngBoth;
685 p->xConflict = tclConflict;
686 }
687 /*****************************************************************************/
688
689 /*
690 ** The aC[] array contains triples of integers. Within each triple, the
691 ** elements are:
692 **
693 ** (0) The number of lines to copy
694 ** (1) The number of lines to delete
695 ** (2) The number of liens to insert
696 **
697 ** Suppose we want to advance over sz lines of the original file. This routine
698 ** returns true if that advance would land us on a copy operation. It
699 ** returns false if the advance would end on a delete.
700 */
701 static int ends_with_copy(int *aC, int sz){
702 while( sz>0 && (aC[0]>0 || aC[1]>0 || aC[2]>0) ){
703 if( aC[0]>=sz ) return 1;
704 sz -= aC[0];
705 if( aC[1]>sz ) return 0;
706 sz -= aC[1];
707 aC += 3;
708 }
709 return 1;
710 }
711
712 /*
713 ** aC[] is an "edit triple" for changes from A to B. Advance through
714 ** this triple to determine the number of lines to bypass on B in order
715 ** to match an advance of sz lines on A.
716 */
717 static int skip_conflict(
718 int *aC, /* Array of integer triples describing the edit */
719 int i, /* Index in aC[] of current location */
720 int sz, /* Lines of A that have been skipped */
721 unsigned int *pLn /* OUT: Lines of B to skip to keep aligment with A */
722 ){
723 *pLn = 0;
724 while( sz>0 ){
725 if( aC[i]==0 && aC[i+1]==0 && aC[i+2]==0 ) break;
726 if( aC[i]>=sz ){
727 aC[i] -= sz;
728 *pLn += sz;
729 break;
730 }
731 *pLn += aC[i];
732 *pLn += aC[i+2];
733 sz -= aC[i] + aC[i+1];
734 i += 3;
735 }
736 return i;
737 }
738
739 /*
740 ** Do a three-way merge. Initialize pOut to contain the result.
741 **
742 ** The merge is an edit against pV2. Both pV1 and pV2 have a
@@ -199,156 +746,113 @@
746 ** The return is 0 upon complete success. If any input file is binary,
747 ** -1 is returned and pOut is unmodified. If there are merge
748 ** conflicts, the merge proceeds as best as it can and the number
749 ** of conflicts is returns
750 */
751 int merge_three_blobs(MergeBuilder *p){
752 int *aC1; /* Changes from pPivot to pV1 */
753 int *aC2; /* Changes from pPivot to pV2 */
754 int i1, i2; /* Index into aC1[] and aC2[] */
755 int nCpy, nDel, nIns; /* Number of lines to copy, delete, or insert */
756 int limit1, limit2; /* Sizes of aC1[] and aC2[] */
757 int nConflict = 0; /* Number of merge conflicts seen so far */
 
 
758 DiffConfig DCfg;
759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
760 /* Compute the edits that occur from pPivot => pV1 (into aC1)
761 ** and pPivot => pV2 (into aC2). Each of the aC1 and aC2 arrays is
762 ** an array of integer triples. Within each triple, the first integer
763 ** is the number of lines of text to copy directly from the pivot,
764 ** the second integer is the number of lines of text to omit from the
765 ** pivot, and the third integer is the number of lines of text that are
766 ** inserted. The edit array ends with a triple of 0,0,0.
767 */
768 diff_config_init(&DCfg, 0);
769 DCfg.diffFlags = p->diffFlags;
770 aC1 = text_diff(p->pPivot, p->pV1, 0, &DCfg);
771 aC2 = text_diff(p->pPivot, p->pV2, 0, &DCfg);
772 if( aC1==0 || aC2==0 ){
773 free(aC1);
774 free(aC2);
775 return -1;
776 }
777
778 blob_rewind(p->pV1); /* Rewind inputs: Needed to reconstruct output */
779 blob_rewind(p->pV2);
780 blob_rewind(p->pPivot);
781
782 /* Determine the length of the aC1[] and aC2[] change vectors */
783 p->mxPivot = 0;
784 p->mxV1 = 0;
785 for(i1=0; aC1[i1] || aC1[i1+1] || aC1[i1+2]; i1+=3){
786 p->mxPivot += aC1[i1] + aC1[i1+1];
787 p->mxV1 += aC1[i1] + aC1[i1+2];
788 }
789 limit1 = i1;
790 p->mxV2 = 0;
791 for(i2=0; aC2[i2] || aC2[i2+1] || aC2[i2+2]; i2+=3){
792 p->mxV2 += aC2[i2] + aC2[i2+2];
793 }
794 limit2 = i2;
795
796 /* Output header text and do any other required initialization */
797 p->xStart(p);
 
 
 
 
 
 
798
799 /* Loop over the two edit vectors and use them to compute merged text
800 ** which is written into pOut. i1 and i2 are multiples of 3 which are
801 ** indices into aC1[] and aC2[] to the edit triple currently being
802 ** processed
803 */
804 i1 = i2 = 0;
 
805 while( i1<limit1 && i2<limit2 ){
 
 
 
 
806 if( aC1[i1]>0 && aC2[i2]>0 ){
807 /* Output text that is unchanged in both V1 and V2 */
808 nCpy = min(aC1[i1], aC2[i2]);
809 p->xSame(p, nCpy);
 
 
 
810 aC1[i1] -= nCpy;
811 aC2[i2] -= nCpy;
812 }else
813 if( aC1[i1] >= aC2[i2+1] && aC1[i1]>0 && aC2[i2+1]+aC2[i2+2]>0 ){
814 /* Output edits to V2 that occurs within unchanged regions of V1 */
815 nDel = aC2[i2+1];
816 nIns = aC2[i2+2];
817 p->xChngV2(p, nDel, nIns);
 
 
 
818 aC1[i1] -= nDel;
819 i2 += 3;
820 }else
821 if( aC2[i2] >= aC1[i1+1] && aC2[i2]>0 && aC1[i1+1]+aC1[i1+2]>0 ){
822 /* Output edits to V1 that occur within unchanged regions of V2 */
823 nDel = aC1[i1+1];
824 nIns = aC1[i1+2];
825 p->xChngV1(p, nDel, nIns);
 
 
 
826 aC2[i2] -= nDel;
827 i1 += 3;
828 }else
829 if( sameEdit(&aC1[i1], &aC2[i2], p->pV1, p->pV2) ){
830 /* Output edits that are identical in both V1 and V2. */
831 assert( aC1[i1]==0 );
832 nDel = aC1[i1+1];
833 nIns = aC1[i1+2];
834 p->xChngBoth(p, nDel, nIns);
 
 
 
835 i1 += 3;
836 i2 += 3;
837 }else
838 {
839 /* We have found a region where different edits to V1 and V2 overlap.
840 ** This is a merge conflict. Find the size of the conflict, then
841 ** output both possible edits separated by distinctive marks.
842 */
843 unsigned int sz = 1; /* Size of the conflict in the pivot, in lines */
844 unsigned int nV1, nV2; /* Size of conflict in V1 and V2, in lines */
845 nConflict++;
846 while( !ends_with_copy(&aC1[i1], sz) || !ends_with_copy(&aC2[i2], sz) ){
847 sz++;
848 }
849 i1 = skip_conflict(aC1, i1, sz, &nV1);
850 i2 = skip_conflict(aC2, i2, sz, &nV2);
851 p->xConflict(p, sz, nV1, nV2);
852 }
853
 
 
 
 
 
 
 
 
 
854 /* If we are finished with an edit triple, advance to the next
855 ** triple.
856 */
857 if( i1<limit1 && aC1[i1]==0 && aC1[i1+1]==0 && aC1[i1+2]==0 ) i1+=3;
858 if( i2<limit2 && aC2[i2]==0 && aC2[i2+1]==0 && aC2[i2+2]==0 ) i2+=3;
@@ -356,20 +860,18 @@
860
861 /* When one of the two edit vectors reaches its end, there might still
862 ** be an insert in the other edit vector. Output this remaining
863 ** insert.
864 */
 
 
 
865 if( i1<limit1 && aC1[i1+2]>0 ){
866 p->xChngV1(p, 0, aC1[i1+2]);
 
867 }else if( i2<limit2 && aC2[i2+2]>0 ){
868 p->xChngV2(p, 0, aC2[i2+2]);
 
869 }
870
871 /* Output footer text */
872 p->xEnd(p);
873
874 free(aC1);
875 free(aC2);
876 return nConflict;
877 }
@@ -384,11 +886,12 @@
886 const char *z = blob_buffer(p);
887 int n = blob_size(p) - len + 1;
888 assert( len==(int)strlen(mergeMarker[1]) );
889 assert( len==(int)strlen(mergeMarker[2]) );
890 assert( len==(int)strlen(mergeMarker[3]) );
891 assert( len==(int)strlen(mergeMarker[4]) );
892 assert( count(mergeMarker)==5 );
893 for(i=0; i<n; ){
894 for(j=0; j<4; j++){
895 if( (memcmp(&z[i], mergeMarker[j], len)==0) ){
896 return 1;
897 }
@@ -408,18 +911,106 @@
911 blob_read_from_file(&file, zFullpath, ExtFILE);
912 rc = contains_merge_marker(&file);
913 blob_reset(&file);
914 return rc;
915 }
916
917 /*
918 ** Show merge output in a Tcl/Tk window, in response to the --tk option
919 ** to the "merge" or "3-way-merge" command.
920 **
921 ** If fossil has direct access to a Tcl interpreter (either loaded
922 ** dynamically through stubs or linked in statically), we can use it
923 ** directly. Otherwise:
924 ** (1) Write the Tcl/Tk script used for rendering into a temp file.
925 ** (2) Invoke "tclsh" on the temp file using fossil_system().
926 ** (3) Delete the temp file.
927 */
928 void merge_tk(const char *zSubCmd, int firstArg){
929 int i;
930 Blob script;
931 const char *zTempFile = 0;
932 char *zCmd;
933 const char *zTclsh;
934 const char *zCnt;
935 int bDarkMode = find_option("dark",0,0)!=0;
936 int nContext;
937 zCnt = find_option("context", "c", 1);
938 if( zCnt==0 ){
939 nContext = 6;
940 }else{
941 nContext = atoi(zCnt);
942 if( nContext<0 ) nContext = 0xfffffff;
943 }
944 blob_zero(&script);
945 blob_appendf(&script, "set ncontext %d\n", nContext);
946 blob_appendf(&script, "set fossilcmd {| \"%/\" %s -tcl",
947 g.nameOfExe, zSubCmd);
948 find_option("tcl",0,0);
949 find_option("debug",0,0);
950 zTclsh = find_option("tclsh",0,1);
951 if( zTclsh==0 ){
952 zTclsh = db_get("tclsh",0);
953 }
954 /* The undocumented --script FILENAME option causes the Tk script to
955 ** be written into the FILENAME instead of being run. This is used
956 ** for testing and debugging. */
957 zTempFile = find_option("script",0,1);
958 verify_all_options();
959
960 if( (g.argc - firstArg)!=3 ){
961 fossil_fatal("Requires 3 filename arguments");
962 }
963
964 for(i=firstArg; i<g.argc; i++){
965 const char *z = g.argv[i];
966 if( sqlite3_strglob("*}*",z) ){
967 blob_appendf(&script, " {%/}", z);
968 }else{
969 int j;
970 blob_append(&script, " ", 1);
971 for(j=0; z[j]; j++) blob_appendf(&script, "\\%03o", (unsigned char)z[j]);
972 }
973 }
974 blob_appendf(&script, "}\nset darkmode %d\n", bDarkMode);
975 blob_appendf(&script, "%s", builtin_file("merge.tcl", 0));
976 if( zTempFile ){
977 blob_write_to_file(&script, zTempFile);
978 fossil_print("To see the merge, run: %s \"%s\"\n", zTclsh, zTempFile);
979 }else{
980 #if defined(FOSSIL_ENABLE_TCL)
981 Th_FossilInit(TH_INIT_DEFAULT);
982 if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script),
983 blob_size(&script), 1, 1, 0)==TCL_OK ){
984 blob_reset(&script);
985 return;
986 }
987 /*
988 * If evaluation of the Tcl script fails, the reason may be that Tk
989 * could not be found by the loaded Tcl, or that Tcl cannot be loaded
990 * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback
991 * to using the external "tclsh", if available.
992 */
993 #endif
994 zTempFile = write_blob_to_temp_file(&script);
995 zCmd = mprintf("%$ %$", zTclsh, zTempFile);
996 fossil_system(zCmd);
997 file_delete(zTempFile);
998 fossil_free(zCmd);
999 }
1000 blob_reset(&script);
1001 }
1002
1003
1004 /*
1005 ** COMMAND: 3-way-merge*
1006 **
1007 ** Usage: %fossil 3-way-merge BASELINE V1 V2 [MERGED]
1008 **
1009 ** Inputs are files BASELINE, V1, and V2. The file MERGED is generated
1010 ** as output. If no MERGED file is specified, output is sent to
1011 ** stdout.
1012 **
1013 ** BASELINE is a common ancestor of two files V1 and V2 that have diverging
1014 ** edits. The generated output file MERGED is the combination of all
1015 ** changes in both V1 and V2.
1016 **
@@ -436,38 +1027,75 @@
1027 ** cp Xup.c Xbase.c
1028 ** # Verify that everything still works
1029 ** fossil commit
1030 **
1031 */
1032 void merge_3way_cmd(void){
1033 MergeBuilder s;
1034 int nConflict;
1035 Blob pivot, v1, v2, out;
1036 int noWarn = 0;
1037 const char *zCnt;
1038
1039 if( find_option("tk", 0, 0)!=0 ){
1040 merge_tk("3-way-merge", 2);
1041 return;
1042 }
1043 mergebuilder_init_text(&s);
1044 if( find_option("debug", 0, 0) ){
1045 mergebuilder_init(&s);
1046 }
1047 if( find_option("tcl", 0, 0) ){
1048 mergebuilder_init_tcl(&s);
1049 noWarn = 1;
1050 }
1051 zCnt = find_option("context", "c", 1);
1052 if( zCnt ){
1053 s.nContext = atoi(zCnt);
1054 if( s.nContext<0 ) s.nContext = 0xfffffff;
1055 }else{
1056 s.nContext = 6;
1057 }
1058 blob_zero(&pivot); s.pPivot = &pivot;
1059 blob_zero(&v1); s.pV1 = &v1;
1060 blob_zero(&v2); s.pV2 = &v2;
1061 blob_zero(&out); s.pOut = &out;
1062
1063 /* We should be done with options.. */
1064 verify_all_options();
1065
1066 if( g.argc!=6 && g.argc!=5 ){
1067 usage("[OPTIONS] PIVOT V1 V2 [MERGED]");
1068 }
1069 s.zPivot = file_tail(g.argv[2]);
1070 s.zV1 = file_tail(g.argv[3]);
1071 s.zV2 = file_tail(g.argv[4]);
1072 if( blob_read_from_file(s.pPivot, g.argv[2], ExtFILE)<0 ){
1073 fossil_fatal("cannot read %s", g.argv[2]);
1074 }
1075 if( blob_read_from_file(s.pV1, g.argv[3], ExtFILE)<0 ){
1076 fossil_fatal("cannot read %s", g.argv[3]);
1077 }
1078 if( blob_read_from_file(s.pV2, g.argv[4], ExtFILE)<0 ){
1079 fossil_fatal("cannot read %s", g.argv[4]);
1080 }
1081 nConflict = merge_three_blobs(&s);
1082 if( g.argc==6 ){
1083 s.zOut = file_tail(g.argv[5]);
1084 blob_write_to_file(s.pOut, g.argv[5]);
1085 }else{
1086 s.zOut = "(Merge Result)";
1087 blob_write_to_file(s.pOut, "-");
1088 }
1089 s.xDestroy(&s);
1090 blob_reset(&pivot);
1091 blob_reset(&v1);
1092 blob_reset(&v2);
1093 blob_reset(&out);
1094 if( nConflict>0 && !noWarn ){
1095 fossil_warning("WARNING: %d merge conflicts", nConflict);
1096 }
1097 }
1098
1099 /*
1100 ** aSubst is an array of string pairs. The first element of each pair is
1101 ** a string that begins with %. The second element is a replacement for that
@@ -505,32 +1133,32 @@
1133
1134 #if INTERFACE
1135 /*
1136 ** Flags to the 3-way merger
1137 */
1138 #define MERGE_DRYRUN 0x0001
1139 /*
1140 ** The MERGE_KEEP_FILES flag specifies that merge_3way() should retain
1141 ** its temporary files on error. By default they are removed after the
1142 ** merge, regardless of success or failure.
1143 */
1144 #define MERGE_KEEP_FILES 0x0002
1145 #endif
1146
1147
1148 /*
1149 ** This routine is a wrapper around merge_three_blobs() with the following
1150 ** enhancements:
1151 **
1152 ** (1) If the merge-command is defined, then use the external merging
1153 ** program specified instead of the built-in blob-merge to do the
1154 ** merging. Panic if the external merger fails.
1155 ** ** Not currently implemented **
1156 **
1157 ** (2) If gmerge-command is defined and there are merge conflicts in
1158 ** merge_three_blobs() then invoke the external graphical merger
1159 ** to resolve the conflicts.
1160 **
1161 ** (3) If a merge conflict occurs and gmerge-command is not defined,
1162 ** then write the pivot, original, and merge-in files to the
1163 ** filesystem.
1164 */
@@ -539,30 +1167,37 @@
1167 const char *zV1, /* Name of file for version merging into (mine) */
1168 Blob *pV2, /* Version merging from (yours) */
1169 Blob *pOut, /* Output written here */
1170 unsigned mergeFlags /* Flags that control operation */
1171 ){
1172 Blob v1; /* Content of zV1 */
1173 int rc; /* Return code of subroutines and this routine */
1174 const char *zGMerge; /* Name of the gmerge command */
1175 MergeBuilder s; /* The merge state */
1176
1177 mergebuilder_init_text(&s);
1178 s.pPivot = pPivot;
1179 s.pV1 = &v1;
1180 s.pV2 = pV2;
1181 blob_zero(pOut);
1182 s.pOut = pOut;
1183 blob_read_from_file(s.pV1, zV1, ExtFILE);
1184 rc = merge_three_blobs(&s);
1185 zGMerge = rc<=0 ? 0 : db_get("gmerge-command", 0);
1186 if( (mergeFlags & MERGE_DRYRUN)==0
1187 && ((zGMerge!=0 && zGMerge[0]!=0)
1188 || (rc!=0 && (mergeFlags & MERGE_KEEP_FILES)!=0)) ){
1189 char *zPivot; /* Name of the pivot file */
1190 char *zOrig; /* Name of the original content file */
1191 char *zOther; /* Name of the merge file */
1192
1193 zPivot = file_newname(zV1, "baseline", 1);
1194 blob_write_to_file(s.pPivot, zPivot);
1195 zOrig = file_newname(zV1, "original", 1);
1196 blob_write_to_file(s.pV1, zOrig);
1197 zOther = file_newname(zV1, "merge", 1);
1198 blob_write_to_file(s.pV2, zOther);
1199 if( rc>0 ){
1200 if( zGMerge && zGMerge[0] ){
1201 char *zOut; /* Temporary output file */
1202 char *zCmd; /* Command to invoke */
1203 const char *azSubst[8]; /* Strings to be substituted */
@@ -590,7 +1225,8 @@
1225 fossil_free(zPivot);
1226 fossil_free(zOrig);
1227 fossil_free(zOther);
1228 }
1229 blob_reset(&v1);
1230 s.xDestroy(&s);
1231 return rc;
1232 }
1233
+1
--- src/path.c
+++ src/path.c
@@ -542,10 +542,11 @@
542542
pChng = pAll;
543543
pAll = pAll->pNext;
544544
fossil_free(pChng);
545545
}
546546
}
547
+ path_reset();
547548
}
548549
549550
/*
550551
** COMMAND: test-name-changes
551552
**
552553
--- src/path.c
+++ src/path.c
@@ -542,10 +542,11 @@
542 pChng = pAll;
543 pAll = pAll->pNext;
544 fossil_free(pChng);
545 }
546 }
 
547 }
548
549 /*
550 ** COMMAND: test-name-changes
551 **
552
--- src/path.c
+++ src/path.c
@@ -542,10 +542,11 @@
542 pChng = pAll;
543 pAll = pAll->pNext;
544 fossil_free(pChng);
545 }
546 }
547 path_reset();
548 }
549
550 /*
551 ** COMMAND: test-name-changes
552 **
553
+12 -1
--- src/setup.c
+++ src/setup.c
@@ -501,13 +501,24 @@
501501
@ behavior or to find an SQL injection opportunity or similar. This can
502502
@ waste hours of CPU time and gigabytes of bandwidth on the server. A
503503
@ suggested value for this setting is:
504504
@ "<tt>timeline,*diff,vpatch,annotate,blame,praise,dir,tree</tt>".
505505
@ (Property: robot-restrict)
506
- @ <p>
506
+ @ <br>
507507
textarea_attribute("", 2, 80,
508508
"robot-restrict", "rbrestrict", "", 0);
509
+ @ <br> The following comma-separated GLOB pattern allows for exceptions
510
+ @ in the maximum number of query parameters before a request is considered
511
+ @ complex. If this GLOB pattern exists and is non-empty and if it
512
+ @ matches against the pagename followed by "/" and the number of query
513
+ @ parameters, then the request is allowed through. For example, the
514
+ @ suggested pattern of "timeline/[012]" allows the /timeline page to
515
+ @ pass with up to 2 query parameters besides "name".
516
+ @ (Property: robot-restrict-qp)
517
+ @ <br>
518
+ textarea_attribute("", 2, 80,
519
+ "robot-restrict-qp", "rbrestrictqp", "", 0);
509520
510521
@ <hr>
511522
@ <p><input type="submit" name="submit" value="Apply Changes"></p>
512523
@ </div></form>
513524
db_end_transaction(0);
514525
--- src/setup.c
+++ src/setup.c
@@ -501,13 +501,24 @@
501 @ behavior or to find an SQL injection opportunity or similar. This can
502 @ waste hours of CPU time and gigabytes of bandwidth on the server. A
503 @ suggested value for this setting is:
504 @ "<tt>timeline,*diff,vpatch,annotate,blame,praise,dir,tree</tt>".
505 @ (Property: robot-restrict)
506 @ <p>
507 textarea_attribute("", 2, 80,
508 "robot-restrict", "rbrestrict", "", 0);
 
 
 
 
 
 
 
 
 
 
 
509
510 @ <hr>
511 @ <p><input type="submit" name="submit" value="Apply Changes"></p>
512 @ </div></form>
513 db_end_transaction(0);
514
--- src/setup.c
+++ src/setup.c
@@ -501,13 +501,24 @@
501 @ behavior or to find an SQL injection opportunity or similar. This can
502 @ waste hours of CPU time and gigabytes of bandwidth on the server. A
503 @ suggested value for this setting is:
504 @ "<tt>timeline,*diff,vpatch,annotate,blame,praise,dir,tree</tt>".
505 @ (Property: robot-restrict)
506 @ <br>
507 textarea_attribute("", 2, 80,
508 "robot-restrict", "rbrestrict", "", 0);
509 @ <br> The following comma-separated GLOB pattern allows for exceptions
510 @ in the maximum number of query parameters before a request is considered
511 @ complex. If this GLOB pattern exists and is non-empty and if it
512 @ matches against the pagename followed by "/" and the number of query
513 @ parameters, then the request is allowed through. For example, the
514 @ suggested pattern of "timeline/[012]" allows the /timeline page to
515 @ pass with up to 2 query parameters besides "name".
516 @ (Property: robot-restrict-qp)
517 @ <br>
518 textarea_attribute("", 2, 80,
519 "robot-restrict-qp", "rbrestrictqp", "", 0);
520
521 @ <hr>
522 @ <p><input type="submit" name="submit" value="Apply Changes"></p>
523 @ </div></form>
524 db_end_transaction(0);
525
+7 -5
--- src/setupuser.c
+++ src/setupuser.c
@@ -115,11 +115,11 @@
115115
}
116116
if( !bUnusedOnly ){
117117
style_submenu_element("Unused", "setup_ulist?unused");
118118
}
119119
@ <table border=1 cellpadding=2 cellspacing=0 class='userTable sortable' \
120
- @ data-column-types='ktxTTKt' data-init-sort='2'>
120
+ @ data-column-types='ktxKTKt' data-init-sort='4'>
121121
@ <thead><tr>
122122
@ <th>Login Name<th>Caps<th>Info<th>Date<th>Expire<th>Last Login\
123123
@ <th>Alerts</tr></thead>
124124
@ <tbody>
125125
db_multi_exec(
@@ -161,15 +161,16 @@
161161
" lower(login) AS sortkey, "
162162
" CASE WHEN info LIKE '%%expires 20%%'"
163163
" THEN substr(info,instr(lower(info),'expires')+8,10)"
164164
" END AS exp,"
165165
"atime,"
166
- " subscriber.ssub, subscriber.subscriberId"
166
+ " subscriber.ssub, subscriber.subscriberId,"
167
+ " user.mtime AS sorttime"
167168
" FROM user LEFT JOIN lastAccess ON login=uname"
168169
" LEFT JOIN subscriber ON login=suname"
169170
" WHERE login NOT IN ('anonymous','nobody','developer','reader') %s"
170
- " ORDER BY sortkey", zWith/*safe-for-%s*/
171
+ " ORDER BY sorttime DESC", zWith/*safe-for-%s*/
171172
);
172173
rNow = db_double(0.0, "SELECT julianday('now');");
173174
while( db_step(&s)==SQLITE_ROW ){
174175
int uid = db_column_int(&s, 0);
175176
const char *zLogin = db_column_text(&s, 1);
@@ -180,10 +181,11 @@
180181
const char *zExp = db_column_text(&s,6);
181182
double rATime = db_column_double(&s,7);
182183
char *zAge = 0;
183184
const char *zSub;
184185
int sid = db_column_int(&s,9);
186
+ sqlite3_int64 sorttime = db_column_int64(&s, 10);
185187
if( rATime>0.0 ){
186188
zAge = human_readable_age(rNow - rATime);
187189
}
188190
if( bUbg ){
189191
@ <tr style='background-color: %h(user_color(zLogin));'>
@@ -192,11 +194,11 @@
192194
}
193195
@ <td data-sortkey='%h(zSortKey)'>\
194196
@ <a href='setup_uedit?id=%d(uid)'>%h(zLogin)</a>
195197
@ <td>%h(zCap)
196198
@ <td>%h(zInfo)
197
- @ <td>%h(zDate?zDate:"")
199
+ @ <td data-sortkey='%09llx(sorttime)'>%h(zDate?zDate:"")
198200
@ <td>%h(zExp?zExp:"")
199201
@ <td data-sortkey='%f(rATime)' style='white-space:nowrap'>%s(zAge?zAge:"")
200202
if( db_column_type(&s,8)==SQLITE_NULL ){
201203
@ <td>
202204
}else if( (zSub = db_column_text(&s,8))==0 || zSub[0]==0 ){
@@ -1016,11 +1018,11 @@
10161018
style_header("User %h", db_column_text(&q,1));
10171019
@ <table class="label-value">
10181020
@ <tr><th>uid:</th><td>%d(db_column_int(&q,0))
10191021
@ (<a href="%R/setup_uedit?id=%d(db_column_int(&q,0))">edit</a>)</td></tr>
10201022
@ <tr><th>login:</th><td>%h(db_column_text(&q,1))</td></tr>
1021
- @ <tr><th>capabilities:</th><td>%h(db_column_text(&q,2))</th></tr>
1023
+ @ <tr><th>capabilities:</th><td>%h(db_column_text(&q,2))</td></tr>
10221024
@ <tr><th valign="top">info:</th>
10231025
@ <td valign="top"><span style='white-space:pre-line;'>\
10241026
@ %h(db_column_text(&q,5))</span></td></tr>
10251027
@ <tr><th>user.mtime:</th><td>%h(db_column_text(&q,6))</td></tr>
10261028
if( db_column_type(&q,7)!=SQLITE_NULL ){
10271029
--- src/setupuser.c
+++ src/setupuser.c
@@ -115,11 +115,11 @@
115 }
116 if( !bUnusedOnly ){
117 style_submenu_element("Unused", "setup_ulist?unused");
118 }
119 @ <table border=1 cellpadding=2 cellspacing=0 class='userTable sortable' \
120 @ data-column-types='ktxTTKt' data-init-sort='2'>
121 @ <thead><tr>
122 @ <th>Login Name<th>Caps<th>Info<th>Date<th>Expire<th>Last Login\
123 @ <th>Alerts</tr></thead>
124 @ <tbody>
125 db_multi_exec(
@@ -161,15 +161,16 @@
161 " lower(login) AS sortkey, "
162 " CASE WHEN info LIKE '%%expires 20%%'"
163 " THEN substr(info,instr(lower(info),'expires')+8,10)"
164 " END AS exp,"
165 "atime,"
166 " subscriber.ssub, subscriber.subscriberId"
 
167 " FROM user LEFT JOIN lastAccess ON login=uname"
168 " LEFT JOIN subscriber ON login=suname"
169 " WHERE login NOT IN ('anonymous','nobody','developer','reader') %s"
170 " ORDER BY sortkey", zWith/*safe-for-%s*/
171 );
172 rNow = db_double(0.0, "SELECT julianday('now');");
173 while( db_step(&s)==SQLITE_ROW ){
174 int uid = db_column_int(&s, 0);
175 const char *zLogin = db_column_text(&s, 1);
@@ -180,10 +181,11 @@
180 const char *zExp = db_column_text(&s,6);
181 double rATime = db_column_double(&s,7);
182 char *zAge = 0;
183 const char *zSub;
184 int sid = db_column_int(&s,9);
 
185 if( rATime>0.0 ){
186 zAge = human_readable_age(rNow - rATime);
187 }
188 if( bUbg ){
189 @ <tr style='background-color: %h(user_color(zLogin));'>
@@ -192,11 +194,11 @@
192 }
193 @ <td data-sortkey='%h(zSortKey)'>\
194 @ <a href='setup_uedit?id=%d(uid)'>%h(zLogin)</a>
195 @ <td>%h(zCap)
196 @ <td>%h(zInfo)
197 @ <td>%h(zDate?zDate:"")
198 @ <td>%h(zExp?zExp:"")
199 @ <td data-sortkey='%f(rATime)' style='white-space:nowrap'>%s(zAge?zAge:"")
200 if( db_column_type(&s,8)==SQLITE_NULL ){
201 @ <td>
202 }else if( (zSub = db_column_text(&s,8))==0 || zSub[0]==0 ){
@@ -1016,11 +1018,11 @@
1016 style_header("User %h", db_column_text(&q,1));
1017 @ <table class="label-value">
1018 @ <tr><th>uid:</th><td>%d(db_column_int(&q,0))
1019 @ (<a href="%R/setup_uedit?id=%d(db_column_int(&q,0))">edit</a>)</td></tr>
1020 @ <tr><th>login:</th><td>%h(db_column_text(&q,1))</td></tr>
1021 @ <tr><th>capabilities:</th><td>%h(db_column_text(&q,2))</th></tr>
1022 @ <tr><th valign="top">info:</th>
1023 @ <td valign="top"><span style='white-space:pre-line;'>\
1024 @ %h(db_column_text(&q,5))</span></td></tr>
1025 @ <tr><th>user.mtime:</th><td>%h(db_column_text(&q,6))</td></tr>
1026 if( db_column_type(&q,7)!=SQLITE_NULL ){
1027
--- src/setupuser.c
+++ src/setupuser.c
@@ -115,11 +115,11 @@
115 }
116 if( !bUnusedOnly ){
117 style_submenu_element("Unused", "setup_ulist?unused");
118 }
119 @ <table border=1 cellpadding=2 cellspacing=0 class='userTable sortable' \
120 @ data-column-types='ktxKTKt' data-init-sort='4'>
121 @ <thead><tr>
122 @ <th>Login Name<th>Caps<th>Info<th>Date<th>Expire<th>Last Login\
123 @ <th>Alerts</tr></thead>
124 @ <tbody>
125 db_multi_exec(
@@ -161,15 +161,16 @@
161 " lower(login) AS sortkey, "
162 " CASE WHEN info LIKE '%%expires 20%%'"
163 " THEN substr(info,instr(lower(info),'expires')+8,10)"
164 " END AS exp,"
165 "atime,"
166 " subscriber.ssub, subscriber.subscriberId,"
167 " user.mtime AS sorttime"
168 " FROM user LEFT JOIN lastAccess ON login=uname"
169 " LEFT JOIN subscriber ON login=suname"
170 " WHERE login NOT IN ('anonymous','nobody','developer','reader') %s"
171 " ORDER BY sorttime DESC", zWith/*safe-for-%s*/
172 );
173 rNow = db_double(0.0, "SELECT julianday('now');");
174 while( db_step(&s)==SQLITE_ROW ){
175 int uid = db_column_int(&s, 0);
176 const char *zLogin = db_column_text(&s, 1);
@@ -180,10 +181,11 @@
181 const char *zExp = db_column_text(&s,6);
182 double rATime = db_column_double(&s,7);
183 char *zAge = 0;
184 const char *zSub;
185 int sid = db_column_int(&s,9);
186 sqlite3_int64 sorttime = db_column_int64(&s, 10);
187 if( rATime>0.0 ){
188 zAge = human_readable_age(rNow - rATime);
189 }
190 if( bUbg ){
191 @ <tr style='background-color: %h(user_color(zLogin));'>
@@ -192,11 +194,11 @@
194 }
195 @ <td data-sortkey='%h(zSortKey)'>\
196 @ <a href='setup_uedit?id=%d(uid)'>%h(zLogin)</a>
197 @ <td>%h(zCap)
198 @ <td>%h(zInfo)
199 @ <td data-sortkey='%09llx(sorttime)'>%h(zDate?zDate:"")
200 @ <td>%h(zExp?zExp:"")
201 @ <td data-sortkey='%f(rATime)' style='white-space:nowrap'>%s(zAge?zAge:"")
202 if( db_column_type(&s,8)==SQLITE_NULL ){
203 @ <td>
204 }else if( (zSub = db_column_text(&s,8))==0 || zSub[0]==0 ){
@@ -1016,11 +1018,11 @@
1018 style_header("User %h", db_column_text(&q,1));
1019 @ <table class="label-value">
1020 @ <tr><th>uid:</th><td>%d(db_column_int(&q,0))
1021 @ (<a href="%R/setup_uedit?id=%d(db_column_int(&q,0))">edit</a>)</td></tr>
1022 @ <tr><th>login:</th><td>%h(db_column_text(&q,1))</td></tr>
1023 @ <tr><th>capabilities:</th><td>%h(db_column_text(&q,2))</td></tr>
1024 @ <tr><th valign="top">info:</th>
1025 @ <td valign="top"><span style='white-space:pre-line;'>\
1026 @ %h(db_column_text(&q,5))</span></td></tr>
1027 @ <tr><th>user.mtime:</th><td>%h(db_column_text(&q,6))</td></tr>
1028 if( db_column_type(&q,7)!=SQLITE_NULL ){
1029
+2 -1
--- src/sitemap.c
+++ src/sitemap.c
@@ -192,11 +192,12 @@
192192
}
193193
if( g.perm.Chat ){
194194
@ <li>%z(href("%R/chat"))Chat</a></li>
195195
}
196196
if( g.perm.RdForum ){
197
- @ <li>%z(href("%R/forum"))Forum</a>
197
+ const char *zTitle = db_get("forum-title","Forum");
198
+ @ <li>%z(href("%R/forum"))%h(zTitle)</a>
198199
@ <ul>
199200
@ <li>%z(href("%R/timeline?y=f"))Recent activity</a></li>
200201
@ </ul>
201202
@ </li>
202203
}
203204
--- src/sitemap.c
+++ src/sitemap.c
@@ -192,11 +192,12 @@
192 }
193 if( g.perm.Chat ){
194 @ <li>%z(href("%R/chat"))Chat</a></li>
195 }
196 if( g.perm.RdForum ){
197 @ <li>%z(href("%R/forum"))Forum</a>
 
198 @ <ul>
199 @ <li>%z(href("%R/timeline?y=f"))Recent activity</a></li>
200 @ </ul>
201 @ </li>
202 }
203
--- src/sitemap.c
+++ src/sitemap.c
@@ -192,11 +192,12 @@
192 }
193 if( g.perm.Chat ){
194 @ <li>%z(href("%R/chat"))Chat</a></li>
195 }
196 if( g.perm.RdForum ){
197 const char *zTitle = db_get("forum-title","Forum");
198 @ <li>%z(href("%R/forum"))%h(zTitle)</a>
199 @ <ul>
200 @ <li>%z(href("%R/timeline?y=f"))Recent activity</a></li>
201 @ </ul>
202 @ </li>
203 }
204
+2 -1
--- src/timeline.c
+++ src/timeline.c
@@ -1863,10 +1863,11 @@
18631863
char *zPlural; /* Ending for plural forms */
18641864
int showCherrypicks = 1; /* True to show cherrypick merges */
18651865
int haveParameterN; /* True if n= query parameter present */
18661866
int from_to_mode = 0; /* 0: from,to. 1: from,ft 2: from,bt */
18671867
1868
+ login_check_credentials();
18681869
url_initialize(&url, "timeline");
18691870
cgi_query_parameters_to_url(&url);
18701871
18711872
(void)P_NoBot("ss")
18721873
/* "ss" is processed via the udc but at least one spider likes to
@@ -1943,11 +1944,10 @@
19431944
*/
19441945
pd_rid = name_choice("dp","dp2",&zDPName);
19451946
if( pd_rid ){
19461947
p_rid = d_rid = pd_rid;
19471948
}
1948
- login_check_credentials();
19491949
if( (!g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki && !g.perm.RdForum)
19501950
|| (bisectLocal && !g.perm.Setup)
19511951
){
19521952
login_needed(g.anon.Read && g.anon.RdTkt && g.anon.RdWiki);
19531953
return;
@@ -1990,10 +1990,11 @@
19901990
zTagName = z;
19911991
zMatchStyle = "brlist";
19921992
}
19931993
if( (z = P("rl"))!=0 ){
19941994
zBrName = z;
1995
+ related = 1;
19951996
zMatchStyle = "brlist";
19961997
}
19971998
}
19981999
19992000
/* Convert r=TAG to t=TAG&rel in order to populate the UI style widgets. */
20002001
--- src/timeline.c
+++ src/timeline.c
@@ -1863,10 +1863,11 @@
1863 char *zPlural; /* Ending for plural forms */
1864 int showCherrypicks = 1; /* True to show cherrypick merges */
1865 int haveParameterN; /* True if n= query parameter present */
1866 int from_to_mode = 0; /* 0: from,to. 1: from,ft 2: from,bt */
1867
 
1868 url_initialize(&url, "timeline");
1869 cgi_query_parameters_to_url(&url);
1870
1871 (void)P_NoBot("ss")
1872 /* "ss" is processed via the udc but at least one spider likes to
@@ -1943,11 +1944,10 @@
1943 */
1944 pd_rid = name_choice("dp","dp2",&zDPName);
1945 if( pd_rid ){
1946 p_rid = d_rid = pd_rid;
1947 }
1948 login_check_credentials();
1949 if( (!g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki && !g.perm.RdForum)
1950 || (bisectLocal && !g.perm.Setup)
1951 ){
1952 login_needed(g.anon.Read && g.anon.RdTkt && g.anon.RdWiki);
1953 return;
@@ -1990,10 +1990,11 @@
1990 zTagName = z;
1991 zMatchStyle = "brlist";
1992 }
1993 if( (z = P("rl"))!=0 ){
1994 zBrName = z;
 
1995 zMatchStyle = "brlist";
1996 }
1997 }
1998
1999 /* Convert r=TAG to t=TAG&rel in order to populate the UI style widgets. */
2000
--- src/timeline.c
+++ src/timeline.c
@@ -1863,10 +1863,11 @@
1863 char *zPlural; /* Ending for plural forms */
1864 int showCherrypicks = 1; /* True to show cherrypick merges */
1865 int haveParameterN; /* True if n= query parameter present */
1866 int from_to_mode = 0; /* 0: from,to. 1: from,ft 2: from,bt */
1867
1868 login_check_credentials();
1869 url_initialize(&url, "timeline");
1870 cgi_query_parameters_to_url(&url);
1871
1872 (void)P_NoBot("ss")
1873 /* "ss" is processed via the udc but at least one spider likes to
@@ -1943,11 +1944,10 @@
1944 */
1945 pd_rid = name_choice("dp","dp2",&zDPName);
1946 if( pd_rid ){
1947 p_rid = d_rid = pd_rid;
1948 }
 
1949 if( (!g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki && !g.perm.RdForum)
1950 || (bisectLocal && !g.perm.Setup)
1951 ){
1952 login_needed(g.anon.Read && g.anon.RdTkt && g.anon.RdWiki);
1953 return;
@@ -1990,10 +1990,11 @@
1990 zTagName = z;
1991 zMatchStyle = "brlist";
1992 }
1993 if( (z = P("rl"))!=0 ){
1994 zBrName = z;
1995 related = 1;
1996 zMatchStyle = "brlist";
1997 }
1998 }
1999
2000 /* Convert r=TAG to t=TAG&rel in order to populate the UI style widgets. */
2001
+1 -1
--- src/tkt.c
+++ src/tkt.c
@@ -781,11 +781,11 @@
781781
782782
zFullName = db_text(0,
783783
"SELECT tkt_uuid FROM ticket"
784784
" WHERE tkt_uuid GLOB '%q*'", zUuid);
785785
if( zFullName ){
786
- attachment_list(zFullName, "<hr><h2>Attachments:</h2><ul>");
786
+ attachment_list(zFullName, "<h2>Attachments:</h2>", 1);
787787
}
788788
789789
style_finish_page();
790790
}
791791
792792
--- src/tkt.c
+++ src/tkt.c
@@ -781,11 +781,11 @@
781
782 zFullName = db_text(0,
783 "SELECT tkt_uuid FROM ticket"
784 " WHERE tkt_uuid GLOB '%q*'", zUuid);
785 if( zFullName ){
786 attachment_list(zFullName, "<hr><h2>Attachments:</h2><ul>");
787 }
788
789 style_finish_page();
790 }
791
792
--- src/tkt.c
+++ src/tkt.c
@@ -781,11 +781,11 @@
781
782 zFullName = db_text(0,
783 "SELECT tkt_uuid FROM ticket"
784 " WHERE tkt_uuid GLOB '%q*'", zUuid);
785 if( zFullName ){
786 attachment_list(zFullName, "<h2>Attachments:</h2>", 1);
787 }
788
789 style_finish_page();
790 }
791
792
+12 -3
--- src/update.c
+++ src/update.c
@@ -132,10 +132,13 @@
132132
int nUpdate = 0; /* Number of changes of any kind */
133133
int bNosync = 0; /* --nosync. Omit the auto-sync */
134134
int width; /* Width of printed comment lines */
135135
Stmt mtimeXfer; /* Statement to transfer mtimes */
136136
const char *zWidth; /* Width option string value */
137
+ const char *zCurBrName; /* Current branch name */
138
+ const char *zNewBrName; /* New branch name */
139
+ const char *zBrChgMsg = ""; /* Message to display if branch changes */
137140
138141
if( !internalUpdate ){
139142
undo_capture_command_line();
140143
url_proxy_options();
141144
}
@@ -163,10 +166,11 @@
163166
/* We should be done with options.. */
164167
verify_all_options();
165168
166169
db_must_be_within_tree();
167170
vid = db_lget_int("checkout", 0);
171
+ zCurBrName = branch_of_rid(vid);
168172
user_select();
169173
if( !dryRunFlag && !internalUpdate && !bNosync ){
170174
if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag, 1, "update") ){
171175
fossil_fatal("update abandoned due to sync failure");
172176
}
@@ -563,20 +567,25 @@
563567
free(zFullNewPath);
564568
}
565569
db_finalize(&q);
566570
db_finalize(&mtimeXfer);
567571
fossil_print("%.79c\n",'-');
572
+ zNewBrName = branch_of_rid(tid);
573
+ if( g.argc<3 && fossil_strcmp(zCurBrName, zNewBrName)!=0 ){
574
+ zBrChgMsg = mprintf(" Branch changed from %s to %s.",
575
+ zCurBrName, zNewBrName);
576
+ }
568577
if( nUpdate==0 ){
569578
show_common_info(tid, "checkout:", 1, 0);
570
- fossil_print("%-13s None. Already up-to-date\n", "changes:");
579
+ fossil_print("%-13s None. Already up-to-date.%s\n", "changes:", zBrChgMsg);
571580
}else{
572581
fossil_print("%-13s %.40s %s\n", "updated-from:", rid_to_uuid(vid),
573582
db_text("", "SELECT datetime(mtime) || ' UTC' FROM event "
574583
" WHERE objid=%d", vid));
575584
show_common_info(tid, "updated-to:", 1, 0);
576
- fossil_print("%-13s %d file%s modified.\n", "changes:",
577
- nUpdate, nUpdate>1 ? "s" : "");
585
+ fossil_print("%-13s %d file%s modified.%s\n", "changes:",
586
+ nUpdate, nUpdate>1 ? "s" : "", zBrChgMsg);
578587
}
579588
580589
/* Report on conflicts
581590
*/
582591
if( !dryRunFlag ){
583592
--- src/update.c
+++ src/update.c
@@ -132,10 +132,13 @@
132 int nUpdate = 0; /* Number of changes of any kind */
133 int bNosync = 0; /* --nosync. Omit the auto-sync */
134 int width; /* Width of printed comment lines */
135 Stmt mtimeXfer; /* Statement to transfer mtimes */
136 const char *zWidth; /* Width option string value */
 
 
 
137
138 if( !internalUpdate ){
139 undo_capture_command_line();
140 url_proxy_options();
141 }
@@ -163,10 +166,11 @@
163 /* We should be done with options.. */
164 verify_all_options();
165
166 db_must_be_within_tree();
167 vid = db_lget_int("checkout", 0);
 
168 user_select();
169 if( !dryRunFlag && !internalUpdate && !bNosync ){
170 if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag, 1, "update") ){
171 fossil_fatal("update abandoned due to sync failure");
172 }
@@ -563,20 +567,25 @@
563 free(zFullNewPath);
564 }
565 db_finalize(&q);
566 db_finalize(&mtimeXfer);
567 fossil_print("%.79c\n",'-');
 
 
 
 
 
568 if( nUpdate==0 ){
569 show_common_info(tid, "checkout:", 1, 0);
570 fossil_print("%-13s None. Already up-to-date\n", "changes:");
571 }else{
572 fossil_print("%-13s %.40s %s\n", "updated-from:", rid_to_uuid(vid),
573 db_text("", "SELECT datetime(mtime) || ' UTC' FROM event "
574 " WHERE objid=%d", vid));
575 show_common_info(tid, "updated-to:", 1, 0);
576 fossil_print("%-13s %d file%s modified.\n", "changes:",
577 nUpdate, nUpdate>1 ? "s" : "");
578 }
579
580 /* Report on conflicts
581 */
582 if( !dryRunFlag ){
583
--- src/update.c
+++ src/update.c
@@ -132,10 +132,13 @@
132 int nUpdate = 0; /* Number of changes of any kind */
133 int bNosync = 0; /* --nosync. Omit the auto-sync */
134 int width; /* Width of printed comment lines */
135 Stmt mtimeXfer; /* Statement to transfer mtimes */
136 const char *zWidth; /* Width option string value */
137 const char *zCurBrName; /* Current branch name */
138 const char *zNewBrName; /* New branch name */
139 const char *zBrChgMsg = ""; /* Message to display if branch changes */
140
141 if( !internalUpdate ){
142 undo_capture_command_line();
143 url_proxy_options();
144 }
@@ -163,10 +166,11 @@
166 /* We should be done with options.. */
167 verify_all_options();
168
169 db_must_be_within_tree();
170 vid = db_lget_int("checkout", 0);
171 zCurBrName = branch_of_rid(vid);
172 user_select();
173 if( !dryRunFlag && !internalUpdate && !bNosync ){
174 if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag, 1, "update") ){
175 fossil_fatal("update abandoned due to sync failure");
176 }
@@ -563,20 +567,25 @@
567 free(zFullNewPath);
568 }
569 db_finalize(&q);
570 db_finalize(&mtimeXfer);
571 fossil_print("%.79c\n",'-');
572 zNewBrName = branch_of_rid(tid);
573 if( g.argc<3 && fossil_strcmp(zCurBrName, zNewBrName)!=0 ){
574 zBrChgMsg = mprintf(" Branch changed from %s to %s.",
575 zCurBrName, zNewBrName);
576 }
577 if( nUpdate==0 ){
578 show_common_info(tid, "checkout:", 1, 0);
579 fossil_print("%-13s None. Already up-to-date.%s\n", "changes:", zBrChgMsg);
580 }else{
581 fossil_print("%-13s %.40s %s\n", "updated-from:", rid_to_uuid(vid),
582 db_text("", "SELECT datetime(mtime) || ' UTC' FROM event "
583 " WHERE objid=%d", vid));
584 show_common_info(tid, "updated-to:", 1, 0);
585 fossil_print("%-13s %d file%s modified.%s\n", "changes:",
586 nUpdate, nUpdate>1 ? "s" : "", zBrChgMsg);
587 }
588
589 /* Report on conflicts
590 */
591 if( !dryRunFlag ){
592
+4 -4
--- src/wiki.c
+++ src/wiki.c
@@ -622,14 +622,14 @@
622622
wiki_render_by_mimetype(&wiki, zMimetype);
623623
blob_reset(&wiki);
624624
}
625625
manifest_destroy(pWiki);
626626
if( !isPopup ){
627
- char * zLabel = mprintf("<hr><h2><a href='%R/attachlist?name=%T'>"
628
- "Attachments</a>:</h2><ul>",
627
+ char * zLabel = mprintf("<h2><a href='%R/attachlist?page=%T'>"
628
+ "Attachments</a>:</h2>",
629629
zPageName);
630
- attachment_list(zPageName, zLabel);
630
+ attachment_list(zPageName, zLabel, 1);
631631
fossil_free(zLabel);
632632
document_emit_js(/*for optional pikchr support*/);
633633
style_finish_page();
634634
}
635635
}
@@ -1331,11 +1331,11 @@
13311331
CX("<div id='fossil-status-bar' "
13321332
"title='Status message area. Double-click to clear them.'>"
13331333
"Status messages will go here.</div>\n"
13341334
/* will be moved into the tab container via JS */);
13351335
1336
- CX("<div id='wikiedit-edit-status''>"
1336
+ CX("<div id='wikiedit-edit-status'>"
13371337
"<span class='name'></span>"
13381338
"<span class='links'></span>"
13391339
"</div>");
13401340
13411341
/* Main tab container... */
13421342
--- src/wiki.c
+++ src/wiki.c
@@ -622,14 +622,14 @@
622 wiki_render_by_mimetype(&wiki, zMimetype);
623 blob_reset(&wiki);
624 }
625 manifest_destroy(pWiki);
626 if( !isPopup ){
627 char * zLabel = mprintf("<hr><h2><a href='%R/attachlist?name=%T'>"
628 "Attachments</a>:</h2><ul>",
629 zPageName);
630 attachment_list(zPageName, zLabel);
631 fossil_free(zLabel);
632 document_emit_js(/*for optional pikchr support*/);
633 style_finish_page();
634 }
635 }
@@ -1331,11 +1331,11 @@
1331 CX("<div id='fossil-status-bar' "
1332 "title='Status message area. Double-click to clear them.'>"
1333 "Status messages will go here.</div>\n"
1334 /* will be moved into the tab container via JS */);
1335
1336 CX("<div id='wikiedit-edit-status''>"
1337 "<span class='name'></span>"
1338 "<span class='links'></span>"
1339 "</div>");
1340
1341 /* Main tab container... */
1342
--- src/wiki.c
+++ src/wiki.c
@@ -622,14 +622,14 @@
622 wiki_render_by_mimetype(&wiki, zMimetype);
623 blob_reset(&wiki);
624 }
625 manifest_destroy(pWiki);
626 if( !isPopup ){
627 char * zLabel = mprintf("<h2><a href='%R/attachlist?page=%T'>"
628 "Attachments</a>:</h2>",
629 zPageName);
630 attachment_list(zPageName, zLabel, 1);
631 fossil_free(zLabel);
632 document_emit_js(/*for optional pikchr support*/);
633 style_finish_page();
634 }
635 }
@@ -1331,11 +1331,11 @@
1331 CX("<div id='fossil-status-bar' "
1332 "title='Status message area. Double-click to clear them.'>"
1333 "Status messages will go here.</div>\n"
1334 /* will be moved into the tab container via JS */);
1335
1336 CX("<div id='wikiedit-edit-status'>"
1337 "<span class='name'></span>"
1338 "<span class='links'></span>"
1339 "</div>");
1340
1341 /* Main tab container... */
1342
--- src/winfile.c
+++ src/winfile.c
@@ -451,6 +451,74 @@
451451
i = j;
452452
}
453453
fossil_free(zBuf);
454454
return zRes;
455455
}
456
+
457
+/* Return the unique identifier (UID) for a file, made up of the file identifier
458
+** (equal to "inode" for Unix-style file systems) plus the volume serial number.
459
+** Call the GetFileInformationByHandleEx() function on Windows Vista, and resort
460
+** to the GetFileInformationByHandle() function on Windows XP. The result string
461
+** is allocated by mprintf(), or NULL on failure.
462
+*/
463
+char *win32_file_id(
464
+ const char *zFileName
465
+){
466
+ static FARPROC fnGetFileInformationByHandleEx;
467
+ static int loaded_fnGetFileInformationByHandleEx;
468
+ wchar_t *wzFileName = fossil_utf8_to_path(zFileName,0);
469
+ HANDLE hFile;
470
+ char *zFileId = 0;
471
+ hFile = CreateFileW(
472
+ wzFileName,
473
+ 0,
474
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
475
+ NULL,
476
+ OPEN_EXISTING,
477
+ FILE_FLAG_BACKUP_SEMANTICS,
478
+ NULL);
479
+ if( hFile!=INVALID_HANDLE_VALUE ){
480
+ BY_HANDLE_FILE_INFORMATION fi;
481
+ struct { /* FILE_ID_INFO from <winbase.h> */
482
+ u64 VolumeSerialNumber;
483
+ unsigned char FileId[16];
484
+ } fi2;
485
+ if( !loaded_fnGetFileInformationByHandleEx ){
486
+ fnGetFileInformationByHandleEx = GetProcAddress(
487
+ GetModuleHandleA("kernel32"),"GetFileInformationByHandleEx");
488
+ loaded_fnGetFileInformationByHandleEx = 1;
489
+ }
490
+ if( fnGetFileInformationByHandleEx ){
491
+ if( fnGetFileInformationByHandleEx(
492
+ hFile,/*FileIdInfo*/0x12,&fi2,sizeof(fi2)) ){
493
+ zFileId = mprintf(
494
+ "%016llx/"
495
+ "%02x%02x%02x%02x%02x%02x%02x%02x"
496
+ "%02x%02x%02x%02x%02x%02x%02x%02x",
497
+ fi2.VolumeSerialNumber,
498
+ fi2.FileId[15], fi2.FileId[14],
499
+ fi2.FileId[13], fi2.FileId[12],
500
+ fi2.FileId[11], fi2.FileId[10],
501
+ fi2.FileId[9], fi2.FileId[8],
502
+ fi2.FileId[7], fi2.FileId[6],
503
+ fi2.FileId[5], fi2.FileId[4],
504
+ fi2.FileId[3], fi2.FileId[2],
505
+ fi2.FileId[1], fi2.FileId[0]);
506
+ }
507
+ }
508
+ if( zFileId==0 ){
509
+ if( GetFileInformationByHandle(hFile,&fi) ){
510
+ ULARGE_INTEGER FileId = {
511
+ /*.LowPart = */ fi.nFileIndexLow,
512
+ /*.HighPart = */ fi.nFileIndexHigh
513
+ };
514
+ zFileId = mprintf(
515
+ "%08x/%016llx",
516
+ fi.dwVolumeSerialNumber,(u64)FileId.QuadPart);
517
+ }
518
+ }
519
+ CloseHandle(hFile);
520
+ }
521
+ fossil_path_free(wzFileName);
522
+ return zFileId;
523
+}
456524
#endif /* _WIN32 -- This code is for win32 only */
457525
--- src/winfile.c
+++ src/winfile.c
@@ -451,6 +451,74 @@
451 i = j;
452 }
453 fossil_free(zBuf);
454 return zRes;
455 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
456 #endif /* _WIN32 -- This code is for win32 only */
457
--- src/winfile.c
+++ src/winfile.c
@@ -451,6 +451,74 @@
451 i = j;
452 }
453 fossil_free(zBuf);
454 return zRes;
455 }
456
457 /* Return the unique identifier (UID) for a file, made up of the file identifier
458 ** (equal to "inode" for Unix-style file systems) plus the volume serial number.
459 ** Call the GetFileInformationByHandleEx() function on Windows Vista, and resort
460 ** to the GetFileInformationByHandle() function on Windows XP. The result string
461 ** is allocated by mprintf(), or NULL on failure.
462 */
463 char *win32_file_id(
464 const char *zFileName
465 ){
466 static FARPROC fnGetFileInformationByHandleEx;
467 static int loaded_fnGetFileInformationByHandleEx;
468 wchar_t *wzFileName = fossil_utf8_to_path(zFileName,0);
469 HANDLE hFile;
470 char *zFileId = 0;
471 hFile = CreateFileW(
472 wzFileName,
473 0,
474 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
475 NULL,
476 OPEN_EXISTING,
477 FILE_FLAG_BACKUP_SEMANTICS,
478 NULL);
479 if( hFile!=INVALID_HANDLE_VALUE ){
480 BY_HANDLE_FILE_INFORMATION fi;
481 struct { /* FILE_ID_INFO from <winbase.h> */
482 u64 VolumeSerialNumber;
483 unsigned char FileId[16];
484 } fi2;
485 if( !loaded_fnGetFileInformationByHandleEx ){
486 fnGetFileInformationByHandleEx = GetProcAddress(
487 GetModuleHandleA("kernel32"),"GetFileInformationByHandleEx");
488 loaded_fnGetFileInformationByHandleEx = 1;
489 }
490 if( fnGetFileInformationByHandleEx ){
491 if( fnGetFileInformationByHandleEx(
492 hFile,/*FileIdInfo*/0x12,&fi2,sizeof(fi2)) ){
493 zFileId = mprintf(
494 "%016llx/"
495 "%02x%02x%02x%02x%02x%02x%02x%02x"
496 "%02x%02x%02x%02x%02x%02x%02x%02x",
497 fi2.VolumeSerialNumber,
498 fi2.FileId[15], fi2.FileId[14],
499 fi2.FileId[13], fi2.FileId[12],
500 fi2.FileId[11], fi2.FileId[10],
501 fi2.FileId[9], fi2.FileId[8],
502 fi2.FileId[7], fi2.FileId[6],
503 fi2.FileId[5], fi2.FileId[4],
504 fi2.FileId[3], fi2.FileId[2],
505 fi2.FileId[1], fi2.FileId[0]);
506 }
507 }
508 if( zFileId==0 ){
509 if( GetFileInformationByHandle(hFile,&fi) ){
510 ULARGE_INTEGER FileId = {
511 /*.LowPart = */ fi.nFileIndexLow,
512 /*.HighPart = */ fi.nFileIndexHigh
513 };
514 zFileId = mprintf(
515 "%08x/%016llx",
516 fi.dwVolumeSerialNumber,(u64)FileId.QuadPart);
517 }
518 }
519 CloseHandle(hFile);
520 }
521 fossil_path_free(wzFileName);
522 return zFileId;
523 }
524 #endif /* _WIN32 -- This code is for win32 only */
525
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -209,10 +209,11 @@
209209
# Additional resource files that get built into the executable.
210210
# These paths are all resolved from the src/ directory, so must
211211
# be relative to that.
212212
set extra_files {
213213
diff.tcl
214
+ merge.tcl
214215
markdown.md
215216
wiki.wiki
216217
*.js
217218
default.css
218219
style.*.css
219220
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -209,10 +209,11 @@
209 # Additional resource files that get built into the executable.
210 # These paths are all resolved from the src/ directory, so must
211 # be relative to that.
212 set extra_files {
213 diff.tcl
 
214 markdown.md
215 wiki.wiki
216 *.js
217 default.css
218 style.*.css
219
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -209,10 +209,11 @@
209 # Additional resource files that get built into the executable.
210 # These paths are all resolved from the src/ directory, so must
211 # be relative to that.
212 set extra_files {
213 diff.tcl
214 merge.tcl
215 markdown.md
216 wiki.wiki
217 *.js
218 default.css
219 style.*.css
220
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -634,10 +634,11 @@
634634
$(SRCDIR)/hbmenu.js \
635635
$(SRCDIR)/href.js \
636636
$(SRCDIR)/login.js \
637637
$(SRCDIR)/markdown.md \
638638
$(SRCDIR)/menu.js \
639
+ $(SRCDIR)/merge.tcl \
639640
$(SRCDIR)/scroll.js \
640641
$(SRCDIR)/skin.js \
641642
$(SRCDIR)/sorttable.js \
642643
$(SRCDIR)/sounds/0.wav \
643644
$(SRCDIR)/sounds/1.wav \
644645
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -634,10 +634,11 @@
634 $(SRCDIR)/hbmenu.js \
635 $(SRCDIR)/href.js \
636 $(SRCDIR)/login.js \
637 $(SRCDIR)/markdown.md \
638 $(SRCDIR)/menu.js \
 
639 $(SRCDIR)/scroll.js \
640 $(SRCDIR)/skin.js \
641 $(SRCDIR)/sorttable.js \
642 $(SRCDIR)/sounds/0.wav \
643 $(SRCDIR)/sounds/1.wav \
644
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -634,10 +634,11 @@
634 $(SRCDIR)/hbmenu.js \
635 $(SRCDIR)/href.js \
636 $(SRCDIR)/login.js \
637 $(SRCDIR)/markdown.md \
638 $(SRCDIR)/menu.js \
639 $(SRCDIR)/merge.tcl \
640 $(SRCDIR)/scroll.js \
641 $(SRCDIR)/skin.js \
642 $(SRCDIR)/sorttable.js \
643 $(SRCDIR)/sounds/0.wav \
644 $(SRCDIR)/sounds/1.wav \
645
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -592,10 +592,11 @@
592592
"$(SRCDIR)\hbmenu.js" \
593593
"$(SRCDIR)\href.js" \
594594
"$(SRCDIR)\login.js" \
595595
"$(SRCDIR)\markdown.md" \
596596
"$(SRCDIR)\menu.js" \
597
+ "$(SRCDIR)\merge.tcl" \
597598
"$(SRCDIR)\scroll.js" \
598599
"$(SRCDIR)\skin.js" \
599600
"$(SRCDIR)\sorttable.js" \
600601
"$(SRCDIR)\sounds\0.wav" \
601602
"$(SRCDIR)\sounds\1.wav" \
@@ -1222,10 +1223,11 @@
12221223
echo "$(SRCDIR)\hbmenu.js" >> $@
12231224
echo "$(SRCDIR)\href.js" >> $@
12241225
echo "$(SRCDIR)\login.js" >> $@
12251226
echo "$(SRCDIR)\markdown.md" >> $@
12261227
echo "$(SRCDIR)\menu.js" >> $@
1228
+ echo "$(SRCDIR)\merge.tcl" >> $@
12271229
echo "$(SRCDIR)\scroll.js" >> $@
12281230
echo "$(SRCDIR)\skin.js" >> $@
12291231
echo "$(SRCDIR)\sorttable.js" >> $@
12301232
echo "$(SRCDIR)\sounds/0.wav" >> $@
12311233
echo "$(SRCDIR)\sounds/1.wav" >> $@
12321234
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -592,10 +592,11 @@
592 "$(SRCDIR)\hbmenu.js" \
593 "$(SRCDIR)\href.js" \
594 "$(SRCDIR)\login.js" \
595 "$(SRCDIR)\markdown.md" \
596 "$(SRCDIR)\menu.js" \
 
597 "$(SRCDIR)\scroll.js" \
598 "$(SRCDIR)\skin.js" \
599 "$(SRCDIR)\sorttable.js" \
600 "$(SRCDIR)\sounds\0.wav" \
601 "$(SRCDIR)\sounds\1.wav" \
@@ -1222,10 +1223,11 @@
1222 echo "$(SRCDIR)\hbmenu.js" >> $@
1223 echo "$(SRCDIR)\href.js" >> $@
1224 echo "$(SRCDIR)\login.js" >> $@
1225 echo "$(SRCDIR)\markdown.md" >> $@
1226 echo "$(SRCDIR)\menu.js" >> $@
 
1227 echo "$(SRCDIR)\scroll.js" >> $@
1228 echo "$(SRCDIR)\skin.js" >> $@
1229 echo "$(SRCDIR)\sorttable.js" >> $@
1230 echo "$(SRCDIR)\sounds/0.wav" >> $@
1231 echo "$(SRCDIR)\sounds/1.wav" >> $@
1232
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -592,10 +592,11 @@
592 "$(SRCDIR)\hbmenu.js" \
593 "$(SRCDIR)\href.js" \
594 "$(SRCDIR)\login.js" \
595 "$(SRCDIR)\markdown.md" \
596 "$(SRCDIR)\menu.js" \
597 "$(SRCDIR)\merge.tcl" \
598 "$(SRCDIR)\scroll.js" \
599 "$(SRCDIR)\skin.js" \
600 "$(SRCDIR)\sorttable.js" \
601 "$(SRCDIR)\sounds\0.wav" \
602 "$(SRCDIR)\sounds\1.wav" \
@@ -1222,10 +1223,11 @@
1223 echo "$(SRCDIR)\hbmenu.js" >> $@
1224 echo "$(SRCDIR)\href.js" >> $@
1225 echo "$(SRCDIR)\login.js" >> $@
1226 echo "$(SRCDIR)\markdown.md" >> $@
1227 echo "$(SRCDIR)\menu.js" >> $@
1228 echo "$(SRCDIR)\merge.tcl" >> $@
1229 echo "$(SRCDIR)\scroll.js" >> $@
1230 echo "$(SRCDIR)\skin.js" >> $@
1231 echo "$(SRCDIR)\sorttable.js" >> $@
1232 echo "$(SRCDIR)\sounds/0.wav" >> $@
1233 echo "$(SRCDIR)\sounds/1.wav" >> $@
1234

Keyboard Shortcuts

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