Fossil SCM

Update the built-in SQLite to 3.6.23.1 release candidate 1.

drh 2010-03-27 12:56 UTC trunk
Commit 340d3398e6142453e7226dfb7143f8dac2e54301
2 files changed +508 -426 +2 -2
+508 -426
--- 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.6.23. By combining all the individual C code files into this
3
+** version 3.6.23.1. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a one 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% are more are commonly seen when SQLite is compiled as a single
88
** translation unit.
@@ -626,13 +626,13 @@
626626
**
627627
** See also: [sqlite3_libversion()],
628628
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
629629
** [sqlite_version()] and [sqlite_source_id()].
630630
*/
631
-#define SQLITE_VERSION "3.6.23"
631
+#define SQLITE_VERSION "3.6.23.1"
632632
#define SQLITE_VERSION_NUMBER 3006023
633
-#define SQLITE_SOURCE_ID "2010-03-05 13:53:23 27413fc8dd52b754b4be9344a66bb9e0d752d48e"
633
+#define SQLITE_SOURCE_ID "2010-03-26 22:28:06 b078b588d617e07886ad156e9f54ade6d823568e"
634634
635635
/*
636636
** CAPI3REF: Run-Time Library Version Numbers
637637
** KEYWORDS: sqlite3_version, sqlite3_sourceid
638638
**
@@ -10425,11 +10425,11 @@
1042510425
SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value*, u8);
1042610426
SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
1042710427
void(*)(void*));
1042810428
SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*);
1042910429
SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *);
10430
-SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int);
10430
+SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8);
1043110431
#ifdef SQLITE_ENABLE_STAT2
1043210432
SQLITE_PRIVATE char *sqlite3Utf8to16(sqlite3 *, u8, char *, int, int *);
1043310433
#endif
1043410434
SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);
1043510435
SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
@@ -10866,10 +10866,397 @@
1086610866
** the vdbe.c file.
1086710867
*/
1086810868
SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER;
1086910869
1087010870
/************** End of global.c **********************************************/
10871
+/************** Begin file ctime.c *******************************************/
10872
+/*
10873
+** 2010 February 23
10874
+**
10875
+** The author disclaims copyright to this source code. In place of
10876
+** a legal notice, here is a blessing:
10877
+**
10878
+** May you do good and not evil.
10879
+** May you find forgiveness for yourself and forgive others.
10880
+** May you share freely, never taking more than you give.
10881
+**
10882
+*************************************************************************
10883
+**
10884
+** This file implements routines used to report what compile-time options
10885
+** SQLite was built with.
10886
+*/
10887
+
10888
+#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
10889
+
10890
+
10891
+/*
10892
+** An array of names of all compile-time options. This array should
10893
+** be sorted A-Z.
10894
+**
10895
+** This array looks large, but in a typical installation actually uses
10896
+** only a handful of compile-time options, so most times this array is usually
10897
+** rather short and uses little memory space.
10898
+*/
10899
+static const char * const azCompileOpt[] = {
10900
+
10901
+/* These macros are provided to "stringify" the value of the define
10902
+** for those options in which the value is meaningful. */
10903
+#define CTIMEOPT_VAL_(opt) #opt
10904
+#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)
10905
+
10906
+#ifdef SQLITE_32BIT_ROWID
10907
+ "32BIT_ROWID",
10908
+#endif
10909
+#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC
10910
+ "4_BYTE_ALIGNED_MALLOC",
10911
+#endif
10912
+#ifdef SQLITE_CASE_SENSITIVE_LIKE
10913
+ "CASE_SENSITIVE_LIKE",
10914
+#endif
10915
+#ifdef SQLITE_CHECK_PAGES
10916
+ "CHECK_PAGES",
10917
+#endif
10918
+#ifdef SQLITE_COVERAGE_TEST
10919
+ "COVERAGE_TEST",
10920
+#endif
10921
+#ifdef SQLITE_DEBUG
10922
+ "DEBUG",
10923
+#endif
10924
+#ifdef SQLITE_DEFAULT_LOCKING_MODE
10925
+ "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),
10926
+#endif
10927
+#ifdef SQLITE_DISABLE_DIRSYNC
10928
+ "DISABLE_DIRSYNC",
10929
+#endif
10930
+#ifdef SQLITE_DISABLE_LFS
10931
+ "DISABLE_LFS",
10932
+#endif
10933
+#ifdef SQLITE_ENABLE_ATOMIC_WRITE
10934
+ "ENABLE_ATOMIC_WRITE",
10935
+#endif
10936
+#ifdef SQLITE_ENABLE_CEROD
10937
+ "ENABLE_CEROD",
10938
+#endif
10939
+#ifdef SQLITE_ENABLE_COLUMN_METADATA
10940
+ "ENABLE_COLUMN_METADATA",
10941
+#endif
10942
+#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
10943
+ "ENABLE_EXPENSIVE_ASSERT",
10944
+#endif
10945
+#ifdef SQLITE_ENABLE_FTS1
10946
+ "ENABLE_FTS1",
10947
+#endif
10948
+#ifdef SQLITE_ENABLE_FTS2
10949
+ "ENABLE_FTS2",
10950
+#endif
10951
+#ifdef SQLITE_ENABLE_FTS3
10952
+ "ENABLE_FTS3",
10953
+#endif
10954
+#ifdef SQLITE_ENABLE_FTS3_PARENTHESIS
10955
+ "ENABLE_FTS3_PARENTHESIS",
10956
+#endif
10957
+#ifdef SQLITE_ENABLE_FTS4
10958
+ "ENABLE_FTS4",
10959
+#endif
10960
+#ifdef SQLITE_ENABLE_ICU
10961
+ "ENABLE_ICU",
10962
+#endif
10963
+#ifdef SQLITE_ENABLE_IOTRACE
10964
+ "ENABLE_IOTRACE",
10965
+#endif
10966
+#ifdef SQLITE_ENABLE_LOAD_EXTENSION
10967
+ "ENABLE_LOAD_EXTENSION",
10968
+#endif
10969
+#ifdef SQLITE_ENABLE_LOCKING_STYLE
10970
+ "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
10971
+#endif
10972
+#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
10973
+ "ENABLE_MEMORY_MANAGEMENT",
10974
+#endif
10975
+#ifdef SQLITE_ENABLE_MEMSYS3
10976
+ "ENABLE_MEMSYS3",
10977
+#endif
10978
+#ifdef SQLITE_ENABLE_MEMSYS5
10979
+ "ENABLE_MEMSYS5",
10980
+#endif
10981
+#ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK
10982
+ "ENABLE_OVERSIZE_CELL_CHECK",
10983
+#endif
10984
+#ifdef SQLITE_ENABLE_RTREE
10985
+ "ENABLE_RTREE",
10986
+#endif
10987
+#ifdef SQLITE_ENABLE_STAT2
10988
+ "ENABLE_STAT2",
10989
+#endif
10990
+#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
10991
+ "ENABLE_UNLOCK_NOTIFY",
10992
+#endif
10993
+#ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
10994
+ "ENABLE_UPDATE_DELETE_LIMIT",
10995
+#endif
10996
+#ifdef SQLITE_HAS_CODEC
10997
+ "HAS_CODEC",
10998
+#endif
10999
+#ifdef SQLITE_HAVE_ISNAN
11000
+ "HAVE_ISNAN",
11001
+#endif
11002
+#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
11003
+ "HOMEGROWN_RECURSIVE_MUTEX",
11004
+#endif
11005
+#ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS
11006
+ "IGNORE_AFP_LOCK_ERRORS",
11007
+#endif
11008
+#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS
11009
+ "IGNORE_FLOCK_LOCK_ERRORS",
11010
+#endif
11011
+#ifdef SQLITE_INT64_TYPE
11012
+ "INT64_TYPE",
11013
+#endif
11014
+#ifdef SQLITE_LOCK_TRACE
11015
+ "LOCK_TRACE",
11016
+#endif
11017
+#ifdef SQLITE_MEMDEBUG
11018
+ "MEMDEBUG",
11019
+#endif
11020
+#ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT
11021
+ "MIXED_ENDIAN_64BIT_FLOAT",
11022
+#endif
11023
+#ifdef SQLITE_NO_SYNC
11024
+ "NO_SYNC",
11025
+#endif
11026
+#ifdef SQLITE_OMIT_ALTERTABLE
11027
+ "OMIT_ALTERTABLE",
11028
+#endif
11029
+#ifdef SQLITE_OMIT_ANALYZE
11030
+ "OMIT_ANALYZE",
11031
+#endif
11032
+#ifdef SQLITE_OMIT_ATTACH
11033
+ "OMIT_ATTACH",
11034
+#endif
11035
+#ifdef SQLITE_OMIT_AUTHORIZATION
11036
+ "OMIT_AUTHORIZATION",
11037
+#endif
11038
+#ifdef SQLITE_OMIT_AUTOINCREMENT
11039
+ "OMIT_AUTOINCREMENT",
11040
+#endif
11041
+#ifdef SQLITE_OMIT_AUTOINIT
11042
+ "OMIT_AUTOINIT",
11043
+#endif
11044
+#ifdef SQLITE_OMIT_AUTOVACUUM
11045
+ "OMIT_AUTOVACUUM",
11046
+#endif
11047
+#ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION
11048
+ "OMIT_BETWEEN_OPTIMIZATION",
11049
+#endif
11050
+#ifdef SQLITE_OMIT_BLOB_LITERAL
11051
+ "OMIT_BLOB_LITERAL",
11052
+#endif
11053
+#ifdef SQLITE_OMIT_BTREECOUNT
11054
+ "OMIT_BTREECOUNT",
11055
+#endif
11056
+#ifdef SQLITE_OMIT_BUILTIN_TEST
11057
+ "OMIT_BUILTIN_TEST",
11058
+#endif
11059
+#ifdef SQLITE_OMIT_CAST
11060
+ "OMIT_CAST",
11061
+#endif
11062
+#ifdef SQLITE_OMIT_CHECK
11063
+ "OMIT_CHECK",
11064
+#endif
11065
+#ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS
11066
+ "OMIT_COMPILEOPTION_DIAGS",
11067
+#endif
11068
+#ifdef SQLITE_OMIT_COMPLETE
11069
+ "OMIT_COMPLETE",
11070
+#endif
11071
+#ifdef SQLITE_OMIT_COMPOUND_SELECT
11072
+ "OMIT_COMPOUND_SELECT",
11073
+#endif
11074
+#ifdef SQLITE_OMIT_DATETIME_FUNCS
11075
+ "OMIT_DATETIME_FUNCS",
11076
+#endif
11077
+#ifdef SQLITE_OMIT_DECLTYPE
11078
+ "OMIT_DECLTYPE",
11079
+#endif
11080
+#ifdef SQLITE_OMIT_DEPRECATED
11081
+ "OMIT_DEPRECATED",
11082
+#endif
11083
+#ifdef SQLITE_OMIT_DISKIO
11084
+ "OMIT_DISKIO",
11085
+#endif
11086
+#ifdef SQLITE_OMIT_EXPLAIN
11087
+ "OMIT_EXPLAIN",
11088
+#endif
11089
+#ifdef SQLITE_OMIT_FLAG_PRAGMAS
11090
+ "OMIT_FLAG_PRAGMAS",
11091
+#endif
11092
+#ifdef SQLITE_OMIT_FLOATING_POINT
11093
+ "OMIT_FLOATING_POINT",
11094
+#endif
11095
+#ifdef SQLITE_OMIT_FOREIGN_KEY
11096
+ "OMIT_FOREIGN_KEY",
11097
+#endif
11098
+#ifdef SQLITE_OMIT_GET_TABLE
11099
+ "OMIT_GET_TABLE",
11100
+#endif
11101
+#ifdef SQLITE_OMIT_GLOBALRECOVER
11102
+ "OMIT_GLOBALRECOVER",
11103
+#endif
11104
+#ifdef SQLITE_OMIT_INCRBLOB
11105
+ "OMIT_INCRBLOB",
11106
+#endif
11107
+#ifdef SQLITE_OMIT_INTEGRITY_CHECK
11108
+ "OMIT_INTEGRITY_CHECK",
11109
+#endif
11110
+#ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
11111
+ "OMIT_LIKE_OPTIMIZATION",
11112
+#endif
11113
+#ifdef SQLITE_OMIT_LOAD_EXTENSION
11114
+ "OMIT_LOAD_EXTENSION",
11115
+#endif
11116
+#ifdef SQLITE_OMIT_LOCALTIME
11117
+ "OMIT_LOCALTIME",
11118
+#endif
11119
+#ifdef SQLITE_OMIT_LOOKASIDE
11120
+ "OMIT_LOOKASIDE",
11121
+#endif
11122
+#ifdef SQLITE_OMIT_MEMORYDB
11123
+ "OMIT_MEMORYDB",
11124
+#endif
11125
+#ifdef SQLITE_OMIT_OR_OPTIMIZATION
11126
+ "OMIT_OR_OPTIMIZATION",
11127
+#endif
11128
+#ifdef SQLITE_OMIT_PAGER_PRAGMAS
11129
+ "OMIT_PAGER_PRAGMAS",
11130
+#endif
11131
+#ifdef SQLITE_OMIT_PRAGMA
11132
+ "OMIT_PRAGMA",
11133
+#endif
11134
+#ifdef SQLITE_OMIT_PROGRESS_CALLBACK
11135
+ "OMIT_PROGRESS_CALLBACK",
11136
+#endif
11137
+#ifdef SQLITE_OMIT_QUICKBALANCE
11138
+ "OMIT_QUICKBALANCE",
11139
+#endif
11140
+#ifdef SQLITE_OMIT_REINDEX
11141
+ "OMIT_REINDEX",
11142
+#endif
11143
+#ifdef SQLITE_OMIT_SCHEMA_PRAGMAS
11144
+ "OMIT_SCHEMA_PRAGMAS",
11145
+#endif
11146
+#ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
11147
+ "OMIT_SCHEMA_VERSION_PRAGMAS",
11148
+#endif
11149
+#ifdef SQLITE_OMIT_SHARED_CACHE
11150
+ "OMIT_SHARED_CACHE",
11151
+#endif
11152
+#ifdef SQLITE_OMIT_SUBQUERY
11153
+ "OMIT_SUBQUERY",
11154
+#endif
11155
+#ifdef SQLITE_OMIT_TCL_VARIABLE
11156
+ "OMIT_TCL_VARIABLE",
11157
+#endif
11158
+#ifdef SQLITE_OMIT_TEMPDB
11159
+ "OMIT_TEMPDB",
11160
+#endif
11161
+#ifdef SQLITE_OMIT_TRACE
11162
+ "OMIT_TRACE",
11163
+#endif
11164
+#ifdef SQLITE_OMIT_TRIGGER
11165
+ "OMIT_TRIGGER",
11166
+#endif
11167
+#ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
11168
+ "OMIT_TRUNCATE_OPTIMIZATION",
11169
+#endif
11170
+#ifdef SQLITE_OMIT_UTF16
11171
+ "OMIT_UTF16",
11172
+#endif
11173
+#ifdef SQLITE_OMIT_VACUUM
11174
+ "OMIT_VACUUM",
11175
+#endif
11176
+#ifdef SQLITE_OMIT_VIEW
11177
+ "OMIT_VIEW",
11178
+#endif
11179
+#ifdef SQLITE_OMIT_VIRTUALTABLE
11180
+ "OMIT_VIRTUALTABLE",
11181
+#endif
11182
+#ifdef SQLITE_OMIT_WSD
11183
+ "OMIT_WSD",
11184
+#endif
11185
+#ifdef SQLITE_OMIT_XFER_OPT
11186
+ "OMIT_XFER_OPT",
11187
+#endif
11188
+#ifdef SQLITE_PERFORMANCE_TRACE
11189
+ "PERFORMANCE_TRACE",
11190
+#endif
11191
+#ifdef SQLITE_PROXY_DEBUG
11192
+ "PROXY_DEBUG",
11193
+#endif
11194
+#ifdef SQLITE_SECURE_DELETE
11195
+ "SECURE_DELETE",
11196
+#endif
11197
+#ifdef SQLITE_SMALL_STACK
11198
+ "SMALL_STACK",
11199
+#endif
11200
+#ifdef SQLITE_SOUNDEX
11201
+ "SOUNDEX",
11202
+#endif
11203
+#ifdef SQLITE_TCL
11204
+ "TCL",
11205
+#endif
11206
+#ifdef SQLITE_TEMP_STORE
11207
+ "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE),
11208
+#endif
11209
+#ifdef SQLITE_TEST
11210
+ "TEST",
11211
+#endif
11212
+#ifdef SQLITE_THREADSAFE
11213
+ "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE),
11214
+#endif
11215
+#ifdef SQLITE_USE_ALLOCA
11216
+ "USE_ALLOCA",
11217
+#endif
11218
+#ifdef SQLITE_ZERO_MALLOC
11219
+ "ZERO_MALLOC"
11220
+#endif
11221
+};
11222
+
11223
+/*
11224
+** Given the name of a compile-time option, return true if that option
11225
+** was used and false if not.
11226
+**
11227
+** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
11228
+** is not required for a match.
11229
+*/
11230
+SQLITE_API int sqlite3_compileoption_used(const char *zOptName){
11231
+ int i, n;
11232
+ if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
11233
+ n = sqlite3Strlen30(zOptName);
11234
+
11235
+ /* Since ArraySize(azCompileOpt) is normally in single digits, a
11236
+ ** linear search is adequate. No need for a binary search. */
11237
+ for(i=0; i<ArraySize(azCompileOpt); i++){
11238
+ if( (sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0)
11239
+ && ( (azCompileOpt[i][n]==0) || (azCompileOpt[i][n]=='=') ) ) return 1;
11240
+ }
11241
+ return 0;
11242
+}
11243
+
11244
+/*
11245
+** Return the N-th compile-time option string. If N is out of range,
11246
+** return a NULL pointer.
11247
+*/
11248
+SQLITE_API const char *sqlite3_compileoption_get(int N){
11249
+ if( N>=0 && N<ArraySize(azCompileOpt) ){
11250
+ return azCompileOpt[N];
11251
+ }
11252
+ return 0;
11253
+}
11254
+
11255
+#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
11256
+
11257
+/************** End of ctime.c ***********************************************/
1087111258
/************** Begin file status.c ******************************************/
1087211259
/*
1087311260
** 2008 June 18
1087411261
**
1087511262
** The author disclaims copyright to this source code. In place of
@@ -12996,11 +13383,12 @@
1299613383
*/
1299713384
static void sqlite3MemFree(void *pPrior){
1299813385
struct MemBlockHdr *pHdr;
1299913386
void **pBt;
1300013387
char *z;
13001
- assert( sqlite3GlobalConfig.bMemstat || mem.mutex!=0 );
13388
+ assert( sqlite3GlobalConfig.bMemstat || sqlite3GlobalConfig.bCoreMutex==0
13389
+ || mem.mutex!=0 );
1300213390
pHdr = sqlite3MemsysGetHeader(pPrior);
1300313391
pBt = (void**)pHdr;
1300413392
pBt -= pHdr->nBacktraceSlots;
1300513393
sqlite3_mutex_enter(mem.mutex);
1300613394
if( pHdr->pPrev ){
@@ -15623,11 +16011,13 @@
1562316011
printf("enter mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef);
1562416012
}
1562516013
#endif
1562616014
}
1562716015
static int winMutexTry(sqlite3_mutex *p){
16016
+#ifndef NDEBUG
1562816017
DWORD tid = GetCurrentThreadId();
16018
+#endif
1562916019
int rc = SQLITE_BUSY;
1563016020
assert( p->id==SQLITE_MUTEX_RECURSIVE || winMutexNotheld2(p, tid) );
1563116021
/*
1563216022
** The sqlite3_mutex_try() routine is very rarely used, and when it
1563316023
** is used it is merely an optimization. So it is OK for it to always
@@ -15661,11 +16051,13 @@
1566116051
** previously entered by the same thread. The behavior
1566216052
** is undefined if the mutex is not currently entered or
1566316053
** is not currently allocated. SQLite will never do either.
1566416054
*/
1566516055
static void winMutexLeave(sqlite3_mutex *p){
15666
- DWORD tid = GetCurrentThreadId();
16056
+#ifndef NDEBUG
16057
+ DWORD tid = GetCurrentThreadId();
16058
+#endif
1566716059
assert( p->nRef>0 );
1566816060
assert( p->owner==tid );
1566916061
p->nRef--;
1567016062
assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );
1567116063
LeaveCriticalSection(&p->mutex);
@@ -18422,23 +18814,25 @@
1842218814
** Memory to hold the UTF-8 string is obtained from sqlite3_malloc and must
1842318815
** be freed by the calling function.
1842418816
**
1842518817
** NULL is returned if there is an allocation error.
1842618818
*/
18427
-SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *db, const void *z, int nByte){
18819
+SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *db, const void *z, int nByte, u8 enc){
1842818820
Mem m;
1842918821
memset(&m, 0, sizeof(m));
1843018822
m.db = db;
18431
- sqlite3VdbeMemSetStr(&m, z, nByte, SQLITE_UTF16NATIVE, SQLITE_STATIC);
18823
+ sqlite3VdbeMemSetStr(&m, z, nByte, enc, SQLITE_STATIC);
1843218824
sqlite3VdbeChangeEncoding(&m, SQLITE_UTF8);
1843318825
if( db->mallocFailed ){
1843418826
sqlite3VdbeMemRelease(&m);
1843518827
m.z = 0;
1843618828
}
1843718829
assert( (m.flags & MEM_Term)!=0 || db->mallocFailed );
1843818830
assert( (m.flags & MEM_Str)!=0 || db->mallocFailed );
18439
- return (m.flags & MEM_Dyn)!=0 ? m.z : sqlite3DbStrDup(db, m.z);
18831
+ assert( (m.flags & MEM_Dyn)!=0 || db->mallocFailed );
18832
+ assert( m.z || db->mallocFailed );
18833
+ return m.z;
1844018834
}
1844118835
1844218836
/*
1844318837
** Convert a UTF-8 string to the UTF-16 encoding specified by parameter
1844418838
** enc. A pointer to the new string is returned, and the value of *pnOut
@@ -19236,11 +19630,11 @@
1923619630
return 2;
1923719631
}
1923819632
1923919633
/* Verify that constants are precomputed correctly */
1924019634
assert( SLOT_2_0 == ((0x7f<<14) | (0x7f)) );
19241
- assert( SLOT_4_2_0 == ((0xf<<28) | (0x7f<<14) | (0x7f)) );
19635
+ assert( SLOT_4_2_0 == ((0xfU<<28) | (0x7f<<14) | (0x7f)) );
1924219636
1924319637
p++;
1924419638
a = a<<14;
1924519639
a |= *p;
1924619640
/* a: p0<<14 | p2 (unmasked) */
@@ -33815,10 +34209,13 @@
3381534209
if( rc==SQLITE_OK ){
3381634210
zMaster = pPager->pTmpSpace;
3381734211
rc = readMasterJournal(pPager->jfd, zMaster, pPager->pVfs->mxPathname+1);
3381834212
testcase( rc!=SQLITE_OK );
3381934213
}
34214
+ if( rc==SQLITE_OK && pPager->noSync==0 && pPager->state>=PAGER_EXCLUSIVE ){
34215
+ rc = sqlite3OsSync(pPager->fd, pPager->sync_flags);
34216
+ }
3382034217
if( rc==SQLITE_OK ){
3382134218
rc = pager_end_transaction(pPager, zMaster[0]!='\0');
3382234219
testcase( rc!=SQLITE_OK );
3382334220
}
3382434221
if( rc==SQLITE_OK && zMaster[0] && res ){
@@ -35135,10 +35532,11 @@
3513535532
}
3513635533
/* pPager->xBusyHandler = 0; */
3513735534
/* pPager->pBusyHandlerArg = 0; */
3513835535
pPager->xReiniter = xReinit;
3513935536
/* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */
35537
+
3514035538
*ppPager = pPager;
3514135539
return SQLITE_OK;
3514235540
}
3514335541
3514435542
@@ -35284,12 +35682,28 @@
3528435682
rc = sqlite3OsRead(pPager->fd, pPg->pData, pPager->pageSize, iOffset);
3528535683
if( rc==SQLITE_IOERR_SHORT_READ ){
3528635684
rc = SQLITE_OK;
3528735685
}
3528835686
if( pgno==1 ){
35289
- u8 *dbFileVers = &((u8*)pPg->pData)[24];
35290
- memcpy(&pPager->dbFileVers, dbFileVers, sizeof(pPager->dbFileVers));
35687
+ if( rc ){
35688
+ /* If the read is unsuccessful, set the dbFileVers[] to something
35689
+ ** that will never be a valid file version. dbFileVers[] is a copy
35690
+ ** of bytes 24..39 of the database. Bytes 28..31 should always be
35691
+ ** zero. Bytes 32..35 and 35..39 should be page numbers which are
35692
+ ** never 0xffffffff. So filling pPager->dbFileVers[] with all 0xff
35693
+ ** bytes should suffice.
35694
+ **
35695
+ ** For an encrypted database, the situation is more complex: bytes
35696
+ ** 24..39 of the database are white noise. But the probability of
35697
+ ** white noising equaling 16 bytes of 0xff is vanishingly small so
35698
+ ** we should still be ok.
35699
+ */
35700
+ memset(pPager->dbFileVers, 0xff, sizeof(pPager->dbFileVers));
35701
+ }else{
35702
+ u8 *dbFileVers = &((u8*)pPg->pData)[24];
35703
+ memcpy(&pPager->dbFileVers, dbFileVers, sizeof(pPager->dbFileVers));
35704
+ }
3529135705
}
3529235706
CODEC1(pPager, pPg->pData, pgno, 3, rc = SQLITE_NOMEM);
3529335707
3529435708
PAGER_INCR(sqlite3_pager_readdb_count);
3529535709
PAGER_INCR(pPager->nRead);
@@ -36786,10 +37200,11 @@
3678637200
if( op==SAVEPOINT_RELEASE ){
3678737201
if( nNew==0 && isOpen(pPager->sjfd) ){
3678837202
/* Only truncate if it is an in-memory sub-journal. */
3678937203
if( sqlite3IsMemJournal(pPager->sjfd) ){
3679037204
rc = sqlite3OsTruncate(pPager->sjfd, 0);
37205
+ assert( rc==SQLITE_OK );
3679137206
}
3679237207
pPager->nSubRec = 0;
3679337208
}
3679437209
}
3679537210
/* Else this is a rollback operation, playback the specified savepoint.
@@ -43199,11 +43614,11 @@
4319943614
if( nOvfl ){
4320043615
rc = getOverflowPage(pBt, ovflPgno, &pOvfl, &iNext);
4320143616
if( rc ) return rc;
4320243617
}
4320343618
43204
- if( (pOvfl || (pOvfl = btreePageLookup(pBt, ovflPgno)))
43619
+ if( ( pOvfl || ((pOvfl = btreePageLookup(pBt, ovflPgno))!=0) )
4320543620
&& sqlite3PagerPageRefcount(pOvfl->pDbPage)!=1
4320643621
){
4320743622
/* There is no reason any cursor should have an outstanding reference
4320843623
** to an overflow page belonging to a cell that is being deleted/updated.
4320943624
** So if there exists more than one reference to this page, then it
@@ -43952,11 +44367,11 @@
4395244367
** the dropCell() routine will overwrite the entire cell with zeroes.
4395344368
** In this case, temporarily copy the cell into the aOvflSpace[]
4395444369
** buffer. It will be copied out again as soon as the aSpace[] buffer
4395544370
** is allocated. */
4395644371
if( pBt->secureDelete ){
43957
- int iOff = apDiv[i] - pParent->aData;
44372
+ int iOff = SQLITE_PTR_TO_INT(apDiv[i]) - SQLITE_PTR_TO_INT(pParent->aData);
4395844373
if( (iOff+szNew[i])>pBt->usableSize ){
4395944374
rc = SQLITE_CORRUPT_BKPT;
4396044375
memset(apOld, 0, (i+1)*sizeof(MemPage*));
4396144376
goto balance_cleanup;
4396244377
}else{
@@ -47321,11 +47736,11 @@
4732147736
SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){
4732247737
assert( (pFrom->flags & MEM_RowSet)==0 );
4732347738
sqlite3VdbeMemReleaseExternal(pTo);
4732447739
memcpy(pTo, pFrom, MEMCELLSIZE);
4732547740
pTo->xDel = 0;
47326
- if( (pFrom->flags&MEM_Dyn)!=0 || pFrom->z==pFrom->zMalloc ){
47741
+ if( (pFrom->flags&MEM_Static)==0 ){
4732747742
pTo->flags &= ~(MEM_Dyn|MEM_Static|MEM_Ephem);
4732847743
assert( srcType==MEM_Ephem || srcType==MEM_Static );
4732947744
pTo->flags |= srcType;
4733047745
}
4733147746
}
@@ -49953,16 +50368,21 @@
4995350368
}
4995450369
4995550370
/* If eStatementOp is non-zero, then a statement transaction needs to
4995650371
** be committed or rolled back. Call sqlite3VdbeCloseStatement() to
4995750372
** do so. If this operation returns an error, and the current statement
49958
- ** error code is SQLITE_OK or SQLITE_CONSTRAINT, then set the error
49959
- ** code to the new value.
50373
+ ** error code is SQLITE_OK or SQLITE_CONSTRAINT, then promote the
50374
+ ** current statement error code.
50375
+ **
50376
+ ** Note that sqlite3VdbeCloseStatement() can only fail if eStatementOp
50377
+ ** is SAVEPOINT_ROLLBACK. But if p->rc==SQLITE_OK then eStatementOp
50378
+ ** must be SAVEPOINT_RELEASE. Hence the NEVER(p->rc==SQLITE_OK) in
50379
+ ** the following code.
4996050380
*/
4996150381
if( eStatementOp ){
4996250382
rc = sqlite3VdbeCloseStatement(p, eStatementOp);
49963
- if( rc && (p->rc==SQLITE_OK || p->rc==SQLITE_CONSTRAINT) ){
50383
+ if( rc && (NEVER(p->rc==SQLITE_OK) || p->rc==SQLITE_CONSTRAINT) ){
4996450384
p->rc = rc;
4996550385
sqlite3DbFree(db, p->zErrMsg);
4996650386
p->zErrMsg = 0;
4996750387
}
4996850388
}
@@ -52577,21 +52997,34 @@
5257752997
** look like a number, leave it alone.
5257852998
*/
5257952999
static void applyNumericAffinity(Mem *pRec){
5258053000
if( (pRec->flags & (MEM_Real|MEM_Int))==0 ){
5258153001
int realnum;
53002
+ u8 enc = pRec->enc;
5258253003
sqlite3VdbeMemNulTerminate(pRec);
52583
- if( (pRec->flags&MEM_Str)
52584
- && sqlite3IsNumber(pRec->z, &realnum, pRec->enc) ){
53004
+ if( (pRec->flags&MEM_Str) && sqlite3IsNumber(pRec->z, &realnum, enc) ){
5258553005
i64 value;
52586
- sqlite3VdbeChangeEncoding(pRec, SQLITE_UTF8);
52587
- if( !realnum && sqlite3Atoi64(pRec->z, &value) ){
53006
+ char *zUtf8 = pRec->z;
53007
+#ifndef SQLITE_OMIT_UTF16
53008
+ if( enc!=SQLITE_UTF8 ){
53009
+ assert( pRec->db );
53010
+ zUtf8 = sqlite3Utf16to8(pRec->db, pRec->z, pRec->n, enc);
53011
+ if( !zUtf8 ) return;
53012
+ }
53013
+#endif
53014
+ if( !realnum && sqlite3Atoi64(zUtf8, &value) ){
5258853015
pRec->u.i = value;
5258953016
MemSetTypeFlag(pRec, MEM_Int);
5259053017
}else{
52591
- sqlite3VdbeMemRealify(pRec);
53018
+ sqlite3AtoF(zUtf8, &pRec->r);
53019
+ MemSetTypeFlag(pRec, MEM_Real);
5259253020
}
53021
+#ifndef SQLITE_OMIT_UTF16
53022
+ if( enc!=SQLITE_UTF8 ){
53023
+ sqlite3DbFree(pRec->db, zUtf8);
53024
+ }
53025
+#endif
5259353026
}
5259453027
}
5259553028
}
5259653029
5259753030
/*
@@ -53039,10 +53472,12 @@
5303953472
i64 b;
5304053473
} ah;
5304153474
struct OP_Ge_stack_vars {
5304253475
int res; /* Result of the comparison of pIn1 against pIn3 */
5304353476
char affinity; /* Affinity to use for comparison */
53477
+ u16 flags1; /* Copy of initial value of pIn1->flags */
53478
+ u16 flags3; /* Copy of initial value of pIn3->flags */
5304453479
} ai;
5304553480
struct OP_Compare_stack_vars {
5304653481
int n;
5304753482
int i;
5304853483
int p1;
@@ -54573,14 +55008,18 @@
5457355008
case OP_Gt: /* same as TK_GT, jump, in1, in3 */
5457455009
case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
5457555010
#if 0 /* local variables moved into u.ai */
5457655011
int res; /* Result of the comparison of pIn1 against pIn3 */
5457755012
char affinity; /* Affinity to use for comparison */
55013
+ u16 flags1; /* Copy of initial value of pIn1->flags */
55014
+ u16 flags3; /* Copy of initial value of pIn3->flags */
5457855015
#endif /* local variables moved into u.ai */
5457955016
5458055017
pIn1 = &aMem[pOp->p1];
5458155018
pIn3 = &aMem[pOp->p3];
55019
+ u.ai.flags1 = pIn1->flags;
55020
+ u.ai.flags3 = pIn3->flags;
5458255021
if( (pIn1->flags | pIn3->flags)&MEM_Null ){
5458355022
/* One or both operands are NULL */
5458455023
if( pOp->p5 & SQLITE_NULLEQ ){
5458555024
/* If SQLITE_NULLEQ is set (which will only happen if the operator is
5458655025
** OP_Eq or OP_Ne) then take the jump or not depending on whether
@@ -54631,10 +55070,14 @@
5463155070
pOut->u.i = u.ai.res;
5463255071
REGISTER_TRACE(pOp->p2, pOut);
5463355072
}else if( u.ai.res ){
5463455073
pc = pOp->p2-1;
5463555074
}
55075
+
55076
+ /* Undo any changes made by applyAffinity() to the input registers. */
55077
+ pIn1->flags = (pIn1->flags&~MEM_TypeMask) | (u.ai.flags1&MEM_TypeMask);
55078
+ pIn3->flags = (pIn3->flags&~MEM_TypeMask) | (u.ai.flags3&MEM_TypeMask);
5463655079
break;
5463755080
}
5463855081
5463955082
/* Opcode: Permutation * * * P4 *
5464055083
**
@@ -61176,14 +61619,10 @@
6117661619
p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight);
6117761620
p5 = binaryCompareP5(pLeft, pRight, jumpIfNull);
6117861621
addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1,
6117961622
(void*)p4, P4_COLLSEQ);
6118061623
sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5);
61181
- if( (p5 & SQLITE_AFF_MASK)!=SQLITE_AFF_NONE ){
61182
- sqlite3ExprCacheAffinityChange(pParse, in1, 1);
61183
- sqlite3ExprCacheAffinityChange(pParse, in2, 1);
61184
- }
6118561624
return addr;
6118661625
}
6118761626
6118861627
#if SQLITE_MAX_EXPR_DEPTH>0
6118961628
/*
@@ -71076,397 +71515,10 @@
7107671515
}
7107771516
return p;
7107871517
}
7107971518
7108071519
/************** End of callback.c ********************************************/
71081
-/************** Begin file ctime.c *******************************************/
71082
-/*
71083
-** 2010 February 23
71084
-**
71085
-** The author disclaims copyright to this source code. In place of
71086
-** a legal notice, here is a blessing:
71087
-**
71088
-** May you do good and not evil.
71089
-** May you find forgiveness for yourself and forgive others.
71090
-** May you share freely, never taking more than you give.
71091
-**
71092
-*************************************************************************
71093
-**
71094
-** This file implements routines used to report what compile-time options
71095
-** SQLite was built with.
71096
-*/
71097
-
71098
-#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
71099
-
71100
-
71101
-/*
71102
-** An array of names of all compile-time options. This array should
71103
-** be sorted A-Z.
71104
-**
71105
-** This array looks large, but in a typical installation actually uses
71106
-** only a handful of compile-time options, so most times this array is usually
71107
-** rather short and uses little memory space.
71108
-*/
71109
-static const char * const azCompileOpt[] = {
71110
-
71111
-/* These macros are provided to "stringify" the value of the define
71112
-** for those options in which the value is meaningful. */
71113
-#define CTIMEOPT_VAL_(opt) #opt
71114
-#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)
71115
-
71116
-#ifdef SQLITE_32BIT_ROWID
71117
- "32BIT_ROWID",
71118
-#endif
71119
-#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC
71120
- "4_BYTE_ALIGNED_MALLOC",
71121
-#endif
71122
-#ifdef SQLITE_CASE_SENSITIVE_LIKE
71123
- "CASE_SENSITIVE_LIKE",
71124
-#endif
71125
-#ifdef SQLITE_CHECK_PAGES
71126
- "CHECK_PAGES",
71127
-#endif
71128
-#ifdef SQLITE_COVERAGE_TEST
71129
- "COVERAGE_TEST",
71130
-#endif
71131
-#ifdef SQLITE_DEBUG
71132
- "DEBUG",
71133
-#endif
71134
-#ifdef SQLITE_DEFAULT_LOCKING_MODE
71135
- "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),
71136
-#endif
71137
-#ifdef SQLITE_DISABLE_DIRSYNC
71138
- "DISABLE_DIRSYNC",
71139
-#endif
71140
-#ifdef SQLITE_DISABLE_LFS
71141
- "DISABLE_LFS",
71142
-#endif
71143
-#ifdef SQLITE_ENABLE_ATOMIC_WRITE
71144
- "ENABLE_ATOMIC_WRITE",
71145
-#endif
71146
-#ifdef SQLITE_ENABLE_CEROD
71147
- "ENABLE_CEROD",
71148
-#endif
71149
-#ifdef SQLITE_ENABLE_COLUMN_METADATA
71150
- "ENABLE_COLUMN_METADATA",
71151
-#endif
71152
-#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
71153
- "ENABLE_EXPENSIVE_ASSERT",
71154
-#endif
71155
-#ifdef SQLITE_ENABLE_FTS1
71156
- "ENABLE_FTS1",
71157
-#endif
71158
-#ifdef SQLITE_ENABLE_FTS2
71159
- "ENABLE_FTS2",
71160
-#endif
71161
-#ifdef SQLITE_ENABLE_FTS3
71162
- "ENABLE_FTS3",
71163
-#endif
71164
-#ifdef SQLITE_ENABLE_FTS3_PARENTHESIS
71165
- "ENABLE_FTS3_PARENTHESIS",
71166
-#endif
71167
-#ifdef SQLITE_ENABLE_FTS4
71168
- "ENABLE_FTS4",
71169
-#endif
71170
-#ifdef SQLITE_ENABLE_ICU
71171
- "ENABLE_ICU",
71172
-#endif
71173
-#ifdef SQLITE_ENABLE_IOTRACE
71174
- "ENABLE_IOTRACE",
71175
-#endif
71176
-#ifdef SQLITE_ENABLE_LOAD_EXTENSION
71177
- "ENABLE_LOAD_EXTENSION",
71178
-#endif
71179
-#ifdef SQLITE_ENABLE_LOCKING_STYLE
71180
- "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
71181
-#endif
71182
-#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
71183
- "ENABLE_MEMORY_MANAGEMENT",
71184
-#endif
71185
-#ifdef SQLITE_ENABLE_MEMSYS3
71186
- "ENABLE_MEMSYS3",
71187
-#endif
71188
-#ifdef SQLITE_ENABLE_MEMSYS5
71189
- "ENABLE_MEMSYS5",
71190
-#endif
71191
-#ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK
71192
- "ENABLE_OVERSIZE_CELL_CHECK",
71193
-#endif
71194
-#ifdef SQLITE_ENABLE_RTREE
71195
- "ENABLE_RTREE",
71196
-#endif
71197
-#ifdef SQLITE_ENABLE_STAT2
71198
- "ENABLE_STAT2",
71199
-#endif
71200
-#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
71201
- "ENABLE_UNLOCK_NOTIFY",
71202
-#endif
71203
-#ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
71204
- "ENABLE_UPDATE_DELETE_LIMIT",
71205
-#endif
71206
-#ifdef SQLITE_HAS_CODEC
71207
- "HAS_CODEC",
71208
-#endif
71209
-#ifdef SQLITE_HAVE_ISNAN
71210
- "HAVE_ISNAN",
71211
-#endif
71212
-#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
71213
- "HOMEGROWN_RECURSIVE_MUTEX",
71214
-#endif
71215
-#ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS
71216
- "IGNORE_AFP_LOCK_ERRORS",
71217
-#endif
71218
-#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS
71219
- "IGNORE_FLOCK_LOCK_ERRORS",
71220
-#endif
71221
-#ifdef SQLITE_INT64_TYPE
71222
- "INT64_TYPE",
71223
-#endif
71224
-#ifdef SQLITE_LOCK_TRACE
71225
- "LOCK_TRACE",
71226
-#endif
71227
-#ifdef SQLITE_MEMDEBUG
71228
- "MEMDEBUG",
71229
-#endif
71230
-#ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT
71231
- "MIXED_ENDIAN_64BIT_FLOAT",
71232
-#endif
71233
-#ifdef SQLITE_NO_SYNC
71234
- "NO_SYNC",
71235
-#endif
71236
-#ifdef SQLITE_OMIT_ALTERTABLE
71237
- "OMIT_ALTERTABLE",
71238
-#endif
71239
-#ifdef SQLITE_OMIT_ANALYZE
71240
- "OMIT_ANALYZE",
71241
-#endif
71242
-#ifdef SQLITE_OMIT_ATTACH
71243
- "OMIT_ATTACH",
71244
-#endif
71245
-#ifdef SQLITE_OMIT_AUTHORIZATION
71246
- "OMIT_AUTHORIZATION",
71247
-#endif
71248
-#ifdef SQLITE_OMIT_AUTOINCREMENT
71249
- "OMIT_AUTOINCREMENT",
71250
-#endif
71251
-#ifdef SQLITE_OMIT_AUTOINIT
71252
- "OMIT_AUTOINIT",
71253
-#endif
71254
-#ifdef SQLITE_OMIT_AUTOVACUUM
71255
- "OMIT_AUTOVACUUM",
71256
-#endif
71257
-#ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION
71258
- "OMIT_BETWEEN_OPTIMIZATION",
71259
-#endif
71260
-#ifdef SQLITE_OMIT_BLOB_LITERAL
71261
- "OMIT_BLOB_LITERAL",
71262
-#endif
71263
-#ifdef SQLITE_OMIT_BTREECOUNT
71264
- "OMIT_BTREECOUNT",
71265
-#endif
71266
-#ifdef SQLITE_OMIT_BUILTIN_TEST
71267
- "OMIT_BUILTIN_TEST",
71268
-#endif
71269
-#ifdef SQLITE_OMIT_CAST
71270
- "OMIT_CAST",
71271
-#endif
71272
-#ifdef SQLITE_OMIT_CHECK
71273
- "OMIT_CHECK",
71274
-#endif
71275
-#ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS
71276
- "OMIT_COMPILEOPTION_DIAGS",
71277
-#endif
71278
-#ifdef SQLITE_OMIT_COMPLETE
71279
- "OMIT_COMPLETE",
71280
-#endif
71281
-#ifdef SQLITE_OMIT_COMPOUND_SELECT
71282
- "OMIT_COMPOUND_SELECT",
71283
-#endif
71284
-#ifdef SQLITE_OMIT_DATETIME_FUNCS
71285
- "OMIT_DATETIME_FUNCS",
71286
-#endif
71287
-#ifdef SQLITE_OMIT_DECLTYPE
71288
- "OMIT_DECLTYPE",
71289
-#endif
71290
-#ifdef SQLITE_OMIT_DEPRECATED
71291
- "OMIT_DEPRECATED",
71292
-#endif
71293
-#ifdef SQLITE_OMIT_DISKIO
71294
- "OMIT_DISKIO",
71295
-#endif
71296
-#ifdef SQLITE_OMIT_EXPLAIN
71297
- "OMIT_EXPLAIN",
71298
-#endif
71299
-#ifdef SQLITE_OMIT_FLAG_PRAGMAS
71300
- "OMIT_FLAG_PRAGMAS",
71301
-#endif
71302
-#ifdef SQLITE_OMIT_FLOATING_POINT
71303
- "OMIT_FLOATING_POINT",
71304
-#endif
71305
-#ifdef SQLITE_OMIT_FOREIGN_KEY
71306
- "OMIT_FOREIGN_KEY",
71307
-#endif
71308
-#ifdef SQLITE_OMIT_GET_TABLE
71309
- "OMIT_GET_TABLE",
71310
-#endif
71311
-#ifdef SQLITE_OMIT_GLOBALRECOVER
71312
- "OMIT_GLOBALRECOVER",
71313
-#endif
71314
-#ifdef SQLITE_OMIT_INCRBLOB
71315
- "OMIT_INCRBLOB",
71316
-#endif
71317
-#ifdef SQLITE_OMIT_INTEGRITY_CHECK
71318
- "OMIT_INTEGRITY_CHECK",
71319
-#endif
71320
-#ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
71321
- "OMIT_LIKE_OPTIMIZATION",
71322
-#endif
71323
-#ifdef SQLITE_OMIT_LOAD_EXTENSION
71324
- "OMIT_LOAD_EXTENSION",
71325
-#endif
71326
-#ifdef SQLITE_OMIT_LOCALTIME
71327
- "OMIT_LOCALTIME",
71328
-#endif
71329
-#ifdef SQLITE_OMIT_LOOKASIDE
71330
- "OMIT_LOOKASIDE",
71331
-#endif
71332
-#ifdef SQLITE_OMIT_MEMORYDB
71333
- "OMIT_MEMORYDB",
71334
-#endif
71335
-#ifdef SQLITE_OMIT_OR_OPTIMIZATION
71336
- "OMIT_OR_OPTIMIZATION",
71337
-#endif
71338
-#ifdef SQLITE_OMIT_PAGER_PRAGMAS
71339
- "OMIT_PAGER_PRAGMAS",
71340
-#endif
71341
-#ifdef SQLITE_OMIT_PRAGMA
71342
- "OMIT_PRAGMA",
71343
-#endif
71344
-#ifdef SQLITE_OMIT_PROGRESS_CALLBACK
71345
- "OMIT_PROGRESS_CALLBACK",
71346
-#endif
71347
-#ifdef SQLITE_OMIT_QUICKBALANCE
71348
- "OMIT_QUICKBALANCE",
71349
-#endif
71350
-#ifdef SQLITE_OMIT_REINDEX
71351
- "OMIT_REINDEX",
71352
-#endif
71353
-#ifdef SQLITE_OMIT_SCHEMA_PRAGMAS
71354
- "OMIT_SCHEMA_PRAGMAS",
71355
-#endif
71356
-#ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
71357
- "OMIT_SCHEMA_VERSION_PRAGMAS",
71358
-#endif
71359
-#ifdef SQLITE_OMIT_SHARED_CACHE
71360
- "OMIT_SHARED_CACHE",
71361
-#endif
71362
-#ifdef SQLITE_OMIT_SUBQUERY
71363
- "OMIT_SUBQUERY",
71364
-#endif
71365
-#ifdef SQLITE_OMIT_TCL_VARIABLE
71366
- "OMIT_TCL_VARIABLE",
71367
-#endif
71368
-#ifdef SQLITE_OMIT_TEMPDB
71369
- "OMIT_TEMPDB",
71370
-#endif
71371
-#ifdef SQLITE_OMIT_TRACE
71372
- "OMIT_TRACE",
71373
-#endif
71374
-#ifdef SQLITE_OMIT_TRIGGER
71375
- "OMIT_TRIGGER",
71376
-#endif
71377
-#ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
71378
- "OMIT_TRUNCATE_OPTIMIZATION",
71379
-#endif
71380
-#ifdef SQLITE_OMIT_UTF16
71381
- "OMIT_UTF16",
71382
-#endif
71383
-#ifdef SQLITE_OMIT_VACUUM
71384
- "OMIT_VACUUM",
71385
-#endif
71386
-#ifdef SQLITE_OMIT_VIEW
71387
- "OMIT_VIEW",
71388
-#endif
71389
-#ifdef SQLITE_OMIT_VIRTUALTABLE
71390
- "OMIT_VIRTUALTABLE",
71391
-#endif
71392
-#ifdef SQLITE_OMIT_WSD
71393
- "OMIT_WSD",
71394
-#endif
71395
-#ifdef SQLITE_OMIT_XFER_OPT
71396
- "OMIT_XFER_OPT",
71397
-#endif
71398
-#ifdef SQLITE_PERFORMANCE_TRACE
71399
- "PERFORMANCE_TRACE",
71400
-#endif
71401
-#ifdef SQLITE_PROXY_DEBUG
71402
- "PROXY_DEBUG",
71403
-#endif
71404
-#ifdef SQLITE_SECURE_DELETE
71405
- "SECURE_DELETE",
71406
-#endif
71407
-#ifdef SQLITE_SMALL_STACK
71408
- "SMALL_STACK",
71409
-#endif
71410
-#ifdef SQLITE_SOUNDEX
71411
- "SOUNDEX",
71412
-#endif
71413
-#ifdef SQLITE_TCL
71414
- "TCL",
71415
-#endif
71416
-#ifdef SQLITE_TEMP_STORE
71417
- "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE),
71418
-#endif
71419
-#ifdef SQLITE_TEST
71420
- "TEST",
71421
-#endif
71422
-#ifdef SQLITE_THREADSAFE
71423
- "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE),
71424
-#endif
71425
-#ifdef SQLITE_USE_ALLOCA
71426
- "USE_ALLOCA",
71427
-#endif
71428
-#ifdef SQLITE_ZERO_MALLOC
71429
- "ZERO_MALLOC"
71430
-#endif
71431
-};
71432
-
71433
-/*
71434
-** Given the name of a compile-time option, return true if that option
71435
-** was used and false if not.
71436
-**
71437
-** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
71438
-** is not required for a match.
71439
-*/
71440
-SQLITE_API int sqlite3_compileoption_used(const char *zOptName){
71441
- int i, n;
71442
- if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
71443
- n = sqlite3Strlen30(zOptName);
71444
-
71445
- /* Since ArraySize(azCompileOpt) is normally in single digits, a
71446
- ** linear search is adequate. No need for a binary search. */
71447
- for(i=0; i<ArraySize(azCompileOpt); i++){
71448
- if( (sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0)
71449
- && ( (azCompileOpt[i][n]==0) || (azCompileOpt[i][n]=='=') ) ) return 1;
71450
- }
71451
- return 0;
71452
-}
71453
-
71454
-/*
71455
-** Return the N-th compile-time option string. If N is out of range,
71456
-** return a NULL pointer.
71457
-*/
71458
-SQLITE_API const char *sqlite3_compileoption_get(int N){
71459
- if( N>=0 && N<ArraySize(azCompileOpt) ){
71460
- return azCompileOpt[N];
71461
- }
71462
- return 0;
71463
-}
71464
-
71465
-#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
71466
-
71467
-/************** End of ctime.c ***********************************************/
7146871520
/************** Begin file delete.c ******************************************/
7146971521
/*
7147071522
** 2001 September 15
7147171523
**
7147271524
** The author disclaims copyright to this source code. In place of
@@ -80134,11 +80186,11 @@
8013480186
*ppStmt = 0;
8013580187
if( !sqlite3SafetyCheckOk(db) ){
8013680188
return SQLITE_MISUSE_BKPT;
8013780189
}
8013880190
sqlite3_mutex_enter(db->mutex);
80139
- zSql8 = sqlite3Utf16to8(db, zSql, nBytes);
80191
+ zSql8 = sqlite3Utf16to8(db, zSql, nBytes, SQLITE_UTF16NATIVE);
8014080192
if( zSql8 ){
8014180193
rc = sqlite3LockAndPrepare(db, zSql8, -1, saveSqlFlag, 0, ppStmt, &zTail8);
8014280194
}
8014380195
8014480196
if( zTail8 && pzTail ){
@@ -97459,11 +97511,11 @@
9745997511
){
9746097512
int rc;
9746197513
char *zFunc8;
9746297514
sqlite3_mutex_enter(db->mutex);
9746397515
assert( !db->mallocFailed );
97464
- zFunc8 = sqlite3Utf16to8(db, zFunctionName, -1);
97516
+ zFunc8 = sqlite3Utf16to8(db, zFunctionName, -1, SQLITE_UTF16NATIVE);
9746597517
rc = sqlite3CreateFunc(db, zFunc8, nArg, eTextRep, p, xFunc, xStep, xFinal);
9746697518
sqlite3DbFree(db, zFunc8);
9746797519
rc = sqlite3ApiExit(db, rc);
9746897520
sqlite3_mutex_leave(db->mutex);
9746997521
return rc;
@@ -98282,11 +98334,11 @@
9828298334
){
9828398335
int rc = SQLITE_OK;
9828498336
char *zName8;
9828598337
sqlite3_mutex_enter(db->mutex);
9828698338
assert( !db->mallocFailed );
98287
- zName8 = sqlite3Utf16to8(db, zName, -1);
98339
+ zName8 = sqlite3Utf16to8(db, zName, -1, SQLITE_UTF16NATIVE);
9828898340
if( zName8 ){
9828998341
rc = createCollation(db, zName8, (u8)enc, SQLITE_COLL_USER, pCtx, xCompare, 0);
9829098342
sqlite3DbFree(db, zName8);
9829198343
}
9829298344
rc = sqlite3ApiExit(db, rc);
@@ -100273,10 +100325,18 @@
100273100325
p->zDb, p->zName
100274100326
);
100275100327
}
100276100328
return rc;
100277100329
}
100330
+
100331
+/*
100332
+** An sqlite3_exec() callback for fts3TableExists.
100333
+*/
100334
+static int fts3TableExistsCallback(void *pArg, int n, char **pp1, char **pp2){
100335
+ *(int*)pArg = 1;
100336
+ return 1;
100337
+}
100278100338
100279100339
/*
100280100340
** Determine if a table currently exists in the database.
100281100341
*/
100282100342
static void fts3TableExists(
@@ -100286,14 +100346,21 @@
100286100346
const char *zName, /* Name of the FTS3 table */
100287100347
const char *zSuffix, /* Shadow table extension */
100288100348
u8 *pResult /* Write results here */
100289100349
){
100290100350
int rc = SQLITE_OK;
100351
+ int res = 0;
100352
+ char *zSql;
100291100353
if( *pRc ) return;
100292
- fts3DbExec(&rc, db, "SELECT 1 FROM %Q.'%q%s'", zDb, zName, zSuffix);
100293
- *pResult = (rc==SQLITE_OK) ? 1 : 0;
100294
- if( rc!=SQLITE_ERROR ) *pRc = rc;
100354
+ zSql = sqlite3_mprintf(
100355
+ "SELECT 1 FROM %Q.sqlite_master WHERE name='%q%s'",
100356
+ zDb, zName, zSuffix
100357
+ );
100358
+ rc = sqlite3_exec(db, zSql, fts3TableExistsCallback, &res, 0);
100359
+ sqlite3_free(zSql);
100360
+ *pResult = res & 0xff;
100361
+ if( rc!=SQLITE_ABORT ) *pRc = rc;
100295100362
}
100296100363
100297100364
/*
100298100365
** This function is the implementation of both the xConnect and xCreate
100299100366
** methods of the FTS3 virtual table.
@@ -100711,11 +100778,16 @@
100711100778
*piPrev = iVal;
100712100779
}
100713100780
100714100781
/*
100715100782
** When this function is called, *ppPoslist is assumed to point to the
100716
-** start of a position-list.
100783
+** start of a position-list. After it returns, *ppPoslist points to the
100784
+** first byte after the position-list.
100785
+**
100786
+** If pp is not NULL, then the contents of the position list are copied
100787
+** to *pp. *pp is set to point to the first byte past the last byte copied
100788
+** before this function returns.
100717100789
*/
100718100790
static void fts3PoslistCopy(char **pp, char **ppPoslist){
100719100791
char *pEnd = *ppPoslist;
100720100792
char c = 0;
100721100793
@@ -101702,11 +101774,17 @@
101702101774
}
101703101775
101704101776
rc = sqlite3Fts3ExprParse(p->pTokenizer, p->azColumn, p->nColumn,
101705101777
iCol, zQuery, -1, &pCsr->pExpr
101706101778
);
101707
- if( rc!=SQLITE_OK ) return rc;
101779
+ if( rc!=SQLITE_OK ){
101780
+ if( rc==SQLITE_ERROR ){
101781
+ p->base.zErrMsg = sqlite3_mprintf("malformed MATCH expression: [%s]",
101782
+ zQuery);
101783
+ }
101784
+ return rc;
101785
+ }
101708101786
101709101787
rc = evalFts3Expr(p, pCsr->pExpr, &pCsr->aDoclist, &pCsr->nDoclist, 0);
101710101788
pCsr->pNextId = pCsr->aDoclist;
101711101789
pCsr->iPrevId = 0;
101712101790
}
@@ -101855,11 +101933,13 @@
101855101933
101856101934
assert( pCsr );
101857101935
while( pCsr<pEnd ){
101858101936
if( pExpr->iCurrent<iDocid ){
101859101937
fts3PoslistCopy(0, &pCsr);
101860
- fts3GetDeltaVarint(&pCsr, &pExpr->iCurrent);
101938
+ if( pCsr<pEnd ){
101939
+ fts3GetDeltaVarint(&pCsr, &pExpr->iCurrent);
101940
+ }
101861101941
pExpr->pCurrent = pCsr;
101862101942
}else{
101863101943
if( pExpr->iCurrent==iDocid ){
101864101944
int iThis = 0;
101865101945
if( iCol<0 ){
@@ -105105,13 +105185,13 @@
105105105185
/* 3 */ "DELETE FROM %Q.'%q_segments'",
105106105186
/* 4 */ "DELETE FROM %Q.'%q_segdir'",
105107105187
/* 5 */ "DELETE FROM %Q.'%q_docsize'",
105108105188
/* 6 */ "DELETE FROM %Q.'%q_stat'",
105109105189
/* 7 */ "SELECT * FROM %Q.'%q_content' WHERE rowid=?",
105110
-/* 8 */ "SELECT coalesce(max(idx)+1, 0) FROM %Q.'%q_segdir' WHERE level=?",
105190
+/* 8 */ "SELECT (SELECT max(idx) FROM %Q.'%q_segdir' WHERE level = ?) + 1",
105111105191
/* 9 */ "INSERT INTO %Q.'%q_segments'(blockid, block) VALUES(?, ?)",
105112
-/* 10 */ "SELECT coalesce(max(blockid)+1, 1) FROM %Q.'%q_segments'",
105192
+/* 10 */ "SELECT coalesce((SELECT max(blockid) FROM %Q.'%q_segments') + 1, 1)",
105113105193
/* 11 */ "INSERT INTO %Q.'%q_segdir' VALUES(?,?,?,?,?,?)",
105114105194
105115105195
/* Return segments in order from oldest to newest.*/
105116105196
/* 12 */ "SELECT idx, start_block, leaves_end_block, end_block, root "
105117105197
"FROM %Q.'%q_segdir' WHERE level = ? ORDER BY idx ASC",
@@ -108666,15 +108746,17 @@
108666108746
char aBuffer[64];
108667108747
sqlite3_snprintf(sizeof(aBuffer), aBuffer,
108668108748
"%d %d %d %d ", iCol, pTerm-sCtx.aTerm, iStart, iEnd-iStart
108669108749
);
108670108750
rc = fts3StringAppend(&res, aBuffer, -1);
108751
+ }else if( rc==SQLITE_DONE ){
108752
+ rc = SQLITE_CORRUPT;
108671108753
}
108672108754
}
108673108755
}
108674108756
if( rc==SQLITE_DONE ){
108675
- rc = SQLITE_CORRUPT;
108757
+ rc = SQLITE_OK;
108676108758
}
108677108759
108678108760
pMod->xClose(pC);
108679108761
if( rc!=SQLITE_OK ) goto offsets_out;
108680108762
}
108681108763
--- 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.6.23. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a one 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% are more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -626,13 +626,13 @@
626 **
627 ** See also: [sqlite3_libversion()],
628 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
629 ** [sqlite_version()] and [sqlite_source_id()].
630 */
631 #define SQLITE_VERSION "3.6.23"
632 #define SQLITE_VERSION_NUMBER 3006023
633 #define SQLITE_SOURCE_ID "2010-03-05 13:53:23 27413fc8dd52b754b4be9344a66bb9e0d752d48e"
634
635 /*
636 ** CAPI3REF: Run-Time Library Version Numbers
637 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
638 **
@@ -10425,11 +10425,11 @@
10425 SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value*, u8);
10426 SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
10427 void(*)(void*));
10428 SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*);
10429 SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *);
10430 SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int);
10431 #ifdef SQLITE_ENABLE_STAT2
10432 SQLITE_PRIVATE char *sqlite3Utf8to16(sqlite3 *, u8, char *, int, int *);
10433 #endif
10434 SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);
10435 SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
@@ -10866,10 +10866,397 @@
10866 ** the vdbe.c file.
10867 */
10868 SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER;
10869
10870 /************** End of global.c **********************************************/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10871 /************** Begin file status.c ******************************************/
10872 /*
10873 ** 2008 June 18
10874 **
10875 ** The author disclaims copyright to this source code. In place of
@@ -12996,11 +13383,12 @@
12996 */
12997 static void sqlite3MemFree(void *pPrior){
12998 struct MemBlockHdr *pHdr;
12999 void **pBt;
13000 char *z;
13001 assert( sqlite3GlobalConfig.bMemstat || mem.mutex!=0 );
 
13002 pHdr = sqlite3MemsysGetHeader(pPrior);
13003 pBt = (void**)pHdr;
13004 pBt -= pHdr->nBacktraceSlots;
13005 sqlite3_mutex_enter(mem.mutex);
13006 if( pHdr->pPrev ){
@@ -15623,11 +16011,13 @@
15623 printf("enter mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef);
15624 }
15625 #endif
15626 }
15627 static int winMutexTry(sqlite3_mutex *p){
 
15628 DWORD tid = GetCurrentThreadId();
 
15629 int rc = SQLITE_BUSY;
15630 assert( p->id==SQLITE_MUTEX_RECURSIVE || winMutexNotheld2(p, tid) );
15631 /*
15632 ** The sqlite3_mutex_try() routine is very rarely used, and when it
15633 ** is used it is merely an optimization. So it is OK for it to always
@@ -15661,11 +16051,13 @@
15661 ** previously entered by the same thread. The behavior
15662 ** is undefined if the mutex is not currently entered or
15663 ** is not currently allocated. SQLite will never do either.
15664 */
15665 static void winMutexLeave(sqlite3_mutex *p){
15666 DWORD tid = GetCurrentThreadId();
 
 
15667 assert( p->nRef>0 );
15668 assert( p->owner==tid );
15669 p->nRef--;
15670 assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );
15671 LeaveCriticalSection(&p->mutex);
@@ -18422,23 +18814,25 @@
18422 ** Memory to hold the UTF-8 string is obtained from sqlite3_malloc and must
18423 ** be freed by the calling function.
18424 **
18425 ** NULL is returned if there is an allocation error.
18426 */
18427 SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *db, const void *z, int nByte){
18428 Mem m;
18429 memset(&m, 0, sizeof(m));
18430 m.db = db;
18431 sqlite3VdbeMemSetStr(&m, z, nByte, SQLITE_UTF16NATIVE, SQLITE_STATIC);
18432 sqlite3VdbeChangeEncoding(&m, SQLITE_UTF8);
18433 if( db->mallocFailed ){
18434 sqlite3VdbeMemRelease(&m);
18435 m.z = 0;
18436 }
18437 assert( (m.flags & MEM_Term)!=0 || db->mallocFailed );
18438 assert( (m.flags & MEM_Str)!=0 || db->mallocFailed );
18439 return (m.flags & MEM_Dyn)!=0 ? m.z : sqlite3DbStrDup(db, m.z);
 
 
18440 }
18441
18442 /*
18443 ** Convert a UTF-8 string to the UTF-16 encoding specified by parameter
18444 ** enc. A pointer to the new string is returned, and the value of *pnOut
@@ -19236,11 +19630,11 @@
19236 return 2;
19237 }
19238
19239 /* Verify that constants are precomputed correctly */
19240 assert( SLOT_2_0 == ((0x7f<<14) | (0x7f)) );
19241 assert( SLOT_4_2_0 == ((0xf<<28) | (0x7f<<14) | (0x7f)) );
19242
19243 p++;
19244 a = a<<14;
19245 a |= *p;
19246 /* a: p0<<14 | p2 (unmasked) */
@@ -33815,10 +34209,13 @@
33815 if( rc==SQLITE_OK ){
33816 zMaster = pPager->pTmpSpace;
33817 rc = readMasterJournal(pPager->jfd, zMaster, pPager->pVfs->mxPathname+1);
33818 testcase( rc!=SQLITE_OK );
33819 }
 
 
 
33820 if( rc==SQLITE_OK ){
33821 rc = pager_end_transaction(pPager, zMaster[0]!='\0');
33822 testcase( rc!=SQLITE_OK );
33823 }
33824 if( rc==SQLITE_OK && zMaster[0] && res ){
@@ -35135,10 +35532,11 @@
35135 }
35136 /* pPager->xBusyHandler = 0; */
35137 /* pPager->pBusyHandlerArg = 0; */
35138 pPager->xReiniter = xReinit;
35139 /* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */
 
35140 *ppPager = pPager;
35141 return SQLITE_OK;
35142 }
35143
35144
@@ -35284,12 +35682,28 @@
35284 rc = sqlite3OsRead(pPager->fd, pPg->pData, pPager->pageSize, iOffset);
35285 if( rc==SQLITE_IOERR_SHORT_READ ){
35286 rc = SQLITE_OK;
35287 }
35288 if( pgno==1 ){
35289 u8 *dbFileVers = &((u8*)pPg->pData)[24];
35290 memcpy(&pPager->dbFileVers, dbFileVers, sizeof(pPager->dbFileVers));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35291 }
35292 CODEC1(pPager, pPg->pData, pgno, 3, rc = SQLITE_NOMEM);
35293
35294 PAGER_INCR(sqlite3_pager_readdb_count);
35295 PAGER_INCR(pPager->nRead);
@@ -36786,10 +37200,11 @@
36786 if( op==SAVEPOINT_RELEASE ){
36787 if( nNew==0 && isOpen(pPager->sjfd) ){
36788 /* Only truncate if it is an in-memory sub-journal. */
36789 if( sqlite3IsMemJournal(pPager->sjfd) ){
36790 rc = sqlite3OsTruncate(pPager->sjfd, 0);
 
36791 }
36792 pPager->nSubRec = 0;
36793 }
36794 }
36795 /* Else this is a rollback operation, playback the specified savepoint.
@@ -43199,11 +43614,11 @@
43199 if( nOvfl ){
43200 rc = getOverflowPage(pBt, ovflPgno, &pOvfl, &iNext);
43201 if( rc ) return rc;
43202 }
43203
43204 if( (pOvfl || (pOvfl = btreePageLookup(pBt, ovflPgno)))
43205 && sqlite3PagerPageRefcount(pOvfl->pDbPage)!=1
43206 ){
43207 /* There is no reason any cursor should have an outstanding reference
43208 ** to an overflow page belonging to a cell that is being deleted/updated.
43209 ** So if there exists more than one reference to this page, then it
@@ -43952,11 +44367,11 @@
43952 ** the dropCell() routine will overwrite the entire cell with zeroes.
43953 ** In this case, temporarily copy the cell into the aOvflSpace[]
43954 ** buffer. It will be copied out again as soon as the aSpace[] buffer
43955 ** is allocated. */
43956 if( pBt->secureDelete ){
43957 int iOff = apDiv[i] - pParent->aData;
43958 if( (iOff+szNew[i])>pBt->usableSize ){
43959 rc = SQLITE_CORRUPT_BKPT;
43960 memset(apOld, 0, (i+1)*sizeof(MemPage*));
43961 goto balance_cleanup;
43962 }else{
@@ -47321,11 +47736,11 @@
47321 SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){
47322 assert( (pFrom->flags & MEM_RowSet)==0 );
47323 sqlite3VdbeMemReleaseExternal(pTo);
47324 memcpy(pTo, pFrom, MEMCELLSIZE);
47325 pTo->xDel = 0;
47326 if( (pFrom->flags&MEM_Dyn)!=0 || pFrom->z==pFrom->zMalloc ){
47327 pTo->flags &= ~(MEM_Dyn|MEM_Static|MEM_Ephem);
47328 assert( srcType==MEM_Ephem || srcType==MEM_Static );
47329 pTo->flags |= srcType;
47330 }
47331 }
@@ -49953,16 +50368,21 @@
49953 }
49954
49955 /* If eStatementOp is non-zero, then a statement transaction needs to
49956 ** be committed or rolled back. Call sqlite3VdbeCloseStatement() to
49957 ** do so. If this operation returns an error, and the current statement
49958 ** error code is SQLITE_OK or SQLITE_CONSTRAINT, then set the error
49959 ** code to the new value.
 
 
 
 
 
49960 */
49961 if( eStatementOp ){
49962 rc = sqlite3VdbeCloseStatement(p, eStatementOp);
49963 if( rc && (p->rc==SQLITE_OK || p->rc==SQLITE_CONSTRAINT) ){
49964 p->rc = rc;
49965 sqlite3DbFree(db, p->zErrMsg);
49966 p->zErrMsg = 0;
49967 }
49968 }
@@ -52577,21 +52997,34 @@
52577 ** look like a number, leave it alone.
52578 */
52579 static void applyNumericAffinity(Mem *pRec){
52580 if( (pRec->flags & (MEM_Real|MEM_Int))==0 ){
52581 int realnum;
 
52582 sqlite3VdbeMemNulTerminate(pRec);
52583 if( (pRec->flags&MEM_Str)
52584 && sqlite3IsNumber(pRec->z, &realnum, pRec->enc) ){
52585 i64 value;
52586 sqlite3VdbeChangeEncoding(pRec, SQLITE_UTF8);
52587 if( !realnum && sqlite3Atoi64(pRec->z, &value) ){
 
 
 
 
 
 
 
52588 pRec->u.i = value;
52589 MemSetTypeFlag(pRec, MEM_Int);
52590 }else{
52591 sqlite3VdbeMemRealify(pRec);
 
52592 }
 
 
 
 
 
52593 }
52594 }
52595 }
52596
52597 /*
@@ -53039,10 +53472,12 @@
53039 i64 b;
53040 } ah;
53041 struct OP_Ge_stack_vars {
53042 int res; /* Result of the comparison of pIn1 against pIn3 */
53043 char affinity; /* Affinity to use for comparison */
 
 
53044 } ai;
53045 struct OP_Compare_stack_vars {
53046 int n;
53047 int i;
53048 int p1;
@@ -54573,14 +55008,18 @@
54573 case OP_Gt: /* same as TK_GT, jump, in1, in3 */
54574 case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
54575 #if 0 /* local variables moved into u.ai */
54576 int res; /* Result of the comparison of pIn1 against pIn3 */
54577 char affinity; /* Affinity to use for comparison */
 
 
54578 #endif /* local variables moved into u.ai */
54579
54580 pIn1 = &aMem[pOp->p1];
54581 pIn3 = &aMem[pOp->p3];
 
 
54582 if( (pIn1->flags | pIn3->flags)&MEM_Null ){
54583 /* One or both operands are NULL */
54584 if( pOp->p5 & SQLITE_NULLEQ ){
54585 /* If SQLITE_NULLEQ is set (which will only happen if the operator is
54586 ** OP_Eq or OP_Ne) then take the jump or not depending on whether
@@ -54631,10 +55070,14 @@
54631 pOut->u.i = u.ai.res;
54632 REGISTER_TRACE(pOp->p2, pOut);
54633 }else if( u.ai.res ){
54634 pc = pOp->p2-1;
54635 }
 
 
 
 
54636 break;
54637 }
54638
54639 /* Opcode: Permutation * * * P4 *
54640 **
@@ -61176,14 +61619,10 @@
61176 p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight);
61177 p5 = binaryCompareP5(pLeft, pRight, jumpIfNull);
61178 addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1,
61179 (void*)p4, P4_COLLSEQ);
61180 sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5);
61181 if( (p5 & SQLITE_AFF_MASK)!=SQLITE_AFF_NONE ){
61182 sqlite3ExprCacheAffinityChange(pParse, in1, 1);
61183 sqlite3ExprCacheAffinityChange(pParse, in2, 1);
61184 }
61185 return addr;
61186 }
61187
61188 #if SQLITE_MAX_EXPR_DEPTH>0
61189 /*
@@ -71076,397 +71515,10 @@
71076 }
71077 return p;
71078 }
71079
71080 /************** End of callback.c ********************************************/
71081 /************** Begin file ctime.c *******************************************/
71082 /*
71083 ** 2010 February 23
71084 **
71085 ** The author disclaims copyright to this source code. In place of
71086 ** a legal notice, here is a blessing:
71087 **
71088 ** May you do good and not evil.
71089 ** May you find forgiveness for yourself and forgive others.
71090 ** May you share freely, never taking more than you give.
71091 **
71092 *************************************************************************
71093 **
71094 ** This file implements routines used to report what compile-time options
71095 ** SQLite was built with.
71096 */
71097
71098 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
71099
71100
71101 /*
71102 ** An array of names of all compile-time options. This array should
71103 ** be sorted A-Z.
71104 **
71105 ** This array looks large, but in a typical installation actually uses
71106 ** only a handful of compile-time options, so most times this array is usually
71107 ** rather short and uses little memory space.
71108 */
71109 static const char * const azCompileOpt[] = {
71110
71111 /* These macros are provided to "stringify" the value of the define
71112 ** for those options in which the value is meaningful. */
71113 #define CTIMEOPT_VAL_(opt) #opt
71114 #define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)
71115
71116 #ifdef SQLITE_32BIT_ROWID
71117 "32BIT_ROWID",
71118 #endif
71119 #ifdef SQLITE_4_BYTE_ALIGNED_MALLOC
71120 "4_BYTE_ALIGNED_MALLOC",
71121 #endif
71122 #ifdef SQLITE_CASE_SENSITIVE_LIKE
71123 "CASE_SENSITIVE_LIKE",
71124 #endif
71125 #ifdef SQLITE_CHECK_PAGES
71126 "CHECK_PAGES",
71127 #endif
71128 #ifdef SQLITE_COVERAGE_TEST
71129 "COVERAGE_TEST",
71130 #endif
71131 #ifdef SQLITE_DEBUG
71132 "DEBUG",
71133 #endif
71134 #ifdef SQLITE_DEFAULT_LOCKING_MODE
71135 "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),
71136 #endif
71137 #ifdef SQLITE_DISABLE_DIRSYNC
71138 "DISABLE_DIRSYNC",
71139 #endif
71140 #ifdef SQLITE_DISABLE_LFS
71141 "DISABLE_LFS",
71142 #endif
71143 #ifdef SQLITE_ENABLE_ATOMIC_WRITE
71144 "ENABLE_ATOMIC_WRITE",
71145 #endif
71146 #ifdef SQLITE_ENABLE_CEROD
71147 "ENABLE_CEROD",
71148 #endif
71149 #ifdef SQLITE_ENABLE_COLUMN_METADATA
71150 "ENABLE_COLUMN_METADATA",
71151 #endif
71152 #ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
71153 "ENABLE_EXPENSIVE_ASSERT",
71154 #endif
71155 #ifdef SQLITE_ENABLE_FTS1
71156 "ENABLE_FTS1",
71157 #endif
71158 #ifdef SQLITE_ENABLE_FTS2
71159 "ENABLE_FTS2",
71160 #endif
71161 #ifdef SQLITE_ENABLE_FTS3
71162 "ENABLE_FTS3",
71163 #endif
71164 #ifdef SQLITE_ENABLE_FTS3_PARENTHESIS
71165 "ENABLE_FTS3_PARENTHESIS",
71166 #endif
71167 #ifdef SQLITE_ENABLE_FTS4
71168 "ENABLE_FTS4",
71169 #endif
71170 #ifdef SQLITE_ENABLE_ICU
71171 "ENABLE_ICU",
71172 #endif
71173 #ifdef SQLITE_ENABLE_IOTRACE
71174 "ENABLE_IOTRACE",
71175 #endif
71176 #ifdef SQLITE_ENABLE_LOAD_EXTENSION
71177 "ENABLE_LOAD_EXTENSION",
71178 #endif
71179 #ifdef SQLITE_ENABLE_LOCKING_STYLE
71180 "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
71181 #endif
71182 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
71183 "ENABLE_MEMORY_MANAGEMENT",
71184 #endif
71185 #ifdef SQLITE_ENABLE_MEMSYS3
71186 "ENABLE_MEMSYS3",
71187 #endif
71188 #ifdef SQLITE_ENABLE_MEMSYS5
71189 "ENABLE_MEMSYS5",
71190 #endif
71191 #ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK
71192 "ENABLE_OVERSIZE_CELL_CHECK",
71193 #endif
71194 #ifdef SQLITE_ENABLE_RTREE
71195 "ENABLE_RTREE",
71196 #endif
71197 #ifdef SQLITE_ENABLE_STAT2
71198 "ENABLE_STAT2",
71199 #endif
71200 #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
71201 "ENABLE_UNLOCK_NOTIFY",
71202 #endif
71203 #ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
71204 "ENABLE_UPDATE_DELETE_LIMIT",
71205 #endif
71206 #ifdef SQLITE_HAS_CODEC
71207 "HAS_CODEC",
71208 #endif
71209 #ifdef SQLITE_HAVE_ISNAN
71210 "HAVE_ISNAN",
71211 #endif
71212 #ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
71213 "HOMEGROWN_RECURSIVE_MUTEX",
71214 #endif
71215 #ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS
71216 "IGNORE_AFP_LOCK_ERRORS",
71217 #endif
71218 #ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS
71219 "IGNORE_FLOCK_LOCK_ERRORS",
71220 #endif
71221 #ifdef SQLITE_INT64_TYPE
71222 "INT64_TYPE",
71223 #endif
71224 #ifdef SQLITE_LOCK_TRACE
71225 "LOCK_TRACE",
71226 #endif
71227 #ifdef SQLITE_MEMDEBUG
71228 "MEMDEBUG",
71229 #endif
71230 #ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT
71231 "MIXED_ENDIAN_64BIT_FLOAT",
71232 #endif
71233 #ifdef SQLITE_NO_SYNC
71234 "NO_SYNC",
71235 #endif
71236 #ifdef SQLITE_OMIT_ALTERTABLE
71237 "OMIT_ALTERTABLE",
71238 #endif
71239 #ifdef SQLITE_OMIT_ANALYZE
71240 "OMIT_ANALYZE",
71241 #endif
71242 #ifdef SQLITE_OMIT_ATTACH
71243 "OMIT_ATTACH",
71244 #endif
71245 #ifdef SQLITE_OMIT_AUTHORIZATION
71246 "OMIT_AUTHORIZATION",
71247 #endif
71248 #ifdef SQLITE_OMIT_AUTOINCREMENT
71249 "OMIT_AUTOINCREMENT",
71250 #endif
71251 #ifdef SQLITE_OMIT_AUTOINIT
71252 "OMIT_AUTOINIT",
71253 #endif
71254 #ifdef SQLITE_OMIT_AUTOVACUUM
71255 "OMIT_AUTOVACUUM",
71256 #endif
71257 #ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION
71258 "OMIT_BETWEEN_OPTIMIZATION",
71259 #endif
71260 #ifdef SQLITE_OMIT_BLOB_LITERAL
71261 "OMIT_BLOB_LITERAL",
71262 #endif
71263 #ifdef SQLITE_OMIT_BTREECOUNT
71264 "OMIT_BTREECOUNT",
71265 #endif
71266 #ifdef SQLITE_OMIT_BUILTIN_TEST
71267 "OMIT_BUILTIN_TEST",
71268 #endif
71269 #ifdef SQLITE_OMIT_CAST
71270 "OMIT_CAST",
71271 #endif
71272 #ifdef SQLITE_OMIT_CHECK
71273 "OMIT_CHECK",
71274 #endif
71275 #ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS
71276 "OMIT_COMPILEOPTION_DIAGS",
71277 #endif
71278 #ifdef SQLITE_OMIT_COMPLETE
71279 "OMIT_COMPLETE",
71280 #endif
71281 #ifdef SQLITE_OMIT_COMPOUND_SELECT
71282 "OMIT_COMPOUND_SELECT",
71283 #endif
71284 #ifdef SQLITE_OMIT_DATETIME_FUNCS
71285 "OMIT_DATETIME_FUNCS",
71286 #endif
71287 #ifdef SQLITE_OMIT_DECLTYPE
71288 "OMIT_DECLTYPE",
71289 #endif
71290 #ifdef SQLITE_OMIT_DEPRECATED
71291 "OMIT_DEPRECATED",
71292 #endif
71293 #ifdef SQLITE_OMIT_DISKIO
71294 "OMIT_DISKIO",
71295 #endif
71296 #ifdef SQLITE_OMIT_EXPLAIN
71297 "OMIT_EXPLAIN",
71298 #endif
71299 #ifdef SQLITE_OMIT_FLAG_PRAGMAS
71300 "OMIT_FLAG_PRAGMAS",
71301 #endif
71302 #ifdef SQLITE_OMIT_FLOATING_POINT
71303 "OMIT_FLOATING_POINT",
71304 #endif
71305 #ifdef SQLITE_OMIT_FOREIGN_KEY
71306 "OMIT_FOREIGN_KEY",
71307 #endif
71308 #ifdef SQLITE_OMIT_GET_TABLE
71309 "OMIT_GET_TABLE",
71310 #endif
71311 #ifdef SQLITE_OMIT_GLOBALRECOVER
71312 "OMIT_GLOBALRECOVER",
71313 #endif
71314 #ifdef SQLITE_OMIT_INCRBLOB
71315 "OMIT_INCRBLOB",
71316 #endif
71317 #ifdef SQLITE_OMIT_INTEGRITY_CHECK
71318 "OMIT_INTEGRITY_CHECK",
71319 #endif
71320 #ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
71321 "OMIT_LIKE_OPTIMIZATION",
71322 #endif
71323 #ifdef SQLITE_OMIT_LOAD_EXTENSION
71324 "OMIT_LOAD_EXTENSION",
71325 #endif
71326 #ifdef SQLITE_OMIT_LOCALTIME
71327 "OMIT_LOCALTIME",
71328 #endif
71329 #ifdef SQLITE_OMIT_LOOKASIDE
71330 "OMIT_LOOKASIDE",
71331 #endif
71332 #ifdef SQLITE_OMIT_MEMORYDB
71333 "OMIT_MEMORYDB",
71334 #endif
71335 #ifdef SQLITE_OMIT_OR_OPTIMIZATION
71336 "OMIT_OR_OPTIMIZATION",
71337 #endif
71338 #ifdef SQLITE_OMIT_PAGER_PRAGMAS
71339 "OMIT_PAGER_PRAGMAS",
71340 #endif
71341 #ifdef SQLITE_OMIT_PRAGMA
71342 "OMIT_PRAGMA",
71343 #endif
71344 #ifdef SQLITE_OMIT_PROGRESS_CALLBACK
71345 "OMIT_PROGRESS_CALLBACK",
71346 #endif
71347 #ifdef SQLITE_OMIT_QUICKBALANCE
71348 "OMIT_QUICKBALANCE",
71349 #endif
71350 #ifdef SQLITE_OMIT_REINDEX
71351 "OMIT_REINDEX",
71352 #endif
71353 #ifdef SQLITE_OMIT_SCHEMA_PRAGMAS
71354 "OMIT_SCHEMA_PRAGMAS",
71355 #endif
71356 #ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
71357 "OMIT_SCHEMA_VERSION_PRAGMAS",
71358 #endif
71359 #ifdef SQLITE_OMIT_SHARED_CACHE
71360 "OMIT_SHARED_CACHE",
71361 #endif
71362 #ifdef SQLITE_OMIT_SUBQUERY
71363 "OMIT_SUBQUERY",
71364 #endif
71365 #ifdef SQLITE_OMIT_TCL_VARIABLE
71366 "OMIT_TCL_VARIABLE",
71367 #endif
71368 #ifdef SQLITE_OMIT_TEMPDB
71369 "OMIT_TEMPDB",
71370 #endif
71371 #ifdef SQLITE_OMIT_TRACE
71372 "OMIT_TRACE",
71373 #endif
71374 #ifdef SQLITE_OMIT_TRIGGER
71375 "OMIT_TRIGGER",
71376 #endif
71377 #ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
71378 "OMIT_TRUNCATE_OPTIMIZATION",
71379 #endif
71380 #ifdef SQLITE_OMIT_UTF16
71381 "OMIT_UTF16",
71382 #endif
71383 #ifdef SQLITE_OMIT_VACUUM
71384 "OMIT_VACUUM",
71385 #endif
71386 #ifdef SQLITE_OMIT_VIEW
71387 "OMIT_VIEW",
71388 #endif
71389 #ifdef SQLITE_OMIT_VIRTUALTABLE
71390 "OMIT_VIRTUALTABLE",
71391 #endif
71392 #ifdef SQLITE_OMIT_WSD
71393 "OMIT_WSD",
71394 #endif
71395 #ifdef SQLITE_OMIT_XFER_OPT
71396 "OMIT_XFER_OPT",
71397 #endif
71398 #ifdef SQLITE_PERFORMANCE_TRACE
71399 "PERFORMANCE_TRACE",
71400 #endif
71401 #ifdef SQLITE_PROXY_DEBUG
71402 "PROXY_DEBUG",
71403 #endif
71404 #ifdef SQLITE_SECURE_DELETE
71405 "SECURE_DELETE",
71406 #endif
71407 #ifdef SQLITE_SMALL_STACK
71408 "SMALL_STACK",
71409 #endif
71410 #ifdef SQLITE_SOUNDEX
71411 "SOUNDEX",
71412 #endif
71413 #ifdef SQLITE_TCL
71414 "TCL",
71415 #endif
71416 #ifdef SQLITE_TEMP_STORE
71417 "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE),
71418 #endif
71419 #ifdef SQLITE_TEST
71420 "TEST",
71421 #endif
71422 #ifdef SQLITE_THREADSAFE
71423 "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE),
71424 #endif
71425 #ifdef SQLITE_USE_ALLOCA
71426 "USE_ALLOCA",
71427 #endif
71428 #ifdef SQLITE_ZERO_MALLOC
71429 "ZERO_MALLOC"
71430 #endif
71431 };
71432
71433 /*
71434 ** Given the name of a compile-time option, return true if that option
71435 ** was used and false if not.
71436 **
71437 ** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
71438 ** is not required for a match.
71439 */
71440 SQLITE_API int sqlite3_compileoption_used(const char *zOptName){
71441 int i, n;
71442 if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
71443 n = sqlite3Strlen30(zOptName);
71444
71445 /* Since ArraySize(azCompileOpt) is normally in single digits, a
71446 ** linear search is adequate. No need for a binary search. */
71447 for(i=0; i<ArraySize(azCompileOpt); i++){
71448 if( (sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0)
71449 && ( (azCompileOpt[i][n]==0) || (azCompileOpt[i][n]=='=') ) ) return 1;
71450 }
71451 return 0;
71452 }
71453
71454 /*
71455 ** Return the N-th compile-time option string. If N is out of range,
71456 ** return a NULL pointer.
71457 */
71458 SQLITE_API const char *sqlite3_compileoption_get(int N){
71459 if( N>=0 && N<ArraySize(azCompileOpt) ){
71460 return azCompileOpt[N];
71461 }
71462 return 0;
71463 }
71464
71465 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
71466
71467 /************** End of ctime.c ***********************************************/
71468 /************** Begin file delete.c ******************************************/
71469 /*
71470 ** 2001 September 15
71471 **
71472 ** The author disclaims copyright to this source code. In place of
@@ -80134,11 +80186,11 @@
80134 *ppStmt = 0;
80135 if( !sqlite3SafetyCheckOk(db) ){
80136 return SQLITE_MISUSE_BKPT;
80137 }
80138 sqlite3_mutex_enter(db->mutex);
80139 zSql8 = sqlite3Utf16to8(db, zSql, nBytes);
80140 if( zSql8 ){
80141 rc = sqlite3LockAndPrepare(db, zSql8, -1, saveSqlFlag, 0, ppStmt, &zTail8);
80142 }
80143
80144 if( zTail8 && pzTail ){
@@ -97459,11 +97511,11 @@
97459 ){
97460 int rc;
97461 char *zFunc8;
97462 sqlite3_mutex_enter(db->mutex);
97463 assert( !db->mallocFailed );
97464 zFunc8 = sqlite3Utf16to8(db, zFunctionName, -1);
97465 rc = sqlite3CreateFunc(db, zFunc8, nArg, eTextRep, p, xFunc, xStep, xFinal);
97466 sqlite3DbFree(db, zFunc8);
97467 rc = sqlite3ApiExit(db, rc);
97468 sqlite3_mutex_leave(db->mutex);
97469 return rc;
@@ -98282,11 +98334,11 @@
98282 ){
98283 int rc = SQLITE_OK;
98284 char *zName8;
98285 sqlite3_mutex_enter(db->mutex);
98286 assert( !db->mallocFailed );
98287 zName8 = sqlite3Utf16to8(db, zName, -1);
98288 if( zName8 ){
98289 rc = createCollation(db, zName8, (u8)enc, SQLITE_COLL_USER, pCtx, xCompare, 0);
98290 sqlite3DbFree(db, zName8);
98291 }
98292 rc = sqlite3ApiExit(db, rc);
@@ -100273,10 +100325,18 @@
100273 p->zDb, p->zName
100274 );
100275 }
100276 return rc;
100277 }
 
 
 
 
 
 
 
 
100278
100279 /*
100280 ** Determine if a table currently exists in the database.
100281 */
100282 static void fts3TableExists(
@@ -100286,14 +100346,21 @@
100286 const char *zName, /* Name of the FTS3 table */
100287 const char *zSuffix, /* Shadow table extension */
100288 u8 *pResult /* Write results here */
100289 ){
100290 int rc = SQLITE_OK;
 
 
100291 if( *pRc ) return;
100292 fts3DbExec(&rc, db, "SELECT 1 FROM %Q.'%q%s'", zDb, zName, zSuffix);
100293 *pResult = (rc==SQLITE_OK) ? 1 : 0;
100294 if( rc!=SQLITE_ERROR ) *pRc = rc;
 
 
 
 
 
100295 }
100296
100297 /*
100298 ** This function is the implementation of both the xConnect and xCreate
100299 ** methods of the FTS3 virtual table.
@@ -100711,11 +100778,16 @@
100711 *piPrev = iVal;
100712 }
100713
100714 /*
100715 ** When this function is called, *ppPoslist is assumed to point to the
100716 ** start of a position-list.
 
 
 
 
 
100717 */
100718 static void fts3PoslistCopy(char **pp, char **ppPoslist){
100719 char *pEnd = *ppPoslist;
100720 char c = 0;
100721
@@ -101702,11 +101774,17 @@
101702 }
101703
101704 rc = sqlite3Fts3ExprParse(p->pTokenizer, p->azColumn, p->nColumn,
101705 iCol, zQuery, -1, &pCsr->pExpr
101706 );
101707 if( rc!=SQLITE_OK ) return rc;
 
 
 
 
 
 
101708
101709 rc = evalFts3Expr(p, pCsr->pExpr, &pCsr->aDoclist, &pCsr->nDoclist, 0);
101710 pCsr->pNextId = pCsr->aDoclist;
101711 pCsr->iPrevId = 0;
101712 }
@@ -101855,11 +101933,13 @@
101855
101856 assert( pCsr );
101857 while( pCsr<pEnd ){
101858 if( pExpr->iCurrent<iDocid ){
101859 fts3PoslistCopy(0, &pCsr);
101860 fts3GetDeltaVarint(&pCsr, &pExpr->iCurrent);
 
 
101861 pExpr->pCurrent = pCsr;
101862 }else{
101863 if( pExpr->iCurrent==iDocid ){
101864 int iThis = 0;
101865 if( iCol<0 ){
@@ -105105,13 +105185,13 @@
105105 /* 3 */ "DELETE FROM %Q.'%q_segments'",
105106 /* 4 */ "DELETE FROM %Q.'%q_segdir'",
105107 /* 5 */ "DELETE FROM %Q.'%q_docsize'",
105108 /* 6 */ "DELETE FROM %Q.'%q_stat'",
105109 /* 7 */ "SELECT * FROM %Q.'%q_content' WHERE rowid=?",
105110 /* 8 */ "SELECT coalesce(max(idx)+1, 0) FROM %Q.'%q_segdir' WHERE level=?",
105111 /* 9 */ "INSERT INTO %Q.'%q_segments'(blockid, block) VALUES(?, ?)",
105112 /* 10 */ "SELECT coalesce(max(blockid)+1, 1) FROM %Q.'%q_segments'",
105113 /* 11 */ "INSERT INTO %Q.'%q_segdir' VALUES(?,?,?,?,?,?)",
105114
105115 /* Return segments in order from oldest to newest.*/
105116 /* 12 */ "SELECT idx, start_block, leaves_end_block, end_block, root "
105117 "FROM %Q.'%q_segdir' WHERE level = ? ORDER BY idx ASC",
@@ -108666,15 +108746,17 @@
108666 char aBuffer[64];
108667 sqlite3_snprintf(sizeof(aBuffer), aBuffer,
108668 "%d %d %d %d ", iCol, pTerm-sCtx.aTerm, iStart, iEnd-iStart
108669 );
108670 rc = fts3StringAppend(&res, aBuffer, -1);
 
 
108671 }
108672 }
108673 }
108674 if( rc==SQLITE_DONE ){
108675 rc = SQLITE_CORRUPT;
108676 }
108677
108678 pMod->xClose(pC);
108679 if( rc!=SQLITE_OK ) goto offsets_out;
108680 }
108681
--- 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.6.23.1. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a one 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% are more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -626,13 +626,13 @@
626 **
627 ** See also: [sqlite3_libversion()],
628 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
629 ** [sqlite_version()] and [sqlite_source_id()].
630 */
631 #define SQLITE_VERSION "3.6.23.1"
632 #define SQLITE_VERSION_NUMBER 3006023
633 #define SQLITE_SOURCE_ID "2010-03-26 22:28:06 b078b588d617e07886ad156e9f54ade6d823568e"
634
635 /*
636 ** CAPI3REF: Run-Time Library Version Numbers
637 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
638 **
@@ -10425,11 +10425,11 @@
10425 SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value*, u8);
10426 SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
10427 void(*)(void*));
10428 SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*);
10429 SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *);
10430 SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8);
10431 #ifdef SQLITE_ENABLE_STAT2
10432 SQLITE_PRIVATE char *sqlite3Utf8to16(sqlite3 *, u8, char *, int, int *);
10433 #endif
10434 SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);
10435 SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
@@ -10866,10 +10866,397 @@
10866 ** the vdbe.c file.
10867 */
10868 SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER;
10869
10870 /************** End of global.c **********************************************/
10871 /************** Begin file ctime.c *******************************************/
10872 /*
10873 ** 2010 February 23
10874 **
10875 ** The author disclaims copyright to this source code. In place of
10876 ** a legal notice, here is a blessing:
10877 **
10878 ** May you do good and not evil.
10879 ** May you find forgiveness for yourself and forgive others.
10880 ** May you share freely, never taking more than you give.
10881 **
10882 *************************************************************************
10883 **
10884 ** This file implements routines used to report what compile-time options
10885 ** SQLite was built with.
10886 */
10887
10888 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
10889
10890
10891 /*
10892 ** An array of names of all compile-time options. This array should
10893 ** be sorted A-Z.
10894 **
10895 ** This array looks large, but in a typical installation actually uses
10896 ** only a handful of compile-time options, so most times this array is usually
10897 ** rather short and uses little memory space.
10898 */
10899 static const char * const azCompileOpt[] = {
10900
10901 /* These macros are provided to "stringify" the value of the define
10902 ** for those options in which the value is meaningful. */
10903 #define CTIMEOPT_VAL_(opt) #opt
10904 #define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)
10905
10906 #ifdef SQLITE_32BIT_ROWID
10907 "32BIT_ROWID",
10908 #endif
10909 #ifdef SQLITE_4_BYTE_ALIGNED_MALLOC
10910 "4_BYTE_ALIGNED_MALLOC",
10911 #endif
10912 #ifdef SQLITE_CASE_SENSITIVE_LIKE
10913 "CASE_SENSITIVE_LIKE",
10914 #endif
10915 #ifdef SQLITE_CHECK_PAGES
10916 "CHECK_PAGES",
10917 #endif
10918 #ifdef SQLITE_COVERAGE_TEST
10919 "COVERAGE_TEST",
10920 #endif
10921 #ifdef SQLITE_DEBUG
10922 "DEBUG",
10923 #endif
10924 #ifdef SQLITE_DEFAULT_LOCKING_MODE
10925 "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),
10926 #endif
10927 #ifdef SQLITE_DISABLE_DIRSYNC
10928 "DISABLE_DIRSYNC",
10929 #endif
10930 #ifdef SQLITE_DISABLE_LFS
10931 "DISABLE_LFS",
10932 #endif
10933 #ifdef SQLITE_ENABLE_ATOMIC_WRITE
10934 "ENABLE_ATOMIC_WRITE",
10935 #endif
10936 #ifdef SQLITE_ENABLE_CEROD
10937 "ENABLE_CEROD",
10938 #endif
10939 #ifdef SQLITE_ENABLE_COLUMN_METADATA
10940 "ENABLE_COLUMN_METADATA",
10941 #endif
10942 #ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
10943 "ENABLE_EXPENSIVE_ASSERT",
10944 #endif
10945 #ifdef SQLITE_ENABLE_FTS1
10946 "ENABLE_FTS1",
10947 #endif
10948 #ifdef SQLITE_ENABLE_FTS2
10949 "ENABLE_FTS2",
10950 #endif
10951 #ifdef SQLITE_ENABLE_FTS3
10952 "ENABLE_FTS3",
10953 #endif
10954 #ifdef SQLITE_ENABLE_FTS3_PARENTHESIS
10955 "ENABLE_FTS3_PARENTHESIS",
10956 #endif
10957 #ifdef SQLITE_ENABLE_FTS4
10958 "ENABLE_FTS4",
10959 #endif
10960 #ifdef SQLITE_ENABLE_ICU
10961 "ENABLE_ICU",
10962 #endif
10963 #ifdef SQLITE_ENABLE_IOTRACE
10964 "ENABLE_IOTRACE",
10965 #endif
10966 #ifdef SQLITE_ENABLE_LOAD_EXTENSION
10967 "ENABLE_LOAD_EXTENSION",
10968 #endif
10969 #ifdef SQLITE_ENABLE_LOCKING_STYLE
10970 "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
10971 #endif
10972 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
10973 "ENABLE_MEMORY_MANAGEMENT",
10974 #endif
10975 #ifdef SQLITE_ENABLE_MEMSYS3
10976 "ENABLE_MEMSYS3",
10977 #endif
10978 #ifdef SQLITE_ENABLE_MEMSYS5
10979 "ENABLE_MEMSYS5",
10980 #endif
10981 #ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK
10982 "ENABLE_OVERSIZE_CELL_CHECK",
10983 #endif
10984 #ifdef SQLITE_ENABLE_RTREE
10985 "ENABLE_RTREE",
10986 #endif
10987 #ifdef SQLITE_ENABLE_STAT2
10988 "ENABLE_STAT2",
10989 #endif
10990 #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
10991 "ENABLE_UNLOCK_NOTIFY",
10992 #endif
10993 #ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
10994 "ENABLE_UPDATE_DELETE_LIMIT",
10995 #endif
10996 #ifdef SQLITE_HAS_CODEC
10997 "HAS_CODEC",
10998 #endif
10999 #ifdef SQLITE_HAVE_ISNAN
11000 "HAVE_ISNAN",
11001 #endif
11002 #ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
11003 "HOMEGROWN_RECURSIVE_MUTEX",
11004 #endif
11005 #ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS
11006 "IGNORE_AFP_LOCK_ERRORS",
11007 #endif
11008 #ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS
11009 "IGNORE_FLOCK_LOCK_ERRORS",
11010 #endif
11011 #ifdef SQLITE_INT64_TYPE
11012 "INT64_TYPE",
11013 #endif
11014 #ifdef SQLITE_LOCK_TRACE
11015 "LOCK_TRACE",
11016 #endif
11017 #ifdef SQLITE_MEMDEBUG
11018 "MEMDEBUG",
11019 #endif
11020 #ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT
11021 "MIXED_ENDIAN_64BIT_FLOAT",
11022 #endif
11023 #ifdef SQLITE_NO_SYNC
11024 "NO_SYNC",
11025 #endif
11026 #ifdef SQLITE_OMIT_ALTERTABLE
11027 "OMIT_ALTERTABLE",
11028 #endif
11029 #ifdef SQLITE_OMIT_ANALYZE
11030 "OMIT_ANALYZE",
11031 #endif
11032 #ifdef SQLITE_OMIT_ATTACH
11033 "OMIT_ATTACH",
11034 #endif
11035 #ifdef SQLITE_OMIT_AUTHORIZATION
11036 "OMIT_AUTHORIZATION",
11037 #endif
11038 #ifdef SQLITE_OMIT_AUTOINCREMENT
11039 "OMIT_AUTOINCREMENT",
11040 #endif
11041 #ifdef SQLITE_OMIT_AUTOINIT
11042 "OMIT_AUTOINIT",
11043 #endif
11044 #ifdef SQLITE_OMIT_AUTOVACUUM
11045 "OMIT_AUTOVACUUM",
11046 #endif
11047 #ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION
11048 "OMIT_BETWEEN_OPTIMIZATION",
11049 #endif
11050 #ifdef SQLITE_OMIT_BLOB_LITERAL
11051 "OMIT_BLOB_LITERAL",
11052 #endif
11053 #ifdef SQLITE_OMIT_BTREECOUNT
11054 "OMIT_BTREECOUNT",
11055 #endif
11056 #ifdef SQLITE_OMIT_BUILTIN_TEST
11057 "OMIT_BUILTIN_TEST",
11058 #endif
11059 #ifdef SQLITE_OMIT_CAST
11060 "OMIT_CAST",
11061 #endif
11062 #ifdef SQLITE_OMIT_CHECK
11063 "OMIT_CHECK",
11064 #endif
11065 #ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS
11066 "OMIT_COMPILEOPTION_DIAGS",
11067 #endif
11068 #ifdef SQLITE_OMIT_COMPLETE
11069 "OMIT_COMPLETE",
11070 #endif
11071 #ifdef SQLITE_OMIT_COMPOUND_SELECT
11072 "OMIT_COMPOUND_SELECT",
11073 #endif
11074 #ifdef SQLITE_OMIT_DATETIME_FUNCS
11075 "OMIT_DATETIME_FUNCS",
11076 #endif
11077 #ifdef SQLITE_OMIT_DECLTYPE
11078 "OMIT_DECLTYPE",
11079 #endif
11080 #ifdef SQLITE_OMIT_DEPRECATED
11081 "OMIT_DEPRECATED",
11082 #endif
11083 #ifdef SQLITE_OMIT_DISKIO
11084 "OMIT_DISKIO",
11085 #endif
11086 #ifdef SQLITE_OMIT_EXPLAIN
11087 "OMIT_EXPLAIN",
11088 #endif
11089 #ifdef SQLITE_OMIT_FLAG_PRAGMAS
11090 "OMIT_FLAG_PRAGMAS",
11091 #endif
11092 #ifdef SQLITE_OMIT_FLOATING_POINT
11093 "OMIT_FLOATING_POINT",
11094 #endif
11095 #ifdef SQLITE_OMIT_FOREIGN_KEY
11096 "OMIT_FOREIGN_KEY",
11097 #endif
11098 #ifdef SQLITE_OMIT_GET_TABLE
11099 "OMIT_GET_TABLE",
11100 #endif
11101 #ifdef SQLITE_OMIT_GLOBALRECOVER
11102 "OMIT_GLOBALRECOVER",
11103 #endif
11104 #ifdef SQLITE_OMIT_INCRBLOB
11105 "OMIT_INCRBLOB",
11106 #endif
11107 #ifdef SQLITE_OMIT_INTEGRITY_CHECK
11108 "OMIT_INTEGRITY_CHECK",
11109 #endif
11110 #ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
11111 "OMIT_LIKE_OPTIMIZATION",
11112 #endif
11113 #ifdef SQLITE_OMIT_LOAD_EXTENSION
11114 "OMIT_LOAD_EXTENSION",
11115 #endif
11116 #ifdef SQLITE_OMIT_LOCALTIME
11117 "OMIT_LOCALTIME",
11118 #endif
11119 #ifdef SQLITE_OMIT_LOOKASIDE
11120 "OMIT_LOOKASIDE",
11121 #endif
11122 #ifdef SQLITE_OMIT_MEMORYDB
11123 "OMIT_MEMORYDB",
11124 #endif
11125 #ifdef SQLITE_OMIT_OR_OPTIMIZATION
11126 "OMIT_OR_OPTIMIZATION",
11127 #endif
11128 #ifdef SQLITE_OMIT_PAGER_PRAGMAS
11129 "OMIT_PAGER_PRAGMAS",
11130 #endif
11131 #ifdef SQLITE_OMIT_PRAGMA
11132 "OMIT_PRAGMA",
11133 #endif
11134 #ifdef SQLITE_OMIT_PROGRESS_CALLBACK
11135 "OMIT_PROGRESS_CALLBACK",
11136 #endif
11137 #ifdef SQLITE_OMIT_QUICKBALANCE
11138 "OMIT_QUICKBALANCE",
11139 #endif
11140 #ifdef SQLITE_OMIT_REINDEX
11141 "OMIT_REINDEX",
11142 #endif
11143 #ifdef SQLITE_OMIT_SCHEMA_PRAGMAS
11144 "OMIT_SCHEMA_PRAGMAS",
11145 #endif
11146 #ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
11147 "OMIT_SCHEMA_VERSION_PRAGMAS",
11148 #endif
11149 #ifdef SQLITE_OMIT_SHARED_CACHE
11150 "OMIT_SHARED_CACHE",
11151 #endif
11152 #ifdef SQLITE_OMIT_SUBQUERY
11153 "OMIT_SUBQUERY",
11154 #endif
11155 #ifdef SQLITE_OMIT_TCL_VARIABLE
11156 "OMIT_TCL_VARIABLE",
11157 #endif
11158 #ifdef SQLITE_OMIT_TEMPDB
11159 "OMIT_TEMPDB",
11160 #endif
11161 #ifdef SQLITE_OMIT_TRACE
11162 "OMIT_TRACE",
11163 #endif
11164 #ifdef SQLITE_OMIT_TRIGGER
11165 "OMIT_TRIGGER",
11166 #endif
11167 #ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
11168 "OMIT_TRUNCATE_OPTIMIZATION",
11169 #endif
11170 #ifdef SQLITE_OMIT_UTF16
11171 "OMIT_UTF16",
11172 #endif
11173 #ifdef SQLITE_OMIT_VACUUM
11174 "OMIT_VACUUM",
11175 #endif
11176 #ifdef SQLITE_OMIT_VIEW
11177 "OMIT_VIEW",
11178 #endif
11179 #ifdef SQLITE_OMIT_VIRTUALTABLE
11180 "OMIT_VIRTUALTABLE",
11181 #endif
11182 #ifdef SQLITE_OMIT_WSD
11183 "OMIT_WSD",
11184 #endif
11185 #ifdef SQLITE_OMIT_XFER_OPT
11186 "OMIT_XFER_OPT",
11187 #endif
11188 #ifdef SQLITE_PERFORMANCE_TRACE
11189 "PERFORMANCE_TRACE",
11190 #endif
11191 #ifdef SQLITE_PROXY_DEBUG
11192 "PROXY_DEBUG",
11193 #endif
11194 #ifdef SQLITE_SECURE_DELETE
11195 "SECURE_DELETE",
11196 #endif
11197 #ifdef SQLITE_SMALL_STACK
11198 "SMALL_STACK",
11199 #endif
11200 #ifdef SQLITE_SOUNDEX
11201 "SOUNDEX",
11202 #endif
11203 #ifdef SQLITE_TCL
11204 "TCL",
11205 #endif
11206 #ifdef SQLITE_TEMP_STORE
11207 "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE),
11208 #endif
11209 #ifdef SQLITE_TEST
11210 "TEST",
11211 #endif
11212 #ifdef SQLITE_THREADSAFE
11213 "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE),
11214 #endif
11215 #ifdef SQLITE_USE_ALLOCA
11216 "USE_ALLOCA",
11217 #endif
11218 #ifdef SQLITE_ZERO_MALLOC
11219 "ZERO_MALLOC"
11220 #endif
11221 };
11222
11223 /*
11224 ** Given the name of a compile-time option, return true if that option
11225 ** was used and false if not.
11226 **
11227 ** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
11228 ** is not required for a match.
11229 */
11230 SQLITE_API int sqlite3_compileoption_used(const char *zOptName){
11231 int i, n;
11232 if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
11233 n = sqlite3Strlen30(zOptName);
11234
11235 /* Since ArraySize(azCompileOpt) is normally in single digits, a
11236 ** linear search is adequate. No need for a binary search. */
11237 for(i=0; i<ArraySize(azCompileOpt); i++){
11238 if( (sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0)
11239 && ( (azCompileOpt[i][n]==0) || (azCompileOpt[i][n]=='=') ) ) return 1;
11240 }
11241 return 0;
11242 }
11243
11244 /*
11245 ** Return the N-th compile-time option string. If N is out of range,
11246 ** return a NULL pointer.
11247 */
11248 SQLITE_API const char *sqlite3_compileoption_get(int N){
11249 if( N>=0 && N<ArraySize(azCompileOpt) ){
11250 return azCompileOpt[N];
11251 }
11252 return 0;
11253 }
11254
11255 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
11256
11257 /************** End of ctime.c ***********************************************/
11258 /************** Begin file status.c ******************************************/
11259 /*
11260 ** 2008 June 18
11261 **
11262 ** The author disclaims copyright to this source code. In place of
@@ -12996,11 +13383,12 @@
13383 */
13384 static void sqlite3MemFree(void *pPrior){
13385 struct MemBlockHdr *pHdr;
13386 void **pBt;
13387 char *z;
13388 assert( sqlite3GlobalConfig.bMemstat || sqlite3GlobalConfig.bCoreMutex==0
13389 || mem.mutex!=0 );
13390 pHdr = sqlite3MemsysGetHeader(pPrior);
13391 pBt = (void**)pHdr;
13392 pBt -= pHdr->nBacktraceSlots;
13393 sqlite3_mutex_enter(mem.mutex);
13394 if( pHdr->pPrev ){
@@ -15623,11 +16011,13 @@
16011 printf("enter mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef);
16012 }
16013 #endif
16014 }
16015 static int winMutexTry(sqlite3_mutex *p){
16016 #ifndef NDEBUG
16017 DWORD tid = GetCurrentThreadId();
16018 #endif
16019 int rc = SQLITE_BUSY;
16020 assert( p->id==SQLITE_MUTEX_RECURSIVE || winMutexNotheld2(p, tid) );
16021 /*
16022 ** The sqlite3_mutex_try() routine is very rarely used, and when it
16023 ** is used it is merely an optimization. So it is OK for it to always
@@ -15661,11 +16051,13 @@
16051 ** previously entered by the same thread. The behavior
16052 ** is undefined if the mutex is not currently entered or
16053 ** is not currently allocated. SQLite will never do either.
16054 */
16055 static void winMutexLeave(sqlite3_mutex *p){
16056 #ifndef NDEBUG
16057 DWORD tid = GetCurrentThreadId();
16058 #endif
16059 assert( p->nRef>0 );
16060 assert( p->owner==tid );
16061 p->nRef--;
16062 assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );
16063 LeaveCriticalSection(&p->mutex);
@@ -18422,23 +18814,25 @@
18814 ** Memory to hold the UTF-8 string is obtained from sqlite3_malloc and must
18815 ** be freed by the calling function.
18816 **
18817 ** NULL is returned if there is an allocation error.
18818 */
18819 SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *db, const void *z, int nByte, u8 enc){
18820 Mem m;
18821 memset(&m, 0, sizeof(m));
18822 m.db = db;
18823 sqlite3VdbeMemSetStr(&m, z, nByte, enc, SQLITE_STATIC);
18824 sqlite3VdbeChangeEncoding(&m, SQLITE_UTF8);
18825 if( db->mallocFailed ){
18826 sqlite3VdbeMemRelease(&m);
18827 m.z = 0;
18828 }
18829 assert( (m.flags & MEM_Term)!=0 || db->mallocFailed );
18830 assert( (m.flags & MEM_Str)!=0 || db->mallocFailed );
18831 assert( (m.flags & MEM_Dyn)!=0 || db->mallocFailed );
18832 assert( m.z || db->mallocFailed );
18833 return m.z;
18834 }
18835
18836 /*
18837 ** Convert a UTF-8 string to the UTF-16 encoding specified by parameter
18838 ** enc. A pointer to the new string is returned, and the value of *pnOut
@@ -19236,11 +19630,11 @@
19630 return 2;
19631 }
19632
19633 /* Verify that constants are precomputed correctly */
19634 assert( SLOT_2_0 == ((0x7f<<14) | (0x7f)) );
19635 assert( SLOT_4_2_0 == ((0xfU<<28) | (0x7f<<14) | (0x7f)) );
19636
19637 p++;
19638 a = a<<14;
19639 a |= *p;
19640 /* a: p0<<14 | p2 (unmasked) */
@@ -33815,10 +34209,13 @@
34209 if( rc==SQLITE_OK ){
34210 zMaster = pPager->pTmpSpace;
34211 rc = readMasterJournal(pPager->jfd, zMaster, pPager->pVfs->mxPathname+1);
34212 testcase( rc!=SQLITE_OK );
34213 }
34214 if( rc==SQLITE_OK && pPager->noSync==0 && pPager->state>=PAGER_EXCLUSIVE ){
34215 rc = sqlite3OsSync(pPager->fd, pPager->sync_flags);
34216 }
34217 if( rc==SQLITE_OK ){
34218 rc = pager_end_transaction(pPager, zMaster[0]!='\0');
34219 testcase( rc!=SQLITE_OK );
34220 }
34221 if( rc==SQLITE_OK && zMaster[0] && res ){
@@ -35135,10 +35532,11 @@
35532 }
35533 /* pPager->xBusyHandler = 0; */
35534 /* pPager->pBusyHandlerArg = 0; */
35535 pPager->xReiniter = xReinit;
35536 /* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */
35537
35538 *ppPager = pPager;
35539 return SQLITE_OK;
35540 }
35541
35542
@@ -35284,12 +35682,28 @@
35682 rc = sqlite3OsRead(pPager->fd, pPg->pData, pPager->pageSize, iOffset);
35683 if( rc==SQLITE_IOERR_SHORT_READ ){
35684 rc = SQLITE_OK;
35685 }
35686 if( pgno==1 ){
35687 if( rc ){
35688 /* If the read is unsuccessful, set the dbFileVers[] to something
35689 ** that will never be a valid file version. dbFileVers[] is a copy
35690 ** of bytes 24..39 of the database. Bytes 28..31 should always be
35691 ** zero. Bytes 32..35 and 35..39 should be page numbers which are
35692 ** never 0xffffffff. So filling pPager->dbFileVers[] with all 0xff
35693 ** bytes should suffice.
35694 **
35695 ** For an encrypted database, the situation is more complex: bytes
35696 ** 24..39 of the database are white noise. But the probability of
35697 ** white noising equaling 16 bytes of 0xff is vanishingly small so
35698 ** we should still be ok.
35699 */
35700 memset(pPager->dbFileVers, 0xff, sizeof(pPager->dbFileVers));
35701 }else{
35702 u8 *dbFileVers = &((u8*)pPg->pData)[24];
35703 memcpy(&pPager->dbFileVers, dbFileVers, sizeof(pPager->dbFileVers));
35704 }
35705 }
35706 CODEC1(pPager, pPg->pData, pgno, 3, rc = SQLITE_NOMEM);
35707
35708 PAGER_INCR(sqlite3_pager_readdb_count);
35709 PAGER_INCR(pPager->nRead);
@@ -36786,10 +37200,11 @@
37200 if( op==SAVEPOINT_RELEASE ){
37201 if( nNew==0 && isOpen(pPager->sjfd) ){
37202 /* Only truncate if it is an in-memory sub-journal. */
37203 if( sqlite3IsMemJournal(pPager->sjfd) ){
37204 rc = sqlite3OsTruncate(pPager->sjfd, 0);
37205 assert( rc==SQLITE_OK );
37206 }
37207 pPager->nSubRec = 0;
37208 }
37209 }
37210 /* Else this is a rollback operation, playback the specified savepoint.
@@ -43199,11 +43614,11 @@
43614 if( nOvfl ){
43615 rc = getOverflowPage(pBt, ovflPgno, &pOvfl, &iNext);
43616 if( rc ) return rc;
43617 }
43618
43619 if( ( pOvfl || ((pOvfl = btreePageLookup(pBt, ovflPgno))!=0) )
43620 && sqlite3PagerPageRefcount(pOvfl->pDbPage)!=1
43621 ){
43622 /* There is no reason any cursor should have an outstanding reference
43623 ** to an overflow page belonging to a cell that is being deleted/updated.
43624 ** So if there exists more than one reference to this page, then it
@@ -43952,11 +44367,11 @@
44367 ** the dropCell() routine will overwrite the entire cell with zeroes.
44368 ** In this case, temporarily copy the cell into the aOvflSpace[]
44369 ** buffer. It will be copied out again as soon as the aSpace[] buffer
44370 ** is allocated. */
44371 if( pBt->secureDelete ){
44372 int iOff = SQLITE_PTR_TO_INT(apDiv[i]) - SQLITE_PTR_TO_INT(pParent->aData);
44373 if( (iOff+szNew[i])>pBt->usableSize ){
44374 rc = SQLITE_CORRUPT_BKPT;
44375 memset(apOld, 0, (i+1)*sizeof(MemPage*));
44376 goto balance_cleanup;
44377 }else{
@@ -47321,11 +47736,11 @@
47736 SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){
47737 assert( (pFrom->flags & MEM_RowSet)==0 );
47738 sqlite3VdbeMemReleaseExternal(pTo);
47739 memcpy(pTo, pFrom, MEMCELLSIZE);
47740 pTo->xDel = 0;
47741 if( (pFrom->flags&MEM_Static)==0 ){
47742 pTo->flags &= ~(MEM_Dyn|MEM_Static|MEM_Ephem);
47743 assert( srcType==MEM_Ephem || srcType==MEM_Static );
47744 pTo->flags |= srcType;
47745 }
47746 }
@@ -49953,16 +50368,21 @@
50368 }
50369
50370 /* If eStatementOp is non-zero, then a statement transaction needs to
50371 ** be committed or rolled back. Call sqlite3VdbeCloseStatement() to
50372 ** do so. If this operation returns an error, and the current statement
50373 ** error code is SQLITE_OK or SQLITE_CONSTRAINT, then promote the
50374 ** current statement error code.
50375 **
50376 ** Note that sqlite3VdbeCloseStatement() can only fail if eStatementOp
50377 ** is SAVEPOINT_ROLLBACK. But if p->rc==SQLITE_OK then eStatementOp
50378 ** must be SAVEPOINT_RELEASE. Hence the NEVER(p->rc==SQLITE_OK) in
50379 ** the following code.
50380 */
50381 if( eStatementOp ){
50382 rc = sqlite3VdbeCloseStatement(p, eStatementOp);
50383 if( rc && (NEVER(p->rc==SQLITE_OK) || p->rc==SQLITE_CONSTRAINT) ){
50384 p->rc = rc;
50385 sqlite3DbFree(db, p->zErrMsg);
50386 p->zErrMsg = 0;
50387 }
50388 }
@@ -52577,21 +52997,34 @@
52997 ** look like a number, leave it alone.
52998 */
52999 static void applyNumericAffinity(Mem *pRec){
53000 if( (pRec->flags & (MEM_Real|MEM_Int))==0 ){
53001 int realnum;
53002 u8 enc = pRec->enc;
53003 sqlite3VdbeMemNulTerminate(pRec);
53004 if( (pRec->flags&MEM_Str) && sqlite3IsNumber(pRec->z, &realnum, enc) ){
 
53005 i64 value;
53006 char *zUtf8 = pRec->z;
53007 #ifndef SQLITE_OMIT_UTF16
53008 if( enc!=SQLITE_UTF8 ){
53009 assert( pRec->db );
53010 zUtf8 = sqlite3Utf16to8(pRec->db, pRec->z, pRec->n, enc);
53011 if( !zUtf8 ) return;
53012 }
53013 #endif
53014 if( !realnum && sqlite3Atoi64(zUtf8, &value) ){
53015 pRec->u.i = value;
53016 MemSetTypeFlag(pRec, MEM_Int);
53017 }else{
53018 sqlite3AtoF(zUtf8, &pRec->r);
53019 MemSetTypeFlag(pRec, MEM_Real);
53020 }
53021 #ifndef SQLITE_OMIT_UTF16
53022 if( enc!=SQLITE_UTF8 ){
53023 sqlite3DbFree(pRec->db, zUtf8);
53024 }
53025 #endif
53026 }
53027 }
53028 }
53029
53030 /*
@@ -53039,10 +53472,12 @@
53472 i64 b;
53473 } ah;
53474 struct OP_Ge_stack_vars {
53475 int res; /* Result of the comparison of pIn1 against pIn3 */
53476 char affinity; /* Affinity to use for comparison */
53477 u16 flags1; /* Copy of initial value of pIn1->flags */
53478 u16 flags3; /* Copy of initial value of pIn3->flags */
53479 } ai;
53480 struct OP_Compare_stack_vars {
53481 int n;
53482 int i;
53483 int p1;
@@ -54573,14 +55008,18 @@
55008 case OP_Gt: /* same as TK_GT, jump, in1, in3 */
55009 case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
55010 #if 0 /* local variables moved into u.ai */
55011 int res; /* Result of the comparison of pIn1 against pIn3 */
55012 char affinity; /* Affinity to use for comparison */
55013 u16 flags1; /* Copy of initial value of pIn1->flags */
55014 u16 flags3; /* Copy of initial value of pIn3->flags */
55015 #endif /* local variables moved into u.ai */
55016
55017 pIn1 = &aMem[pOp->p1];
55018 pIn3 = &aMem[pOp->p3];
55019 u.ai.flags1 = pIn1->flags;
55020 u.ai.flags3 = pIn3->flags;
55021 if( (pIn1->flags | pIn3->flags)&MEM_Null ){
55022 /* One or both operands are NULL */
55023 if( pOp->p5 & SQLITE_NULLEQ ){
55024 /* If SQLITE_NULLEQ is set (which will only happen if the operator is
55025 ** OP_Eq or OP_Ne) then take the jump or not depending on whether
@@ -54631,10 +55070,14 @@
55070 pOut->u.i = u.ai.res;
55071 REGISTER_TRACE(pOp->p2, pOut);
55072 }else if( u.ai.res ){
55073 pc = pOp->p2-1;
55074 }
55075
55076 /* Undo any changes made by applyAffinity() to the input registers. */
55077 pIn1->flags = (pIn1->flags&~MEM_TypeMask) | (u.ai.flags1&MEM_TypeMask);
55078 pIn3->flags = (pIn3->flags&~MEM_TypeMask) | (u.ai.flags3&MEM_TypeMask);
55079 break;
55080 }
55081
55082 /* Opcode: Permutation * * * P4 *
55083 **
@@ -61176,14 +61619,10 @@
61619 p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight);
61620 p5 = binaryCompareP5(pLeft, pRight, jumpIfNull);
61621 addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1,
61622 (void*)p4, P4_COLLSEQ);
61623 sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5);
 
 
 
 
61624 return addr;
61625 }
61626
61627 #if SQLITE_MAX_EXPR_DEPTH>0
61628 /*
@@ -71076,397 +71515,10 @@
71515 }
71516 return p;
71517 }
71518
71519 /************** End of callback.c ********************************************/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71520 /************** Begin file delete.c ******************************************/
71521 /*
71522 ** 2001 September 15
71523 **
71524 ** The author disclaims copyright to this source code. In place of
@@ -80134,11 +80186,11 @@
80186 *ppStmt = 0;
80187 if( !sqlite3SafetyCheckOk(db) ){
80188 return SQLITE_MISUSE_BKPT;
80189 }
80190 sqlite3_mutex_enter(db->mutex);
80191 zSql8 = sqlite3Utf16to8(db, zSql, nBytes, SQLITE_UTF16NATIVE);
80192 if( zSql8 ){
80193 rc = sqlite3LockAndPrepare(db, zSql8, -1, saveSqlFlag, 0, ppStmt, &zTail8);
80194 }
80195
80196 if( zTail8 && pzTail ){
@@ -97459,11 +97511,11 @@
97511 ){
97512 int rc;
97513 char *zFunc8;
97514 sqlite3_mutex_enter(db->mutex);
97515 assert( !db->mallocFailed );
97516 zFunc8 = sqlite3Utf16to8(db, zFunctionName, -1, SQLITE_UTF16NATIVE);
97517 rc = sqlite3CreateFunc(db, zFunc8, nArg, eTextRep, p, xFunc, xStep, xFinal);
97518 sqlite3DbFree(db, zFunc8);
97519 rc = sqlite3ApiExit(db, rc);
97520 sqlite3_mutex_leave(db->mutex);
97521 return rc;
@@ -98282,11 +98334,11 @@
98334 ){
98335 int rc = SQLITE_OK;
98336 char *zName8;
98337 sqlite3_mutex_enter(db->mutex);
98338 assert( !db->mallocFailed );
98339 zName8 = sqlite3Utf16to8(db, zName, -1, SQLITE_UTF16NATIVE);
98340 if( zName8 ){
98341 rc = createCollation(db, zName8, (u8)enc, SQLITE_COLL_USER, pCtx, xCompare, 0);
98342 sqlite3DbFree(db, zName8);
98343 }
98344 rc = sqlite3ApiExit(db, rc);
@@ -100273,10 +100325,18 @@
100325 p->zDb, p->zName
100326 );
100327 }
100328 return rc;
100329 }
100330
100331 /*
100332 ** An sqlite3_exec() callback for fts3TableExists.
100333 */
100334 static int fts3TableExistsCallback(void *pArg, int n, char **pp1, char **pp2){
100335 *(int*)pArg = 1;
100336 return 1;
100337 }
100338
100339 /*
100340 ** Determine if a table currently exists in the database.
100341 */
100342 static void fts3TableExists(
@@ -100286,14 +100346,21 @@
100346 const char *zName, /* Name of the FTS3 table */
100347 const char *zSuffix, /* Shadow table extension */
100348 u8 *pResult /* Write results here */
100349 ){
100350 int rc = SQLITE_OK;
100351 int res = 0;
100352 char *zSql;
100353 if( *pRc ) return;
100354 zSql = sqlite3_mprintf(
100355 "SELECT 1 FROM %Q.sqlite_master WHERE name='%q%s'",
100356 zDb, zName, zSuffix
100357 );
100358 rc = sqlite3_exec(db, zSql, fts3TableExistsCallback, &res, 0);
100359 sqlite3_free(zSql);
100360 *pResult = res & 0xff;
100361 if( rc!=SQLITE_ABORT ) *pRc = rc;
100362 }
100363
100364 /*
100365 ** This function is the implementation of both the xConnect and xCreate
100366 ** methods of the FTS3 virtual table.
@@ -100711,11 +100778,16 @@
100778 *piPrev = iVal;
100779 }
100780
100781 /*
100782 ** When this function is called, *ppPoslist is assumed to point to the
100783 ** start of a position-list. After it returns, *ppPoslist points to the
100784 ** first byte after the position-list.
100785 **
100786 ** If pp is not NULL, then the contents of the position list are copied
100787 ** to *pp. *pp is set to point to the first byte past the last byte copied
100788 ** before this function returns.
100789 */
100790 static void fts3PoslistCopy(char **pp, char **ppPoslist){
100791 char *pEnd = *ppPoslist;
100792 char c = 0;
100793
@@ -101702,11 +101774,17 @@
101774 }
101775
101776 rc = sqlite3Fts3ExprParse(p->pTokenizer, p->azColumn, p->nColumn,
101777 iCol, zQuery, -1, &pCsr->pExpr
101778 );
101779 if( rc!=SQLITE_OK ){
101780 if( rc==SQLITE_ERROR ){
101781 p->base.zErrMsg = sqlite3_mprintf("malformed MATCH expression: [%s]",
101782 zQuery);
101783 }
101784 return rc;
101785 }
101786
101787 rc = evalFts3Expr(p, pCsr->pExpr, &pCsr->aDoclist, &pCsr->nDoclist, 0);
101788 pCsr->pNextId = pCsr->aDoclist;
101789 pCsr->iPrevId = 0;
101790 }
@@ -101855,11 +101933,13 @@
101933
101934 assert( pCsr );
101935 while( pCsr<pEnd ){
101936 if( pExpr->iCurrent<iDocid ){
101937 fts3PoslistCopy(0, &pCsr);
101938 if( pCsr<pEnd ){
101939 fts3GetDeltaVarint(&pCsr, &pExpr->iCurrent);
101940 }
101941 pExpr->pCurrent = pCsr;
101942 }else{
101943 if( pExpr->iCurrent==iDocid ){
101944 int iThis = 0;
101945 if( iCol<0 ){
@@ -105105,13 +105185,13 @@
105185 /* 3 */ "DELETE FROM %Q.'%q_segments'",
105186 /* 4 */ "DELETE FROM %Q.'%q_segdir'",
105187 /* 5 */ "DELETE FROM %Q.'%q_docsize'",
105188 /* 6 */ "DELETE FROM %Q.'%q_stat'",
105189 /* 7 */ "SELECT * FROM %Q.'%q_content' WHERE rowid=?",
105190 /* 8 */ "SELECT (SELECT max(idx) FROM %Q.'%q_segdir' WHERE level = ?) + 1",
105191 /* 9 */ "INSERT INTO %Q.'%q_segments'(blockid, block) VALUES(?, ?)",
105192 /* 10 */ "SELECT coalesce((SELECT max(blockid) FROM %Q.'%q_segments') + 1, 1)",
105193 /* 11 */ "INSERT INTO %Q.'%q_segdir' VALUES(?,?,?,?,?,?)",
105194
105195 /* Return segments in order from oldest to newest.*/
105196 /* 12 */ "SELECT idx, start_block, leaves_end_block, end_block, root "
105197 "FROM %Q.'%q_segdir' WHERE level = ? ORDER BY idx ASC",
@@ -108666,15 +108746,17 @@
108746 char aBuffer[64];
108747 sqlite3_snprintf(sizeof(aBuffer), aBuffer,
108748 "%d %d %d %d ", iCol, pTerm-sCtx.aTerm, iStart, iEnd-iStart
108749 );
108750 rc = fts3StringAppend(&res, aBuffer, -1);
108751 }else if( rc==SQLITE_DONE ){
108752 rc = SQLITE_CORRUPT;
108753 }
108754 }
108755 }
108756 if( rc==SQLITE_DONE ){
108757 rc = SQLITE_OK;
108758 }
108759
108760 pMod->xClose(pC);
108761 if( rc!=SQLITE_OK ) goto offsets_out;
108762 }
108763
+2 -2
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -105,13 +105,13 @@
105105
**
106106
** See also: [sqlite3_libversion()],
107107
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108108
** [sqlite_version()] and [sqlite_source_id()].
109109
*/
110
-#define SQLITE_VERSION "3.6.23"
110
+#define SQLITE_VERSION "3.6.23.1"
111111
#define SQLITE_VERSION_NUMBER 3006023
112
-#define SQLITE_SOURCE_ID "2010-03-05 13:53:23 27413fc8dd52b754b4be9344a66bb9e0d752d48e"
112
+#define SQLITE_SOURCE_ID "2010-03-26 22:28:06 b078b588d617e07886ad156e9f54ade6d823568e"
113113
114114
/*
115115
** CAPI3REF: Run-Time Library Version Numbers
116116
** KEYWORDS: sqlite3_version, sqlite3_sourceid
117117
**
118118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -105,13 +105,13 @@
105 **
106 ** See also: [sqlite3_libversion()],
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.6.23"
111 #define SQLITE_VERSION_NUMBER 3006023
112 #define SQLITE_SOURCE_ID "2010-03-05 13:53:23 27413fc8dd52b754b4be9344a66bb9e0d752d48e"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -105,13 +105,13 @@
105 **
106 ** See also: [sqlite3_libversion()],
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.6.23.1"
111 #define SQLITE_VERSION_NUMBER 3006023
112 #define SQLITE_SOURCE_ID "2010-03-26 22:28:06 b078b588d617e07886ad156e9f54ade6d823568e"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118

Keyboard Shortcuts

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