Fossil SCM

Bring in the latest SQLite version 3.7.16 beta from upstream for testing.

drh 2013-03-11 21:40 trunk
Commit d586f2edfc0ffd8784dfb2743d848fe4ba1b76d0
2 files changed +70 -39 +1 -1
+70 -39
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -304,10 +304,14 @@
304304
/* Needed for various definitions... */
305305
#ifndef _GNU_SOURCE
306306
# define _GNU_SOURCE
307307
#endif
308308
309
+#if defined(__OpenBSD__) && !defined(_BSD_SOURCE)
310
+# define _BSD_SOURCE
311
+#endif
312
+
309313
/*
310314
** Include standard header files as necessary
311315
*/
312316
#ifdef HAVE_STDINT_H
313317
#include <stdint.h>
@@ -674,11 +678,11 @@
674678
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
675679
** [sqlite_version()] and [sqlite_source_id()].
676680
*/
677681
#define SQLITE_VERSION "3.7.16"
678682
#define SQLITE_VERSION_NUMBER 3007016
679
-#define SQLITE_SOURCE_ID "2013-03-06 01:55:27 7097241c1220ada318f8eda938c3e3430b94a606"
683
+#define SQLITE_SOURCE_ID "2013-03-11 13:37:52 f9027cb47bdec8dcebf1f038921b28d9e9928c18"
680684
681685
/*
682686
** CAPI3REF: Run-Time Library Version Numbers
683687
** KEYWORDS: sqlite3_version, sqlite3_sourceid
684688
**
@@ -48402,10 +48406,29 @@
4840248406
** is empty, the offset should be 65536, but the 2-byte value stores zero.
4840348407
** This routine makes the necessary adjustment to 65536.
4840448408
*/
4840548409
#define get2byteNotZero(X) (((((int)get2byte(X))-1)&0xffff)+1)
4840648410
48411
+/*
48412
+** Values passed as the 5th argument to allocateBtreePage()
48413
+*/
48414
+#define BTALLOC_ANY 0 /* Allocate any page */
48415
+#define BTALLOC_EXACT 1 /* Allocate exact page if possible */
48416
+#define BTALLOC_LE 2 /* Allocate any page <= the parameter */
48417
+
48418
+/*
48419
+** Macro IfNotOmitAV(x) returns (x) if SQLITE_OMIT_AUTOVACUUM is not
48420
+** defined, or 0 if it is. For example:
48421
+**
48422
+** bIncrVacuum = IfNotOmitAV(pBtShared->incrVacuum);
48423
+*/
48424
+#ifndef SQLITE_OMIT_AUTOVACUUM
48425
+#define IfNotOmitAV(expr) (expr)
48426
+#else
48427
+#define IfNotOmitAV(expr) 0
48428
+#endif
48429
+
4840748430
#ifndef SQLITE_OMIT_SHARED_CACHE
4840848431
/*
4840948432
** A list of BtShared objects that are eligible for participation
4841048433
** in shared cache. This variable has file scope during normal builds,
4841148434
** but the test harness needs to access it so we make it global for
@@ -50954,11 +50977,11 @@
5095450977
** is requested, this is a no-op.
5095550978
*/
5095650979
if( p->inTrans==TRANS_WRITE || (p->inTrans==TRANS_READ && !wrflag) ){
5095750980
goto trans_begun;
5095850981
}
50959
- assert( pBt->bDoTruncate==0 );
50982
+ assert( IfNotOmitAV(pBt->bDoTruncate)==0 );
5096050983
5096150984
/* Write transactions are not possible on a read-only database */
5096250985
if( (pBt->btsFlags & BTS_READ_ONLY)!=0 && wrflag ){
5096350986
rc = SQLITE_READONLY;
5096450987
goto trans_begun;
@@ -51269,13 +51292,10 @@
5126951292
return rc;
5127051293
}
5127151294
5127251295
/* Forward declaration required by incrVacuumStep(). */
5127351296
static int allocateBtreePage(BtShared *, MemPage **, Pgno *, Pgno, u8);
51274
-#define BTALLOC_ANY 0 /* Allocate any page */
51275
-#define BTALLOC_EXACT 1 /* Allocate exact page if possible */
51276
-#define BTALLOC_LE 2 /* Allocate any page <= the parameter */
5127751297
5127851298
/*
5127951299
** Perform a single step of an incremental-vacuum. If successful, return
5128051300
** SQLITE_OK. If there is no work to do (and therefore no point in
5128151301
** calling this function again), return SQLITE_DONE. Or, if an error
@@ -53261,11 +53281,11 @@
5326153281
MemPage *pTrunk = 0;
5326253282
MemPage *pPrevTrunk = 0;
5326353283
Pgno mxPage; /* Total size of the database file */
5326453284
5326553285
assert( sqlite3_mutex_held(pBt->mutex) );
53266
- assert( eMode==BTALLOC_ANY || (nearby>0 && pBt->autoVacuum) );
53286
+ assert( eMode==BTALLOC_ANY || (nearby>0 && IfNotOmitAV(pBt->autoVacuum)) );
5326753287
pPage1 = pBt->pPage1;
5326853288
mxPage = btreePagecount(pBt);
5326953289
n = get4byte(&pPage1->aData[36]);
5327053290
testcase( n==mxPage-1 );
5327153291
if( n>=mxPage ){
@@ -53494,11 +53514,11 @@
5349453514
** content for any page that really does lie past the end of the database
5349553515
** file on disk. So the effects of disabling the no-content optimization
5349653516
** here are confined to those pages that lie between the end of the
5349753517
** database image and the end of the database file.
5349853518
*/
53499
- int bNoContent = (0==pBt->bDoTruncate);
53519
+ int bNoContent = (0==IfNotOmitAV(pBt->bDoTruncate));
5350053520
5350153521
rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);
5350253522
if( rc ) return rc;
5350353523
pBt->nPage++;
5350453524
if( pBt->nPage==PENDING_BYTE_PAGE(pBt) ) pBt->nPage++;
@@ -57554,11 +57574,13 @@
5755457574
** SQLITE_OK is returned if the conversion is successful (or not required).
5755557575
** SQLITE_NOMEM may be returned if a malloc() fails during conversion
5755657576
** between formats.
5755757577
*/
5755857578
SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){
57579
+#ifndef SQLITE_OMIT_UTF16
5755957580
int rc;
57581
+#endif
5756057582
assert( (pMem->flags&MEM_RowSet)==0 );
5756157583
assert( desiredEnc==SQLITE_UTF8 || desiredEnc==SQLITE_UTF16LE
5756257584
|| desiredEnc==SQLITE_UTF16BE );
5756357585
if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){
5756457586
return SQLITE_OK;
@@ -85357,34 +85379,32 @@
8535785379
Table *pView, /* View definition */
8535885380
Expr *pWhere, /* Optional WHERE clause to be added */
8535985381
int iCur /* Cursor number for ephemerial table */
8536085382
){
8536185383
SelectDest dest;
85362
- Select *pDup;
85384
+ Select *pSel;
85385
+ SrcList *pFrom;
8536385386
sqlite3 *db = pParse->db;
85364
-
85365
- pDup = sqlite3SelectDup(db, pView->pSelect, 0);
85366
- if( pWhere ){
85367
- SrcList *pFrom;
85368
-
85369
- pWhere = sqlite3ExprDup(db, pWhere, 0);
85370
- pFrom = sqlite3SrcListAppend(db, 0, 0, 0);
85371
- if( pFrom ){
85372
- assert( pFrom->nSrc==1 );
85373
- pFrom->a[0].zAlias = sqlite3DbStrDup(db, pView->zName);
85374
- pFrom->a[0].pSelect = pDup;
85375
- assert( pFrom->a[0].pOn==0 );
85376
- assert( pFrom->a[0].pUsing==0 );
85377
- }else{
85378
- sqlite3SelectDelete(db, pDup);
85379
- }
85380
- pDup = sqlite3SelectNew(pParse, 0, pFrom, pWhere, 0, 0, 0, 0, 0, 0);
85381
- if( pDup ) pDup->selFlags |= SF_Materialize;
85382
- }
85387
+ int iDb = sqlite3SchemaToIndex(db, pView->pSchema);
85388
+
85389
+ pWhere = sqlite3ExprDup(db, pWhere, 0);
85390
+ pFrom = sqlite3SrcListAppend(db, 0, 0, 0);
85391
+
85392
+ if( pFrom ){
85393
+ assert( pFrom->nSrc==1 );
85394
+ pFrom->a[0].zName = sqlite3DbStrDup(db, pView->zName);
85395
+ pFrom->a[0].zDatabase = sqlite3DbStrDup(db, db->aDb[iDb].zName);
85396
+ assert( pFrom->a[0].pOn==0 );
85397
+ assert( pFrom->a[0].pUsing==0 );
85398
+ }
85399
+
85400
+ pSel = sqlite3SelectNew(pParse, 0, pFrom, pWhere, 0, 0, 0, 0, 0, 0);
85401
+ if( pSel ) pSel->selFlags |= SF_Materialize;
85402
+
8538385403
sqlite3SelectDestInit(&dest, SRT_EphemTab, iCur);
85384
- sqlite3Select(pParse, pDup, &dest);
85385
- sqlite3SelectDelete(db, pDup);
85404
+ sqlite3Select(pParse, pSel, &dest);
85405
+ sqlite3SelectDelete(db, pSel);
8538685406
}
8538785407
#endif /* !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) */
8538885408
8538985409
#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
8539085410
/*
@@ -86918,22 +86938,27 @@
8691886938
sqlite3_int64 x;
8691986939
unsigned c;
8692086940
x = sqlite3_value_int64(argv[i]);
8692186941
if( x<0 || x>0x10ffff ) x = 0xfffd;
8692286942
c = (unsigned)(x & 0x1fffff);
86923
- if( c<=0xFFFF ){
86924
- if( c>=0xd800 && c<=0xdfff ) c = 0xfffd;
86925
- *zOut++ = (u8)(c&0x00FF);
86926
- *zOut++ = (u8)((c>>8)&0x00FF);
86943
+ if( c<0x00080 ){
86944
+ *zOut++ = (u8)(c&0xFF);
86945
+ }else if( c<0x00800 ){
86946
+ *zOut++ = 0xC0 + (u8)((c>>6)&0x1F);
86947
+ *zOut++ = 0x80 + (u8)(c & 0x3F);
86948
+ }else if( c<0x10000 ){
86949
+ *zOut++ = 0xE0 + (u8)((c>>12)&0x0F);
86950
+ *zOut++ = 0x80 + (u8)((c>>6) & 0x3F);
86951
+ *zOut++ = 0x80 + (u8)(c & 0x3F);
8692786952
}else{
86928
- *zOut++ = (u8)(((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0));
86929
- *zOut++ = (u8)(0x00D8 + (((c-0x10000)>>18)&0x03));
86930
- *zOut++ = (u8)(c&0x00FF);
86931
- *zOut++ = (u8)(0x00DC + ((c>>8)&0x03));
86932
- }
86953
+ *zOut++ = 0xF0 + (u8)((c>>18) & 0x07);
86954
+ *zOut++ = 0x80 + (u8)((c>>12) & 0x3F);
86955
+ *zOut++ = 0x80 + (u8)((c>>6) & 0x3F);
86956
+ *zOut++ = 0x80 + (u8)(c & 0x3F);
86957
+ } \
8693386958
}
86934
- sqlite3_result_text16le(context, (char*)z, (int)(zOut-z), sqlite3_free);
86959
+ sqlite3_result_text(context, (char*)z, (int)(zOut-z), sqlite3_free);
8693586960
}
8693686961
8693786962
/*
8693886963
** The hex() function. Interpret the argument as a blob. Return
8693986964
** a hexadecimal rendering as text.
@@ -93197,10 +93222,11 @@
9319793222
}
9319893223
}else
9319993224
#endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */
9320093225
9320193226
#ifndef SQLITE_OMIT_FOREIGN_KEY
93227
+#ifndef SQLITE_OMIT_TRIGGER
9320293228
if( sqlite3StrICmp(zLeft, "foreign_key_check")==0 ){
9320393229
FKey *pFK; /* A foreign key constraint */
9320493230
Table *pTab; /* Child table contain "REFERENCES" keyword */
9320593231
Table *pParent; /* Parent table that child points to */
9320693232
Index *pIdx; /* Index in the parent table */
@@ -93308,10 +93334,11 @@
9330893334
}
9330993335
sqlite3VdbeAddOp2(v, OP_Next, 0, addrTop+1);
9331093336
sqlite3VdbeJumpHere(v, addrTop);
9331193337
}
9331293338
}else
93339
+#endif /* !defined(SQLITE_OMIT_TRIGGER) */
9331393340
#endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */
9331493341
9331593342
#ifndef NDEBUG
9331693343
if( sqlite3StrICmp(zLeft, "parser_trace")==0 ){
9331793344
if( zRight ){
@@ -94104,15 +94131,19 @@
9410494131
** For an attached db, it is an error if the encoding is not the same
9410594132
** as sqlite3.enc.
9410694133
*/
9410794134
if( meta[BTREE_TEXT_ENCODING-1] ){ /* text encoding */
9410894135
if( iDb==0 ){
94136
+#ifndef SQLITE_OMIT_UTF16
9410994137
u8 encoding;
9411094138
/* If opening the main database, set ENC(db). */
9411194139
encoding = (u8)meta[BTREE_TEXT_ENCODING-1] & 3;
9411294140
if( encoding==0 ) encoding = SQLITE_UTF8;
9411394141
ENC(db) = encoding;
94142
+#else
94143
+ ENC(db) = SQLITE_UTF8;
94144
+#endif
9411494145
}else{
9411594146
/* If opening an attached database, the encoding much match ENC(db) */
9411694147
if( meta[BTREE_TEXT_ENCODING-1]!=ENC(db) ){
9411794148
sqlite3SetString(pzErrMsg, db, "attached databases must use the same"
9411894149
" text encoding as main database");
9411994150
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -304,10 +304,14 @@
304 /* Needed for various definitions... */
305 #ifndef _GNU_SOURCE
306 # define _GNU_SOURCE
307 #endif
308
 
 
 
 
309 /*
310 ** Include standard header files as necessary
311 */
312 #ifdef HAVE_STDINT_H
313 #include <stdint.h>
@@ -674,11 +678,11 @@
674 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
675 ** [sqlite_version()] and [sqlite_source_id()].
676 */
677 #define SQLITE_VERSION "3.7.16"
678 #define SQLITE_VERSION_NUMBER 3007016
679 #define SQLITE_SOURCE_ID "2013-03-06 01:55:27 7097241c1220ada318f8eda938c3e3430b94a606"
680
681 /*
682 ** CAPI3REF: Run-Time Library Version Numbers
683 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
684 **
@@ -48402,10 +48406,29 @@
48402 ** is empty, the offset should be 65536, but the 2-byte value stores zero.
48403 ** This routine makes the necessary adjustment to 65536.
48404 */
48405 #define get2byteNotZero(X) (((((int)get2byte(X))-1)&0xffff)+1)
48406
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48407 #ifndef SQLITE_OMIT_SHARED_CACHE
48408 /*
48409 ** A list of BtShared objects that are eligible for participation
48410 ** in shared cache. This variable has file scope during normal builds,
48411 ** but the test harness needs to access it so we make it global for
@@ -50954,11 +50977,11 @@
50954 ** is requested, this is a no-op.
50955 */
50956 if( p->inTrans==TRANS_WRITE || (p->inTrans==TRANS_READ && !wrflag) ){
50957 goto trans_begun;
50958 }
50959 assert( pBt->bDoTruncate==0 );
50960
50961 /* Write transactions are not possible on a read-only database */
50962 if( (pBt->btsFlags & BTS_READ_ONLY)!=0 && wrflag ){
50963 rc = SQLITE_READONLY;
50964 goto trans_begun;
@@ -51269,13 +51292,10 @@
51269 return rc;
51270 }
51271
51272 /* Forward declaration required by incrVacuumStep(). */
51273 static int allocateBtreePage(BtShared *, MemPage **, Pgno *, Pgno, u8);
51274 #define BTALLOC_ANY 0 /* Allocate any page */
51275 #define BTALLOC_EXACT 1 /* Allocate exact page if possible */
51276 #define BTALLOC_LE 2 /* Allocate any page <= the parameter */
51277
51278 /*
51279 ** Perform a single step of an incremental-vacuum. If successful, return
51280 ** SQLITE_OK. If there is no work to do (and therefore no point in
51281 ** calling this function again), return SQLITE_DONE. Or, if an error
@@ -53261,11 +53281,11 @@
53261 MemPage *pTrunk = 0;
53262 MemPage *pPrevTrunk = 0;
53263 Pgno mxPage; /* Total size of the database file */
53264
53265 assert( sqlite3_mutex_held(pBt->mutex) );
53266 assert( eMode==BTALLOC_ANY || (nearby>0 && pBt->autoVacuum) );
53267 pPage1 = pBt->pPage1;
53268 mxPage = btreePagecount(pBt);
53269 n = get4byte(&pPage1->aData[36]);
53270 testcase( n==mxPage-1 );
53271 if( n>=mxPage ){
@@ -53494,11 +53514,11 @@
53494 ** content for any page that really does lie past the end of the database
53495 ** file on disk. So the effects of disabling the no-content optimization
53496 ** here are confined to those pages that lie between the end of the
53497 ** database image and the end of the database file.
53498 */
53499 int bNoContent = (0==pBt->bDoTruncate);
53500
53501 rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);
53502 if( rc ) return rc;
53503 pBt->nPage++;
53504 if( pBt->nPage==PENDING_BYTE_PAGE(pBt) ) pBt->nPage++;
@@ -57554,11 +57574,13 @@
57554 ** SQLITE_OK is returned if the conversion is successful (or not required).
57555 ** SQLITE_NOMEM may be returned if a malloc() fails during conversion
57556 ** between formats.
57557 */
57558 SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){
 
57559 int rc;
 
57560 assert( (pMem->flags&MEM_RowSet)==0 );
57561 assert( desiredEnc==SQLITE_UTF8 || desiredEnc==SQLITE_UTF16LE
57562 || desiredEnc==SQLITE_UTF16BE );
57563 if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){
57564 return SQLITE_OK;
@@ -85357,34 +85379,32 @@
85357 Table *pView, /* View definition */
85358 Expr *pWhere, /* Optional WHERE clause to be added */
85359 int iCur /* Cursor number for ephemerial table */
85360 ){
85361 SelectDest dest;
85362 Select *pDup;
 
85363 sqlite3 *db = pParse->db;
85364
85365 pDup = sqlite3SelectDup(db, pView->pSelect, 0);
85366 if( pWhere ){
85367 SrcList *pFrom;
85368
85369 pWhere = sqlite3ExprDup(db, pWhere, 0);
85370 pFrom = sqlite3SrcListAppend(db, 0, 0, 0);
85371 if( pFrom ){
85372 assert( pFrom->nSrc==1 );
85373 pFrom->a[0].zAlias = sqlite3DbStrDup(db, pView->zName);
85374 pFrom->a[0].pSelect = pDup;
85375 assert( pFrom->a[0].pOn==0 );
85376 assert( pFrom->a[0].pUsing==0 );
85377 }else{
85378 sqlite3SelectDelete(db, pDup);
85379 }
85380 pDup = sqlite3SelectNew(pParse, 0, pFrom, pWhere, 0, 0, 0, 0, 0, 0);
85381 if( pDup ) pDup->selFlags |= SF_Materialize;
85382 }
85383 sqlite3SelectDestInit(&dest, SRT_EphemTab, iCur);
85384 sqlite3Select(pParse, pDup, &dest);
85385 sqlite3SelectDelete(db, pDup);
85386 }
85387 #endif /* !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) */
85388
85389 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
85390 /*
@@ -86918,22 +86938,27 @@
86918 sqlite3_int64 x;
86919 unsigned c;
86920 x = sqlite3_value_int64(argv[i]);
86921 if( x<0 || x>0x10ffff ) x = 0xfffd;
86922 c = (unsigned)(x & 0x1fffff);
86923 if( c<=0xFFFF ){
86924 if( c>=0xd800 && c<=0xdfff ) c = 0xfffd;
86925 *zOut++ = (u8)(c&0x00FF);
86926 *zOut++ = (u8)((c>>8)&0x00FF);
 
 
 
 
 
86927 }else{
86928 *zOut++ = (u8)(((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0));
86929 *zOut++ = (u8)(0x00D8 + (((c-0x10000)>>18)&0x03));
86930 *zOut++ = (u8)(c&0x00FF);
86931 *zOut++ = (u8)(0x00DC + ((c>>8)&0x03));
86932 }
86933 }
86934 sqlite3_result_text16le(context, (char*)z, (int)(zOut-z), sqlite3_free);
86935 }
86936
86937 /*
86938 ** The hex() function. Interpret the argument as a blob. Return
86939 ** a hexadecimal rendering as text.
@@ -93197,10 +93222,11 @@
93197 }
93198 }else
93199 #endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */
93200
93201 #ifndef SQLITE_OMIT_FOREIGN_KEY
 
93202 if( sqlite3StrICmp(zLeft, "foreign_key_check")==0 ){
93203 FKey *pFK; /* A foreign key constraint */
93204 Table *pTab; /* Child table contain "REFERENCES" keyword */
93205 Table *pParent; /* Parent table that child points to */
93206 Index *pIdx; /* Index in the parent table */
@@ -93308,10 +93334,11 @@
93308 }
93309 sqlite3VdbeAddOp2(v, OP_Next, 0, addrTop+1);
93310 sqlite3VdbeJumpHere(v, addrTop);
93311 }
93312 }else
 
93313 #endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */
93314
93315 #ifndef NDEBUG
93316 if( sqlite3StrICmp(zLeft, "parser_trace")==0 ){
93317 if( zRight ){
@@ -94104,15 +94131,19 @@
94104 ** For an attached db, it is an error if the encoding is not the same
94105 ** as sqlite3.enc.
94106 */
94107 if( meta[BTREE_TEXT_ENCODING-1] ){ /* text encoding */
94108 if( iDb==0 ){
 
94109 u8 encoding;
94110 /* If opening the main database, set ENC(db). */
94111 encoding = (u8)meta[BTREE_TEXT_ENCODING-1] & 3;
94112 if( encoding==0 ) encoding = SQLITE_UTF8;
94113 ENC(db) = encoding;
 
 
 
94114 }else{
94115 /* If opening an attached database, the encoding much match ENC(db) */
94116 if( meta[BTREE_TEXT_ENCODING-1]!=ENC(db) ){
94117 sqlite3SetString(pzErrMsg, db, "attached databases must use the same"
94118 " text encoding as main database");
94119
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -304,10 +304,14 @@
304 /* Needed for various definitions... */
305 #ifndef _GNU_SOURCE
306 # define _GNU_SOURCE
307 #endif
308
309 #if defined(__OpenBSD__) && !defined(_BSD_SOURCE)
310 # define _BSD_SOURCE
311 #endif
312
313 /*
314 ** Include standard header files as necessary
315 */
316 #ifdef HAVE_STDINT_H
317 #include <stdint.h>
@@ -674,11 +678,11 @@
678 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
679 ** [sqlite_version()] and [sqlite_source_id()].
680 */
681 #define SQLITE_VERSION "3.7.16"
682 #define SQLITE_VERSION_NUMBER 3007016
683 #define SQLITE_SOURCE_ID "2013-03-11 13:37:52 f9027cb47bdec8dcebf1f038921b28d9e9928c18"
684
685 /*
686 ** CAPI3REF: Run-Time Library Version Numbers
687 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
688 **
@@ -48402,10 +48406,29 @@
48406 ** is empty, the offset should be 65536, but the 2-byte value stores zero.
48407 ** This routine makes the necessary adjustment to 65536.
48408 */
48409 #define get2byteNotZero(X) (((((int)get2byte(X))-1)&0xffff)+1)
48410
48411 /*
48412 ** Values passed as the 5th argument to allocateBtreePage()
48413 */
48414 #define BTALLOC_ANY 0 /* Allocate any page */
48415 #define BTALLOC_EXACT 1 /* Allocate exact page if possible */
48416 #define BTALLOC_LE 2 /* Allocate any page <= the parameter */
48417
48418 /*
48419 ** Macro IfNotOmitAV(x) returns (x) if SQLITE_OMIT_AUTOVACUUM is not
48420 ** defined, or 0 if it is. For example:
48421 **
48422 ** bIncrVacuum = IfNotOmitAV(pBtShared->incrVacuum);
48423 */
48424 #ifndef SQLITE_OMIT_AUTOVACUUM
48425 #define IfNotOmitAV(expr) (expr)
48426 #else
48427 #define IfNotOmitAV(expr) 0
48428 #endif
48429
48430 #ifndef SQLITE_OMIT_SHARED_CACHE
48431 /*
48432 ** A list of BtShared objects that are eligible for participation
48433 ** in shared cache. This variable has file scope during normal builds,
48434 ** but the test harness needs to access it so we make it global for
@@ -50954,11 +50977,11 @@
50977 ** is requested, this is a no-op.
50978 */
50979 if( p->inTrans==TRANS_WRITE || (p->inTrans==TRANS_READ && !wrflag) ){
50980 goto trans_begun;
50981 }
50982 assert( IfNotOmitAV(pBt->bDoTruncate)==0 );
50983
50984 /* Write transactions are not possible on a read-only database */
50985 if( (pBt->btsFlags & BTS_READ_ONLY)!=0 && wrflag ){
50986 rc = SQLITE_READONLY;
50987 goto trans_begun;
@@ -51269,13 +51292,10 @@
51292 return rc;
51293 }
51294
51295 /* Forward declaration required by incrVacuumStep(). */
51296 static int allocateBtreePage(BtShared *, MemPage **, Pgno *, Pgno, u8);
 
 
 
51297
51298 /*
51299 ** Perform a single step of an incremental-vacuum. If successful, return
51300 ** SQLITE_OK. If there is no work to do (and therefore no point in
51301 ** calling this function again), return SQLITE_DONE. Or, if an error
@@ -53261,11 +53281,11 @@
53281 MemPage *pTrunk = 0;
53282 MemPage *pPrevTrunk = 0;
53283 Pgno mxPage; /* Total size of the database file */
53284
53285 assert( sqlite3_mutex_held(pBt->mutex) );
53286 assert( eMode==BTALLOC_ANY || (nearby>0 && IfNotOmitAV(pBt->autoVacuum)) );
53287 pPage1 = pBt->pPage1;
53288 mxPage = btreePagecount(pBt);
53289 n = get4byte(&pPage1->aData[36]);
53290 testcase( n==mxPage-1 );
53291 if( n>=mxPage ){
@@ -53494,11 +53514,11 @@
53514 ** content for any page that really does lie past the end of the database
53515 ** file on disk. So the effects of disabling the no-content optimization
53516 ** here are confined to those pages that lie between the end of the
53517 ** database image and the end of the database file.
53518 */
53519 int bNoContent = (0==IfNotOmitAV(pBt->bDoTruncate));
53520
53521 rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);
53522 if( rc ) return rc;
53523 pBt->nPage++;
53524 if( pBt->nPage==PENDING_BYTE_PAGE(pBt) ) pBt->nPage++;
@@ -57554,11 +57574,13 @@
57574 ** SQLITE_OK is returned if the conversion is successful (or not required).
57575 ** SQLITE_NOMEM may be returned if a malloc() fails during conversion
57576 ** between formats.
57577 */
57578 SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){
57579 #ifndef SQLITE_OMIT_UTF16
57580 int rc;
57581 #endif
57582 assert( (pMem->flags&MEM_RowSet)==0 );
57583 assert( desiredEnc==SQLITE_UTF8 || desiredEnc==SQLITE_UTF16LE
57584 || desiredEnc==SQLITE_UTF16BE );
57585 if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){
57586 return SQLITE_OK;
@@ -85357,34 +85379,32 @@
85379 Table *pView, /* View definition */
85380 Expr *pWhere, /* Optional WHERE clause to be added */
85381 int iCur /* Cursor number for ephemerial table */
85382 ){
85383 SelectDest dest;
85384 Select *pSel;
85385 SrcList *pFrom;
85386 sqlite3 *db = pParse->db;
85387 int iDb = sqlite3SchemaToIndex(db, pView->pSchema);
85388
85389 pWhere = sqlite3ExprDup(db, pWhere, 0);
85390 pFrom = sqlite3SrcListAppend(db, 0, 0, 0);
85391
85392 if( pFrom ){
85393 assert( pFrom->nSrc==1 );
85394 pFrom->a[0].zName = sqlite3DbStrDup(db, pView->zName);
85395 pFrom->a[0].zDatabase = sqlite3DbStrDup(db, db->aDb[iDb].zName);
85396 assert( pFrom->a[0].pOn==0 );
85397 assert( pFrom->a[0].pUsing==0 );
85398 }
85399
85400 pSel = sqlite3SelectNew(pParse, 0, pFrom, pWhere, 0, 0, 0, 0, 0, 0);
85401 if( pSel ) pSel->selFlags |= SF_Materialize;
85402
 
 
 
85403 sqlite3SelectDestInit(&dest, SRT_EphemTab, iCur);
85404 sqlite3Select(pParse, pSel, &dest);
85405 sqlite3SelectDelete(db, pSel);
85406 }
85407 #endif /* !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) */
85408
85409 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
85410 /*
@@ -86918,22 +86938,27 @@
86938 sqlite3_int64 x;
86939 unsigned c;
86940 x = sqlite3_value_int64(argv[i]);
86941 if( x<0 || x>0x10ffff ) x = 0xfffd;
86942 c = (unsigned)(x & 0x1fffff);
86943 if( c<0x00080 ){
86944 *zOut++ = (u8)(c&0xFF);
86945 }else if( c<0x00800 ){
86946 *zOut++ = 0xC0 + (u8)((c>>6)&0x1F);
86947 *zOut++ = 0x80 + (u8)(c & 0x3F);
86948 }else if( c<0x10000 ){
86949 *zOut++ = 0xE0 + (u8)((c>>12)&0x0F);
86950 *zOut++ = 0x80 + (u8)((c>>6) & 0x3F);
86951 *zOut++ = 0x80 + (u8)(c & 0x3F);
86952 }else{
86953 *zOut++ = 0xF0 + (u8)((c>>18) & 0x07);
86954 *zOut++ = 0x80 + (u8)((c>>12) & 0x3F);
86955 *zOut++ = 0x80 + (u8)((c>>6) & 0x3F);
86956 *zOut++ = 0x80 + (u8)(c & 0x3F);
86957 } \
86958 }
86959 sqlite3_result_text(context, (char*)z, (int)(zOut-z), sqlite3_free);
86960 }
86961
86962 /*
86963 ** The hex() function. Interpret the argument as a blob. Return
86964 ** a hexadecimal rendering as text.
@@ -93197,10 +93222,11 @@
93222 }
93223 }else
93224 #endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */
93225
93226 #ifndef SQLITE_OMIT_FOREIGN_KEY
93227 #ifndef SQLITE_OMIT_TRIGGER
93228 if( sqlite3StrICmp(zLeft, "foreign_key_check")==0 ){
93229 FKey *pFK; /* A foreign key constraint */
93230 Table *pTab; /* Child table contain "REFERENCES" keyword */
93231 Table *pParent; /* Parent table that child points to */
93232 Index *pIdx; /* Index in the parent table */
@@ -93308,10 +93334,11 @@
93334 }
93335 sqlite3VdbeAddOp2(v, OP_Next, 0, addrTop+1);
93336 sqlite3VdbeJumpHere(v, addrTop);
93337 }
93338 }else
93339 #endif /* !defined(SQLITE_OMIT_TRIGGER) */
93340 #endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */
93341
93342 #ifndef NDEBUG
93343 if( sqlite3StrICmp(zLeft, "parser_trace")==0 ){
93344 if( zRight ){
@@ -94104,15 +94131,19 @@
94131 ** For an attached db, it is an error if the encoding is not the same
94132 ** as sqlite3.enc.
94133 */
94134 if( meta[BTREE_TEXT_ENCODING-1] ){ /* text encoding */
94135 if( iDb==0 ){
94136 #ifndef SQLITE_OMIT_UTF16
94137 u8 encoding;
94138 /* If opening the main database, set ENC(db). */
94139 encoding = (u8)meta[BTREE_TEXT_ENCODING-1] & 3;
94140 if( encoding==0 ) encoding = SQLITE_UTF8;
94141 ENC(db) = encoding;
94142 #else
94143 ENC(db) = SQLITE_UTF8;
94144 #endif
94145 }else{
94146 /* If opening an attached database, the encoding much match ENC(db) */
94147 if( meta[BTREE_TEXT_ENCODING-1]!=ENC(db) ){
94148 sqlite3SetString(pzErrMsg, db, "attached databases must use the same"
94149 " text encoding as main database");
94150
+1 -1
--- 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.7.16"
111111
#define SQLITE_VERSION_NUMBER 3007016
112
-#define SQLITE_SOURCE_ID "2013-03-06 01:55:27 7097241c1220ada318f8eda938c3e3430b94a606"
112
+#define SQLITE_SOURCE_ID "2013-03-11 13:37:52 f9027cb47bdec8dcebf1f038921b28d9e9928c18"
113113
114114
/*
115115
** CAPI3REF: Run-Time Library Version Numbers
116116
** KEYWORDS: sqlite3_version, sqlite3_sourceid
117117
**
118118
--- 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.7.16"
111 #define SQLITE_VERSION_NUMBER 3007016
112 #define SQLITE_SOURCE_ID "2013-03-06 01:55:27 7097241c1220ada318f8eda938c3e3430b94a606"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118
--- 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.7.16"
111 #define SQLITE_VERSION_NUMBER 3007016
112 #define SQLITE_SOURCE_ID "2013-03-11 13:37:52 f9027cb47bdec8dcebf1f038921b28d9e9928c18"
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