Fossil SCM

Update the built-in SQLite to the first 3.17.0 release candidate.

drh 2017-02-09 19:56 trunk
Commit e734fdc68d5d74bbfa3f5d3da0f66f0d27629e7e
3 files changed +6 -1 +134 -102 +29 -29
+6 -1
--- src/shell.c
+++ src/shell.c
@@ -4286,19 +4286,24 @@
42864286
const char *zMode = nArg>=2 ? azArg[1] : "";
42874287
int n2 = (int)strlen(zMode);
42884288
int c2 = zMode[0];
42894289
if( c2=='l' && n2>2 && strncmp(azArg[1],"lines",n2)==0 ){
42904290
p->mode = MODE_Line;
4291
+ sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row);
42914292
}else if( c2=='c' && strncmp(azArg[1],"columns",n2)==0 ){
42924293
p->mode = MODE_Column;
4294
+ sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row);
42934295
}else if( c2=='l' && n2>2 && strncmp(azArg[1],"list",n2)==0 ){
42944296
p->mode = MODE_List;
4297
+ sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Column);
4298
+ sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row);
42954299
}else if( c2=='h' && strncmp(azArg[1],"html",n2)==0 ){
42964300
p->mode = MODE_Html;
42974301
}else if( c2=='t' && strncmp(azArg[1],"tcl",n2)==0 ){
42984302
p->mode = MODE_Tcl;
42994303
sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Space);
4304
+ sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row);
43004305
}else if( c2=='c' && strncmp(azArg[1],"csv",n2)==0 ){
43014306
p->mode = MODE_Csv;
43024307
sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Comma);
43034308
sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_CrLf);
43044309
}else if( c2=='t' && strncmp(azArg[1],"tabs",n2)==0 ){
@@ -5295,11 +5300,11 @@
52955300
sqlite3_libversion(), sqlite3_sourceid());
52965301
}else
52975302
52985303
if( c=='v' && strncmp(azArg[0], "vfsinfo", n)==0 ){
52995304
const char *zDbName = nArg==2 ? azArg[1] : "main";
5300
- sqlite3_vfs *pVfs;
5305
+ sqlite3_vfs *pVfs = 0;
53015306
if( p->db ){
53025307
sqlite3_file_control(p->db, zDbName, SQLITE_FCNTL_VFS_POINTER, &pVfs);
53035308
if( pVfs ){
53045309
utf8_printf(p->out, "vfs.zName = \"%s\"\n", pVfs->zName);
53055310
raw_printf(p->out, "vfs.iVersion = %d\n", pVfs->iVersion);
53065311
--- src/shell.c
+++ src/shell.c
@@ -4286,19 +4286,24 @@
4286 const char *zMode = nArg>=2 ? azArg[1] : "";
4287 int n2 = (int)strlen(zMode);
4288 int c2 = zMode[0];
4289 if( c2=='l' && n2>2 && strncmp(azArg[1],"lines",n2)==0 ){
4290 p->mode = MODE_Line;
 
4291 }else if( c2=='c' && strncmp(azArg[1],"columns",n2)==0 ){
4292 p->mode = MODE_Column;
 
4293 }else if( c2=='l' && n2>2 && strncmp(azArg[1],"list",n2)==0 ){
4294 p->mode = MODE_List;
 
 
4295 }else if( c2=='h' && strncmp(azArg[1],"html",n2)==0 ){
4296 p->mode = MODE_Html;
4297 }else if( c2=='t' && strncmp(azArg[1],"tcl",n2)==0 ){
4298 p->mode = MODE_Tcl;
4299 sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Space);
 
4300 }else if( c2=='c' && strncmp(azArg[1],"csv",n2)==0 ){
4301 p->mode = MODE_Csv;
4302 sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Comma);
4303 sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_CrLf);
4304 }else if( c2=='t' && strncmp(azArg[1],"tabs",n2)==0 ){
@@ -5295,11 +5300,11 @@
5295 sqlite3_libversion(), sqlite3_sourceid());
5296 }else
5297
5298 if( c=='v' && strncmp(azArg[0], "vfsinfo", n)==0 ){
5299 const char *zDbName = nArg==2 ? azArg[1] : "main";
5300 sqlite3_vfs *pVfs;
5301 if( p->db ){
5302 sqlite3_file_control(p->db, zDbName, SQLITE_FCNTL_VFS_POINTER, &pVfs);
5303 if( pVfs ){
5304 utf8_printf(p->out, "vfs.zName = \"%s\"\n", pVfs->zName);
5305 raw_printf(p->out, "vfs.iVersion = %d\n", pVfs->iVersion);
5306
--- src/shell.c
+++ src/shell.c
@@ -4286,19 +4286,24 @@
4286 const char *zMode = nArg>=2 ? azArg[1] : "";
4287 int n2 = (int)strlen(zMode);
4288 int c2 = zMode[0];
4289 if( c2=='l' && n2>2 && strncmp(azArg[1],"lines",n2)==0 ){
4290 p->mode = MODE_Line;
4291 sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row);
4292 }else if( c2=='c' && strncmp(azArg[1],"columns",n2)==0 ){
4293 p->mode = MODE_Column;
4294 sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row);
4295 }else if( c2=='l' && n2>2 && strncmp(azArg[1],"list",n2)==0 ){
4296 p->mode = MODE_List;
4297 sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Column);
4298 sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row);
4299 }else if( c2=='h' && strncmp(azArg[1],"html",n2)==0 ){
4300 p->mode = MODE_Html;
4301 }else if( c2=='t' && strncmp(azArg[1],"tcl",n2)==0 ){
4302 p->mode = MODE_Tcl;
4303 sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Space);
4304 sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row);
4305 }else if( c2=='c' && strncmp(azArg[1],"csv",n2)==0 ){
4306 p->mode = MODE_Csv;
4307 sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Comma);
4308 sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_CrLf);
4309 }else if( c2=='t' && strncmp(azArg[1],"tabs",n2)==0 ){
@@ -5295,11 +5300,11 @@
5300 sqlite3_libversion(), sqlite3_sourceid());
5301 }else
5302
5303 if( c=='v' && strncmp(azArg[0], "vfsinfo", n)==0 ){
5304 const char *zDbName = nArg==2 ? azArg[1] : "main";
5305 sqlite3_vfs *pVfs = 0;
5306 if( p->db ){
5307 sqlite3_file_control(p->db, zDbName, SQLITE_FCNTL_VFS_POINTER, &pVfs);
5308 if( pVfs ){
5309 utf8_printf(p->out, "vfs.zName = \"%s\"\n", pVfs->zName);
5310 raw_printf(p->out, "vfs.iVersion = %d\n", pVfs->iVersion);
5311
+134 -102
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -202,23 +202,31 @@
202202
# define _FILE_OFFSET_BITS 64
203203
# endif
204204
# define _LARGEFILE_SOURCE 1
205205
#endif
206206
207
-/* What version of GCC is being used. 0 means GCC is not being used */
208
-#ifdef __GNUC__
207
+/* The GCC_VERSION, CLANG_VERSION, and MSVC_VERSION macros are used to
208
+** conditionally include optimizations for each of these compilers. A
209
+** value of 0 means that compiler is not being used. The
210
+** SQLITE_DISABLE_INTRINSIC macro means do not use any compiler-specific
211
+** optimizations, and hence set all compiler macros to 0
212
+*/
213
+#if defined(__GNUC__) && !defined(SQLITE_DISABLE_INTRINSIC)
209214
# define GCC_VERSION (__GNUC__*1000000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__)
210215
#else
211216
# define GCC_VERSION 0
212217
#endif
213
-
214
-/* What version of CLANG is being used. 0 means CLANG is not being used */
215
-#if defined(__clang__) && !defined(_WIN32)
218
+#if defined(__clang__) && !defined(_WIN32) && !defined(SQLITE_DISABLE_INTRINSIC)
216219
# define CLANG_VERSION \
217220
(__clang_major__*1000000+__clang_minor__*1000+__clang_patchlevel__)
218221
#else
219222
# define CLANG_VERSION 0
223
+#endif
224
+#if defined(_MSC_VER) && !defined(SQLITE_DISABLE_INTRINSIC)
225
+# define MSVC_VERSION _MSC_VER
226
+#else
227
+# define MSVC_VERSION 0
220228
#endif
221229
222230
/* Needed for various definitions... */
223231
#if defined(__GNUC__) && !defined(_GNU_SOURCE)
224232
# define _GNU_SOURCE
@@ -389,11 +397,11 @@
389397
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
390398
** [sqlite_version()] and [sqlite_source_id()].
391399
*/
392400
#define SQLITE_VERSION "3.17.0"
393401
#define SQLITE_VERSION_NUMBER 3017000
394
-#define SQLITE_SOURCE_ID "2017-02-07 13:51:48 a136609c98ed3cc673c5a3c2578d49db3f2518d1"
402
+#define SQLITE_SOURCE_ID "2017-02-09 17:12:22 798fb9d70d2e5f95e64237b04d6692360133381a"
395403
396404
/*
397405
** CAPI3REF: Run-Time Library Version Numbers
398406
** KEYWORDS: sqlite3_version sqlite3_sourceid
399407
**
@@ -8916,11 +8924,11 @@
89168924
** The session object will be used to create changesets for tables in
89178925
** database zDb, where zDb is either "main", or "temp", or the name of an
89188926
** attached database. It is not an error if database zDb is not attached
89198927
** to the database when the session object is created.
89208928
*/
8921
-int sqlite3session_create(
8929
+SQLITE_API int sqlite3session_create(
89228930
sqlite3 *db, /* Database handle */
89238931
const char *zDb, /* Name of db (e.g. "main") */
89248932
sqlite3_session **ppSession /* OUT: New session object */
89258933
);
89268934
@@ -8934,11 +8942,11 @@
89348942
**
89358943
** Session objects must be deleted before the database handle to which they
89368944
** are attached is closed. Refer to the documentation for
89378945
** [sqlite3session_create()] for details.
89388946
*/
8939
-void sqlite3session_delete(sqlite3_session *pSession);
8947
+SQLITE_API void sqlite3session_delete(sqlite3_session *pSession);
89408948
89418949
89428950
/*
89438951
** CAPI3REF: Enable Or Disable A Session Object
89448952
**
@@ -8954,11 +8962,11 @@
89548962
** no-op, and may be used to query the current state of the session.
89558963
**
89568964
** The return value indicates the final state of the session object: 0 if
89578965
** the session is disabled, or 1 if it is enabled.
89588966
*/
8959
-int sqlite3session_enable(sqlite3_session *pSession, int bEnable);
8967
+SQLITE_API int sqlite3session_enable(sqlite3_session *pSession, int bEnable);
89608968
89618969
/*
89628970
** CAPI3REF: Set Or Clear the Indirect Change Flag
89638971
**
89648972
** Each change recorded by a session object is marked as either direct or
@@ -8983,11 +8991,11 @@
89838991
** indirect flag for the specified session object.
89848992
**
89858993
** The return value indicates the final state of the indirect flag: 0 if
89868994
** it is clear, or 1 if it is set.
89878995
*/
8988
-int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect);
8996
+SQLITE_API int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect);
89898997
89908998
/*
89918999
** CAPI3REF: Attach A Table To A Session Object
89929000
**
89939001
** If argument zTab is not NULL, then it is the name of a table to attach
@@ -9013,11 +9021,11 @@
90139021
** in one or more of their PRIMARY KEY columns.
90149022
**
90159023
** SQLITE_OK is returned if the call completes without error. Or, if an error
90169024
** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned.
90179025
*/
9018
-int sqlite3session_attach(
9026
+SQLITE_API int sqlite3session_attach(
90199027
sqlite3_session *pSession, /* Session object */
90209028
const char *zTab /* Table name */
90219029
);
90229030
90239031
/*
@@ -9027,11 +9035,11 @@
90279035
** in tables that are not attached to the Session object, the filter is called
90289036
** to determine whether changes to the table's rows should be tracked or not.
90299037
** If xFilter returns 0, changes is not tracked. Note that once a table is
90309038
** attached, xFilter will not be called again.
90319039
*/
9032
-void sqlite3session_table_filter(
9040
+SQLITE_API void sqlite3session_table_filter(
90339041
sqlite3_session *pSession, /* Session object */
90349042
int(*xFilter)(
90359043
void *pCtx, /* Copy of third arg to _filter_table() */
90369044
const char *zTab /* Table name */
90379045
),
@@ -9140,11 +9148,11 @@
91409148
** changeset, even though the delete took place while the session was disabled.
91419149
** Or, if one field of a row is updated while a session is disabled, and
91429150
** another field of the same row is updated while the session is enabled, the
91439151
** resulting changeset will contain an UPDATE change that updates both fields.
91449152
*/
9145
-int sqlite3session_changeset(
9153
+SQLITE_API int sqlite3session_changeset(
91469154
sqlite3_session *pSession, /* Session object */
91479155
int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */
91489156
void **ppChangeset /* OUT: Buffer containing changeset */
91499157
);
91509158
@@ -9202,11 +9210,11 @@
92029210
** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
92039211
** may be set to point to a buffer containing an English language error
92049212
** message. It is the responsibility of the caller to free this buffer using
92059213
** sqlite3_free().
92069214
*/
9207
-int sqlite3session_diff(
9215
+SQLITE_API int sqlite3session_diff(
92089216
sqlite3_session *pSession,
92099217
const char *zFromDb,
92109218
const char *zTbl,
92119219
char **pzErrMsg
92129220
);
@@ -9238,11 +9246,11 @@
92389246
** Changes within a patchset are ordered in the same way as for changesets
92399247
** generated by the sqlite3session_changeset() function (i.e. all changes for
92409248
** a single table are grouped together, tables appear in the order in which
92419249
** they were attached to the session object).
92429250
*/
9243
-int sqlite3session_patchset(
9251
+SQLITE_API int sqlite3session_patchset(
92449252
sqlite3_session *pSession, /* Session object */
92459253
int *pnPatchset, /* OUT: Size of buffer at *ppChangeset */
92469254
void **ppPatchset /* OUT: Buffer containing changeset */
92479255
);
92489256
@@ -9259,11 +9267,11 @@
92599267
** an attached table is modified and then later on the original values
92609268
** are restored. However, if this function returns non-zero, then it is
92619269
** guaranteed that a call to sqlite3session_changeset() will return a
92629270
** changeset containing zero changes.
92639271
*/
9264
-int sqlite3session_isempty(sqlite3_session *pSession);
9272
+SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession);
92659273
92669274
/*
92679275
** CAPI3REF: Create An Iterator To Traverse A Changeset
92689276
**
92699277
** Create an iterator used to iterate through the contents of a changeset.
@@ -9294,11 +9302,11 @@
92949302
** this function, all changes that relate to a single table are visited
92959303
** consecutively. There is no chance that the iterator will visit a change
92969304
** the applies to table X, then one for table Y, and then later on visit
92979305
** another change for table X.
92989306
*/
9299
-int sqlite3changeset_start(
9307
+SQLITE_API int sqlite3changeset_start(
93009308
sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */
93019309
int nChangeset, /* Size of changeset blob in bytes */
93029310
void *pChangeset /* Pointer to blob containing changeset */
93039311
);
93049312
@@ -9323,11 +9331,11 @@
93239331
**
93249332
** If an error occurs, an SQLite error code is returned. Possible error
93259333
** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or
93269334
** SQLITE_NOMEM.
93279335
*/
9328
-int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
9336
+SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
93299337
93309338
/*
93319339
** CAPI3REF: Obtain The Current Operation From A Changeset Iterator
93329340
**
93339341
** The pIter argument passed to this function may either be an iterator
@@ -9351,11 +9359,11 @@
93519359
**
93529360
** If no error occurs, SQLITE_OK is returned. If an error does occur, an
93539361
** SQLite error code is returned. The values of the output variables may not
93549362
** be trusted in this case.
93559363
*/
9356
-int sqlite3changeset_op(
9364
+SQLITE_API int sqlite3changeset_op(
93579365
sqlite3_changeset_iter *pIter, /* Iterator object */
93589366
const char **pzTab, /* OUT: Pointer to table name */
93599367
int *pnCol, /* OUT: Number of columns in table */
93609368
int *pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */
93619369
int *pbIndirect /* OUT: True for an 'indirect' change */
@@ -9384,11 +9392,11 @@
93849392
** If this function is called when the iterator does not point to a valid
93859393
** entry, SQLITE_MISUSE is returned and the output variables zeroed. Otherwise,
93869394
** SQLITE_OK is returned and the output variables populated as described
93879395
** above.
93889396
*/
9389
-int sqlite3changeset_pk(
9397
+SQLITE_API int sqlite3changeset_pk(
93909398
sqlite3_changeset_iter *pIter, /* Iterator object */
93919399
unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */
93929400
int *pnCol /* OUT: Number of entries in output array */
93939401
);
93949402
@@ -9414,11 +9422,11 @@
94149422
** is similar to the "old.*" columns available to update or delete triggers.
94159423
**
94169424
** If some other error occurs (e.g. an OOM condition), an SQLite error code
94179425
** is returned and *ppValue is set to NULL.
94189426
*/
9419
-int sqlite3changeset_old(
9427
+SQLITE_API int sqlite3changeset_old(
94209428
sqlite3_changeset_iter *pIter, /* Changeset iterator */
94219429
int iVal, /* Column number */
94229430
sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */
94239431
);
94249432
@@ -9447,11 +9455,11 @@
94479455
** triggers.
94489456
**
94499457
** If some other error occurs (e.g. an OOM condition), an SQLite error code
94509458
** is returned and *ppValue is set to NULL.
94519459
*/
9452
-int sqlite3changeset_new(
9460
+SQLITE_API int sqlite3changeset_new(
94539461
sqlite3_changeset_iter *pIter, /* Changeset iterator */
94549462
int iVal, /* Column number */
94559463
sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */
94569464
);
94579465
@@ -9474,11 +9482,11 @@
94749482
** and returns SQLITE_OK.
94759483
**
94769484
** If some other error occurs (e.g. an OOM condition), an SQLite error code
94779485
** is returned and *ppValue is set to NULL.
94789486
*/
9479
-int sqlite3changeset_conflict(
9487
+SQLITE_API int sqlite3changeset_conflict(
94809488
sqlite3_changeset_iter *pIter, /* Changeset iterator */
94819489
int iVal, /* Column number */
94829490
sqlite3_value **ppValue /* OUT: Value from conflicting row */
94839491
);
94849492
@@ -9490,11 +9498,11 @@
94909498
** it sets the output variable to the total number of known foreign key
94919499
** violations in the destination database and returns SQLITE_OK.
94929500
**
94939501
** In all other cases this function returns SQLITE_MISUSE.
94949502
*/
9495
-int sqlite3changeset_fk_conflicts(
9503
+SQLITE_API int sqlite3changeset_fk_conflicts(
94969504
sqlite3_changeset_iter *pIter, /* Changeset iterator */
94979505
int *pnOut /* OUT: Number of FK violations */
94989506
);
94999507
95009508
@@ -9523,11 +9531,11 @@
95239531
** rc = sqlite3changeset_finalize();
95249532
** if( rc!=SQLITE_OK ){
95259533
** // An error has occurred
95269534
** }
95279535
*/
9528
-int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter);
9536
+SQLITE_API int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter);
95299537
95309538
/*
95319539
** CAPI3REF: Invert A Changeset
95329540
**
95339541
** This function is used to "invert" a changeset object. Applying an inverted
@@ -9553,11 +9561,11 @@
95539561
** call to this function.
95549562
**
95559563
** WARNING/TODO: This function currently assumes that the input is a valid
95569564
** changeset. If it is not, the results are undefined.
95579565
*/
9558
-int sqlite3changeset_invert(
9566
+SQLITE_API int sqlite3changeset_invert(
95599567
int nIn, const void *pIn, /* Input changeset */
95609568
int *pnOut, void **ppOut /* OUT: Inverse of input */
95619569
);
95629570
95639571
/*
@@ -9582,11 +9590,11 @@
95829590
** *pnOut = 0;
95839591
** }
95849592
**
95859593
** Refer to the sqlite3_changegroup documentation below for details.
95869594
*/
9587
-int sqlite3changeset_concat(
9595
+SQLITE_API int sqlite3changeset_concat(
95889596
int nA, /* Number of bytes in buffer pA */
95899597
void *pA, /* Pointer to buffer containing changeset A */
95909598
int nB, /* Number of bytes in buffer pB */
95919599
void *pB, /* Pointer to buffer containing changeset B */
95929600
int *pnOut, /* OUT: Number of bytes in output changeset */
@@ -9888,11 +9896,11 @@
98889896
** If any other error (aside from a constraint failure when attempting to
98899897
** write to the target database) occurs, then the savepoint transaction is
98909898
** rolled back, restoring the target database to its original state, and an
98919899
** SQLite error code returned.
98929900
*/
9893
-int sqlite3changeset_apply(
9901
+SQLITE_API int sqlite3changeset_apply(
98949902
sqlite3 *db, /* Apply change to "main" db of this handle */
98959903
int nChangeset, /* Size of changeset in bytes */
98969904
void *pChangeset, /* Changeset blob */
98979905
int(*xFilter)(
98989906
void *pCtx, /* Copy of sixth arg to _apply() */
@@ -10089,11 +10097,11 @@
1008910097
**
1009010098
** The sessions module never invokes an xOutput callback with the third
1009110099
** parameter set to a value less than or equal to zero. Other than this,
1009210100
** no guarantees are made as to the size of the chunks of data returned.
1009310101
*/
10094
-int sqlite3changeset_apply_strm(
10102
+SQLITE_API int sqlite3changeset_apply_strm(
1009510103
sqlite3 *db, /* Apply change to "main" db of this handle */
1009610104
int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */
1009710105
void *pIn, /* First arg for xInput */
1009810106
int(*xFilter)(
1009910107
void *pCtx, /* Copy of sixth arg to _apply() */
@@ -10104,35 +10112,35 @@
1010410112
int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
1010510113
sqlite3_changeset_iter *p /* Handle describing change and conflict */
1010610114
),
1010710115
void *pCtx /* First argument passed to xConflict */
1010810116
);
10109
-int sqlite3changeset_concat_strm(
10117
+SQLITE_API int sqlite3changeset_concat_strm(
1011010118
int (*xInputA)(void *pIn, void *pData, int *pnData),
1011110119
void *pInA,
1011210120
int (*xInputB)(void *pIn, void *pData, int *pnData),
1011310121
void *pInB,
1011410122
int (*xOutput)(void *pOut, const void *pData, int nData),
1011510123
void *pOut
1011610124
);
10117
-int sqlite3changeset_invert_strm(
10125
+SQLITE_API int sqlite3changeset_invert_strm(
1011810126
int (*xInput)(void *pIn, void *pData, int *pnData),
1011910127
void *pIn,
1012010128
int (*xOutput)(void *pOut, const void *pData, int nData),
1012110129
void *pOut
1012210130
);
10123
-int sqlite3changeset_start_strm(
10131
+SQLITE_API int sqlite3changeset_start_strm(
1012410132
sqlite3_changeset_iter **pp,
1012510133
int (*xInput)(void *pIn, void *pData, int *pnData),
1012610134
void *pIn
1012710135
);
10128
-int sqlite3session_changeset_strm(
10136
+SQLITE_API int sqlite3session_changeset_strm(
1012910137
sqlite3_session *pSession,
1013010138
int (*xOutput)(void *pOut, const void *pData, int nData),
1013110139
void *pOut
1013210140
);
10133
-int sqlite3session_patchset_strm(
10141
+SQLITE_API int sqlite3session_patchset_strm(
1013410142
sqlite3_session *pSession,
1013510143
int (*xOutput)(void *pOut, const void *pData, int nData),
1013610144
void *pOut
1013710145
);
1013810146
int sqlite3changegroup_add_strm(sqlite3_changegroup*,
@@ -11035,10 +11043,11 @@
1103511043
# if defined(_MSC_VER) && _MSC_VER>=1400
1103611044
# if !defined(_WIN32_WCE)
1103711045
# include <intrin.h>
1103811046
# pragma intrinsic(_byteswap_ushort)
1103911047
# pragma intrinsic(_byteswap_ulong)
11048
+# pragma intrinsic(_byteswap_uint64)
1104011049
# pragma intrinsic(_ReadWriteBarrier)
1104111050
# else
1104211051
# include <cmnintrin.h>
1104311052
# endif
1104411053
# endif
@@ -11849,36 +11858,39 @@
1184911858
** Macros to determine whether the machine is big or little endian,
1185011859
** and whether or not that determination is run-time or compile-time.
1185111860
**
1185211861
** For best performance, an attempt is made to guess at the byte-order
1185311862
** using C-preprocessor macros. If that is unsuccessful, or if
11854
-** -DSQLITE_RUNTIME_BYTEORDER=1 is set, then byte-order is determined
11863
+** -DSQLITE_BYTEORDER=0 is set, then byte-order is determined
1185511864
** at run-time.
1185611865
*/
11857
-#if (defined(i386) || defined(__i386__) || defined(_M_IX86) || \
11866
+#ifndef SQLITE_BYTEORDER
11867
+# if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
1185811868
defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
1185911869
defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
11860
- defined(__arm__)) && !defined(SQLITE_RUNTIME_BYTEORDER)
11861
-# define SQLITE_BYTEORDER 1234
11862
-# define SQLITE_BIGENDIAN 0
11863
-# define SQLITE_LITTLEENDIAN 1
11864
-# define SQLITE_UTF16NATIVE SQLITE_UTF16LE
11870
+ defined(__arm__)
11871
+# define SQLITE_BYTEORDER 1234
11872
+# elif defined(sparc) || defined(__ppc__)
11873
+# define SQLITE_BYTEORDER 4321
11874
+# else
11875
+# define SQLITE_BYTEORDER 0
11876
+# endif
1186511877
#endif
11866
-#if (defined(sparc) || defined(__ppc__)) \
11867
- && !defined(SQLITE_RUNTIME_BYTEORDER)
11868
-# define SQLITE_BYTEORDER 4321
11878
+#if SQLITE_BYTEORDER==4321
1186911879
# define SQLITE_BIGENDIAN 1
1187011880
# define SQLITE_LITTLEENDIAN 0
1187111881
# define SQLITE_UTF16NATIVE SQLITE_UTF16BE
11872
-#endif
11873
-#if !defined(SQLITE_BYTEORDER)
11882
+#elif SQLITE_BYTEORDER==1234
11883
+# define SQLITE_BIGENDIAN 0
11884
+# define SQLITE_LITTLEENDIAN 1
11885
+# define SQLITE_UTF16NATIVE SQLITE_UTF16LE
11886
+#else
1187411887
# ifdef SQLITE_AMALGAMATION
1187511888
const int sqlite3one = 1;
1187611889
# else
1187711890
extern const int sqlite3one;
1187811891
# endif
11879
-# define SQLITE_BYTEORDER 0 /* 0 means "unknown at compile-time" */
1188011892
# define SQLITE_BIGENDIAN (*(char *)(&sqlite3one)==0)
1188111893
# define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)
1188211894
# define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)
1188311895
#endif
1188411896
@@ -20693,20 +20705,22 @@
2069320705
** cases of nByte<=0 will be intercepted and dealt with by higher level
2069420706
** routines.
2069520707
*/
2069620708
static void *sqlite3MemMalloc(int nByte){
2069720709
#ifdef SQLITE_MALLOCSIZE
20698
- void *p = SQLITE_MALLOC( nByte );
20710
+ void *p;
20711
+ testcase( ROUND8(nByte)==nByte );
20712
+ p = SQLITE_MALLOC( nByte );
2069920713
if( p==0 ){
2070020714
testcase( sqlite3GlobalConfig.xLog!=0 );
2070120715
sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte);
2070220716
}
2070320717
return p;
2070420718
#else
2070520719
sqlite3_int64 *p;
2070620720
assert( nByte>0 );
20707
- nByte = ROUND8(nByte);
20721
+ testcase( ROUND8(nByte)!=nByte );
2070820722
p = SQLITE_MALLOC( nByte+8 );
2070920723
if( p ){
2071020724
p[0] = nByte;
2071120725
p++;
2071220726
}else{
@@ -23824,12 +23838,11 @@
2382423838
SQLITE_PRIVATE void sqlite3MemoryBarrier(void){
2382523839
#if defined(SQLITE_MEMORY_BARRIER)
2382623840
SQLITE_MEMORY_BARRIER;
2382723841
#elif defined(__GNUC__)
2382823842
__sync_synchronize();
23829
-#elif !defined(SQLITE_DISABLE_INTRINSIC) && \
23830
- defined(_MSC_VER) && _MSC_VER>=1300
23843
+#elif MSCV_VERSION>=1300
2383123844
_ReadWriteBarrier();
2383223845
#elif defined(MemoryBarrier)
2383323846
MemoryBarrier();
2383423847
#endif
2383523848
}
@@ -24359,28 +24372,36 @@
2435924372
** Do a memory allocation with statistics and alarms. Assume the
2436024373
** lock is already held.
2436124374
*/
2436224375
static void mallocWithAlarm(int n, void **pp){
2436324376
void *p;
24364
- int nFull = 0;
24377
+ int nFull;
2436524378
assert( sqlite3_mutex_held(mem0.mutex) );
24379
+ assert( n>0 );
24380
+
24381
+ /* In Firefox (circa 2017-02-08), xRoundup() is remapped to an internal
24382
+ ** implementation of malloc_good_size(), which must be called in debug
24383
+ ** mode and specifically when the DMD "Dark Matter Detector" is enabled
24384
+ ** or else a crash results. Hence, do not attempt to optimize out the
24385
+ ** following xRoundup() call. */
24386
+ nFull = sqlite3GlobalConfig.m.xRoundup(n);
24387
+
2436624388
sqlite3StatusHighwater(SQLITE_STATUS_MALLOC_SIZE, n);
2436724389
if( mem0.alarmThreshold>0 ){
2436824390
sqlite3_int64 nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);
24369
- nFull = sqlite3GlobalConfig.m.xRoundup(n);
2437024391
if( nUsed >= mem0.alarmThreshold - nFull ){
2437124392
mem0.nearlyFull = 1;
2437224393
sqlite3MallocAlarm(nFull);
2437324394
}else{
2437424395
mem0.nearlyFull = 0;
2437524396
}
2437624397
}
24377
- p = sqlite3GlobalConfig.m.xMalloc(n);
24398
+ p = sqlite3GlobalConfig.m.xMalloc(nFull);
2437824399
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
2437924400
if( p==0 && mem0.alarmThreshold>0 ){
2438024401
sqlite3MallocAlarm(nFull);
24381
- p = sqlite3GlobalConfig.m.xMalloc(n);
24402
+ p = sqlite3GlobalConfig.m.xMalloc(nFull);
2438224403
}
2438324404
#endif
2438424405
if( p ){
2438524406
nFull = sqlite3MallocSize(p);
2438624407
sqlite3StatusUp(SQLITE_STATUS_MEMORY_USED, nFull);
@@ -28674,17 +28695,15 @@
2867428695
SQLITE_PRIVATE u32 sqlite3Get4byte(const u8 *p){
2867528696
#if SQLITE_BYTEORDER==4321
2867628697
u32 x;
2867728698
memcpy(&x,p,4);
2867828699
return x;
28679
-#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
28680
- && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
28700
+#elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
2868128701
u32 x;
2868228702
memcpy(&x,p,4);
2868328703
return __builtin_bswap32(x);
28684
-#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
28685
- && defined(_MSC_VER) && _MSC_VER>=1300
28704
+#elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
2868628705
u32 x;
2868728706
memcpy(&x,p,4);
2868828707
return _byteswap_ulong(x);
2868928708
#else
2869028709
testcase( p[0]&0x80 );
@@ -28692,16 +28711,14 @@
2869228711
#endif
2869328712
}
2869428713
SQLITE_PRIVATE void sqlite3Put4byte(unsigned char *p, u32 v){
2869528714
#if SQLITE_BYTEORDER==4321
2869628715
memcpy(p,&v,4);
28697
-#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
28698
- && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
28716
+#elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
2869928717
u32 x = __builtin_bswap32(v);
2870028718
memcpy(p,&x,4);
28701
-#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
28702
- && defined(_MSC_VER) && _MSC_VER>=1300
28719
+#elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
2870328720
u32 x = _byteswap_ulong(v);
2870428721
memcpy(p,&x,4);
2870528722
#else
2870628723
p[0] = (u8)(v>>24);
2870728724
p[1] = (u8)(v>>16);
@@ -28813,12 +28830,11 @@
2881328830
** the other 64-bit signed integer at *pA and store the result in *pA.
2881428831
** Return 0 on success. Or if the operation would have resulted in an
2881528832
** overflow, leave *pA unchanged and return 1.
2881628833
*/
2881728834
SQLITE_PRIVATE int sqlite3AddInt64(i64 *pA, i64 iB){
28818
-#if !defined(SQLITE_DISABLE_INTRINSIC) \
28819
- && (GCC_VERSION>=5004000 || CLANG_VERSION>=4000000)
28835
+#if GCC_VERSION>=5004000 || CLANG_VERSION>=4000000
2882028836
return __builtin_add_overflow(*pA, iB, pA);
2882128837
#else
2882228838
i64 iA = *pA;
2882328839
testcase( iA==0 ); testcase( iA==1 );
2882428840
testcase( iB==-1 ); testcase( iB==0 );
@@ -28834,12 +28850,11 @@
2883428850
*pA += iB;
2883528851
return 0;
2883628852
#endif
2883728853
}
2883828854
SQLITE_PRIVATE int sqlite3SubInt64(i64 *pA, i64 iB){
28839
-#if !defined(SQLITE_DISABLE_INTRINSIC) \
28840
- && (GCC_VERSION>=5004000 || CLANG_VERSION>=4000000)
28855
+#if GCC_VERSION>=5004000 || CLANG_VERSION>=4000000
2884128856
return __builtin_sub_overflow(*pA, iB, pA);
2884228857
#else
2884328858
testcase( iB==SMALLEST_INT64+1 );
2884428859
if( iB==SMALLEST_INT64 ){
2884528860
testcase( (*pA)==(-1) ); testcase( (*pA)==0 );
@@ -28850,12 +28865,11 @@
2885028865
return sqlite3AddInt64(pA, -iB);
2885128866
}
2885228867
#endif
2885328868
}
2885428869
SQLITE_PRIVATE int sqlite3MulInt64(i64 *pA, i64 iB){
28855
-#if !defined(SQLITE_DISABLE_INTRINSIC) \
28856
- && (GCC_VERSION>=5004000 || CLANG_VERSION>=4000000)
28870
+#if GCC_VERSION>=5004000 || CLANG_VERSION>=4000000
2885728871
return __builtin_mul_overflow(*pA, iB, pA);
2885828872
#else
2885928873
i64 iA = *pA;
2886028874
if( iB>0 ){
2886128875
if( iA>LARGEST_INT64/iB ) return 1;
@@ -58540,15 +58554,13 @@
5854058554
** two-byte aligned address. get2bytea() is only used for accessing the
5854158555
** cell addresses in a btree header.
5854258556
*/
5854358557
#if SQLITE_BYTEORDER==4321
5854458558
# define get2byteAligned(x) (*(u16*)(x))
58545
-#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
58546
- && GCC_VERSION>=4008000
58559
+#elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4008000
5854758560
# define get2byteAligned(x) __builtin_bswap16(*(u16*)(x))
58548
-#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
58549
- && defined(_MSC_VER) && _MSC_VER>=1300
58561
+#elif SQLITE_BYTEORDER==1234 && MSCV_VERSION>=1300
5855058562
# define get2byteAligned(x) _byteswap_ushort(*(u16*)(x))
5855158563
#else
5855258564
# define get2byteAligned(x) ((x)[0]<<8 | (x)[1])
5855358565
#endif
5855458566
@@ -144588,10 +144600,11 @@
144588144600
144589144601
/* Precompiled statements used by the implementation. Each of these
144590144602
** statements is run and reset within a single virtual table API call.
144591144603
*/
144592144604
sqlite3_stmt *aStmt[40];
144605
+ sqlite3_stmt *pSeekStmt; /* Cache for fts3CursorSeekStmt() */
144593144606
144594144607
char *zReadExprlist;
144595144608
char *zWriteExprlist;
144596144609
144597144610
int nNodeSize; /* Soft limit for node size */
@@ -144657,10 +144670,11 @@
144657144670
struct Fts3Cursor {
144658144671
sqlite3_vtab_cursor base; /* Base class used by SQLite core */
144659144672
i16 eSearch; /* Search strategy (see below) */
144660144673
u8 isEof; /* True if at End Of Results */
144661144674
u8 isRequireSeek; /* True if must seek pStmt to %_content row */
144675
+ u8 bSeekStmt; /* True if pStmt is a seek */
144662144676
sqlite3_stmt *pStmt; /* Prepared statement in use by the cursor */
144663144677
Fts3Expr *pExpr; /* Parsed MATCH query string */
144664144678
int iLangid; /* Language being queried for */
144665144679
int nPhrase; /* Number of matchable phrases in query */
144666144680
Fts3DeferredToken *pDeferred; /* Deferred search tokens, if any */
@@ -145179,10 +145193,11 @@
145179145193
145180145194
assert( p->nPendingData==0 );
145181145195
assert( p->pSegments==0 );
145182145196
145183145197
/* Free any prepared statements held */
145198
+ sqlite3_finalize(p->pSeekStmt);
145184145199
for(i=0; i<SizeofArray(p->aStmt); i++){
145185145200
sqlite3_finalize(p->aStmt[i]);
145186145201
}
145187145202
sqlite3_free(p->zSegmentsTbl);
145188145203
sqlite3_free(p->zReadExprlist);
@@ -146366,19 +146381,39 @@
146366146381
return SQLITE_NOMEM;
146367146382
}
146368146383
memset(pCsr, 0, sizeof(Fts3Cursor));
146369146384
return SQLITE_OK;
146370146385
}
146386
+
146387
+/*
146388
+** Finalize the statement handle at pCsr->pStmt.
146389
+**
146390
+** Or, if that statement handle is one created by fts3CursorSeekStmt(),
146391
+** and the Fts3Table.pSeekStmt slot is currently NULL, save the statement
146392
+** pointer there instead of finalizing it.
146393
+*/
146394
+static void fts3CursorFinalizeStmt(Fts3Cursor *pCsr){
146395
+ if( pCsr->bSeekStmt ){
146396
+ Fts3Table *p = (Fts3Table *)pCsr->base.pVtab;
146397
+ if( p->pSeekStmt==0 ){
146398
+ p->pSeekStmt = pCsr->pStmt;
146399
+ sqlite3_reset(pCsr->pStmt);
146400
+ pCsr->pStmt = 0;
146401
+ }
146402
+ pCsr->bSeekStmt = 0;
146403
+ }
146404
+ sqlite3_finalize(pCsr->pStmt);
146405
+}
146371146406
146372146407
/*
146373146408
** Close the cursor. For additional information see the documentation
146374146409
** on the xClose method of the virtual table interface.
146375146410
*/
146376146411
static int fts3CloseMethod(sqlite3_vtab_cursor *pCursor){
146377146412
Fts3Cursor *pCsr = (Fts3Cursor *)pCursor;
146378146413
assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );
146379
- sqlite3_finalize(pCsr->pStmt);
146414
+ fts3CursorFinalizeStmt(pCsr);
146380146415
sqlite3Fts3ExprFree(pCsr->pExpr);
146381146416
sqlite3Fts3FreeDeferredTokens(pCsr);
146382146417
sqlite3_free(pCsr->aDoclist);
146383146418
sqlite3Fts3MIBufferFree(pCsr->pMIBuffer);
146384146419
assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );
@@ -146392,24 +146427,27 @@
146392146427
**
146393146428
** "SELECT <columns> FROM %_content WHERE rowid = ?"
146394146429
**
146395146430
** (or the equivalent for a content=xxx table) and set pCsr->pStmt to
146396146431
** it. If an error occurs, return an SQLite error code.
146397
-**
146398
-** Otherwise, set *ppStmt to point to pCsr->pStmt and return SQLITE_OK.
146399146432
*/
146400
-static int fts3CursorSeekStmt(Fts3Cursor *pCsr, sqlite3_stmt **ppStmt){
146433
+static int fts3CursorSeekStmt(Fts3Cursor *pCsr){
146401146434
int rc = SQLITE_OK;
146402146435
if( pCsr->pStmt==0 ){
146403146436
Fts3Table *p = (Fts3Table *)pCsr->base.pVtab;
146404146437
char *zSql;
146405
- zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist);
146406
- if( !zSql ) return SQLITE_NOMEM;
146407
- rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0);
146408
- sqlite3_free(zSql);
146438
+ if( p->pSeekStmt ){
146439
+ pCsr->pStmt = p->pSeekStmt;
146440
+ p->pSeekStmt = 0;
146441
+ }else{
146442
+ zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist);
146443
+ if( !zSql ) return SQLITE_NOMEM;
146444
+ rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0);
146445
+ sqlite3_free(zSql);
146446
+ }
146447
+ if( rc==SQLITE_OK ) pCsr->bSeekStmt = 1;
146409146448
}
146410
- *ppStmt = pCsr->pStmt;
146411146449
return rc;
146412146450
}
146413146451
146414146452
/*
146415146453
** Position the pCsr->pStmt statement so that it is on the row
@@ -146417,13 +146455,11 @@
146417146455
** SQLITE_OK on success.
146418146456
*/
146419146457
static int fts3CursorSeek(sqlite3_context *pContext, Fts3Cursor *pCsr){
146420146458
int rc = SQLITE_OK;
146421146459
if( pCsr->isRequireSeek ){
146422
- sqlite3_stmt *pStmt = 0;
146423
-
146424
- rc = fts3CursorSeekStmt(pCsr, &pStmt);
146460
+ rc = fts3CursorSeekStmt(pCsr);
146425146461
if( rc==SQLITE_OK ){
146426146462
sqlite3_bind_int64(pCsr->pStmt, 1, pCsr->iPrevId);
146427146463
pCsr->isRequireSeek = 0;
146428146464
if( SQLITE_ROW==sqlite3_step(pCsr->pStmt) ){
146429146465
return SQLITE_OK;
@@ -147877,11 +147913,11 @@
147877147913
if( idxNum & FTS3_HAVE_DOCID_GE ) pDocidGe = apVal[iIdx++];
147878147914
if( idxNum & FTS3_HAVE_DOCID_LE ) pDocidLe = apVal[iIdx++];
147879147915
assert( iIdx==nVal );
147880147916
147881147917
/* In case the cursor has been used before, clear it now. */
147882
- sqlite3_finalize(pCsr->pStmt);
147918
+ fts3CursorFinalizeStmt(pCsr);
147883147919
sqlite3_free(pCsr->aDoclist);
147884147920
sqlite3Fts3MIBufferFree(pCsr->pMIBuffer);
147885147921
sqlite3Fts3ExprFree(pCsr->pExpr);
147886147922
memset(&pCursor[1], 0, sizeof(Fts3Cursor)-sizeof(sqlite3_vtab_cursor));
147887147923
@@ -147945,11 +147981,11 @@
147945147981
sqlite3_free(zSql);
147946147982
}else{
147947147983
rc = SQLITE_NOMEM;
147948147984
}
147949147985
}else if( eSearch==FTS3_DOCID_SEARCH ){
147950
- rc = fts3CursorSeekStmt(pCsr, &pCsr->pStmt);
147986
+ rc = fts3CursorSeekStmt(pCsr);
147951147987
if( rc==SQLITE_OK ){
147952147988
rc = sqlite3_bind_value(pCsr->pStmt, 1, pCons);
147953147989
}
147954147990
}
147955147991
if( rc!=SQLITE_OK ) return rc;
@@ -162965,10 +163001,11 @@
162965163001
/* #include <stdio.h> */
162966163002
162967163003
#ifndef SQLITE_AMALGAMATION
162968163004
#include "sqlite3rtree.h"
162969163005
typedef sqlite3_int64 i64;
163006
+typedef sqlite3_uint64 u64;
162970163007
typedef unsigned char u8;
162971163008
typedef unsigned short u16;
162972163009
typedef unsigned int u32;
162973163010
#endif
162974163011
@@ -163266,20 +163303,20 @@
163266163303
# define MIN(x,y) ((x) > (y) ? (y) : (x))
163267163304
#endif
163268163305
163269163306
/* What version of GCC is being used. 0 means GCC is not being used */
163270163307
#ifndef GCC_VERSION
163271
-#ifdef __GNUC__
163308
+#if defined(__GNUC__) && !defined(SQLITE_DISABLE_INTRINSIC)
163272163309
# define GCC_VERSION (__GNUC__*1000000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__)
163273163310
#else
163274163311
# define GCC_VERSION 0
163275163312
#endif
163276163313
#endif
163277163314
163278163315
/* What version of CLANG is being used. 0 means CLANG is not being used */
163279163316
#ifndef CLANG_VERSION
163280
-#if defined(__clang__) && !defined(_WIN32)
163317
+#if defined(__clang__) && !defined(_WIN32) && !defined(SQLITE_DISABLE_INTRINSIC)
163281163318
# define CLANG_VERSION \
163282163319
(__clang_major__*1000000+__clang_minor__*1000+__clang_patchlevel__)
163283163320
#else
163284163321
# define CLANG_VERSION 0
163285163322
#endif
@@ -163300,27 +163337,26 @@
163300163337
** using C-preprocessor macros. If that is unsuccessful, or if
163301163338
** -DSQLITE_RUNTIME_BYTEORDER=1 is set, then byte-order is determined
163302163339
** at run-time.
163303163340
*/
163304163341
#ifndef SQLITE_BYTEORDER
163305
-#if (defined(i386) || defined(__i386__) || defined(_M_IX86) || \
163306
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
163307
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
163308
- defined(__arm__)) && !defined(SQLITE_RUNTIME_BYTEORDER)
163342
+#if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
163343
+ defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
163344
+ defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
163345
+ defined(__arm__)
163309163346
# define SQLITE_BYTEORDER 1234
163310
-#elif (defined(sparc) || defined(__ppc__)) \
163311
- && !defined(SQLITE_RUNTIME_BYTEORDER)
163347
+#elif defined(sparc) || defined(__ppc__)
163312163348
# define SQLITE_BYTEORDER 4321
163313163349
#else
163314163350
# define SQLITE_BYTEORDER 0 /* 0 means "unknown at compile-time" */
163315163351
#endif
163316163352
#endif
163317163353
163318163354
163319163355
/* What version of MSVC is being used. 0 means MSVC is not being used */
163320163356
#ifndef MSVC_VERSION
163321
-#if defined(_MSC_VER)
163357
+#if defined(_MSC_VER) && !defined(SQLITE_DISABLE_INTRINSIC)
163322163358
# define MSVC_VERSION _MSC_VER
163323163359
#else
163324163360
# define MSVC_VERSION 0
163325163361
#endif
163326163362
#endif
@@ -163336,13 +163372,10 @@
163336163372
assert( ((((char*)p) - (char*)0)&3)==0 ); /* p is always 4-byte aligned */
163337163373
#if SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
163338163374
pCoord->u = _byteswap_ulong(*(u32*)p);
163339163375
#elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
163340163376
pCoord->u = __builtin_bswap32(*(u32*)p);
163341
-#elif SQLITE_BYTEORDER==1234
163342
- pCoord->u = ((pCoord->u>>24)&0xff)|((pCoord->u>>8)&0xff00)|
163343
- ((pCoord->u&0xff)<<24)|((pCoord->u&0xff00)<<8);
163344163377
#elif SQLITE_BYTEORDER==4321
163345163378
pCoord->u = *(u32*)p;
163346163379
#else
163347163380
pCoord->u = (
163348163381
(((u32)p[0]) << 24) +
@@ -163382,14 +163415,13 @@
163382163415
/*
163383163416
** Functions to serialize a 16 bit integer, 32 bit real number and
163384163417
** 64 bit integer. The value returned is the number of bytes written
163385163418
** to the argument buffer (always 2, 4 and 8 respectively).
163386163419
*/
163387
-static int writeInt16(u8 *p, int i){
163420
+static void writeInt16(u8 *p, int i){
163388163421
p[0] = (i>> 8)&0xFF;
163389163422
p[1] = (i>> 0)&0xFF;
163390
- return 2;
163391163423
}
163392163424
static int writeCoord(u8 *p, RtreeCoord *pCoord){
163393163425
u32 i;
163394163426
assert( ((((char*)p) - (char*)0)&3)==0 ); /* p is always 4-byte aligned */
163395163427
assert( sizeof(RtreeCoord)==4 );
@@ -197506,11 +197538,11 @@
197506197538
int nArg, /* Number of args */
197507197539
sqlite3_value **apUnused /* Function arguments */
197508197540
){
197509197541
assert( nArg==0 );
197510197542
UNUSED_PARAM2(nArg, apUnused);
197511
- sqlite3_result_text(pCtx, "fts5: 2017-02-07 12:58:38 07fe6228208684d579c4f6c334c90eb6262a9233", -1, SQLITE_TRANSIENT);
197543
+ sqlite3_result_text(pCtx, "fts5: 2017-02-08 19:12:36 1afec5758b624e6a066d4e7ef50695095e9d7ff1", -1, SQLITE_TRANSIENT);
197512197544
}
197513197545
197514197546
static int fts5Init(sqlite3 *db){
197515197547
static const sqlite3_module fts5Mod = {
197516197548
/* iVersion */ 2,
197517197549
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -202,23 +202,31 @@
202 # define _FILE_OFFSET_BITS 64
203 # endif
204 # define _LARGEFILE_SOURCE 1
205 #endif
206
207 /* What version of GCC is being used. 0 means GCC is not being used */
208 #ifdef __GNUC__
 
 
 
 
 
209 # define GCC_VERSION (__GNUC__*1000000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__)
210 #else
211 # define GCC_VERSION 0
212 #endif
213
214 /* What version of CLANG is being used. 0 means CLANG is not being used */
215 #if defined(__clang__) && !defined(_WIN32)
216 # define CLANG_VERSION \
217 (__clang_major__*1000000+__clang_minor__*1000+__clang_patchlevel__)
218 #else
219 # define CLANG_VERSION 0
 
 
 
 
 
220 #endif
221
222 /* Needed for various definitions... */
223 #if defined(__GNUC__) && !defined(_GNU_SOURCE)
224 # define _GNU_SOURCE
@@ -389,11 +397,11 @@
389 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
390 ** [sqlite_version()] and [sqlite_source_id()].
391 */
392 #define SQLITE_VERSION "3.17.0"
393 #define SQLITE_VERSION_NUMBER 3017000
394 #define SQLITE_SOURCE_ID "2017-02-07 13:51:48 a136609c98ed3cc673c5a3c2578d49db3f2518d1"
395
396 /*
397 ** CAPI3REF: Run-Time Library Version Numbers
398 ** KEYWORDS: sqlite3_version sqlite3_sourceid
399 **
@@ -8916,11 +8924,11 @@
8916 ** The session object will be used to create changesets for tables in
8917 ** database zDb, where zDb is either "main", or "temp", or the name of an
8918 ** attached database. It is not an error if database zDb is not attached
8919 ** to the database when the session object is created.
8920 */
8921 int sqlite3session_create(
8922 sqlite3 *db, /* Database handle */
8923 const char *zDb, /* Name of db (e.g. "main") */
8924 sqlite3_session **ppSession /* OUT: New session object */
8925 );
8926
@@ -8934,11 +8942,11 @@
8934 **
8935 ** Session objects must be deleted before the database handle to which they
8936 ** are attached is closed. Refer to the documentation for
8937 ** [sqlite3session_create()] for details.
8938 */
8939 void sqlite3session_delete(sqlite3_session *pSession);
8940
8941
8942 /*
8943 ** CAPI3REF: Enable Or Disable A Session Object
8944 **
@@ -8954,11 +8962,11 @@
8954 ** no-op, and may be used to query the current state of the session.
8955 **
8956 ** The return value indicates the final state of the session object: 0 if
8957 ** the session is disabled, or 1 if it is enabled.
8958 */
8959 int sqlite3session_enable(sqlite3_session *pSession, int bEnable);
8960
8961 /*
8962 ** CAPI3REF: Set Or Clear the Indirect Change Flag
8963 **
8964 ** Each change recorded by a session object is marked as either direct or
@@ -8983,11 +8991,11 @@
8983 ** indirect flag for the specified session object.
8984 **
8985 ** The return value indicates the final state of the indirect flag: 0 if
8986 ** it is clear, or 1 if it is set.
8987 */
8988 int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect);
8989
8990 /*
8991 ** CAPI3REF: Attach A Table To A Session Object
8992 **
8993 ** If argument zTab is not NULL, then it is the name of a table to attach
@@ -9013,11 +9021,11 @@
9013 ** in one or more of their PRIMARY KEY columns.
9014 **
9015 ** SQLITE_OK is returned if the call completes without error. Or, if an error
9016 ** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned.
9017 */
9018 int sqlite3session_attach(
9019 sqlite3_session *pSession, /* Session object */
9020 const char *zTab /* Table name */
9021 );
9022
9023 /*
@@ -9027,11 +9035,11 @@
9027 ** in tables that are not attached to the Session object, the filter is called
9028 ** to determine whether changes to the table's rows should be tracked or not.
9029 ** If xFilter returns 0, changes is not tracked. Note that once a table is
9030 ** attached, xFilter will not be called again.
9031 */
9032 void sqlite3session_table_filter(
9033 sqlite3_session *pSession, /* Session object */
9034 int(*xFilter)(
9035 void *pCtx, /* Copy of third arg to _filter_table() */
9036 const char *zTab /* Table name */
9037 ),
@@ -9140,11 +9148,11 @@
9140 ** changeset, even though the delete took place while the session was disabled.
9141 ** Or, if one field of a row is updated while a session is disabled, and
9142 ** another field of the same row is updated while the session is enabled, the
9143 ** resulting changeset will contain an UPDATE change that updates both fields.
9144 */
9145 int sqlite3session_changeset(
9146 sqlite3_session *pSession, /* Session object */
9147 int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */
9148 void **ppChangeset /* OUT: Buffer containing changeset */
9149 );
9150
@@ -9202,11 +9210,11 @@
9202 ** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
9203 ** may be set to point to a buffer containing an English language error
9204 ** message. It is the responsibility of the caller to free this buffer using
9205 ** sqlite3_free().
9206 */
9207 int sqlite3session_diff(
9208 sqlite3_session *pSession,
9209 const char *zFromDb,
9210 const char *zTbl,
9211 char **pzErrMsg
9212 );
@@ -9238,11 +9246,11 @@
9238 ** Changes within a patchset are ordered in the same way as for changesets
9239 ** generated by the sqlite3session_changeset() function (i.e. all changes for
9240 ** a single table are grouped together, tables appear in the order in which
9241 ** they were attached to the session object).
9242 */
9243 int sqlite3session_patchset(
9244 sqlite3_session *pSession, /* Session object */
9245 int *pnPatchset, /* OUT: Size of buffer at *ppChangeset */
9246 void **ppPatchset /* OUT: Buffer containing changeset */
9247 );
9248
@@ -9259,11 +9267,11 @@
9259 ** an attached table is modified and then later on the original values
9260 ** are restored. However, if this function returns non-zero, then it is
9261 ** guaranteed that a call to sqlite3session_changeset() will return a
9262 ** changeset containing zero changes.
9263 */
9264 int sqlite3session_isempty(sqlite3_session *pSession);
9265
9266 /*
9267 ** CAPI3REF: Create An Iterator To Traverse A Changeset
9268 **
9269 ** Create an iterator used to iterate through the contents of a changeset.
@@ -9294,11 +9302,11 @@
9294 ** this function, all changes that relate to a single table are visited
9295 ** consecutively. There is no chance that the iterator will visit a change
9296 ** the applies to table X, then one for table Y, and then later on visit
9297 ** another change for table X.
9298 */
9299 int sqlite3changeset_start(
9300 sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */
9301 int nChangeset, /* Size of changeset blob in bytes */
9302 void *pChangeset /* Pointer to blob containing changeset */
9303 );
9304
@@ -9323,11 +9331,11 @@
9323 **
9324 ** If an error occurs, an SQLite error code is returned. Possible error
9325 ** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or
9326 ** SQLITE_NOMEM.
9327 */
9328 int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
9329
9330 /*
9331 ** CAPI3REF: Obtain The Current Operation From A Changeset Iterator
9332 **
9333 ** The pIter argument passed to this function may either be an iterator
@@ -9351,11 +9359,11 @@
9351 **
9352 ** If no error occurs, SQLITE_OK is returned. If an error does occur, an
9353 ** SQLite error code is returned. The values of the output variables may not
9354 ** be trusted in this case.
9355 */
9356 int sqlite3changeset_op(
9357 sqlite3_changeset_iter *pIter, /* Iterator object */
9358 const char **pzTab, /* OUT: Pointer to table name */
9359 int *pnCol, /* OUT: Number of columns in table */
9360 int *pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */
9361 int *pbIndirect /* OUT: True for an 'indirect' change */
@@ -9384,11 +9392,11 @@
9384 ** If this function is called when the iterator does not point to a valid
9385 ** entry, SQLITE_MISUSE is returned and the output variables zeroed. Otherwise,
9386 ** SQLITE_OK is returned and the output variables populated as described
9387 ** above.
9388 */
9389 int sqlite3changeset_pk(
9390 sqlite3_changeset_iter *pIter, /* Iterator object */
9391 unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */
9392 int *pnCol /* OUT: Number of entries in output array */
9393 );
9394
@@ -9414,11 +9422,11 @@
9414 ** is similar to the "old.*" columns available to update or delete triggers.
9415 **
9416 ** If some other error occurs (e.g. an OOM condition), an SQLite error code
9417 ** is returned and *ppValue is set to NULL.
9418 */
9419 int sqlite3changeset_old(
9420 sqlite3_changeset_iter *pIter, /* Changeset iterator */
9421 int iVal, /* Column number */
9422 sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */
9423 );
9424
@@ -9447,11 +9455,11 @@
9447 ** triggers.
9448 **
9449 ** If some other error occurs (e.g. an OOM condition), an SQLite error code
9450 ** is returned and *ppValue is set to NULL.
9451 */
9452 int sqlite3changeset_new(
9453 sqlite3_changeset_iter *pIter, /* Changeset iterator */
9454 int iVal, /* Column number */
9455 sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */
9456 );
9457
@@ -9474,11 +9482,11 @@
9474 ** and returns SQLITE_OK.
9475 **
9476 ** If some other error occurs (e.g. an OOM condition), an SQLite error code
9477 ** is returned and *ppValue is set to NULL.
9478 */
9479 int sqlite3changeset_conflict(
9480 sqlite3_changeset_iter *pIter, /* Changeset iterator */
9481 int iVal, /* Column number */
9482 sqlite3_value **ppValue /* OUT: Value from conflicting row */
9483 );
9484
@@ -9490,11 +9498,11 @@
9490 ** it sets the output variable to the total number of known foreign key
9491 ** violations in the destination database and returns SQLITE_OK.
9492 **
9493 ** In all other cases this function returns SQLITE_MISUSE.
9494 */
9495 int sqlite3changeset_fk_conflicts(
9496 sqlite3_changeset_iter *pIter, /* Changeset iterator */
9497 int *pnOut /* OUT: Number of FK violations */
9498 );
9499
9500
@@ -9523,11 +9531,11 @@
9523 ** rc = sqlite3changeset_finalize();
9524 ** if( rc!=SQLITE_OK ){
9525 ** // An error has occurred
9526 ** }
9527 */
9528 int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter);
9529
9530 /*
9531 ** CAPI3REF: Invert A Changeset
9532 **
9533 ** This function is used to "invert" a changeset object. Applying an inverted
@@ -9553,11 +9561,11 @@
9553 ** call to this function.
9554 **
9555 ** WARNING/TODO: This function currently assumes that the input is a valid
9556 ** changeset. If it is not, the results are undefined.
9557 */
9558 int sqlite3changeset_invert(
9559 int nIn, const void *pIn, /* Input changeset */
9560 int *pnOut, void **ppOut /* OUT: Inverse of input */
9561 );
9562
9563 /*
@@ -9582,11 +9590,11 @@
9582 ** *pnOut = 0;
9583 ** }
9584 **
9585 ** Refer to the sqlite3_changegroup documentation below for details.
9586 */
9587 int sqlite3changeset_concat(
9588 int nA, /* Number of bytes in buffer pA */
9589 void *pA, /* Pointer to buffer containing changeset A */
9590 int nB, /* Number of bytes in buffer pB */
9591 void *pB, /* Pointer to buffer containing changeset B */
9592 int *pnOut, /* OUT: Number of bytes in output changeset */
@@ -9888,11 +9896,11 @@
9888 ** If any other error (aside from a constraint failure when attempting to
9889 ** write to the target database) occurs, then the savepoint transaction is
9890 ** rolled back, restoring the target database to its original state, and an
9891 ** SQLite error code returned.
9892 */
9893 int sqlite3changeset_apply(
9894 sqlite3 *db, /* Apply change to "main" db of this handle */
9895 int nChangeset, /* Size of changeset in bytes */
9896 void *pChangeset, /* Changeset blob */
9897 int(*xFilter)(
9898 void *pCtx, /* Copy of sixth arg to _apply() */
@@ -10089,11 +10097,11 @@
10089 **
10090 ** The sessions module never invokes an xOutput callback with the third
10091 ** parameter set to a value less than or equal to zero. Other than this,
10092 ** no guarantees are made as to the size of the chunks of data returned.
10093 */
10094 int sqlite3changeset_apply_strm(
10095 sqlite3 *db, /* Apply change to "main" db of this handle */
10096 int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */
10097 void *pIn, /* First arg for xInput */
10098 int(*xFilter)(
10099 void *pCtx, /* Copy of sixth arg to _apply() */
@@ -10104,35 +10112,35 @@
10104 int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
10105 sqlite3_changeset_iter *p /* Handle describing change and conflict */
10106 ),
10107 void *pCtx /* First argument passed to xConflict */
10108 );
10109 int sqlite3changeset_concat_strm(
10110 int (*xInputA)(void *pIn, void *pData, int *pnData),
10111 void *pInA,
10112 int (*xInputB)(void *pIn, void *pData, int *pnData),
10113 void *pInB,
10114 int (*xOutput)(void *pOut, const void *pData, int nData),
10115 void *pOut
10116 );
10117 int sqlite3changeset_invert_strm(
10118 int (*xInput)(void *pIn, void *pData, int *pnData),
10119 void *pIn,
10120 int (*xOutput)(void *pOut, const void *pData, int nData),
10121 void *pOut
10122 );
10123 int sqlite3changeset_start_strm(
10124 sqlite3_changeset_iter **pp,
10125 int (*xInput)(void *pIn, void *pData, int *pnData),
10126 void *pIn
10127 );
10128 int sqlite3session_changeset_strm(
10129 sqlite3_session *pSession,
10130 int (*xOutput)(void *pOut, const void *pData, int nData),
10131 void *pOut
10132 );
10133 int sqlite3session_patchset_strm(
10134 sqlite3_session *pSession,
10135 int (*xOutput)(void *pOut, const void *pData, int nData),
10136 void *pOut
10137 );
10138 int sqlite3changegroup_add_strm(sqlite3_changegroup*,
@@ -11035,10 +11043,11 @@
11035 # if defined(_MSC_VER) && _MSC_VER>=1400
11036 # if !defined(_WIN32_WCE)
11037 # include <intrin.h>
11038 # pragma intrinsic(_byteswap_ushort)
11039 # pragma intrinsic(_byteswap_ulong)
 
11040 # pragma intrinsic(_ReadWriteBarrier)
11041 # else
11042 # include <cmnintrin.h>
11043 # endif
11044 # endif
@@ -11849,36 +11858,39 @@
11849 ** Macros to determine whether the machine is big or little endian,
11850 ** and whether or not that determination is run-time or compile-time.
11851 **
11852 ** For best performance, an attempt is made to guess at the byte-order
11853 ** using C-preprocessor macros. If that is unsuccessful, or if
11854 ** -DSQLITE_RUNTIME_BYTEORDER=1 is set, then byte-order is determined
11855 ** at run-time.
11856 */
11857 #if (defined(i386) || defined(__i386__) || defined(_M_IX86) || \
 
11858 defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
11859 defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
11860 defined(__arm__)) && !defined(SQLITE_RUNTIME_BYTEORDER)
11861 # define SQLITE_BYTEORDER 1234
11862 # define SQLITE_BIGENDIAN 0
11863 # define SQLITE_LITTLEENDIAN 1
11864 # define SQLITE_UTF16NATIVE SQLITE_UTF16LE
 
 
11865 #endif
11866 #if (defined(sparc) || defined(__ppc__)) \
11867 && !defined(SQLITE_RUNTIME_BYTEORDER)
11868 # define SQLITE_BYTEORDER 4321
11869 # define SQLITE_BIGENDIAN 1
11870 # define SQLITE_LITTLEENDIAN 0
11871 # define SQLITE_UTF16NATIVE SQLITE_UTF16BE
11872 #endif
11873 #if !defined(SQLITE_BYTEORDER)
 
 
 
11874 # ifdef SQLITE_AMALGAMATION
11875 const int sqlite3one = 1;
11876 # else
11877 extern const int sqlite3one;
11878 # endif
11879 # define SQLITE_BYTEORDER 0 /* 0 means "unknown at compile-time" */
11880 # define SQLITE_BIGENDIAN (*(char *)(&sqlite3one)==0)
11881 # define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)
11882 # define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)
11883 #endif
11884
@@ -20693,20 +20705,22 @@
20693 ** cases of nByte<=0 will be intercepted and dealt with by higher level
20694 ** routines.
20695 */
20696 static void *sqlite3MemMalloc(int nByte){
20697 #ifdef SQLITE_MALLOCSIZE
20698 void *p = SQLITE_MALLOC( nByte );
 
 
20699 if( p==0 ){
20700 testcase( sqlite3GlobalConfig.xLog!=0 );
20701 sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte);
20702 }
20703 return p;
20704 #else
20705 sqlite3_int64 *p;
20706 assert( nByte>0 );
20707 nByte = ROUND8(nByte);
20708 p = SQLITE_MALLOC( nByte+8 );
20709 if( p ){
20710 p[0] = nByte;
20711 p++;
20712 }else{
@@ -23824,12 +23838,11 @@
23824 SQLITE_PRIVATE void sqlite3MemoryBarrier(void){
23825 #if defined(SQLITE_MEMORY_BARRIER)
23826 SQLITE_MEMORY_BARRIER;
23827 #elif defined(__GNUC__)
23828 __sync_synchronize();
23829 #elif !defined(SQLITE_DISABLE_INTRINSIC) && \
23830 defined(_MSC_VER) && _MSC_VER>=1300
23831 _ReadWriteBarrier();
23832 #elif defined(MemoryBarrier)
23833 MemoryBarrier();
23834 #endif
23835 }
@@ -24359,28 +24372,36 @@
24359 ** Do a memory allocation with statistics and alarms. Assume the
24360 ** lock is already held.
24361 */
24362 static void mallocWithAlarm(int n, void **pp){
24363 void *p;
24364 int nFull = 0;
24365 assert( sqlite3_mutex_held(mem0.mutex) );
 
 
 
 
 
 
 
 
 
24366 sqlite3StatusHighwater(SQLITE_STATUS_MALLOC_SIZE, n);
24367 if( mem0.alarmThreshold>0 ){
24368 sqlite3_int64 nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);
24369 nFull = sqlite3GlobalConfig.m.xRoundup(n);
24370 if( nUsed >= mem0.alarmThreshold - nFull ){
24371 mem0.nearlyFull = 1;
24372 sqlite3MallocAlarm(nFull);
24373 }else{
24374 mem0.nearlyFull = 0;
24375 }
24376 }
24377 p = sqlite3GlobalConfig.m.xMalloc(n);
24378 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
24379 if( p==0 && mem0.alarmThreshold>0 ){
24380 sqlite3MallocAlarm(nFull);
24381 p = sqlite3GlobalConfig.m.xMalloc(n);
24382 }
24383 #endif
24384 if( p ){
24385 nFull = sqlite3MallocSize(p);
24386 sqlite3StatusUp(SQLITE_STATUS_MEMORY_USED, nFull);
@@ -28674,17 +28695,15 @@
28674 SQLITE_PRIVATE u32 sqlite3Get4byte(const u8 *p){
28675 #if SQLITE_BYTEORDER==4321
28676 u32 x;
28677 memcpy(&x,p,4);
28678 return x;
28679 #elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
28680 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
28681 u32 x;
28682 memcpy(&x,p,4);
28683 return __builtin_bswap32(x);
28684 #elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
28685 && defined(_MSC_VER) && _MSC_VER>=1300
28686 u32 x;
28687 memcpy(&x,p,4);
28688 return _byteswap_ulong(x);
28689 #else
28690 testcase( p[0]&0x80 );
@@ -28692,16 +28711,14 @@
28692 #endif
28693 }
28694 SQLITE_PRIVATE void sqlite3Put4byte(unsigned char *p, u32 v){
28695 #if SQLITE_BYTEORDER==4321
28696 memcpy(p,&v,4);
28697 #elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
28698 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
28699 u32 x = __builtin_bswap32(v);
28700 memcpy(p,&x,4);
28701 #elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
28702 && defined(_MSC_VER) && _MSC_VER>=1300
28703 u32 x = _byteswap_ulong(v);
28704 memcpy(p,&x,4);
28705 #else
28706 p[0] = (u8)(v>>24);
28707 p[1] = (u8)(v>>16);
@@ -28813,12 +28830,11 @@
28813 ** the other 64-bit signed integer at *pA and store the result in *pA.
28814 ** Return 0 on success. Or if the operation would have resulted in an
28815 ** overflow, leave *pA unchanged and return 1.
28816 */
28817 SQLITE_PRIVATE int sqlite3AddInt64(i64 *pA, i64 iB){
28818 #if !defined(SQLITE_DISABLE_INTRINSIC) \
28819 && (GCC_VERSION>=5004000 || CLANG_VERSION>=4000000)
28820 return __builtin_add_overflow(*pA, iB, pA);
28821 #else
28822 i64 iA = *pA;
28823 testcase( iA==0 ); testcase( iA==1 );
28824 testcase( iB==-1 ); testcase( iB==0 );
@@ -28834,12 +28850,11 @@
28834 *pA += iB;
28835 return 0;
28836 #endif
28837 }
28838 SQLITE_PRIVATE int sqlite3SubInt64(i64 *pA, i64 iB){
28839 #if !defined(SQLITE_DISABLE_INTRINSIC) \
28840 && (GCC_VERSION>=5004000 || CLANG_VERSION>=4000000)
28841 return __builtin_sub_overflow(*pA, iB, pA);
28842 #else
28843 testcase( iB==SMALLEST_INT64+1 );
28844 if( iB==SMALLEST_INT64 ){
28845 testcase( (*pA)==(-1) ); testcase( (*pA)==0 );
@@ -28850,12 +28865,11 @@
28850 return sqlite3AddInt64(pA, -iB);
28851 }
28852 #endif
28853 }
28854 SQLITE_PRIVATE int sqlite3MulInt64(i64 *pA, i64 iB){
28855 #if !defined(SQLITE_DISABLE_INTRINSIC) \
28856 && (GCC_VERSION>=5004000 || CLANG_VERSION>=4000000)
28857 return __builtin_mul_overflow(*pA, iB, pA);
28858 #else
28859 i64 iA = *pA;
28860 if( iB>0 ){
28861 if( iA>LARGEST_INT64/iB ) return 1;
@@ -58540,15 +58554,13 @@
58540 ** two-byte aligned address. get2bytea() is only used for accessing the
58541 ** cell addresses in a btree header.
58542 */
58543 #if SQLITE_BYTEORDER==4321
58544 # define get2byteAligned(x) (*(u16*)(x))
58545 #elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
58546 && GCC_VERSION>=4008000
58547 # define get2byteAligned(x) __builtin_bswap16(*(u16*)(x))
58548 #elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
58549 && defined(_MSC_VER) && _MSC_VER>=1300
58550 # define get2byteAligned(x) _byteswap_ushort(*(u16*)(x))
58551 #else
58552 # define get2byteAligned(x) ((x)[0]<<8 | (x)[1])
58553 #endif
58554
@@ -144588,10 +144600,11 @@
144588
144589 /* Precompiled statements used by the implementation. Each of these
144590 ** statements is run and reset within a single virtual table API call.
144591 */
144592 sqlite3_stmt *aStmt[40];
 
144593
144594 char *zReadExprlist;
144595 char *zWriteExprlist;
144596
144597 int nNodeSize; /* Soft limit for node size */
@@ -144657,10 +144670,11 @@
144657 struct Fts3Cursor {
144658 sqlite3_vtab_cursor base; /* Base class used by SQLite core */
144659 i16 eSearch; /* Search strategy (see below) */
144660 u8 isEof; /* True if at End Of Results */
144661 u8 isRequireSeek; /* True if must seek pStmt to %_content row */
 
144662 sqlite3_stmt *pStmt; /* Prepared statement in use by the cursor */
144663 Fts3Expr *pExpr; /* Parsed MATCH query string */
144664 int iLangid; /* Language being queried for */
144665 int nPhrase; /* Number of matchable phrases in query */
144666 Fts3DeferredToken *pDeferred; /* Deferred search tokens, if any */
@@ -145179,10 +145193,11 @@
145179
145180 assert( p->nPendingData==0 );
145181 assert( p->pSegments==0 );
145182
145183 /* Free any prepared statements held */
 
145184 for(i=0; i<SizeofArray(p->aStmt); i++){
145185 sqlite3_finalize(p->aStmt[i]);
145186 }
145187 sqlite3_free(p->zSegmentsTbl);
145188 sqlite3_free(p->zReadExprlist);
@@ -146366,19 +146381,39 @@
146366 return SQLITE_NOMEM;
146367 }
146368 memset(pCsr, 0, sizeof(Fts3Cursor));
146369 return SQLITE_OK;
146370 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146371
146372 /*
146373 ** Close the cursor. For additional information see the documentation
146374 ** on the xClose method of the virtual table interface.
146375 */
146376 static int fts3CloseMethod(sqlite3_vtab_cursor *pCursor){
146377 Fts3Cursor *pCsr = (Fts3Cursor *)pCursor;
146378 assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );
146379 sqlite3_finalize(pCsr->pStmt);
146380 sqlite3Fts3ExprFree(pCsr->pExpr);
146381 sqlite3Fts3FreeDeferredTokens(pCsr);
146382 sqlite3_free(pCsr->aDoclist);
146383 sqlite3Fts3MIBufferFree(pCsr->pMIBuffer);
146384 assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );
@@ -146392,24 +146427,27 @@
146392 **
146393 ** "SELECT <columns> FROM %_content WHERE rowid = ?"
146394 **
146395 ** (or the equivalent for a content=xxx table) and set pCsr->pStmt to
146396 ** it. If an error occurs, return an SQLite error code.
146397 **
146398 ** Otherwise, set *ppStmt to point to pCsr->pStmt and return SQLITE_OK.
146399 */
146400 static int fts3CursorSeekStmt(Fts3Cursor *pCsr, sqlite3_stmt **ppStmt){
146401 int rc = SQLITE_OK;
146402 if( pCsr->pStmt==0 ){
146403 Fts3Table *p = (Fts3Table *)pCsr->base.pVtab;
146404 char *zSql;
146405 zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist);
146406 if( !zSql ) return SQLITE_NOMEM;
146407 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0);
146408 sqlite3_free(zSql);
 
 
 
 
 
 
146409 }
146410 *ppStmt = pCsr->pStmt;
146411 return rc;
146412 }
146413
146414 /*
146415 ** Position the pCsr->pStmt statement so that it is on the row
@@ -146417,13 +146455,11 @@
146417 ** SQLITE_OK on success.
146418 */
146419 static int fts3CursorSeek(sqlite3_context *pContext, Fts3Cursor *pCsr){
146420 int rc = SQLITE_OK;
146421 if( pCsr->isRequireSeek ){
146422 sqlite3_stmt *pStmt = 0;
146423
146424 rc = fts3CursorSeekStmt(pCsr, &pStmt);
146425 if( rc==SQLITE_OK ){
146426 sqlite3_bind_int64(pCsr->pStmt, 1, pCsr->iPrevId);
146427 pCsr->isRequireSeek = 0;
146428 if( SQLITE_ROW==sqlite3_step(pCsr->pStmt) ){
146429 return SQLITE_OK;
@@ -147877,11 +147913,11 @@
147877 if( idxNum & FTS3_HAVE_DOCID_GE ) pDocidGe = apVal[iIdx++];
147878 if( idxNum & FTS3_HAVE_DOCID_LE ) pDocidLe = apVal[iIdx++];
147879 assert( iIdx==nVal );
147880
147881 /* In case the cursor has been used before, clear it now. */
147882 sqlite3_finalize(pCsr->pStmt);
147883 sqlite3_free(pCsr->aDoclist);
147884 sqlite3Fts3MIBufferFree(pCsr->pMIBuffer);
147885 sqlite3Fts3ExprFree(pCsr->pExpr);
147886 memset(&pCursor[1], 0, sizeof(Fts3Cursor)-sizeof(sqlite3_vtab_cursor));
147887
@@ -147945,11 +147981,11 @@
147945 sqlite3_free(zSql);
147946 }else{
147947 rc = SQLITE_NOMEM;
147948 }
147949 }else if( eSearch==FTS3_DOCID_SEARCH ){
147950 rc = fts3CursorSeekStmt(pCsr, &pCsr->pStmt);
147951 if( rc==SQLITE_OK ){
147952 rc = sqlite3_bind_value(pCsr->pStmt, 1, pCons);
147953 }
147954 }
147955 if( rc!=SQLITE_OK ) return rc;
@@ -162965,10 +163001,11 @@
162965 /* #include <stdio.h> */
162966
162967 #ifndef SQLITE_AMALGAMATION
162968 #include "sqlite3rtree.h"
162969 typedef sqlite3_int64 i64;
 
162970 typedef unsigned char u8;
162971 typedef unsigned short u16;
162972 typedef unsigned int u32;
162973 #endif
162974
@@ -163266,20 +163303,20 @@
163266 # define MIN(x,y) ((x) > (y) ? (y) : (x))
163267 #endif
163268
163269 /* What version of GCC is being used. 0 means GCC is not being used */
163270 #ifndef GCC_VERSION
163271 #ifdef __GNUC__
163272 # define GCC_VERSION (__GNUC__*1000000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__)
163273 #else
163274 # define GCC_VERSION 0
163275 #endif
163276 #endif
163277
163278 /* What version of CLANG is being used. 0 means CLANG is not being used */
163279 #ifndef CLANG_VERSION
163280 #if defined(__clang__) && !defined(_WIN32)
163281 # define CLANG_VERSION \
163282 (__clang_major__*1000000+__clang_minor__*1000+__clang_patchlevel__)
163283 #else
163284 # define CLANG_VERSION 0
163285 #endif
@@ -163300,27 +163337,26 @@
163300 ** using C-preprocessor macros. If that is unsuccessful, or if
163301 ** -DSQLITE_RUNTIME_BYTEORDER=1 is set, then byte-order is determined
163302 ** at run-time.
163303 */
163304 #ifndef SQLITE_BYTEORDER
163305 #if (defined(i386) || defined(__i386__) || defined(_M_IX86) || \
163306 defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
163307 defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
163308 defined(__arm__)) && !defined(SQLITE_RUNTIME_BYTEORDER)
163309 # define SQLITE_BYTEORDER 1234
163310 #elif (defined(sparc) || defined(__ppc__)) \
163311 && !defined(SQLITE_RUNTIME_BYTEORDER)
163312 # define SQLITE_BYTEORDER 4321
163313 #else
163314 # define SQLITE_BYTEORDER 0 /* 0 means "unknown at compile-time" */
163315 #endif
163316 #endif
163317
163318
163319 /* What version of MSVC is being used. 0 means MSVC is not being used */
163320 #ifndef MSVC_VERSION
163321 #if defined(_MSC_VER)
163322 # define MSVC_VERSION _MSC_VER
163323 #else
163324 # define MSVC_VERSION 0
163325 #endif
163326 #endif
@@ -163336,13 +163372,10 @@
163336 assert( ((((char*)p) - (char*)0)&3)==0 ); /* p is always 4-byte aligned */
163337 #if SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
163338 pCoord->u = _byteswap_ulong(*(u32*)p);
163339 #elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
163340 pCoord->u = __builtin_bswap32(*(u32*)p);
163341 #elif SQLITE_BYTEORDER==1234
163342 pCoord->u = ((pCoord->u>>24)&0xff)|((pCoord->u>>8)&0xff00)|
163343 ((pCoord->u&0xff)<<24)|((pCoord->u&0xff00)<<8);
163344 #elif SQLITE_BYTEORDER==4321
163345 pCoord->u = *(u32*)p;
163346 #else
163347 pCoord->u = (
163348 (((u32)p[0]) << 24) +
@@ -163382,14 +163415,13 @@
163382 /*
163383 ** Functions to serialize a 16 bit integer, 32 bit real number and
163384 ** 64 bit integer. The value returned is the number of bytes written
163385 ** to the argument buffer (always 2, 4 and 8 respectively).
163386 */
163387 static int writeInt16(u8 *p, int i){
163388 p[0] = (i>> 8)&0xFF;
163389 p[1] = (i>> 0)&0xFF;
163390 return 2;
163391 }
163392 static int writeCoord(u8 *p, RtreeCoord *pCoord){
163393 u32 i;
163394 assert( ((((char*)p) - (char*)0)&3)==0 ); /* p is always 4-byte aligned */
163395 assert( sizeof(RtreeCoord)==4 );
@@ -197506,11 +197538,11 @@
197506 int nArg, /* Number of args */
197507 sqlite3_value **apUnused /* Function arguments */
197508 ){
197509 assert( nArg==0 );
197510 UNUSED_PARAM2(nArg, apUnused);
197511 sqlite3_result_text(pCtx, "fts5: 2017-02-07 12:58:38 07fe6228208684d579c4f6c334c90eb6262a9233", -1, SQLITE_TRANSIENT);
197512 }
197513
197514 static int fts5Init(sqlite3 *db){
197515 static const sqlite3_module fts5Mod = {
197516 /* iVersion */ 2,
197517
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -202,23 +202,31 @@
202 # define _FILE_OFFSET_BITS 64
203 # endif
204 # define _LARGEFILE_SOURCE 1
205 #endif
206
207 /* The GCC_VERSION, CLANG_VERSION, and MSVC_VERSION macros are used to
208 ** conditionally include optimizations for each of these compilers. A
209 ** value of 0 means that compiler is not being used. The
210 ** SQLITE_DISABLE_INTRINSIC macro means do not use any compiler-specific
211 ** optimizations, and hence set all compiler macros to 0
212 */
213 #if defined(__GNUC__) && !defined(SQLITE_DISABLE_INTRINSIC)
214 # define GCC_VERSION (__GNUC__*1000000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__)
215 #else
216 # define GCC_VERSION 0
217 #endif
218 #if defined(__clang__) && !defined(_WIN32) && !defined(SQLITE_DISABLE_INTRINSIC)
 
 
219 # define CLANG_VERSION \
220 (__clang_major__*1000000+__clang_minor__*1000+__clang_patchlevel__)
221 #else
222 # define CLANG_VERSION 0
223 #endif
224 #if defined(_MSC_VER) && !defined(SQLITE_DISABLE_INTRINSIC)
225 # define MSVC_VERSION _MSC_VER
226 #else
227 # define MSVC_VERSION 0
228 #endif
229
230 /* Needed for various definitions... */
231 #if defined(__GNUC__) && !defined(_GNU_SOURCE)
232 # define _GNU_SOURCE
@@ -389,11 +397,11 @@
397 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
398 ** [sqlite_version()] and [sqlite_source_id()].
399 */
400 #define SQLITE_VERSION "3.17.0"
401 #define SQLITE_VERSION_NUMBER 3017000
402 #define SQLITE_SOURCE_ID "2017-02-09 17:12:22 798fb9d70d2e5f95e64237b04d6692360133381a"
403
404 /*
405 ** CAPI3REF: Run-Time Library Version Numbers
406 ** KEYWORDS: sqlite3_version sqlite3_sourceid
407 **
@@ -8916,11 +8924,11 @@
8924 ** The session object will be used to create changesets for tables in
8925 ** database zDb, where zDb is either "main", or "temp", or the name of an
8926 ** attached database. It is not an error if database zDb is not attached
8927 ** to the database when the session object is created.
8928 */
8929 SQLITE_API int sqlite3session_create(
8930 sqlite3 *db, /* Database handle */
8931 const char *zDb, /* Name of db (e.g. "main") */
8932 sqlite3_session **ppSession /* OUT: New session object */
8933 );
8934
@@ -8934,11 +8942,11 @@
8942 **
8943 ** Session objects must be deleted before the database handle to which they
8944 ** are attached is closed. Refer to the documentation for
8945 ** [sqlite3session_create()] for details.
8946 */
8947 SQLITE_API void sqlite3session_delete(sqlite3_session *pSession);
8948
8949
8950 /*
8951 ** CAPI3REF: Enable Or Disable A Session Object
8952 **
@@ -8954,11 +8962,11 @@
8962 ** no-op, and may be used to query the current state of the session.
8963 **
8964 ** The return value indicates the final state of the session object: 0 if
8965 ** the session is disabled, or 1 if it is enabled.
8966 */
8967 SQLITE_API int sqlite3session_enable(sqlite3_session *pSession, int bEnable);
8968
8969 /*
8970 ** CAPI3REF: Set Or Clear the Indirect Change Flag
8971 **
8972 ** Each change recorded by a session object is marked as either direct or
@@ -8983,11 +8991,11 @@
8991 ** indirect flag for the specified session object.
8992 **
8993 ** The return value indicates the final state of the indirect flag: 0 if
8994 ** it is clear, or 1 if it is set.
8995 */
8996 SQLITE_API int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect);
8997
8998 /*
8999 ** CAPI3REF: Attach A Table To A Session Object
9000 **
9001 ** If argument zTab is not NULL, then it is the name of a table to attach
@@ -9013,11 +9021,11 @@
9021 ** in one or more of their PRIMARY KEY columns.
9022 **
9023 ** SQLITE_OK is returned if the call completes without error. Or, if an error
9024 ** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned.
9025 */
9026 SQLITE_API int sqlite3session_attach(
9027 sqlite3_session *pSession, /* Session object */
9028 const char *zTab /* Table name */
9029 );
9030
9031 /*
@@ -9027,11 +9035,11 @@
9035 ** in tables that are not attached to the Session object, the filter is called
9036 ** to determine whether changes to the table's rows should be tracked or not.
9037 ** If xFilter returns 0, changes is not tracked. Note that once a table is
9038 ** attached, xFilter will not be called again.
9039 */
9040 SQLITE_API void sqlite3session_table_filter(
9041 sqlite3_session *pSession, /* Session object */
9042 int(*xFilter)(
9043 void *pCtx, /* Copy of third arg to _filter_table() */
9044 const char *zTab /* Table name */
9045 ),
@@ -9140,11 +9148,11 @@
9148 ** changeset, even though the delete took place while the session was disabled.
9149 ** Or, if one field of a row is updated while a session is disabled, and
9150 ** another field of the same row is updated while the session is enabled, the
9151 ** resulting changeset will contain an UPDATE change that updates both fields.
9152 */
9153 SQLITE_API int sqlite3session_changeset(
9154 sqlite3_session *pSession, /* Session object */
9155 int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */
9156 void **ppChangeset /* OUT: Buffer containing changeset */
9157 );
9158
@@ -9202,11 +9210,11 @@
9210 ** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
9211 ** may be set to point to a buffer containing an English language error
9212 ** message. It is the responsibility of the caller to free this buffer using
9213 ** sqlite3_free().
9214 */
9215 SQLITE_API int sqlite3session_diff(
9216 sqlite3_session *pSession,
9217 const char *zFromDb,
9218 const char *zTbl,
9219 char **pzErrMsg
9220 );
@@ -9238,11 +9246,11 @@
9246 ** Changes within a patchset are ordered in the same way as for changesets
9247 ** generated by the sqlite3session_changeset() function (i.e. all changes for
9248 ** a single table are grouped together, tables appear in the order in which
9249 ** they were attached to the session object).
9250 */
9251 SQLITE_API int sqlite3session_patchset(
9252 sqlite3_session *pSession, /* Session object */
9253 int *pnPatchset, /* OUT: Size of buffer at *ppChangeset */
9254 void **ppPatchset /* OUT: Buffer containing changeset */
9255 );
9256
@@ -9259,11 +9267,11 @@
9267 ** an attached table is modified and then later on the original values
9268 ** are restored. However, if this function returns non-zero, then it is
9269 ** guaranteed that a call to sqlite3session_changeset() will return a
9270 ** changeset containing zero changes.
9271 */
9272 SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession);
9273
9274 /*
9275 ** CAPI3REF: Create An Iterator To Traverse A Changeset
9276 **
9277 ** Create an iterator used to iterate through the contents of a changeset.
@@ -9294,11 +9302,11 @@
9302 ** this function, all changes that relate to a single table are visited
9303 ** consecutively. There is no chance that the iterator will visit a change
9304 ** the applies to table X, then one for table Y, and then later on visit
9305 ** another change for table X.
9306 */
9307 SQLITE_API int sqlite3changeset_start(
9308 sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */
9309 int nChangeset, /* Size of changeset blob in bytes */
9310 void *pChangeset /* Pointer to blob containing changeset */
9311 );
9312
@@ -9323,11 +9331,11 @@
9331 **
9332 ** If an error occurs, an SQLite error code is returned. Possible error
9333 ** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or
9334 ** SQLITE_NOMEM.
9335 */
9336 SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
9337
9338 /*
9339 ** CAPI3REF: Obtain The Current Operation From A Changeset Iterator
9340 **
9341 ** The pIter argument passed to this function may either be an iterator
@@ -9351,11 +9359,11 @@
9359 **
9360 ** If no error occurs, SQLITE_OK is returned. If an error does occur, an
9361 ** SQLite error code is returned. The values of the output variables may not
9362 ** be trusted in this case.
9363 */
9364 SQLITE_API int sqlite3changeset_op(
9365 sqlite3_changeset_iter *pIter, /* Iterator object */
9366 const char **pzTab, /* OUT: Pointer to table name */
9367 int *pnCol, /* OUT: Number of columns in table */
9368 int *pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */
9369 int *pbIndirect /* OUT: True for an 'indirect' change */
@@ -9384,11 +9392,11 @@
9392 ** If this function is called when the iterator does not point to a valid
9393 ** entry, SQLITE_MISUSE is returned and the output variables zeroed. Otherwise,
9394 ** SQLITE_OK is returned and the output variables populated as described
9395 ** above.
9396 */
9397 SQLITE_API int sqlite3changeset_pk(
9398 sqlite3_changeset_iter *pIter, /* Iterator object */
9399 unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */
9400 int *pnCol /* OUT: Number of entries in output array */
9401 );
9402
@@ -9414,11 +9422,11 @@
9422 ** is similar to the "old.*" columns available to update or delete triggers.
9423 **
9424 ** If some other error occurs (e.g. an OOM condition), an SQLite error code
9425 ** is returned and *ppValue is set to NULL.
9426 */
9427 SQLITE_API int sqlite3changeset_old(
9428 sqlite3_changeset_iter *pIter, /* Changeset iterator */
9429 int iVal, /* Column number */
9430 sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */
9431 );
9432
@@ -9447,11 +9455,11 @@
9455 ** triggers.
9456 **
9457 ** If some other error occurs (e.g. an OOM condition), an SQLite error code
9458 ** is returned and *ppValue is set to NULL.
9459 */
9460 SQLITE_API int sqlite3changeset_new(
9461 sqlite3_changeset_iter *pIter, /* Changeset iterator */
9462 int iVal, /* Column number */
9463 sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */
9464 );
9465
@@ -9474,11 +9482,11 @@
9482 ** and returns SQLITE_OK.
9483 **
9484 ** If some other error occurs (e.g. an OOM condition), an SQLite error code
9485 ** is returned and *ppValue is set to NULL.
9486 */
9487 SQLITE_API int sqlite3changeset_conflict(
9488 sqlite3_changeset_iter *pIter, /* Changeset iterator */
9489 int iVal, /* Column number */
9490 sqlite3_value **ppValue /* OUT: Value from conflicting row */
9491 );
9492
@@ -9490,11 +9498,11 @@
9498 ** it sets the output variable to the total number of known foreign key
9499 ** violations in the destination database and returns SQLITE_OK.
9500 **
9501 ** In all other cases this function returns SQLITE_MISUSE.
9502 */
9503 SQLITE_API int sqlite3changeset_fk_conflicts(
9504 sqlite3_changeset_iter *pIter, /* Changeset iterator */
9505 int *pnOut /* OUT: Number of FK violations */
9506 );
9507
9508
@@ -9523,11 +9531,11 @@
9531 ** rc = sqlite3changeset_finalize();
9532 ** if( rc!=SQLITE_OK ){
9533 ** // An error has occurred
9534 ** }
9535 */
9536 SQLITE_API int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter);
9537
9538 /*
9539 ** CAPI3REF: Invert A Changeset
9540 **
9541 ** This function is used to "invert" a changeset object. Applying an inverted
@@ -9553,11 +9561,11 @@
9561 ** call to this function.
9562 **
9563 ** WARNING/TODO: This function currently assumes that the input is a valid
9564 ** changeset. If it is not, the results are undefined.
9565 */
9566 SQLITE_API int sqlite3changeset_invert(
9567 int nIn, const void *pIn, /* Input changeset */
9568 int *pnOut, void **ppOut /* OUT: Inverse of input */
9569 );
9570
9571 /*
@@ -9582,11 +9590,11 @@
9590 ** *pnOut = 0;
9591 ** }
9592 **
9593 ** Refer to the sqlite3_changegroup documentation below for details.
9594 */
9595 SQLITE_API int sqlite3changeset_concat(
9596 int nA, /* Number of bytes in buffer pA */
9597 void *pA, /* Pointer to buffer containing changeset A */
9598 int nB, /* Number of bytes in buffer pB */
9599 void *pB, /* Pointer to buffer containing changeset B */
9600 int *pnOut, /* OUT: Number of bytes in output changeset */
@@ -9888,11 +9896,11 @@
9896 ** If any other error (aside from a constraint failure when attempting to
9897 ** write to the target database) occurs, then the savepoint transaction is
9898 ** rolled back, restoring the target database to its original state, and an
9899 ** SQLite error code returned.
9900 */
9901 SQLITE_API int sqlite3changeset_apply(
9902 sqlite3 *db, /* Apply change to "main" db of this handle */
9903 int nChangeset, /* Size of changeset in bytes */
9904 void *pChangeset, /* Changeset blob */
9905 int(*xFilter)(
9906 void *pCtx, /* Copy of sixth arg to _apply() */
@@ -10089,11 +10097,11 @@
10097 **
10098 ** The sessions module never invokes an xOutput callback with the third
10099 ** parameter set to a value less than or equal to zero. Other than this,
10100 ** no guarantees are made as to the size of the chunks of data returned.
10101 */
10102 SQLITE_API int sqlite3changeset_apply_strm(
10103 sqlite3 *db, /* Apply change to "main" db of this handle */
10104 int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */
10105 void *pIn, /* First arg for xInput */
10106 int(*xFilter)(
10107 void *pCtx, /* Copy of sixth arg to _apply() */
@@ -10104,35 +10112,35 @@
10112 int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
10113 sqlite3_changeset_iter *p /* Handle describing change and conflict */
10114 ),
10115 void *pCtx /* First argument passed to xConflict */
10116 );
10117 SQLITE_API int sqlite3changeset_concat_strm(
10118 int (*xInputA)(void *pIn, void *pData, int *pnData),
10119 void *pInA,
10120 int (*xInputB)(void *pIn, void *pData, int *pnData),
10121 void *pInB,
10122 int (*xOutput)(void *pOut, const void *pData, int nData),
10123 void *pOut
10124 );
10125 SQLITE_API int sqlite3changeset_invert_strm(
10126 int (*xInput)(void *pIn, void *pData, int *pnData),
10127 void *pIn,
10128 int (*xOutput)(void *pOut, const void *pData, int nData),
10129 void *pOut
10130 );
10131 SQLITE_API int sqlite3changeset_start_strm(
10132 sqlite3_changeset_iter **pp,
10133 int (*xInput)(void *pIn, void *pData, int *pnData),
10134 void *pIn
10135 );
10136 SQLITE_API int sqlite3session_changeset_strm(
10137 sqlite3_session *pSession,
10138 int (*xOutput)(void *pOut, const void *pData, int nData),
10139 void *pOut
10140 );
10141 SQLITE_API int sqlite3session_patchset_strm(
10142 sqlite3_session *pSession,
10143 int (*xOutput)(void *pOut, const void *pData, int nData),
10144 void *pOut
10145 );
10146 int sqlite3changegroup_add_strm(sqlite3_changegroup*,
@@ -11035,10 +11043,11 @@
11043 # if defined(_MSC_VER) && _MSC_VER>=1400
11044 # if !defined(_WIN32_WCE)
11045 # include <intrin.h>
11046 # pragma intrinsic(_byteswap_ushort)
11047 # pragma intrinsic(_byteswap_ulong)
11048 # pragma intrinsic(_byteswap_uint64)
11049 # pragma intrinsic(_ReadWriteBarrier)
11050 # else
11051 # include <cmnintrin.h>
11052 # endif
11053 # endif
@@ -11849,36 +11858,39 @@
11858 ** Macros to determine whether the machine is big or little endian,
11859 ** and whether or not that determination is run-time or compile-time.
11860 **
11861 ** For best performance, an attempt is made to guess at the byte-order
11862 ** using C-preprocessor macros. If that is unsuccessful, or if
11863 ** -DSQLITE_BYTEORDER=0 is set, then byte-order is determined
11864 ** at run-time.
11865 */
11866 #ifndef SQLITE_BYTEORDER
11867 # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
11868 defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
11869 defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
11870 defined(__arm__)
11871 # define SQLITE_BYTEORDER 1234
11872 # elif defined(sparc) || defined(__ppc__)
11873 # define SQLITE_BYTEORDER 4321
11874 # else
11875 # define SQLITE_BYTEORDER 0
11876 # endif
11877 #endif
11878 #if SQLITE_BYTEORDER==4321
 
 
11879 # define SQLITE_BIGENDIAN 1
11880 # define SQLITE_LITTLEENDIAN 0
11881 # define SQLITE_UTF16NATIVE SQLITE_UTF16BE
11882 #elif SQLITE_BYTEORDER==1234
11883 # define SQLITE_BIGENDIAN 0
11884 # define SQLITE_LITTLEENDIAN 1
11885 # define SQLITE_UTF16NATIVE SQLITE_UTF16LE
11886 #else
11887 # ifdef SQLITE_AMALGAMATION
11888 const int sqlite3one = 1;
11889 # else
11890 extern const int sqlite3one;
11891 # endif
 
11892 # define SQLITE_BIGENDIAN (*(char *)(&sqlite3one)==0)
11893 # define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)
11894 # define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)
11895 #endif
11896
@@ -20693,20 +20705,22 @@
20705 ** cases of nByte<=0 will be intercepted and dealt with by higher level
20706 ** routines.
20707 */
20708 static void *sqlite3MemMalloc(int nByte){
20709 #ifdef SQLITE_MALLOCSIZE
20710 void *p;
20711 testcase( ROUND8(nByte)==nByte );
20712 p = SQLITE_MALLOC( nByte );
20713 if( p==0 ){
20714 testcase( sqlite3GlobalConfig.xLog!=0 );
20715 sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte);
20716 }
20717 return p;
20718 #else
20719 sqlite3_int64 *p;
20720 assert( nByte>0 );
20721 testcase( ROUND8(nByte)!=nByte );
20722 p = SQLITE_MALLOC( nByte+8 );
20723 if( p ){
20724 p[0] = nByte;
20725 p++;
20726 }else{
@@ -23824,12 +23838,11 @@
23838 SQLITE_PRIVATE void sqlite3MemoryBarrier(void){
23839 #if defined(SQLITE_MEMORY_BARRIER)
23840 SQLITE_MEMORY_BARRIER;
23841 #elif defined(__GNUC__)
23842 __sync_synchronize();
23843 #elif MSCV_VERSION>=1300
 
23844 _ReadWriteBarrier();
23845 #elif defined(MemoryBarrier)
23846 MemoryBarrier();
23847 #endif
23848 }
@@ -24359,28 +24372,36 @@
24372 ** Do a memory allocation with statistics and alarms. Assume the
24373 ** lock is already held.
24374 */
24375 static void mallocWithAlarm(int n, void **pp){
24376 void *p;
24377 int nFull;
24378 assert( sqlite3_mutex_held(mem0.mutex) );
24379 assert( n>0 );
24380
24381 /* In Firefox (circa 2017-02-08), xRoundup() is remapped to an internal
24382 ** implementation of malloc_good_size(), which must be called in debug
24383 ** mode and specifically when the DMD "Dark Matter Detector" is enabled
24384 ** or else a crash results. Hence, do not attempt to optimize out the
24385 ** following xRoundup() call. */
24386 nFull = sqlite3GlobalConfig.m.xRoundup(n);
24387
24388 sqlite3StatusHighwater(SQLITE_STATUS_MALLOC_SIZE, n);
24389 if( mem0.alarmThreshold>0 ){
24390 sqlite3_int64 nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);
 
24391 if( nUsed >= mem0.alarmThreshold - nFull ){
24392 mem0.nearlyFull = 1;
24393 sqlite3MallocAlarm(nFull);
24394 }else{
24395 mem0.nearlyFull = 0;
24396 }
24397 }
24398 p = sqlite3GlobalConfig.m.xMalloc(nFull);
24399 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
24400 if( p==0 && mem0.alarmThreshold>0 ){
24401 sqlite3MallocAlarm(nFull);
24402 p = sqlite3GlobalConfig.m.xMalloc(nFull);
24403 }
24404 #endif
24405 if( p ){
24406 nFull = sqlite3MallocSize(p);
24407 sqlite3StatusUp(SQLITE_STATUS_MEMORY_USED, nFull);
@@ -28674,17 +28695,15 @@
28695 SQLITE_PRIVATE u32 sqlite3Get4byte(const u8 *p){
28696 #if SQLITE_BYTEORDER==4321
28697 u32 x;
28698 memcpy(&x,p,4);
28699 return x;
28700 #elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
 
28701 u32 x;
28702 memcpy(&x,p,4);
28703 return __builtin_bswap32(x);
28704 #elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
 
28705 u32 x;
28706 memcpy(&x,p,4);
28707 return _byteswap_ulong(x);
28708 #else
28709 testcase( p[0]&0x80 );
@@ -28692,16 +28711,14 @@
28711 #endif
28712 }
28713 SQLITE_PRIVATE void sqlite3Put4byte(unsigned char *p, u32 v){
28714 #if SQLITE_BYTEORDER==4321
28715 memcpy(p,&v,4);
28716 #elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
 
28717 u32 x = __builtin_bswap32(v);
28718 memcpy(p,&x,4);
28719 #elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
 
28720 u32 x = _byteswap_ulong(v);
28721 memcpy(p,&x,4);
28722 #else
28723 p[0] = (u8)(v>>24);
28724 p[1] = (u8)(v>>16);
@@ -28813,12 +28830,11 @@
28830 ** the other 64-bit signed integer at *pA and store the result in *pA.
28831 ** Return 0 on success. Or if the operation would have resulted in an
28832 ** overflow, leave *pA unchanged and return 1.
28833 */
28834 SQLITE_PRIVATE int sqlite3AddInt64(i64 *pA, i64 iB){
28835 #if GCC_VERSION>=5004000 || CLANG_VERSION>=4000000
 
28836 return __builtin_add_overflow(*pA, iB, pA);
28837 #else
28838 i64 iA = *pA;
28839 testcase( iA==0 ); testcase( iA==1 );
28840 testcase( iB==-1 ); testcase( iB==0 );
@@ -28834,12 +28850,11 @@
28850 *pA += iB;
28851 return 0;
28852 #endif
28853 }
28854 SQLITE_PRIVATE int sqlite3SubInt64(i64 *pA, i64 iB){
28855 #if GCC_VERSION>=5004000 || CLANG_VERSION>=4000000
 
28856 return __builtin_sub_overflow(*pA, iB, pA);
28857 #else
28858 testcase( iB==SMALLEST_INT64+1 );
28859 if( iB==SMALLEST_INT64 ){
28860 testcase( (*pA)==(-1) ); testcase( (*pA)==0 );
@@ -28850,12 +28865,11 @@
28865 return sqlite3AddInt64(pA, -iB);
28866 }
28867 #endif
28868 }
28869 SQLITE_PRIVATE int sqlite3MulInt64(i64 *pA, i64 iB){
28870 #if GCC_VERSION>=5004000 || CLANG_VERSION>=4000000
 
28871 return __builtin_mul_overflow(*pA, iB, pA);
28872 #else
28873 i64 iA = *pA;
28874 if( iB>0 ){
28875 if( iA>LARGEST_INT64/iB ) return 1;
@@ -58540,15 +58554,13 @@
58554 ** two-byte aligned address. get2bytea() is only used for accessing the
58555 ** cell addresses in a btree header.
58556 */
58557 #if SQLITE_BYTEORDER==4321
58558 # define get2byteAligned(x) (*(u16*)(x))
58559 #elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4008000
 
58560 # define get2byteAligned(x) __builtin_bswap16(*(u16*)(x))
58561 #elif SQLITE_BYTEORDER==1234 && MSCV_VERSION>=1300
 
58562 # define get2byteAligned(x) _byteswap_ushort(*(u16*)(x))
58563 #else
58564 # define get2byteAligned(x) ((x)[0]<<8 | (x)[1])
58565 #endif
58566
@@ -144588,10 +144600,11 @@
144600
144601 /* Precompiled statements used by the implementation. Each of these
144602 ** statements is run and reset within a single virtual table API call.
144603 */
144604 sqlite3_stmt *aStmt[40];
144605 sqlite3_stmt *pSeekStmt; /* Cache for fts3CursorSeekStmt() */
144606
144607 char *zReadExprlist;
144608 char *zWriteExprlist;
144609
144610 int nNodeSize; /* Soft limit for node size */
@@ -144657,10 +144670,11 @@
144670 struct Fts3Cursor {
144671 sqlite3_vtab_cursor base; /* Base class used by SQLite core */
144672 i16 eSearch; /* Search strategy (see below) */
144673 u8 isEof; /* True if at End Of Results */
144674 u8 isRequireSeek; /* True if must seek pStmt to %_content row */
144675 u8 bSeekStmt; /* True if pStmt is a seek */
144676 sqlite3_stmt *pStmt; /* Prepared statement in use by the cursor */
144677 Fts3Expr *pExpr; /* Parsed MATCH query string */
144678 int iLangid; /* Language being queried for */
144679 int nPhrase; /* Number of matchable phrases in query */
144680 Fts3DeferredToken *pDeferred; /* Deferred search tokens, if any */
@@ -145179,10 +145193,11 @@
145193
145194 assert( p->nPendingData==0 );
145195 assert( p->pSegments==0 );
145196
145197 /* Free any prepared statements held */
145198 sqlite3_finalize(p->pSeekStmt);
145199 for(i=0; i<SizeofArray(p->aStmt); i++){
145200 sqlite3_finalize(p->aStmt[i]);
145201 }
145202 sqlite3_free(p->zSegmentsTbl);
145203 sqlite3_free(p->zReadExprlist);
@@ -146366,19 +146381,39 @@
146381 return SQLITE_NOMEM;
146382 }
146383 memset(pCsr, 0, sizeof(Fts3Cursor));
146384 return SQLITE_OK;
146385 }
146386
146387 /*
146388 ** Finalize the statement handle at pCsr->pStmt.
146389 **
146390 ** Or, if that statement handle is one created by fts3CursorSeekStmt(),
146391 ** and the Fts3Table.pSeekStmt slot is currently NULL, save the statement
146392 ** pointer there instead of finalizing it.
146393 */
146394 static void fts3CursorFinalizeStmt(Fts3Cursor *pCsr){
146395 if( pCsr->bSeekStmt ){
146396 Fts3Table *p = (Fts3Table *)pCsr->base.pVtab;
146397 if( p->pSeekStmt==0 ){
146398 p->pSeekStmt = pCsr->pStmt;
146399 sqlite3_reset(pCsr->pStmt);
146400 pCsr->pStmt = 0;
146401 }
146402 pCsr->bSeekStmt = 0;
146403 }
146404 sqlite3_finalize(pCsr->pStmt);
146405 }
146406
146407 /*
146408 ** Close the cursor. For additional information see the documentation
146409 ** on the xClose method of the virtual table interface.
146410 */
146411 static int fts3CloseMethod(sqlite3_vtab_cursor *pCursor){
146412 Fts3Cursor *pCsr = (Fts3Cursor *)pCursor;
146413 assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );
146414 fts3CursorFinalizeStmt(pCsr);
146415 sqlite3Fts3ExprFree(pCsr->pExpr);
146416 sqlite3Fts3FreeDeferredTokens(pCsr);
146417 sqlite3_free(pCsr->aDoclist);
146418 sqlite3Fts3MIBufferFree(pCsr->pMIBuffer);
146419 assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );
@@ -146392,24 +146427,27 @@
146427 **
146428 ** "SELECT <columns> FROM %_content WHERE rowid = ?"
146429 **
146430 ** (or the equivalent for a content=xxx table) and set pCsr->pStmt to
146431 ** it. If an error occurs, return an SQLite error code.
 
 
146432 */
146433 static int fts3CursorSeekStmt(Fts3Cursor *pCsr){
146434 int rc = SQLITE_OK;
146435 if( pCsr->pStmt==0 ){
146436 Fts3Table *p = (Fts3Table *)pCsr->base.pVtab;
146437 char *zSql;
146438 if( p->pSeekStmt ){
146439 pCsr->pStmt = p->pSeekStmt;
146440 p->pSeekStmt = 0;
146441 }else{
146442 zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist);
146443 if( !zSql ) return SQLITE_NOMEM;
146444 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0);
146445 sqlite3_free(zSql);
146446 }
146447 if( rc==SQLITE_OK ) pCsr->bSeekStmt = 1;
146448 }
 
146449 return rc;
146450 }
146451
146452 /*
146453 ** Position the pCsr->pStmt statement so that it is on the row
@@ -146417,13 +146455,11 @@
146455 ** SQLITE_OK on success.
146456 */
146457 static int fts3CursorSeek(sqlite3_context *pContext, Fts3Cursor *pCsr){
146458 int rc = SQLITE_OK;
146459 if( pCsr->isRequireSeek ){
146460 rc = fts3CursorSeekStmt(pCsr);
 
 
146461 if( rc==SQLITE_OK ){
146462 sqlite3_bind_int64(pCsr->pStmt, 1, pCsr->iPrevId);
146463 pCsr->isRequireSeek = 0;
146464 if( SQLITE_ROW==sqlite3_step(pCsr->pStmt) ){
146465 return SQLITE_OK;
@@ -147877,11 +147913,11 @@
147913 if( idxNum & FTS3_HAVE_DOCID_GE ) pDocidGe = apVal[iIdx++];
147914 if( idxNum & FTS3_HAVE_DOCID_LE ) pDocidLe = apVal[iIdx++];
147915 assert( iIdx==nVal );
147916
147917 /* In case the cursor has been used before, clear it now. */
147918 fts3CursorFinalizeStmt(pCsr);
147919 sqlite3_free(pCsr->aDoclist);
147920 sqlite3Fts3MIBufferFree(pCsr->pMIBuffer);
147921 sqlite3Fts3ExprFree(pCsr->pExpr);
147922 memset(&pCursor[1], 0, sizeof(Fts3Cursor)-sizeof(sqlite3_vtab_cursor));
147923
@@ -147945,11 +147981,11 @@
147981 sqlite3_free(zSql);
147982 }else{
147983 rc = SQLITE_NOMEM;
147984 }
147985 }else if( eSearch==FTS3_DOCID_SEARCH ){
147986 rc = fts3CursorSeekStmt(pCsr);
147987 if( rc==SQLITE_OK ){
147988 rc = sqlite3_bind_value(pCsr->pStmt, 1, pCons);
147989 }
147990 }
147991 if( rc!=SQLITE_OK ) return rc;
@@ -162965,10 +163001,11 @@
163001 /* #include <stdio.h> */
163002
163003 #ifndef SQLITE_AMALGAMATION
163004 #include "sqlite3rtree.h"
163005 typedef sqlite3_int64 i64;
163006 typedef sqlite3_uint64 u64;
163007 typedef unsigned char u8;
163008 typedef unsigned short u16;
163009 typedef unsigned int u32;
163010 #endif
163011
@@ -163266,20 +163303,20 @@
163303 # define MIN(x,y) ((x) > (y) ? (y) : (x))
163304 #endif
163305
163306 /* What version of GCC is being used. 0 means GCC is not being used */
163307 #ifndef GCC_VERSION
163308 #if defined(__GNUC__) && !defined(SQLITE_DISABLE_INTRINSIC)
163309 # define GCC_VERSION (__GNUC__*1000000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__)
163310 #else
163311 # define GCC_VERSION 0
163312 #endif
163313 #endif
163314
163315 /* What version of CLANG is being used. 0 means CLANG is not being used */
163316 #ifndef CLANG_VERSION
163317 #if defined(__clang__) && !defined(_WIN32) && !defined(SQLITE_DISABLE_INTRINSIC)
163318 # define CLANG_VERSION \
163319 (__clang_major__*1000000+__clang_minor__*1000+__clang_patchlevel__)
163320 #else
163321 # define CLANG_VERSION 0
163322 #endif
@@ -163300,27 +163337,26 @@
163337 ** using C-preprocessor macros. If that is unsuccessful, or if
163338 ** -DSQLITE_RUNTIME_BYTEORDER=1 is set, then byte-order is determined
163339 ** at run-time.
163340 */
163341 #ifndef SQLITE_BYTEORDER
163342 #if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
163343 defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
163344 defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
163345 defined(__arm__)
163346 # define SQLITE_BYTEORDER 1234
163347 #elif defined(sparc) || defined(__ppc__)
 
163348 # define SQLITE_BYTEORDER 4321
163349 #else
163350 # define SQLITE_BYTEORDER 0 /* 0 means "unknown at compile-time" */
163351 #endif
163352 #endif
163353
163354
163355 /* What version of MSVC is being used. 0 means MSVC is not being used */
163356 #ifndef MSVC_VERSION
163357 #if defined(_MSC_VER) && !defined(SQLITE_DISABLE_INTRINSIC)
163358 # define MSVC_VERSION _MSC_VER
163359 #else
163360 # define MSVC_VERSION 0
163361 #endif
163362 #endif
@@ -163336,13 +163372,10 @@
163372 assert( ((((char*)p) - (char*)0)&3)==0 ); /* p is always 4-byte aligned */
163373 #if SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
163374 pCoord->u = _byteswap_ulong(*(u32*)p);
163375 #elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
163376 pCoord->u = __builtin_bswap32(*(u32*)p);
 
 
 
163377 #elif SQLITE_BYTEORDER==4321
163378 pCoord->u = *(u32*)p;
163379 #else
163380 pCoord->u = (
163381 (((u32)p[0]) << 24) +
@@ -163382,14 +163415,13 @@
163415 /*
163416 ** Functions to serialize a 16 bit integer, 32 bit real number and
163417 ** 64 bit integer. The value returned is the number of bytes written
163418 ** to the argument buffer (always 2, 4 and 8 respectively).
163419 */
163420 static void writeInt16(u8 *p, int i){
163421 p[0] = (i>> 8)&0xFF;
163422 p[1] = (i>> 0)&0xFF;
 
163423 }
163424 static int writeCoord(u8 *p, RtreeCoord *pCoord){
163425 u32 i;
163426 assert( ((((char*)p) - (char*)0)&3)==0 ); /* p is always 4-byte aligned */
163427 assert( sizeof(RtreeCoord)==4 );
@@ -197506,11 +197538,11 @@
197538 int nArg, /* Number of args */
197539 sqlite3_value **apUnused /* Function arguments */
197540 ){
197541 assert( nArg==0 );
197542 UNUSED_PARAM2(nArg, apUnused);
197543 sqlite3_result_text(pCtx, "fts5: 2017-02-08 19:12:36 1afec5758b624e6a066d4e7ef50695095e9d7ff1", -1, SQLITE_TRANSIENT);
197544 }
197545
197546 static int fts5Init(sqlite3 *db){
197547 static const sqlite3_module fts5Mod = {
197548 /* iVersion */ 2,
197549
+29 -29
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,11 +121,11 @@
121121
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122122
** [sqlite_version()] and [sqlite_source_id()].
123123
*/
124124
#define SQLITE_VERSION "3.17.0"
125125
#define SQLITE_VERSION_NUMBER 3017000
126
-#define SQLITE_SOURCE_ID "2017-02-07 13:51:48 a136609c98ed3cc673c5a3c2578d49db3f2518d1"
126
+#define SQLITE_SOURCE_ID "2017-02-09 17:12:22 798fb9d70d2e5f95e64237b04d6692360133381a"
127127
128128
/*
129129
** CAPI3REF: Run-Time Library Version Numbers
130130
** KEYWORDS: sqlite3_version sqlite3_sourceid
131131
**
@@ -8648,11 +8648,11 @@
86488648
** The session object will be used to create changesets for tables in
86498649
** database zDb, where zDb is either "main", or "temp", or the name of an
86508650
** attached database. It is not an error if database zDb is not attached
86518651
** to the database when the session object is created.
86528652
*/
8653
-int sqlite3session_create(
8653
+SQLITE_API int sqlite3session_create(
86548654
sqlite3 *db, /* Database handle */
86558655
const char *zDb, /* Name of db (e.g. "main") */
86568656
sqlite3_session **ppSession /* OUT: New session object */
86578657
);
86588658
@@ -8666,11 +8666,11 @@
86668666
**
86678667
** Session objects must be deleted before the database handle to which they
86688668
** are attached is closed. Refer to the documentation for
86698669
** [sqlite3session_create()] for details.
86708670
*/
8671
-void sqlite3session_delete(sqlite3_session *pSession);
8671
+SQLITE_API void sqlite3session_delete(sqlite3_session *pSession);
86728672
86738673
86748674
/*
86758675
** CAPI3REF: Enable Or Disable A Session Object
86768676
**
@@ -8686,11 +8686,11 @@
86868686
** no-op, and may be used to query the current state of the session.
86878687
**
86888688
** The return value indicates the final state of the session object: 0 if
86898689
** the session is disabled, or 1 if it is enabled.
86908690
*/
8691
-int sqlite3session_enable(sqlite3_session *pSession, int bEnable);
8691
+SQLITE_API int sqlite3session_enable(sqlite3_session *pSession, int bEnable);
86928692
86938693
/*
86948694
** CAPI3REF: Set Or Clear the Indirect Change Flag
86958695
**
86968696
** Each change recorded by a session object is marked as either direct or
@@ -8715,11 +8715,11 @@
87158715
** indirect flag for the specified session object.
87168716
**
87178717
** The return value indicates the final state of the indirect flag: 0 if
87188718
** it is clear, or 1 if it is set.
87198719
*/
8720
-int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect);
8720
+SQLITE_API int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect);
87218721
87228722
/*
87238723
** CAPI3REF: Attach A Table To A Session Object
87248724
**
87258725
** If argument zTab is not NULL, then it is the name of a table to attach
@@ -8745,11 +8745,11 @@
87458745
** in one or more of their PRIMARY KEY columns.
87468746
**
87478747
** SQLITE_OK is returned if the call completes without error. Or, if an error
87488748
** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned.
87498749
*/
8750
-int sqlite3session_attach(
8750
+SQLITE_API int sqlite3session_attach(
87518751
sqlite3_session *pSession, /* Session object */
87528752
const char *zTab /* Table name */
87538753
);
87548754
87558755
/*
@@ -8759,11 +8759,11 @@
87598759
** in tables that are not attached to the Session object, the filter is called
87608760
** to determine whether changes to the table's rows should be tracked or not.
87618761
** If xFilter returns 0, changes is not tracked. Note that once a table is
87628762
** attached, xFilter will not be called again.
87638763
*/
8764
-void sqlite3session_table_filter(
8764
+SQLITE_API void sqlite3session_table_filter(
87658765
sqlite3_session *pSession, /* Session object */
87668766
int(*xFilter)(
87678767
void *pCtx, /* Copy of third arg to _filter_table() */
87688768
const char *zTab /* Table name */
87698769
),
@@ -8872,11 +8872,11 @@
88728872
** changeset, even though the delete took place while the session was disabled.
88738873
** Or, if one field of a row is updated while a session is disabled, and
88748874
** another field of the same row is updated while the session is enabled, the
88758875
** resulting changeset will contain an UPDATE change that updates both fields.
88768876
*/
8877
-int sqlite3session_changeset(
8877
+SQLITE_API int sqlite3session_changeset(
88788878
sqlite3_session *pSession, /* Session object */
88798879
int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */
88808880
void **ppChangeset /* OUT: Buffer containing changeset */
88818881
);
88828882
@@ -8934,11 +8934,11 @@
89348934
** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
89358935
** may be set to point to a buffer containing an English language error
89368936
** message. It is the responsibility of the caller to free this buffer using
89378937
** sqlite3_free().
89388938
*/
8939
-int sqlite3session_diff(
8939
+SQLITE_API int sqlite3session_diff(
89408940
sqlite3_session *pSession,
89418941
const char *zFromDb,
89428942
const char *zTbl,
89438943
char **pzErrMsg
89448944
);
@@ -8970,11 +8970,11 @@
89708970
** Changes within a patchset are ordered in the same way as for changesets
89718971
** generated by the sqlite3session_changeset() function (i.e. all changes for
89728972
** a single table are grouped together, tables appear in the order in which
89738973
** they were attached to the session object).
89748974
*/
8975
-int sqlite3session_patchset(
8975
+SQLITE_API int sqlite3session_patchset(
89768976
sqlite3_session *pSession, /* Session object */
89778977
int *pnPatchset, /* OUT: Size of buffer at *ppChangeset */
89788978
void **ppPatchset /* OUT: Buffer containing changeset */
89798979
);
89808980
@@ -8991,11 +8991,11 @@
89918991
** an attached table is modified and then later on the original values
89928992
** are restored. However, if this function returns non-zero, then it is
89938993
** guaranteed that a call to sqlite3session_changeset() will return a
89948994
** changeset containing zero changes.
89958995
*/
8996
-int sqlite3session_isempty(sqlite3_session *pSession);
8996
+SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession);
89978997
89988998
/*
89998999
** CAPI3REF: Create An Iterator To Traverse A Changeset
90009000
**
90019001
** Create an iterator used to iterate through the contents of a changeset.
@@ -9026,11 +9026,11 @@
90269026
** this function, all changes that relate to a single table are visited
90279027
** consecutively. There is no chance that the iterator will visit a change
90289028
** the applies to table X, then one for table Y, and then later on visit
90299029
** another change for table X.
90309030
*/
9031
-int sqlite3changeset_start(
9031
+SQLITE_API int sqlite3changeset_start(
90329032
sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */
90339033
int nChangeset, /* Size of changeset blob in bytes */
90349034
void *pChangeset /* Pointer to blob containing changeset */
90359035
);
90369036
@@ -9055,11 +9055,11 @@
90559055
**
90569056
** If an error occurs, an SQLite error code is returned. Possible error
90579057
** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or
90589058
** SQLITE_NOMEM.
90599059
*/
9060
-int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
9060
+SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
90619061
90629062
/*
90639063
** CAPI3REF: Obtain The Current Operation From A Changeset Iterator
90649064
**
90659065
** The pIter argument passed to this function may either be an iterator
@@ -9083,11 +9083,11 @@
90839083
**
90849084
** If no error occurs, SQLITE_OK is returned. If an error does occur, an
90859085
** SQLite error code is returned. The values of the output variables may not
90869086
** be trusted in this case.
90879087
*/
9088
-int sqlite3changeset_op(
9088
+SQLITE_API int sqlite3changeset_op(
90899089
sqlite3_changeset_iter *pIter, /* Iterator object */
90909090
const char **pzTab, /* OUT: Pointer to table name */
90919091
int *pnCol, /* OUT: Number of columns in table */
90929092
int *pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */
90939093
int *pbIndirect /* OUT: True for an 'indirect' change */
@@ -9116,11 +9116,11 @@
91169116
** If this function is called when the iterator does not point to a valid
91179117
** entry, SQLITE_MISUSE is returned and the output variables zeroed. Otherwise,
91189118
** SQLITE_OK is returned and the output variables populated as described
91199119
** above.
91209120
*/
9121
-int sqlite3changeset_pk(
9121
+SQLITE_API int sqlite3changeset_pk(
91229122
sqlite3_changeset_iter *pIter, /* Iterator object */
91239123
unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */
91249124
int *pnCol /* OUT: Number of entries in output array */
91259125
);
91269126
@@ -9146,11 +9146,11 @@
91469146
** is similar to the "old.*" columns available to update or delete triggers.
91479147
**
91489148
** If some other error occurs (e.g. an OOM condition), an SQLite error code
91499149
** is returned and *ppValue is set to NULL.
91509150
*/
9151
-int sqlite3changeset_old(
9151
+SQLITE_API int sqlite3changeset_old(
91529152
sqlite3_changeset_iter *pIter, /* Changeset iterator */
91539153
int iVal, /* Column number */
91549154
sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */
91559155
);
91569156
@@ -9179,11 +9179,11 @@
91799179
** triggers.
91809180
**
91819181
** If some other error occurs (e.g. an OOM condition), an SQLite error code
91829182
** is returned and *ppValue is set to NULL.
91839183
*/
9184
-int sqlite3changeset_new(
9184
+SQLITE_API int sqlite3changeset_new(
91859185
sqlite3_changeset_iter *pIter, /* Changeset iterator */
91869186
int iVal, /* Column number */
91879187
sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */
91889188
);
91899189
@@ -9206,11 +9206,11 @@
92069206
** and returns SQLITE_OK.
92079207
**
92089208
** If some other error occurs (e.g. an OOM condition), an SQLite error code
92099209
** is returned and *ppValue is set to NULL.
92109210
*/
9211
-int sqlite3changeset_conflict(
9211
+SQLITE_API int sqlite3changeset_conflict(
92129212
sqlite3_changeset_iter *pIter, /* Changeset iterator */
92139213
int iVal, /* Column number */
92149214
sqlite3_value **ppValue /* OUT: Value from conflicting row */
92159215
);
92169216
@@ -9222,11 +9222,11 @@
92229222
** it sets the output variable to the total number of known foreign key
92239223
** violations in the destination database and returns SQLITE_OK.
92249224
**
92259225
** In all other cases this function returns SQLITE_MISUSE.
92269226
*/
9227
-int sqlite3changeset_fk_conflicts(
9227
+SQLITE_API int sqlite3changeset_fk_conflicts(
92289228
sqlite3_changeset_iter *pIter, /* Changeset iterator */
92299229
int *pnOut /* OUT: Number of FK violations */
92309230
);
92319231
92329232
@@ -9255,11 +9255,11 @@
92559255
** rc = sqlite3changeset_finalize();
92569256
** if( rc!=SQLITE_OK ){
92579257
** // An error has occurred
92589258
** }
92599259
*/
9260
-int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter);
9260
+SQLITE_API int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter);
92619261
92629262
/*
92639263
** CAPI3REF: Invert A Changeset
92649264
**
92659265
** This function is used to "invert" a changeset object. Applying an inverted
@@ -9285,11 +9285,11 @@
92859285
** call to this function.
92869286
**
92879287
** WARNING/TODO: This function currently assumes that the input is a valid
92889288
** changeset. If it is not, the results are undefined.
92899289
*/
9290
-int sqlite3changeset_invert(
9290
+SQLITE_API int sqlite3changeset_invert(
92919291
int nIn, const void *pIn, /* Input changeset */
92929292
int *pnOut, void **ppOut /* OUT: Inverse of input */
92939293
);
92949294
92959295
/*
@@ -9314,11 +9314,11 @@
93149314
** *pnOut = 0;
93159315
** }
93169316
**
93179317
** Refer to the sqlite3_changegroup documentation below for details.
93189318
*/
9319
-int sqlite3changeset_concat(
9319
+SQLITE_API int sqlite3changeset_concat(
93209320
int nA, /* Number of bytes in buffer pA */
93219321
void *pA, /* Pointer to buffer containing changeset A */
93229322
int nB, /* Number of bytes in buffer pB */
93239323
void *pB, /* Pointer to buffer containing changeset B */
93249324
int *pnOut, /* OUT: Number of bytes in output changeset */
@@ -9620,11 +9620,11 @@
96209620
** If any other error (aside from a constraint failure when attempting to
96219621
** write to the target database) occurs, then the savepoint transaction is
96229622
** rolled back, restoring the target database to its original state, and an
96239623
** SQLite error code returned.
96249624
*/
9625
-int sqlite3changeset_apply(
9625
+SQLITE_API int sqlite3changeset_apply(
96269626
sqlite3 *db, /* Apply change to "main" db of this handle */
96279627
int nChangeset, /* Size of changeset in bytes */
96289628
void *pChangeset, /* Changeset blob */
96299629
int(*xFilter)(
96309630
void *pCtx, /* Copy of sixth arg to _apply() */
@@ -9821,11 +9821,11 @@
98219821
**
98229822
** The sessions module never invokes an xOutput callback with the third
98239823
** parameter set to a value less than or equal to zero. Other than this,
98249824
** no guarantees are made as to the size of the chunks of data returned.
98259825
*/
9826
-int sqlite3changeset_apply_strm(
9826
+SQLITE_API int sqlite3changeset_apply_strm(
98279827
sqlite3 *db, /* Apply change to "main" db of this handle */
98289828
int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */
98299829
void *pIn, /* First arg for xInput */
98309830
int(*xFilter)(
98319831
void *pCtx, /* Copy of sixth arg to _apply() */
@@ -9836,35 +9836,35 @@
98369836
int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
98379837
sqlite3_changeset_iter *p /* Handle describing change and conflict */
98389838
),
98399839
void *pCtx /* First argument passed to xConflict */
98409840
);
9841
-int sqlite3changeset_concat_strm(
9841
+SQLITE_API int sqlite3changeset_concat_strm(
98429842
int (*xInputA)(void *pIn, void *pData, int *pnData),
98439843
void *pInA,
98449844
int (*xInputB)(void *pIn, void *pData, int *pnData),
98459845
void *pInB,
98469846
int (*xOutput)(void *pOut, const void *pData, int nData),
98479847
void *pOut
98489848
);
9849
-int sqlite3changeset_invert_strm(
9849
+SQLITE_API int sqlite3changeset_invert_strm(
98509850
int (*xInput)(void *pIn, void *pData, int *pnData),
98519851
void *pIn,
98529852
int (*xOutput)(void *pOut, const void *pData, int nData),
98539853
void *pOut
98549854
);
9855
-int sqlite3changeset_start_strm(
9855
+SQLITE_API int sqlite3changeset_start_strm(
98569856
sqlite3_changeset_iter **pp,
98579857
int (*xInput)(void *pIn, void *pData, int *pnData),
98589858
void *pIn
98599859
);
9860
-int sqlite3session_changeset_strm(
9860
+SQLITE_API int sqlite3session_changeset_strm(
98619861
sqlite3_session *pSession,
98629862
int (*xOutput)(void *pOut, const void *pData, int nData),
98639863
void *pOut
98649864
);
9865
-int sqlite3session_patchset_strm(
9865
+SQLITE_API int sqlite3session_patchset_strm(
98669866
sqlite3_session *pSession,
98679867
int (*xOutput)(void *pOut, const void *pData, int nData),
98689868
void *pOut
98699869
);
98709870
int sqlite3changegroup_add_strm(sqlite3_changegroup*,
98719871
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,11 +121,11 @@
121 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122 ** [sqlite_version()] and [sqlite_source_id()].
123 */
124 #define SQLITE_VERSION "3.17.0"
125 #define SQLITE_VERSION_NUMBER 3017000
126 #define SQLITE_SOURCE_ID "2017-02-07 13:51:48 a136609c98ed3cc673c5a3c2578d49db3f2518d1"
127
128 /*
129 ** CAPI3REF: Run-Time Library Version Numbers
130 ** KEYWORDS: sqlite3_version sqlite3_sourceid
131 **
@@ -8648,11 +8648,11 @@
8648 ** The session object will be used to create changesets for tables in
8649 ** database zDb, where zDb is either "main", or "temp", or the name of an
8650 ** attached database. It is not an error if database zDb is not attached
8651 ** to the database when the session object is created.
8652 */
8653 int sqlite3session_create(
8654 sqlite3 *db, /* Database handle */
8655 const char *zDb, /* Name of db (e.g. "main") */
8656 sqlite3_session **ppSession /* OUT: New session object */
8657 );
8658
@@ -8666,11 +8666,11 @@
8666 **
8667 ** Session objects must be deleted before the database handle to which they
8668 ** are attached is closed. Refer to the documentation for
8669 ** [sqlite3session_create()] for details.
8670 */
8671 void sqlite3session_delete(sqlite3_session *pSession);
8672
8673
8674 /*
8675 ** CAPI3REF: Enable Or Disable A Session Object
8676 **
@@ -8686,11 +8686,11 @@
8686 ** no-op, and may be used to query the current state of the session.
8687 **
8688 ** The return value indicates the final state of the session object: 0 if
8689 ** the session is disabled, or 1 if it is enabled.
8690 */
8691 int sqlite3session_enable(sqlite3_session *pSession, int bEnable);
8692
8693 /*
8694 ** CAPI3REF: Set Or Clear the Indirect Change Flag
8695 **
8696 ** Each change recorded by a session object is marked as either direct or
@@ -8715,11 +8715,11 @@
8715 ** indirect flag for the specified session object.
8716 **
8717 ** The return value indicates the final state of the indirect flag: 0 if
8718 ** it is clear, or 1 if it is set.
8719 */
8720 int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect);
8721
8722 /*
8723 ** CAPI3REF: Attach A Table To A Session Object
8724 **
8725 ** If argument zTab is not NULL, then it is the name of a table to attach
@@ -8745,11 +8745,11 @@
8745 ** in one or more of their PRIMARY KEY columns.
8746 **
8747 ** SQLITE_OK is returned if the call completes without error. Or, if an error
8748 ** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned.
8749 */
8750 int sqlite3session_attach(
8751 sqlite3_session *pSession, /* Session object */
8752 const char *zTab /* Table name */
8753 );
8754
8755 /*
@@ -8759,11 +8759,11 @@
8759 ** in tables that are not attached to the Session object, the filter is called
8760 ** to determine whether changes to the table's rows should be tracked or not.
8761 ** If xFilter returns 0, changes is not tracked. Note that once a table is
8762 ** attached, xFilter will not be called again.
8763 */
8764 void sqlite3session_table_filter(
8765 sqlite3_session *pSession, /* Session object */
8766 int(*xFilter)(
8767 void *pCtx, /* Copy of third arg to _filter_table() */
8768 const char *zTab /* Table name */
8769 ),
@@ -8872,11 +8872,11 @@
8872 ** changeset, even though the delete took place while the session was disabled.
8873 ** Or, if one field of a row is updated while a session is disabled, and
8874 ** another field of the same row is updated while the session is enabled, the
8875 ** resulting changeset will contain an UPDATE change that updates both fields.
8876 */
8877 int sqlite3session_changeset(
8878 sqlite3_session *pSession, /* Session object */
8879 int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */
8880 void **ppChangeset /* OUT: Buffer containing changeset */
8881 );
8882
@@ -8934,11 +8934,11 @@
8934 ** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
8935 ** may be set to point to a buffer containing an English language error
8936 ** message. It is the responsibility of the caller to free this buffer using
8937 ** sqlite3_free().
8938 */
8939 int sqlite3session_diff(
8940 sqlite3_session *pSession,
8941 const char *zFromDb,
8942 const char *zTbl,
8943 char **pzErrMsg
8944 );
@@ -8970,11 +8970,11 @@
8970 ** Changes within a patchset are ordered in the same way as for changesets
8971 ** generated by the sqlite3session_changeset() function (i.e. all changes for
8972 ** a single table are grouped together, tables appear in the order in which
8973 ** they were attached to the session object).
8974 */
8975 int sqlite3session_patchset(
8976 sqlite3_session *pSession, /* Session object */
8977 int *pnPatchset, /* OUT: Size of buffer at *ppChangeset */
8978 void **ppPatchset /* OUT: Buffer containing changeset */
8979 );
8980
@@ -8991,11 +8991,11 @@
8991 ** an attached table is modified and then later on the original values
8992 ** are restored. However, if this function returns non-zero, then it is
8993 ** guaranteed that a call to sqlite3session_changeset() will return a
8994 ** changeset containing zero changes.
8995 */
8996 int sqlite3session_isempty(sqlite3_session *pSession);
8997
8998 /*
8999 ** CAPI3REF: Create An Iterator To Traverse A Changeset
9000 **
9001 ** Create an iterator used to iterate through the contents of a changeset.
@@ -9026,11 +9026,11 @@
9026 ** this function, all changes that relate to a single table are visited
9027 ** consecutively. There is no chance that the iterator will visit a change
9028 ** the applies to table X, then one for table Y, and then later on visit
9029 ** another change for table X.
9030 */
9031 int sqlite3changeset_start(
9032 sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */
9033 int nChangeset, /* Size of changeset blob in bytes */
9034 void *pChangeset /* Pointer to blob containing changeset */
9035 );
9036
@@ -9055,11 +9055,11 @@
9055 **
9056 ** If an error occurs, an SQLite error code is returned. Possible error
9057 ** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or
9058 ** SQLITE_NOMEM.
9059 */
9060 int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
9061
9062 /*
9063 ** CAPI3REF: Obtain The Current Operation From A Changeset Iterator
9064 **
9065 ** The pIter argument passed to this function may either be an iterator
@@ -9083,11 +9083,11 @@
9083 **
9084 ** If no error occurs, SQLITE_OK is returned. If an error does occur, an
9085 ** SQLite error code is returned. The values of the output variables may not
9086 ** be trusted in this case.
9087 */
9088 int sqlite3changeset_op(
9089 sqlite3_changeset_iter *pIter, /* Iterator object */
9090 const char **pzTab, /* OUT: Pointer to table name */
9091 int *pnCol, /* OUT: Number of columns in table */
9092 int *pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */
9093 int *pbIndirect /* OUT: True for an 'indirect' change */
@@ -9116,11 +9116,11 @@
9116 ** If this function is called when the iterator does not point to a valid
9117 ** entry, SQLITE_MISUSE is returned and the output variables zeroed. Otherwise,
9118 ** SQLITE_OK is returned and the output variables populated as described
9119 ** above.
9120 */
9121 int sqlite3changeset_pk(
9122 sqlite3_changeset_iter *pIter, /* Iterator object */
9123 unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */
9124 int *pnCol /* OUT: Number of entries in output array */
9125 );
9126
@@ -9146,11 +9146,11 @@
9146 ** is similar to the "old.*" columns available to update or delete triggers.
9147 **
9148 ** If some other error occurs (e.g. an OOM condition), an SQLite error code
9149 ** is returned and *ppValue is set to NULL.
9150 */
9151 int sqlite3changeset_old(
9152 sqlite3_changeset_iter *pIter, /* Changeset iterator */
9153 int iVal, /* Column number */
9154 sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */
9155 );
9156
@@ -9179,11 +9179,11 @@
9179 ** triggers.
9180 **
9181 ** If some other error occurs (e.g. an OOM condition), an SQLite error code
9182 ** is returned and *ppValue is set to NULL.
9183 */
9184 int sqlite3changeset_new(
9185 sqlite3_changeset_iter *pIter, /* Changeset iterator */
9186 int iVal, /* Column number */
9187 sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */
9188 );
9189
@@ -9206,11 +9206,11 @@
9206 ** and returns SQLITE_OK.
9207 **
9208 ** If some other error occurs (e.g. an OOM condition), an SQLite error code
9209 ** is returned and *ppValue is set to NULL.
9210 */
9211 int sqlite3changeset_conflict(
9212 sqlite3_changeset_iter *pIter, /* Changeset iterator */
9213 int iVal, /* Column number */
9214 sqlite3_value **ppValue /* OUT: Value from conflicting row */
9215 );
9216
@@ -9222,11 +9222,11 @@
9222 ** it sets the output variable to the total number of known foreign key
9223 ** violations in the destination database and returns SQLITE_OK.
9224 **
9225 ** In all other cases this function returns SQLITE_MISUSE.
9226 */
9227 int sqlite3changeset_fk_conflicts(
9228 sqlite3_changeset_iter *pIter, /* Changeset iterator */
9229 int *pnOut /* OUT: Number of FK violations */
9230 );
9231
9232
@@ -9255,11 +9255,11 @@
9255 ** rc = sqlite3changeset_finalize();
9256 ** if( rc!=SQLITE_OK ){
9257 ** // An error has occurred
9258 ** }
9259 */
9260 int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter);
9261
9262 /*
9263 ** CAPI3REF: Invert A Changeset
9264 **
9265 ** This function is used to "invert" a changeset object. Applying an inverted
@@ -9285,11 +9285,11 @@
9285 ** call to this function.
9286 **
9287 ** WARNING/TODO: This function currently assumes that the input is a valid
9288 ** changeset. If it is not, the results are undefined.
9289 */
9290 int sqlite3changeset_invert(
9291 int nIn, const void *pIn, /* Input changeset */
9292 int *pnOut, void **ppOut /* OUT: Inverse of input */
9293 );
9294
9295 /*
@@ -9314,11 +9314,11 @@
9314 ** *pnOut = 0;
9315 ** }
9316 **
9317 ** Refer to the sqlite3_changegroup documentation below for details.
9318 */
9319 int sqlite3changeset_concat(
9320 int nA, /* Number of bytes in buffer pA */
9321 void *pA, /* Pointer to buffer containing changeset A */
9322 int nB, /* Number of bytes in buffer pB */
9323 void *pB, /* Pointer to buffer containing changeset B */
9324 int *pnOut, /* OUT: Number of bytes in output changeset */
@@ -9620,11 +9620,11 @@
9620 ** If any other error (aside from a constraint failure when attempting to
9621 ** write to the target database) occurs, then the savepoint transaction is
9622 ** rolled back, restoring the target database to its original state, and an
9623 ** SQLite error code returned.
9624 */
9625 int sqlite3changeset_apply(
9626 sqlite3 *db, /* Apply change to "main" db of this handle */
9627 int nChangeset, /* Size of changeset in bytes */
9628 void *pChangeset, /* Changeset blob */
9629 int(*xFilter)(
9630 void *pCtx, /* Copy of sixth arg to _apply() */
@@ -9821,11 +9821,11 @@
9821 **
9822 ** The sessions module never invokes an xOutput callback with the third
9823 ** parameter set to a value less than or equal to zero. Other than this,
9824 ** no guarantees are made as to the size of the chunks of data returned.
9825 */
9826 int sqlite3changeset_apply_strm(
9827 sqlite3 *db, /* Apply change to "main" db of this handle */
9828 int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */
9829 void *pIn, /* First arg for xInput */
9830 int(*xFilter)(
9831 void *pCtx, /* Copy of sixth arg to _apply() */
@@ -9836,35 +9836,35 @@
9836 int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
9837 sqlite3_changeset_iter *p /* Handle describing change and conflict */
9838 ),
9839 void *pCtx /* First argument passed to xConflict */
9840 );
9841 int sqlite3changeset_concat_strm(
9842 int (*xInputA)(void *pIn, void *pData, int *pnData),
9843 void *pInA,
9844 int (*xInputB)(void *pIn, void *pData, int *pnData),
9845 void *pInB,
9846 int (*xOutput)(void *pOut, const void *pData, int nData),
9847 void *pOut
9848 );
9849 int sqlite3changeset_invert_strm(
9850 int (*xInput)(void *pIn, void *pData, int *pnData),
9851 void *pIn,
9852 int (*xOutput)(void *pOut, const void *pData, int nData),
9853 void *pOut
9854 );
9855 int sqlite3changeset_start_strm(
9856 sqlite3_changeset_iter **pp,
9857 int (*xInput)(void *pIn, void *pData, int *pnData),
9858 void *pIn
9859 );
9860 int sqlite3session_changeset_strm(
9861 sqlite3_session *pSession,
9862 int (*xOutput)(void *pOut, const void *pData, int nData),
9863 void *pOut
9864 );
9865 int sqlite3session_patchset_strm(
9866 sqlite3_session *pSession,
9867 int (*xOutput)(void *pOut, const void *pData, int nData),
9868 void *pOut
9869 );
9870 int sqlite3changegroup_add_strm(sqlite3_changegroup*,
9871
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,11 +121,11 @@
121 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122 ** [sqlite_version()] and [sqlite_source_id()].
123 */
124 #define SQLITE_VERSION "3.17.0"
125 #define SQLITE_VERSION_NUMBER 3017000
126 #define SQLITE_SOURCE_ID "2017-02-09 17:12:22 798fb9d70d2e5f95e64237b04d6692360133381a"
127
128 /*
129 ** CAPI3REF: Run-Time Library Version Numbers
130 ** KEYWORDS: sqlite3_version sqlite3_sourceid
131 **
@@ -8648,11 +8648,11 @@
8648 ** The session object will be used to create changesets for tables in
8649 ** database zDb, where zDb is either "main", or "temp", or the name of an
8650 ** attached database. It is not an error if database zDb is not attached
8651 ** to the database when the session object is created.
8652 */
8653 SQLITE_API int sqlite3session_create(
8654 sqlite3 *db, /* Database handle */
8655 const char *zDb, /* Name of db (e.g. "main") */
8656 sqlite3_session **ppSession /* OUT: New session object */
8657 );
8658
@@ -8666,11 +8666,11 @@
8666 **
8667 ** Session objects must be deleted before the database handle to which they
8668 ** are attached is closed. Refer to the documentation for
8669 ** [sqlite3session_create()] for details.
8670 */
8671 SQLITE_API void sqlite3session_delete(sqlite3_session *pSession);
8672
8673
8674 /*
8675 ** CAPI3REF: Enable Or Disable A Session Object
8676 **
@@ -8686,11 +8686,11 @@
8686 ** no-op, and may be used to query the current state of the session.
8687 **
8688 ** The return value indicates the final state of the session object: 0 if
8689 ** the session is disabled, or 1 if it is enabled.
8690 */
8691 SQLITE_API int sqlite3session_enable(sqlite3_session *pSession, int bEnable);
8692
8693 /*
8694 ** CAPI3REF: Set Or Clear the Indirect Change Flag
8695 **
8696 ** Each change recorded by a session object is marked as either direct or
@@ -8715,11 +8715,11 @@
8715 ** indirect flag for the specified session object.
8716 **
8717 ** The return value indicates the final state of the indirect flag: 0 if
8718 ** it is clear, or 1 if it is set.
8719 */
8720 SQLITE_API int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect);
8721
8722 /*
8723 ** CAPI3REF: Attach A Table To A Session Object
8724 **
8725 ** If argument zTab is not NULL, then it is the name of a table to attach
@@ -8745,11 +8745,11 @@
8745 ** in one or more of their PRIMARY KEY columns.
8746 **
8747 ** SQLITE_OK is returned if the call completes without error. Or, if an error
8748 ** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned.
8749 */
8750 SQLITE_API int sqlite3session_attach(
8751 sqlite3_session *pSession, /* Session object */
8752 const char *zTab /* Table name */
8753 );
8754
8755 /*
@@ -8759,11 +8759,11 @@
8759 ** in tables that are not attached to the Session object, the filter is called
8760 ** to determine whether changes to the table's rows should be tracked or not.
8761 ** If xFilter returns 0, changes is not tracked. Note that once a table is
8762 ** attached, xFilter will not be called again.
8763 */
8764 SQLITE_API void sqlite3session_table_filter(
8765 sqlite3_session *pSession, /* Session object */
8766 int(*xFilter)(
8767 void *pCtx, /* Copy of third arg to _filter_table() */
8768 const char *zTab /* Table name */
8769 ),
@@ -8872,11 +8872,11 @@
8872 ** changeset, even though the delete took place while the session was disabled.
8873 ** Or, if one field of a row is updated while a session is disabled, and
8874 ** another field of the same row is updated while the session is enabled, the
8875 ** resulting changeset will contain an UPDATE change that updates both fields.
8876 */
8877 SQLITE_API int sqlite3session_changeset(
8878 sqlite3_session *pSession, /* Session object */
8879 int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */
8880 void **ppChangeset /* OUT: Buffer containing changeset */
8881 );
8882
@@ -8934,11 +8934,11 @@
8934 ** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
8935 ** may be set to point to a buffer containing an English language error
8936 ** message. It is the responsibility of the caller to free this buffer using
8937 ** sqlite3_free().
8938 */
8939 SQLITE_API int sqlite3session_diff(
8940 sqlite3_session *pSession,
8941 const char *zFromDb,
8942 const char *zTbl,
8943 char **pzErrMsg
8944 );
@@ -8970,11 +8970,11 @@
8970 ** Changes within a patchset are ordered in the same way as for changesets
8971 ** generated by the sqlite3session_changeset() function (i.e. all changes for
8972 ** a single table are grouped together, tables appear in the order in which
8973 ** they were attached to the session object).
8974 */
8975 SQLITE_API int sqlite3session_patchset(
8976 sqlite3_session *pSession, /* Session object */
8977 int *pnPatchset, /* OUT: Size of buffer at *ppChangeset */
8978 void **ppPatchset /* OUT: Buffer containing changeset */
8979 );
8980
@@ -8991,11 +8991,11 @@
8991 ** an attached table is modified and then later on the original values
8992 ** are restored. However, if this function returns non-zero, then it is
8993 ** guaranteed that a call to sqlite3session_changeset() will return a
8994 ** changeset containing zero changes.
8995 */
8996 SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession);
8997
8998 /*
8999 ** CAPI3REF: Create An Iterator To Traverse A Changeset
9000 **
9001 ** Create an iterator used to iterate through the contents of a changeset.
@@ -9026,11 +9026,11 @@
9026 ** this function, all changes that relate to a single table are visited
9027 ** consecutively. There is no chance that the iterator will visit a change
9028 ** the applies to table X, then one for table Y, and then later on visit
9029 ** another change for table X.
9030 */
9031 SQLITE_API int sqlite3changeset_start(
9032 sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */
9033 int nChangeset, /* Size of changeset blob in bytes */
9034 void *pChangeset /* Pointer to blob containing changeset */
9035 );
9036
@@ -9055,11 +9055,11 @@
9055 **
9056 ** If an error occurs, an SQLite error code is returned. Possible error
9057 ** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or
9058 ** SQLITE_NOMEM.
9059 */
9060 SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
9061
9062 /*
9063 ** CAPI3REF: Obtain The Current Operation From A Changeset Iterator
9064 **
9065 ** The pIter argument passed to this function may either be an iterator
@@ -9083,11 +9083,11 @@
9083 **
9084 ** If no error occurs, SQLITE_OK is returned. If an error does occur, an
9085 ** SQLite error code is returned. The values of the output variables may not
9086 ** be trusted in this case.
9087 */
9088 SQLITE_API int sqlite3changeset_op(
9089 sqlite3_changeset_iter *pIter, /* Iterator object */
9090 const char **pzTab, /* OUT: Pointer to table name */
9091 int *pnCol, /* OUT: Number of columns in table */
9092 int *pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */
9093 int *pbIndirect /* OUT: True for an 'indirect' change */
@@ -9116,11 +9116,11 @@
9116 ** If this function is called when the iterator does not point to a valid
9117 ** entry, SQLITE_MISUSE is returned and the output variables zeroed. Otherwise,
9118 ** SQLITE_OK is returned and the output variables populated as described
9119 ** above.
9120 */
9121 SQLITE_API int sqlite3changeset_pk(
9122 sqlite3_changeset_iter *pIter, /* Iterator object */
9123 unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */
9124 int *pnCol /* OUT: Number of entries in output array */
9125 );
9126
@@ -9146,11 +9146,11 @@
9146 ** is similar to the "old.*" columns available to update or delete triggers.
9147 **
9148 ** If some other error occurs (e.g. an OOM condition), an SQLite error code
9149 ** is returned and *ppValue is set to NULL.
9150 */
9151 SQLITE_API int sqlite3changeset_old(
9152 sqlite3_changeset_iter *pIter, /* Changeset iterator */
9153 int iVal, /* Column number */
9154 sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */
9155 );
9156
@@ -9179,11 +9179,11 @@
9179 ** triggers.
9180 **
9181 ** If some other error occurs (e.g. an OOM condition), an SQLite error code
9182 ** is returned and *ppValue is set to NULL.
9183 */
9184 SQLITE_API int sqlite3changeset_new(
9185 sqlite3_changeset_iter *pIter, /* Changeset iterator */
9186 int iVal, /* Column number */
9187 sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */
9188 );
9189
@@ -9206,11 +9206,11 @@
9206 ** and returns SQLITE_OK.
9207 **
9208 ** If some other error occurs (e.g. an OOM condition), an SQLite error code
9209 ** is returned and *ppValue is set to NULL.
9210 */
9211 SQLITE_API int sqlite3changeset_conflict(
9212 sqlite3_changeset_iter *pIter, /* Changeset iterator */
9213 int iVal, /* Column number */
9214 sqlite3_value **ppValue /* OUT: Value from conflicting row */
9215 );
9216
@@ -9222,11 +9222,11 @@
9222 ** it sets the output variable to the total number of known foreign key
9223 ** violations in the destination database and returns SQLITE_OK.
9224 **
9225 ** In all other cases this function returns SQLITE_MISUSE.
9226 */
9227 SQLITE_API int sqlite3changeset_fk_conflicts(
9228 sqlite3_changeset_iter *pIter, /* Changeset iterator */
9229 int *pnOut /* OUT: Number of FK violations */
9230 );
9231
9232
@@ -9255,11 +9255,11 @@
9255 ** rc = sqlite3changeset_finalize();
9256 ** if( rc!=SQLITE_OK ){
9257 ** // An error has occurred
9258 ** }
9259 */
9260 SQLITE_API int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter);
9261
9262 /*
9263 ** CAPI3REF: Invert A Changeset
9264 **
9265 ** This function is used to "invert" a changeset object. Applying an inverted
@@ -9285,11 +9285,11 @@
9285 ** call to this function.
9286 **
9287 ** WARNING/TODO: This function currently assumes that the input is a valid
9288 ** changeset. If it is not, the results are undefined.
9289 */
9290 SQLITE_API int sqlite3changeset_invert(
9291 int nIn, const void *pIn, /* Input changeset */
9292 int *pnOut, void **ppOut /* OUT: Inverse of input */
9293 );
9294
9295 /*
@@ -9314,11 +9314,11 @@
9314 ** *pnOut = 0;
9315 ** }
9316 **
9317 ** Refer to the sqlite3_changegroup documentation below for details.
9318 */
9319 SQLITE_API int sqlite3changeset_concat(
9320 int nA, /* Number of bytes in buffer pA */
9321 void *pA, /* Pointer to buffer containing changeset A */
9322 int nB, /* Number of bytes in buffer pB */
9323 void *pB, /* Pointer to buffer containing changeset B */
9324 int *pnOut, /* OUT: Number of bytes in output changeset */
@@ -9620,11 +9620,11 @@
9620 ** If any other error (aside from a constraint failure when attempting to
9621 ** write to the target database) occurs, then the savepoint transaction is
9622 ** rolled back, restoring the target database to its original state, and an
9623 ** SQLite error code returned.
9624 */
9625 SQLITE_API int sqlite3changeset_apply(
9626 sqlite3 *db, /* Apply change to "main" db of this handle */
9627 int nChangeset, /* Size of changeset in bytes */
9628 void *pChangeset, /* Changeset blob */
9629 int(*xFilter)(
9630 void *pCtx, /* Copy of sixth arg to _apply() */
@@ -9821,11 +9821,11 @@
9821 **
9822 ** The sessions module never invokes an xOutput callback with the third
9823 ** parameter set to a value less than or equal to zero. Other than this,
9824 ** no guarantees are made as to the size of the chunks of data returned.
9825 */
9826 SQLITE_API int sqlite3changeset_apply_strm(
9827 sqlite3 *db, /* Apply change to "main" db of this handle */
9828 int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */
9829 void *pIn, /* First arg for xInput */
9830 int(*xFilter)(
9831 void *pCtx, /* Copy of sixth arg to _apply() */
@@ -9836,35 +9836,35 @@
9836 int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
9837 sqlite3_changeset_iter *p /* Handle describing change and conflict */
9838 ),
9839 void *pCtx /* First argument passed to xConflict */
9840 );
9841 SQLITE_API int sqlite3changeset_concat_strm(
9842 int (*xInputA)(void *pIn, void *pData, int *pnData),
9843 void *pInA,
9844 int (*xInputB)(void *pIn, void *pData, int *pnData),
9845 void *pInB,
9846 int (*xOutput)(void *pOut, const void *pData, int nData),
9847 void *pOut
9848 );
9849 SQLITE_API int sqlite3changeset_invert_strm(
9850 int (*xInput)(void *pIn, void *pData, int *pnData),
9851 void *pIn,
9852 int (*xOutput)(void *pOut, const void *pData, int nData),
9853 void *pOut
9854 );
9855 SQLITE_API int sqlite3changeset_start_strm(
9856 sqlite3_changeset_iter **pp,
9857 int (*xInput)(void *pIn, void *pData, int *pnData),
9858 void *pIn
9859 );
9860 SQLITE_API int sqlite3session_changeset_strm(
9861 sqlite3_session *pSession,
9862 int (*xOutput)(void *pOut, const void *pData, int nData),
9863 void *pOut
9864 );
9865 SQLITE_API int sqlite3session_patchset_strm(
9866 sqlite3_session *pSession,
9867 int (*xOutput)(void *pOut, const void *pData, int nData),
9868 void *pOut
9869 );
9870 int sqlite3changegroup_add_strm(sqlite3_changegroup*,
9871

Keyboard Shortcuts

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