Fossil SCM

Update the built-in SQLite to version 3.44.0.

drh 2023-11-01 14:13 trunk
Commit 72e143519d956c4c1574537066576fd3b5563d9ae854334237bb495702ce012b
+106 -114
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -466,20 +466,22 @@
466466
** is true. Otherwise, assume stdin is connected to a file or pipe.
467467
*/
468468
static int stdin_is_interactive = 1;
469469
470470
/*
471
-** If build is for Windows, without 3rd-party line editing, Console
472
-** input and output may be done in a UTF-8 compatible way. This is
473
-** determined by invocation option and OS installed capability.
471
+** If build is for non-RT Windows, without 3rd-party line editing,
472
+** console input and output may be done in a UTF-8 compatible way,
473
+** if the OS is capable of it and the --no-utf8 option is not seen.
474474
*/
475475
#if (defined(_WIN32) || defined(WIN32)) && SHELL_USE_LOCAL_GETLINE \
476
- && !defined(SHELL_OMIT_WIN_UTF8)
476
+ && !defined(SHELL_OMIT_WIN_UTF8) && !SQLITE_OS_WINRT
477477
# define SHELL_WIN_UTF8_OPT 1
478
+/* Record whether to do UTF-8 console I/O translation per stream. */
478479
static int console_utf8_in = 0;
479480
static int console_utf8_out = 0;
480
- static int mbcs_opted = 0;
481
+/* Record whether can do UTF-8 or --no-utf8 seen in invocation. */
482
+ static int mbcs_opted = 1; /* Assume cannot do until shown otherwise. */
481483
#else
482484
# define console_utf8_in 0
483485
# define console_utf8_out 0
484486
# define SHELL_WIN_UTF8_OPT 0
485487
#endif
@@ -615,11 +617,11 @@
615617
return dynPrompt.dynamicPrompt;
616618
}
617619
#endif /* !defined(SQLITE_OMIT_DYNAPROMPT) */
618620
619621
#if SHELL_WIN_UTF8_OPT
620
-/* Following struct is used for UTF-8 operation. */
622
+/* Following struct is used for UTF-8 console I/O. */
621623
static struct ConsoleState {
622624
int stdinEof; /* EOF has been seen on console input */
623625
int infsMode; /* Input file stream mode upon shell start */
624626
UINT inCodePage; /* Input code page upon shell start */
625627
UINT outCodePage; /* Output code page upon shell start */
@@ -629,110 +631,109 @@
629631
630632
#ifndef _O_U16TEXT /* For build environments lacking this constant: */
631633
# define _O_U16TEXT 0x20000
632634
#endif
633635
634
-
635
-#if !SQLITE_OS_WINRT
636
-/*
637
-** Check Windows major version against given value, returning
638
-** 1 if the OS major version is no less than the argument.
639
-** This check uses very late binding to the registry access
640
-** API so that it can operate gracefully on OS versions that
641
-** do not have that API. The Windows NT registry, for versions
642
-** through Windows 11 (at least, as of October 2023), keeps
643
-** the actual major version number at registry key/value
644
-** HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentMajorVersionNumber
645
-** where it can be read more reliably than allowed by various
646
-** version info APIs which "process" the result in a manner
647
-** incompatible with the purpose of the CLI's version check.
648
-**
649
-** If the registry API is unavailable, or the location of
650
-** the above registry value changes, or the OS major version
651
-** is less than the argument, this function returns 0.
652
-*/
653
-static int CheckAtLeastWinX(DWORD major_version){
654
- typedef LONG (WINAPI *REG_OPEN)(HKEY,LPCSTR,DWORD,REGSAM,PHKEY);
655
- typedef LSTATUS (WINAPI *REG_READ)(HKEY,LPCSTR,LPCSTR,DWORD,
656
- LPDWORD,PVOID,LPDWORD);
657
- typedef LSTATUS (WINAPI *REG_CLOSE)(HKEY);
658
- int rv = 0;
659
- HINSTANCE hLib = LoadLibrary(TEXT("Advapi32.dll"));
660
- if( NULL != hLib ){
661
- REG_OPEN rkOpen = (REG_OPEN)GetProcAddress(hLib, "RegOpenKeyExA");
662
- REG_READ rkRead = (REG_READ)GetProcAddress(hLib, "RegGetValueA");
663
- REG_CLOSE rkFree = (REG_CLOSE)GetProcAddress(hLib, "RegCloseKey");
664
- if( rkOpen != NULL && rkRead != NULL && rkFree != NULL ){
665
- HKEY hk;
666
- const char *zsk = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
667
- if( ERROR_SUCCESS == rkOpen(HKEY_LOCAL_MACHINE, zsk, 0, KEY_READ, &hk) ){
668
- DWORD kv = 0, kvsize = sizeof(kv);
669
- if( ERROR_SUCCESS == rkRead(hk, 0, "CurrentMajorVersionNumber",
670
- RRF_RT_REG_DWORD, 0, &kv, &kvsize) ){
671
- rv = (kv >= major_version);
672
- }
673
- rkFree(hk);
674
- }
675
- }
676
- FreeLibrary(hLib);
677
- }
678
- return rv;
679
-}
680
-# define IS_WIN10_OR_LATER() CheckAtLeastWinX(10)
681
-#else /* defined(SQLITE_OS_WINRT) */
682
-# define IS_WIN10_OR_LATER() 0
683
-#endif
684
-
685
-/*
686
-** Prepare console, (if known to be a WIN32 console), for UTF-8 input
687
-** (from either typing or suitable paste operations) and/or for UTF-8
688
-** output rendering. This may "fail" with a message to stderr, where
689
-** the preparation is not done and common "code page" issues occur.
636
+/*
637
+** If given stream number is a console, return 1 and get some attributes,
638
+** else return 0 and set the output attributes to invalid values.
639
+*/
640
+static short console_attrs(unsigned stnum, HANDLE *pH, DWORD *pConsMode){
641
+ static int stid[3] = { STD_INPUT_HANDLE,STD_OUTPUT_HANDLE,STD_ERROR_HANDLE };
642
+ HANDLE h;
643
+ *pH = INVALID_HANDLE_VALUE;
644
+ *pConsMode = 0;
645
+ if( stnum > 2 ) return 0;
646
+ h = GetStdHandle(stid[stnum]);
647
+ if( h!=*pH && GetFileType(h)==FILE_TYPE_CHAR && GetConsoleMode(h,pConsMode) ){
648
+ *pH = h;
649
+ return 1;
650
+ }
651
+ return 0;
652
+}
653
+
654
+/*
655
+** Perform a runtime test of Windows console to determine if it can
656
+** do char-stream I/O correctly when the code page is set to CP_UTF8.
657
+** Returns are: 1 => yes it can, 0 => no it cannot
658
+**
659
+** The console's output code page is momentarily set, then restored.
660
+** So this should only be run when the process is given use of the
661
+** console for either input or output.
662
+*/
663
+static short ConsoleDoesUTF8(void){
664
+ UINT ocp = GetConsoleOutputCP();
665
+ const char TrialUtf8[] = { '\xC8', '\xAB' }; /* "ȫ" or 2 MBCS characters */
666
+ WCHAR aReadBack[1] = { 0 }; /* Read back as 0x022B when decoded as UTF-8. */
667
+ CONSOLE_SCREEN_BUFFER_INFO csbInfo = {0};
668
+ /* Create an inactive screen buffer with which to do the experiment. */
669
+ HANDLE hCSB = CreateConsoleScreenBuffer(GENERIC_READ|GENERIC_WRITE, 0, 0,
670
+ CONSOLE_TEXTMODE_BUFFER, NULL);
671
+ if( hCSB!=INVALID_HANDLE_VALUE ){
672
+ COORD cpos = {0,0};
673
+ DWORD rbc;
674
+ SetConsoleCursorPosition(hCSB, cpos);
675
+ SetConsoleOutputCP(CP_UTF8);
676
+ /* Write 2 chars which are a single character in UTF-8 but more in MBCS. */
677
+ WriteConsoleA(hCSB, TrialUtf8, sizeof(TrialUtf8), NULL, NULL);
678
+ ReadConsoleOutputCharacterW(hCSB, &aReadBack[0], 1, cpos, &rbc);
679
+ GetConsoleScreenBufferInfo(hCSB, &csbInfo);
680
+ SetConsoleOutputCP(ocp);
681
+ CloseHandle(hCSB);
682
+ }
683
+ /* Return 1 if cursor advanced by 1 position, else 0. */
684
+ return (short)(csbInfo.dwCursorPosition.X == 1 && aReadBack[0] == 0x022B);
685
+}
686
+
687
+static short in_console = 0;
688
+static short out_console = 0;
689
+
690
+/*
691
+** Determine whether either normal I/O stream is the console,
692
+** and whether it can do UTF-8 translation, setting globals
693
+** in_console, out_console and mbcs_opted accordingly.
694
+*/
695
+static void probe_console(void){
696
+ HANDLE h;
697
+ DWORD cMode;
698
+ in_console = console_attrs(0, &h, &cMode);
699
+ out_console = console_attrs(1, &h, &cMode);
700
+ if( in_console || out_console ) mbcs_opted = !ConsoleDoesUTF8();
701
+}
702
+
703
+/*
704
+** If console is used for normal I/O, absent a --no-utf8 option,
705
+** prepare console for UTF-8 input (from either typing or suitable
706
+** paste operations) and/or for UTF-8 output rendering.
690707
**
691708
** The console state upon entry is preserved, in conState, so that
692709
** console_restore() can later restore the same console state.
693710
**
694711
** The globals console_utf8_in and console_utf8_out are set, for
695712
** later use in selecting UTF-8 or MBCS console I/O translations.
713
+** This routine depends upon globals set by probe_console().
696714
*/
697715
static void console_prepare_utf8(void){
698
- HANDLE hCI = GetStdHandle(STD_INPUT_HANDLE);
699
- HANDLE hCO = GetStdHandle(STD_OUTPUT_HANDLE);
700
- HANDLE hCC = INVALID_HANDLE_VALUE;
701
- DWORD consoleMode = 0;
702
- u8 conI = 0, conO = 0;
703716
struct ConsoleState csWork = { 0, 0, 0, 0, INVALID_HANDLE_VALUE, 0 };
704717
705718
console_utf8_in = console_utf8_out = 0;
706
- if( isatty(0) && GetFileType(hCI)==FILE_TYPE_CHAR ) conI = 1;
707
- if( isatty(1) && GetFileType(hCO)==FILE_TYPE_CHAR ) conO = 1;
708
- if( (!conI && !conO) || mbcs_opted ) return;
709
- if( conI ) hCC = hCI;
710
- else hCC = hCO;
711
- if( !IsValidCodePage(CP_UTF8) || !GetConsoleMode( hCC, &consoleMode) ){
712
- bail:
713
- fprintf(stderr, "Cannot use UTF-8 code page.\n");
714
- return;
715
- }
716
- csWork.hConsole = hCC;
717
- csWork.consoleMode = consoleMode;
718
- csWork.inCodePage = GetConsoleCP();
719
- csWork.outCodePage = GetConsoleOutputCP();
720
- if( conI ){
721
- if( !SetConsoleCP(CP_UTF8) ) goto bail;
722
- consoleMode |= ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT;
723
- SetConsoleMode(conState.hConsole, consoleMode);
724
- csWork.infsMode = _setmode(_fileno(stdin), _O_U16TEXT);
725
- }
726
- if( conO ){
727
- /* Here, it is assumed that if conI is true, this call will also
728
- ** succeed, so there is no need to undo above setup upon failure. */
729
- if( !SetConsoleOutputCP(CP_UTF8) ) goto bail;
730
- }
731
- console_utf8_in = conI;
732
- console_utf8_out = conO;
733
- conState = csWork;
719
+ if( (!in_console && !out_console) || mbcs_opted ) return;
720
+ console_attrs((in_console)? 0 : 1, &conState.hConsole, &conState.consoleMode);
721
+ conState.inCodePage = GetConsoleCP();
722
+ conState.outCodePage = GetConsoleOutputCP();
723
+ if( in_console ){
724
+ SetConsoleCP(CP_UTF8);
725
+ DWORD newConsoleMode = conState.consoleMode
726
+ | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT;
727
+ SetConsoleMode(conState.hConsole, newConsoleMode);
728
+ conState.infsMode = _setmode(_fileno(stdin), _O_U16TEXT);
729
+ console_utf8_in = 1;
730
+ }
731
+ if( out_console ){
732
+ SetConsoleOutputCP(CP_UTF8);
733
+ console_utf8_out = 1;
734
+ }
734735
}
735736
736737
/*
737738
** Undo the effects of console_prepare_utf8(), if any.
738739
*/
@@ -19328,11 +19329,11 @@
1932819329
const char *z = 0;
1932919330
int n = 0;
1933019331
if( sqlite3_stmt_scanstatus_v2(p,ii,SQLITE_SCANSTAT_EXPLAIN,f,(void*)&z) ){
1933119332
break;
1933219333
}
19333
- n = strlen(z) + scanStatsHeight(p, ii)*3;
19334
+ n = (int)strlen(z) + scanStatsHeight(p, ii)*3;
1933419335
if( n>nWidth ) nWidth = n;
1933519336
}
1933619337
nWidth += 4;
1933719338
1933819339
sqlite3_stmt_scanstatus_v2(p, -1, SQLITE_SCANSTAT_NCYCLE, f, (void*)&nTotal);
@@ -19340,16 +19341,16 @@
1934019341
i64 nLoop = 0;
1934119342
i64 nRow = 0;
1934219343
i64 nCycle = 0;
1934319344
int iId = 0;
1934419345
int iPid = 0;
19345
- const char *z = 0;
19346
+ const char *zo = 0;
1934619347
const char *zName = 0;
1934719348
char *zText = 0;
1934819349
double rEst = 0.0;
1934919350
19350
- if( sqlite3_stmt_scanstatus_v2(p,ii,SQLITE_SCANSTAT_EXPLAIN,f,(void*)&z) ){
19351
+ if( sqlite3_stmt_scanstatus_v2(p,ii,SQLITE_SCANSTAT_EXPLAIN,f,(void*)&zo) ){
1935119352
break;
1935219353
}
1935319354
sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_EST,f,(void*)&rEst);
1935419355
sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NLOOP,f,(void*)&nLoop);
1935519356
sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NVISIT,f,(void*)&nRow);
@@ -19356,11 +19357,11 @@
1935619357
sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NCYCLE,f,(void*)&nCycle);
1935719358
sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_SELECTID,f,(void*)&iId);
1935819359
sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_PARENTID,f,(void*)&iPid);
1935919360
sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NAME,f,(void*)&zName);
1936019361
19361
- zText = sqlite3_mprintf("%s", z);
19362
+ zText = sqlite3_mprintf("%s", zo);
1936219363
if( nCycle>=0 || nLoop>=0 || nRow>=0 ){
1936319364
char *z = 0;
1936419365
if( nCycle>=0 && nTotal>0 ){
1936519366
z = sqlite3_mprintf("%zcycles=%lld [%d%%]", z,
1936619367
nCycle, ((nCycle*100)+nTotal/2) / nTotal
@@ -28075,11 +28076,12 @@
2807528076
#else
2807628077
stdin_is_interactive = isatty(0);
2807728078
stdout_is_console = isatty(1);
2807828079
#endif
2807928080
#if SHELL_WIN_UTF8_OPT
28080
- atexit(console_restore); /* Needs revision for CLI as library call */
28081
+ probe_console(); /* Check for console I/O and UTF-8 capability. */
28082
+ if( !mbcs_opted ) atexit(console_restore);
2808128083
#endif
2808228084
atexit(sayAbnormalExit);
2808328085
#ifdef SQLITE_DEBUG
2808428086
mem_main_enter = sqlite3_memory_used();
2808528087
#endif
@@ -28160,20 +28162,10 @@
2816028162
SQLITE_SHELL_DBNAME_PROC(&data.pAuxDb->zDbFilename);
2816128163
warnInmemoryDb = 0;
2816228164
}
2816328165
#endif
2816428166
28165
-#if SHELL_WIN_UTF8_OPT
28166
- /* If Windows build and not RT, set default MBCS/UTF-8 translation for
28167
- ** console according to detected Windows version. This default may be
28168
- ** overridden by a -no-utf8 or (undocumented) -utf8 invocation option.
28169
- ** If a runtime check for UTF-8 console I/O capability is devised,
28170
- ** that should be preferred over this version check.
28171
- */
28172
- mbcs_opted = (IS_WIN10_OR_LATER())? 0 : 1;
28173
-#endif
28174
-
2817528167
/* Do an initial pass through the command-line argument to locate
2817628168
** the name of the database file, the name of the initialization file,
2817728169
** the size of the alternative malloc heap, options affecting commands
2817828170
** or SQL run from the command line, and the first command to execute.
2817928171
*/
@@ -28220,12 +28212,12 @@
2822028212
** we do the actual processing of arguments later in a second pass.
2822128213
*/
2822228214
stdin_is_interactive = 0;
2822328215
}else if( cli_strcmp(z,"-utf8")==0 ){
2822428216
#if SHELL_WIN_UTF8_OPT
28225
- /* Option accepted, but just specifies default UTF-8 console I/O. */
28226
- mbcs_opted = 0;
28217
+ /* Option accepted, but is ignored except for this diagnostic. */
28218
+ if( mbcs_opted ) fprintf(stderr, "Cannot do UTF-8 at this console.\n");
2822728219
#endif /* SHELL_WIN_UTF8_OPT */
2822828220
}else if( cli_strcmp(z,"-no-utf8")==0 ){
2822928221
#if SHELL_WIN_UTF8_OPT
2823028222
mbcs_opted = 1;
2823128223
#endif /* SHELL_WIN_UTF8_OPT */
@@ -28367,14 +28359,14 @@
2836728359
exit(1);
2836828360
}
2836928361
}
2837028362
#if SHELL_WIN_UTF8_OPT
2837128363
/* Get indicated Windows console setup done before running invocation commands. */
28372
- if( stdin_is_interactive || stdout_is_console ){
28364
+ if( in_console || out_console ){
2837328365
console_prepare_utf8();
2837428366
}
28375
- if( !stdin_is_interactive ){
28367
+ if( !in_console ){
2837628368
setBinaryMode(stdin, 0);
2837728369
}
2837828370
#endif
2837928371
2838028372
if( data.pAuxDb->zDbFilename==0 ){
2838128373
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -466,20 +466,22 @@
466 ** is true. Otherwise, assume stdin is connected to a file or pipe.
467 */
468 static int stdin_is_interactive = 1;
469
470 /*
471 ** If build is for Windows, without 3rd-party line editing, Console
472 ** input and output may be done in a UTF-8 compatible way. This is
473 ** determined by invocation option and OS installed capability.
474 */
475 #if (defined(_WIN32) || defined(WIN32)) && SHELL_USE_LOCAL_GETLINE \
476 && !defined(SHELL_OMIT_WIN_UTF8)
477 # define SHELL_WIN_UTF8_OPT 1
 
478 static int console_utf8_in = 0;
479 static int console_utf8_out = 0;
480 static int mbcs_opted = 0;
 
481 #else
482 # define console_utf8_in 0
483 # define console_utf8_out 0
484 # define SHELL_WIN_UTF8_OPT 0
485 #endif
@@ -615,11 +617,11 @@
615 return dynPrompt.dynamicPrompt;
616 }
617 #endif /* !defined(SQLITE_OMIT_DYNAPROMPT) */
618
619 #if SHELL_WIN_UTF8_OPT
620 /* Following struct is used for UTF-8 operation. */
621 static struct ConsoleState {
622 int stdinEof; /* EOF has been seen on console input */
623 int infsMode; /* Input file stream mode upon shell start */
624 UINT inCodePage; /* Input code page upon shell start */
625 UINT outCodePage; /* Output code page upon shell start */
@@ -629,110 +631,109 @@
629
630 #ifndef _O_U16TEXT /* For build environments lacking this constant: */
631 # define _O_U16TEXT 0x20000
632 #endif
633
634
635 #if !SQLITE_OS_WINRT
636 /*
637 ** Check Windows major version against given value, returning
638 ** 1 if the OS major version is no less than the argument.
639 ** This check uses very late binding to the registry access
640 ** API so that it can operate gracefully on OS versions that
641 ** do not have that API. The Windows NT registry, for versions
642 ** through Windows 11 (at least, as of October 2023), keeps
643 ** the actual major version number at registry key/value
644 ** HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentMajorVersionNumber
645 ** where it can be read more reliably than allowed by various
646 ** version info APIs which "process" the result in a manner
647 ** incompatible with the purpose of the CLI's version check.
648 **
649 ** If the registry API is unavailable, or the location of
650 ** the above registry value changes, or the OS major version
651 ** is less than the argument, this function returns 0.
652 */
653 static int CheckAtLeastWinX(DWORD major_version){
654 typedef LONG (WINAPI *REG_OPEN)(HKEY,LPCSTR,DWORD,REGSAM,PHKEY);
655 typedef LSTATUS (WINAPI *REG_READ)(HKEY,LPCSTR,LPCSTR,DWORD,
656 LPDWORD,PVOID,LPDWORD);
657 typedef LSTATUS (WINAPI *REG_CLOSE)(HKEY);
658 int rv = 0;
659 HINSTANCE hLib = LoadLibrary(TEXT("Advapi32.dll"));
660 if( NULL != hLib ){
661 REG_OPEN rkOpen = (REG_OPEN)GetProcAddress(hLib, "RegOpenKeyExA");
662 REG_READ rkRead = (REG_READ)GetProcAddress(hLib, "RegGetValueA");
663 REG_CLOSE rkFree = (REG_CLOSE)GetProcAddress(hLib, "RegCloseKey");
664 if( rkOpen != NULL && rkRead != NULL && rkFree != NULL ){
665 HKEY hk;
666 const char *zsk = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
667 if( ERROR_SUCCESS == rkOpen(HKEY_LOCAL_MACHINE, zsk, 0, KEY_READ, &hk) ){
668 DWORD kv = 0, kvsize = sizeof(kv);
669 if( ERROR_SUCCESS == rkRead(hk, 0, "CurrentMajorVersionNumber",
670 RRF_RT_REG_DWORD, 0, &kv, &kvsize) ){
671 rv = (kv >= major_version);
672 }
673 rkFree(hk);
674 }
675 }
676 FreeLibrary(hLib);
677 }
678 return rv;
679 }
680 # define IS_WIN10_OR_LATER() CheckAtLeastWinX(10)
681 #else /* defined(SQLITE_OS_WINRT) */
682 # define IS_WIN10_OR_LATER() 0
683 #endif
684
685 /*
686 ** Prepare console, (if known to be a WIN32 console), for UTF-8 input
687 ** (from either typing or suitable paste operations) and/or for UTF-8
688 ** output rendering. This may "fail" with a message to stderr, where
689 ** the preparation is not done and common "code page" issues occur.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
690 **
691 ** The console state upon entry is preserved, in conState, so that
692 ** console_restore() can later restore the same console state.
693 **
694 ** The globals console_utf8_in and console_utf8_out are set, for
695 ** later use in selecting UTF-8 or MBCS console I/O translations.
 
696 */
697 static void console_prepare_utf8(void){
698 HANDLE hCI = GetStdHandle(STD_INPUT_HANDLE);
699 HANDLE hCO = GetStdHandle(STD_OUTPUT_HANDLE);
700 HANDLE hCC = INVALID_HANDLE_VALUE;
701 DWORD consoleMode = 0;
702 u8 conI = 0, conO = 0;
703 struct ConsoleState csWork = { 0, 0, 0, 0, INVALID_HANDLE_VALUE, 0 };
704
705 console_utf8_in = console_utf8_out = 0;
706 if( isatty(0) && GetFileType(hCI)==FILE_TYPE_CHAR ) conI = 1;
707 if( isatty(1) && GetFileType(hCO)==FILE_TYPE_CHAR ) conO = 1;
708 if( (!conI && !conO) || mbcs_opted ) return;
709 if( conI ) hCC = hCI;
710 else hCC = hCO;
711 if( !IsValidCodePage(CP_UTF8) || !GetConsoleMode( hCC, &consoleMode) ){
712 bail:
713 fprintf(stderr, "Cannot use UTF-8 code page.\n");
714 return;
715 }
716 csWork.hConsole = hCC;
717 csWork.consoleMode = consoleMode;
718 csWork.inCodePage = GetConsoleCP();
719 csWork.outCodePage = GetConsoleOutputCP();
720 if( conI ){
721 if( !SetConsoleCP(CP_UTF8) ) goto bail;
722 consoleMode |= ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT;
723 SetConsoleMode(conState.hConsole, consoleMode);
724 csWork.infsMode = _setmode(_fileno(stdin), _O_U16TEXT);
725 }
726 if( conO ){
727 /* Here, it is assumed that if conI is true, this call will also
728 ** succeed, so there is no need to undo above setup upon failure. */
729 if( !SetConsoleOutputCP(CP_UTF8) ) goto bail;
730 }
731 console_utf8_in = conI;
732 console_utf8_out = conO;
733 conState = csWork;
734 }
735
736 /*
737 ** Undo the effects of console_prepare_utf8(), if any.
738 */
@@ -19328,11 +19329,11 @@
19328 const char *z = 0;
19329 int n = 0;
19330 if( sqlite3_stmt_scanstatus_v2(p,ii,SQLITE_SCANSTAT_EXPLAIN,f,(void*)&z) ){
19331 break;
19332 }
19333 n = strlen(z) + scanStatsHeight(p, ii)*3;
19334 if( n>nWidth ) nWidth = n;
19335 }
19336 nWidth += 4;
19337
19338 sqlite3_stmt_scanstatus_v2(p, -1, SQLITE_SCANSTAT_NCYCLE, f, (void*)&nTotal);
@@ -19340,16 +19341,16 @@
19340 i64 nLoop = 0;
19341 i64 nRow = 0;
19342 i64 nCycle = 0;
19343 int iId = 0;
19344 int iPid = 0;
19345 const char *z = 0;
19346 const char *zName = 0;
19347 char *zText = 0;
19348 double rEst = 0.0;
19349
19350 if( sqlite3_stmt_scanstatus_v2(p,ii,SQLITE_SCANSTAT_EXPLAIN,f,(void*)&z) ){
19351 break;
19352 }
19353 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_EST,f,(void*)&rEst);
19354 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NLOOP,f,(void*)&nLoop);
19355 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NVISIT,f,(void*)&nRow);
@@ -19356,11 +19357,11 @@
19356 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NCYCLE,f,(void*)&nCycle);
19357 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_SELECTID,f,(void*)&iId);
19358 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_PARENTID,f,(void*)&iPid);
19359 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NAME,f,(void*)&zName);
19360
19361 zText = sqlite3_mprintf("%s", z);
19362 if( nCycle>=0 || nLoop>=0 || nRow>=0 ){
19363 char *z = 0;
19364 if( nCycle>=0 && nTotal>0 ){
19365 z = sqlite3_mprintf("%zcycles=%lld [%d%%]", z,
19366 nCycle, ((nCycle*100)+nTotal/2) / nTotal
@@ -28075,11 +28076,12 @@
28075 #else
28076 stdin_is_interactive = isatty(0);
28077 stdout_is_console = isatty(1);
28078 #endif
28079 #if SHELL_WIN_UTF8_OPT
28080 atexit(console_restore); /* Needs revision for CLI as library call */
 
28081 #endif
28082 atexit(sayAbnormalExit);
28083 #ifdef SQLITE_DEBUG
28084 mem_main_enter = sqlite3_memory_used();
28085 #endif
@@ -28160,20 +28162,10 @@
28160 SQLITE_SHELL_DBNAME_PROC(&data.pAuxDb->zDbFilename);
28161 warnInmemoryDb = 0;
28162 }
28163 #endif
28164
28165 #if SHELL_WIN_UTF8_OPT
28166 /* If Windows build and not RT, set default MBCS/UTF-8 translation for
28167 ** console according to detected Windows version. This default may be
28168 ** overridden by a -no-utf8 or (undocumented) -utf8 invocation option.
28169 ** If a runtime check for UTF-8 console I/O capability is devised,
28170 ** that should be preferred over this version check.
28171 */
28172 mbcs_opted = (IS_WIN10_OR_LATER())? 0 : 1;
28173 #endif
28174
28175 /* Do an initial pass through the command-line argument to locate
28176 ** the name of the database file, the name of the initialization file,
28177 ** the size of the alternative malloc heap, options affecting commands
28178 ** or SQL run from the command line, and the first command to execute.
28179 */
@@ -28220,12 +28212,12 @@
28220 ** we do the actual processing of arguments later in a second pass.
28221 */
28222 stdin_is_interactive = 0;
28223 }else if( cli_strcmp(z,"-utf8")==0 ){
28224 #if SHELL_WIN_UTF8_OPT
28225 /* Option accepted, but just specifies default UTF-8 console I/O. */
28226 mbcs_opted = 0;
28227 #endif /* SHELL_WIN_UTF8_OPT */
28228 }else if( cli_strcmp(z,"-no-utf8")==0 ){
28229 #if SHELL_WIN_UTF8_OPT
28230 mbcs_opted = 1;
28231 #endif /* SHELL_WIN_UTF8_OPT */
@@ -28367,14 +28359,14 @@
28367 exit(1);
28368 }
28369 }
28370 #if SHELL_WIN_UTF8_OPT
28371 /* Get indicated Windows console setup done before running invocation commands. */
28372 if( stdin_is_interactive || stdout_is_console ){
28373 console_prepare_utf8();
28374 }
28375 if( !stdin_is_interactive ){
28376 setBinaryMode(stdin, 0);
28377 }
28378 #endif
28379
28380 if( data.pAuxDb->zDbFilename==0 ){
28381
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -466,20 +466,22 @@
466 ** is true. Otherwise, assume stdin is connected to a file or pipe.
467 */
468 static int stdin_is_interactive = 1;
469
470 /*
471 ** If build is for non-RT Windows, without 3rd-party line editing,
472 ** console input and output may be done in a UTF-8 compatible way,
473 ** if the OS is capable of it and the --no-utf8 option is not seen.
474 */
475 #if (defined(_WIN32) || defined(WIN32)) && SHELL_USE_LOCAL_GETLINE \
476 && !defined(SHELL_OMIT_WIN_UTF8) && !SQLITE_OS_WINRT
477 # define SHELL_WIN_UTF8_OPT 1
478 /* Record whether to do UTF-8 console I/O translation per stream. */
479 static int console_utf8_in = 0;
480 static int console_utf8_out = 0;
481 /* Record whether can do UTF-8 or --no-utf8 seen in invocation. */
482 static int mbcs_opted = 1; /* Assume cannot do until shown otherwise. */
483 #else
484 # define console_utf8_in 0
485 # define console_utf8_out 0
486 # define SHELL_WIN_UTF8_OPT 0
487 #endif
@@ -615,11 +617,11 @@
617 return dynPrompt.dynamicPrompt;
618 }
619 #endif /* !defined(SQLITE_OMIT_DYNAPROMPT) */
620
621 #if SHELL_WIN_UTF8_OPT
622 /* Following struct is used for UTF-8 console I/O. */
623 static struct ConsoleState {
624 int stdinEof; /* EOF has been seen on console input */
625 int infsMode; /* Input file stream mode upon shell start */
626 UINT inCodePage; /* Input code page upon shell start */
627 UINT outCodePage; /* Output code page upon shell start */
@@ -629,110 +631,109 @@
631
632 #ifndef _O_U16TEXT /* For build environments lacking this constant: */
633 # define _O_U16TEXT 0x20000
634 #endif
635
636 /*
637 ** If given stream number is a console, return 1 and get some attributes,
638 ** else return 0 and set the output attributes to invalid values.
639 */
640 static short console_attrs(unsigned stnum, HANDLE *pH, DWORD *pConsMode){
641 static int stid[3] = { STD_INPUT_HANDLE,STD_OUTPUT_HANDLE,STD_ERROR_HANDLE };
642 HANDLE h;
643 *pH = INVALID_HANDLE_VALUE;
644 *pConsMode = 0;
645 if( stnum > 2 ) return 0;
646 h = GetStdHandle(stid[stnum]);
647 if( h!=*pH && GetFileType(h)==FILE_TYPE_CHAR && GetConsoleMode(h,pConsMode) ){
648 *pH = h;
649 return 1;
650 }
651 return 0;
652 }
653
654 /*
655 ** Perform a runtime test of Windows console to determine if it can
656 ** do char-stream I/O correctly when the code page is set to CP_UTF8.
657 ** Returns are: 1 => yes it can, 0 => no it cannot
658 **
659 ** The console's output code page is momentarily set, then restored.
660 ** So this should only be run when the process is given use of the
661 ** console for either input or output.
662 */
663 static short ConsoleDoesUTF8(void){
664 UINT ocp = GetConsoleOutputCP();
665 const char TrialUtf8[] = { '\xC8', '\xAB' }; /* "ȫ" or 2 MBCS characters */
666 WCHAR aReadBack[1] = { 0 }; /* Read back as 0x022B when decoded as UTF-8. */
667 CONSOLE_SCREEN_BUFFER_INFO csbInfo = {0};
668 /* Create an inactive screen buffer with which to do the experiment. */
669 HANDLE hCSB = CreateConsoleScreenBuffer(GENERIC_READ|GENERIC_WRITE, 0, 0,
670 CONSOLE_TEXTMODE_BUFFER, NULL);
671 if( hCSB!=INVALID_HANDLE_VALUE ){
672 COORD cpos = {0,0};
673 DWORD rbc;
674 SetConsoleCursorPosition(hCSB, cpos);
675 SetConsoleOutputCP(CP_UTF8);
676 /* Write 2 chars which are a single character in UTF-8 but more in MBCS. */
677 WriteConsoleA(hCSB, TrialUtf8, sizeof(TrialUtf8), NULL, NULL);
678 ReadConsoleOutputCharacterW(hCSB, &aReadBack[0], 1, cpos, &rbc);
679 GetConsoleScreenBufferInfo(hCSB, &csbInfo);
680 SetConsoleOutputCP(ocp);
681 CloseHandle(hCSB);
682 }
683 /* Return 1 if cursor advanced by 1 position, else 0. */
684 return (short)(csbInfo.dwCursorPosition.X == 1 && aReadBack[0] == 0x022B);
685 }
686
687 static short in_console = 0;
688 static short out_console = 0;
689
690 /*
691 ** Determine whether either normal I/O stream is the console,
692 ** and whether it can do UTF-8 translation, setting globals
693 ** in_console, out_console and mbcs_opted accordingly.
694 */
695 static void probe_console(void){
696 HANDLE h;
697 DWORD cMode;
698 in_console = console_attrs(0, &h, &cMode);
699 out_console = console_attrs(1, &h, &cMode);
700 if( in_console || out_console ) mbcs_opted = !ConsoleDoesUTF8();
701 }
702
703 /*
704 ** If console is used for normal I/O, absent a --no-utf8 option,
705 ** prepare console for UTF-8 input (from either typing or suitable
706 ** paste operations) and/or for UTF-8 output rendering.
707 **
708 ** The console state upon entry is preserved, in conState, so that
709 ** console_restore() can later restore the same console state.
710 **
711 ** The globals console_utf8_in and console_utf8_out are set, for
712 ** later use in selecting UTF-8 or MBCS console I/O translations.
713 ** This routine depends upon globals set by probe_console().
714 */
715 static void console_prepare_utf8(void){
 
 
 
 
 
716 struct ConsoleState csWork = { 0, 0, 0, 0, INVALID_HANDLE_VALUE, 0 };
717
718 console_utf8_in = console_utf8_out = 0;
719 if( (!in_console && !out_console) || mbcs_opted ) return;
720 console_attrs((in_console)? 0 : 1, &conState.hConsole, &conState.consoleMode);
721 conState.inCodePage = GetConsoleCP();
722 conState.outCodePage = GetConsoleOutputCP();
723 if( in_console ){
724 SetConsoleCP(CP_UTF8);
725 DWORD newConsoleMode = conState.consoleMode
726 | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT;
727 SetConsoleMode(conState.hConsole, newConsoleMode);
728 conState.infsMode = _setmode(_fileno(stdin), _O_U16TEXT);
729 console_utf8_in = 1;
730 }
731 if( out_console ){
732 SetConsoleOutputCP(CP_UTF8);
733 console_utf8_out = 1;
734 }
 
 
 
 
 
 
 
 
 
 
 
 
735 }
736
737 /*
738 ** Undo the effects of console_prepare_utf8(), if any.
739 */
@@ -19328,11 +19329,11 @@
19329 const char *z = 0;
19330 int n = 0;
19331 if( sqlite3_stmt_scanstatus_v2(p,ii,SQLITE_SCANSTAT_EXPLAIN,f,(void*)&z) ){
19332 break;
19333 }
19334 n = (int)strlen(z) + scanStatsHeight(p, ii)*3;
19335 if( n>nWidth ) nWidth = n;
19336 }
19337 nWidth += 4;
19338
19339 sqlite3_stmt_scanstatus_v2(p, -1, SQLITE_SCANSTAT_NCYCLE, f, (void*)&nTotal);
@@ -19340,16 +19341,16 @@
19341 i64 nLoop = 0;
19342 i64 nRow = 0;
19343 i64 nCycle = 0;
19344 int iId = 0;
19345 int iPid = 0;
19346 const char *zo = 0;
19347 const char *zName = 0;
19348 char *zText = 0;
19349 double rEst = 0.0;
19350
19351 if( sqlite3_stmt_scanstatus_v2(p,ii,SQLITE_SCANSTAT_EXPLAIN,f,(void*)&zo) ){
19352 break;
19353 }
19354 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_EST,f,(void*)&rEst);
19355 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NLOOP,f,(void*)&nLoop);
19356 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NVISIT,f,(void*)&nRow);
@@ -19356,11 +19357,11 @@
19357 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NCYCLE,f,(void*)&nCycle);
19358 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_SELECTID,f,(void*)&iId);
19359 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_PARENTID,f,(void*)&iPid);
19360 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NAME,f,(void*)&zName);
19361
19362 zText = sqlite3_mprintf("%s", zo);
19363 if( nCycle>=0 || nLoop>=0 || nRow>=0 ){
19364 char *z = 0;
19365 if( nCycle>=0 && nTotal>0 ){
19366 z = sqlite3_mprintf("%zcycles=%lld [%d%%]", z,
19367 nCycle, ((nCycle*100)+nTotal/2) / nTotal
@@ -28075,11 +28076,12 @@
28076 #else
28077 stdin_is_interactive = isatty(0);
28078 stdout_is_console = isatty(1);
28079 #endif
28080 #if SHELL_WIN_UTF8_OPT
28081 probe_console(); /* Check for console I/O and UTF-8 capability. */
28082 if( !mbcs_opted ) atexit(console_restore);
28083 #endif
28084 atexit(sayAbnormalExit);
28085 #ifdef SQLITE_DEBUG
28086 mem_main_enter = sqlite3_memory_used();
28087 #endif
@@ -28160,20 +28162,10 @@
28162 SQLITE_SHELL_DBNAME_PROC(&data.pAuxDb->zDbFilename);
28163 warnInmemoryDb = 0;
28164 }
28165 #endif
28166
 
 
 
 
 
 
 
 
 
 
28167 /* Do an initial pass through the command-line argument to locate
28168 ** the name of the database file, the name of the initialization file,
28169 ** the size of the alternative malloc heap, options affecting commands
28170 ** or SQL run from the command line, and the first command to execute.
28171 */
@@ -28220,12 +28212,12 @@
28212 ** we do the actual processing of arguments later in a second pass.
28213 */
28214 stdin_is_interactive = 0;
28215 }else if( cli_strcmp(z,"-utf8")==0 ){
28216 #if SHELL_WIN_UTF8_OPT
28217 /* Option accepted, but is ignored except for this diagnostic. */
28218 if( mbcs_opted ) fprintf(stderr, "Cannot do UTF-8 at this console.\n");
28219 #endif /* SHELL_WIN_UTF8_OPT */
28220 }else if( cli_strcmp(z,"-no-utf8")==0 ){
28221 #if SHELL_WIN_UTF8_OPT
28222 mbcs_opted = 1;
28223 #endif /* SHELL_WIN_UTF8_OPT */
@@ -28367,14 +28359,14 @@
28359 exit(1);
28360 }
28361 }
28362 #if SHELL_WIN_UTF8_OPT
28363 /* Get indicated Windows console setup done before running invocation commands. */
28364 if( in_console || out_console ){
28365 console_prepare_utf8();
28366 }
28367 if( !in_console ){
28368 setBinaryMode(stdin, 0);
28369 }
28370 #endif
28371
28372 if( data.pAuxDb->zDbFilename==0 ){
28373
+24 -7
--- 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
-** ddc6ead6453e0f98943bd07aedd90d47bc2e.
21
+** 17129ba1ff7f0daf37100ee82d507aef7827.
2222
*/
2323
#define SQLITE_CORE 1
2424
#define SQLITE_AMALGAMATION 1
2525
#ifndef SQLITE_PRIVATE
2626
# define SQLITE_PRIVATE static
@@ -459,11 +459,11 @@
459459
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
460460
** [sqlite_version()] and [sqlite_source_id()].
461461
*/
462462
#define SQLITE_VERSION "3.44.0"
463463
#define SQLITE_VERSION_NUMBER 3044000
464
-#define SQLITE_SOURCE_ID "2023-10-29 20:05:18 ddc6ead6453e0f98943bd07aedd90d47bc2e9e9e27b008d493491168bea2b3f1"
464
+#define SQLITE_SOURCE_ID "2023-11-01 11:23:50 17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad81301"
465465
466466
/*
467467
** CAPI3REF: Run-Time Library Version Numbers
468468
** KEYWORDS: sqlite3_version sqlite3_sourceid
469469
**
@@ -62971,10 +62971,17 @@
6297162971
#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
6297262972
if( bBatch ){
6297362973
rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_BEGIN_ATOMIC_WRITE, 0);
6297462974
if( rc==SQLITE_OK ){
6297562975
rc = pager_write_pagelist(pPager, pList);
62976
+ if( rc==SQLITE_OK && pPager->dbSize>pPager->dbFileSize ){
62977
+ char *pTmp = pPager->pTmpSpace;
62978
+ int szPage = (int)pPager->pageSize;
62979
+ memset(pTmp, 0, szPage);
62980
+ rc = sqlite3OsWrite(pPager->fd, pTmp, szPage,
62981
+ ((i64)pPager->dbSize*pPager->pageSize)-szPage);
62982
+ }
6297662983
if( rc==SQLITE_OK ){
6297762984
rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_COMMIT_ATOMIC_WRITE, 0);
6297862985
}
6297962986
if( rc!=SQLITE_OK ){
6298062987
sqlite3OsFileControlHint(fd, SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE, 0);
@@ -109503,11 +109510,12 @@
109503109510
assert( (int)(sEdupBuf.zEnd - sEdupBuf.zAlloc) >= nNewSize+nToken );
109504109511
assert( ExprHasProperty(p, EP_Reduced)==0 );
109505109512
memcpy(sEdupBuf.zAlloc, p, nNewSize);
109506109513
}else{
109507109514
u32 nSize = (u32)exprStructSize(p);
109508
- assert( (int)(sEdupBuf.zEnd - sEdupBuf.zAlloc) >= EXPR_FULLSIZE+nToken );
109515
+ assert( (int)(sEdupBuf.zEnd - sEdupBuf.zAlloc) >=
109516
+ (int)EXPR_FULLSIZE+nToken );
109509109517
memcpy(sEdupBuf.zAlloc, p, nSize);
109510109518
if( nSize<EXPR_FULLSIZE ){
109511109519
memset(&sEdupBuf.zAlloc[nSize], 0, EXPR_FULLSIZE-nSize);
109512109520
}
109513109521
nNewSize = EXPR_FULLSIZE;
@@ -135276,10 +135284,13 @@
135276135284
int (*value_encoding)(sqlite3_value*);
135277135285
/* Version 3.41.0 and later */
135278135286
int (*is_interrupted)(sqlite3*);
135279135287
/* Version 3.43.0 and later */
135280135288
int (*stmt_explain)(sqlite3_stmt*,int);
135289
+ /* Version 3.44.0 and later */
135290
+ void *(*get_clientdata)(sqlite3*,const char*);
135291
+ int (*set_clientdata)(sqlite3*, const char*, void*, void(*)(void*));
135281135292
};
135282135293
135283135294
/*
135284135295
** This is the function signature used for all extension entry points. It
135285135296
** is also defined in the file "loadext.c".
@@ -135606,10 +135617,13 @@
135606135617
#define sqlite3_value_encoding sqlite3_api->value_encoding
135607135618
/* Version 3.41.0 and later */
135608135619
#define sqlite3_is_interrupted sqlite3_api->is_interrupted
135609135620
/* Version 3.43.0 and later */
135610135621
#define sqlite3_stmt_explain sqlite3_api->stmt_explain
135622
+/* Version 3.44.0 and later */
135623
+#define sqlite3_get_clientdata sqlite3_api->get_clientdata
135624
+#define sqlite3_set_clientdata sqlite3_api->set_clientdata
135611135625
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
135612135626
135613135627
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
135614135628
/* This case when the file really is being compiled as a loadable
135615135629
** extension */
@@ -136124,11 +136138,14 @@
136124136138
/* Version 3.40.0 and later */
136125136139
sqlite3_value_encoding,
136126136140
/* Version 3.41.0 and later */
136127136141
sqlite3_is_interrupted,
136128136142
/* Version 3.43.0 and later */
136129
- sqlite3_stmt_explain
136143
+ sqlite3_stmt_explain,
136144
+ /* Version 3.44.0 and later */
136145
+ sqlite3_get_clientdata,
136146
+ sqlite3_set_clientdata
136130136147
};
136131136148
136132136149
/* True if x is the directory separator character
136133136150
*/
136134136151
#if SQLITE_OS_WIN
@@ -147957,14 +147974,14 @@
147957147974
** If regAcc is non-zero and there are no min() or max() aggregates
147958147975
** in pAggInfo, then only populate the pAggInfo->nAccumulator accumulator
147959147976
** registers if register regAcc contains 0. The caller will take care
147960147977
** of setting and clearing regAcc.
147961147978
**
147962
-** For an ORDER BY aggregate, the actually accumulator memory cell update
147979
+** For an ORDER BY aggregate, the actual accumulator memory cell update
147963147980
** is deferred until after all input rows have been received, so that they
147964147981
** can be run in the requested order. In that case, instead of invoking
147965
-** OP_AggStep to update accumulator, just add the arguments that would
147982
+** OP_AggStep to update the accumulator, just add the arguments that would
147966147983
** have been passed into OP_AggStep into the sorting ephemeral table
147967147984
** (along with the appropriate sort key).
147968147985
*/
147969147986
static void updateAccumulator(
147970147987
Parse *pParse,
@@ -247496,11 +247513,11 @@
247496247513
int nArg, /* Number of args */
247497247514
sqlite3_value **apUnused /* Function arguments */
247498247515
){
247499247516
assert( nArg==0 );
247500247517
UNUSED_PARAM2(nArg, apUnused);
247501
- sqlite3_result_text(pCtx, "fts5: 2023-10-29 20:05:18 ddc6ead6453e0f98943bd07aedd90d47bc2e9e9e27b008d493491168bea2b3f1", -1, SQLITE_TRANSIENT);
247518
+ sqlite3_result_text(pCtx, "fts5: 2023-11-01 11:23:50 17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad81301", -1, SQLITE_TRANSIENT);
247502247519
}
247503247520
247504247521
/*
247505247522
** Return true if zName is the extension on one of the shadow tables used
247506247523
** by this module.
247507247524
--- 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 ** ddc6ead6453e0f98943bd07aedd90d47bc2e.
22 */
23 #define SQLITE_CORE 1
24 #define SQLITE_AMALGAMATION 1
25 #ifndef SQLITE_PRIVATE
26 # define SQLITE_PRIVATE static
@@ -459,11 +459,11 @@
459 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
460 ** [sqlite_version()] and [sqlite_source_id()].
461 */
462 #define SQLITE_VERSION "3.44.0"
463 #define SQLITE_VERSION_NUMBER 3044000
464 #define SQLITE_SOURCE_ID "2023-10-29 20:05:18 ddc6ead6453e0f98943bd07aedd90d47bc2e9e9e27b008d493491168bea2b3f1"
465
466 /*
467 ** CAPI3REF: Run-Time Library Version Numbers
468 ** KEYWORDS: sqlite3_version sqlite3_sourceid
469 **
@@ -62971,10 +62971,17 @@
62971 #ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
62972 if( bBatch ){
62973 rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_BEGIN_ATOMIC_WRITE, 0);
62974 if( rc==SQLITE_OK ){
62975 rc = pager_write_pagelist(pPager, pList);
 
 
 
 
 
 
 
62976 if( rc==SQLITE_OK ){
62977 rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_COMMIT_ATOMIC_WRITE, 0);
62978 }
62979 if( rc!=SQLITE_OK ){
62980 sqlite3OsFileControlHint(fd, SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE, 0);
@@ -109503,11 +109510,12 @@
109503 assert( (int)(sEdupBuf.zEnd - sEdupBuf.zAlloc) >= nNewSize+nToken );
109504 assert( ExprHasProperty(p, EP_Reduced)==0 );
109505 memcpy(sEdupBuf.zAlloc, p, nNewSize);
109506 }else{
109507 u32 nSize = (u32)exprStructSize(p);
109508 assert( (int)(sEdupBuf.zEnd - sEdupBuf.zAlloc) >= EXPR_FULLSIZE+nToken );
 
109509 memcpy(sEdupBuf.zAlloc, p, nSize);
109510 if( nSize<EXPR_FULLSIZE ){
109511 memset(&sEdupBuf.zAlloc[nSize], 0, EXPR_FULLSIZE-nSize);
109512 }
109513 nNewSize = EXPR_FULLSIZE;
@@ -135276,10 +135284,13 @@
135276 int (*value_encoding)(sqlite3_value*);
135277 /* Version 3.41.0 and later */
135278 int (*is_interrupted)(sqlite3*);
135279 /* Version 3.43.0 and later */
135280 int (*stmt_explain)(sqlite3_stmt*,int);
 
 
 
135281 };
135282
135283 /*
135284 ** This is the function signature used for all extension entry points. It
135285 ** is also defined in the file "loadext.c".
@@ -135606,10 +135617,13 @@
135606 #define sqlite3_value_encoding sqlite3_api->value_encoding
135607 /* Version 3.41.0 and later */
135608 #define sqlite3_is_interrupted sqlite3_api->is_interrupted
135609 /* Version 3.43.0 and later */
135610 #define sqlite3_stmt_explain sqlite3_api->stmt_explain
 
 
 
135611 #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
135612
135613 #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
135614 /* This case when the file really is being compiled as a loadable
135615 ** extension */
@@ -136124,11 +136138,14 @@
136124 /* Version 3.40.0 and later */
136125 sqlite3_value_encoding,
136126 /* Version 3.41.0 and later */
136127 sqlite3_is_interrupted,
136128 /* Version 3.43.0 and later */
136129 sqlite3_stmt_explain
 
 
 
136130 };
136131
136132 /* True if x is the directory separator character
136133 */
136134 #if SQLITE_OS_WIN
@@ -147957,14 +147974,14 @@
147957 ** If regAcc is non-zero and there are no min() or max() aggregates
147958 ** in pAggInfo, then only populate the pAggInfo->nAccumulator accumulator
147959 ** registers if register regAcc contains 0. The caller will take care
147960 ** of setting and clearing regAcc.
147961 **
147962 ** For an ORDER BY aggregate, the actually accumulator memory cell update
147963 ** is deferred until after all input rows have been received, so that they
147964 ** can be run in the requested order. In that case, instead of invoking
147965 ** OP_AggStep to update accumulator, just add the arguments that would
147966 ** have been passed into OP_AggStep into the sorting ephemeral table
147967 ** (along with the appropriate sort key).
147968 */
147969 static void updateAccumulator(
147970 Parse *pParse,
@@ -247496,11 +247513,11 @@
247496 int nArg, /* Number of args */
247497 sqlite3_value **apUnused /* Function arguments */
247498 ){
247499 assert( nArg==0 );
247500 UNUSED_PARAM2(nArg, apUnused);
247501 sqlite3_result_text(pCtx, "fts5: 2023-10-29 20:05:18 ddc6ead6453e0f98943bd07aedd90d47bc2e9e9e27b008d493491168bea2b3f1", -1, SQLITE_TRANSIENT);
247502 }
247503
247504 /*
247505 ** Return true if zName is the extension on one of the shadow tables used
247506 ** by this module.
247507
--- 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 ** 17129ba1ff7f0daf37100ee82d507aef7827.
22 */
23 #define SQLITE_CORE 1
24 #define SQLITE_AMALGAMATION 1
25 #ifndef SQLITE_PRIVATE
26 # define SQLITE_PRIVATE static
@@ -459,11 +459,11 @@
459 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
460 ** [sqlite_version()] and [sqlite_source_id()].
461 */
462 #define SQLITE_VERSION "3.44.0"
463 #define SQLITE_VERSION_NUMBER 3044000
464 #define SQLITE_SOURCE_ID "2023-11-01 11:23:50 17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad81301"
465
466 /*
467 ** CAPI3REF: Run-Time Library Version Numbers
468 ** KEYWORDS: sqlite3_version sqlite3_sourceid
469 **
@@ -62971,10 +62971,17 @@
62971 #ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
62972 if( bBatch ){
62973 rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_BEGIN_ATOMIC_WRITE, 0);
62974 if( rc==SQLITE_OK ){
62975 rc = pager_write_pagelist(pPager, pList);
62976 if( rc==SQLITE_OK && pPager->dbSize>pPager->dbFileSize ){
62977 char *pTmp = pPager->pTmpSpace;
62978 int szPage = (int)pPager->pageSize;
62979 memset(pTmp, 0, szPage);
62980 rc = sqlite3OsWrite(pPager->fd, pTmp, szPage,
62981 ((i64)pPager->dbSize*pPager->pageSize)-szPage);
62982 }
62983 if( rc==SQLITE_OK ){
62984 rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_COMMIT_ATOMIC_WRITE, 0);
62985 }
62986 if( rc!=SQLITE_OK ){
62987 sqlite3OsFileControlHint(fd, SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE, 0);
@@ -109503,11 +109510,12 @@
109510 assert( (int)(sEdupBuf.zEnd - sEdupBuf.zAlloc) >= nNewSize+nToken );
109511 assert( ExprHasProperty(p, EP_Reduced)==0 );
109512 memcpy(sEdupBuf.zAlloc, p, nNewSize);
109513 }else{
109514 u32 nSize = (u32)exprStructSize(p);
109515 assert( (int)(sEdupBuf.zEnd - sEdupBuf.zAlloc) >=
109516 (int)EXPR_FULLSIZE+nToken );
109517 memcpy(sEdupBuf.zAlloc, p, nSize);
109518 if( nSize<EXPR_FULLSIZE ){
109519 memset(&sEdupBuf.zAlloc[nSize], 0, EXPR_FULLSIZE-nSize);
109520 }
109521 nNewSize = EXPR_FULLSIZE;
@@ -135276,10 +135284,13 @@
135284 int (*value_encoding)(sqlite3_value*);
135285 /* Version 3.41.0 and later */
135286 int (*is_interrupted)(sqlite3*);
135287 /* Version 3.43.0 and later */
135288 int (*stmt_explain)(sqlite3_stmt*,int);
135289 /* Version 3.44.0 and later */
135290 void *(*get_clientdata)(sqlite3*,const char*);
135291 int (*set_clientdata)(sqlite3*, const char*, void*, void(*)(void*));
135292 };
135293
135294 /*
135295 ** This is the function signature used for all extension entry points. It
135296 ** is also defined in the file "loadext.c".
@@ -135606,10 +135617,13 @@
135617 #define sqlite3_value_encoding sqlite3_api->value_encoding
135618 /* Version 3.41.0 and later */
135619 #define sqlite3_is_interrupted sqlite3_api->is_interrupted
135620 /* Version 3.43.0 and later */
135621 #define sqlite3_stmt_explain sqlite3_api->stmt_explain
135622 /* Version 3.44.0 and later */
135623 #define sqlite3_get_clientdata sqlite3_api->get_clientdata
135624 #define sqlite3_set_clientdata sqlite3_api->set_clientdata
135625 #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
135626
135627 #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
135628 /* This case when the file really is being compiled as a loadable
135629 ** extension */
@@ -136124,11 +136138,14 @@
136138 /* Version 3.40.0 and later */
136139 sqlite3_value_encoding,
136140 /* Version 3.41.0 and later */
136141 sqlite3_is_interrupted,
136142 /* Version 3.43.0 and later */
136143 sqlite3_stmt_explain,
136144 /* Version 3.44.0 and later */
136145 sqlite3_get_clientdata,
136146 sqlite3_set_clientdata
136147 };
136148
136149 /* True if x is the directory separator character
136150 */
136151 #if SQLITE_OS_WIN
@@ -147957,14 +147974,14 @@
147974 ** If regAcc is non-zero and there are no min() or max() aggregates
147975 ** in pAggInfo, then only populate the pAggInfo->nAccumulator accumulator
147976 ** registers if register regAcc contains 0. The caller will take care
147977 ** of setting and clearing regAcc.
147978 **
147979 ** For an ORDER BY aggregate, the actual accumulator memory cell update
147980 ** is deferred until after all input rows have been received, so that they
147981 ** can be run in the requested order. In that case, instead of invoking
147982 ** OP_AggStep to update the accumulator, just add the arguments that would
147983 ** have been passed into OP_AggStep into the sorting ephemeral table
147984 ** (along with the appropriate sort key).
147985 */
147986 static void updateAccumulator(
147987 Parse *pParse,
@@ -247496,11 +247513,11 @@
247513 int nArg, /* Number of args */
247514 sqlite3_value **apUnused /* Function arguments */
247515 ){
247516 assert( nArg==0 );
247517 UNUSED_PARAM2(nArg, apUnused);
247518 sqlite3_result_text(pCtx, "fts5: 2023-11-01 11:23:50 17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad81301", -1, SQLITE_TRANSIENT);
247519 }
247520
247521 /*
247522 ** Return true if zName is the extension on one of the shadow tables used
247523 ** by this module.
247524
--- 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.44.0"
150150
#define SQLITE_VERSION_NUMBER 3044000
151
-#define SQLITE_SOURCE_ID "2023-10-29 20:05:18 ddc6ead6453e0f98943bd07aedd90d47bc2e9e9e27b008d493491168bea2b3f1"
151
+#define SQLITE_SOURCE_ID "2023-11-01 11:23:50 17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad81301"
152152
153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
155155
** KEYWORDS: sqlite3_version sqlite3_sourceid
156156
**
157157
--- 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.44.0"
150 #define SQLITE_VERSION_NUMBER 3044000
151 #define SQLITE_SOURCE_ID "2023-10-29 20:05:18 ddc6ead6453e0f98943bd07aedd90d47bc2e9e9e27b008d493491168bea2b3f1"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
157
--- 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.44.0"
150 #define SQLITE_VERSION_NUMBER 3044000
151 #define SQLITE_SOURCE_ID "2023-11-01 11:23:50 17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad81301"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
157

Keyboard Shortcuts

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