Fossil SCM

Update the built-in SQLite to the latest 3.25.0 alpha that includes support for the SQLITE_FCNTL_DATA_VERSION file control.

drh 2018-07-18 19:11 trunk
Commit abacf2e5bfd83f5206b6c304c3f270d6d0e450212b0b6febd2388ee5fc99f942
3 files changed +3 +94 -32 +56 -10
--- src/shell.c
+++ src/shell.c
@@ -11854,10 +11854,11 @@
1185411854
"SELECT count(*) FROM %s WHERE type='view'" },
1185511855
{ "schema size:",
1185611856
"SELECT total(length(sql)) FROM %s" },
1185711857
};
1185811858
int i;
11859
+ unsigned iDataVersion;
1185911860
char *zSchemaTab;
1186011861
char *zDb = nArg>=2 ? azArg[1] : "main";
1186111862
sqlite3_stmt *pStmt = 0;
1186211863
unsigned char aHdr[100];
1186311864
open_db(p, 0);
@@ -11906,10 +11907,12 @@
1190611907
int val = db_int(p, zSql);
1190711908
sqlite3_free(zSql);
1190811909
utf8_printf(p->out, "%-20s %d\n", aQuery[i].zName, val);
1190911910
}
1191011911
sqlite3_free(zSchemaTab);
11912
+ sqlite3_file_control(p->db, zDb, SQLITE_FCNTL_DATA_VERSION, &iDataVersion);
11913
+ utf8_printf(p->out, "%-20s %u\n", "data version", iDataVersion);
1191111914
return 0;
1191211915
}
1191311916
1191411917
/*
1191511918
** Print the current sqlite3_errmsg() value to stderr and return 1.
1191611919
--- src/shell.c
+++ src/shell.c
@@ -11854,10 +11854,11 @@
11854 "SELECT count(*) FROM %s WHERE type='view'" },
11855 { "schema size:",
11856 "SELECT total(length(sql)) FROM %s" },
11857 };
11858 int i;
 
11859 char *zSchemaTab;
11860 char *zDb = nArg>=2 ? azArg[1] : "main";
11861 sqlite3_stmt *pStmt = 0;
11862 unsigned char aHdr[100];
11863 open_db(p, 0);
@@ -11906,10 +11907,12 @@
11906 int val = db_int(p, zSql);
11907 sqlite3_free(zSql);
11908 utf8_printf(p->out, "%-20s %d\n", aQuery[i].zName, val);
11909 }
11910 sqlite3_free(zSchemaTab);
 
 
11911 return 0;
11912 }
11913
11914 /*
11915 ** Print the current sqlite3_errmsg() value to stderr and return 1.
11916
--- src/shell.c
+++ src/shell.c
@@ -11854,10 +11854,11 @@
11854 "SELECT count(*) FROM %s WHERE type='view'" },
11855 { "schema size:",
11856 "SELECT total(length(sql)) FROM %s" },
11857 };
11858 int i;
11859 unsigned iDataVersion;
11860 char *zSchemaTab;
11861 char *zDb = nArg>=2 ? azArg[1] : "main";
11862 sqlite3_stmt *pStmt = 0;
11863 unsigned char aHdr[100];
11864 open_db(p, 0);
@@ -11906,10 +11907,12 @@
11907 int val = db_int(p, zSql);
11908 sqlite3_free(zSql);
11909 utf8_printf(p->out, "%-20s %d\n", aQuery[i].zName, val);
11910 }
11911 sqlite3_free(zSchemaTab);
11912 sqlite3_file_control(p->db, zDb, SQLITE_FCNTL_DATA_VERSION, &iDataVersion);
11913 utf8_printf(p->out, "%-20s %u\n", "data version", iDataVersion);
11914 return 0;
11915 }
11916
11917 /*
11918 ** Print the current sqlite3_errmsg() value to stderr and return 1.
11919
+94 -32
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1150,11 +1150,11 @@
11501150
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
11511151
** [sqlite_version()] and [sqlite_source_id()].
11521152
*/
11531153
#define SQLITE_VERSION "3.25.0"
11541154
#define SQLITE_VERSION_NUMBER 3025000
1155
-#define SQLITE_SOURCE_ID "2018-07-13 20:28:54 148d9b61471a874a16a9ec9c9603da03cadb3a40662fb550af51cb36212426b1"
1155
+#define SQLITE_SOURCE_ID "2018-07-18 19:09:07 a5087c5c87ad65f92e3bc96bbc84afb43faf10ab6b9ed3ba16304b5c60ad069f"
11561156
11571157
/*
11581158
** CAPI3REF: Run-Time Library Version Numbers
11591159
** KEYWORDS: sqlite3_version sqlite3_sourceid
11601160
**
@@ -2098,10 +2098,29 @@
20982098
** <li>[[SQLITE_FCNTL_LOCK_TIMEOUT]]
20992099
** The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode causes attempts to obtain
21002100
** a file lock using the xLock or xShmLock methods of the VFS to wait
21012101
** for up to M milliseconds before failing, where M is the single
21022102
** unsigned integer parameter.
2103
+**
2104
+** <li>[[SQLITE_FCNTL_DATA_VERSION]]
2105
+** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
2106
+** a database file. The argument is a pointer to a 32-bit unsigned integer.
2107
+** The "data version" for the pager is written into the pointer. The
2108
+** "data version" changes whenever any change occurs to the corresponding
2109
+** database file, either through SQL statements on the same database
2110
+** connection, or through transactions committed by separate database
2111
+** connections possibly in other processes. The [sqlite3_total_changes()]
2112
+** interface can be used to find if any database on the connection has changed,
2113
+** but that interface response to changes on TEMP as well as MAIN and does
2114
+** not provide a mechanism to detect changes to MAIN only. Also, the
2115
+** [sqlite3_total_changes()] interface response to internal changes only and
2116
+** omits changes made by other database connections. The
2117
+** [PRAGMA data_version] command provide a mechanism to detect changes to
2118
+** a single attached database that occur due to other database connections,
2119
+** but omits changes implemented by the database connection for which it is
2120
+** called. This file control is the only mechanism to detect changes that
2121
+** happen either internally or externally on a single database.
21032122
** </ul>
21042123
*/
21052124
#define SQLITE_FCNTL_LOCKSTATE 1
21062125
#define SQLITE_FCNTL_GET_LOCKPROXYFILE 2
21072126
#define SQLITE_FCNTL_SET_LOCKPROXYFILE 3
@@ -2133,10 +2152,11 @@
21332152
#define SQLITE_FCNTL_PDB 30
21342153
#define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31
21352154
#define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32
21362155
#define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33
21372156
#define SQLITE_FCNTL_LOCK_TIMEOUT 34
2157
+#define SQLITE_FCNTL_DATA_VERSION 35
21382158
21392159
/* deprecated names */
21402160
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
21412161
#define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
21422162
#define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
@@ -3301,16 +3321,21 @@
33013321
** returns the value as set when the calling statement began executing.
33023322
** ^If it is used by the second or subsequent such statement within a trigger
33033323
** program, the value returned reflects the number of rows modified by the
33043324
** previous INSERT, UPDATE or DELETE statement within the same trigger.
33053325
**
3306
-** See also the [sqlite3_total_changes()] interface, the
3307
-** [count_changes pragma], and the [changes() SQL function].
3308
-**
33093326
** If a separate thread makes changes on the same database connection
33103327
** while [sqlite3_changes()] is running then the value returned
33113328
** is unpredictable and not meaningful.
3329
+**
3330
+** See also:
3331
+** <ul>
3332
+** <li> the [sqlite3_total_changes()] interface
3333
+** <li> the [count_changes pragma]
3334
+** <li> the [changes() SQL function]
3335
+** <li> the [data_version pragma]
3336
+** </ul>
33123337
*/
33133338
SQLITE_API int sqlite3_changes(sqlite3*);
33143339
33153340
/*
33163341
** CAPI3REF: Total Number Of Rows Modified
@@ -3324,17 +3349,30 @@
33243349
**
33253350
** ^Changes made as part of [foreign key actions] are included in the
33263351
** count, but those made as part of REPLACE constraint resolution are
33273352
** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
33283353
** are not counted.
3354
+**
3355
+** This the [sqlite3_total_changes(D)] interface only reports the number
3356
+** of rows that changed due to SQL statement run against database
3357
+** connection D. Any changes by other database connections are ignored.
3358
+** To detect changes against a database file from other database
3359
+** connections use the [PRAGMA data_version] command or the
3360
+** [SQLITE_FCNTL_DATA_VERSION] [file control].
33293361
**
3330
-** See also the [sqlite3_changes()] interface, the
3331
-** [count_changes pragma], and the [total_changes() SQL function].
3332
-**
33333362
** If a separate thread makes changes on the same database connection
33343363
** while [sqlite3_total_changes()] is running then the value
33353364
** returned is unpredictable and not meaningful.
3365
+**
3366
+** See also:
3367
+** <ul>
3368
+** <li> the [sqlite3_changes()] interface
3369
+** <li> the [count_changes pragma]
3370
+** <li> the [changes() SQL function]
3371
+** <li> the [data_version pragma]
3372
+** <li> the [SQLITE_FCNTL_DATA_VERSION] [file control]
3373
+** </ul>
33363374
*/
33373375
SQLITE_API int sqlite3_total_changes(sqlite3*);
33383376
33393377
/*
33403378
** CAPI3REF: Interrupt A Long-Running Query
@@ -8102,10 +8140,11 @@
81028140
SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
81038141
81048142
/*
81058143
** CAPI3REF: Low-Level Control Of Database Files
81068144
** METHOD: sqlite3
8145
+** KEYWORDS: {file control}
81078146
**
81088147
** ^The [sqlite3_file_control()] interface makes a direct call to the
81098148
** xFileControl method for the [sqlite3_io_methods] object associated
81108149
** with a particular database identified by the second argument. ^The
81118150
** name of the database is "main" for the main database or "temp" for the
@@ -8116,15 +8155,22 @@
81168155
** ^The third and fourth parameters to this routine
81178156
** are passed directly through to the second and third parameters of
81188157
** the xFileControl method. ^The return value of the xFileControl
81198158
** method becomes the return value of this routine.
81208159
**
8160
+** A few opcodes for [sqlite3_file_control()] are handled directly
8161
+** by the SQLite core and never invoke the
8162
+** sqlite3_io_methods.xFileControl method.
81218163
** ^The [SQLITE_FCNTL_FILE_POINTER] value for the op parameter causes
81228164
** a pointer to the underlying [sqlite3_file] object to be written into
8123
-** the space pointed to by the 4th parameter. ^The [SQLITE_FCNTL_FILE_POINTER]
8124
-** case is a short-circuit path which does not actually invoke the
8125
-** underlying sqlite3_io_methods.xFileControl method.
8165
+** the space pointed to by the 4th parameter. The
8166
+** [SQLITE_FCNTL_JOURNAL_POINTER] works similarly except that it returns
8167
+** the [sqlite3_file] object associated with the journal file instead of
8168
+** the main database. The [SQLITE_FCNTL_VFS_POINTER] opcode returns
8169
+** a pointer to the underlying [sqlite3_vfs] object for the file.
8170
+** The [SQLITE_FCNTL_DATA_VERSION] returns the data version counter
8171
+** from the pager.
81268172
**
81278173
** ^If the second parameter (zDbName) does not match the name of any
81288174
** open database file, then SQLITE_ERROR is returned. ^This error
81298175
** code is not remembered and will not be recalled by [sqlite3_errcode()]
81308176
** or [sqlite3_errmsg()]. The underlying xFileControl method might
@@ -51664,11 +51710,10 @@
5166451710
5166551711
/*
5166651712
** Return the pPager->iDataVersion value
5166751713
*/
5166851714
SQLITE_PRIVATE u32 sqlite3PagerDataVersion(Pager *pPager){
51669
- assert( pPager->eState>PAGER_OPEN );
5167051715
return pPager->iDataVersion;
5167151716
}
5167251717
5167351718
/*
5167451719
** Free all structures in the Pager.aSavepoint[] array and set both
@@ -56282,13 +56327,14 @@
5628256327
/* If this is an in-memory db, or no pages have been written to, or this
5628356328
** function has already been called, it is mostly a no-op. However, any
5628456329
** backup in progress needs to be restarted. */
5628556330
sqlite3BackupRestart(pPager->pBackup);
5628656331
}else{
56332
+ PgHdr *pList;
5628756333
if( pagerUseWal(pPager) ){
56288
- PgHdr *pList = sqlite3PcacheDirtyList(pPager->pPCache);
5628956334
PgHdr *pPageOne = 0;
56335
+ pList = sqlite3PcacheDirtyList(pPager->pPCache);
5629056336
if( pList==0 ){
5629156337
/* Must have at least one page for the WAL commit flag.
5629256338
** Ticket [2d1a5c67dfc2363e44f29d9bbd57f] 2011-05-18 */
5629356339
rc = sqlite3PagerGet(pPager, 1, &pPageOne, 0);
5629456340
pList = pPageOne;
@@ -56305,18 +56351,18 @@
5630556351
}else{
5630656352
/* The bBatch boolean is true if the batch-atomic-write commit method
5630756353
** should be used. No rollback journal is created if batch-atomic-write
5630856354
** is enabled.
5630956355
*/
56310
- sqlite3_file *fd = pPager->fd;
5631156356
#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
56312
- const int bBatch = zMaster==0 /* An SQLITE_IOCAP_BATCH_ATOMIC commit */
56357
+ sqlite3_file *fd = pPager->fd;
56358
+ int bBatch = zMaster==0 /* An SQLITE_IOCAP_BATCH_ATOMIC commit */
5631356359
&& (sqlite3OsDeviceCharacteristics(fd) & SQLITE_IOCAP_BATCH_ATOMIC)
5631456360
&& !pPager->noSync
5631556361
&& sqlite3JournalIsInMemory(pPager->jfd);
5631656362
#else
56317
-# define bBatch 0
56363
+# define bBatch 0
5631856364
#endif
5631956365
5632056366
#ifdef SQLITE_ENABLE_ATOMIC_WRITE
5632156367
/* The following block updates the change-counter. Exactly how it
5632256368
** does this depends on whether or not the atomic-update optimization
@@ -56364,19 +56410,20 @@
5636456410
if( rc==SQLITE_OK ){
5636556411
rc = pager_incr_changecounter(pPager, 0);
5636656412
}
5636756413
}
5636856414
}
56369
-#else
56415
+#else /* SQLITE_ENABLE_ATOMIC_WRITE */
5637056416
#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
5637156417
if( zMaster ){
5637256418
rc = sqlite3JournalCreate(pPager->jfd);
5637356419
if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
56420
+ assert( bBatch==0 );
5637456421
}
5637556422
#endif
5637656423
rc = pager_incr_changecounter(pPager, 0);
56377
-#endif
56424
+#endif /* !SQLITE_ENABLE_ATOMIC_WRITE */
5637856425
if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
5637956426
5638056427
/* Write the master journal name into the journal file. If a master
5638156428
** journal file name has already been written to the journal file,
5638256429
** or if zMaster is NULL (no master journal), then this call is a no-op.
@@ -56396,27 +56443,39 @@
5639656443
** xSync() call will be changed to a no-op by the OS anyhow.
5639756444
*/
5639856445
rc = syncJournal(pPager, 0);
5639956446
if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
5640056447
56448
+ pList = sqlite3PcacheDirtyList(pPager->pPCache);
56449
+#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
5640156450
if( bBatch ){
56402
- /* The pager is now in DBMOD state. But regardless of what happens
56403
- ** next, attempting to play the journal back into the database would
56404
- ** be unsafe. Close it now to make sure that does not happen. */
56405
- sqlite3OsClose(pPager->jfd);
5640656451
rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_BEGIN_ATOMIC_WRITE, 0);
56407
- if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
56408
- }
56409
- rc = pager_write_pagelist(pPager,sqlite3PcacheDirtyList(pPager->pPCache));
56410
- if( bBatch ){
5641156452
if( rc==SQLITE_OK ){
56412
- rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_COMMIT_ATOMIC_WRITE, 0);
56453
+ rc = pager_write_pagelist(pPager, pList);
56454
+ if( rc==SQLITE_OK ){
56455
+ rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_COMMIT_ATOMIC_WRITE, 0);
56456
+ }
56457
+ if( rc!=SQLITE_OK ){
56458
+ sqlite3OsFileControlHint(fd, SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE, 0);
56459
+ }
5641356460
}
56414
- if( rc!=SQLITE_OK ){
56415
- sqlite3OsFileControlHint(fd, SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE, 0);
56461
+
56462
+ if( (rc&0xFF)==SQLITE_IOERR && rc!=SQLITE_IOERR_NOMEM ){
56463
+ rc = sqlite3JournalCreate(pPager->jfd);
56464
+ if( rc!=SQLITE_OK ){
56465
+ sqlite3OsClose(pPager->jfd);
56466
+ }
56467
+ bBatch = 0;
56468
+ }else{
56469
+ sqlite3OsClose(pPager->jfd);
5641656470
}
5641756471
}
56472
+#endif /* SQLITE_ENABLE_BATCH_ATOMIC_WRITE */
56473
+
56474
+ if( bBatch==0 && rc==SQLITE_OK ){
56475
+ rc = pager_write_pagelist(pPager, pList);
56476
+ }
5641856477
5641956478
if( rc!=SQLITE_OK ){
5642056479
assert( rc!=SQLITE_IOERR_BLOCKED );
5642156480
goto commit_phase_one_exit;
5642256481
}
@@ -151804,11 +151863,11 @@
151804151863
}
151805151864
}
151806151865
sqlite3VtabRollback(db);
151807151866
sqlite3EndBenignMalloc();
151808151867
151809
- if( (db->mDbFlags&DBFLAG_SchemaChange)!=0 && db->init.busy==0 ){
151868
+ if( schemaChange ){
151810151869
sqlite3ExpirePreparedStatements(db);
151811151870
sqlite3ResetAllSchemasOfConnection(db);
151812151871
}
151813151872
sqlite3BtreeLeaveAll(db);
151814151873
@@ -154224,10 +154283,13 @@
154224154283
*(sqlite3_vfs**)pArg = sqlite3PagerVfs(pPager);
154225154284
rc = SQLITE_OK;
154226154285
}else if( op==SQLITE_FCNTL_JOURNAL_POINTER ){
154227154286
*(sqlite3_file**)pArg = sqlite3PagerJrnlFile(pPager);
154228154287
rc = SQLITE_OK;
154288
+ }else if( op==SQLITE_FCNTL_DATA_VERSION ){
154289
+ *(unsigned int*)pArg = sqlite3PagerDataVersion(pPager);
154290
+ rc = SQLITE_OK;
154229154291
}else{
154230154292
rc = sqlite3OsFileControl(fd, op, pArg);
154231154293
}
154232154294
sqlite3BtreeLeave(pBtree);
154233154295
}
@@ -211451,11 +211513,11 @@
211451211513
int nArg, /* Number of args */
211452211514
sqlite3_value **apUnused /* Function arguments */
211453211515
){
211454211516
assert( nArg==0 );
211455211517
UNUSED_PARAM2(nArg, apUnused);
211456
- sqlite3_result_text(pCtx, "fts5: 2018-07-13 20:28:54 148d9b61471a874a16a9ec9c9603da03cadb3a40662fb550af51cb36212426b1", -1, SQLITE_TRANSIENT);
211518
+ sqlite3_result_text(pCtx, "fts5: 2018-07-18 19:09:07 a5087c5c87ad65f92e3bc96bbc84afb43faf10ab6b9ed3ba16304b5c60ad069f", -1, SQLITE_TRANSIENT);
211457211519
}
211458211520
211459211521
static int fts5Init(sqlite3 *db){
211460211522
static const sqlite3_module fts5Mod = {
211461211523
/* iVersion */ 2,
@@ -216161,12 +216223,12 @@
216161216223
}
216162216224
#endif /* SQLITE_CORE */
216163216225
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
216164216226
216165216227
/************** End of stmt.c ************************************************/
216166
-#if __LINE__!=216166
216228
+#if __LINE__!=216228
216167216229
#undef SQLITE_SOURCE_ID
216168
-#define SQLITE_SOURCE_ID "2018-07-13 20:28:54 148d9b61471a874a16a9ec9c9603da03cadb3a40662fb550af51cb362124alt2"
216230
+#define SQLITE_SOURCE_ID "2018-07-18 19:09:07 a5087c5c87ad65f92e3bc96bbc84afb43faf10ab6b9ed3ba16304b5c60adalt2"
216169216231
#endif
216170216232
/* Return the source-id for this library */
216171216233
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
216172216234
/************************** End of sqlite3.c ******************************/
216173216235
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1150,11 +1150,11 @@
1150 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1151 ** [sqlite_version()] and [sqlite_source_id()].
1152 */
1153 #define SQLITE_VERSION "3.25.0"
1154 #define SQLITE_VERSION_NUMBER 3025000
1155 #define SQLITE_SOURCE_ID "2018-07-13 20:28:54 148d9b61471a874a16a9ec9c9603da03cadb3a40662fb550af51cb36212426b1"
1156
1157 /*
1158 ** CAPI3REF: Run-Time Library Version Numbers
1159 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1160 **
@@ -2098,10 +2098,29 @@
2098 ** <li>[[SQLITE_FCNTL_LOCK_TIMEOUT]]
2099 ** The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode causes attempts to obtain
2100 ** a file lock using the xLock or xShmLock methods of the VFS to wait
2101 ** for up to M milliseconds before failing, where M is the single
2102 ** unsigned integer parameter.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2103 ** </ul>
2104 */
2105 #define SQLITE_FCNTL_LOCKSTATE 1
2106 #define SQLITE_FCNTL_GET_LOCKPROXYFILE 2
2107 #define SQLITE_FCNTL_SET_LOCKPROXYFILE 3
@@ -2133,10 +2152,11 @@
2133 #define SQLITE_FCNTL_PDB 30
2134 #define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31
2135 #define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32
2136 #define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33
2137 #define SQLITE_FCNTL_LOCK_TIMEOUT 34
 
2138
2139 /* deprecated names */
2140 #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
2141 #define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
2142 #define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
@@ -3301,16 +3321,21 @@
3301 ** returns the value as set when the calling statement began executing.
3302 ** ^If it is used by the second or subsequent such statement within a trigger
3303 ** program, the value returned reflects the number of rows modified by the
3304 ** previous INSERT, UPDATE or DELETE statement within the same trigger.
3305 **
3306 ** See also the [sqlite3_total_changes()] interface, the
3307 ** [count_changes pragma], and the [changes() SQL function].
3308 **
3309 ** If a separate thread makes changes on the same database connection
3310 ** while [sqlite3_changes()] is running then the value returned
3311 ** is unpredictable and not meaningful.
 
 
 
 
 
 
 
 
3312 */
3313 SQLITE_API int sqlite3_changes(sqlite3*);
3314
3315 /*
3316 ** CAPI3REF: Total Number Of Rows Modified
@@ -3324,17 +3349,30 @@
3324 **
3325 ** ^Changes made as part of [foreign key actions] are included in the
3326 ** count, but those made as part of REPLACE constraint resolution are
3327 ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
3328 ** are not counted.
 
 
 
 
 
 
 
3329 **
3330 ** See also the [sqlite3_changes()] interface, the
3331 ** [count_changes pragma], and the [total_changes() SQL function].
3332 **
3333 ** If a separate thread makes changes on the same database connection
3334 ** while [sqlite3_total_changes()] is running then the value
3335 ** returned is unpredictable and not meaningful.
 
 
 
 
 
 
 
 
 
3336 */
3337 SQLITE_API int sqlite3_total_changes(sqlite3*);
3338
3339 /*
3340 ** CAPI3REF: Interrupt A Long-Running Query
@@ -8102,10 +8140,11 @@
8102 SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
8103
8104 /*
8105 ** CAPI3REF: Low-Level Control Of Database Files
8106 ** METHOD: sqlite3
 
8107 **
8108 ** ^The [sqlite3_file_control()] interface makes a direct call to the
8109 ** xFileControl method for the [sqlite3_io_methods] object associated
8110 ** with a particular database identified by the second argument. ^The
8111 ** name of the database is "main" for the main database or "temp" for the
@@ -8116,15 +8155,22 @@
8116 ** ^The third and fourth parameters to this routine
8117 ** are passed directly through to the second and third parameters of
8118 ** the xFileControl method. ^The return value of the xFileControl
8119 ** method becomes the return value of this routine.
8120 **
 
 
 
8121 ** ^The [SQLITE_FCNTL_FILE_POINTER] value for the op parameter causes
8122 ** a pointer to the underlying [sqlite3_file] object to be written into
8123 ** the space pointed to by the 4th parameter. ^The [SQLITE_FCNTL_FILE_POINTER]
8124 ** case is a short-circuit path which does not actually invoke the
8125 ** underlying sqlite3_io_methods.xFileControl method.
 
 
 
 
8126 **
8127 ** ^If the second parameter (zDbName) does not match the name of any
8128 ** open database file, then SQLITE_ERROR is returned. ^This error
8129 ** code is not remembered and will not be recalled by [sqlite3_errcode()]
8130 ** or [sqlite3_errmsg()]. The underlying xFileControl method might
@@ -51664,11 +51710,10 @@
51664
51665 /*
51666 ** Return the pPager->iDataVersion value
51667 */
51668 SQLITE_PRIVATE u32 sqlite3PagerDataVersion(Pager *pPager){
51669 assert( pPager->eState>PAGER_OPEN );
51670 return pPager->iDataVersion;
51671 }
51672
51673 /*
51674 ** Free all structures in the Pager.aSavepoint[] array and set both
@@ -56282,13 +56327,14 @@
56282 /* If this is an in-memory db, or no pages have been written to, or this
56283 ** function has already been called, it is mostly a no-op. However, any
56284 ** backup in progress needs to be restarted. */
56285 sqlite3BackupRestart(pPager->pBackup);
56286 }else{
 
56287 if( pagerUseWal(pPager) ){
56288 PgHdr *pList = sqlite3PcacheDirtyList(pPager->pPCache);
56289 PgHdr *pPageOne = 0;
 
56290 if( pList==0 ){
56291 /* Must have at least one page for the WAL commit flag.
56292 ** Ticket [2d1a5c67dfc2363e44f29d9bbd57f] 2011-05-18 */
56293 rc = sqlite3PagerGet(pPager, 1, &pPageOne, 0);
56294 pList = pPageOne;
@@ -56305,18 +56351,18 @@
56305 }else{
56306 /* The bBatch boolean is true if the batch-atomic-write commit method
56307 ** should be used. No rollback journal is created if batch-atomic-write
56308 ** is enabled.
56309 */
56310 sqlite3_file *fd = pPager->fd;
56311 #ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
56312 const int bBatch = zMaster==0 /* An SQLITE_IOCAP_BATCH_ATOMIC commit */
 
56313 && (sqlite3OsDeviceCharacteristics(fd) & SQLITE_IOCAP_BATCH_ATOMIC)
56314 && !pPager->noSync
56315 && sqlite3JournalIsInMemory(pPager->jfd);
56316 #else
56317 # define bBatch 0
56318 #endif
56319
56320 #ifdef SQLITE_ENABLE_ATOMIC_WRITE
56321 /* The following block updates the change-counter. Exactly how it
56322 ** does this depends on whether or not the atomic-update optimization
@@ -56364,19 +56410,20 @@
56364 if( rc==SQLITE_OK ){
56365 rc = pager_incr_changecounter(pPager, 0);
56366 }
56367 }
56368 }
56369 #else
56370 #ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
56371 if( zMaster ){
56372 rc = sqlite3JournalCreate(pPager->jfd);
56373 if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
 
56374 }
56375 #endif
56376 rc = pager_incr_changecounter(pPager, 0);
56377 #endif
56378 if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
56379
56380 /* Write the master journal name into the journal file. If a master
56381 ** journal file name has already been written to the journal file,
56382 ** or if zMaster is NULL (no master journal), then this call is a no-op.
@@ -56396,27 +56443,39 @@
56396 ** xSync() call will be changed to a no-op by the OS anyhow.
56397 */
56398 rc = syncJournal(pPager, 0);
56399 if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
56400
 
 
56401 if( bBatch ){
56402 /* The pager is now in DBMOD state. But regardless of what happens
56403 ** next, attempting to play the journal back into the database would
56404 ** be unsafe. Close it now to make sure that does not happen. */
56405 sqlite3OsClose(pPager->jfd);
56406 rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_BEGIN_ATOMIC_WRITE, 0);
56407 if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
56408 }
56409 rc = pager_write_pagelist(pPager,sqlite3PcacheDirtyList(pPager->pPCache));
56410 if( bBatch ){
56411 if( rc==SQLITE_OK ){
56412 rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_COMMIT_ATOMIC_WRITE, 0);
 
 
 
 
 
 
56413 }
56414 if( rc!=SQLITE_OK ){
56415 sqlite3OsFileControlHint(fd, SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE, 0);
 
 
 
 
 
 
 
56416 }
56417 }
 
 
 
 
 
56418
56419 if( rc!=SQLITE_OK ){
56420 assert( rc!=SQLITE_IOERR_BLOCKED );
56421 goto commit_phase_one_exit;
56422 }
@@ -151804,11 +151863,11 @@
151804 }
151805 }
151806 sqlite3VtabRollback(db);
151807 sqlite3EndBenignMalloc();
151808
151809 if( (db->mDbFlags&DBFLAG_SchemaChange)!=0 && db->init.busy==0 ){
151810 sqlite3ExpirePreparedStatements(db);
151811 sqlite3ResetAllSchemasOfConnection(db);
151812 }
151813 sqlite3BtreeLeaveAll(db);
151814
@@ -154224,10 +154283,13 @@
154224 *(sqlite3_vfs**)pArg = sqlite3PagerVfs(pPager);
154225 rc = SQLITE_OK;
154226 }else if( op==SQLITE_FCNTL_JOURNAL_POINTER ){
154227 *(sqlite3_file**)pArg = sqlite3PagerJrnlFile(pPager);
154228 rc = SQLITE_OK;
 
 
 
154229 }else{
154230 rc = sqlite3OsFileControl(fd, op, pArg);
154231 }
154232 sqlite3BtreeLeave(pBtree);
154233 }
@@ -211451,11 +211513,11 @@
211451 int nArg, /* Number of args */
211452 sqlite3_value **apUnused /* Function arguments */
211453 ){
211454 assert( nArg==0 );
211455 UNUSED_PARAM2(nArg, apUnused);
211456 sqlite3_result_text(pCtx, "fts5: 2018-07-13 20:28:54 148d9b61471a874a16a9ec9c9603da03cadb3a40662fb550af51cb36212426b1", -1, SQLITE_TRANSIENT);
211457 }
211458
211459 static int fts5Init(sqlite3 *db){
211460 static const sqlite3_module fts5Mod = {
211461 /* iVersion */ 2,
@@ -216161,12 +216223,12 @@
216161 }
216162 #endif /* SQLITE_CORE */
216163 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
216164
216165 /************** End of stmt.c ************************************************/
216166 #if __LINE__!=216166
216167 #undef SQLITE_SOURCE_ID
216168 #define SQLITE_SOURCE_ID "2018-07-13 20:28:54 148d9b61471a874a16a9ec9c9603da03cadb3a40662fb550af51cb362124alt2"
216169 #endif
216170 /* Return the source-id for this library */
216171 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
216172 /************************** End of sqlite3.c ******************************/
216173
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1150,11 +1150,11 @@
1150 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1151 ** [sqlite_version()] and [sqlite_source_id()].
1152 */
1153 #define SQLITE_VERSION "3.25.0"
1154 #define SQLITE_VERSION_NUMBER 3025000
1155 #define SQLITE_SOURCE_ID "2018-07-18 19:09:07 a5087c5c87ad65f92e3bc96bbc84afb43faf10ab6b9ed3ba16304b5c60ad069f"
1156
1157 /*
1158 ** CAPI3REF: Run-Time Library Version Numbers
1159 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1160 **
@@ -2098,10 +2098,29 @@
2098 ** <li>[[SQLITE_FCNTL_LOCK_TIMEOUT]]
2099 ** The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode causes attempts to obtain
2100 ** a file lock using the xLock or xShmLock methods of the VFS to wait
2101 ** for up to M milliseconds before failing, where M is the single
2102 ** unsigned integer parameter.
2103 **
2104 ** <li>[[SQLITE_FCNTL_DATA_VERSION]]
2105 ** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
2106 ** a database file. The argument is a pointer to a 32-bit unsigned integer.
2107 ** The "data version" for the pager is written into the pointer. The
2108 ** "data version" changes whenever any change occurs to the corresponding
2109 ** database file, either through SQL statements on the same database
2110 ** connection, or through transactions committed by separate database
2111 ** connections possibly in other processes. The [sqlite3_total_changes()]
2112 ** interface can be used to find if any database on the connection has changed,
2113 ** but that interface response to changes on TEMP as well as MAIN and does
2114 ** not provide a mechanism to detect changes to MAIN only. Also, the
2115 ** [sqlite3_total_changes()] interface response to internal changes only and
2116 ** omits changes made by other database connections. The
2117 ** [PRAGMA data_version] command provide a mechanism to detect changes to
2118 ** a single attached database that occur due to other database connections,
2119 ** but omits changes implemented by the database connection for which it is
2120 ** called. This file control is the only mechanism to detect changes that
2121 ** happen either internally or externally on a single database.
2122 ** </ul>
2123 */
2124 #define SQLITE_FCNTL_LOCKSTATE 1
2125 #define SQLITE_FCNTL_GET_LOCKPROXYFILE 2
2126 #define SQLITE_FCNTL_SET_LOCKPROXYFILE 3
@@ -2133,10 +2152,11 @@
2152 #define SQLITE_FCNTL_PDB 30
2153 #define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31
2154 #define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32
2155 #define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33
2156 #define SQLITE_FCNTL_LOCK_TIMEOUT 34
2157 #define SQLITE_FCNTL_DATA_VERSION 35
2158
2159 /* deprecated names */
2160 #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
2161 #define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
2162 #define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
@@ -3301,16 +3321,21 @@
3321 ** returns the value as set when the calling statement began executing.
3322 ** ^If it is used by the second or subsequent such statement within a trigger
3323 ** program, the value returned reflects the number of rows modified by the
3324 ** previous INSERT, UPDATE or DELETE statement within the same trigger.
3325 **
 
 
 
3326 ** If a separate thread makes changes on the same database connection
3327 ** while [sqlite3_changes()] is running then the value returned
3328 ** is unpredictable and not meaningful.
3329 **
3330 ** See also:
3331 ** <ul>
3332 ** <li> the [sqlite3_total_changes()] interface
3333 ** <li> the [count_changes pragma]
3334 ** <li> the [changes() SQL function]
3335 ** <li> the [data_version pragma]
3336 ** </ul>
3337 */
3338 SQLITE_API int sqlite3_changes(sqlite3*);
3339
3340 /*
3341 ** CAPI3REF: Total Number Of Rows Modified
@@ -3324,17 +3349,30 @@
3349 **
3350 ** ^Changes made as part of [foreign key actions] are included in the
3351 ** count, but those made as part of REPLACE constraint resolution are
3352 ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
3353 ** are not counted.
3354 **
3355 ** This the [sqlite3_total_changes(D)] interface only reports the number
3356 ** of rows that changed due to SQL statement run against database
3357 ** connection D. Any changes by other database connections are ignored.
3358 ** To detect changes against a database file from other database
3359 ** connections use the [PRAGMA data_version] command or the
3360 ** [SQLITE_FCNTL_DATA_VERSION] [file control].
3361 **
 
 
 
3362 ** If a separate thread makes changes on the same database connection
3363 ** while [sqlite3_total_changes()] is running then the value
3364 ** returned is unpredictable and not meaningful.
3365 **
3366 ** See also:
3367 ** <ul>
3368 ** <li> the [sqlite3_changes()] interface
3369 ** <li> the [count_changes pragma]
3370 ** <li> the [changes() SQL function]
3371 ** <li> the [data_version pragma]
3372 ** <li> the [SQLITE_FCNTL_DATA_VERSION] [file control]
3373 ** </ul>
3374 */
3375 SQLITE_API int sqlite3_total_changes(sqlite3*);
3376
3377 /*
3378 ** CAPI3REF: Interrupt A Long-Running Query
@@ -8102,10 +8140,11 @@
8140 SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
8141
8142 /*
8143 ** CAPI3REF: Low-Level Control Of Database Files
8144 ** METHOD: sqlite3
8145 ** KEYWORDS: {file control}
8146 **
8147 ** ^The [sqlite3_file_control()] interface makes a direct call to the
8148 ** xFileControl method for the [sqlite3_io_methods] object associated
8149 ** with a particular database identified by the second argument. ^The
8150 ** name of the database is "main" for the main database or "temp" for the
@@ -8116,15 +8155,22 @@
8155 ** ^The third and fourth parameters to this routine
8156 ** are passed directly through to the second and third parameters of
8157 ** the xFileControl method. ^The return value of the xFileControl
8158 ** method becomes the return value of this routine.
8159 **
8160 ** A few opcodes for [sqlite3_file_control()] are handled directly
8161 ** by the SQLite core and never invoke the
8162 ** sqlite3_io_methods.xFileControl method.
8163 ** ^The [SQLITE_FCNTL_FILE_POINTER] value for the op parameter causes
8164 ** a pointer to the underlying [sqlite3_file] object to be written into
8165 ** the space pointed to by the 4th parameter. The
8166 ** [SQLITE_FCNTL_JOURNAL_POINTER] works similarly except that it returns
8167 ** the [sqlite3_file] object associated with the journal file instead of
8168 ** the main database. The [SQLITE_FCNTL_VFS_POINTER] opcode returns
8169 ** a pointer to the underlying [sqlite3_vfs] object for the file.
8170 ** The [SQLITE_FCNTL_DATA_VERSION] returns the data version counter
8171 ** from the pager.
8172 **
8173 ** ^If the second parameter (zDbName) does not match the name of any
8174 ** open database file, then SQLITE_ERROR is returned. ^This error
8175 ** code is not remembered and will not be recalled by [sqlite3_errcode()]
8176 ** or [sqlite3_errmsg()]. The underlying xFileControl method might
@@ -51664,11 +51710,10 @@
51710
51711 /*
51712 ** Return the pPager->iDataVersion value
51713 */
51714 SQLITE_PRIVATE u32 sqlite3PagerDataVersion(Pager *pPager){
 
51715 return pPager->iDataVersion;
51716 }
51717
51718 /*
51719 ** Free all structures in the Pager.aSavepoint[] array and set both
@@ -56282,13 +56327,14 @@
56327 /* If this is an in-memory db, or no pages have been written to, or this
56328 ** function has already been called, it is mostly a no-op. However, any
56329 ** backup in progress needs to be restarted. */
56330 sqlite3BackupRestart(pPager->pBackup);
56331 }else{
56332 PgHdr *pList;
56333 if( pagerUseWal(pPager) ){
 
56334 PgHdr *pPageOne = 0;
56335 pList = sqlite3PcacheDirtyList(pPager->pPCache);
56336 if( pList==0 ){
56337 /* Must have at least one page for the WAL commit flag.
56338 ** Ticket [2d1a5c67dfc2363e44f29d9bbd57f] 2011-05-18 */
56339 rc = sqlite3PagerGet(pPager, 1, &pPageOne, 0);
56340 pList = pPageOne;
@@ -56305,18 +56351,18 @@
56351 }else{
56352 /* The bBatch boolean is true if the batch-atomic-write commit method
56353 ** should be used. No rollback journal is created if batch-atomic-write
56354 ** is enabled.
56355 */
 
56356 #ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
56357 sqlite3_file *fd = pPager->fd;
56358 int bBatch = zMaster==0 /* An SQLITE_IOCAP_BATCH_ATOMIC commit */
56359 && (sqlite3OsDeviceCharacteristics(fd) & SQLITE_IOCAP_BATCH_ATOMIC)
56360 && !pPager->noSync
56361 && sqlite3JournalIsInMemory(pPager->jfd);
56362 #else
56363 # define bBatch 0
56364 #endif
56365
56366 #ifdef SQLITE_ENABLE_ATOMIC_WRITE
56367 /* The following block updates the change-counter. Exactly how it
56368 ** does this depends on whether or not the atomic-update optimization
@@ -56364,19 +56410,20 @@
56410 if( rc==SQLITE_OK ){
56411 rc = pager_incr_changecounter(pPager, 0);
56412 }
56413 }
56414 }
56415 #else /* SQLITE_ENABLE_ATOMIC_WRITE */
56416 #ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
56417 if( zMaster ){
56418 rc = sqlite3JournalCreate(pPager->jfd);
56419 if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
56420 assert( bBatch==0 );
56421 }
56422 #endif
56423 rc = pager_incr_changecounter(pPager, 0);
56424 #endif /* !SQLITE_ENABLE_ATOMIC_WRITE */
56425 if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
56426
56427 /* Write the master journal name into the journal file. If a master
56428 ** journal file name has already been written to the journal file,
56429 ** or if zMaster is NULL (no master journal), then this call is a no-op.
@@ -56396,27 +56443,39 @@
56443 ** xSync() call will be changed to a no-op by the OS anyhow.
56444 */
56445 rc = syncJournal(pPager, 0);
56446 if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
56447
56448 pList = sqlite3PcacheDirtyList(pPager->pPCache);
56449 #ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
56450 if( bBatch ){
 
 
 
 
56451 rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_BEGIN_ATOMIC_WRITE, 0);
 
 
 
 
56452 if( rc==SQLITE_OK ){
56453 rc = pager_write_pagelist(pPager, pList);
56454 if( rc==SQLITE_OK ){
56455 rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_COMMIT_ATOMIC_WRITE, 0);
56456 }
56457 if( rc!=SQLITE_OK ){
56458 sqlite3OsFileControlHint(fd, SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE, 0);
56459 }
56460 }
56461
56462 if( (rc&0xFF)==SQLITE_IOERR && rc!=SQLITE_IOERR_NOMEM ){
56463 rc = sqlite3JournalCreate(pPager->jfd);
56464 if( rc!=SQLITE_OK ){
56465 sqlite3OsClose(pPager->jfd);
56466 }
56467 bBatch = 0;
56468 }else{
56469 sqlite3OsClose(pPager->jfd);
56470 }
56471 }
56472 #endif /* SQLITE_ENABLE_BATCH_ATOMIC_WRITE */
56473
56474 if( bBatch==0 && rc==SQLITE_OK ){
56475 rc = pager_write_pagelist(pPager, pList);
56476 }
56477
56478 if( rc!=SQLITE_OK ){
56479 assert( rc!=SQLITE_IOERR_BLOCKED );
56480 goto commit_phase_one_exit;
56481 }
@@ -151804,11 +151863,11 @@
151863 }
151864 }
151865 sqlite3VtabRollback(db);
151866 sqlite3EndBenignMalloc();
151867
151868 if( schemaChange ){
151869 sqlite3ExpirePreparedStatements(db);
151870 sqlite3ResetAllSchemasOfConnection(db);
151871 }
151872 sqlite3BtreeLeaveAll(db);
151873
@@ -154224,10 +154283,13 @@
154283 *(sqlite3_vfs**)pArg = sqlite3PagerVfs(pPager);
154284 rc = SQLITE_OK;
154285 }else if( op==SQLITE_FCNTL_JOURNAL_POINTER ){
154286 *(sqlite3_file**)pArg = sqlite3PagerJrnlFile(pPager);
154287 rc = SQLITE_OK;
154288 }else if( op==SQLITE_FCNTL_DATA_VERSION ){
154289 *(unsigned int*)pArg = sqlite3PagerDataVersion(pPager);
154290 rc = SQLITE_OK;
154291 }else{
154292 rc = sqlite3OsFileControl(fd, op, pArg);
154293 }
154294 sqlite3BtreeLeave(pBtree);
154295 }
@@ -211451,11 +211513,11 @@
211513 int nArg, /* Number of args */
211514 sqlite3_value **apUnused /* Function arguments */
211515 ){
211516 assert( nArg==0 );
211517 UNUSED_PARAM2(nArg, apUnused);
211518 sqlite3_result_text(pCtx, "fts5: 2018-07-18 19:09:07 a5087c5c87ad65f92e3bc96bbc84afb43faf10ab6b9ed3ba16304b5c60ad069f", -1, SQLITE_TRANSIENT);
211519 }
211520
211521 static int fts5Init(sqlite3 *db){
211522 static const sqlite3_module fts5Mod = {
211523 /* iVersion */ 2,
@@ -216161,12 +216223,12 @@
216223 }
216224 #endif /* SQLITE_CORE */
216225 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
216226
216227 /************** End of stmt.c ************************************************/
216228 #if __LINE__!=216228
216229 #undef SQLITE_SOURCE_ID
216230 #define SQLITE_SOURCE_ID "2018-07-18 19:09:07 a5087c5c87ad65f92e3bc96bbc84afb43faf10ab6b9ed3ba16304b5c60adalt2"
216231 #endif
216232 /* Return the source-id for this library */
216233 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
216234 /************************** End of sqlite3.c ******************************/
216235
+56 -10
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123123
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124124
** [sqlite_version()] and [sqlite_source_id()].
125125
*/
126126
#define SQLITE_VERSION "3.25.0"
127127
#define SQLITE_VERSION_NUMBER 3025000
128
-#define SQLITE_SOURCE_ID "2018-07-13 20:28:54 148d9b61471a874a16a9ec9c9603da03cadb3a40662fb550af51cb36212426b1"
128
+#define SQLITE_SOURCE_ID "2018-07-18 19:09:07 a5087c5c87ad65f92e3bc96bbc84afb43faf10ab6b9ed3ba16304b5c60ad069f"
129129
130130
/*
131131
** CAPI3REF: Run-Time Library Version Numbers
132132
** KEYWORDS: sqlite3_version sqlite3_sourceid
133133
**
@@ -1071,10 +1071,29 @@
10711071
** <li>[[SQLITE_FCNTL_LOCK_TIMEOUT]]
10721072
** The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode causes attempts to obtain
10731073
** a file lock using the xLock or xShmLock methods of the VFS to wait
10741074
** for up to M milliseconds before failing, where M is the single
10751075
** unsigned integer parameter.
1076
+**
1077
+** <li>[[SQLITE_FCNTL_DATA_VERSION]]
1078
+** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
1079
+** a database file. The argument is a pointer to a 32-bit unsigned integer.
1080
+** The "data version" for the pager is written into the pointer. The
1081
+** "data version" changes whenever any change occurs to the corresponding
1082
+** database file, either through SQL statements on the same database
1083
+** connection, or through transactions committed by separate database
1084
+** connections possibly in other processes. The [sqlite3_total_changes()]
1085
+** interface can be used to find if any database on the connection has changed,
1086
+** but that interface response to changes on TEMP as well as MAIN and does
1087
+** not provide a mechanism to detect changes to MAIN only. Also, the
1088
+** [sqlite3_total_changes()] interface response to internal changes only and
1089
+** omits changes made by other database connections. The
1090
+** [PRAGMA data_version] command provide a mechanism to detect changes to
1091
+** a single attached database that occur due to other database connections,
1092
+** but omits changes implemented by the database connection for which it is
1093
+** called. This file control is the only mechanism to detect changes that
1094
+** happen either internally or externally on a single database.
10761095
** </ul>
10771096
*/
10781097
#define SQLITE_FCNTL_LOCKSTATE 1
10791098
#define SQLITE_FCNTL_GET_LOCKPROXYFILE 2
10801099
#define SQLITE_FCNTL_SET_LOCKPROXYFILE 3
@@ -1106,10 +1125,11 @@
11061125
#define SQLITE_FCNTL_PDB 30
11071126
#define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31
11081127
#define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32
11091128
#define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33
11101129
#define SQLITE_FCNTL_LOCK_TIMEOUT 34
1130
+#define SQLITE_FCNTL_DATA_VERSION 35
11111131
11121132
/* deprecated names */
11131133
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
11141134
#define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
11151135
#define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
@@ -2274,16 +2294,21 @@
22742294
** returns the value as set when the calling statement began executing.
22752295
** ^If it is used by the second or subsequent such statement within a trigger
22762296
** program, the value returned reflects the number of rows modified by the
22772297
** previous INSERT, UPDATE or DELETE statement within the same trigger.
22782298
**
2279
-** See also the [sqlite3_total_changes()] interface, the
2280
-** [count_changes pragma], and the [changes() SQL function].
2281
-**
22822299
** If a separate thread makes changes on the same database connection
22832300
** while [sqlite3_changes()] is running then the value returned
22842301
** is unpredictable and not meaningful.
2302
+**
2303
+** See also:
2304
+** <ul>
2305
+** <li> the [sqlite3_total_changes()] interface
2306
+** <li> the [count_changes pragma]
2307
+** <li> the [changes() SQL function]
2308
+** <li> the [data_version pragma]
2309
+** </ul>
22852310
*/
22862311
SQLITE_API int sqlite3_changes(sqlite3*);
22872312
22882313
/*
22892314
** CAPI3REF: Total Number Of Rows Modified
@@ -2297,17 +2322,30 @@
22972322
**
22982323
** ^Changes made as part of [foreign key actions] are included in the
22992324
** count, but those made as part of REPLACE constraint resolution are
23002325
** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
23012326
** are not counted.
2327
+**
2328
+** This the [sqlite3_total_changes(D)] interface only reports the number
2329
+** of rows that changed due to SQL statement run against database
2330
+** connection D. Any changes by other database connections are ignored.
2331
+** To detect changes against a database file from other database
2332
+** connections use the [PRAGMA data_version] command or the
2333
+** [SQLITE_FCNTL_DATA_VERSION] [file control].
23022334
**
2303
-** See also the [sqlite3_changes()] interface, the
2304
-** [count_changes pragma], and the [total_changes() SQL function].
2305
-**
23062335
** If a separate thread makes changes on the same database connection
23072336
** while [sqlite3_total_changes()] is running then the value
23082337
** returned is unpredictable and not meaningful.
2338
+**
2339
+** See also:
2340
+** <ul>
2341
+** <li> the [sqlite3_changes()] interface
2342
+** <li> the [count_changes pragma]
2343
+** <li> the [changes() SQL function]
2344
+** <li> the [data_version pragma]
2345
+** <li> the [SQLITE_FCNTL_DATA_VERSION] [file control]
2346
+** </ul>
23092347
*/
23102348
SQLITE_API int sqlite3_total_changes(sqlite3*);
23112349
23122350
/*
23132351
** CAPI3REF: Interrupt A Long-Running Query
@@ -7075,10 +7113,11 @@
70757113
SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
70767114
70777115
/*
70787116
** CAPI3REF: Low-Level Control Of Database Files
70797117
** METHOD: sqlite3
7118
+** KEYWORDS: {file control}
70807119
**
70817120
** ^The [sqlite3_file_control()] interface makes a direct call to the
70827121
** xFileControl method for the [sqlite3_io_methods] object associated
70837122
** with a particular database identified by the second argument. ^The
70847123
** name of the database is "main" for the main database or "temp" for the
@@ -7089,15 +7128,22 @@
70897128
** ^The third and fourth parameters to this routine
70907129
** are passed directly through to the second and third parameters of
70917130
** the xFileControl method. ^The return value of the xFileControl
70927131
** method becomes the return value of this routine.
70937132
**
7133
+** A few opcodes for [sqlite3_file_control()] are handled directly
7134
+** by the SQLite core and never invoke the
7135
+** sqlite3_io_methods.xFileControl method.
70947136
** ^The [SQLITE_FCNTL_FILE_POINTER] value for the op parameter causes
70957137
** a pointer to the underlying [sqlite3_file] object to be written into
7096
-** the space pointed to by the 4th parameter. ^The [SQLITE_FCNTL_FILE_POINTER]
7097
-** case is a short-circuit path which does not actually invoke the
7098
-** underlying sqlite3_io_methods.xFileControl method.
7138
+** the space pointed to by the 4th parameter. The
7139
+** [SQLITE_FCNTL_JOURNAL_POINTER] works similarly except that it returns
7140
+** the [sqlite3_file] object associated with the journal file instead of
7141
+** the main database. The [SQLITE_FCNTL_VFS_POINTER] opcode returns
7142
+** a pointer to the underlying [sqlite3_vfs] object for the file.
7143
+** The [SQLITE_FCNTL_DATA_VERSION] returns the data version counter
7144
+** from the pager.
70997145
**
71007146
** ^If the second parameter (zDbName) does not match the name of any
71017147
** open database file, then SQLITE_ERROR is returned. ^This error
71027148
** code is not remembered and will not be recalled by [sqlite3_errcode()]
71037149
** or [sqlite3_errmsg()]. The underlying xFileControl method might
71047150
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.25.0"
127 #define SQLITE_VERSION_NUMBER 3025000
128 #define SQLITE_SOURCE_ID "2018-07-13 20:28:54 148d9b61471a874a16a9ec9c9603da03cadb3a40662fb550af51cb36212426b1"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
@@ -1071,10 +1071,29 @@
1071 ** <li>[[SQLITE_FCNTL_LOCK_TIMEOUT]]
1072 ** The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode causes attempts to obtain
1073 ** a file lock using the xLock or xShmLock methods of the VFS to wait
1074 ** for up to M milliseconds before failing, where M is the single
1075 ** unsigned integer parameter.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1076 ** </ul>
1077 */
1078 #define SQLITE_FCNTL_LOCKSTATE 1
1079 #define SQLITE_FCNTL_GET_LOCKPROXYFILE 2
1080 #define SQLITE_FCNTL_SET_LOCKPROXYFILE 3
@@ -1106,10 +1125,11 @@
1106 #define SQLITE_FCNTL_PDB 30
1107 #define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31
1108 #define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32
1109 #define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33
1110 #define SQLITE_FCNTL_LOCK_TIMEOUT 34
 
1111
1112 /* deprecated names */
1113 #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
1114 #define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
1115 #define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
@@ -2274,16 +2294,21 @@
2274 ** returns the value as set when the calling statement began executing.
2275 ** ^If it is used by the second or subsequent such statement within a trigger
2276 ** program, the value returned reflects the number of rows modified by the
2277 ** previous INSERT, UPDATE or DELETE statement within the same trigger.
2278 **
2279 ** See also the [sqlite3_total_changes()] interface, the
2280 ** [count_changes pragma], and the [changes() SQL function].
2281 **
2282 ** If a separate thread makes changes on the same database connection
2283 ** while [sqlite3_changes()] is running then the value returned
2284 ** is unpredictable and not meaningful.
 
 
 
 
 
 
 
 
2285 */
2286 SQLITE_API int sqlite3_changes(sqlite3*);
2287
2288 /*
2289 ** CAPI3REF: Total Number Of Rows Modified
@@ -2297,17 +2322,30 @@
2297 **
2298 ** ^Changes made as part of [foreign key actions] are included in the
2299 ** count, but those made as part of REPLACE constraint resolution are
2300 ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
2301 ** are not counted.
 
 
 
 
 
 
 
2302 **
2303 ** See also the [sqlite3_changes()] interface, the
2304 ** [count_changes pragma], and the [total_changes() SQL function].
2305 **
2306 ** If a separate thread makes changes on the same database connection
2307 ** while [sqlite3_total_changes()] is running then the value
2308 ** returned is unpredictable and not meaningful.
 
 
 
 
 
 
 
 
 
2309 */
2310 SQLITE_API int sqlite3_total_changes(sqlite3*);
2311
2312 /*
2313 ** CAPI3REF: Interrupt A Long-Running Query
@@ -7075,10 +7113,11 @@
7075 SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
7076
7077 /*
7078 ** CAPI3REF: Low-Level Control Of Database Files
7079 ** METHOD: sqlite3
 
7080 **
7081 ** ^The [sqlite3_file_control()] interface makes a direct call to the
7082 ** xFileControl method for the [sqlite3_io_methods] object associated
7083 ** with a particular database identified by the second argument. ^The
7084 ** name of the database is "main" for the main database or "temp" for the
@@ -7089,15 +7128,22 @@
7089 ** ^The third and fourth parameters to this routine
7090 ** are passed directly through to the second and third parameters of
7091 ** the xFileControl method. ^The return value of the xFileControl
7092 ** method becomes the return value of this routine.
7093 **
 
 
 
7094 ** ^The [SQLITE_FCNTL_FILE_POINTER] value for the op parameter causes
7095 ** a pointer to the underlying [sqlite3_file] object to be written into
7096 ** the space pointed to by the 4th parameter. ^The [SQLITE_FCNTL_FILE_POINTER]
7097 ** case is a short-circuit path which does not actually invoke the
7098 ** underlying sqlite3_io_methods.xFileControl method.
 
 
 
 
7099 **
7100 ** ^If the second parameter (zDbName) does not match the name of any
7101 ** open database file, then SQLITE_ERROR is returned. ^This error
7102 ** code is not remembered and will not be recalled by [sqlite3_errcode()]
7103 ** or [sqlite3_errmsg()]. The underlying xFileControl method might
7104
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.25.0"
127 #define SQLITE_VERSION_NUMBER 3025000
128 #define SQLITE_SOURCE_ID "2018-07-18 19:09:07 a5087c5c87ad65f92e3bc96bbc84afb43faf10ab6b9ed3ba16304b5c60ad069f"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
@@ -1071,10 +1071,29 @@
1071 ** <li>[[SQLITE_FCNTL_LOCK_TIMEOUT]]
1072 ** The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode causes attempts to obtain
1073 ** a file lock using the xLock or xShmLock methods of the VFS to wait
1074 ** for up to M milliseconds before failing, where M is the single
1075 ** unsigned integer parameter.
1076 **
1077 ** <li>[[SQLITE_FCNTL_DATA_VERSION]]
1078 ** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
1079 ** a database file. The argument is a pointer to a 32-bit unsigned integer.
1080 ** The "data version" for the pager is written into the pointer. The
1081 ** "data version" changes whenever any change occurs to the corresponding
1082 ** database file, either through SQL statements on the same database
1083 ** connection, or through transactions committed by separate database
1084 ** connections possibly in other processes. The [sqlite3_total_changes()]
1085 ** interface can be used to find if any database on the connection has changed,
1086 ** but that interface response to changes on TEMP as well as MAIN and does
1087 ** not provide a mechanism to detect changes to MAIN only. Also, the
1088 ** [sqlite3_total_changes()] interface response to internal changes only and
1089 ** omits changes made by other database connections. The
1090 ** [PRAGMA data_version] command provide a mechanism to detect changes to
1091 ** a single attached database that occur due to other database connections,
1092 ** but omits changes implemented by the database connection for which it is
1093 ** called. This file control is the only mechanism to detect changes that
1094 ** happen either internally or externally on a single database.
1095 ** </ul>
1096 */
1097 #define SQLITE_FCNTL_LOCKSTATE 1
1098 #define SQLITE_FCNTL_GET_LOCKPROXYFILE 2
1099 #define SQLITE_FCNTL_SET_LOCKPROXYFILE 3
@@ -1106,10 +1125,11 @@
1125 #define SQLITE_FCNTL_PDB 30
1126 #define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31
1127 #define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32
1128 #define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33
1129 #define SQLITE_FCNTL_LOCK_TIMEOUT 34
1130 #define SQLITE_FCNTL_DATA_VERSION 35
1131
1132 /* deprecated names */
1133 #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
1134 #define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
1135 #define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
@@ -2274,16 +2294,21 @@
2294 ** returns the value as set when the calling statement began executing.
2295 ** ^If it is used by the second or subsequent such statement within a trigger
2296 ** program, the value returned reflects the number of rows modified by the
2297 ** previous INSERT, UPDATE or DELETE statement within the same trigger.
2298 **
 
 
 
2299 ** If a separate thread makes changes on the same database connection
2300 ** while [sqlite3_changes()] is running then the value returned
2301 ** is unpredictable and not meaningful.
2302 **
2303 ** See also:
2304 ** <ul>
2305 ** <li> the [sqlite3_total_changes()] interface
2306 ** <li> the [count_changes pragma]
2307 ** <li> the [changes() SQL function]
2308 ** <li> the [data_version pragma]
2309 ** </ul>
2310 */
2311 SQLITE_API int sqlite3_changes(sqlite3*);
2312
2313 /*
2314 ** CAPI3REF: Total Number Of Rows Modified
@@ -2297,17 +2322,30 @@
2322 **
2323 ** ^Changes made as part of [foreign key actions] are included in the
2324 ** count, but those made as part of REPLACE constraint resolution are
2325 ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
2326 ** are not counted.
2327 **
2328 ** This the [sqlite3_total_changes(D)] interface only reports the number
2329 ** of rows that changed due to SQL statement run against database
2330 ** connection D. Any changes by other database connections are ignored.
2331 ** To detect changes against a database file from other database
2332 ** connections use the [PRAGMA data_version] command or the
2333 ** [SQLITE_FCNTL_DATA_VERSION] [file control].
2334 **
 
 
 
2335 ** If a separate thread makes changes on the same database connection
2336 ** while [sqlite3_total_changes()] is running then the value
2337 ** returned is unpredictable and not meaningful.
2338 **
2339 ** See also:
2340 ** <ul>
2341 ** <li> the [sqlite3_changes()] interface
2342 ** <li> the [count_changes pragma]
2343 ** <li> the [changes() SQL function]
2344 ** <li> the [data_version pragma]
2345 ** <li> the [SQLITE_FCNTL_DATA_VERSION] [file control]
2346 ** </ul>
2347 */
2348 SQLITE_API int sqlite3_total_changes(sqlite3*);
2349
2350 /*
2351 ** CAPI3REF: Interrupt A Long-Running Query
@@ -7075,10 +7113,11 @@
7113 SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
7114
7115 /*
7116 ** CAPI3REF: Low-Level Control Of Database Files
7117 ** METHOD: sqlite3
7118 ** KEYWORDS: {file control}
7119 **
7120 ** ^The [sqlite3_file_control()] interface makes a direct call to the
7121 ** xFileControl method for the [sqlite3_io_methods] object associated
7122 ** with a particular database identified by the second argument. ^The
7123 ** name of the database is "main" for the main database or "temp" for the
@@ -7089,15 +7128,22 @@
7128 ** ^The third and fourth parameters to this routine
7129 ** are passed directly through to the second and third parameters of
7130 ** the xFileControl method. ^The return value of the xFileControl
7131 ** method becomes the return value of this routine.
7132 **
7133 ** A few opcodes for [sqlite3_file_control()] are handled directly
7134 ** by the SQLite core and never invoke the
7135 ** sqlite3_io_methods.xFileControl method.
7136 ** ^The [SQLITE_FCNTL_FILE_POINTER] value for the op parameter causes
7137 ** a pointer to the underlying [sqlite3_file] object to be written into
7138 ** the space pointed to by the 4th parameter. The
7139 ** [SQLITE_FCNTL_JOURNAL_POINTER] works similarly except that it returns
7140 ** the [sqlite3_file] object associated with the journal file instead of
7141 ** the main database. The [SQLITE_FCNTL_VFS_POINTER] opcode returns
7142 ** a pointer to the underlying [sqlite3_vfs] object for the file.
7143 ** The [SQLITE_FCNTL_DATA_VERSION] returns the data version counter
7144 ** from the pager.
7145 **
7146 ** ^If the second parameter (zDbName) does not match the name of any
7147 ** open database file, then SQLITE_ERROR is returned. ^This error
7148 ** code is not remembered and will not be recalled by [sqlite3_errcode()]
7149 ** or [sqlite3_errmsg()]. The underlying xFileControl method might
7150

Keyboard Shortcuts

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