Fossil SCM

Update SQLite to pre-3.6.23 that leaves SQLITE_ENABLE_LOCKING_STYLE turned off by default. This should help it to build correctly on Tiger. Ticket [8b3c5d30f7e6]

drh 2010-03-04 22:39 UTC trunk
Commit 73223b8bd62bab67360fdf8e16dc82d216fd5ab7
2 files changed +121 -82 +12 -6
+121 -82
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -313,41 +313,38 @@
313313
** and with SQLITE_ENABLE_STAT2
314314
*/
315315
#define SQLITE_INDEX_SAMPLES 10
316316
317317
/*
318
-** This macro is used to "hide" some ugliness in casting an int
319
-** value to a ptr value under the MSVC 64-bit compiler. Casting
320
-** non 64-bit values to ptr types results in a "hard" error with
321
-** the MSVC 64-bit compiler which this attempts to avoid.
322
-**
323
-** A simple compiler pragma or casting sequence could not be found
324
-** to correct this in all situations, so this macro was introduced.
325
-**
326
-** It could be argued that the intptr_t type could be used in this
327
-** case, but that type is not available on all compilers, or
328
-** requires the #include of specific headers which differs between
329
-** platforms.
318
+** The following macros are used to cast pointers to integers and
319
+** integers to pointers. The way you do this varies from one compiler
320
+** to the next, so we have developed the following set of #if statements
321
+** to generate appropriate macros for a wide range of compilers.
322
+**
323
+** The correct "ANSI" way to do this is to use the intptr_t type.
324
+** Unfortunately, that typedef is not available on all compilers, or
325
+** if it is available, it requires an #include of specific headers
326
+** that very from one machine to the next.
330327
**
331328
** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on
332329
** the ((void*)&((char*)0)[X]) construct. But MSVC chokes on ((void*)(X)).
333330
** So we have to define the macros in different ways depending on the
334331
** compiler.
335332
*/
336
-#if defined(__GNUC__)
337
-# if defined(HAVE_STDINT_H)
338
-# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X))
339
-# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X))
340
-# else
341
-# define SQLITE_INT_TO_PTR(X) ((void*)(X))
342
-# define SQLITE_PTR_TO_INT(X) ((int)(X))
343
-# endif
344
-#else
345
-# define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X])
346
-# define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0))
333
+#if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */
334
+# define SQLITE_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X))
335
+# define SQLITE_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X))
336
+#elif !defined(__GNUC__) /* Works for compilers other than LLVM */
337
+# define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X])
338
+# define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0))
339
+#elif defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */
340
+# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X))
341
+# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X))
342
+#else /* Generates a warning - but it always works */
343
+# define SQLITE_INT_TO_PTR(X) ((void*)(X))
344
+# define SQLITE_PTR_TO_INT(X) ((int)(X))
347345
#endif
348
-
349346
350347
/*
351348
** The SQLITE_THREADSAFE macro must be defined as either 0 or 1.
352349
** Older versions of SQLite used an optional THREADSAFE macro.
353350
** We support that for legacy
@@ -631,11 +628,11 @@
631628
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
632629
** [sqlite_version()] and [sqlite_source_id()].
633630
*/
634631
#define SQLITE_VERSION "3.6.23"
635632
#define SQLITE_VERSION_NUMBER 3006023
636
-#define SQLITE_SOURCE_ID "2010-02-26 13:07:37 8f29490da62df07ea922b03cab52b6edd2669edb"
633
+#define SQLITE_SOURCE_ID "2010-03-04 22:36:45 1a0fa8d19d69d4ecaaaa879ac3c893980375fcc6"
637634
638635
/*
639636
** CAPI3REF: Run-Time Library Version Numbers
640637
** KEYWORDS: sqlite3_version, sqlite3_sourceid
641638
**
@@ -668,13 +665,13 @@
668665
SQLITE_API const char sqlite3_version[] = SQLITE_VERSION;
669666
SQLITE_API const char *sqlite3_libversion(void);
670667
SQLITE_API const char *sqlite3_sourceid(void);
671668
SQLITE_API int sqlite3_libversion_number(void);
672669
670
+#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
673671
/*
674672
** CAPI3REF: Run-Time Library Compilation Options Diagnostics
675
-** KEYWORDS: sqlite3_compileoption_used, sqlite3_compileoption_get
676673
**
677674
** ^The sqlite3_compileoption_used() function returns 0 or 1
678675
** indicating whether the specified option was defined at
679676
** compile time. ^The SQLITE_ prefix may be omitted from the
680677
** option name passed to sqlite3_compileoption_used().
@@ -686,15 +683,15 @@
686683
** prefix is omitted from any strings returned by
687684
** sqlite3_compileoption_get().
688685
**
689686
** ^Support for the diagnostic functions sqlite3_compileoption_used()
690687
** and sqlite3_compileoption_get() may be omitted by specifing the
691
-** SQLITE_OMIT_COMPILEOPTION_DIAGS option at compile time.
688
+** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time.
692689
**
693
-** See also: [sqlite_compile_option_used()] and [sqlite_compile_option_get()].
690
+** See also: SQL functions [sqlite_compileoption_used()] and
691
+** [sqlite_compileoption_get()] and the [compile_options pragma].
694692
*/
695
-#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
696693
SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
697694
SQLITE_API const char *sqlite3_compileoption_get(int N);
698695
#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
699696
700697
/*
@@ -6222,20 +6219,26 @@
62226219
/*
62236220
** CAPI3REF: Error Logging Interface
62246221
** EXPERIMENTAL
62256222
**
62266223
** ^The [sqlite3_log()] interface writes a message into the error log
6227
-** established by the [SQLITE_CONFIG_ERRORLOG] option to [sqlite3_config()].
6224
+** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()].
62286225
** ^If logging is enabled, the zFormat string and subsequent arguments are
62296226
** passed through to [sqlite3_vmprintf()] to generate the final output string.
62306227
**
62316228
** The sqlite3_log() interface is intended for use by extensions such as
62326229
** virtual tables, collating functions, and SQL functions. While there is
62336230
** nothing to prevent an application from calling sqlite3_log(), doing so
62346231
** is considered bad form.
62356232
**
62366233
** The zFormat string must not be NULL.
6234
+**
6235
+** To avoid deadlocks and other threading problems, the sqlite3_log() routine
6236
+** will not use dynamically allocated memory. The log message is stored in
6237
+** a fixed-length buffer on the stack. If the log message is longer than
6238
+** a few hundred characters, it will be truncated to the length of the
6239
+** buffer.
62376240
*/
62386241
SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
62396242
62406243
/*
62416244
** Undo the hack that converts floating point types to integer for
@@ -16867,11 +16870,13 @@
1686716870
break;
1686816871
case etFLOAT:
1686916872
case etEXP:
1687016873
case etGENERIC:
1687116874
realvalue = va_arg(ap,double);
16872
-#ifndef SQLITE_OMIT_FLOATING_POINT
16875
+#ifdef SQLITE_OMIT_FLOATING_POINT
16876
+ length = 0;
16877
+#else
1687316878
if( precision<0 ) precision = 6; /* Set default precision */
1687416879
if( precision>etBUFSIZE/2-10 ) precision = etBUFSIZE/2-10;
1687516880
if( realvalue<0.0 ){
1687616881
realvalue = -realvalue;
1687716882
prefix = '-';
@@ -17013,13 +17018,11 @@
1701317018
}
1701417019
i = prefix!=0;
1701517020
while( nPad-- ) bufpt[i++] = '0';
1701617021
length = width;
1701717022
}
17018
-#else
17019
- length = 0;
17020
-#endif /* SQLITE_OMIT_FLOATING_POINT */
17023
+#endif /* !defined(SQLITE_OMIT_FLOATING_POINT) */
1702117024
break;
1702217025
case etSIZE:
1702317026
*(va_arg(ap,int*)) = pAccum->nChar;
1702417027
length = width = 0;
1702517028
break;
@@ -17062,11 +17065,11 @@
1706217065
char q = ((xtype==etSQLESCAPE3)?'"':'\''); /* Quote character */
1706317066
char *escarg = va_arg(ap,char*);
1706417067
isnull = escarg==0;
1706517068
if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
1706617069
k = precision;
17067
- for(i=n=0; (ch=escarg[i])!=0 && k!=0; i++, k--){
17070
+ for(i=n=0; k!=0 && (ch=escarg[i])!=0; i++, k--){
1706817071
if( ch==q ) n++;
1706917072
}
1707017073
needQuote = !isnull && xtype==etSQLESCAPE2;
1707117074
n += i + 1 + needQuote*2;
1707217075
if( n>etBUFSIZE ){
@@ -17345,30 +17348,40 @@
1734517348
sqlite3VXPrintf(&acc, 0, zFormat, ap);
1734617349
va_end(ap);
1734717350
z = sqlite3StrAccumFinish(&acc);
1734817351
return z;
1734917352
}
17353
+
17354
+/*
17355
+** This is the routine that actually formats the sqlite3_log() message.
17356
+** We house it in a separate routine from sqlite3_log() to avoid using
17357
+** stack space on small-stack systems when logging is disabled.
17358
+**
17359
+** sqlite3_log() must render into a static buffer. It cannot dynamically
17360
+** allocate memory because it might be called while the memory allocator
17361
+** mutex is held.
17362
+*/
17363
+static void renderLogMsg(int iErrCode, const char *zFormat, va_list ap){
17364
+ StrAccum acc; /* String accumulator */
17365
+ char zMsg[SQLITE_PRINT_BUF_SIZE*3]; /* Complete log message */
17366
+
17367
+ sqlite3StrAccumInit(&acc, zMsg, sizeof(zMsg), 0);
17368
+ acc.useMalloc = 0;
17369
+ sqlite3VXPrintf(&acc, 0, zFormat, ap);
17370
+ sqlite3GlobalConfig.xLog(sqlite3GlobalConfig.pLogArg, iErrCode,
17371
+ sqlite3StrAccumFinish(&acc));
17372
+}
1735017373
1735117374
/*
1735217375
** Format and write a message to the log if logging is enabled.
1735317376
*/
1735417377
SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...){
17355
- void (*xLog)(void*, int, const char*); /* The global logger function */
17356
- void *pLogArg; /* First argument to the logger */
1735717378
va_list ap; /* Vararg list */
17358
- char *zMsg; /* Complete log message */
17359
-
17360
- xLog = sqlite3GlobalConfig.xLog;
17361
- if( xLog ){
17379
+ if( sqlite3GlobalConfig.xLog ){
1736217380
va_start(ap, zFormat);
17363
- sqlite3BeginBenignMalloc();
17364
- zMsg = sqlite3_vmprintf(zFormat, ap);
17365
- sqlite3EndBenignMalloc();
17381
+ renderLogMsg(iErrCode, zFormat, ap);
1736617382
va_end(ap);
17367
- pLogArg = sqlite3GlobalConfig.pLogArg;
17368
- xLog(pLogArg, iErrCode, zMsg ? zMsg : zFormat);
17369
- sqlite3_free(zMsg);
1737017383
}
1737117384
}
1737217385
1737317386
#if defined(SQLITE_DEBUG)
1737417387
/*
@@ -19180,10 +19193,23 @@
1918019193
p[1] = (u8)(v & 0x7f);
1918119194
return 2;
1918219195
}
1918319196
return sqlite3PutVarint(p, v);
1918419197
}
19198
+
19199
+/*
19200
+** Bitmasks used by sqlite3GetVarint(). These precomputed constants
19201
+** are defined here rather than simply putting the constant expressions
19202
+** inline in order to work around bugs in the RVT compiler.
19203
+**
19204
+** SLOT_2_0 A mask for (0x7f<<14) | 0x7f
19205
+**
19206
+** SLOT_4_2_0 A mask for (0x7f<<28) | SLOT_2_0
19207
+*/
19208
+#define SLOT_2_0 0x001fc07f
19209
+#define SLOT_4_2_0 0xf01fc07f
19210
+
1918519211
1918619212
/*
1918719213
** Read a 64-bit variable-length integer from memory starting at p[0].
1918819214
** Return the number of bytes read. The value is stored in *v.
1918919215
*/
@@ -19208,33 +19234,37 @@
1920819234
a |= b;
1920919235
*v = a;
1921019236
return 2;
1921119237
}
1921219238
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
+
1921319243
p++;
1921419244
a = a<<14;
1921519245
a |= *p;
1921619246
/* a: p0<<14 | p2 (unmasked) */
1921719247
if (!(a&0x80))
1921819248
{
19219
- a &= (0x7f<<14)|(0x7f);
19249
+ a &= SLOT_2_0;
1922019250
b &= 0x7f;
1922119251
b = b<<7;
1922219252
a |= b;
1922319253
*v = a;
1922419254
return 3;
1922519255
}
1922619256
1922719257
/* CSE1 from below */
19228
- a &= (0x7f<<14)|(0x7f);
19258
+ a &= SLOT_2_0;
1922919259
p++;
1923019260
b = b<<14;
1923119261
b |= *p;
1923219262
/* b: p1<<14 | p3 (unmasked) */
1923319263
if (!(b&0x80))
1923419264
{
19235
- b &= (0x7f<<14)|(0x7f);
19265
+ b &= SLOT_2_0;
1923619266
/* moved CSE1 up */
1923719267
/* a &= (0x7f<<14)|(0x7f); */
1923819268
a = a<<7;
1923919269
a |= b;
1924019270
*v = a;
@@ -19244,11 +19274,11 @@
1924419274
/* a: p0<<14 | p2 (masked) */
1924519275
/* b: p1<<14 | p3 (unmasked) */
1924619276
/* 1:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */
1924719277
/* moved CSE1 up */
1924819278
/* a &= (0x7f<<14)|(0x7f); */
19249
- b &= (0x7f<<14)|(0x7f);
19279
+ b &= SLOT_2_0;
1925019280
s = a;
1925119281
/* s: p0<<14 | p2 (masked) */
1925219282
1925319283
p++;
1925419284
a = a<<14;
@@ -19277,11 +19307,11 @@
1927719307
/* b: p1<<28 | p3<<14 | p5 (unmasked) */
1927819308
if (!(b&0x80))
1927919309
{
1928019310
/* we can skip this cause it was (effectively) done above in calc'ing s */
1928119311
/* b &= (0x7f<<28)|(0x7f<<14)|(0x7f); */
19282
- a &= (0x7f<<14)|(0x7f);
19312
+ a &= SLOT_2_0;
1928319313
a = a<<7;
1928419314
a |= b;
1928519315
s = s>>18;
1928619316
*v = ((u64)s)<<32 | a;
1928719317
return 6;
@@ -19291,28 +19321,28 @@
1929119321
a = a<<14;
1929219322
a |= *p;
1929319323
/* a: p2<<28 | p4<<14 | p6 (unmasked) */
1929419324
if (!(a&0x80))
1929519325
{
19296
- a &= (0x1f<<28)|(0x7f<<14)|(0x7f);
19297
- b &= (0x7f<<14)|(0x7f);
19326
+ a &= SLOT_4_2_0;
19327
+ b &= SLOT_2_0;
1929819328
b = b<<7;
1929919329
a |= b;
1930019330
s = s>>11;
1930119331
*v = ((u64)s)<<32 | a;
1930219332
return 7;
1930319333
}
1930419334
1930519335
/* CSE2 from below */
19306
- a &= (0x7f<<14)|(0x7f);
19336
+ a &= SLOT_2_0;
1930719337
p++;
1930819338
b = b<<14;
1930919339
b |= *p;
1931019340
/* b: p3<<28 | p5<<14 | p7 (unmasked) */
1931119341
if (!(b&0x80))
1931219342
{
19313
- b &= (0x1f<<28)|(0x7f<<14)|(0x7f);
19343
+ b &= SLOT_4_2_0;
1931419344
/* moved CSE2 up */
1931519345
/* a &= (0x7f<<14)|(0x7f); */
1931619346
a = a<<7;
1931719347
a |= b;
1931819348
s = s>>4;
@@ -19325,11 +19355,11 @@
1932519355
a |= *p;
1932619356
/* a: p4<<29 | p6<<15 | p8 (unmasked) */
1932719357
1932819358
/* moved CSE2 up */
1932919359
/* a &= (0x7f<<29)|(0x7f<<15)|(0xff); */
19330
- b &= (0x7f<<14)|(0x7f);
19360
+ b &= SLOT_2_0;
1933119361
b = b<<8;
1933219362
a |= b;
1933319363
1933419364
s = s<<4;
1933519365
b = p[-4];
@@ -19445,13 +19475,13 @@
1944519475
a = a<<14;
1944619476
a |= *p;
1944719477
/* a: p0<<28 | p2<<14 | p4 (unmasked) */
1944819478
if (!(a&0x80))
1944919479
{
19450
- /* Walues between 268435456 and 34359738367 */
19451
- a &= (0x1f<<28)|(0x7f<<14)|(0x7f);
19452
- b &= (0x1f<<28)|(0x7f<<14)|(0x7f);
19480
+ /* Values between 268435456 and 34359738367 */
19481
+ a &= SLOT_4_2_0;
19482
+ b &= SLOT_4_2_0;
1945319483
b = b<<7;
1945419484
*v = a | b;
1945519485
return 5;
1945619486
}
1945719487
@@ -21446,11 +21476,11 @@
2144621476
** selection of the appropriate locking style based on the filesystem
2144721477
** where the database is located.
2144821478
*/
2144921479
#if !defined(SQLITE_ENABLE_LOCKING_STYLE)
2145021480
# if defined(__APPLE__)
21451
-# define SQLITE_ENABLE_LOCKING_STYLE 1
21481
+# define SQLITE_ENABLE_LOCKING_STYLE 0
2145221482
# else
2145321483
# define SQLITE_ENABLE_LOCKING_STYLE 0
2145421484
# endif
2145521485
#endif
2145621486
@@ -21511,10 +21541,13 @@
2151121541
# include <sys/file.h>
2151221542
# include <sys/param.h>
2151321543
# include <sys/mount.h>
2151421544
# endif
2151521545
#endif /* SQLITE_ENABLE_LOCKING_STYLE */
21546
+
21547
+#ifdef __APPLE__
21548
+#endif
2151621549
2151721550
/*
2151821551
** Allowed values of unixFile.fsFlags
2151921552
*/
2152021553
#define SQLITE_FSFLAGS_IS_MSDOS 0x1
@@ -23155,11 +23188,11 @@
2315523188
lock.l_type = F_UNLCK;
2315623189
lock.l_whence = SEEK_SET;
2315723190
lock.l_start = SHARED_FIRST;
2315823191
lock.l_len = divSize;
2315923192
if( fcntl(h, F_SETLK, &lock)==(-1) ){
23160
- int tErrno = errno;
23193
+ tErrno = errno;
2316123194
rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK);
2316223195
if( IS_LOCK_ERROR(rc) ){
2316323196
pFile->lastErrno = tErrno;
2316423197
}
2316523198
goto end_unlock;
@@ -23167,11 +23200,11 @@
2316723200
lock.l_type = F_RDLCK;
2316823201
lock.l_whence = SEEK_SET;
2316923202
lock.l_start = SHARED_FIRST;
2317023203
lock.l_len = divSize;
2317123204
if( fcntl(h, F_SETLK, &lock)==(-1) ){
23172
- int tErrno = errno;
23205
+ tErrno = errno;
2317323206
rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_RDLOCK);
2317423207
if( IS_LOCK_ERROR(rc) ){
2317523208
pFile->lastErrno = tErrno;
2317623209
}
2317723210
goto end_unlock;
@@ -23179,11 +23212,11 @@
2317923212
lock.l_type = F_UNLCK;
2318023213
lock.l_whence = SEEK_SET;
2318123214
lock.l_start = SHARED_FIRST+divSize;
2318223215
lock.l_len = SHARED_SIZE-divSize;
2318323216
if( fcntl(h, F_SETLK, &lock)==(-1) ){
23184
- int tErrno = errno;
23217
+ tErrno = errno;
2318523218
rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK);
2318623219
if( IS_LOCK_ERROR(rc) ){
2318723220
pFile->lastErrno = tErrno;
2318823221
}
2318923222
goto end_unlock;
@@ -23192,11 +23225,11 @@
2319223225
lock.l_type = F_RDLCK;
2319323226
lock.l_whence = SEEK_SET;
2319423227
lock.l_start = SHARED_FIRST;
2319523228
lock.l_len = SHARED_SIZE;
2319623229
if( fcntl(h, F_SETLK, &lock)==(-1) ){
23197
- int tErrno = errno;
23230
+ tErrno = errno;
2319823231
rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_RDLOCK);
2319923232
if( IS_LOCK_ERROR(rc) ){
2320023233
pFile->lastErrno = tErrno;
2320123234
}
2320223235
goto end_unlock;
@@ -26491,11 +26524,11 @@
2649126524
sqlite3_free(pNew);
2649226525
sqlite3_free(pUnused);
2649326526
return rc;
2649426527
}
2649526528
26496
-#ifdef SQLITE_TEST
26529
+#if defined(SQLITE_TEST) && defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
2649726530
/* simulate multiple hosts by creating unique hostid file paths */
2649826531
SQLITE_API int sqlite3_hostid_num = 0;
2649926532
#endif
2650026533
2650126534
#define PROXY_HOSTIDLEN 16 /* conch file host id length */
@@ -30169,10 +30202,11 @@
3016930202
SQLITE_PRIVATE void sqlite3PcacheSetPageSize(PCache *pCache, int szPage){
3017030203
assert( pCache->nRef==0 && pCache->pDirty==0 );
3017130204
if( pCache->pCache ){
3017230205
sqlite3GlobalConfig.pcache.xDestroy(pCache->pCache);
3017330206
pCache->pCache = 0;
30207
+ pCache->pPage1 = 0;
3017430208
}
3017530209
pCache->szPage = szPage;
3017630210
}
3017730211
3017830212
/*
@@ -43918,12 +43952,19 @@
4391843952
** the dropCell() routine will overwrite the entire cell with zeroes.
4391943953
** In this case, temporarily copy the cell into the aOvflSpace[]
4392043954
** buffer. It will be copied out again as soon as the aSpace[] buffer
4392143955
** is allocated. */
4392243956
if( pBt->secureDelete ){
43923
- memcpy(&aOvflSpace[apDiv[i]-pParent->aData], apDiv[i], szNew[i]);
43924
- apDiv[i] = &aOvflSpace[apDiv[i]-pParent->aData];
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{
43963
+ memcpy(&aOvflSpace[iOff], apDiv[i], szNew[i]);
43964
+ apDiv[i] = &aOvflSpace[apDiv[i]-pParent->aData];
43965
+ }
4392543966
}
4392643967
dropCell(pParent, i+nxDiv-pParent->nOverflow, szNew[i], &rc);
4392743968
}
4392843969
}
4392943970
@@ -58617,11 +58658,13 @@
5861758658
** an error of some kind.
5861858659
*/
5861958660
vdbe_error_halt:
5862058661
assert( rc );
5862158662
p->rc = rc;
58622
- sqlite3_log(rc, "prepared statement aborts at %d: [%s]", pc, p->zSql);
58663
+ testcase( sqlite3GlobalConfig.xLog!=0 );
58664
+ sqlite3_log(rc, "statement aborts at %d: [%s] %s",
58665
+ pc, p->zSql, p->zErrMsg);
5862358666
sqlite3VdbeHalt(p);
5862458667
if( rc==SQLITE_IOERR_NOMEM ) db->mallocFailed = 1;
5862558668
rc = SQLITE_ERROR;
5862658669
if( resetSchemaOnFault ) sqlite3ResetInternalSchema(db, 0);
5862758670
@@ -73606,12 +73649,12 @@
7360673649
FUNCTION(randomblob, 1, 0, 0, randomBlob ),
7360773650
FUNCTION(nullif, 2, 0, 1, nullifFunc ),
7360873651
FUNCTION(sqlite_version, 0, 0, 0, versionFunc ),
7360973652
FUNCTION(sqlite_source_id, 0, 0, 0, sourceidFunc ),
7361073653
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
73611
- FUNCTION(sqlite_compile_option_used,1, 0, 0, compileoptionusedFunc ),
73612
- FUNCTION(sqlite_compile_option_get, 1, 0, 0, compileoptiongetFunc ),
73654
+ FUNCTION(sqlite_compileoption_used,1, 0, 0, compileoptionusedFunc ),
73655
+ FUNCTION(sqlite_compileoption_get, 1, 0, 0, compileoptiongetFunc ),
7361373656
#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
7361473657
FUNCTION(quote, 1, 0, 0, quoteFunc ),
7361573658
FUNCTION(last_insert_rowid, 0, 0, 0, last_insert_rowid),
7361673659
FUNCTION(changes, 0, 0, 0, changes ),
7361773660
FUNCTION(total_changes, 0, 0, 0, total_changes ),
@@ -79179,22 +79222,14 @@
7917979222
#endif /* SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS */
7918079223
7918179224
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
7918279225
/*
7918379226
** PRAGMA compile_options
79184
- ** PRAGMA compile_option(<option>)
7918579227
**
79186
- ** The first form returns a single row for each option that was
79187
- ** defined at compile time. The second form returns 0 or 1
79188
- ** indicating whether the specified option was defined at
79189
- ** compile time.
79228
+ ** Return the names of all compile-time options used in this build,
79229
+ ** one option per row.
7919079230
*/
79191
- if( sqlite3StrICmp(zLeft, "compile_option")==0 && zRight ){
79192
- int used = sqlite3_compileoption_used(zRight);
79193
- returnSingleInt(pParse, zRight, used);
79194
- }else
79195
-
7919679231
if( sqlite3StrICmp(zLeft, "compile_options")==0 ){
7919779232
int i = 0;
7919879233
const char *zOpt;
7919979234
sqlite3VdbeSetNumCols(v, 1);
7920079235
pParse->nMem = 1;
@@ -86540,11 +86575,15 @@
8654086575
** actually occurs when doing a vacuum since the vacuum_db is initially
8654186576
** empty. Only the journal header is written. Apparently it takes more
8654286577
** time to parse and run the PRAGMA to turn journalling off than it does
8654386578
** to write the journal header file.
8654486579
*/
86545
- zSql = "ATTACH '' AS vacuum_db;";
86580
+ if( sqlite3TempInMemory(db) ){
86581
+ zSql = "ATTACH ':memory:' AS vacuum_db;";
86582
+ }else{
86583
+ zSql = "ATTACH '' AS vacuum_db;";
86584
+ }
8654686585
rc = execSql(db, pzErrMsg, zSql);
8654786586
if( rc!=SQLITE_OK ) goto end_of_vacuum;
8654886587
pDb = &db->aDb[db->nDb-1];
8654986588
assert( strcmp(db->aDb[db->nDb-1].zName,"vacuum_db")==0 );
8655086589
pTemp = db->aDb[db->nDb-1].pBt;
8655186590
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -313,41 +313,38 @@
313 ** and with SQLITE_ENABLE_STAT2
314 */
315 #define SQLITE_INDEX_SAMPLES 10
316
317 /*
318 ** This macro is used to "hide" some ugliness in casting an int
319 ** value to a ptr value under the MSVC 64-bit compiler. Casting
320 ** non 64-bit values to ptr types results in a "hard" error with
321 ** the MSVC 64-bit compiler which this attempts to avoid.
322 **
323 ** A simple compiler pragma or casting sequence could not be found
324 ** to correct this in all situations, so this macro was introduced.
325 **
326 ** It could be argued that the intptr_t type could be used in this
327 ** case, but that type is not available on all compilers, or
328 ** requires the #include of specific headers which differs between
329 ** platforms.
330 **
331 ** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on
332 ** the ((void*)&((char*)0)[X]) construct. But MSVC chokes on ((void*)(X)).
333 ** So we have to define the macros in different ways depending on the
334 ** compiler.
335 */
336 #if defined(__GNUC__)
337 # if defined(HAVE_STDINT_H)
338 # define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X))
339 # define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X))
340 # else
341 # define SQLITE_INT_TO_PTR(X) ((void*)(X))
342 # define SQLITE_PTR_TO_INT(X) ((int)(X))
343 # endif
344 #else
345 # define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X])
346 # define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0))
 
347 #endif
348
349
350 /*
351 ** The SQLITE_THREADSAFE macro must be defined as either 0 or 1.
352 ** Older versions of SQLite used an optional THREADSAFE macro.
353 ** We support that for legacy
@@ -631,11 +628,11 @@
631 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
632 ** [sqlite_version()] and [sqlite_source_id()].
633 */
634 #define SQLITE_VERSION "3.6.23"
635 #define SQLITE_VERSION_NUMBER 3006023
636 #define SQLITE_SOURCE_ID "2010-02-26 13:07:37 8f29490da62df07ea922b03cab52b6edd2669edb"
637
638 /*
639 ** CAPI3REF: Run-Time Library Version Numbers
640 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
641 **
@@ -668,13 +665,13 @@
668 SQLITE_API const char sqlite3_version[] = SQLITE_VERSION;
669 SQLITE_API const char *sqlite3_libversion(void);
670 SQLITE_API const char *sqlite3_sourceid(void);
671 SQLITE_API int sqlite3_libversion_number(void);
672
 
673 /*
674 ** CAPI3REF: Run-Time Library Compilation Options Diagnostics
675 ** KEYWORDS: sqlite3_compileoption_used, sqlite3_compileoption_get
676 **
677 ** ^The sqlite3_compileoption_used() function returns 0 or 1
678 ** indicating whether the specified option was defined at
679 ** compile time. ^The SQLITE_ prefix may be omitted from the
680 ** option name passed to sqlite3_compileoption_used().
@@ -686,15 +683,15 @@
686 ** prefix is omitted from any strings returned by
687 ** sqlite3_compileoption_get().
688 **
689 ** ^Support for the diagnostic functions sqlite3_compileoption_used()
690 ** and sqlite3_compileoption_get() may be omitted by specifing the
691 ** SQLITE_OMIT_COMPILEOPTION_DIAGS option at compile time.
692 **
693 ** See also: [sqlite_compile_option_used()] and [sqlite_compile_option_get()].
 
694 */
695 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
696 SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
697 SQLITE_API const char *sqlite3_compileoption_get(int N);
698 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
699
700 /*
@@ -6222,20 +6219,26 @@
6222 /*
6223 ** CAPI3REF: Error Logging Interface
6224 ** EXPERIMENTAL
6225 **
6226 ** ^The [sqlite3_log()] interface writes a message into the error log
6227 ** established by the [SQLITE_CONFIG_ERRORLOG] option to [sqlite3_config()].
6228 ** ^If logging is enabled, the zFormat string and subsequent arguments are
6229 ** passed through to [sqlite3_vmprintf()] to generate the final output string.
6230 **
6231 ** The sqlite3_log() interface is intended for use by extensions such as
6232 ** virtual tables, collating functions, and SQL functions. While there is
6233 ** nothing to prevent an application from calling sqlite3_log(), doing so
6234 ** is considered bad form.
6235 **
6236 ** The zFormat string must not be NULL.
 
 
 
 
 
 
6237 */
6238 SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
6239
6240 /*
6241 ** Undo the hack that converts floating point types to integer for
@@ -16867,11 +16870,13 @@
16867 break;
16868 case etFLOAT:
16869 case etEXP:
16870 case etGENERIC:
16871 realvalue = va_arg(ap,double);
16872 #ifndef SQLITE_OMIT_FLOATING_POINT
 
 
16873 if( precision<0 ) precision = 6; /* Set default precision */
16874 if( precision>etBUFSIZE/2-10 ) precision = etBUFSIZE/2-10;
16875 if( realvalue<0.0 ){
16876 realvalue = -realvalue;
16877 prefix = '-';
@@ -17013,13 +17018,11 @@
17013 }
17014 i = prefix!=0;
17015 while( nPad-- ) bufpt[i++] = '0';
17016 length = width;
17017 }
17018 #else
17019 length = 0;
17020 #endif /* SQLITE_OMIT_FLOATING_POINT */
17021 break;
17022 case etSIZE:
17023 *(va_arg(ap,int*)) = pAccum->nChar;
17024 length = width = 0;
17025 break;
@@ -17062,11 +17065,11 @@
17062 char q = ((xtype==etSQLESCAPE3)?'"':'\''); /* Quote character */
17063 char *escarg = va_arg(ap,char*);
17064 isnull = escarg==0;
17065 if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
17066 k = precision;
17067 for(i=n=0; (ch=escarg[i])!=0 && k!=0; i++, k--){
17068 if( ch==q ) n++;
17069 }
17070 needQuote = !isnull && xtype==etSQLESCAPE2;
17071 n += i + 1 + needQuote*2;
17072 if( n>etBUFSIZE ){
@@ -17345,30 +17348,40 @@
17345 sqlite3VXPrintf(&acc, 0, zFormat, ap);
17346 va_end(ap);
17347 z = sqlite3StrAccumFinish(&acc);
17348 return z;
17349 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17350
17351 /*
17352 ** Format and write a message to the log if logging is enabled.
17353 */
17354 SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...){
17355 void (*xLog)(void*, int, const char*); /* The global logger function */
17356 void *pLogArg; /* First argument to the logger */
17357 va_list ap; /* Vararg list */
17358 char *zMsg; /* Complete log message */
17359
17360 xLog = sqlite3GlobalConfig.xLog;
17361 if( xLog ){
17362 va_start(ap, zFormat);
17363 sqlite3BeginBenignMalloc();
17364 zMsg = sqlite3_vmprintf(zFormat, ap);
17365 sqlite3EndBenignMalloc();
17366 va_end(ap);
17367 pLogArg = sqlite3GlobalConfig.pLogArg;
17368 xLog(pLogArg, iErrCode, zMsg ? zMsg : zFormat);
17369 sqlite3_free(zMsg);
17370 }
17371 }
17372
17373 #if defined(SQLITE_DEBUG)
17374 /*
@@ -19180,10 +19193,23 @@
19180 p[1] = (u8)(v & 0x7f);
19181 return 2;
19182 }
19183 return sqlite3PutVarint(p, v);
19184 }
 
 
 
 
 
 
 
 
 
 
 
 
 
19185
19186 /*
19187 ** Read a 64-bit variable-length integer from memory starting at p[0].
19188 ** Return the number of bytes read. The value is stored in *v.
19189 */
@@ -19208,33 +19234,37 @@
19208 a |= b;
19209 *v = a;
19210 return 2;
19211 }
19212
 
 
 
 
19213 p++;
19214 a = a<<14;
19215 a |= *p;
19216 /* a: p0<<14 | p2 (unmasked) */
19217 if (!(a&0x80))
19218 {
19219 a &= (0x7f<<14)|(0x7f);
19220 b &= 0x7f;
19221 b = b<<7;
19222 a |= b;
19223 *v = a;
19224 return 3;
19225 }
19226
19227 /* CSE1 from below */
19228 a &= (0x7f<<14)|(0x7f);
19229 p++;
19230 b = b<<14;
19231 b |= *p;
19232 /* b: p1<<14 | p3 (unmasked) */
19233 if (!(b&0x80))
19234 {
19235 b &= (0x7f<<14)|(0x7f);
19236 /* moved CSE1 up */
19237 /* a &= (0x7f<<14)|(0x7f); */
19238 a = a<<7;
19239 a |= b;
19240 *v = a;
@@ -19244,11 +19274,11 @@
19244 /* a: p0<<14 | p2 (masked) */
19245 /* b: p1<<14 | p3 (unmasked) */
19246 /* 1:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */
19247 /* moved CSE1 up */
19248 /* a &= (0x7f<<14)|(0x7f); */
19249 b &= (0x7f<<14)|(0x7f);
19250 s = a;
19251 /* s: p0<<14 | p2 (masked) */
19252
19253 p++;
19254 a = a<<14;
@@ -19277,11 +19307,11 @@
19277 /* b: p1<<28 | p3<<14 | p5 (unmasked) */
19278 if (!(b&0x80))
19279 {
19280 /* we can skip this cause it was (effectively) done above in calc'ing s */
19281 /* b &= (0x7f<<28)|(0x7f<<14)|(0x7f); */
19282 a &= (0x7f<<14)|(0x7f);
19283 a = a<<7;
19284 a |= b;
19285 s = s>>18;
19286 *v = ((u64)s)<<32 | a;
19287 return 6;
@@ -19291,28 +19321,28 @@
19291 a = a<<14;
19292 a |= *p;
19293 /* a: p2<<28 | p4<<14 | p6 (unmasked) */
19294 if (!(a&0x80))
19295 {
19296 a &= (0x1f<<28)|(0x7f<<14)|(0x7f);
19297 b &= (0x7f<<14)|(0x7f);
19298 b = b<<7;
19299 a |= b;
19300 s = s>>11;
19301 *v = ((u64)s)<<32 | a;
19302 return 7;
19303 }
19304
19305 /* CSE2 from below */
19306 a &= (0x7f<<14)|(0x7f);
19307 p++;
19308 b = b<<14;
19309 b |= *p;
19310 /* b: p3<<28 | p5<<14 | p7 (unmasked) */
19311 if (!(b&0x80))
19312 {
19313 b &= (0x1f<<28)|(0x7f<<14)|(0x7f);
19314 /* moved CSE2 up */
19315 /* a &= (0x7f<<14)|(0x7f); */
19316 a = a<<7;
19317 a |= b;
19318 s = s>>4;
@@ -19325,11 +19355,11 @@
19325 a |= *p;
19326 /* a: p4<<29 | p6<<15 | p8 (unmasked) */
19327
19328 /* moved CSE2 up */
19329 /* a &= (0x7f<<29)|(0x7f<<15)|(0xff); */
19330 b &= (0x7f<<14)|(0x7f);
19331 b = b<<8;
19332 a |= b;
19333
19334 s = s<<4;
19335 b = p[-4];
@@ -19445,13 +19475,13 @@
19445 a = a<<14;
19446 a |= *p;
19447 /* a: p0<<28 | p2<<14 | p4 (unmasked) */
19448 if (!(a&0x80))
19449 {
19450 /* Walues between 268435456 and 34359738367 */
19451 a &= (0x1f<<28)|(0x7f<<14)|(0x7f);
19452 b &= (0x1f<<28)|(0x7f<<14)|(0x7f);
19453 b = b<<7;
19454 *v = a | b;
19455 return 5;
19456 }
19457
@@ -21446,11 +21476,11 @@
21446 ** selection of the appropriate locking style based on the filesystem
21447 ** where the database is located.
21448 */
21449 #if !defined(SQLITE_ENABLE_LOCKING_STYLE)
21450 # if defined(__APPLE__)
21451 # define SQLITE_ENABLE_LOCKING_STYLE 1
21452 # else
21453 # define SQLITE_ENABLE_LOCKING_STYLE 0
21454 # endif
21455 #endif
21456
@@ -21511,10 +21541,13 @@
21511 # include <sys/file.h>
21512 # include <sys/param.h>
21513 # include <sys/mount.h>
21514 # endif
21515 #endif /* SQLITE_ENABLE_LOCKING_STYLE */
 
 
 
21516
21517 /*
21518 ** Allowed values of unixFile.fsFlags
21519 */
21520 #define SQLITE_FSFLAGS_IS_MSDOS 0x1
@@ -23155,11 +23188,11 @@
23155 lock.l_type = F_UNLCK;
23156 lock.l_whence = SEEK_SET;
23157 lock.l_start = SHARED_FIRST;
23158 lock.l_len = divSize;
23159 if( fcntl(h, F_SETLK, &lock)==(-1) ){
23160 int tErrno = errno;
23161 rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK);
23162 if( IS_LOCK_ERROR(rc) ){
23163 pFile->lastErrno = tErrno;
23164 }
23165 goto end_unlock;
@@ -23167,11 +23200,11 @@
23167 lock.l_type = F_RDLCK;
23168 lock.l_whence = SEEK_SET;
23169 lock.l_start = SHARED_FIRST;
23170 lock.l_len = divSize;
23171 if( fcntl(h, F_SETLK, &lock)==(-1) ){
23172 int tErrno = errno;
23173 rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_RDLOCK);
23174 if( IS_LOCK_ERROR(rc) ){
23175 pFile->lastErrno = tErrno;
23176 }
23177 goto end_unlock;
@@ -23179,11 +23212,11 @@
23179 lock.l_type = F_UNLCK;
23180 lock.l_whence = SEEK_SET;
23181 lock.l_start = SHARED_FIRST+divSize;
23182 lock.l_len = SHARED_SIZE-divSize;
23183 if( fcntl(h, F_SETLK, &lock)==(-1) ){
23184 int tErrno = errno;
23185 rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK);
23186 if( IS_LOCK_ERROR(rc) ){
23187 pFile->lastErrno = tErrno;
23188 }
23189 goto end_unlock;
@@ -23192,11 +23225,11 @@
23192 lock.l_type = F_RDLCK;
23193 lock.l_whence = SEEK_SET;
23194 lock.l_start = SHARED_FIRST;
23195 lock.l_len = SHARED_SIZE;
23196 if( fcntl(h, F_SETLK, &lock)==(-1) ){
23197 int tErrno = errno;
23198 rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_RDLOCK);
23199 if( IS_LOCK_ERROR(rc) ){
23200 pFile->lastErrno = tErrno;
23201 }
23202 goto end_unlock;
@@ -26491,11 +26524,11 @@
26491 sqlite3_free(pNew);
26492 sqlite3_free(pUnused);
26493 return rc;
26494 }
26495
26496 #ifdef SQLITE_TEST
26497 /* simulate multiple hosts by creating unique hostid file paths */
26498 SQLITE_API int sqlite3_hostid_num = 0;
26499 #endif
26500
26501 #define PROXY_HOSTIDLEN 16 /* conch file host id length */
@@ -30169,10 +30202,11 @@
30169 SQLITE_PRIVATE void sqlite3PcacheSetPageSize(PCache *pCache, int szPage){
30170 assert( pCache->nRef==0 && pCache->pDirty==0 );
30171 if( pCache->pCache ){
30172 sqlite3GlobalConfig.pcache.xDestroy(pCache->pCache);
30173 pCache->pCache = 0;
 
30174 }
30175 pCache->szPage = szPage;
30176 }
30177
30178 /*
@@ -43918,12 +43952,19 @@
43918 ** the dropCell() routine will overwrite the entire cell with zeroes.
43919 ** In this case, temporarily copy the cell into the aOvflSpace[]
43920 ** buffer. It will be copied out again as soon as the aSpace[] buffer
43921 ** is allocated. */
43922 if( pBt->secureDelete ){
43923 memcpy(&aOvflSpace[apDiv[i]-pParent->aData], apDiv[i], szNew[i]);
43924 apDiv[i] = &aOvflSpace[apDiv[i]-pParent->aData];
 
 
 
 
 
 
 
43925 }
43926 dropCell(pParent, i+nxDiv-pParent->nOverflow, szNew[i], &rc);
43927 }
43928 }
43929
@@ -58617,11 +58658,13 @@
58617 ** an error of some kind.
58618 */
58619 vdbe_error_halt:
58620 assert( rc );
58621 p->rc = rc;
58622 sqlite3_log(rc, "prepared statement aborts at %d: [%s]", pc, p->zSql);
 
 
58623 sqlite3VdbeHalt(p);
58624 if( rc==SQLITE_IOERR_NOMEM ) db->mallocFailed = 1;
58625 rc = SQLITE_ERROR;
58626 if( resetSchemaOnFault ) sqlite3ResetInternalSchema(db, 0);
58627
@@ -73606,12 +73649,12 @@
73606 FUNCTION(randomblob, 1, 0, 0, randomBlob ),
73607 FUNCTION(nullif, 2, 0, 1, nullifFunc ),
73608 FUNCTION(sqlite_version, 0, 0, 0, versionFunc ),
73609 FUNCTION(sqlite_source_id, 0, 0, 0, sourceidFunc ),
73610 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
73611 FUNCTION(sqlite_compile_option_used,1, 0, 0, compileoptionusedFunc ),
73612 FUNCTION(sqlite_compile_option_get, 1, 0, 0, compileoptiongetFunc ),
73613 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
73614 FUNCTION(quote, 1, 0, 0, quoteFunc ),
73615 FUNCTION(last_insert_rowid, 0, 0, 0, last_insert_rowid),
73616 FUNCTION(changes, 0, 0, 0, changes ),
73617 FUNCTION(total_changes, 0, 0, 0, total_changes ),
@@ -79179,22 +79222,14 @@
79179 #endif /* SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS */
79180
79181 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
79182 /*
79183 ** PRAGMA compile_options
79184 ** PRAGMA compile_option(<option>)
79185 **
79186 ** The first form returns a single row for each option that was
79187 ** defined at compile time. The second form returns 0 or 1
79188 ** indicating whether the specified option was defined at
79189 ** compile time.
79190 */
79191 if( sqlite3StrICmp(zLeft, "compile_option")==0 && zRight ){
79192 int used = sqlite3_compileoption_used(zRight);
79193 returnSingleInt(pParse, zRight, used);
79194 }else
79195
79196 if( sqlite3StrICmp(zLeft, "compile_options")==0 ){
79197 int i = 0;
79198 const char *zOpt;
79199 sqlite3VdbeSetNumCols(v, 1);
79200 pParse->nMem = 1;
@@ -86540,11 +86575,15 @@
86540 ** actually occurs when doing a vacuum since the vacuum_db is initially
86541 ** empty. Only the journal header is written. Apparently it takes more
86542 ** time to parse and run the PRAGMA to turn journalling off than it does
86543 ** to write the journal header file.
86544 */
86545 zSql = "ATTACH '' AS vacuum_db;";
 
 
 
 
86546 rc = execSql(db, pzErrMsg, zSql);
86547 if( rc!=SQLITE_OK ) goto end_of_vacuum;
86548 pDb = &db->aDb[db->nDb-1];
86549 assert( strcmp(db->aDb[db->nDb-1].zName,"vacuum_db")==0 );
86550 pTemp = db->aDb[db->nDb-1].pBt;
86551
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -313,41 +313,38 @@
313 ** and with SQLITE_ENABLE_STAT2
314 */
315 #define SQLITE_INDEX_SAMPLES 10
316
317 /*
318 ** The following macros are used to cast pointers to integers and
319 ** integers to pointers. The way you do this varies from one compiler
320 ** to the next, so we have developed the following set of #if statements
321 ** to generate appropriate macros for a wide range of compilers.
322 **
323 ** The correct "ANSI" way to do this is to use the intptr_t type.
324 ** Unfortunately, that typedef is not available on all compilers, or
325 ** if it is available, it requires an #include of specific headers
326 ** that very from one machine to the next.
 
 
 
327 **
328 ** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on
329 ** the ((void*)&((char*)0)[X]) construct. But MSVC chokes on ((void*)(X)).
330 ** So we have to define the macros in different ways depending on the
331 ** compiler.
332 */
333 #if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */
334 # define SQLITE_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X))
335 # define SQLITE_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X))
336 #elif !defined(__GNUC__) /* Works for compilers other than LLVM */
337 # define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X])
338 # define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0))
339 #elif defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */
340 # define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X))
341 # define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X))
342 #else /* Generates a warning - but it always works */
343 # define SQLITE_INT_TO_PTR(X) ((void*)(X))
344 # define SQLITE_PTR_TO_INT(X) ((int)(X))
345 #endif
 
346
347 /*
348 ** The SQLITE_THREADSAFE macro must be defined as either 0 or 1.
349 ** Older versions of SQLite used an optional THREADSAFE macro.
350 ** We support that for legacy
@@ -631,11 +628,11 @@
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-04 22:36:45 1a0fa8d19d69d4ecaaaa879ac3c893980375fcc6"
634
635 /*
636 ** CAPI3REF: Run-Time Library Version Numbers
637 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
638 **
@@ -668,13 +665,13 @@
665 SQLITE_API const char sqlite3_version[] = SQLITE_VERSION;
666 SQLITE_API const char *sqlite3_libversion(void);
667 SQLITE_API const char *sqlite3_sourceid(void);
668 SQLITE_API int sqlite3_libversion_number(void);
669
670 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
671 /*
672 ** CAPI3REF: Run-Time Library Compilation Options Diagnostics
 
673 **
674 ** ^The sqlite3_compileoption_used() function returns 0 or 1
675 ** indicating whether the specified option was defined at
676 ** compile time. ^The SQLITE_ prefix may be omitted from the
677 ** option name passed to sqlite3_compileoption_used().
@@ -686,15 +683,15 @@
683 ** prefix is omitted from any strings returned by
684 ** sqlite3_compileoption_get().
685 **
686 ** ^Support for the diagnostic functions sqlite3_compileoption_used()
687 ** and sqlite3_compileoption_get() may be omitted by specifing the
688 ** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time.
689 **
690 ** See also: SQL functions [sqlite_compileoption_used()] and
691 ** [sqlite_compileoption_get()] and the [compile_options pragma].
692 */
 
693 SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
694 SQLITE_API const char *sqlite3_compileoption_get(int N);
695 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
696
697 /*
@@ -6222,20 +6219,26 @@
6219 /*
6220 ** CAPI3REF: Error Logging Interface
6221 ** EXPERIMENTAL
6222 **
6223 ** ^The [sqlite3_log()] interface writes a message into the error log
6224 ** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()].
6225 ** ^If logging is enabled, the zFormat string and subsequent arguments are
6226 ** passed through to [sqlite3_vmprintf()] to generate the final output string.
6227 **
6228 ** The sqlite3_log() interface is intended for use by extensions such as
6229 ** virtual tables, collating functions, and SQL functions. While there is
6230 ** nothing to prevent an application from calling sqlite3_log(), doing so
6231 ** is considered bad form.
6232 **
6233 ** The zFormat string must not be NULL.
6234 **
6235 ** To avoid deadlocks and other threading problems, the sqlite3_log() routine
6236 ** will not use dynamically allocated memory. The log message is stored in
6237 ** a fixed-length buffer on the stack. If the log message is longer than
6238 ** a few hundred characters, it will be truncated to the length of the
6239 ** buffer.
6240 */
6241 SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
6242
6243 /*
6244 ** Undo the hack that converts floating point types to integer for
@@ -16867,11 +16870,13 @@
16870 break;
16871 case etFLOAT:
16872 case etEXP:
16873 case etGENERIC:
16874 realvalue = va_arg(ap,double);
16875 #ifdef SQLITE_OMIT_FLOATING_POINT
16876 length = 0;
16877 #else
16878 if( precision<0 ) precision = 6; /* Set default precision */
16879 if( precision>etBUFSIZE/2-10 ) precision = etBUFSIZE/2-10;
16880 if( realvalue<0.0 ){
16881 realvalue = -realvalue;
16882 prefix = '-';
@@ -17013,13 +17018,11 @@
17018 }
17019 i = prefix!=0;
17020 while( nPad-- ) bufpt[i++] = '0';
17021 length = width;
17022 }
17023 #endif /* !defined(SQLITE_OMIT_FLOATING_POINT) */
 
 
17024 break;
17025 case etSIZE:
17026 *(va_arg(ap,int*)) = pAccum->nChar;
17027 length = width = 0;
17028 break;
@@ -17062,11 +17065,11 @@
17065 char q = ((xtype==etSQLESCAPE3)?'"':'\''); /* Quote character */
17066 char *escarg = va_arg(ap,char*);
17067 isnull = escarg==0;
17068 if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
17069 k = precision;
17070 for(i=n=0; k!=0 && (ch=escarg[i])!=0; i++, k--){
17071 if( ch==q ) n++;
17072 }
17073 needQuote = !isnull && xtype==etSQLESCAPE2;
17074 n += i + 1 + needQuote*2;
17075 if( n>etBUFSIZE ){
@@ -17345,30 +17348,40 @@
17348 sqlite3VXPrintf(&acc, 0, zFormat, ap);
17349 va_end(ap);
17350 z = sqlite3StrAccumFinish(&acc);
17351 return z;
17352 }
17353
17354 /*
17355 ** This is the routine that actually formats the sqlite3_log() message.
17356 ** We house it in a separate routine from sqlite3_log() to avoid using
17357 ** stack space on small-stack systems when logging is disabled.
17358 **
17359 ** sqlite3_log() must render into a static buffer. It cannot dynamically
17360 ** allocate memory because it might be called while the memory allocator
17361 ** mutex is held.
17362 */
17363 static void renderLogMsg(int iErrCode, const char *zFormat, va_list ap){
17364 StrAccum acc; /* String accumulator */
17365 char zMsg[SQLITE_PRINT_BUF_SIZE*3]; /* Complete log message */
17366
17367 sqlite3StrAccumInit(&acc, zMsg, sizeof(zMsg), 0);
17368 acc.useMalloc = 0;
17369 sqlite3VXPrintf(&acc, 0, zFormat, ap);
17370 sqlite3GlobalConfig.xLog(sqlite3GlobalConfig.pLogArg, iErrCode,
17371 sqlite3StrAccumFinish(&acc));
17372 }
17373
17374 /*
17375 ** Format and write a message to the log if logging is enabled.
17376 */
17377 SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...){
 
 
17378 va_list ap; /* Vararg list */
17379 if( sqlite3GlobalConfig.xLog ){
 
 
 
17380 va_start(ap, zFormat);
17381 renderLogMsg(iErrCode, zFormat, ap);
 
 
17382 va_end(ap);
 
 
 
17383 }
17384 }
17385
17386 #if defined(SQLITE_DEBUG)
17387 /*
@@ -19180,10 +19193,23 @@
19193 p[1] = (u8)(v & 0x7f);
19194 return 2;
19195 }
19196 return sqlite3PutVarint(p, v);
19197 }
19198
19199 /*
19200 ** Bitmasks used by sqlite3GetVarint(). These precomputed constants
19201 ** are defined here rather than simply putting the constant expressions
19202 ** inline in order to work around bugs in the RVT compiler.
19203 **
19204 ** SLOT_2_0 A mask for (0x7f<<14) | 0x7f
19205 **
19206 ** SLOT_4_2_0 A mask for (0x7f<<28) | SLOT_2_0
19207 */
19208 #define SLOT_2_0 0x001fc07f
19209 #define SLOT_4_2_0 0xf01fc07f
19210
19211
19212 /*
19213 ** Read a 64-bit variable-length integer from memory starting at p[0].
19214 ** Return the number of bytes read. The value is stored in *v.
19215 */
@@ -19208,33 +19234,37 @@
19234 a |= b;
19235 *v = a;
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) */
19247 if (!(a&0x80))
19248 {
19249 a &= SLOT_2_0;
19250 b &= 0x7f;
19251 b = b<<7;
19252 a |= b;
19253 *v = a;
19254 return 3;
19255 }
19256
19257 /* CSE1 from below */
19258 a &= SLOT_2_0;
19259 p++;
19260 b = b<<14;
19261 b |= *p;
19262 /* b: p1<<14 | p3 (unmasked) */
19263 if (!(b&0x80))
19264 {
19265 b &= SLOT_2_0;
19266 /* moved CSE1 up */
19267 /* a &= (0x7f<<14)|(0x7f); */
19268 a = a<<7;
19269 a |= b;
19270 *v = a;
@@ -19244,11 +19274,11 @@
19274 /* a: p0<<14 | p2 (masked) */
19275 /* b: p1<<14 | p3 (unmasked) */
19276 /* 1:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */
19277 /* moved CSE1 up */
19278 /* a &= (0x7f<<14)|(0x7f); */
19279 b &= SLOT_2_0;
19280 s = a;
19281 /* s: p0<<14 | p2 (masked) */
19282
19283 p++;
19284 a = a<<14;
@@ -19277,11 +19307,11 @@
19307 /* b: p1<<28 | p3<<14 | p5 (unmasked) */
19308 if (!(b&0x80))
19309 {
19310 /* we can skip this cause it was (effectively) done above in calc'ing s */
19311 /* b &= (0x7f<<28)|(0x7f<<14)|(0x7f); */
19312 a &= SLOT_2_0;
19313 a = a<<7;
19314 a |= b;
19315 s = s>>18;
19316 *v = ((u64)s)<<32 | a;
19317 return 6;
@@ -19291,28 +19321,28 @@
19321 a = a<<14;
19322 a |= *p;
19323 /* a: p2<<28 | p4<<14 | p6 (unmasked) */
19324 if (!(a&0x80))
19325 {
19326 a &= SLOT_4_2_0;
19327 b &= SLOT_2_0;
19328 b = b<<7;
19329 a |= b;
19330 s = s>>11;
19331 *v = ((u64)s)<<32 | a;
19332 return 7;
19333 }
19334
19335 /* CSE2 from below */
19336 a &= SLOT_2_0;
19337 p++;
19338 b = b<<14;
19339 b |= *p;
19340 /* b: p3<<28 | p5<<14 | p7 (unmasked) */
19341 if (!(b&0x80))
19342 {
19343 b &= SLOT_4_2_0;
19344 /* moved CSE2 up */
19345 /* a &= (0x7f<<14)|(0x7f); */
19346 a = a<<7;
19347 a |= b;
19348 s = s>>4;
@@ -19325,11 +19355,11 @@
19355 a |= *p;
19356 /* a: p4<<29 | p6<<15 | p8 (unmasked) */
19357
19358 /* moved CSE2 up */
19359 /* a &= (0x7f<<29)|(0x7f<<15)|(0xff); */
19360 b &= SLOT_2_0;
19361 b = b<<8;
19362 a |= b;
19363
19364 s = s<<4;
19365 b = p[-4];
@@ -19445,13 +19475,13 @@
19475 a = a<<14;
19476 a |= *p;
19477 /* a: p0<<28 | p2<<14 | p4 (unmasked) */
19478 if (!(a&0x80))
19479 {
19480 /* Values between 268435456 and 34359738367 */
19481 a &= SLOT_4_2_0;
19482 b &= SLOT_4_2_0;
19483 b = b<<7;
19484 *v = a | b;
19485 return 5;
19486 }
19487
@@ -21446,11 +21476,11 @@
21476 ** selection of the appropriate locking style based on the filesystem
21477 ** where the database is located.
21478 */
21479 #if !defined(SQLITE_ENABLE_LOCKING_STYLE)
21480 # if defined(__APPLE__)
21481 # define SQLITE_ENABLE_LOCKING_STYLE 0
21482 # else
21483 # define SQLITE_ENABLE_LOCKING_STYLE 0
21484 # endif
21485 #endif
21486
@@ -21511,10 +21541,13 @@
21541 # include <sys/file.h>
21542 # include <sys/param.h>
21543 # include <sys/mount.h>
21544 # endif
21545 #endif /* SQLITE_ENABLE_LOCKING_STYLE */
21546
21547 #ifdef __APPLE__
21548 #endif
21549
21550 /*
21551 ** Allowed values of unixFile.fsFlags
21552 */
21553 #define SQLITE_FSFLAGS_IS_MSDOS 0x1
@@ -23155,11 +23188,11 @@
23188 lock.l_type = F_UNLCK;
23189 lock.l_whence = SEEK_SET;
23190 lock.l_start = SHARED_FIRST;
23191 lock.l_len = divSize;
23192 if( fcntl(h, F_SETLK, &lock)==(-1) ){
23193 tErrno = errno;
23194 rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK);
23195 if( IS_LOCK_ERROR(rc) ){
23196 pFile->lastErrno = tErrno;
23197 }
23198 goto end_unlock;
@@ -23167,11 +23200,11 @@
23200 lock.l_type = F_RDLCK;
23201 lock.l_whence = SEEK_SET;
23202 lock.l_start = SHARED_FIRST;
23203 lock.l_len = divSize;
23204 if( fcntl(h, F_SETLK, &lock)==(-1) ){
23205 tErrno = errno;
23206 rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_RDLOCK);
23207 if( IS_LOCK_ERROR(rc) ){
23208 pFile->lastErrno = tErrno;
23209 }
23210 goto end_unlock;
@@ -23179,11 +23212,11 @@
23212 lock.l_type = F_UNLCK;
23213 lock.l_whence = SEEK_SET;
23214 lock.l_start = SHARED_FIRST+divSize;
23215 lock.l_len = SHARED_SIZE-divSize;
23216 if( fcntl(h, F_SETLK, &lock)==(-1) ){
23217 tErrno = errno;
23218 rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK);
23219 if( IS_LOCK_ERROR(rc) ){
23220 pFile->lastErrno = tErrno;
23221 }
23222 goto end_unlock;
@@ -23192,11 +23225,11 @@
23225 lock.l_type = F_RDLCK;
23226 lock.l_whence = SEEK_SET;
23227 lock.l_start = SHARED_FIRST;
23228 lock.l_len = SHARED_SIZE;
23229 if( fcntl(h, F_SETLK, &lock)==(-1) ){
23230 tErrno = errno;
23231 rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_RDLOCK);
23232 if( IS_LOCK_ERROR(rc) ){
23233 pFile->lastErrno = tErrno;
23234 }
23235 goto end_unlock;
@@ -26491,11 +26524,11 @@
26524 sqlite3_free(pNew);
26525 sqlite3_free(pUnused);
26526 return rc;
26527 }
26528
26529 #if defined(SQLITE_TEST) && defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
26530 /* simulate multiple hosts by creating unique hostid file paths */
26531 SQLITE_API int sqlite3_hostid_num = 0;
26532 #endif
26533
26534 #define PROXY_HOSTIDLEN 16 /* conch file host id length */
@@ -30169,10 +30202,11 @@
30202 SQLITE_PRIVATE void sqlite3PcacheSetPageSize(PCache *pCache, int szPage){
30203 assert( pCache->nRef==0 && pCache->pDirty==0 );
30204 if( pCache->pCache ){
30205 sqlite3GlobalConfig.pcache.xDestroy(pCache->pCache);
30206 pCache->pCache = 0;
30207 pCache->pPage1 = 0;
30208 }
30209 pCache->szPage = szPage;
30210 }
30211
30212 /*
@@ -43918,12 +43952,19 @@
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{
43963 memcpy(&aOvflSpace[iOff], apDiv[i], szNew[i]);
43964 apDiv[i] = &aOvflSpace[apDiv[i]-pParent->aData];
43965 }
43966 }
43967 dropCell(pParent, i+nxDiv-pParent->nOverflow, szNew[i], &rc);
43968 }
43969 }
43970
@@ -58617,11 +58658,13 @@
58658 ** an error of some kind.
58659 */
58660 vdbe_error_halt:
58661 assert( rc );
58662 p->rc = rc;
58663 testcase( sqlite3GlobalConfig.xLog!=0 );
58664 sqlite3_log(rc, "statement aborts at %d: [%s] %s",
58665 pc, p->zSql, p->zErrMsg);
58666 sqlite3VdbeHalt(p);
58667 if( rc==SQLITE_IOERR_NOMEM ) db->mallocFailed = 1;
58668 rc = SQLITE_ERROR;
58669 if( resetSchemaOnFault ) sqlite3ResetInternalSchema(db, 0);
58670
@@ -73606,12 +73649,12 @@
73649 FUNCTION(randomblob, 1, 0, 0, randomBlob ),
73650 FUNCTION(nullif, 2, 0, 1, nullifFunc ),
73651 FUNCTION(sqlite_version, 0, 0, 0, versionFunc ),
73652 FUNCTION(sqlite_source_id, 0, 0, 0, sourceidFunc ),
73653 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
73654 FUNCTION(sqlite_compileoption_used,1, 0, 0, compileoptionusedFunc ),
73655 FUNCTION(sqlite_compileoption_get, 1, 0, 0, compileoptiongetFunc ),
73656 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
73657 FUNCTION(quote, 1, 0, 0, quoteFunc ),
73658 FUNCTION(last_insert_rowid, 0, 0, 0, last_insert_rowid),
73659 FUNCTION(changes, 0, 0, 0, changes ),
73660 FUNCTION(total_changes, 0, 0, 0, total_changes ),
@@ -79179,22 +79222,14 @@
79222 #endif /* SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS */
79223
79224 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
79225 /*
79226 ** PRAGMA compile_options
 
79227 **
79228 ** Return the names of all compile-time options used in this build,
79229 ** one option per row.
 
 
79230 */
 
 
 
 
 
79231 if( sqlite3StrICmp(zLeft, "compile_options")==0 ){
79232 int i = 0;
79233 const char *zOpt;
79234 sqlite3VdbeSetNumCols(v, 1);
79235 pParse->nMem = 1;
@@ -86540,11 +86575,15 @@
86575 ** actually occurs when doing a vacuum since the vacuum_db is initially
86576 ** empty. Only the journal header is written. Apparently it takes more
86577 ** time to parse and run the PRAGMA to turn journalling off than it does
86578 ** to write the journal header file.
86579 */
86580 if( sqlite3TempInMemory(db) ){
86581 zSql = "ATTACH ':memory:' AS vacuum_db;";
86582 }else{
86583 zSql = "ATTACH '' AS vacuum_db;";
86584 }
86585 rc = execSql(db, pzErrMsg, zSql);
86586 if( rc!=SQLITE_OK ) goto end_of_vacuum;
86587 pDb = &db->aDb[db->nDb-1];
86588 assert( strcmp(db->aDb[db->nDb-1].zName,"vacuum_db")==0 );
86589 pTemp = db->aDb[db->nDb-1].pBt;
86590
+12 -6
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107107
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108108
** [sqlite_version()] and [sqlite_source_id()].
109109
*/
110110
#define SQLITE_VERSION "3.6.23"
111111
#define SQLITE_VERSION_NUMBER 3006023
112
-#define SQLITE_SOURCE_ID "2010-02-26 13:07:37 8f29490da62df07ea922b03cab52b6edd2669edb"
112
+#define SQLITE_SOURCE_ID "2010-03-04 22:36:45 1a0fa8d19d69d4ecaaaa879ac3c893980375fcc6"
113113
114114
/*
115115
** CAPI3REF: Run-Time Library Version Numbers
116116
** KEYWORDS: sqlite3_version, sqlite3_sourceid
117117
**
@@ -144,13 +144,13 @@
144144
SQLITE_API SQLITE_EXTERN const char sqlite3_version[];
145145
SQLITE_API const char *sqlite3_libversion(void);
146146
SQLITE_API const char *sqlite3_sourceid(void);
147147
SQLITE_API int sqlite3_libversion_number(void);
148148
149
+#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
149150
/*
150151
** CAPI3REF: Run-Time Library Compilation Options Diagnostics
151
-** KEYWORDS: sqlite3_compileoption_used, sqlite3_compileoption_get
152152
**
153153
** ^The sqlite3_compileoption_used() function returns 0 or 1
154154
** indicating whether the specified option was defined at
155155
** compile time. ^The SQLITE_ prefix may be omitted from the
156156
** option name passed to sqlite3_compileoption_used().
@@ -162,15 +162,15 @@
162162
** prefix is omitted from any strings returned by
163163
** sqlite3_compileoption_get().
164164
**
165165
** ^Support for the diagnostic functions sqlite3_compileoption_used()
166166
** and sqlite3_compileoption_get() may be omitted by specifing the
167
-** SQLITE_OMIT_COMPILEOPTION_DIAGS option at compile time.
167
+** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time.
168168
**
169
-** See also: [sqlite_compile_option_used()] and [sqlite_compile_option_get()].
169
+** See also: SQL functions [sqlite_compileoption_used()] and
170
+** [sqlite_compileoption_get()] and the [compile_options pragma].
170171
*/
171
-#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
172172
SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
173173
SQLITE_API const char *sqlite3_compileoption_get(int N);
174174
#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
175175
176176
/*
@@ -5698,20 +5698,26 @@
56985698
/*
56995699
** CAPI3REF: Error Logging Interface
57005700
** EXPERIMENTAL
57015701
**
57025702
** ^The [sqlite3_log()] interface writes a message into the error log
5703
-** established by the [SQLITE_CONFIG_ERRORLOG] option to [sqlite3_config()].
5703
+** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()].
57045704
** ^If logging is enabled, the zFormat string and subsequent arguments are
57055705
** passed through to [sqlite3_vmprintf()] to generate the final output string.
57065706
**
57075707
** The sqlite3_log() interface is intended for use by extensions such as
57085708
** virtual tables, collating functions, and SQL functions. While there is
57095709
** nothing to prevent an application from calling sqlite3_log(), doing so
57105710
** is considered bad form.
57115711
**
57125712
** The zFormat string must not be NULL.
5713
+**
5714
+** To avoid deadlocks and other threading problems, the sqlite3_log() routine
5715
+** will not use dynamically allocated memory. The log message is stored in
5716
+** a fixed-length buffer on the stack. If the log message is longer than
5717
+** a few hundred characters, it will be truncated to the length of the
5718
+** buffer.
57135719
*/
57145720
SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
57155721
57165722
/*
57175723
** Undo the hack that converts floating point types to integer for
57185724
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.6.23"
111 #define SQLITE_VERSION_NUMBER 3006023
112 #define SQLITE_SOURCE_ID "2010-02-26 13:07:37 8f29490da62df07ea922b03cab52b6edd2669edb"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
@@ -144,13 +144,13 @@
144 SQLITE_API SQLITE_EXTERN const char sqlite3_version[];
145 SQLITE_API const char *sqlite3_libversion(void);
146 SQLITE_API const char *sqlite3_sourceid(void);
147 SQLITE_API int sqlite3_libversion_number(void);
148
 
149 /*
150 ** CAPI3REF: Run-Time Library Compilation Options Diagnostics
151 ** KEYWORDS: sqlite3_compileoption_used, sqlite3_compileoption_get
152 **
153 ** ^The sqlite3_compileoption_used() function returns 0 or 1
154 ** indicating whether the specified option was defined at
155 ** compile time. ^The SQLITE_ prefix may be omitted from the
156 ** option name passed to sqlite3_compileoption_used().
@@ -162,15 +162,15 @@
162 ** prefix is omitted from any strings returned by
163 ** sqlite3_compileoption_get().
164 **
165 ** ^Support for the diagnostic functions sqlite3_compileoption_used()
166 ** and sqlite3_compileoption_get() may be omitted by specifing the
167 ** SQLITE_OMIT_COMPILEOPTION_DIAGS option at compile time.
168 **
169 ** See also: [sqlite_compile_option_used()] and [sqlite_compile_option_get()].
 
170 */
171 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
172 SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
173 SQLITE_API const char *sqlite3_compileoption_get(int N);
174 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
175
176 /*
@@ -5698,20 +5698,26 @@
5698 /*
5699 ** CAPI3REF: Error Logging Interface
5700 ** EXPERIMENTAL
5701 **
5702 ** ^The [sqlite3_log()] interface writes a message into the error log
5703 ** established by the [SQLITE_CONFIG_ERRORLOG] option to [sqlite3_config()].
5704 ** ^If logging is enabled, the zFormat string and subsequent arguments are
5705 ** passed through to [sqlite3_vmprintf()] to generate the final output string.
5706 **
5707 ** The sqlite3_log() interface is intended for use by extensions such as
5708 ** virtual tables, collating functions, and SQL functions. While there is
5709 ** nothing to prevent an application from calling sqlite3_log(), doing so
5710 ** is considered bad form.
5711 **
5712 ** The zFormat string must not be NULL.
 
 
 
 
 
 
5713 */
5714 SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
5715
5716 /*
5717 ** Undo the hack that converts floating point types to integer for
5718
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.6.23"
111 #define SQLITE_VERSION_NUMBER 3006023
112 #define SQLITE_SOURCE_ID "2010-03-04 22:36:45 1a0fa8d19d69d4ecaaaa879ac3c893980375fcc6"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
@@ -144,13 +144,13 @@
144 SQLITE_API SQLITE_EXTERN const char sqlite3_version[];
145 SQLITE_API const char *sqlite3_libversion(void);
146 SQLITE_API const char *sqlite3_sourceid(void);
147 SQLITE_API int sqlite3_libversion_number(void);
148
149 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
150 /*
151 ** CAPI3REF: Run-Time Library Compilation Options Diagnostics
 
152 **
153 ** ^The sqlite3_compileoption_used() function returns 0 or 1
154 ** indicating whether the specified option was defined at
155 ** compile time. ^The SQLITE_ prefix may be omitted from the
156 ** option name passed to sqlite3_compileoption_used().
@@ -162,15 +162,15 @@
162 ** prefix is omitted from any strings returned by
163 ** sqlite3_compileoption_get().
164 **
165 ** ^Support for the diagnostic functions sqlite3_compileoption_used()
166 ** and sqlite3_compileoption_get() may be omitted by specifing the
167 ** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time.
168 **
169 ** See also: SQL functions [sqlite_compileoption_used()] and
170 ** [sqlite_compileoption_get()] and the [compile_options pragma].
171 */
 
172 SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
173 SQLITE_API const char *sqlite3_compileoption_get(int N);
174 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
175
176 /*
@@ -5698,20 +5698,26 @@
5698 /*
5699 ** CAPI3REF: Error Logging Interface
5700 ** EXPERIMENTAL
5701 **
5702 ** ^The [sqlite3_log()] interface writes a message into the error log
5703 ** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()].
5704 ** ^If logging is enabled, the zFormat string and subsequent arguments are
5705 ** passed through to [sqlite3_vmprintf()] to generate the final output string.
5706 **
5707 ** The sqlite3_log() interface is intended for use by extensions such as
5708 ** virtual tables, collating functions, and SQL functions. While there is
5709 ** nothing to prevent an application from calling sqlite3_log(), doing so
5710 ** is considered bad form.
5711 **
5712 ** The zFormat string must not be NULL.
5713 **
5714 ** To avoid deadlocks and other threading problems, the sqlite3_log() routine
5715 ** will not use dynamically allocated memory. The log message is stored in
5716 ** a fixed-length buffer on the stack. If the log message is longer than
5717 ** a few hundred characters, it will be truncated to the length of the
5718 ** buffer.
5719 */
5720 SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
5721
5722 /*
5723 ** Undo the hack that converts floating point types to integer for
5724

Keyboard Shortcuts

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