Fossil SCM

Update the built-in SQLite to the latest 3.7.7 alpha that includes the fix for disappearing WAL transactions.

drh 2011-05-20 11:39 trunk
Commit c60e143f287a43d0ec40da89130d50386a3dabc7
3 files changed +11 -8 +12 -2 +1 -1
+11 -8
--- src/shell.c
+++ src/shell.c
@@ -68,21 +68,21 @@
6868
* thus we always assume that we have a console. That can be
6969
* overridden with the -batch command line option.
7070
*/
7171
#define isatty(x) 1
7272
#endif
73
+
74
+/* True if the timer is enabled */
75
+static int enableTimer = 0;
7376
7477
#if !defined(_WIN32) && !defined(WIN32) && !defined(__OS2__) && !defined(__RTP__) && !defined(_WRS_KERNEL)
7578
#include <sys/time.h>
7679
#include <sys/resource.h>
7780
7881
/* Saved resource information for the beginning of an operation */
7982
static struct rusage sBegin;
8083
81
-/* True if the timer is enabled */
82
-static int enableTimer = 0;
83
-
8484
/*
8585
** Begin timing an operation
8686
*/
8787
static void beginTimer(void){
8888
if( enableTimer ){
@@ -122,13 +122,10 @@
122122
static FILETIME ftKernelBegin;
123123
static FILETIME ftUserBegin;
124124
typedef BOOL (WINAPI *GETPROCTIMES)(HANDLE, LPFILETIME, LPFILETIME, LPFILETIME, LPFILETIME);
125125
static GETPROCTIMES getProcessTimesAddr = NULL;
126126
127
-/* True if the timer is enabled */
128
-static int enableTimer = 0;
129
-
130127
/*
131128
** Check to see if we have timer support. Return 1 if necessary
132129
** support found (or found previously).
133130
*/
134131
static int hasTimer(void){
@@ -2197,12 +2194,12 @@
21972194
int i, n;
21982195
open_db(p);
21992196
22002197
/* convert testctrl text option to value. allow any unique prefix
22012198
** of the option name, or a numerical value. */
2202
- n = strlen(azArg[1]);
2203
- for(i=0; i<sizeof(aCtrl)/sizeof(aCtrl[0]); i++){
2199
+ n = strlen30(azArg[1]);
2200
+ for(i=0; i<(int)(sizeof(aCtrl)/sizeof(aCtrl[0])); i++){
22042201
if( strncmp(azArg[1], aCtrl[i].zCtrlName, n)==0 ){
22052202
if( testctrl<0 ){
22062203
testctrl = aCtrl[i].ctrlCode;
22072204
}else{
22082205
fprintf(stderr, "ambiguous option name: \"%s\"\n", azArg[i]);
@@ -2650,10 +2647,11 @@
26502647
static void main_init(struct callback_data *data) {
26512648
memset(data, 0, sizeof(*data));
26522649
data->mode = MODE_List;
26532650
memcpy(data->separator,"|", 2);
26542651
data->showHeader = 0;
2652
+ sqlite3_config(SQLITE_CONFIG_URI, 1);
26552653
sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
26562654
sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
26572655
sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
26582656
sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);
26592657
}
@@ -2664,10 +2662,15 @@
26642662
const char *zInitFile = 0;
26652663
char *zFirstCmd = 0;
26662664
int i;
26672665
int rc = 0;
26682666
2667
+ if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
2668
+ fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
2669
+ sqlite3_sourceid(), SQLITE_SOURCE_ID);
2670
+ exit(1);
2671
+ }
26692672
Argv0 = argv[0];
26702673
main_init(&data);
26712674
stdin_is_interactive = isatty(0);
26722675
26732676
/* Make sure we have a valid signal handler early, before anything
26742677
--- src/shell.c
+++ src/shell.c
@@ -68,21 +68,21 @@
68 * thus we always assume that we have a console. That can be
69 * overridden with the -batch command line option.
70 */
71 #define isatty(x) 1
72 #endif
 
 
 
73
74 #if !defined(_WIN32) && !defined(WIN32) && !defined(__OS2__) && !defined(__RTP__) && !defined(_WRS_KERNEL)
75 #include <sys/time.h>
76 #include <sys/resource.h>
77
78 /* Saved resource information for the beginning of an operation */
79 static struct rusage sBegin;
80
81 /* True if the timer is enabled */
82 static int enableTimer = 0;
83
84 /*
85 ** Begin timing an operation
86 */
87 static void beginTimer(void){
88 if( enableTimer ){
@@ -122,13 +122,10 @@
122 static FILETIME ftKernelBegin;
123 static FILETIME ftUserBegin;
124 typedef BOOL (WINAPI *GETPROCTIMES)(HANDLE, LPFILETIME, LPFILETIME, LPFILETIME, LPFILETIME);
125 static GETPROCTIMES getProcessTimesAddr = NULL;
126
127 /* True if the timer is enabled */
128 static int enableTimer = 0;
129
130 /*
131 ** Check to see if we have timer support. Return 1 if necessary
132 ** support found (or found previously).
133 */
134 static int hasTimer(void){
@@ -2197,12 +2194,12 @@
2197 int i, n;
2198 open_db(p);
2199
2200 /* convert testctrl text option to value. allow any unique prefix
2201 ** of the option name, or a numerical value. */
2202 n = strlen(azArg[1]);
2203 for(i=0; i<sizeof(aCtrl)/sizeof(aCtrl[0]); i++){
2204 if( strncmp(azArg[1], aCtrl[i].zCtrlName, n)==0 ){
2205 if( testctrl<0 ){
2206 testctrl = aCtrl[i].ctrlCode;
2207 }else{
2208 fprintf(stderr, "ambiguous option name: \"%s\"\n", azArg[i]);
@@ -2650,10 +2647,11 @@
2650 static void main_init(struct callback_data *data) {
2651 memset(data, 0, sizeof(*data));
2652 data->mode = MODE_List;
2653 memcpy(data->separator,"|", 2);
2654 data->showHeader = 0;
 
2655 sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
2656 sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
2657 sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
2658 sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);
2659 }
@@ -2664,10 +2662,15 @@
2664 const char *zInitFile = 0;
2665 char *zFirstCmd = 0;
2666 int i;
2667 int rc = 0;
2668
 
 
 
 
 
2669 Argv0 = argv[0];
2670 main_init(&data);
2671 stdin_is_interactive = isatty(0);
2672
2673 /* Make sure we have a valid signal handler early, before anything
2674
--- src/shell.c
+++ src/shell.c
@@ -68,21 +68,21 @@
68 * thus we always assume that we have a console. That can be
69 * overridden with the -batch command line option.
70 */
71 #define isatty(x) 1
72 #endif
73
74 /* True if the timer is enabled */
75 static int enableTimer = 0;
76
77 #if !defined(_WIN32) && !defined(WIN32) && !defined(__OS2__) && !defined(__RTP__) && !defined(_WRS_KERNEL)
78 #include <sys/time.h>
79 #include <sys/resource.h>
80
81 /* Saved resource information for the beginning of an operation */
82 static struct rusage sBegin;
83
 
 
 
84 /*
85 ** Begin timing an operation
86 */
87 static void beginTimer(void){
88 if( enableTimer ){
@@ -122,13 +122,10 @@
122 static FILETIME ftKernelBegin;
123 static FILETIME ftUserBegin;
124 typedef BOOL (WINAPI *GETPROCTIMES)(HANDLE, LPFILETIME, LPFILETIME, LPFILETIME, LPFILETIME);
125 static GETPROCTIMES getProcessTimesAddr = NULL;
126
 
 
 
127 /*
128 ** Check to see if we have timer support. Return 1 if necessary
129 ** support found (or found previously).
130 */
131 static int hasTimer(void){
@@ -2197,12 +2194,12 @@
2194 int i, n;
2195 open_db(p);
2196
2197 /* convert testctrl text option to value. allow any unique prefix
2198 ** of the option name, or a numerical value. */
2199 n = strlen30(azArg[1]);
2200 for(i=0; i<(int)(sizeof(aCtrl)/sizeof(aCtrl[0])); i++){
2201 if( strncmp(azArg[1], aCtrl[i].zCtrlName, n)==0 ){
2202 if( testctrl<0 ){
2203 testctrl = aCtrl[i].ctrlCode;
2204 }else{
2205 fprintf(stderr, "ambiguous option name: \"%s\"\n", azArg[i]);
@@ -2650,10 +2647,11 @@
2647 static void main_init(struct callback_data *data) {
2648 memset(data, 0, sizeof(*data));
2649 data->mode = MODE_List;
2650 memcpy(data->separator,"|", 2);
2651 data->showHeader = 0;
2652 sqlite3_config(SQLITE_CONFIG_URI, 1);
2653 sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
2654 sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
2655 sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
2656 sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);
2657 }
@@ -2664,10 +2662,15 @@
2662 const char *zInitFile = 0;
2663 char *zFirstCmd = 0;
2664 int i;
2665 int rc = 0;
2666
2667 if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
2668 fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
2669 sqlite3_sourceid(), SQLITE_SOURCE_ID);
2670 exit(1);
2671 }
2672 Argv0 = argv[0];
2673 main_init(&data);
2674 stdin_is_interactive = isatty(0);
2675
2676 /* Make sure we have a valid signal handler early, before anything
2677
+12 -2
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -650,11 +650,11 @@
650650
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
651651
** [sqlite_version()] and [sqlite_source_id()].
652652
*/
653653
#define SQLITE_VERSION "3.7.7"
654654
#define SQLITE_VERSION_NUMBER 3007007
655
-#define SQLITE_SOURCE_ID "2011-05-18 03:02:10 186d7ff1d9804d508e472e4939608bf2be67bdc2"
655
+#define SQLITE_SOURCE_ID "2011-05-20 01:50:01 2018d4e108872f2436df046636401b89cfde589d"
656656
657657
/*
658658
** CAPI3REF: Run-Time Library Version Numbers
659659
** KEYWORDS: sqlite3_version, sqlite3_sourceid
660660
**
@@ -42472,15 +42472,25 @@
4247242472
*/
4247342473
sqlite3BackupRestart(pPager->pBackup);
4247442474
}else{
4247542475
if( pagerUseWal(pPager) ){
4247642476
PgHdr *pList = sqlite3PcacheDirtyList(pPager->pPCache);
42477
- if( pList ){
42477
+ PgHdr *pPageOne = 0;
42478
+ if( pList==0 ){
42479
+ /* Must have at least one page for the WAL commit flag.
42480
+ ** Ticket [2d1a5c67dfc2363e44f29d9bbd57f] 2011-05-18 */
42481
+ rc = sqlite3PagerGet(pPager, 1, &pPageOne);
42482
+ pList = pPageOne;
42483
+ pList->pDirty = 0;
42484
+ }
42485
+ assert( rc==SQLITE_OK );
42486
+ if( ALWAYS(pList) ){
4247842487
rc = pagerWalFrames(pPager, pList, pPager->dbSize, 1,
4247942488
(pPager->fullSync ? pPager->syncFlags : 0)
4248042489
);
4248142490
}
42491
+ sqlite3PagerUnref(pPageOne);
4248242492
if( rc==SQLITE_OK ){
4248342493
sqlite3PcacheCleanAll(pPager->pPCache);
4248442494
}
4248542495
}else{
4248642496
/* The following block updates the change-counter. Exactly how it
4248742497
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -650,11 +650,11 @@
650 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
651 ** [sqlite_version()] and [sqlite_source_id()].
652 */
653 #define SQLITE_VERSION "3.7.7"
654 #define SQLITE_VERSION_NUMBER 3007007
655 #define SQLITE_SOURCE_ID "2011-05-18 03:02:10 186d7ff1d9804d508e472e4939608bf2be67bdc2"
656
657 /*
658 ** CAPI3REF: Run-Time Library Version Numbers
659 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
660 **
@@ -42472,15 +42472,25 @@
42472 */
42473 sqlite3BackupRestart(pPager->pBackup);
42474 }else{
42475 if( pagerUseWal(pPager) ){
42476 PgHdr *pList = sqlite3PcacheDirtyList(pPager->pPCache);
42477 if( pList ){
 
 
 
 
 
 
 
 
 
42478 rc = pagerWalFrames(pPager, pList, pPager->dbSize, 1,
42479 (pPager->fullSync ? pPager->syncFlags : 0)
42480 );
42481 }
 
42482 if( rc==SQLITE_OK ){
42483 sqlite3PcacheCleanAll(pPager->pPCache);
42484 }
42485 }else{
42486 /* The following block updates the change-counter. Exactly how it
42487
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -650,11 +650,11 @@
650 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
651 ** [sqlite_version()] and [sqlite_source_id()].
652 */
653 #define SQLITE_VERSION "3.7.7"
654 #define SQLITE_VERSION_NUMBER 3007007
655 #define SQLITE_SOURCE_ID "2011-05-20 01:50:01 2018d4e108872f2436df046636401b89cfde589d"
656
657 /*
658 ** CAPI3REF: Run-Time Library Version Numbers
659 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
660 **
@@ -42472,15 +42472,25 @@
42472 */
42473 sqlite3BackupRestart(pPager->pBackup);
42474 }else{
42475 if( pagerUseWal(pPager) ){
42476 PgHdr *pList = sqlite3PcacheDirtyList(pPager->pPCache);
42477 PgHdr *pPageOne = 0;
42478 if( pList==0 ){
42479 /* Must have at least one page for the WAL commit flag.
42480 ** Ticket [2d1a5c67dfc2363e44f29d9bbd57f] 2011-05-18 */
42481 rc = sqlite3PagerGet(pPager, 1, &pPageOne);
42482 pList = pPageOne;
42483 pList->pDirty = 0;
42484 }
42485 assert( rc==SQLITE_OK );
42486 if( ALWAYS(pList) ){
42487 rc = pagerWalFrames(pPager, pList, pPager->dbSize, 1,
42488 (pPager->fullSync ? pPager->syncFlags : 0)
42489 );
42490 }
42491 sqlite3PagerUnref(pPageOne);
42492 if( rc==SQLITE_OK ){
42493 sqlite3PcacheCleanAll(pPager->pPCache);
42494 }
42495 }else{
42496 /* The following block updates the change-counter. Exactly how it
42497
+1 -1
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107107
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108108
** [sqlite_version()] and [sqlite_source_id()].
109109
*/
110110
#define SQLITE_VERSION "3.7.7"
111111
#define SQLITE_VERSION_NUMBER 3007007
112
-#define SQLITE_SOURCE_ID "2011-05-18 03:02:10 186d7ff1d9804d508e472e4939608bf2be67bdc2"
112
+#define SQLITE_SOURCE_ID "2011-05-20 01:50:01 2018d4e108872f2436df046636401b89cfde589d"
113113
114114
/*
115115
** CAPI3REF: Run-Time Library Version Numbers
116116
** KEYWORDS: sqlite3_version, sqlite3_sourceid
117117
**
118118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.7.7"
111 #define SQLITE_VERSION_NUMBER 3007007
112 #define SQLITE_SOURCE_ID "2011-05-18 03:02:10 186d7ff1d9804d508e472e4939608bf2be67bdc2"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.7.7"
111 #define SQLITE_VERSION_NUMBER 3007007
112 #define SQLITE_SOURCE_ID "2011-05-20 01:50:01 2018d4e108872f2436df046636401b89cfde589d"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118

Keyboard Shortcuts

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