Fossil SCM

Update the built-in SQLite to version 3.16.2.

drh 2017-01-06 17:01 trunk
Commit ddfc7a608b3c1123a09621c9a18648fab8a190f5
2 files changed +110 -61 +9 -5
+110 -61
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3
-** version 3.16.1. By combining all the individual C code files into this
3
+** version 3.16.2. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
77
** of 5% or more are commonly seen when SQLite is compiled as a single
88
** translation unit.
@@ -379,13 +379,13 @@
379379
**
380380
** See also: [sqlite3_libversion()],
381381
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
382382
** [sqlite_version()] and [sqlite_source_id()].
383383
*/
384
-#define SQLITE_VERSION "3.16.1"
385
-#define SQLITE_VERSION_NUMBER 3016001
386
-#define SQLITE_SOURCE_ID "2017-01-03 18:27:03 979f04392853b8053817a3eea2fc679947b437fd"
384
+#define SQLITE_VERSION "3.16.2"
385
+#define SQLITE_VERSION_NUMBER 3016002
386
+#define SQLITE_SOURCE_ID "2017-01-06 16:32:41 a65a62893ca8319e89e48b8a38cf8a59c69a8209"
387387
388388
/*
389389
** CAPI3REF: Run-Time Library Version Numbers
390390
** KEYWORDS: sqlite3_version sqlite3_sourceid
391391
**
@@ -4154,12 +4154,16 @@
41544154
/*
41554155
** CAPI3REF: Number Of Columns In A Result Set
41564156
** METHOD: sqlite3_stmt
41574157
**
41584158
** ^Return the number of columns in the result set returned by the
4159
-** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
4160
-** statement that does not return data (for example an [UPDATE]).
4159
+** [prepared statement]. ^If this routine returns 0, that means the
4160
+** [prepared statement] returns no data (for example an [UPDATE]).
4161
+** ^However, just because this routine returns a positive number does not
4162
+** mean that one or more rows of data will be returned. ^A SELECT statement
4163
+** will always have a positive sqlite3_column_count() but depending on the
4164
+** WHERE clause constraints and the table content, it might return no rows.
41614165
**
41624166
** See also: [sqlite3_data_count()]
41634167
*/
41644168
SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
41654169
@@ -12859,12 +12863,14 @@
1285912863
SQLITE_PRIVATE int sqlite3VdbeAddOp4Dup8(Vdbe*,int,int,int,int,const u8*,int);
1286012864
SQLITE_PRIVATE int sqlite3VdbeAddOp4Int(Vdbe*,int,int,int,int,int);
1286112865
SQLITE_PRIVATE void sqlite3VdbeEndCoroutine(Vdbe*,int);
1286212866
#if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS)
1286312867
SQLITE_PRIVATE void sqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N);
12868
+SQLITE_PRIVATE void sqlite3VdbeVerifyNoResultRow(Vdbe *p);
1286412869
#else
1286512870
# define sqlite3VdbeVerifyNoMallocRequired(A,B)
12871
+# define sqlite3VdbeVerifyNoResultRow(A)
1286612872
#endif
1286712873
SQLITE_PRIVATE VdbeOp *sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp, int iLineno);
1286812874
SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*);
1286912875
SQLITE_PRIVATE void sqlite3VdbeChangeOpcode(Vdbe*, u32 addr, u8);
1287012876
SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, u32 addr, int P1);
@@ -70275,10 +70281,11 @@
7027570281
assert( pVal->db==0 || sqlite3_mutex_held(pVal->db->mutex) );
7027670282
assert( (enc&3)==(enc&~SQLITE_UTF16_ALIGNED) );
7027770283
assert( (pVal->flags & MEM_RowSet)==0 );
7027870284
assert( (pVal->flags & (MEM_Null))==0 );
7027970285
if( pVal->flags & (MEM_Blob|MEM_Str) ){
70286
+ if( ExpandBlob(pVal) ) return 0;
7028070287
pVal->flags |= MEM_Str;
7028170288
if( pVal->enc != (enc & ~SQLITE_UTF16_ALIGNED) ){
7028270289
sqlite3VdbeChangeEncoding(pVal, enc & ~SQLITE_UTF16_ALIGNED);
7028370290
}
7028470291
if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&SQLITE_PTR_TO_INT(pVal->z)) ){
@@ -71620,10 +71627,26 @@
7162071627
** sqlite3VdbeAddOpList() will always be non-NULL.
7162171628
*/
7162271629
#if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS)
7162371630
SQLITE_PRIVATE void sqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N){
7162471631
assert( p->nOp + N <= p->pParse->nOpAlloc );
71632
+}
71633
+#endif
71634
+
71635
+/*
71636
+** Verify that the VM passed as the only argument does not contain
71637
+** an OP_ResultRow opcode. Fail an assert() if it does. This is used
71638
+** by code in pragma.c to ensure that the implementation of certain
71639
+** pragmas comports with the flags specified in the mkpragmatab.tcl
71640
+** script.
71641
+*/
71642
+#if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS)
71643
+SQLITE_PRIVATE void sqlite3VdbeVerifyNoResultRow(Vdbe *p){
71644
+ int i;
71645
+ for(i=0; i<p->nOp; i++){
71646
+ assert( p->aOp[i].opcode!=OP_ResultRow );
71647
+ }
7162571648
}
7162671649
#endif
7162771650
7162871651
/*
7162971652
** This function returns a pointer to the array of opcodes associated with
@@ -109542,16 +109565,29 @@
109542109565
onError = overrideError;
109543109566
}else if( onError==OE_Default ){
109544109567
onError = OE_Abort;
109545109568
}
109546109569
109547
- if( ix==0 && pPk==pIdx && onError==OE_Replace && pPk->pNext==0 ){
109570
+ /* Collision detection may be omitted if all of the following are true:
109571
+ ** (1) The conflict resolution algorithm is REPLACE
109572
+ ** (2) The table is a WITHOUT ROWID table
109573
+ ** (3) There are no secondary indexes on the table
109574
+ ** (4) No delete triggers need to be fired if there is a conflict
109575
+ ** (5) No FK constraint counters need to be updated if a conflict occurs.
109576
+ */
109577
+ if( (ix==0 && pIdx->pNext==0) /* Condition 3 */
109578
+ && pPk==pIdx /* Condition 2 */
109579
+ && onError==OE_Replace /* Condition 1 */
109580
+ && ( 0==(db->flags&SQLITE_RecTriggers) || /* Condition 4 */
109581
+ 0==sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0))
109582
+ && ( 0==(db->flags&SQLITE_ForeignKeys) || /* Condition 5 */
109583
+ (0==pTab->pFKey && 0==sqlite3FkReferences(pTab)))
109584
+ ){
109548109585
sqlite3VdbeResolveLabel(v, addrUniqueOk);
109549109586
continue;
109550109587
}
109551109588
109552
-
109553109589
/* Check to see if the new index entry will be unique */
109554109590
sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
109555109591
regIdx, pIdx->nKeyCol); VdbeCoverage(v);
109556109592
109557109593
/* Generate code to handle collisions */
@@ -111793,15 +111829,16 @@
111793111829
#define PragTyp_PARSER_TRACE 42
111794111830
111795111831
/* Property flags associated with various pragma. */
111796111832
#define PragFlg_NeedSchema 0x01 /* Force schema load before running */
111797111833
#define PragFlg_NoColumns 0x02 /* OP_ResultRow called with zero columns */
111798
-#define PragFlg_ReadOnly 0x04 /* Read-only HEADER_VALUE */
111799
-#define PragFlg_Result0 0x08 /* Acts as query when no argument */
111800
-#define PragFlg_Result1 0x10 /* Acts as query when has one argument */
111801
-#define PragFlg_SchemaOpt 0x20 /* Schema restricts name search if present */
111802
-#define PragFlg_SchemaReq 0x40 /* Schema required - "main" is default */
111834
+#define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */
111835
+#define PragFlg_ReadOnly 0x08 /* Read-only HEADER_VALUE */
111836
+#define PragFlg_Result0 0x10 /* Acts as query when no argument */
111837
+#define PragFlg_Result1 0x20 /* Acts as query when has one argument */
111838
+#define PragFlg_SchemaOpt 0x40 /* Schema restricts name search if present */
111839
+#define PragFlg_SchemaReq 0x80 /* Schema required - "main" is default */
111803111840
111804111841
/* Names of columns for pragmas that return multi-column result
111805111842
** or that return single-column results where the name of the
111806111843
** result column is different from the name of the pragma
111807111844
*/
@@ -111874,26 +111911,26 @@
111874111911
/* iArg: */ 0 },
111875111912
#endif
111876111913
#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
111877111914
{/* zName: */ "application_id",
111878111915
/* ePragTyp: */ PragTyp_HEADER_VALUE,
111879
- /* ePragFlg: */ PragFlg_Result0,
111916
+ /* ePragFlg: */ PragFlg_NoColumns1|PragFlg_Result0,
111880111917
/* ColNames: */ 0, 0,
111881111918
/* iArg: */ BTREE_APPLICATION_ID },
111882111919
#endif
111883111920
#if !defined(SQLITE_OMIT_AUTOVACUUM)
111884111921
{/* zName: */ "auto_vacuum",
111885111922
/* ePragTyp: */ PragTyp_AUTO_VACUUM,
111886
- /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
111923
+ /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
111887111924
/* ColNames: */ 0, 0,
111888111925
/* iArg: */ 0 },
111889111926
#endif
111890111927
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
111891111928
#if !defined(SQLITE_OMIT_AUTOMATIC_INDEX)
111892111929
{/* zName: */ "automatic_index",
111893111930
/* ePragTyp: */ PragTyp_FLAG,
111894
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
111931
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
111895111932
/* ColNames: */ 0, 0,
111896111933
/* iArg: */ SQLITE_AutoIndex },
111897111934
#endif
111898111935
#endif
111899111936
{/* zName: */ "busy_timeout",
@@ -111902,35 +111939,35 @@
111902111939
/* ColNames: */ 45, 1,
111903111940
/* iArg: */ 0 },
111904111941
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
111905111942
{/* zName: */ "cache_size",
111906111943
/* ePragTyp: */ PragTyp_CACHE_SIZE,
111907
- /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
111944
+ /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
111908111945
/* ColNames: */ 0, 0,
111909111946
/* iArg: */ 0 },
111910111947
#endif
111911111948
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
111912111949
{/* zName: */ "cache_spill",
111913111950
/* ePragTyp: */ PragTyp_CACHE_SPILL,
111914
- /* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq,
111951
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
111915111952
/* ColNames: */ 0, 0,
111916111953
/* iArg: */ 0 },
111917111954
#endif
111918111955
{/* zName: */ "case_sensitive_like",
111919111956
/* ePragTyp: */ PragTyp_CASE_SENSITIVE_LIKE,
111920
- /* ePragFlg: */ 0,
111957
+ /* ePragFlg: */ PragFlg_NoColumns,
111921111958
/* ColNames: */ 0, 0,
111922111959
/* iArg: */ 0 },
111923111960
{/* zName: */ "cell_size_check",
111924111961
/* ePragTyp: */ PragTyp_FLAG,
111925
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
111962
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
111926111963
/* ColNames: */ 0, 0,
111927111964
/* iArg: */ SQLITE_CellSizeCk },
111928111965
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
111929111966
{/* zName: */ "checkpoint_fullfsync",
111930111967
/* ePragTyp: */ PragTyp_FLAG,
111931
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
111968
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
111932111969
/* ColNames: */ 0, 0,
111933111970
/* iArg: */ SQLITE_CkptFullFSync },
111934111971
#endif
111935111972
#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
111936111973
{/* zName: */ "collation_list",
@@ -111947,25 +111984,25 @@
111947111984
/* iArg: */ 0 },
111948111985
#endif
111949111986
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
111950111987
{/* zName: */ "count_changes",
111951111988
/* ePragTyp: */ PragTyp_FLAG,
111952
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
111989
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
111953111990
/* ColNames: */ 0, 0,
111954111991
/* iArg: */ SQLITE_CountRows },
111955111992
#endif
111956111993
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_OS_WIN
111957111994
{/* zName: */ "data_store_directory",
111958111995
/* ePragTyp: */ PragTyp_DATA_STORE_DIRECTORY,
111959
- /* ePragFlg: */ 0,
111996
+ /* ePragFlg: */ PragFlg_NoColumns1,
111960111997
/* ColNames: */ 0, 0,
111961111998
/* iArg: */ 0 },
111962111999
#endif
111963112000
#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
111964112001
{/* zName: */ "data_version",
111965112002
/* ePragTyp: */ PragTyp_HEADER_VALUE,
111966
- /* ePragFlg: */ PragFlg_Result0|PragFlg_ReadOnly,
112003
+ /* ePragFlg: */ PragFlg_ReadOnly|PragFlg_Result0,
111967112004
/* ColNames: */ 0, 0,
111968112005
/* iArg: */ BTREE_DATA_VERSION },
111969112006
#endif
111970112007
#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
111971112008
{/* zName: */ "database_list",
@@ -111975,34 +112012,34 @@
111975112012
/* iArg: */ 0 },
111976112013
#endif
111977112014
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)
111978112015
{/* zName: */ "default_cache_size",
111979112016
/* ePragTyp: */ PragTyp_DEFAULT_CACHE_SIZE,
111980
- /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
112017
+ /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
111981112018
/* ColNames: */ 0, 1,
111982112019
/* iArg: */ 0 },
111983112020
#endif
111984112021
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
111985112022
#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
111986112023
{/* zName: */ "defer_foreign_keys",
111987112024
/* ePragTyp: */ PragTyp_FLAG,
111988
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112025
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
111989112026
/* ColNames: */ 0, 0,
111990112027
/* iArg: */ SQLITE_DeferFKs },
111991112028
#endif
111992112029
#endif
111993112030
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
111994112031
{/* zName: */ "empty_result_callbacks",
111995112032
/* ePragTyp: */ PragTyp_FLAG,
111996
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112033
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
111997112034
/* ColNames: */ 0, 0,
111998112035
/* iArg: */ SQLITE_NullCallback },
111999112036
#endif
112000112037
#if !defined(SQLITE_OMIT_UTF16)
112001112038
{/* zName: */ "encoding",
112002112039
/* ePragTyp: */ PragTyp_ENCODING,
112003
- /* ePragFlg: */ PragFlg_Result0,
112040
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112004112041
/* ColNames: */ 0, 0,
112005112042
/* iArg: */ 0 },
112006112043
#endif
112007112044
#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
112008112045
{/* zName: */ "foreign_key_check",
@@ -112020,31 +112057,31 @@
112020112057
#endif
112021112058
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112022112059
#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
112023112060
{/* zName: */ "foreign_keys",
112024112061
/* ePragTyp: */ PragTyp_FLAG,
112025
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112062
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112026112063
/* ColNames: */ 0, 0,
112027112064
/* iArg: */ SQLITE_ForeignKeys },
112028112065
#endif
112029112066
#endif
112030112067
#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
112031112068
{/* zName: */ "freelist_count",
112032112069
/* ePragTyp: */ PragTyp_HEADER_VALUE,
112033
- /* ePragFlg: */ PragFlg_Result0|PragFlg_ReadOnly,
112070
+ /* ePragFlg: */ PragFlg_ReadOnly|PragFlg_Result0,
112034112071
/* ColNames: */ 0, 0,
112035112072
/* iArg: */ BTREE_FREE_PAGE_COUNT },
112036112073
#endif
112037112074
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112038112075
{/* zName: */ "full_column_names",
112039112076
/* ePragTyp: */ PragTyp_FLAG,
112040
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112077
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112041112078
/* ColNames: */ 0, 0,
112042112079
/* iArg: */ SQLITE_FullColNames },
112043112080
{/* zName: */ "fullfsync",
112044112081
/* ePragTyp: */ PragTyp_FLAG,
112045
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112082
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112046112083
/* ColNames: */ 0, 0,
112047112084
/* iArg: */ SQLITE_FullFSync },
112048112085
#endif
112049112086
#if defined(SQLITE_HAS_CODEC)
112050112087
{/* zName: */ "hexkey",
@@ -112060,11 +112097,11 @@
112060112097
#endif
112061112098
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112062112099
#if !defined(SQLITE_OMIT_CHECK)
112063112100
{/* zName: */ "ignore_check_constraints",
112064112101
/* ePragTyp: */ PragTyp_FLAG,
112065
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112102
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112066112103
/* ColNames: */ 0, 0,
112067112104
/* iArg: */ SQLITE_IgnoreChecks },
112068112105
#endif
112069112106
#endif
112070112107
#if !defined(SQLITE_OMIT_AUTOVACUUM)
@@ -112118,18 +112155,18 @@
112118112155
/* iArg: */ 0 },
112119112156
#endif
112120112157
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112121112158
{/* zName: */ "legacy_file_format",
112122112159
/* ePragTyp: */ PragTyp_FLAG,
112123
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112160
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112124112161
/* ColNames: */ 0, 0,
112125112162
/* iArg: */ SQLITE_LegacyFileFmt },
112126112163
#endif
112127112164
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_ENABLE_LOCKING_STYLE
112128112165
{/* zName: */ "lock_proxy_file",
112129112166
/* ePragTyp: */ PragTyp_LOCK_PROXY_FILE,
112130
- /* ePragFlg: */ 0,
112167
+ /* ePragFlg: */ PragFlg_NoColumns1,
112131112168
/* ColNames: */ 0, 0,
112132112169
/* iArg: */ 0 },
112133112170
#endif
112134112171
#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
112135112172
{/* zName: */ "lock_status",
@@ -112159,11 +112196,11 @@
112159112196
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
112160112197
/* ColNames: */ 0, 0,
112161112198
/* iArg: */ 0 },
112162112199
{/* zName: */ "page_size",
112163112200
/* ePragTyp: */ PragTyp_PAGE_SIZE,
112164
- /* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq,
112201
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
112165112202
/* ColNames: */ 0, 0,
112166112203
/* iArg: */ 0 },
112167112204
#endif
112168112205
#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_PARSER_TRACE)
112169112206
{/* zName: */ "parser_trace",
@@ -112173,11 +112210,11 @@
112173112210
/* iArg: */ 0 },
112174112211
#endif
112175112212
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112176112213
{/* zName: */ "query_only",
112177112214
/* ePragTyp: */ PragTyp_FLAG,
112178
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112215
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112179112216
/* ColNames: */ 0, 0,
112180112217
/* iArg: */ SQLITE_QueryOnly },
112181112218
#endif
112182112219
#if !defined(SQLITE_OMIT_INTEGRITY_CHECK)
112183112220
{/* zName: */ "quick_check",
@@ -112187,16 +112224,16 @@
112187112224
/* iArg: */ 0 },
112188112225
#endif
112189112226
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112190112227
{/* zName: */ "read_uncommitted",
112191112228
/* ePragTyp: */ PragTyp_FLAG,
112192
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112229
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112193112230
/* ColNames: */ 0, 0,
112194112231
/* iArg: */ SQLITE_ReadUncommitted },
112195112232
{/* zName: */ "recursive_triggers",
112196112233
/* ePragTyp: */ PragTyp_FLAG,
112197
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112234
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112198112235
/* ColNames: */ 0, 0,
112199112236
/* iArg: */ SQLITE_RecTriggers },
112200112237
#endif
112201112238
#if defined(SQLITE_HAS_CODEC)
112202112239
{/* zName: */ "rekey",
@@ -112206,18 +112243,18 @@
112206112243
/* iArg: */ 0 },
112207112244
#endif
112208112245
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112209112246
{/* zName: */ "reverse_unordered_selects",
112210112247
/* ePragTyp: */ PragTyp_FLAG,
112211
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112248
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112212112249
/* ColNames: */ 0, 0,
112213112250
/* iArg: */ SQLITE_ReverseOrder },
112214112251
#endif
112215112252
#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
112216112253
{/* zName: */ "schema_version",
112217112254
/* ePragTyp: */ PragTyp_HEADER_VALUE,
112218
- /* ePragFlg: */ PragFlg_Result0,
112255
+ /* ePragFlg: */ PragFlg_NoColumns1|PragFlg_Result0,
112219112256
/* ColNames: */ 0, 0,
112220112257
/* iArg: */ BTREE_SCHEMA_VERSION },
112221112258
#endif
112222112259
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112223112260
{/* zName: */ "secure_delete",
@@ -112227,17 +112264,17 @@
112227112264
/* iArg: */ 0 },
112228112265
#endif
112229112266
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112230112267
{/* zName: */ "short_column_names",
112231112268
/* ePragTyp: */ PragTyp_FLAG,
112232
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112269
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112233112270
/* ColNames: */ 0, 0,
112234112271
/* iArg: */ SQLITE_ShortColNames },
112235112272
#endif
112236112273
{/* zName: */ "shrink_memory",
112237112274
/* ePragTyp: */ PragTyp_SHRINK_MEMORY,
112238
- /* ePragFlg: */ 0,
112275
+ /* ePragFlg: */ PragFlg_NoColumns,
112239112276
/* ColNames: */ 0, 0,
112240112277
/* iArg: */ 0 },
112241112278
{/* zName: */ "soft_heap_limit",
112242112279
/* ePragTyp: */ PragTyp_SOFT_HEAP_LIMIT,
112243112280
/* ePragFlg: */ PragFlg_Result0,
@@ -112245,11 +112282,11 @@
112245112282
/* iArg: */ 0 },
112246112283
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112247112284
#if defined(SQLITE_DEBUG)
112248112285
{/* zName: */ "sql_trace",
112249112286
/* ePragTyp: */ PragTyp_FLAG,
112250
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112287
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112251112288
/* ColNames: */ 0, 0,
112252112289
/* iArg: */ SQLITE_SqlTrace },
112253112290
#endif
112254112291
#endif
112255112292
#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
@@ -112260,11 +112297,11 @@
112260112297
/* iArg: */ 0 },
112261112298
#endif
112262112299
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112263112300
{/* zName: */ "synchronous",
112264112301
/* ePragTyp: */ PragTyp_SYNCHRONOUS,
112265
- /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
112302
+ /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
112266112303
/* ColNames: */ 0, 0,
112267112304
/* iArg: */ 0 },
112268112305
#endif
112269112306
#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
112270112307
{/* zName: */ "table_info",
@@ -112274,16 +112311,16 @@
112274112311
/* iArg: */ 0 },
112275112312
#endif
112276112313
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112277112314
{/* zName: */ "temp_store",
112278112315
/* ePragTyp: */ PragTyp_TEMP_STORE,
112279
- /* ePragFlg: */ PragFlg_Result0,
112316
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112280112317
/* ColNames: */ 0, 0,
112281112318
/* iArg: */ 0 },
112282112319
{/* zName: */ "temp_store_directory",
112283112320
/* ePragTyp: */ PragTyp_TEMP_STORE_DIRECTORY,
112284
- /* ePragFlg: */ 0,
112321
+ /* ePragFlg: */ PragFlg_NoColumns1,
112285112322
/* ColNames: */ 0, 0,
112286112323
/* iArg: */ 0 },
112287112324
#endif
112288112325
{/* zName: */ "threads",
112289112326
/* ePragTyp: */ PragTyp_THREADS,
@@ -112291,39 +112328,39 @@
112291112328
/* ColNames: */ 0, 0,
112292112329
/* iArg: */ 0 },
112293112330
#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
112294112331
{/* zName: */ "user_version",
112295112332
/* ePragTyp: */ PragTyp_HEADER_VALUE,
112296
- /* ePragFlg: */ PragFlg_Result0,
112333
+ /* ePragFlg: */ PragFlg_NoColumns1|PragFlg_Result0,
112297112334
/* ColNames: */ 0, 0,
112298112335
/* iArg: */ BTREE_USER_VERSION },
112299112336
#endif
112300112337
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112301112338
#if defined(SQLITE_DEBUG)
112302112339
{/* zName: */ "vdbe_addoptrace",
112303112340
/* ePragTyp: */ PragTyp_FLAG,
112304
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112341
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112305112342
/* ColNames: */ 0, 0,
112306112343
/* iArg: */ SQLITE_VdbeAddopTrace },
112307112344
{/* zName: */ "vdbe_debug",
112308112345
/* ePragTyp: */ PragTyp_FLAG,
112309
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112346
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112310112347
/* ColNames: */ 0, 0,
112311112348
/* iArg: */ SQLITE_SqlTrace|SQLITE_VdbeListing|SQLITE_VdbeTrace },
112312112349
{/* zName: */ "vdbe_eqp",
112313112350
/* ePragTyp: */ PragTyp_FLAG,
112314
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112351
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112315112352
/* ColNames: */ 0, 0,
112316112353
/* iArg: */ SQLITE_VdbeEQP },
112317112354
{/* zName: */ "vdbe_listing",
112318112355
/* ePragTyp: */ PragTyp_FLAG,
112319
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112356
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112320112357
/* ColNames: */ 0, 0,
112321112358
/* iArg: */ SQLITE_VdbeListing },
112322112359
{/* zName: */ "vdbe_trace",
112323112360
/* ePragTyp: */ PragTyp_FLAG,
112324
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112361
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112325112362
/* ColNames: */ 0, 0,
112326112363
/* iArg: */ SQLITE_VdbeTrace },
112327112364
#endif
112328112365
#endif
112329112366
#if !defined(SQLITE_OMIT_WAL)
@@ -112339,11 +112376,11 @@
112339112376
/* iArg: */ 0 },
112340112377
#endif
112341112378
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112342112379
{/* zName: */ "writable_schema",
112343112380
/* ePragTyp: */ PragTyp_FLAG,
112344
- /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112381
+ /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112345112382
/* ColNames: */ 0, 0,
112346112383
/* iArg: */ SQLITE_WriteSchema|SQLITE_RecoveryMode },
112347112384
#endif
112348112385
};
112349112386
/* Number of pragmas: 60 on by default, 73 total. */
@@ -112727,11 +112764,13 @@
112727112764
if( (pPragma->mPragFlg & PragFlg_NeedSchema)!=0 ){
112728112765
if( sqlite3ReadSchema(pParse) ) goto pragma_out;
112729112766
}
112730112767
112731112768
/* Register the result column names for pragmas that return results */
112732
- if( (pPragma->mPragFlg & PragFlg_NoColumns)==0 ){
112769
+ if( (pPragma->mPragFlg & PragFlg_NoColumns)==0
112770
+ && ((pPragma->mPragFlg & PragFlg_NoColumns1)==0 || zRight==0)
112771
+ ){
112733112772
setPragmaResultColumnNames(v, pPragma);
112734112773
}
112735112774
112736112775
/* Jump to the appropriate pragma handler */
112737112776
switch( pPragma->ePragTyp ){
@@ -114271,10 +114310,19 @@
114271114310
}
114272114311
break;
114273114312
#endif
114274114313
114275114314
} /* End of the PRAGMA switch */
114315
+
114316
+ /* The following block is a no-op unless SQLITE_DEBUG is defined. Its only
114317
+ ** purpose is to execute assert() statements to verify that if the
114318
+ ** PragFlg_NoColumns1 flag is set and the caller specified an argument
114319
+ ** to the PRAGMA, the implementation has not added any OP_ResultRow
114320
+ ** instructions to the VM. */
114321
+ if( (pPragma->mPragFlg & PragFlg_NoColumns1) && zRight ){
114322
+ sqlite3VdbeVerifyNoResultRow(v);
114323
+ }
114276114324
114277114325
pragma_out:
114278114326
sqlite3DbFree(db, zLeft);
114279114327
sqlite3DbFree(db, zRight);
114280114328
}
@@ -116186,12 +116234,11 @@
116186116234
if( eDest==SRT_Mem || eDest==SRT_Output || eDest==SRT_Coroutine ){
116187116235
ecelFlags = SQLITE_ECEL_DUP;
116188116236
}else{
116189116237
ecelFlags = 0;
116190116238
}
116191
- assert( eDest!=SRT_Table || pSort==0 );
116192
- if( pSort && hasDistinct==0 && eDest!=SRT_EphemTab ){
116239
+ if( pSort && hasDistinct==0 && eDest!=SRT_EphemTab && eDest!=SRT_Table ){
116193116240
/* For each expression in pEList that is a copy of an expression in
116194116241
** the ORDER BY clause (pSort->pOrderBy), set the associated
116195116242
** iOrderByCol value to one more than the index of the ORDER BY
116196116243
** expression within the sort-key that pushOntoSorter() will generate.
116197116244
** This allows the pEList field to be omitted from the sorted record,
@@ -116729,10 +116776,11 @@
116729116776
}
116730116777
sqlite3VdbeAddOp3(v, OP_Column, iSortTab, iRead, regRow+i);
116731116778
VdbeComment((v, "%s", aOutEx[i].zName ? aOutEx[i].zName : aOutEx[i].zSpan));
116732116779
}
116733116780
switch( eDest ){
116781
+ case SRT_Table:
116734116782
case SRT_EphemTab: {
116735116783
sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, regRowid);
116736116784
sqlite3VdbeAddOp3(v, OP_Insert, iParm, regRow, regRowid);
116737116785
sqlite3VdbeChangeP5(v, OPFLAG_APPEND);
116738116786
break;
@@ -189748,11 +189796,11 @@
189748189796
}
189749189797
}
189750189798
else if( pLeaf->nn>pLeaf->szLeaf ){
189751189799
pIter->iPgidxOff = pLeaf->szLeaf + fts5GetVarint32(
189752189800
&pLeaf->p[pLeaf->szLeaf], iOff
189753
- );
189801
+ );
189754189802
pIter->iLeafOffset = iOff;
189755189803
pIter->iEndofDoclist = iOff;
189756189804
bNewTerm = 1;
189757189805
}
189758189806
assert_nc( iOff<pLeaf->szLeaf );
@@ -189782,10 +189830,11 @@
189782189830
** Later: Switched back to fts5SegIterLoadNPos() because it supports
189783189831
** detail=none mode. Not ideal.
189784189832
*/
189785189833
int nSz;
189786189834
assert( p->rc==SQLITE_OK );
189835
+ assert( pIter->iLeafOffset<=pIter->pLeaf->nn );
189787189836
fts5FastGetVarint32(pIter->pLeaf->p, pIter->iLeafOffset, nSz);
189788189837
pIter->bDel = (nSz & 0x0001);
189789189838
pIter->nPos = nSz>>1;
189790189839
assert_nc( pIter->nPos>=0 );
189791189840
}
@@ -190776,11 +190825,11 @@
190776190825
fts5DataRelease(pData);
190777190826
if( nRem<=0 ){
190778190827
break;
190779190828
}else{
190780190829
pgno++;
190781
- pData = fts5DataRead(p, FTS5_SEGMENT_ROWID(pSeg->pSeg->iSegid, pgno));
190830
+ pData = fts5LeafRead(p, FTS5_SEGMENT_ROWID(pSeg->pSeg->iSegid, pgno));
190782190831
if( pData==0 ) break;
190783190832
pChunk = &pData->p[4];
190784190833
nChunk = MIN(nRem, pData->szLeaf - 4);
190785190834
if( pgno==pgnoSave ){
190786190835
assert( pSeg->pNextLeaf==0 );
@@ -193538,11 +193587,11 @@
193538193587
193539193588
/* If the leaf in question has already been trimmed from the segment,
193540193589
** ignore this b-tree entry. Otherwise, load it into memory. */
193541193590
if( iIdxLeaf<pSeg->pgnoFirst ) continue;
193542193591
iRow = FTS5_SEGMENT_ROWID(pSeg->iSegid, iIdxLeaf);
193543
- pLeaf = fts5DataRead(p, iRow);
193592
+ pLeaf = fts5LeafRead(p, iRow);
193544193593
if( pLeaf==0 ) break;
193545193594
193546193595
/* Check that the leaf contains at least one term, and that it is equal
193547193596
** to or larger than the split-key in zIdxTerm. Also check that if there
193548193597
** is also a rowid pointer within the leaf page header, it points to a
@@ -196814,11 +196863,11 @@
196814196863
int nArg, /* Number of args */
196815196864
sqlite3_value **apUnused /* Function arguments */
196816196865
){
196817196866
assert( nArg==0 );
196818196867
UNUSED_PARAM2(nArg, apUnused);
196819
- sqlite3_result_text(pCtx, "fts5: 2017-01-03 18:27:03 979f04392853b8053817a3eea2fc679947b437fd", -1, SQLITE_TRANSIENT);
196868
+ sqlite3_result_text(pCtx, "fts5: 2017-01-06 16:32:41 a65a62893ca8319e89e48b8a38cf8a59c69a8209", -1, SQLITE_TRANSIENT);
196820196869
}
196821196870
196822196871
static int fts5Init(sqlite3 *db){
196823196872
static const sqlite3_module fts5Mod = {
196824196873
/* iVersion */ 2,
196825196874
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.16.1. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -379,13 +379,13 @@
379 **
380 ** See also: [sqlite3_libversion()],
381 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
382 ** [sqlite_version()] and [sqlite_source_id()].
383 */
384 #define SQLITE_VERSION "3.16.1"
385 #define SQLITE_VERSION_NUMBER 3016001
386 #define SQLITE_SOURCE_ID "2017-01-03 18:27:03 979f04392853b8053817a3eea2fc679947b437fd"
387
388 /*
389 ** CAPI3REF: Run-Time Library Version Numbers
390 ** KEYWORDS: sqlite3_version sqlite3_sourceid
391 **
@@ -4154,12 +4154,16 @@
4154 /*
4155 ** CAPI3REF: Number Of Columns In A Result Set
4156 ** METHOD: sqlite3_stmt
4157 **
4158 ** ^Return the number of columns in the result set returned by the
4159 ** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
4160 ** statement that does not return data (for example an [UPDATE]).
 
 
 
 
4161 **
4162 ** See also: [sqlite3_data_count()]
4163 */
4164 SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
4165
@@ -12859,12 +12863,14 @@
12859 SQLITE_PRIVATE int sqlite3VdbeAddOp4Dup8(Vdbe*,int,int,int,int,const u8*,int);
12860 SQLITE_PRIVATE int sqlite3VdbeAddOp4Int(Vdbe*,int,int,int,int,int);
12861 SQLITE_PRIVATE void sqlite3VdbeEndCoroutine(Vdbe*,int);
12862 #if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS)
12863 SQLITE_PRIVATE void sqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N);
 
12864 #else
12865 # define sqlite3VdbeVerifyNoMallocRequired(A,B)
 
12866 #endif
12867 SQLITE_PRIVATE VdbeOp *sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp, int iLineno);
12868 SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*);
12869 SQLITE_PRIVATE void sqlite3VdbeChangeOpcode(Vdbe*, u32 addr, u8);
12870 SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, u32 addr, int P1);
@@ -70275,10 +70281,11 @@
70275 assert( pVal->db==0 || sqlite3_mutex_held(pVal->db->mutex) );
70276 assert( (enc&3)==(enc&~SQLITE_UTF16_ALIGNED) );
70277 assert( (pVal->flags & MEM_RowSet)==0 );
70278 assert( (pVal->flags & (MEM_Null))==0 );
70279 if( pVal->flags & (MEM_Blob|MEM_Str) ){
 
70280 pVal->flags |= MEM_Str;
70281 if( pVal->enc != (enc & ~SQLITE_UTF16_ALIGNED) ){
70282 sqlite3VdbeChangeEncoding(pVal, enc & ~SQLITE_UTF16_ALIGNED);
70283 }
70284 if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&SQLITE_PTR_TO_INT(pVal->z)) ){
@@ -71620,10 +71627,26 @@
71620 ** sqlite3VdbeAddOpList() will always be non-NULL.
71621 */
71622 #if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS)
71623 SQLITE_PRIVATE void sqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N){
71624 assert( p->nOp + N <= p->pParse->nOpAlloc );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71625 }
71626 #endif
71627
71628 /*
71629 ** This function returns a pointer to the array of opcodes associated with
@@ -109542,16 +109565,29 @@
109542 onError = overrideError;
109543 }else if( onError==OE_Default ){
109544 onError = OE_Abort;
109545 }
109546
109547 if( ix==0 && pPk==pIdx && onError==OE_Replace && pPk->pNext==0 ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109548 sqlite3VdbeResolveLabel(v, addrUniqueOk);
109549 continue;
109550 }
109551
109552
109553 /* Check to see if the new index entry will be unique */
109554 sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
109555 regIdx, pIdx->nKeyCol); VdbeCoverage(v);
109556
109557 /* Generate code to handle collisions */
@@ -111793,15 +111829,16 @@
111793 #define PragTyp_PARSER_TRACE 42
111794
111795 /* Property flags associated with various pragma. */
111796 #define PragFlg_NeedSchema 0x01 /* Force schema load before running */
111797 #define PragFlg_NoColumns 0x02 /* OP_ResultRow called with zero columns */
111798 #define PragFlg_ReadOnly 0x04 /* Read-only HEADER_VALUE */
111799 #define PragFlg_Result0 0x08 /* Acts as query when no argument */
111800 #define PragFlg_Result1 0x10 /* Acts as query when has one argument */
111801 #define PragFlg_SchemaOpt 0x20 /* Schema restricts name search if present */
111802 #define PragFlg_SchemaReq 0x40 /* Schema required - "main" is default */
 
111803
111804 /* Names of columns for pragmas that return multi-column result
111805 ** or that return single-column results where the name of the
111806 ** result column is different from the name of the pragma
111807 */
@@ -111874,26 +111911,26 @@
111874 /* iArg: */ 0 },
111875 #endif
111876 #if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
111877 {/* zName: */ "application_id",
111878 /* ePragTyp: */ PragTyp_HEADER_VALUE,
111879 /* ePragFlg: */ PragFlg_Result0,
111880 /* ColNames: */ 0, 0,
111881 /* iArg: */ BTREE_APPLICATION_ID },
111882 #endif
111883 #if !defined(SQLITE_OMIT_AUTOVACUUM)
111884 {/* zName: */ "auto_vacuum",
111885 /* ePragTyp: */ PragTyp_AUTO_VACUUM,
111886 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
111887 /* ColNames: */ 0, 0,
111888 /* iArg: */ 0 },
111889 #endif
111890 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
111891 #if !defined(SQLITE_OMIT_AUTOMATIC_INDEX)
111892 {/* zName: */ "automatic_index",
111893 /* ePragTyp: */ PragTyp_FLAG,
111894 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
111895 /* ColNames: */ 0, 0,
111896 /* iArg: */ SQLITE_AutoIndex },
111897 #endif
111898 #endif
111899 {/* zName: */ "busy_timeout",
@@ -111902,35 +111939,35 @@
111902 /* ColNames: */ 45, 1,
111903 /* iArg: */ 0 },
111904 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
111905 {/* zName: */ "cache_size",
111906 /* ePragTyp: */ PragTyp_CACHE_SIZE,
111907 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
111908 /* ColNames: */ 0, 0,
111909 /* iArg: */ 0 },
111910 #endif
111911 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
111912 {/* zName: */ "cache_spill",
111913 /* ePragTyp: */ PragTyp_CACHE_SPILL,
111914 /* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq,
111915 /* ColNames: */ 0, 0,
111916 /* iArg: */ 0 },
111917 #endif
111918 {/* zName: */ "case_sensitive_like",
111919 /* ePragTyp: */ PragTyp_CASE_SENSITIVE_LIKE,
111920 /* ePragFlg: */ 0,
111921 /* ColNames: */ 0, 0,
111922 /* iArg: */ 0 },
111923 {/* zName: */ "cell_size_check",
111924 /* ePragTyp: */ PragTyp_FLAG,
111925 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
111926 /* ColNames: */ 0, 0,
111927 /* iArg: */ SQLITE_CellSizeCk },
111928 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
111929 {/* zName: */ "checkpoint_fullfsync",
111930 /* ePragTyp: */ PragTyp_FLAG,
111931 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
111932 /* ColNames: */ 0, 0,
111933 /* iArg: */ SQLITE_CkptFullFSync },
111934 #endif
111935 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
111936 {/* zName: */ "collation_list",
@@ -111947,25 +111984,25 @@
111947 /* iArg: */ 0 },
111948 #endif
111949 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
111950 {/* zName: */ "count_changes",
111951 /* ePragTyp: */ PragTyp_FLAG,
111952 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
111953 /* ColNames: */ 0, 0,
111954 /* iArg: */ SQLITE_CountRows },
111955 #endif
111956 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_OS_WIN
111957 {/* zName: */ "data_store_directory",
111958 /* ePragTyp: */ PragTyp_DATA_STORE_DIRECTORY,
111959 /* ePragFlg: */ 0,
111960 /* ColNames: */ 0, 0,
111961 /* iArg: */ 0 },
111962 #endif
111963 #if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
111964 {/* zName: */ "data_version",
111965 /* ePragTyp: */ PragTyp_HEADER_VALUE,
111966 /* ePragFlg: */ PragFlg_Result0|PragFlg_ReadOnly,
111967 /* ColNames: */ 0, 0,
111968 /* iArg: */ BTREE_DATA_VERSION },
111969 #endif
111970 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
111971 {/* zName: */ "database_list",
@@ -111975,34 +112012,34 @@
111975 /* iArg: */ 0 },
111976 #endif
111977 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)
111978 {/* zName: */ "default_cache_size",
111979 /* ePragTyp: */ PragTyp_DEFAULT_CACHE_SIZE,
111980 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
111981 /* ColNames: */ 0, 1,
111982 /* iArg: */ 0 },
111983 #endif
111984 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
111985 #if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
111986 {/* zName: */ "defer_foreign_keys",
111987 /* ePragTyp: */ PragTyp_FLAG,
111988 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
111989 /* ColNames: */ 0, 0,
111990 /* iArg: */ SQLITE_DeferFKs },
111991 #endif
111992 #endif
111993 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
111994 {/* zName: */ "empty_result_callbacks",
111995 /* ePragTyp: */ PragTyp_FLAG,
111996 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
111997 /* ColNames: */ 0, 0,
111998 /* iArg: */ SQLITE_NullCallback },
111999 #endif
112000 #if !defined(SQLITE_OMIT_UTF16)
112001 {/* zName: */ "encoding",
112002 /* ePragTyp: */ PragTyp_ENCODING,
112003 /* ePragFlg: */ PragFlg_Result0,
112004 /* ColNames: */ 0, 0,
112005 /* iArg: */ 0 },
112006 #endif
112007 #if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
112008 {/* zName: */ "foreign_key_check",
@@ -112020,31 +112057,31 @@
112020 #endif
112021 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112022 #if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
112023 {/* zName: */ "foreign_keys",
112024 /* ePragTyp: */ PragTyp_FLAG,
112025 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112026 /* ColNames: */ 0, 0,
112027 /* iArg: */ SQLITE_ForeignKeys },
112028 #endif
112029 #endif
112030 #if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
112031 {/* zName: */ "freelist_count",
112032 /* ePragTyp: */ PragTyp_HEADER_VALUE,
112033 /* ePragFlg: */ PragFlg_Result0|PragFlg_ReadOnly,
112034 /* ColNames: */ 0, 0,
112035 /* iArg: */ BTREE_FREE_PAGE_COUNT },
112036 #endif
112037 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112038 {/* zName: */ "full_column_names",
112039 /* ePragTyp: */ PragTyp_FLAG,
112040 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112041 /* ColNames: */ 0, 0,
112042 /* iArg: */ SQLITE_FullColNames },
112043 {/* zName: */ "fullfsync",
112044 /* ePragTyp: */ PragTyp_FLAG,
112045 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112046 /* ColNames: */ 0, 0,
112047 /* iArg: */ SQLITE_FullFSync },
112048 #endif
112049 #if defined(SQLITE_HAS_CODEC)
112050 {/* zName: */ "hexkey",
@@ -112060,11 +112097,11 @@
112060 #endif
112061 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112062 #if !defined(SQLITE_OMIT_CHECK)
112063 {/* zName: */ "ignore_check_constraints",
112064 /* ePragTyp: */ PragTyp_FLAG,
112065 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112066 /* ColNames: */ 0, 0,
112067 /* iArg: */ SQLITE_IgnoreChecks },
112068 #endif
112069 #endif
112070 #if !defined(SQLITE_OMIT_AUTOVACUUM)
@@ -112118,18 +112155,18 @@
112118 /* iArg: */ 0 },
112119 #endif
112120 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112121 {/* zName: */ "legacy_file_format",
112122 /* ePragTyp: */ PragTyp_FLAG,
112123 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112124 /* ColNames: */ 0, 0,
112125 /* iArg: */ SQLITE_LegacyFileFmt },
112126 #endif
112127 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_ENABLE_LOCKING_STYLE
112128 {/* zName: */ "lock_proxy_file",
112129 /* ePragTyp: */ PragTyp_LOCK_PROXY_FILE,
112130 /* ePragFlg: */ 0,
112131 /* ColNames: */ 0, 0,
112132 /* iArg: */ 0 },
112133 #endif
112134 #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
112135 {/* zName: */ "lock_status",
@@ -112159,11 +112196,11 @@
112159 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
112160 /* ColNames: */ 0, 0,
112161 /* iArg: */ 0 },
112162 {/* zName: */ "page_size",
112163 /* ePragTyp: */ PragTyp_PAGE_SIZE,
112164 /* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq,
112165 /* ColNames: */ 0, 0,
112166 /* iArg: */ 0 },
112167 #endif
112168 #if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_PARSER_TRACE)
112169 {/* zName: */ "parser_trace",
@@ -112173,11 +112210,11 @@
112173 /* iArg: */ 0 },
112174 #endif
112175 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112176 {/* zName: */ "query_only",
112177 /* ePragTyp: */ PragTyp_FLAG,
112178 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112179 /* ColNames: */ 0, 0,
112180 /* iArg: */ SQLITE_QueryOnly },
112181 #endif
112182 #if !defined(SQLITE_OMIT_INTEGRITY_CHECK)
112183 {/* zName: */ "quick_check",
@@ -112187,16 +112224,16 @@
112187 /* iArg: */ 0 },
112188 #endif
112189 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112190 {/* zName: */ "read_uncommitted",
112191 /* ePragTyp: */ PragTyp_FLAG,
112192 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112193 /* ColNames: */ 0, 0,
112194 /* iArg: */ SQLITE_ReadUncommitted },
112195 {/* zName: */ "recursive_triggers",
112196 /* ePragTyp: */ PragTyp_FLAG,
112197 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112198 /* ColNames: */ 0, 0,
112199 /* iArg: */ SQLITE_RecTriggers },
112200 #endif
112201 #if defined(SQLITE_HAS_CODEC)
112202 {/* zName: */ "rekey",
@@ -112206,18 +112243,18 @@
112206 /* iArg: */ 0 },
112207 #endif
112208 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112209 {/* zName: */ "reverse_unordered_selects",
112210 /* ePragTyp: */ PragTyp_FLAG,
112211 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112212 /* ColNames: */ 0, 0,
112213 /* iArg: */ SQLITE_ReverseOrder },
112214 #endif
112215 #if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
112216 {/* zName: */ "schema_version",
112217 /* ePragTyp: */ PragTyp_HEADER_VALUE,
112218 /* ePragFlg: */ PragFlg_Result0,
112219 /* ColNames: */ 0, 0,
112220 /* iArg: */ BTREE_SCHEMA_VERSION },
112221 #endif
112222 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112223 {/* zName: */ "secure_delete",
@@ -112227,17 +112264,17 @@
112227 /* iArg: */ 0 },
112228 #endif
112229 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112230 {/* zName: */ "short_column_names",
112231 /* ePragTyp: */ PragTyp_FLAG,
112232 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112233 /* ColNames: */ 0, 0,
112234 /* iArg: */ SQLITE_ShortColNames },
112235 #endif
112236 {/* zName: */ "shrink_memory",
112237 /* ePragTyp: */ PragTyp_SHRINK_MEMORY,
112238 /* ePragFlg: */ 0,
112239 /* ColNames: */ 0, 0,
112240 /* iArg: */ 0 },
112241 {/* zName: */ "soft_heap_limit",
112242 /* ePragTyp: */ PragTyp_SOFT_HEAP_LIMIT,
112243 /* ePragFlg: */ PragFlg_Result0,
@@ -112245,11 +112282,11 @@
112245 /* iArg: */ 0 },
112246 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112247 #if defined(SQLITE_DEBUG)
112248 {/* zName: */ "sql_trace",
112249 /* ePragTyp: */ PragTyp_FLAG,
112250 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112251 /* ColNames: */ 0, 0,
112252 /* iArg: */ SQLITE_SqlTrace },
112253 #endif
112254 #endif
112255 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
@@ -112260,11 +112297,11 @@
112260 /* iArg: */ 0 },
112261 #endif
112262 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112263 {/* zName: */ "synchronous",
112264 /* ePragTyp: */ PragTyp_SYNCHRONOUS,
112265 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
112266 /* ColNames: */ 0, 0,
112267 /* iArg: */ 0 },
112268 #endif
112269 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
112270 {/* zName: */ "table_info",
@@ -112274,16 +112311,16 @@
112274 /* iArg: */ 0 },
112275 #endif
112276 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112277 {/* zName: */ "temp_store",
112278 /* ePragTyp: */ PragTyp_TEMP_STORE,
112279 /* ePragFlg: */ PragFlg_Result0,
112280 /* ColNames: */ 0, 0,
112281 /* iArg: */ 0 },
112282 {/* zName: */ "temp_store_directory",
112283 /* ePragTyp: */ PragTyp_TEMP_STORE_DIRECTORY,
112284 /* ePragFlg: */ 0,
112285 /* ColNames: */ 0, 0,
112286 /* iArg: */ 0 },
112287 #endif
112288 {/* zName: */ "threads",
112289 /* ePragTyp: */ PragTyp_THREADS,
@@ -112291,39 +112328,39 @@
112291 /* ColNames: */ 0, 0,
112292 /* iArg: */ 0 },
112293 #if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
112294 {/* zName: */ "user_version",
112295 /* ePragTyp: */ PragTyp_HEADER_VALUE,
112296 /* ePragFlg: */ PragFlg_Result0,
112297 /* ColNames: */ 0, 0,
112298 /* iArg: */ BTREE_USER_VERSION },
112299 #endif
112300 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112301 #if defined(SQLITE_DEBUG)
112302 {/* zName: */ "vdbe_addoptrace",
112303 /* ePragTyp: */ PragTyp_FLAG,
112304 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112305 /* ColNames: */ 0, 0,
112306 /* iArg: */ SQLITE_VdbeAddopTrace },
112307 {/* zName: */ "vdbe_debug",
112308 /* ePragTyp: */ PragTyp_FLAG,
112309 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112310 /* ColNames: */ 0, 0,
112311 /* iArg: */ SQLITE_SqlTrace|SQLITE_VdbeListing|SQLITE_VdbeTrace },
112312 {/* zName: */ "vdbe_eqp",
112313 /* ePragTyp: */ PragTyp_FLAG,
112314 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112315 /* ColNames: */ 0, 0,
112316 /* iArg: */ SQLITE_VdbeEQP },
112317 {/* zName: */ "vdbe_listing",
112318 /* ePragTyp: */ PragTyp_FLAG,
112319 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112320 /* ColNames: */ 0, 0,
112321 /* iArg: */ SQLITE_VdbeListing },
112322 {/* zName: */ "vdbe_trace",
112323 /* ePragTyp: */ PragTyp_FLAG,
112324 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112325 /* ColNames: */ 0, 0,
112326 /* iArg: */ SQLITE_VdbeTrace },
112327 #endif
112328 #endif
112329 #if !defined(SQLITE_OMIT_WAL)
@@ -112339,11 +112376,11 @@
112339 /* iArg: */ 0 },
112340 #endif
112341 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112342 {/* zName: */ "writable_schema",
112343 /* ePragTyp: */ PragTyp_FLAG,
112344 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
112345 /* ColNames: */ 0, 0,
112346 /* iArg: */ SQLITE_WriteSchema|SQLITE_RecoveryMode },
112347 #endif
112348 };
112349 /* Number of pragmas: 60 on by default, 73 total. */
@@ -112727,11 +112764,13 @@
112727 if( (pPragma->mPragFlg & PragFlg_NeedSchema)!=0 ){
112728 if( sqlite3ReadSchema(pParse) ) goto pragma_out;
112729 }
112730
112731 /* Register the result column names for pragmas that return results */
112732 if( (pPragma->mPragFlg & PragFlg_NoColumns)==0 ){
 
 
112733 setPragmaResultColumnNames(v, pPragma);
112734 }
112735
112736 /* Jump to the appropriate pragma handler */
112737 switch( pPragma->ePragTyp ){
@@ -114271,10 +114310,19 @@
114271 }
114272 break;
114273 #endif
114274
114275 } /* End of the PRAGMA switch */
 
 
 
 
 
 
 
 
 
114276
114277 pragma_out:
114278 sqlite3DbFree(db, zLeft);
114279 sqlite3DbFree(db, zRight);
114280 }
@@ -116186,12 +116234,11 @@
116186 if( eDest==SRT_Mem || eDest==SRT_Output || eDest==SRT_Coroutine ){
116187 ecelFlags = SQLITE_ECEL_DUP;
116188 }else{
116189 ecelFlags = 0;
116190 }
116191 assert( eDest!=SRT_Table || pSort==0 );
116192 if( pSort && hasDistinct==0 && eDest!=SRT_EphemTab ){
116193 /* For each expression in pEList that is a copy of an expression in
116194 ** the ORDER BY clause (pSort->pOrderBy), set the associated
116195 ** iOrderByCol value to one more than the index of the ORDER BY
116196 ** expression within the sort-key that pushOntoSorter() will generate.
116197 ** This allows the pEList field to be omitted from the sorted record,
@@ -116729,10 +116776,11 @@
116729 }
116730 sqlite3VdbeAddOp3(v, OP_Column, iSortTab, iRead, regRow+i);
116731 VdbeComment((v, "%s", aOutEx[i].zName ? aOutEx[i].zName : aOutEx[i].zSpan));
116732 }
116733 switch( eDest ){
 
116734 case SRT_EphemTab: {
116735 sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, regRowid);
116736 sqlite3VdbeAddOp3(v, OP_Insert, iParm, regRow, regRowid);
116737 sqlite3VdbeChangeP5(v, OPFLAG_APPEND);
116738 break;
@@ -189748,11 +189796,11 @@
189748 }
189749 }
189750 else if( pLeaf->nn>pLeaf->szLeaf ){
189751 pIter->iPgidxOff = pLeaf->szLeaf + fts5GetVarint32(
189752 &pLeaf->p[pLeaf->szLeaf], iOff
189753 );
189754 pIter->iLeafOffset = iOff;
189755 pIter->iEndofDoclist = iOff;
189756 bNewTerm = 1;
189757 }
189758 assert_nc( iOff<pLeaf->szLeaf );
@@ -189782,10 +189830,11 @@
189782 ** Later: Switched back to fts5SegIterLoadNPos() because it supports
189783 ** detail=none mode. Not ideal.
189784 */
189785 int nSz;
189786 assert( p->rc==SQLITE_OK );
 
189787 fts5FastGetVarint32(pIter->pLeaf->p, pIter->iLeafOffset, nSz);
189788 pIter->bDel = (nSz & 0x0001);
189789 pIter->nPos = nSz>>1;
189790 assert_nc( pIter->nPos>=0 );
189791 }
@@ -190776,11 +190825,11 @@
190776 fts5DataRelease(pData);
190777 if( nRem<=0 ){
190778 break;
190779 }else{
190780 pgno++;
190781 pData = fts5DataRead(p, FTS5_SEGMENT_ROWID(pSeg->pSeg->iSegid, pgno));
190782 if( pData==0 ) break;
190783 pChunk = &pData->p[4];
190784 nChunk = MIN(nRem, pData->szLeaf - 4);
190785 if( pgno==pgnoSave ){
190786 assert( pSeg->pNextLeaf==0 );
@@ -193538,11 +193587,11 @@
193538
193539 /* If the leaf in question has already been trimmed from the segment,
193540 ** ignore this b-tree entry. Otherwise, load it into memory. */
193541 if( iIdxLeaf<pSeg->pgnoFirst ) continue;
193542 iRow = FTS5_SEGMENT_ROWID(pSeg->iSegid, iIdxLeaf);
193543 pLeaf = fts5DataRead(p, iRow);
193544 if( pLeaf==0 ) break;
193545
193546 /* Check that the leaf contains at least one term, and that it is equal
193547 ** to or larger than the split-key in zIdxTerm. Also check that if there
193548 ** is also a rowid pointer within the leaf page header, it points to a
@@ -196814,11 +196863,11 @@
196814 int nArg, /* Number of args */
196815 sqlite3_value **apUnused /* Function arguments */
196816 ){
196817 assert( nArg==0 );
196818 UNUSED_PARAM2(nArg, apUnused);
196819 sqlite3_result_text(pCtx, "fts5: 2017-01-03 18:27:03 979f04392853b8053817a3eea2fc679947b437fd", -1, SQLITE_TRANSIENT);
196820 }
196821
196822 static int fts5Init(sqlite3 *db){
196823 static const sqlite3_module fts5Mod = {
196824 /* iVersion */ 2,
196825
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.16.2. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -379,13 +379,13 @@
379 **
380 ** See also: [sqlite3_libversion()],
381 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
382 ** [sqlite_version()] and [sqlite_source_id()].
383 */
384 #define SQLITE_VERSION "3.16.2"
385 #define SQLITE_VERSION_NUMBER 3016002
386 #define SQLITE_SOURCE_ID "2017-01-06 16:32:41 a65a62893ca8319e89e48b8a38cf8a59c69a8209"
387
388 /*
389 ** CAPI3REF: Run-Time Library Version Numbers
390 ** KEYWORDS: sqlite3_version sqlite3_sourceid
391 **
@@ -4154,12 +4154,16 @@
4154 /*
4155 ** CAPI3REF: Number Of Columns In A Result Set
4156 ** METHOD: sqlite3_stmt
4157 **
4158 ** ^Return the number of columns in the result set returned by the
4159 ** [prepared statement]. ^If this routine returns 0, that means the
4160 ** [prepared statement] returns no data (for example an [UPDATE]).
4161 ** ^However, just because this routine returns a positive number does not
4162 ** mean that one or more rows of data will be returned. ^A SELECT statement
4163 ** will always have a positive sqlite3_column_count() but depending on the
4164 ** WHERE clause constraints and the table content, it might return no rows.
4165 **
4166 ** See also: [sqlite3_data_count()]
4167 */
4168 SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
4169
@@ -12859,12 +12863,14 @@
12863 SQLITE_PRIVATE int sqlite3VdbeAddOp4Dup8(Vdbe*,int,int,int,int,const u8*,int);
12864 SQLITE_PRIVATE int sqlite3VdbeAddOp4Int(Vdbe*,int,int,int,int,int);
12865 SQLITE_PRIVATE void sqlite3VdbeEndCoroutine(Vdbe*,int);
12866 #if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS)
12867 SQLITE_PRIVATE void sqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N);
12868 SQLITE_PRIVATE void sqlite3VdbeVerifyNoResultRow(Vdbe *p);
12869 #else
12870 # define sqlite3VdbeVerifyNoMallocRequired(A,B)
12871 # define sqlite3VdbeVerifyNoResultRow(A)
12872 #endif
12873 SQLITE_PRIVATE VdbeOp *sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp, int iLineno);
12874 SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*);
12875 SQLITE_PRIVATE void sqlite3VdbeChangeOpcode(Vdbe*, u32 addr, u8);
12876 SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, u32 addr, int P1);
@@ -70275,10 +70281,11 @@
70281 assert( pVal->db==0 || sqlite3_mutex_held(pVal->db->mutex) );
70282 assert( (enc&3)==(enc&~SQLITE_UTF16_ALIGNED) );
70283 assert( (pVal->flags & MEM_RowSet)==0 );
70284 assert( (pVal->flags & (MEM_Null))==0 );
70285 if( pVal->flags & (MEM_Blob|MEM_Str) ){
70286 if( ExpandBlob(pVal) ) return 0;
70287 pVal->flags |= MEM_Str;
70288 if( pVal->enc != (enc & ~SQLITE_UTF16_ALIGNED) ){
70289 sqlite3VdbeChangeEncoding(pVal, enc & ~SQLITE_UTF16_ALIGNED);
70290 }
70291 if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&SQLITE_PTR_TO_INT(pVal->z)) ){
@@ -71620,10 +71627,26 @@
71627 ** sqlite3VdbeAddOpList() will always be non-NULL.
71628 */
71629 #if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS)
71630 SQLITE_PRIVATE void sqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N){
71631 assert( p->nOp + N <= p->pParse->nOpAlloc );
71632 }
71633 #endif
71634
71635 /*
71636 ** Verify that the VM passed as the only argument does not contain
71637 ** an OP_ResultRow opcode. Fail an assert() if it does. This is used
71638 ** by code in pragma.c to ensure that the implementation of certain
71639 ** pragmas comports with the flags specified in the mkpragmatab.tcl
71640 ** script.
71641 */
71642 #if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS)
71643 SQLITE_PRIVATE void sqlite3VdbeVerifyNoResultRow(Vdbe *p){
71644 int i;
71645 for(i=0; i<p->nOp; i++){
71646 assert( p->aOp[i].opcode!=OP_ResultRow );
71647 }
71648 }
71649 #endif
71650
71651 /*
71652 ** This function returns a pointer to the array of opcodes associated with
@@ -109542,16 +109565,29 @@
109565 onError = overrideError;
109566 }else if( onError==OE_Default ){
109567 onError = OE_Abort;
109568 }
109569
109570 /* Collision detection may be omitted if all of the following are true:
109571 ** (1) The conflict resolution algorithm is REPLACE
109572 ** (2) The table is a WITHOUT ROWID table
109573 ** (3) There are no secondary indexes on the table
109574 ** (4) No delete triggers need to be fired if there is a conflict
109575 ** (5) No FK constraint counters need to be updated if a conflict occurs.
109576 */
109577 if( (ix==0 && pIdx->pNext==0) /* Condition 3 */
109578 && pPk==pIdx /* Condition 2 */
109579 && onError==OE_Replace /* Condition 1 */
109580 && ( 0==(db->flags&SQLITE_RecTriggers) || /* Condition 4 */
109581 0==sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0))
109582 && ( 0==(db->flags&SQLITE_ForeignKeys) || /* Condition 5 */
109583 (0==pTab->pFKey && 0==sqlite3FkReferences(pTab)))
109584 ){
109585 sqlite3VdbeResolveLabel(v, addrUniqueOk);
109586 continue;
109587 }
109588
 
109589 /* Check to see if the new index entry will be unique */
109590 sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
109591 regIdx, pIdx->nKeyCol); VdbeCoverage(v);
109592
109593 /* Generate code to handle collisions */
@@ -111793,15 +111829,16 @@
111829 #define PragTyp_PARSER_TRACE 42
111830
111831 /* Property flags associated with various pragma. */
111832 #define PragFlg_NeedSchema 0x01 /* Force schema load before running */
111833 #define PragFlg_NoColumns 0x02 /* OP_ResultRow called with zero columns */
111834 #define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */
111835 #define PragFlg_ReadOnly 0x08 /* Read-only HEADER_VALUE */
111836 #define PragFlg_Result0 0x10 /* Acts as query when no argument */
111837 #define PragFlg_Result1 0x20 /* Acts as query when has one argument */
111838 #define PragFlg_SchemaOpt 0x40 /* Schema restricts name search if present */
111839 #define PragFlg_SchemaReq 0x80 /* Schema required - "main" is default */
111840
111841 /* Names of columns for pragmas that return multi-column result
111842 ** or that return single-column results where the name of the
111843 ** result column is different from the name of the pragma
111844 */
@@ -111874,26 +111911,26 @@
111911 /* iArg: */ 0 },
111912 #endif
111913 #if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
111914 {/* zName: */ "application_id",
111915 /* ePragTyp: */ PragTyp_HEADER_VALUE,
111916 /* ePragFlg: */ PragFlg_NoColumns1|PragFlg_Result0,
111917 /* ColNames: */ 0, 0,
111918 /* iArg: */ BTREE_APPLICATION_ID },
111919 #endif
111920 #if !defined(SQLITE_OMIT_AUTOVACUUM)
111921 {/* zName: */ "auto_vacuum",
111922 /* ePragTyp: */ PragTyp_AUTO_VACUUM,
111923 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
111924 /* ColNames: */ 0, 0,
111925 /* iArg: */ 0 },
111926 #endif
111927 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
111928 #if !defined(SQLITE_OMIT_AUTOMATIC_INDEX)
111929 {/* zName: */ "automatic_index",
111930 /* ePragTyp: */ PragTyp_FLAG,
111931 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
111932 /* ColNames: */ 0, 0,
111933 /* iArg: */ SQLITE_AutoIndex },
111934 #endif
111935 #endif
111936 {/* zName: */ "busy_timeout",
@@ -111902,35 +111939,35 @@
111939 /* ColNames: */ 45, 1,
111940 /* iArg: */ 0 },
111941 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
111942 {/* zName: */ "cache_size",
111943 /* ePragTyp: */ PragTyp_CACHE_SIZE,
111944 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
111945 /* ColNames: */ 0, 0,
111946 /* iArg: */ 0 },
111947 #endif
111948 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
111949 {/* zName: */ "cache_spill",
111950 /* ePragTyp: */ PragTyp_CACHE_SPILL,
111951 /* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
111952 /* ColNames: */ 0, 0,
111953 /* iArg: */ 0 },
111954 #endif
111955 {/* zName: */ "case_sensitive_like",
111956 /* ePragTyp: */ PragTyp_CASE_SENSITIVE_LIKE,
111957 /* ePragFlg: */ PragFlg_NoColumns,
111958 /* ColNames: */ 0, 0,
111959 /* iArg: */ 0 },
111960 {/* zName: */ "cell_size_check",
111961 /* ePragTyp: */ PragTyp_FLAG,
111962 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
111963 /* ColNames: */ 0, 0,
111964 /* iArg: */ SQLITE_CellSizeCk },
111965 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
111966 {/* zName: */ "checkpoint_fullfsync",
111967 /* ePragTyp: */ PragTyp_FLAG,
111968 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
111969 /* ColNames: */ 0, 0,
111970 /* iArg: */ SQLITE_CkptFullFSync },
111971 #endif
111972 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
111973 {/* zName: */ "collation_list",
@@ -111947,25 +111984,25 @@
111984 /* iArg: */ 0 },
111985 #endif
111986 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
111987 {/* zName: */ "count_changes",
111988 /* ePragTyp: */ PragTyp_FLAG,
111989 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
111990 /* ColNames: */ 0, 0,
111991 /* iArg: */ SQLITE_CountRows },
111992 #endif
111993 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_OS_WIN
111994 {/* zName: */ "data_store_directory",
111995 /* ePragTyp: */ PragTyp_DATA_STORE_DIRECTORY,
111996 /* ePragFlg: */ PragFlg_NoColumns1,
111997 /* ColNames: */ 0, 0,
111998 /* iArg: */ 0 },
111999 #endif
112000 #if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
112001 {/* zName: */ "data_version",
112002 /* ePragTyp: */ PragTyp_HEADER_VALUE,
112003 /* ePragFlg: */ PragFlg_ReadOnly|PragFlg_Result0,
112004 /* ColNames: */ 0, 0,
112005 /* iArg: */ BTREE_DATA_VERSION },
112006 #endif
112007 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
112008 {/* zName: */ "database_list",
@@ -111975,34 +112012,34 @@
112012 /* iArg: */ 0 },
112013 #endif
112014 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)
112015 {/* zName: */ "default_cache_size",
112016 /* ePragTyp: */ PragTyp_DEFAULT_CACHE_SIZE,
112017 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
112018 /* ColNames: */ 0, 1,
112019 /* iArg: */ 0 },
112020 #endif
112021 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112022 #if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
112023 {/* zName: */ "defer_foreign_keys",
112024 /* ePragTyp: */ PragTyp_FLAG,
112025 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112026 /* ColNames: */ 0, 0,
112027 /* iArg: */ SQLITE_DeferFKs },
112028 #endif
112029 #endif
112030 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112031 {/* zName: */ "empty_result_callbacks",
112032 /* ePragTyp: */ PragTyp_FLAG,
112033 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112034 /* ColNames: */ 0, 0,
112035 /* iArg: */ SQLITE_NullCallback },
112036 #endif
112037 #if !defined(SQLITE_OMIT_UTF16)
112038 {/* zName: */ "encoding",
112039 /* ePragTyp: */ PragTyp_ENCODING,
112040 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112041 /* ColNames: */ 0, 0,
112042 /* iArg: */ 0 },
112043 #endif
112044 #if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
112045 {/* zName: */ "foreign_key_check",
@@ -112020,31 +112057,31 @@
112057 #endif
112058 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112059 #if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
112060 {/* zName: */ "foreign_keys",
112061 /* ePragTyp: */ PragTyp_FLAG,
112062 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112063 /* ColNames: */ 0, 0,
112064 /* iArg: */ SQLITE_ForeignKeys },
112065 #endif
112066 #endif
112067 #if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
112068 {/* zName: */ "freelist_count",
112069 /* ePragTyp: */ PragTyp_HEADER_VALUE,
112070 /* ePragFlg: */ PragFlg_ReadOnly|PragFlg_Result0,
112071 /* ColNames: */ 0, 0,
112072 /* iArg: */ BTREE_FREE_PAGE_COUNT },
112073 #endif
112074 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112075 {/* zName: */ "full_column_names",
112076 /* ePragTyp: */ PragTyp_FLAG,
112077 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112078 /* ColNames: */ 0, 0,
112079 /* iArg: */ SQLITE_FullColNames },
112080 {/* zName: */ "fullfsync",
112081 /* ePragTyp: */ PragTyp_FLAG,
112082 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112083 /* ColNames: */ 0, 0,
112084 /* iArg: */ SQLITE_FullFSync },
112085 #endif
112086 #if defined(SQLITE_HAS_CODEC)
112087 {/* zName: */ "hexkey",
@@ -112060,11 +112097,11 @@
112097 #endif
112098 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112099 #if !defined(SQLITE_OMIT_CHECK)
112100 {/* zName: */ "ignore_check_constraints",
112101 /* ePragTyp: */ PragTyp_FLAG,
112102 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112103 /* ColNames: */ 0, 0,
112104 /* iArg: */ SQLITE_IgnoreChecks },
112105 #endif
112106 #endif
112107 #if !defined(SQLITE_OMIT_AUTOVACUUM)
@@ -112118,18 +112155,18 @@
112155 /* iArg: */ 0 },
112156 #endif
112157 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112158 {/* zName: */ "legacy_file_format",
112159 /* ePragTyp: */ PragTyp_FLAG,
112160 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112161 /* ColNames: */ 0, 0,
112162 /* iArg: */ SQLITE_LegacyFileFmt },
112163 #endif
112164 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_ENABLE_LOCKING_STYLE
112165 {/* zName: */ "lock_proxy_file",
112166 /* ePragTyp: */ PragTyp_LOCK_PROXY_FILE,
112167 /* ePragFlg: */ PragFlg_NoColumns1,
112168 /* ColNames: */ 0, 0,
112169 /* iArg: */ 0 },
112170 #endif
112171 #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
112172 {/* zName: */ "lock_status",
@@ -112159,11 +112196,11 @@
112196 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
112197 /* ColNames: */ 0, 0,
112198 /* iArg: */ 0 },
112199 {/* zName: */ "page_size",
112200 /* ePragTyp: */ PragTyp_PAGE_SIZE,
112201 /* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
112202 /* ColNames: */ 0, 0,
112203 /* iArg: */ 0 },
112204 #endif
112205 #if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_PARSER_TRACE)
112206 {/* zName: */ "parser_trace",
@@ -112173,11 +112210,11 @@
112210 /* iArg: */ 0 },
112211 #endif
112212 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112213 {/* zName: */ "query_only",
112214 /* ePragTyp: */ PragTyp_FLAG,
112215 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112216 /* ColNames: */ 0, 0,
112217 /* iArg: */ SQLITE_QueryOnly },
112218 #endif
112219 #if !defined(SQLITE_OMIT_INTEGRITY_CHECK)
112220 {/* zName: */ "quick_check",
@@ -112187,16 +112224,16 @@
112224 /* iArg: */ 0 },
112225 #endif
112226 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112227 {/* zName: */ "read_uncommitted",
112228 /* ePragTyp: */ PragTyp_FLAG,
112229 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112230 /* ColNames: */ 0, 0,
112231 /* iArg: */ SQLITE_ReadUncommitted },
112232 {/* zName: */ "recursive_triggers",
112233 /* ePragTyp: */ PragTyp_FLAG,
112234 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112235 /* ColNames: */ 0, 0,
112236 /* iArg: */ SQLITE_RecTriggers },
112237 #endif
112238 #if defined(SQLITE_HAS_CODEC)
112239 {/* zName: */ "rekey",
@@ -112206,18 +112243,18 @@
112243 /* iArg: */ 0 },
112244 #endif
112245 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112246 {/* zName: */ "reverse_unordered_selects",
112247 /* ePragTyp: */ PragTyp_FLAG,
112248 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112249 /* ColNames: */ 0, 0,
112250 /* iArg: */ SQLITE_ReverseOrder },
112251 #endif
112252 #if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
112253 {/* zName: */ "schema_version",
112254 /* ePragTyp: */ PragTyp_HEADER_VALUE,
112255 /* ePragFlg: */ PragFlg_NoColumns1|PragFlg_Result0,
112256 /* ColNames: */ 0, 0,
112257 /* iArg: */ BTREE_SCHEMA_VERSION },
112258 #endif
112259 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112260 {/* zName: */ "secure_delete",
@@ -112227,17 +112264,17 @@
112264 /* iArg: */ 0 },
112265 #endif
112266 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112267 {/* zName: */ "short_column_names",
112268 /* ePragTyp: */ PragTyp_FLAG,
112269 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112270 /* ColNames: */ 0, 0,
112271 /* iArg: */ SQLITE_ShortColNames },
112272 #endif
112273 {/* zName: */ "shrink_memory",
112274 /* ePragTyp: */ PragTyp_SHRINK_MEMORY,
112275 /* ePragFlg: */ PragFlg_NoColumns,
112276 /* ColNames: */ 0, 0,
112277 /* iArg: */ 0 },
112278 {/* zName: */ "soft_heap_limit",
112279 /* ePragTyp: */ PragTyp_SOFT_HEAP_LIMIT,
112280 /* ePragFlg: */ PragFlg_Result0,
@@ -112245,11 +112282,11 @@
112282 /* iArg: */ 0 },
112283 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112284 #if defined(SQLITE_DEBUG)
112285 {/* zName: */ "sql_trace",
112286 /* ePragTyp: */ PragTyp_FLAG,
112287 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112288 /* ColNames: */ 0, 0,
112289 /* iArg: */ SQLITE_SqlTrace },
112290 #endif
112291 #endif
112292 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
@@ -112260,11 +112297,11 @@
112297 /* iArg: */ 0 },
112298 #endif
112299 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112300 {/* zName: */ "synchronous",
112301 /* ePragTyp: */ PragTyp_SYNCHRONOUS,
112302 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
112303 /* ColNames: */ 0, 0,
112304 /* iArg: */ 0 },
112305 #endif
112306 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
112307 {/* zName: */ "table_info",
@@ -112274,16 +112311,16 @@
112311 /* iArg: */ 0 },
112312 #endif
112313 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
112314 {/* zName: */ "temp_store",
112315 /* ePragTyp: */ PragTyp_TEMP_STORE,
112316 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112317 /* ColNames: */ 0, 0,
112318 /* iArg: */ 0 },
112319 {/* zName: */ "temp_store_directory",
112320 /* ePragTyp: */ PragTyp_TEMP_STORE_DIRECTORY,
112321 /* ePragFlg: */ PragFlg_NoColumns1,
112322 /* ColNames: */ 0, 0,
112323 /* iArg: */ 0 },
112324 #endif
112325 {/* zName: */ "threads",
112326 /* ePragTyp: */ PragTyp_THREADS,
@@ -112291,39 +112328,39 @@
112328 /* ColNames: */ 0, 0,
112329 /* iArg: */ 0 },
112330 #if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
112331 {/* zName: */ "user_version",
112332 /* ePragTyp: */ PragTyp_HEADER_VALUE,
112333 /* ePragFlg: */ PragFlg_NoColumns1|PragFlg_Result0,
112334 /* ColNames: */ 0, 0,
112335 /* iArg: */ BTREE_USER_VERSION },
112336 #endif
112337 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112338 #if defined(SQLITE_DEBUG)
112339 {/* zName: */ "vdbe_addoptrace",
112340 /* ePragTyp: */ PragTyp_FLAG,
112341 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112342 /* ColNames: */ 0, 0,
112343 /* iArg: */ SQLITE_VdbeAddopTrace },
112344 {/* zName: */ "vdbe_debug",
112345 /* ePragTyp: */ PragTyp_FLAG,
112346 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112347 /* ColNames: */ 0, 0,
112348 /* iArg: */ SQLITE_SqlTrace|SQLITE_VdbeListing|SQLITE_VdbeTrace },
112349 {/* zName: */ "vdbe_eqp",
112350 /* ePragTyp: */ PragTyp_FLAG,
112351 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112352 /* ColNames: */ 0, 0,
112353 /* iArg: */ SQLITE_VdbeEQP },
112354 {/* zName: */ "vdbe_listing",
112355 /* ePragTyp: */ PragTyp_FLAG,
112356 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112357 /* ColNames: */ 0, 0,
112358 /* iArg: */ SQLITE_VdbeListing },
112359 {/* zName: */ "vdbe_trace",
112360 /* ePragTyp: */ PragTyp_FLAG,
112361 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112362 /* ColNames: */ 0, 0,
112363 /* iArg: */ SQLITE_VdbeTrace },
112364 #endif
112365 #endif
112366 #if !defined(SQLITE_OMIT_WAL)
@@ -112339,11 +112376,11 @@
112376 /* iArg: */ 0 },
112377 #endif
112378 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
112379 {/* zName: */ "writable_schema",
112380 /* ePragTyp: */ PragTyp_FLAG,
112381 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
112382 /* ColNames: */ 0, 0,
112383 /* iArg: */ SQLITE_WriteSchema|SQLITE_RecoveryMode },
112384 #endif
112385 };
112386 /* Number of pragmas: 60 on by default, 73 total. */
@@ -112727,11 +112764,13 @@
112764 if( (pPragma->mPragFlg & PragFlg_NeedSchema)!=0 ){
112765 if( sqlite3ReadSchema(pParse) ) goto pragma_out;
112766 }
112767
112768 /* Register the result column names for pragmas that return results */
112769 if( (pPragma->mPragFlg & PragFlg_NoColumns)==0
112770 && ((pPragma->mPragFlg & PragFlg_NoColumns1)==0 || zRight==0)
112771 ){
112772 setPragmaResultColumnNames(v, pPragma);
112773 }
112774
112775 /* Jump to the appropriate pragma handler */
112776 switch( pPragma->ePragTyp ){
@@ -114271,10 +114310,19 @@
114310 }
114311 break;
114312 #endif
114313
114314 } /* End of the PRAGMA switch */
114315
114316 /* The following block is a no-op unless SQLITE_DEBUG is defined. Its only
114317 ** purpose is to execute assert() statements to verify that if the
114318 ** PragFlg_NoColumns1 flag is set and the caller specified an argument
114319 ** to the PRAGMA, the implementation has not added any OP_ResultRow
114320 ** instructions to the VM. */
114321 if( (pPragma->mPragFlg & PragFlg_NoColumns1) && zRight ){
114322 sqlite3VdbeVerifyNoResultRow(v);
114323 }
114324
114325 pragma_out:
114326 sqlite3DbFree(db, zLeft);
114327 sqlite3DbFree(db, zRight);
114328 }
@@ -116186,12 +116234,11 @@
116234 if( eDest==SRT_Mem || eDest==SRT_Output || eDest==SRT_Coroutine ){
116235 ecelFlags = SQLITE_ECEL_DUP;
116236 }else{
116237 ecelFlags = 0;
116238 }
116239 if( pSort && hasDistinct==0 && eDest!=SRT_EphemTab && eDest!=SRT_Table ){
 
116240 /* For each expression in pEList that is a copy of an expression in
116241 ** the ORDER BY clause (pSort->pOrderBy), set the associated
116242 ** iOrderByCol value to one more than the index of the ORDER BY
116243 ** expression within the sort-key that pushOntoSorter() will generate.
116244 ** This allows the pEList field to be omitted from the sorted record,
@@ -116729,10 +116776,11 @@
116776 }
116777 sqlite3VdbeAddOp3(v, OP_Column, iSortTab, iRead, regRow+i);
116778 VdbeComment((v, "%s", aOutEx[i].zName ? aOutEx[i].zName : aOutEx[i].zSpan));
116779 }
116780 switch( eDest ){
116781 case SRT_Table:
116782 case SRT_EphemTab: {
116783 sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, regRowid);
116784 sqlite3VdbeAddOp3(v, OP_Insert, iParm, regRow, regRowid);
116785 sqlite3VdbeChangeP5(v, OPFLAG_APPEND);
116786 break;
@@ -189748,11 +189796,11 @@
189796 }
189797 }
189798 else if( pLeaf->nn>pLeaf->szLeaf ){
189799 pIter->iPgidxOff = pLeaf->szLeaf + fts5GetVarint32(
189800 &pLeaf->p[pLeaf->szLeaf], iOff
189801 );
189802 pIter->iLeafOffset = iOff;
189803 pIter->iEndofDoclist = iOff;
189804 bNewTerm = 1;
189805 }
189806 assert_nc( iOff<pLeaf->szLeaf );
@@ -189782,10 +189830,11 @@
189830 ** Later: Switched back to fts5SegIterLoadNPos() because it supports
189831 ** detail=none mode. Not ideal.
189832 */
189833 int nSz;
189834 assert( p->rc==SQLITE_OK );
189835 assert( pIter->iLeafOffset<=pIter->pLeaf->nn );
189836 fts5FastGetVarint32(pIter->pLeaf->p, pIter->iLeafOffset, nSz);
189837 pIter->bDel = (nSz & 0x0001);
189838 pIter->nPos = nSz>>1;
189839 assert_nc( pIter->nPos>=0 );
189840 }
@@ -190776,11 +190825,11 @@
190825 fts5DataRelease(pData);
190826 if( nRem<=0 ){
190827 break;
190828 }else{
190829 pgno++;
190830 pData = fts5LeafRead(p, FTS5_SEGMENT_ROWID(pSeg->pSeg->iSegid, pgno));
190831 if( pData==0 ) break;
190832 pChunk = &pData->p[4];
190833 nChunk = MIN(nRem, pData->szLeaf - 4);
190834 if( pgno==pgnoSave ){
190835 assert( pSeg->pNextLeaf==0 );
@@ -193538,11 +193587,11 @@
193587
193588 /* If the leaf in question has already been trimmed from the segment,
193589 ** ignore this b-tree entry. Otherwise, load it into memory. */
193590 if( iIdxLeaf<pSeg->pgnoFirst ) continue;
193591 iRow = FTS5_SEGMENT_ROWID(pSeg->iSegid, iIdxLeaf);
193592 pLeaf = fts5LeafRead(p, iRow);
193593 if( pLeaf==0 ) break;
193594
193595 /* Check that the leaf contains at least one term, and that it is equal
193596 ** to or larger than the split-key in zIdxTerm. Also check that if there
193597 ** is also a rowid pointer within the leaf page header, it points to a
@@ -196814,11 +196863,11 @@
196863 int nArg, /* Number of args */
196864 sqlite3_value **apUnused /* Function arguments */
196865 ){
196866 assert( nArg==0 );
196867 UNUSED_PARAM2(nArg, apUnused);
196868 sqlite3_result_text(pCtx, "fts5: 2017-01-06 16:32:41 a65a62893ca8319e89e48b8a38cf8a59c69a8209", -1, SQLITE_TRANSIENT);
196869 }
196870
196871 static int fts5Init(sqlite3 *db){
196872 static const sqlite3_module fts5Mod = {
196873 /* iVersion */ 2,
196874
+9 -5
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -119,13 +119,13 @@
119119
**
120120
** See also: [sqlite3_libversion()],
121121
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122122
** [sqlite_version()] and [sqlite_source_id()].
123123
*/
124
-#define SQLITE_VERSION "3.16.1"
125
-#define SQLITE_VERSION_NUMBER 3016001
126
-#define SQLITE_SOURCE_ID "2017-01-03 18:27:03 979f04392853b8053817a3eea2fc679947b437fd"
124
+#define SQLITE_VERSION "3.16.2"
125
+#define SQLITE_VERSION_NUMBER 3016002
126
+#define SQLITE_SOURCE_ID "2017-01-06 16:32:41 a65a62893ca8319e89e48b8a38cf8a59c69a8209"
127127
128128
/*
129129
** CAPI3REF: Run-Time Library Version Numbers
130130
** KEYWORDS: sqlite3_version sqlite3_sourceid
131131
**
@@ -3894,12 +3894,16 @@
38943894
/*
38953895
** CAPI3REF: Number Of Columns In A Result Set
38963896
** METHOD: sqlite3_stmt
38973897
**
38983898
** ^Return the number of columns in the result set returned by the
3899
-** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
3900
-** statement that does not return data (for example an [UPDATE]).
3899
+** [prepared statement]. ^If this routine returns 0, that means the
3900
+** [prepared statement] returns no data (for example an [UPDATE]).
3901
+** ^However, just because this routine returns a positive number does not
3902
+** mean that one or more rows of data will be returned. ^A SELECT statement
3903
+** will always have a positive sqlite3_column_count() but depending on the
3904
+** WHERE clause constraints and the table content, it might return no rows.
39013905
**
39023906
** See also: [sqlite3_data_count()]
39033907
*/
39043908
SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
39053909
39063910
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -119,13 +119,13 @@
119 **
120 ** See also: [sqlite3_libversion()],
121 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122 ** [sqlite_version()] and [sqlite_source_id()].
123 */
124 #define SQLITE_VERSION "3.16.1"
125 #define SQLITE_VERSION_NUMBER 3016001
126 #define SQLITE_SOURCE_ID "2017-01-03 18:27:03 979f04392853b8053817a3eea2fc679947b437fd"
127
128 /*
129 ** CAPI3REF: Run-Time Library Version Numbers
130 ** KEYWORDS: sqlite3_version sqlite3_sourceid
131 **
@@ -3894,12 +3894,16 @@
3894 /*
3895 ** CAPI3REF: Number Of Columns In A Result Set
3896 ** METHOD: sqlite3_stmt
3897 **
3898 ** ^Return the number of columns in the result set returned by the
3899 ** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
3900 ** statement that does not return data (for example an [UPDATE]).
 
 
 
 
3901 **
3902 ** See also: [sqlite3_data_count()]
3903 */
3904 SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
3905
3906
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -119,13 +119,13 @@
119 **
120 ** See also: [sqlite3_libversion()],
121 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122 ** [sqlite_version()] and [sqlite_source_id()].
123 */
124 #define SQLITE_VERSION "3.16.2"
125 #define SQLITE_VERSION_NUMBER 3016002
126 #define SQLITE_SOURCE_ID "2017-01-06 16:32:41 a65a62893ca8319e89e48b8a38cf8a59c69a8209"
127
128 /*
129 ** CAPI3REF: Run-Time Library Version Numbers
130 ** KEYWORDS: sqlite3_version sqlite3_sourceid
131 **
@@ -3894,12 +3894,16 @@
3894 /*
3895 ** CAPI3REF: Number Of Columns In A Result Set
3896 ** METHOD: sqlite3_stmt
3897 **
3898 ** ^Return the number of columns in the result set returned by the
3899 ** [prepared statement]. ^If this routine returns 0, that means the
3900 ** [prepared statement] returns no data (for example an [UPDATE]).
3901 ** ^However, just because this routine returns a positive number does not
3902 ** mean that one or more rows of data will be returned. ^A SELECT statement
3903 ** will always have a positive sqlite3_column_count() but depending on the
3904 ** WHERE clause constraints and the table content, it might return no rows.
3905 **
3906 ** See also: [sqlite3_data_count()]
3907 */
3908 SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
3909
3910

Keyboard Shortcuts

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