Fossil SCM

Update the built-in SQLite to the latest 3.7.6 beta.

drh 2011-04-07 17:36 trunk
Commit 8caf7e169164fdd8159efc55959b011a7368c6c9
2 files changed +79 -53 +14 -14
+79 -53
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -198,11 +198,11 @@
198198
# define SQLITE_DEFAULT_WAL_AUTOCHECKPOINT 1000
199199
#endif
200200
201201
/*
202202
** The maximum number of attached databases. This must be between 0
203
-** and 30. The upper bound on 30 is because a 32-bit integer bitmap
203
+** and 62. The upper bound on 62 is because a 64-bit integer bitmap
204204
** is used internally to track attached databases.
205205
*/
206206
#ifndef SQLITE_MAX_ATTACHED
207207
# define SQLITE_MAX_ATTACHED 10
208208
#endif
@@ -650,11 +650,11 @@
650650
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
651651
** [sqlite_version()] and [sqlite_source_id()].
652652
*/
653653
#define SQLITE_VERSION "3.7.6"
654654
#define SQLITE_VERSION_NUMBER 3007006
655
-#define SQLITE_SOURCE_ID "2011-04-05 22:08:24 3eeb0ff78d04891b5fd1a3d99a9fb8cfbed77a81"
655
+#define SQLITE_SOURCE_ID "2011-04-07 15:24:08 bf78acb9dfacde0f08a5b3ceac13480f12a06168"
656656
657657
/*
658658
** CAPI3REF: Run-Time Library Version Numbers
659659
** KEYWORDS: sqlite3_version, sqlite3_sourceid
660660
**
@@ -1273,11 +1273,11 @@
12731273
** when the database connection has [PRAGMA synchronous] set to OFF.)^
12741274
** Some specialized VFSes need this signal in order to operate correctly
12751275
** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most
12761276
** VFSes do not need this signal and should silently ignore this opcode.
12771277
** Applications should not call [sqlite3_file_control()] with this
1278
-** opcode as doing so may disrupt the operation of the specilized VFSes
1278
+** opcode as doing so may disrupt the operation of the specialized VFSes
12791279
** that do require it.
12801280
*/
12811281
#define SQLITE_FCNTL_LOCKSTATE 1
12821282
#define SQLITE_GET_LOCKPROXYFILE 2
12831283
#define SQLITE_SET_LOCKPROXYFILE 3
@@ -1855,11 +1855,11 @@
18551855
** </dd>
18561856
**
18571857
** <dt>SQLITE_CONFIG_SCRATCH</dt>
18581858
** <dd> ^This option specifies a static memory buffer that SQLite can use for
18591859
** scratch memory. There are three arguments: A pointer an 8-byte
1860
-** aligned memory buffer from which the scrach allocations will be
1860
+** aligned memory buffer from which the scratch allocations will be
18611861
** drawn, the size of each scratch allocation (sz),
18621862
** and the maximum number of scratch allocations (N). The sz
18631863
** argument must be a multiple of 16.
18641864
** The first argument must be a pointer to an 8-byte aligned buffer
18651865
** of at least sz*N bytes of memory.
@@ -2007,11 +2007,11 @@
20072007
** <dl>
20082008
** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
20092009
** <dd> ^This option takes three additional arguments that determine the
20102010
** [lookaside memory allocator] configuration for the [database connection].
20112011
** ^The first argument (the third parameter to [sqlite3_db_config()] is a
2012
-** pointer to an memory buffer to use for lookaside memory.
2012
+** pointer to a memory buffer to use for lookaside memory.
20132013
** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
20142014
** may be NULL in which case SQLite will allocate the
20152015
** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the
20162016
** size of each lookaside buffer slot. ^The third argument is the number of
20172017
** slots. The size of the buffer in the first argument must be greater than
@@ -2039,11 +2039,11 @@
20392039
**
20402040
** <dt>SQLITE_DBCONFIG_ENABLE_TRIGGER</dt>
20412041
** <dd> ^This option is used to enable or disable [CREATE TRIGGER | triggers].
20422042
** There should be two additional arguments.
20432043
** The first argument is an integer which is 0 to disable triggers,
2044
-** positive to enable trigers or negative to leave the setting unchanged.
2044
+** positive to enable triggers or negative to leave the setting unchanged.
20452045
** The second parameter is a pointer to an integer into which
20462046
** is written 0 or 1 to indicate whether triggers are disabled or enabled
20472047
** following this call. The second parameter may be a NULL pointer, in
20482048
** which case the trigger setting is not reported back. </dd>
20492049
**
@@ -2651,11 +2651,11 @@
26512651
SQLITE_API void sqlite3_randomness(int N, void *P);
26522652
26532653
/*
26542654
** CAPI3REF: Compile-Time Authorization Callbacks
26552655
**
2656
-** ^This routine registers a authorizer callback with a particular
2656
+** ^This routine registers an authorizer callback with a particular
26572657
** [database connection], supplied in the first argument.
26582658
** ^The authorizer callback is invoked as SQL statements are being compiled
26592659
** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
26602660
** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various
26612661
** points during the compilation process, as logic is being created
@@ -3297,11 +3297,11 @@
32973297
** will accept either a protected or an unprotected sqlite3_value.
32983298
** Every interface that accepts sqlite3_value arguments specifies
32993299
** whether or not it requires a protected sqlite3_value.
33003300
**
33013301
** The terms "protected" and "unprotected" refer to whether or not
3302
-** a mutex is held. A internal mutex is held for a protected
3302
+** a mutex is held. An internal mutex is held for a protected
33033303
** sqlite3_value object but no mutex is held for an unprotected
33043304
** sqlite3_value object. If SQLite is compiled to be single-threaded
33053305
** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)
33063306
** or if SQLite is run in one of reduced mutex modes
33073307
** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]
@@ -3983,11 +3983,11 @@
39833983
**
39843984
** ^These functions (collectively known as "function creation routines")
39853985
** are used to add SQL functions or aggregates or to redefine the behavior
39863986
** of existing SQL functions or aggregates. The only differences between
39873987
** these routines are the text encoding expected for
3988
-** the the second parameter (the name of the function being created)
3988
+** the second parameter (the name of the function being created)
39893989
** and the presence or absence of a destructor callback for
39903990
** the application data pointer.
39913991
**
39923992
** ^The first parameter is the [database connection] to which the SQL
39933993
** function is to be added. ^If an application uses more than one database
@@ -4028,11 +4028,11 @@
40284028
** pointers to C-language functions that implement the SQL function or
40294029
** aggregate. ^A scalar SQL function requires an implementation of the xFunc
40304030
** callback only; NULL pointers must be passed as the xStep and xFinal
40314031
** parameters. ^An aggregate SQL function requires an implementation of xStep
40324032
** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing
4033
-** SQL function or aggregate, pass NULL poiners for all three function
4033
+** SQL function or aggregate, pass NULL pointers for all three function
40344034
** callbacks.
40354035
**
40364036
** ^(If the ninth parameter to sqlite3_create_function_v2() is not NULL,
40374037
** then it is destructor for the application data pointer.
40384038
** The destructor is invoked when the function is deleted, either by being
@@ -4462,11 +4462,11 @@
44624462
** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep
44634463
** force strings to be UTF16 with native byte order.
44644464
** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin
44654465
** on an even byte address.
44664466
**
4467
-** ^The fourth argument, pArg, is a application data pointer that is passed
4467
+** ^The fourth argument, pArg, is an application data pointer that is passed
44684468
** through as the first argument to the collating function callback.
44694469
**
44704470
** ^The fifth argument, xCallback, is a pointer to the collating function.
44714471
** ^Multiple collating functions can be registered using the same name but
44724472
** with different eTextRep parameters and SQLite will use whichever
@@ -4478,11 +4478,11 @@
44784478
** ^The collating function callback is invoked with a copy of the pArg
44794479
** application data pointer and with two strings in the encoding specified
44804480
** by the eTextRep argument. The collating function must return an
44814481
** integer that is negative, zero, or positive
44824482
** if the first string is less than, equal to, or greater than the second,
4483
-** respectively. A collating function must alway return the same answer
4483
+** respectively. A collating function must always return the same answer
44844484
** given the same inputs. If two or more collating functions are registered
44854485
** to the same collation name (using different eTextRep values) then all
44864486
** must give an equivalent answer when invoked with equivalent strings.
44874487
** The collating function must obey the following properties for all
44884488
** strings A, B, and C:
@@ -4890,11 +4890,11 @@
48904890
** <ul>
48914891
** <li> The soft heap limit is set to zero.
48924892
** <li> Memory accounting is disabled using a combination of the
48934893
** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and
48944894
** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option.
4895
-** <li> An alternative page cache implementation is specifed using
4895
+** <li> An alternative page cache implementation is specified using
48964896
** [sqlite3_config]([SQLITE_CONFIG_PCACHE],...).
48974897
** <li> The page cache allocates from its own memory pool supplied
48984898
** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
48994899
** from the heap.
49004900
** </ul>)^
@@ -5111,11 +5111,11 @@
51115111
51125112
/*
51135113
** CAPI3REF: Virtual Table Object
51145114
** KEYWORDS: sqlite3_module {virtual table module}
51155115
**
5116
-** This structure, sometimes called a a "virtual table module",
5116
+** This structure, sometimes called a "virtual table module",
51175117
** defines the implementation of a [virtual tables].
51185118
** This structure consists mostly of methods for the module.
51195119
**
51205120
** ^A virtual table module is created by filling in a persistent
51215121
** instance of this structure and passing a pointer to that instance
@@ -5423,11 +5423,11 @@
54235423
** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
54245424
** then the BLOB handle is marked as "expired".
54255425
** This is true if any column of the row is changed, even a column
54265426
** other than the one the BLOB handle is open on.)^
54275427
** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for
5428
-** a expired BLOB handle fail with an return code of [SQLITE_ABORT].
5428
+** an expired BLOB handle fail with a return code of [SQLITE_ABORT].
54295429
** ^(Changes written into a BLOB prior to the BLOB expiring are not
54305430
** rolled back by the expiration of the BLOB. Such changes will eventually
54315431
** commit if the transaction continues to completion.)^
54325432
**
54335433
** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
@@ -7825,10 +7825,11 @@
78257825
# define sqlite3BtreeEnter(X)
78267826
# define sqlite3BtreeEnterAll(X)
78277827
#endif
78287828
78297829
#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE
7830
+SQLITE_PRIVATE int sqlite3BtreeSharable(Btree*);
78307831
SQLITE_PRIVATE void sqlite3BtreeLeave(Btree*);
78317832
SQLITE_PRIVATE void sqlite3BtreeEnterCursor(BtCursor*);
78327833
SQLITE_PRIVATE void sqlite3BtreeLeaveCursor(BtCursor*);
78337834
SQLITE_PRIVATE void sqlite3BtreeLeaveAll(sqlite3*);
78347835
#ifndef NDEBUG
@@ -7837,10 +7838,11 @@
78377838
SQLITE_PRIVATE int sqlite3BtreeHoldsAllMutexes(sqlite3*);
78387839
SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3*,int,Schema*);
78397840
#endif
78407841
#else
78417842
7843
+# define sqlite3BtreeSharable(X) 0
78427844
# define sqlite3BtreeLeave(X)
78437845
# define sqlite3BtreeEnterCursor(X)
78447846
# define sqlite3BtreeLeaveCursor(X)
78457847
# define sqlite3BtreeLeaveAll(X)
78467848
@@ -12493,10 +12495,11 @@
1249312495
u8 usesStmtJournal; /* True if uses a statement journal */
1249412496
u8 readOnly; /* True for read-only statements */
1249512497
u8 isPrepareV2; /* True if prepared with prepare_v2() */
1249612498
int nChange; /* Number of db changes made since last reset */
1249712499
yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */
12500
+ yDbMask lockMask; /* Subset of btreeMask that requires a lock */
1249812501
int iStatement; /* Statement number (or 0 if has not opened stmt) */
1249912502
int aCounter[3]; /* Counters used by sqlite3_stmt_status() */
1250012503
#ifndef SQLITE_OMIT_TRACE
1250112504
i64 startTime; /* Time when query started - used for profiling */
1250212505
#endif
@@ -26784,22 +26787,21 @@
2678426787
** is the same technique used by glibc to implement posix_fallocate()
2678526788
** on systems that do not have a real fallocate() system call.
2678626789
*/
2678726790
int nBlk = buf.st_blksize; /* File-system block size */
2678826791
i64 iWrite; /* Next offset to write to */
26789
- int nWrite; /* Return value from seekAndWrite() */
2679026792
2679126793
if( robust_ftruncate(pFile->h, nSize) ){
2679226794
pFile->lastErrno = errno;
2679326795
return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath);
2679426796
}
2679526797
iWrite = ((buf.st_size + 2*nBlk - 1)/nBlk)*nBlk-1;
26796
- do {
26797
- nWrite = seekAndWrite(pFile, iWrite, "", 1);
26798
+ while( iWrite<nSize ){
26799
+ int nWrite = seekAndWrite(pFile, iWrite, "", 1);
26800
+ if( nWrite!=1 ) return SQLITE_IOERR_WRITE;
2679826801
iWrite += nBlk;
26799
- } while( nWrite==1 && iWrite<nSize );
26800
- if( nWrite!=1 ) return SQLITE_IOERR_WRITE;
26802
+ }
2680126803
#endif
2680226804
}
2680326805
}
2680426806
2680526807
return SQLITE_OK;
@@ -46156,10 +46158,18 @@
4615646158
for(i=0; i<db->nDb; i++){
4615746159
p = db->aDb[i].pBt;
4615846160
if( p ) sqlite3BtreeLeave(p);
4615946161
}
4616046162
}
46163
+
46164
+/*
46165
+** Return true if a particular Btree requires a lock. Return FALSE if
46166
+** no lock is ever required since it is not sharable.
46167
+*/
46168
+SQLITE_PRIVATE int sqlite3BtreeSharable(Btree *p){
46169
+ return p->sharable;
46170
+}
4616146171
4616246172
#ifndef NDEBUG
4616346173
/*
4616446174
** Return true if the current thread holds the database connection
4616546175
** mutex and all required BtShared mutexes.
@@ -48362,11 +48372,10 @@
4836248372
rc = sqlite3PagerNosync(pBt->pPager);
4836348373
sqlite3BtreeLeave(p);
4836448374
return rc;
4836548375
}
4836648376
48367
-#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) || !defined(SQLITE_OMIT_VACUUM)
4836848377
/*
4836948378
** Change the default pages size and the number of reserved bytes per page.
4837048379
** Or, if the page size has already been fixed, return SQLITE_READONLY
4837148380
** without changing anything.
4837248381
**
@@ -48417,10 +48426,11 @@
4841748426
*/
4841848427
SQLITE_PRIVATE int sqlite3BtreeGetPageSize(Btree *p){
4841948428
return p->pBt->pageSize;
4842048429
}
4842148430
48431
+#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) || !defined(SQLITE_OMIT_VACUUM)
4842248432
/*
4842348433
** Return the number of bytes of space at the end of every page that
4842448434
** are intentually left unused. This is the "reserved" space that is
4842548435
** sometimes used by extensions.
4842648436
*/
@@ -51054,11 +51064,11 @@
5105451064
if( rc ){
5105551065
pTrunk = 0;
5105651066
goto end_allocate_page;
5105751067
}
5105851068
51059
- k = get4byte(&pTrunk->aData[4]);
51069
+ k = get4byte(&pTrunk->aData[4]); /* # of leaves on this trunk page */
5106051070
if( k==0 && !searchList ){
5106151071
/* The trunk has no leaves and the list is not being searched.
5106251072
** So extract the trunk page itself and use it as the newly
5106351073
** allocated page */
5106451074
assert( pPrevTrunk==0 );
@@ -51139,14 +51149,10 @@
5113951149
}else if( k>0 ){
5114051150
/* Extract a leaf from the trunk */
5114151151
u32 closest;
5114251152
Pgno iPage;
5114351153
unsigned char *aData = pTrunk->aData;
51144
- rc = sqlite3PagerWrite(pTrunk->pDbPage);
51145
- if( rc ){
51146
- goto end_allocate_page;
51147
- }
5114851154
if( nearby>0 ){
5114951155
u32 i;
5115051156
int dist;
5115151157
closest = 0;
5115251158
dist = sqlite3AbsInt32(get4byte(&aData[8]) - nearby);
@@ -51172,15 +51178,16 @@
5117251178
int noContent;
5117351179
*pPgno = iPage;
5117451180
TRACE(("ALLOCATE: %d was leaf %d of %d on trunk %d"
5117551181
": %d more free pages\n",
5117651182
*pPgno, closest+1, k, pTrunk->pgno, n-1));
51183
+ rc = sqlite3PagerWrite(pTrunk->pDbPage);
51184
+ if( rc ) goto end_allocate_page;
5117751185
if( closest<k-1 ){
5117851186
memcpy(&aData[8+closest*4], &aData[4+k*4], 4);
5117951187
}
5118051188
put4byte(&aData[4], k-1);
51181
- assert( sqlite3PagerIswriteable(pTrunk->pDbPage) );
5118251189
noContent = !btreeGetHasContent(pBt, *pPgno);
5118351190
rc = btreeGetPage(pBt, *pPgno, ppPage, noContent);
5118451191
if( rc==SQLITE_OK ){
5118551192
rc = sqlite3PagerWrite((*ppPage)->pDbPage);
5118651193
if( rc!=SQLITE_OK ){
@@ -51245,10 +51252,11 @@
5124551252
}
5124651253
(*ppPage)->isInit = 0;
5124751254
}else{
5124851255
*ppPage = 0;
5124951256
}
51257
+ assert( rc!=SQLITE_OK || sqlite3PagerIswriteable((*ppPage)->pDbPage) );
5125051258
return rc;
5125151259
}
5125251260
5125351261
/*
5125451262
** This function is used to add page iPage to the database file free-list.
@@ -56384,11 +56392,12 @@
5638456392
pOp->p4type = P4_NOTUSED;
5638556393
p->expired = 0;
5638656394
if( op==OP_ParseSchema ){
5638756395
/* Any program that uses the OP_ParseSchema opcode needs to lock
5638856396
** all btrees. */
56389
- p->btreeMask = ~(yDbMask)0;
56397
+ int j;
56398
+ for(j=0; j<p->db->nDb; j++) sqlite3VdbeUsesBtree(p, j);
5639056399
}
5639156400
#ifdef SQLITE_DEBUG
5639256401
pOp->zComment = 0;
5639356402
if( sqlite3VdbeAddopTrace ) sqlite3VdbePrintOp(0, i, &p->aOp[i]);
5639456403
#endif
@@ -57182,10 +57191,13 @@
5718257191
*/
5718357192
SQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe *p, int i){
5718457193
assert( i>=0 && i<p->db->nDb && i<(int)sizeof(yDbMask)*8 );
5718557194
assert( i<(int)sizeof(p->btreeMask)*8 );
5718657195
p->btreeMask |= ((yDbMask)1)<<i;
57196
+ if( i!=1 && sqlite3BtreeSharable(p->db->aDb[i].pBt) ){
57197
+ p->lockMask |= ((yDbMask)1)<<i;
57198
+ }
5718757199
}
5718857200
5718957201
#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0
5719057202
/*
5719157203
** If SQLite is compiled to support shared-cache mode and to be threadsafe,
@@ -57209,15 +57221,19 @@
5720957221
** be a problem.
5721057222
*/
5721157223
SQLITE_PRIVATE void sqlite3VdbeEnter(Vdbe *p){
5721257224
int i;
5721357225
yDbMask mask;
57214
- sqlite3 *db = p->db;
57215
- Db *aDb = db->aDb;
57216
- int nDb = db->nDb;
57226
+ sqlite3 *db;
57227
+ Db *aDb;
57228
+ int nDb;
57229
+ if( p->lockMask==0 ) return; /* The common case */
57230
+ db = p->db;
57231
+ aDb = db->aDb;
57232
+ nDb = db->nDb;
5721757233
for(i=0, mask=1; i<nDb; i++, mask += mask){
57218
- if( i!=1 && (mask & p->btreeMask)!=0 && ALWAYS(aDb[i].pBt!=0) ){
57234
+ if( i!=1 && (mask & p->lockMask)!=0 && ALWAYS(aDb[i].pBt!=0) ){
5721957235
sqlite3BtreeEnter(aDb[i].pBt);
5722057236
}
5722157237
}
5722257238
}
5722357239
#endif
@@ -57227,16 +57243,19 @@
5722757243
** Unlock all of the btrees previously locked by a call to sqlite3VdbeEnter().
5722857244
*/
5722957245
SQLITE_PRIVATE void sqlite3VdbeLeave(Vdbe *p){
5723057246
int i;
5723157247
yDbMask mask;
57232
- sqlite3 *db = p->db;
57233
- Db *aDb = db->aDb;
57234
- int nDb = db->nDb;
57235
-
57248
+ sqlite3 *db;
57249
+ Db *aDb;
57250
+ int nDb;
57251
+ if( p->lockMask==0 ) return; /* The common case */
57252
+ db = p->db;
57253
+ aDb = db->aDb;
57254
+ nDb = db->nDb;
5723657255
for(i=0, mask=1; i<nDb; i++, mask += mask){
57237
- if( i!=1 && (mask & p->btreeMask)!=0 && ALWAYS(aDb[i].pBt!=0) ){
57256
+ if( i!=1 && (mask & p->lockMask)!=0 && ALWAYS(aDb[i].pBt!=0) ){
5723857257
sqlite3BtreeLeave(aDb[i].pBt);
5723957258
}
5724057259
}
5724157260
}
5724257261
#endif
@@ -60834,11 +60853,11 @@
6083460853
if( db->vdbeExecCnt>1 ){
6083560854
while( *zRawSql ){
6083660855
const char *zStart = zRawSql;
6083760856
while( *(zRawSql++)!='\n' && *zRawSql );
6083860857
sqlite3StrAccumAppend(&out, "-- ", 3);
60839
- sqlite3StrAccumAppend(&out, zStart, zRawSql-zStart);
60858
+ sqlite3StrAccumAppend(&out, zStart, (int)(zRawSql-zStart));
6084060859
}
6084160860
}else{
6084260861
while( zRawSql[0] ){
6084360862
n = findNextHostParameter(zRawSql, &nToken);
6084460863
assert( n>0 );
@@ -66139,12 +66158,10 @@
6613966158
#ifdef SQLITE_DEBUG
6614066159
for(u.bu.iDb=0; u.bu.iDb<db->nDb; u.bu.iDb++){
6614166160
assert( u.bu.iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[u.bu.iDb].pBt) );
6614266161
}
6614366162
#endif
66144
- assert( p->btreeMask == ~(yDbMask)0 );
66145
-
6614666163
6614766164
u.bu.iDb = pOp->p1;
6614866165
assert( u.bu.iDb>=0 && u.bu.iDb<db->nDb );
6614966166
assert( DbHasProperty(db, u.bu.iDb, DB_SchemaLoaded) );
6615066167
/* Used to be a conditional */ {
@@ -86021,10 +86038,15 @@
8602186038
8602286039
#ifdef SQLITE_OMIT_COMPLETE
8602386040
# define sqlite3_complete 0
8602486041
# define sqlite3_complete16 0
8602586042
#endif
86043
+
86044
+#ifdef SQLITE_OMIT_DECLTYPE
86045
+# define sqlite3_column_decltype16 0
86046
+# define sqlite3_column_decltype 0
86047
+#endif
8602686048
8602786049
#ifdef SQLITE_OMIT_PROGRESS_CALLBACK
8602886050
# define sqlite3_progress_handler 0
8602986051
#endif
8603086052
@@ -89790,10 +89812,26 @@
8979089812
char *zMsg = sqlite3MPrintf(pParse->db, "USE TEMP B-TREE FOR %s", zUsage);
8979189813
sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC);
8979289814
}
8979389815
}
8979489816
89817
+/*
89818
+** Assign expression b to lvalue a. A second, no-op, version of this macro
89819
+** is provided when SQLITE_OMIT_EXPLAIN is defined. This allows the code
89820
+** in sqlite3Select() to assign values to structure member variables that
89821
+** only exist if SQLITE_OMIT_EXPLAIN is not defined without polluting the
89822
+** code with #ifndef directives.
89823
+*/
89824
+# define explainSetInteger(a, b) a = b
89825
+
89826
+#else
89827
+/* No-op versions of the explainXXX() functions and macros. */
89828
+# define explainTempTable(y,z)
89829
+# define explainSetInteger(y,z)
89830
+#endif
89831
+
89832
+#if !defined(SQLITE_OMIT_EXPLAIN) && !defined(SQLITE_OMIT_COMPOUND_SELECT)
8979589833
/*
8979689834
** Unless an "EXPLAIN QUERY PLAN" command is being processed, this function
8979789835
** is a no-op. Otherwise, it adds a single row of output to the EQP result,
8979889836
** where the caption is of one of the two forms:
8979989837
**
@@ -89821,25 +89859,13 @@
8982189859
bUseTmp?"USING TEMP B-TREE ":"", selectOpName(op)
8982289860
);
8982389861
sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC);
8982489862
}
8982589863
}
89826
-
89827
-/*
89828
-** Assign expression b to lvalue a. A second, no-op, version of this macro
89829
-** is provided when SQLITE_OMIT_EXPLAIN is defined. This allows the code
89830
-** in sqlite3Select() to assign values to structure member variables that
89831
-** only exist if SQLITE_OMIT_EXPLAIN is not defined without polluting the
89832
-** code with #ifndef directives.
89833
-*/
89834
-# define explainSetInteger(a, b) a = b
89835
-
8983689864
#else
8983789865
/* No-op versions of the explainXXX() functions and macros. */
89838
-# define explainTempTable(y,z)
8983989866
# define explainComposite(v,w,x,y,z)
89840
-# define explainSetInteger(y,z)
8984189867
#endif
8984289868
8984389869
/*
8984489870
** If the inner loop was generated using a non-null pOrderBy argument,
8984589871
** then the results were placed in a sorter. After the loop is terminated
@@ -106809,11 +106835,11 @@
106809106835
va_list ap;
106810106836
int rc;
106811106837
va_start(ap, op);
106812106838
switch( op ){
106813106839
case SQLITE_DBCONFIG_LOOKASIDE: {
106814
- void *pBuf = va_arg(ap, void*); /* IMP: R-21112-12275 */
106840
+ void *pBuf = va_arg(ap, void*); /* IMP: R-26835-10964 */
106815106841
int sz = va_arg(ap, int); /* IMP: R-47871-25994 */
106816106842
int cnt = va_arg(ap, int); /* IMP: R-04460-53386 */
106817106843
rc = setupLookaside(db, pBuf, sz, cnt);
106818106844
break;
106819106845
}
106820106846
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -198,11 +198,11 @@
198 # define SQLITE_DEFAULT_WAL_AUTOCHECKPOINT 1000
199 #endif
200
201 /*
202 ** The maximum number of attached databases. This must be between 0
203 ** and 30. The upper bound on 30 is because a 32-bit integer bitmap
204 ** is used internally to track attached databases.
205 */
206 #ifndef SQLITE_MAX_ATTACHED
207 # define SQLITE_MAX_ATTACHED 10
208 #endif
@@ -650,11 +650,11 @@
650 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
651 ** [sqlite_version()] and [sqlite_source_id()].
652 */
653 #define SQLITE_VERSION "3.7.6"
654 #define SQLITE_VERSION_NUMBER 3007006
655 #define SQLITE_SOURCE_ID "2011-04-05 22:08:24 3eeb0ff78d04891b5fd1a3d99a9fb8cfbed77a81"
656
657 /*
658 ** CAPI3REF: Run-Time Library Version Numbers
659 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
660 **
@@ -1273,11 +1273,11 @@
1273 ** when the database connection has [PRAGMA synchronous] set to OFF.)^
1274 ** Some specialized VFSes need this signal in order to operate correctly
1275 ** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most
1276 ** VFSes do not need this signal and should silently ignore this opcode.
1277 ** Applications should not call [sqlite3_file_control()] with this
1278 ** opcode as doing so may disrupt the operation of the specilized VFSes
1279 ** that do require it.
1280 */
1281 #define SQLITE_FCNTL_LOCKSTATE 1
1282 #define SQLITE_GET_LOCKPROXYFILE 2
1283 #define SQLITE_SET_LOCKPROXYFILE 3
@@ -1855,11 +1855,11 @@
1855 ** </dd>
1856 **
1857 ** <dt>SQLITE_CONFIG_SCRATCH</dt>
1858 ** <dd> ^This option specifies a static memory buffer that SQLite can use for
1859 ** scratch memory. There are three arguments: A pointer an 8-byte
1860 ** aligned memory buffer from which the scrach allocations will be
1861 ** drawn, the size of each scratch allocation (sz),
1862 ** and the maximum number of scratch allocations (N). The sz
1863 ** argument must be a multiple of 16.
1864 ** The first argument must be a pointer to an 8-byte aligned buffer
1865 ** of at least sz*N bytes of memory.
@@ -2007,11 +2007,11 @@
2007 ** <dl>
2008 ** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
2009 ** <dd> ^This option takes three additional arguments that determine the
2010 ** [lookaside memory allocator] configuration for the [database connection].
2011 ** ^The first argument (the third parameter to [sqlite3_db_config()] is a
2012 ** pointer to an memory buffer to use for lookaside memory.
2013 ** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
2014 ** may be NULL in which case SQLite will allocate the
2015 ** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the
2016 ** size of each lookaside buffer slot. ^The third argument is the number of
2017 ** slots. The size of the buffer in the first argument must be greater than
@@ -2039,11 +2039,11 @@
2039 **
2040 ** <dt>SQLITE_DBCONFIG_ENABLE_TRIGGER</dt>
2041 ** <dd> ^This option is used to enable or disable [CREATE TRIGGER | triggers].
2042 ** There should be two additional arguments.
2043 ** The first argument is an integer which is 0 to disable triggers,
2044 ** positive to enable trigers or negative to leave the setting unchanged.
2045 ** The second parameter is a pointer to an integer into which
2046 ** is written 0 or 1 to indicate whether triggers are disabled or enabled
2047 ** following this call. The second parameter may be a NULL pointer, in
2048 ** which case the trigger setting is not reported back. </dd>
2049 **
@@ -2651,11 +2651,11 @@
2651 SQLITE_API void sqlite3_randomness(int N, void *P);
2652
2653 /*
2654 ** CAPI3REF: Compile-Time Authorization Callbacks
2655 **
2656 ** ^This routine registers a authorizer callback with a particular
2657 ** [database connection], supplied in the first argument.
2658 ** ^The authorizer callback is invoked as SQL statements are being compiled
2659 ** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
2660 ** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various
2661 ** points during the compilation process, as logic is being created
@@ -3297,11 +3297,11 @@
3297 ** will accept either a protected or an unprotected sqlite3_value.
3298 ** Every interface that accepts sqlite3_value arguments specifies
3299 ** whether or not it requires a protected sqlite3_value.
3300 **
3301 ** The terms "protected" and "unprotected" refer to whether or not
3302 ** a mutex is held. A internal mutex is held for a protected
3303 ** sqlite3_value object but no mutex is held for an unprotected
3304 ** sqlite3_value object. If SQLite is compiled to be single-threaded
3305 ** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)
3306 ** or if SQLite is run in one of reduced mutex modes
3307 ** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]
@@ -3983,11 +3983,11 @@
3983 **
3984 ** ^These functions (collectively known as "function creation routines")
3985 ** are used to add SQL functions or aggregates or to redefine the behavior
3986 ** of existing SQL functions or aggregates. The only differences between
3987 ** these routines are the text encoding expected for
3988 ** the the second parameter (the name of the function being created)
3989 ** and the presence or absence of a destructor callback for
3990 ** the application data pointer.
3991 **
3992 ** ^The first parameter is the [database connection] to which the SQL
3993 ** function is to be added. ^If an application uses more than one database
@@ -4028,11 +4028,11 @@
4028 ** pointers to C-language functions that implement the SQL function or
4029 ** aggregate. ^A scalar SQL function requires an implementation of the xFunc
4030 ** callback only; NULL pointers must be passed as the xStep and xFinal
4031 ** parameters. ^An aggregate SQL function requires an implementation of xStep
4032 ** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing
4033 ** SQL function or aggregate, pass NULL poiners for all three function
4034 ** callbacks.
4035 **
4036 ** ^(If the ninth parameter to sqlite3_create_function_v2() is not NULL,
4037 ** then it is destructor for the application data pointer.
4038 ** The destructor is invoked when the function is deleted, either by being
@@ -4462,11 +4462,11 @@
4462 ** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep
4463 ** force strings to be UTF16 with native byte order.
4464 ** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin
4465 ** on an even byte address.
4466 **
4467 ** ^The fourth argument, pArg, is a application data pointer that is passed
4468 ** through as the first argument to the collating function callback.
4469 **
4470 ** ^The fifth argument, xCallback, is a pointer to the collating function.
4471 ** ^Multiple collating functions can be registered using the same name but
4472 ** with different eTextRep parameters and SQLite will use whichever
@@ -4478,11 +4478,11 @@
4478 ** ^The collating function callback is invoked with a copy of the pArg
4479 ** application data pointer and with two strings in the encoding specified
4480 ** by the eTextRep argument. The collating function must return an
4481 ** integer that is negative, zero, or positive
4482 ** if the first string is less than, equal to, or greater than the second,
4483 ** respectively. A collating function must alway return the same answer
4484 ** given the same inputs. If two or more collating functions are registered
4485 ** to the same collation name (using different eTextRep values) then all
4486 ** must give an equivalent answer when invoked with equivalent strings.
4487 ** The collating function must obey the following properties for all
4488 ** strings A, B, and C:
@@ -4890,11 +4890,11 @@
4890 ** <ul>
4891 ** <li> The soft heap limit is set to zero.
4892 ** <li> Memory accounting is disabled using a combination of the
4893 ** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and
4894 ** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option.
4895 ** <li> An alternative page cache implementation is specifed using
4896 ** [sqlite3_config]([SQLITE_CONFIG_PCACHE],...).
4897 ** <li> The page cache allocates from its own memory pool supplied
4898 ** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
4899 ** from the heap.
4900 ** </ul>)^
@@ -5111,11 +5111,11 @@
5111
5112 /*
5113 ** CAPI3REF: Virtual Table Object
5114 ** KEYWORDS: sqlite3_module {virtual table module}
5115 **
5116 ** This structure, sometimes called a a "virtual table module",
5117 ** defines the implementation of a [virtual tables].
5118 ** This structure consists mostly of methods for the module.
5119 **
5120 ** ^A virtual table module is created by filling in a persistent
5121 ** instance of this structure and passing a pointer to that instance
@@ -5423,11 +5423,11 @@
5423 ** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
5424 ** then the BLOB handle is marked as "expired".
5425 ** This is true if any column of the row is changed, even a column
5426 ** other than the one the BLOB handle is open on.)^
5427 ** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for
5428 ** a expired BLOB handle fail with an return code of [SQLITE_ABORT].
5429 ** ^(Changes written into a BLOB prior to the BLOB expiring are not
5430 ** rolled back by the expiration of the BLOB. Such changes will eventually
5431 ** commit if the transaction continues to completion.)^
5432 **
5433 ** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
@@ -7825,10 +7825,11 @@
7825 # define sqlite3BtreeEnter(X)
7826 # define sqlite3BtreeEnterAll(X)
7827 #endif
7828
7829 #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE
 
7830 SQLITE_PRIVATE void sqlite3BtreeLeave(Btree*);
7831 SQLITE_PRIVATE void sqlite3BtreeEnterCursor(BtCursor*);
7832 SQLITE_PRIVATE void sqlite3BtreeLeaveCursor(BtCursor*);
7833 SQLITE_PRIVATE void sqlite3BtreeLeaveAll(sqlite3*);
7834 #ifndef NDEBUG
@@ -7837,10 +7838,11 @@
7837 SQLITE_PRIVATE int sqlite3BtreeHoldsAllMutexes(sqlite3*);
7838 SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3*,int,Schema*);
7839 #endif
7840 #else
7841
 
7842 # define sqlite3BtreeLeave(X)
7843 # define sqlite3BtreeEnterCursor(X)
7844 # define sqlite3BtreeLeaveCursor(X)
7845 # define sqlite3BtreeLeaveAll(X)
7846
@@ -12493,10 +12495,11 @@
12493 u8 usesStmtJournal; /* True if uses a statement journal */
12494 u8 readOnly; /* True for read-only statements */
12495 u8 isPrepareV2; /* True if prepared with prepare_v2() */
12496 int nChange; /* Number of db changes made since last reset */
12497 yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */
 
12498 int iStatement; /* Statement number (or 0 if has not opened stmt) */
12499 int aCounter[3]; /* Counters used by sqlite3_stmt_status() */
12500 #ifndef SQLITE_OMIT_TRACE
12501 i64 startTime; /* Time when query started - used for profiling */
12502 #endif
@@ -26784,22 +26787,21 @@
26784 ** is the same technique used by glibc to implement posix_fallocate()
26785 ** on systems that do not have a real fallocate() system call.
26786 */
26787 int nBlk = buf.st_blksize; /* File-system block size */
26788 i64 iWrite; /* Next offset to write to */
26789 int nWrite; /* Return value from seekAndWrite() */
26790
26791 if( robust_ftruncate(pFile->h, nSize) ){
26792 pFile->lastErrno = errno;
26793 return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath);
26794 }
26795 iWrite = ((buf.st_size + 2*nBlk - 1)/nBlk)*nBlk-1;
26796 do {
26797 nWrite = seekAndWrite(pFile, iWrite, "", 1);
 
26798 iWrite += nBlk;
26799 } while( nWrite==1 && iWrite<nSize );
26800 if( nWrite!=1 ) return SQLITE_IOERR_WRITE;
26801 #endif
26802 }
26803 }
26804
26805 return SQLITE_OK;
@@ -46156,10 +46158,18 @@
46156 for(i=0; i<db->nDb; i++){
46157 p = db->aDb[i].pBt;
46158 if( p ) sqlite3BtreeLeave(p);
46159 }
46160 }
 
 
 
 
 
 
 
 
46161
46162 #ifndef NDEBUG
46163 /*
46164 ** Return true if the current thread holds the database connection
46165 ** mutex and all required BtShared mutexes.
@@ -48362,11 +48372,10 @@
48362 rc = sqlite3PagerNosync(pBt->pPager);
48363 sqlite3BtreeLeave(p);
48364 return rc;
48365 }
48366
48367 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) || !defined(SQLITE_OMIT_VACUUM)
48368 /*
48369 ** Change the default pages size and the number of reserved bytes per page.
48370 ** Or, if the page size has already been fixed, return SQLITE_READONLY
48371 ** without changing anything.
48372 **
@@ -48417,10 +48426,11 @@
48417 */
48418 SQLITE_PRIVATE int sqlite3BtreeGetPageSize(Btree *p){
48419 return p->pBt->pageSize;
48420 }
48421
 
48422 /*
48423 ** Return the number of bytes of space at the end of every page that
48424 ** are intentually left unused. This is the "reserved" space that is
48425 ** sometimes used by extensions.
48426 */
@@ -51054,11 +51064,11 @@
51054 if( rc ){
51055 pTrunk = 0;
51056 goto end_allocate_page;
51057 }
51058
51059 k = get4byte(&pTrunk->aData[4]);
51060 if( k==0 && !searchList ){
51061 /* The trunk has no leaves and the list is not being searched.
51062 ** So extract the trunk page itself and use it as the newly
51063 ** allocated page */
51064 assert( pPrevTrunk==0 );
@@ -51139,14 +51149,10 @@
51139 }else if( k>0 ){
51140 /* Extract a leaf from the trunk */
51141 u32 closest;
51142 Pgno iPage;
51143 unsigned char *aData = pTrunk->aData;
51144 rc = sqlite3PagerWrite(pTrunk->pDbPage);
51145 if( rc ){
51146 goto end_allocate_page;
51147 }
51148 if( nearby>0 ){
51149 u32 i;
51150 int dist;
51151 closest = 0;
51152 dist = sqlite3AbsInt32(get4byte(&aData[8]) - nearby);
@@ -51172,15 +51178,16 @@
51172 int noContent;
51173 *pPgno = iPage;
51174 TRACE(("ALLOCATE: %d was leaf %d of %d on trunk %d"
51175 ": %d more free pages\n",
51176 *pPgno, closest+1, k, pTrunk->pgno, n-1));
 
 
51177 if( closest<k-1 ){
51178 memcpy(&aData[8+closest*4], &aData[4+k*4], 4);
51179 }
51180 put4byte(&aData[4], k-1);
51181 assert( sqlite3PagerIswriteable(pTrunk->pDbPage) );
51182 noContent = !btreeGetHasContent(pBt, *pPgno);
51183 rc = btreeGetPage(pBt, *pPgno, ppPage, noContent);
51184 if( rc==SQLITE_OK ){
51185 rc = sqlite3PagerWrite((*ppPage)->pDbPage);
51186 if( rc!=SQLITE_OK ){
@@ -51245,10 +51252,11 @@
51245 }
51246 (*ppPage)->isInit = 0;
51247 }else{
51248 *ppPage = 0;
51249 }
 
51250 return rc;
51251 }
51252
51253 /*
51254 ** This function is used to add page iPage to the database file free-list.
@@ -56384,11 +56392,12 @@
56384 pOp->p4type = P4_NOTUSED;
56385 p->expired = 0;
56386 if( op==OP_ParseSchema ){
56387 /* Any program that uses the OP_ParseSchema opcode needs to lock
56388 ** all btrees. */
56389 p->btreeMask = ~(yDbMask)0;
 
56390 }
56391 #ifdef SQLITE_DEBUG
56392 pOp->zComment = 0;
56393 if( sqlite3VdbeAddopTrace ) sqlite3VdbePrintOp(0, i, &p->aOp[i]);
56394 #endif
@@ -57182,10 +57191,13 @@
57182 */
57183 SQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe *p, int i){
57184 assert( i>=0 && i<p->db->nDb && i<(int)sizeof(yDbMask)*8 );
57185 assert( i<(int)sizeof(p->btreeMask)*8 );
57186 p->btreeMask |= ((yDbMask)1)<<i;
 
 
 
57187 }
57188
57189 #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0
57190 /*
57191 ** If SQLite is compiled to support shared-cache mode and to be threadsafe,
@@ -57209,15 +57221,19 @@
57209 ** be a problem.
57210 */
57211 SQLITE_PRIVATE void sqlite3VdbeEnter(Vdbe *p){
57212 int i;
57213 yDbMask mask;
57214 sqlite3 *db = p->db;
57215 Db *aDb = db->aDb;
57216 int nDb = db->nDb;
 
 
 
 
57217 for(i=0, mask=1; i<nDb; i++, mask += mask){
57218 if( i!=1 && (mask & p->btreeMask)!=0 && ALWAYS(aDb[i].pBt!=0) ){
57219 sqlite3BtreeEnter(aDb[i].pBt);
57220 }
57221 }
57222 }
57223 #endif
@@ -57227,16 +57243,19 @@
57227 ** Unlock all of the btrees previously locked by a call to sqlite3VdbeEnter().
57228 */
57229 SQLITE_PRIVATE void sqlite3VdbeLeave(Vdbe *p){
57230 int i;
57231 yDbMask mask;
57232 sqlite3 *db = p->db;
57233 Db *aDb = db->aDb;
57234 int nDb = db->nDb;
57235
 
 
 
57236 for(i=0, mask=1; i<nDb; i++, mask += mask){
57237 if( i!=1 && (mask & p->btreeMask)!=0 && ALWAYS(aDb[i].pBt!=0) ){
57238 sqlite3BtreeLeave(aDb[i].pBt);
57239 }
57240 }
57241 }
57242 #endif
@@ -60834,11 +60853,11 @@
60834 if( db->vdbeExecCnt>1 ){
60835 while( *zRawSql ){
60836 const char *zStart = zRawSql;
60837 while( *(zRawSql++)!='\n' && *zRawSql );
60838 sqlite3StrAccumAppend(&out, "-- ", 3);
60839 sqlite3StrAccumAppend(&out, zStart, zRawSql-zStart);
60840 }
60841 }else{
60842 while( zRawSql[0] ){
60843 n = findNextHostParameter(zRawSql, &nToken);
60844 assert( n>0 );
@@ -66139,12 +66158,10 @@
66139 #ifdef SQLITE_DEBUG
66140 for(u.bu.iDb=0; u.bu.iDb<db->nDb; u.bu.iDb++){
66141 assert( u.bu.iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[u.bu.iDb].pBt) );
66142 }
66143 #endif
66144 assert( p->btreeMask == ~(yDbMask)0 );
66145
66146
66147 u.bu.iDb = pOp->p1;
66148 assert( u.bu.iDb>=0 && u.bu.iDb<db->nDb );
66149 assert( DbHasProperty(db, u.bu.iDb, DB_SchemaLoaded) );
66150 /* Used to be a conditional */ {
@@ -86021,10 +86038,15 @@
86021
86022 #ifdef SQLITE_OMIT_COMPLETE
86023 # define sqlite3_complete 0
86024 # define sqlite3_complete16 0
86025 #endif
 
 
 
 
 
86026
86027 #ifdef SQLITE_OMIT_PROGRESS_CALLBACK
86028 # define sqlite3_progress_handler 0
86029 #endif
86030
@@ -89790,10 +89812,26 @@
89790 char *zMsg = sqlite3MPrintf(pParse->db, "USE TEMP B-TREE FOR %s", zUsage);
89791 sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC);
89792 }
89793 }
89794
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89795 /*
89796 ** Unless an "EXPLAIN QUERY PLAN" command is being processed, this function
89797 ** is a no-op. Otherwise, it adds a single row of output to the EQP result,
89798 ** where the caption is of one of the two forms:
89799 **
@@ -89821,25 +89859,13 @@
89821 bUseTmp?"USING TEMP B-TREE ":"", selectOpName(op)
89822 );
89823 sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC);
89824 }
89825 }
89826
89827 /*
89828 ** Assign expression b to lvalue a. A second, no-op, version of this macro
89829 ** is provided when SQLITE_OMIT_EXPLAIN is defined. This allows the code
89830 ** in sqlite3Select() to assign values to structure member variables that
89831 ** only exist if SQLITE_OMIT_EXPLAIN is not defined without polluting the
89832 ** code with #ifndef directives.
89833 */
89834 # define explainSetInteger(a, b) a = b
89835
89836 #else
89837 /* No-op versions of the explainXXX() functions and macros. */
89838 # define explainTempTable(y,z)
89839 # define explainComposite(v,w,x,y,z)
89840 # define explainSetInteger(y,z)
89841 #endif
89842
89843 /*
89844 ** If the inner loop was generated using a non-null pOrderBy argument,
89845 ** then the results were placed in a sorter. After the loop is terminated
@@ -106809,11 +106835,11 @@
106809 va_list ap;
106810 int rc;
106811 va_start(ap, op);
106812 switch( op ){
106813 case SQLITE_DBCONFIG_LOOKASIDE: {
106814 void *pBuf = va_arg(ap, void*); /* IMP: R-21112-12275 */
106815 int sz = va_arg(ap, int); /* IMP: R-47871-25994 */
106816 int cnt = va_arg(ap, int); /* IMP: R-04460-53386 */
106817 rc = setupLookaside(db, pBuf, sz, cnt);
106818 break;
106819 }
106820
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -198,11 +198,11 @@
198 # define SQLITE_DEFAULT_WAL_AUTOCHECKPOINT 1000
199 #endif
200
201 /*
202 ** The maximum number of attached databases. This must be between 0
203 ** and 62. The upper bound on 62 is because a 64-bit integer bitmap
204 ** is used internally to track attached databases.
205 */
206 #ifndef SQLITE_MAX_ATTACHED
207 # define SQLITE_MAX_ATTACHED 10
208 #endif
@@ -650,11 +650,11 @@
650 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
651 ** [sqlite_version()] and [sqlite_source_id()].
652 */
653 #define SQLITE_VERSION "3.7.6"
654 #define SQLITE_VERSION_NUMBER 3007006
655 #define SQLITE_SOURCE_ID "2011-04-07 15:24:08 bf78acb9dfacde0f08a5b3ceac13480f12a06168"
656
657 /*
658 ** CAPI3REF: Run-Time Library Version Numbers
659 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
660 **
@@ -1273,11 +1273,11 @@
1273 ** when the database connection has [PRAGMA synchronous] set to OFF.)^
1274 ** Some specialized VFSes need this signal in order to operate correctly
1275 ** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most
1276 ** VFSes do not need this signal and should silently ignore this opcode.
1277 ** Applications should not call [sqlite3_file_control()] with this
1278 ** opcode as doing so may disrupt the operation of the specialized VFSes
1279 ** that do require it.
1280 */
1281 #define SQLITE_FCNTL_LOCKSTATE 1
1282 #define SQLITE_GET_LOCKPROXYFILE 2
1283 #define SQLITE_SET_LOCKPROXYFILE 3
@@ -1855,11 +1855,11 @@
1855 ** </dd>
1856 **
1857 ** <dt>SQLITE_CONFIG_SCRATCH</dt>
1858 ** <dd> ^This option specifies a static memory buffer that SQLite can use for
1859 ** scratch memory. There are three arguments: A pointer an 8-byte
1860 ** aligned memory buffer from which the scratch allocations will be
1861 ** drawn, the size of each scratch allocation (sz),
1862 ** and the maximum number of scratch allocations (N). The sz
1863 ** argument must be a multiple of 16.
1864 ** The first argument must be a pointer to an 8-byte aligned buffer
1865 ** of at least sz*N bytes of memory.
@@ -2007,11 +2007,11 @@
2007 ** <dl>
2008 ** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
2009 ** <dd> ^This option takes three additional arguments that determine the
2010 ** [lookaside memory allocator] configuration for the [database connection].
2011 ** ^The first argument (the third parameter to [sqlite3_db_config()] is a
2012 ** pointer to a memory buffer to use for lookaside memory.
2013 ** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
2014 ** may be NULL in which case SQLite will allocate the
2015 ** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the
2016 ** size of each lookaside buffer slot. ^The third argument is the number of
2017 ** slots. The size of the buffer in the first argument must be greater than
@@ -2039,11 +2039,11 @@
2039 **
2040 ** <dt>SQLITE_DBCONFIG_ENABLE_TRIGGER</dt>
2041 ** <dd> ^This option is used to enable or disable [CREATE TRIGGER | triggers].
2042 ** There should be two additional arguments.
2043 ** The first argument is an integer which is 0 to disable triggers,
2044 ** positive to enable triggers or negative to leave the setting unchanged.
2045 ** The second parameter is a pointer to an integer into which
2046 ** is written 0 or 1 to indicate whether triggers are disabled or enabled
2047 ** following this call. The second parameter may be a NULL pointer, in
2048 ** which case the trigger setting is not reported back. </dd>
2049 **
@@ -2651,11 +2651,11 @@
2651 SQLITE_API void sqlite3_randomness(int N, void *P);
2652
2653 /*
2654 ** CAPI3REF: Compile-Time Authorization Callbacks
2655 **
2656 ** ^This routine registers an authorizer callback with a particular
2657 ** [database connection], supplied in the first argument.
2658 ** ^The authorizer callback is invoked as SQL statements are being compiled
2659 ** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
2660 ** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various
2661 ** points during the compilation process, as logic is being created
@@ -3297,11 +3297,11 @@
3297 ** will accept either a protected or an unprotected sqlite3_value.
3298 ** Every interface that accepts sqlite3_value arguments specifies
3299 ** whether or not it requires a protected sqlite3_value.
3300 **
3301 ** The terms "protected" and "unprotected" refer to whether or not
3302 ** a mutex is held. An internal mutex is held for a protected
3303 ** sqlite3_value object but no mutex is held for an unprotected
3304 ** sqlite3_value object. If SQLite is compiled to be single-threaded
3305 ** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)
3306 ** or if SQLite is run in one of reduced mutex modes
3307 ** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]
@@ -3983,11 +3983,11 @@
3983 **
3984 ** ^These functions (collectively known as "function creation routines")
3985 ** are used to add SQL functions or aggregates or to redefine the behavior
3986 ** of existing SQL functions or aggregates. The only differences between
3987 ** these routines are the text encoding expected for
3988 ** the second parameter (the name of the function being created)
3989 ** and the presence or absence of a destructor callback for
3990 ** the application data pointer.
3991 **
3992 ** ^The first parameter is the [database connection] to which the SQL
3993 ** function is to be added. ^If an application uses more than one database
@@ -4028,11 +4028,11 @@
4028 ** pointers to C-language functions that implement the SQL function or
4029 ** aggregate. ^A scalar SQL function requires an implementation of the xFunc
4030 ** callback only; NULL pointers must be passed as the xStep and xFinal
4031 ** parameters. ^An aggregate SQL function requires an implementation of xStep
4032 ** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing
4033 ** SQL function or aggregate, pass NULL pointers for all three function
4034 ** callbacks.
4035 **
4036 ** ^(If the ninth parameter to sqlite3_create_function_v2() is not NULL,
4037 ** then it is destructor for the application data pointer.
4038 ** The destructor is invoked when the function is deleted, either by being
@@ -4462,11 +4462,11 @@
4462 ** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep
4463 ** force strings to be UTF16 with native byte order.
4464 ** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin
4465 ** on an even byte address.
4466 **
4467 ** ^The fourth argument, pArg, is an application data pointer that is passed
4468 ** through as the first argument to the collating function callback.
4469 **
4470 ** ^The fifth argument, xCallback, is a pointer to the collating function.
4471 ** ^Multiple collating functions can be registered using the same name but
4472 ** with different eTextRep parameters and SQLite will use whichever
@@ -4478,11 +4478,11 @@
4478 ** ^The collating function callback is invoked with a copy of the pArg
4479 ** application data pointer and with two strings in the encoding specified
4480 ** by the eTextRep argument. The collating function must return an
4481 ** integer that is negative, zero, or positive
4482 ** if the first string is less than, equal to, or greater than the second,
4483 ** respectively. A collating function must always return the same answer
4484 ** given the same inputs. If two or more collating functions are registered
4485 ** to the same collation name (using different eTextRep values) then all
4486 ** must give an equivalent answer when invoked with equivalent strings.
4487 ** The collating function must obey the following properties for all
4488 ** strings A, B, and C:
@@ -4890,11 +4890,11 @@
4890 ** <ul>
4891 ** <li> The soft heap limit is set to zero.
4892 ** <li> Memory accounting is disabled using a combination of the
4893 ** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and
4894 ** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option.
4895 ** <li> An alternative page cache implementation is specified using
4896 ** [sqlite3_config]([SQLITE_CONFIG_PCACHE],...).
4897 ** <li> The page cache allocates from its own memory pool supplied
4898 ** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
4899 ** from the heap.
4900 ** </ul>)^
@@ -5111,11 +5111,11 @@
5111
5112 /*
5113 ** CAPI3REF: Virtual Table Object
5114 ** KEYWORDS: sqlite3_module {virtual table module}
5115 **
5116 ** This structure, sometimes called a "virtual table module",
5117 ** defines the implementation of a [virtual tables].
5118 ** This structure consists mostly of methods for the module.
5119 **
5120 ** ^A virtual table module is created by filling in a persistent
5121 ** instance of this structure and passing a pointer to that instance
@@ -5423,11 +5423,11 @@
5423 ** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
5424 ** then the BLOB handle is marked as "expired".
5425 ** This is true if any column of the row is changed, even a column
5426 ** other than the one the BLOB handle is open on.)^
5427 ** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for
5428 ** an expired BLOB handle fail with a return code of [SQLITE_ABORT].
5429 ** ^(Changes written into a BLOB prior to the BLOB expiring are not
5430 ** rolled back by the expiration of the BLOB. Such changes will eventually
5431 ** commit if the transaction continues to completion.)^
5432 **
5433 ** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
@@ -7825,10 +7825,11 @@
7825 # define sqlite3BtreeEnter(X)
7826 # define sqlite3BtreeEnterAll(X)
7827 #endif
7828
7829 #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE
7830 SQLITE_PRIVATE int sqlite3BtreeSharable(Btree*);
7831 SQLITE_PRIVATE void sqlite3BtreeLeave(Btree*);
7832 SQLITE_PRIVATE void sqlite3BtreeEnterCursor(BtCursor*);
7833 SQLITE_PRIVATE void sqlite3BtreeLeaveCursor(BtCursor*);
7834 SQLITE_PRIVATE void sqlite3BtreeLeaveAll(sqlite3*);
7835 #ifndef NDEBUG
@@ -7837,10 +7838,11 @@
7838 SQLITE_PRIVATE int sqlite3BtreeHoldsAllMutexes(sqlite3*);
7839 SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3*,int,Schema*);
7840 #endif
7841 #else
7842
7843 # define sqlite3BtreeSharable(X) 0
7844 # define sqlite3BtreeLeave(X)
7845 # define sqlite3BtreeEnterCursor(X)
7846 # define sqlite3BtreeLeaveCursor(X)
7847 # define sqlite3BtreeLeaveAll(X)
7848
@@ -12493,10 +12495,11 @@
12495 u8 usesStmtJournal; /* True if uses a statement journal */
12496 u8 readOnly; /* True for read-only statements */
12497 u8 isPrepareV2; /* True if prepared with prepare_v2() */
12498 int nChange; /* Number of db changes made since last reset */
12499 yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */
12500 yDbMask lockMask; /* Subset of btreeMask that requires a lock */
12501 int iStatement; /* Statement number (or 0 if has not opened stmt) */
12502 int aCounter[3]; /* Counters used by sqlite3_stmt_status() */
12503 #ifndef SQLITE_OMIT_TRACE
12504 i64 startTime; /* Time when query started - used for profiling */
12505 #endif
@@ -26784,22 +26787,21 @@
26787 ** is the same technique used by glibc to implement posix_fallocate()
26788 ** on systems that do not have a real fallocate() system call.
26789 */
26790 int nBlk = buf.st_blksize; /* File-system block size */
26791 i64 iWrite; /* Next offset to write to */
 
26792
26793 if( robust_ftruncate(pFile->h, nSize) ){
26794 pFile->lastErrno = errno;
26795 return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath);
26796 }
26797 iWrite = ((buf.st_size + 2*nBlk - 1)/nBlk)*nBlk-1;
26798 while( iWrite<nSize ){
26799 int nWrite = seekAndWrite(pFile, iWrite, "", 1);
26800 if( nWrite!=1 ) return SQLITE_IOERR_WRITE;
26801 iWrite += nBlk;
26802 }
 
26803 #endif
26804 }
26805 }
26806
26807 return SQLITE_OK;
@@ -46156,10 +46158,18 @@
46158 for(i=0; i<db->nDb; i++){
46159 p = db->aDb[i].pBt;
46160 if( p ) sqlite3BtreeLeave(p);
46161 }
46162 }
46163
46164 /*
46165 ** Return true if a particular Btree requires a lock. Return FALSE if
46166 ** no lock is ever required since it is not sharable.
46167 */
46168 SQLITE_PRIVATE int sqlite3BtreeSharable(Btree *p){
46169 return p->sharable;
46170 }
46171
46172 #ifndef NDEBUG
46173 /*
46174 ** Return true if the current thread holds the database connection
46175 ** mutex and all required BtShared mutexes.
@@ -48362,11 +48372,10 @@
48372 rc = sqlite3PagerNosync(pBt->pPager);
48373 sqlite3BtreeLeave(p);
48374 return rc;
48375 }
48376
 
48377 /*
48378 ** Change the default pages size and the number of reserved bytes per page.
48379 ** Or, if the page size has already been fixed, return SQLITE_READONLY
48380 ** without changing anything.
48381 **
@@ -48417,10 +48426,11 @@
48426 */
48427 SQLITE_PRIVATE int sqlite3BtreeGetPageSize(Btree *p){
48428 return p->pBt->pageSize;
48429 }
48430
48431 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) || !defined(SQLITE_OMIT_VACUUM)
48432 /*
48433 ** Return the number of bytes of space at the end of every page that
48434 ** are intentually left unused. This is the "reserved" space that is
48435 ** sometimes used by extensions.
48436 */
@@ -51054,11 +51064,11 @@
51064 if( rc ){
51065 pTrunk = 0;
51066 goto end_allocate_page;
51067 }
51068
51069 k = get4byte(&pTrunk->aData[4]); /* # of leaves on this trunk page */
51070 if( k==0 && !searchList ){
51071 /* The trunk has no leaves and the list is not being searched.
51072 ** So extract the trunk page itself and use it as the newly
51073 ** allocated page */
51074 assert( pPrevTrunk==0 );
@@ -51139,14 +51149,10 @@
51149 }else if( k>0 ){
51150 /* Extract a leaf from the trunk */
51151 u32 closest;
51152 Pgno iPage;
51153 unsigned char *aData = pTrunk->aData;
 
 
 
 
51154 if( nearby>0 ){
51155 u32 i;
51156 int dist;
51157 closest = 0;
51158 dist = sqlite3AbsInt32(get4byte(&aData[8]) - nearby);
@@ -51172,15 +51178,16 @@
51178 int noContent;
51179 *pPgno = iPage;
51180 TRACE(("ALLOCATE: %d was leaf %d of %d on trunk %d"
51181 ": %d more free pages\n",
51182 *pPgno, closest+1, k, pTrunk->pgno, n-1));
51183 rc = sqlite3PagerWrite(pTrunk->pDbPage);
51184 if( rc ) goto end_allocate_page;
51185 if( closest<k-1 ){
51186 memcpy(&aData[8+closest*4], &aData[4+k*4], 4);
51187 }
51188 put4byte(&aData[4], k-1);
 
51189 noContent = !btreeGetHasContent(pBt, *pPgno);
51190 rc = btreeGetPage(pBt, *pPgno, ppPage, noContent);
51191 if( rc==SQLITE_OK ){
51192 rc = sqlite3PagerWrite((*ppPage)->pDbPage);
51193 if( rc!=SQLITE_OK ){
@@ -51245,10 +51252,11 @@
51252 }
51253 (*ppPage)->isInit = 0;
51254 }else{
51255 *ppPage = 0;
51256 }
51257 assert( rc!=SQLITE_OK || sqlite3PagerIswriteable((*ppPage)->pDbPage) );
51258 return rc;
51259 }
51260
51261 /*
51262 ** This function is used to add page iPage to the database file free-list.
@@ -56384,11 +56392,12 @@
56392 pOp->p4type = P4_NOTUSED;
56393 p->expired = 0;
56394 if( op==OP_ParseSchema ){
56395 /* Any program that uses the OP_ParseSchema opcode needs to lock
56396 ** all btrees. */
56397 int j;
56398 for(j=0; j<p->db->nDb; j++) sqlite3VdbeUsesBtree(p, j);
56399 }
56400 #ifdef SQLITE_DEBUG
56401 pOp->zComment = 0;
56402 if( sqlite3VdbeAddopTrace ) sqlite3VdbePrintOp(0, i, &p->aOp[i]);
56403 #endif
@@ -57182,10 +57191,13 @@
57191 */
57192 SQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe *p, int i){
57193 assert( i>=0 && i<p->db->nDb && i<(int)sizeof(yDbMask)*8 );
57194 assert( i<(int)sizeof(p->btreeMask)*8 );
57195 p->btreeMask |= ((yDbMask)1)<<i;
57196 if( i!=1 && sqlite3BtreeSharable(p->db->aDb[i].pBt) ){
57197 p->lockMask |= ((yDbMask)1)<<i;
57198 }
57199 }
57200
57201 #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0
57202 /*
57203 ** If SQLite is compiled to support shared-cache mode and to be threadsafe,
@@ -57209,15 +57221,19 @@
57221 ** be a problem.
57222 */
57223 SQLITE_PRIVATE void sqlite3VdbeEnter(Vdbe *p){
57224 int i;
57225 yDbMask mask;
57226 sqlite3 *db;
57227 Db *aDb;
57228 int nDb;
57229 if( p->lockMask==0 ) return; /* The common case */
57230 db = p->db;
57231 aDb = db->aDb;
57232 nDb = db->nDb;
57233 for(i=0, mask=1; i<nDb; i++, mask += mask){
57234 if( i!=1 && (mask & p->lockMask)!=0 && ALWAYS(aDb[i].pBt!=0) ){
57235 sqlite3BtreeEnter(aDb[i].pBt);
57236 }
57237 }
57238 }
57239 #endif
@@ -57227,16 +57243,19 @@
57243 ** Unlock all of the btrees previously locked by a call to sqlite3VdbeEnter().
57244 */
57245 SQLITE_PRIVATE void sqlite3VdbeLeave(Vdbe *p){
57246 int i;
57247 yDbMask mask;
57248 sqlite3 *db;
57249 Db *aDb;
57250 int nDb;
57251 if( p->lockMask==0 ) return; /* The common case */
57252 db = p->db;
57253 aDb = db->aDb;
57254 nDb = db->nDb;
57255 for(i=0, mask=1; i<nDb; i++, mask += mask){
57256 if( i!=1 && (mask & p->lockMask)!=0 && ALWAYS(aDb[i].pBt!=0) ){
57257 sqlite3BtreeLeave(aDb[i].pBt);
57258 }
57259 }
57260 }
57261 #endif
@@ -60834,11 +60853,11 @@
60853 if( db->vdbeExecCnt>1 ){
60854 while( *zRawSql ){
60855 const char *zStart = zRawSql;
60856 while( *(zRawSql++)!='\n' && *zRawSql );
60857 sqlite3StrAccumAppend(&out, "-- ", 3);
60858 sqlite3StrAccumAppend(&out, zStart, (int)(zRawSql-zStart));
60859 }
60860 }else{
60861 while( zRawSql[0] ){
60862 n = findNextHostParameter(zRawSql, &nToken);
60863 assert( n>0 );
@@ -66139,12 +66158,10 @@
66158 #ifdef SQLITE_DEBUG
66159 for(u.bu.iDb=0; u.bu.iDb<db->nDb; u.bu.iDb++){
66160 assert( u.bu.iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[u.bu.iDb].pBt) );
66161 }
66162 #endif
 
 
66163
66164 u.bu.iDb = pOp->p1;
66165 assert( u.bu.iDb>=0 && u.bu.iDb<db->nDb );
66166 assert( DbHasProperty(db, u.bu.iDb, DB_SchemaLoaded) );
66167 /* Used to be a conditional */ {
@@ -86021,10 +86038,15 @@
86038
86039 #ifdef SQLITE_OMIT_COMPLETE
86040 # define sqlite3_complete 0
86041 # define sqlite3_complete16 0
86042 #endif
86043
86044 #ifdef SQLITE_OMIT_DECLTYPE
86045 # define sqlite3_column_decltype16 0
86046 # define sqlite3_column_decltype 0
86047 #endif
86048
86049 #ifdef SQLITE_OMIT_PROGRESS_CALLBACK
86050 # define sqlite3_progress_handler 0
86051 #endif
86052
@@ -89790,10 +89812,26 @@
89812 char *zMsg = sqlite3MPrintf(pParse->db, "USE TEMP B-TREE FOR %s", zUsage);
89813 sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC);
89814 }
89815 }
89816
89817 /*
89818 ** Assign expression b to lvalue a. A second, no-op, version of this macro
89819 ** is provided when SQLITE_OMIT_EXPLAIN is defined. This allows the code
89820 ** in sqlite3Select() to assign values to structure member variables that
89821 ** only exist if SQLITE_OMIT_EXPLAIN is not defined without polluting the
89822 ** code with #ifndef directives.
89823 */
89824 # define explainSetInteger(a, b) a = b
89825
89826 #else
89827 /* No-op versions of the explainXXX() functions and macros. */
89828 # define explainTempTable(y,z)
89829 # define explainSetInteger(y,z)
89830 #endif
89831
89832 #if !defined(SQLITE_OMIT_EXPLAIN) && !defined(SQLITE_OMIT_COMPOUND_SELECT)
89833 /*
89834 ** Unless an "EXPLAIN QUERY PLAN" command is being processed, this function
89835 ** is a no-op. Otherwise, it adds a single row of output to the EQP result,
89836 ** where the caption is of one of the two forms:
89837 **
@@ -89821,25 +89859,13 @@
89859 bUseTmp?"USING TEMP B-TREE ":"", selectOpName(op)
89860 );
89861 sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC);
89862 }
89863 }
 
 
 
 
 
 
 
 
 
 
89864 #else
89865 /* No-op versions of the explainXXX() functions and macros. */
 
89866 # define explainComposite(v,w,x,y,z)
 
89867 #endif
89868
89869 /*
89870 ** If the inner loop was generated using a non-null pOrderBy argument,
89871 ** then the results were placed in a sorter. After the loop is terminated
@@ -106809,11 +106835,11 @@
106835 va_list ap;
106836 int rc;
106837 va_start(ap, op);
106838 switch( op ){
106839 case SQLITE_DBCONFIG_LOOKASIDE: {
106840 void *pBuf = va_arg(ap, void*); /* IMP: R-26835-10964 */
106841 int sz = va_arg(ap, int); /* IMP: R-47871-25994 */
106842 int cnt = va_arg(ap, int); /* IMP: R-04460-53386 */
106843 rc = setupLookaside(db, pBuf, sz, cnt);
106844 break;
106845 }
106846
+14 -14
--- 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.6"
111111
#define SQLITE_VERSION_NUMBER 3007006
112
-#define SQLITE_SOURCE_ID "2011-04-05 22:08:24 3eeb0ff78d04891b5fd1a3d99a9fb8cfbed77a81"
112
+#define SQLITE_SOURCE_ID "2011-04-07 15:24:08 bf78acb9dfacde0f08a5b3ceac13480f12a06168"
113113
114114
/*
115115
** CAPI3REF: Run-Time Library Version Numbers
116116
** KEYWORDS: sqlite3_version, sqlite3_sourceid
117117
**
@@ -730,11 +730,11 @@
730730
** when the database connection has [PRAGMA synchronous] set to OFF.)^
731731
** Some specialized VFSes need this signal in order to operate correctly
732732
** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most
733733
** VFSes do not need this signal and should silently ignore this opcode.
734734
** Applications should not call [sqlite3_file_control()] with this
735
-** opcode as doing so may disrupt the operation of the specilized VFSes
735
+** opcode as doing so may disrupt the operation of the specialized VFSes
736736
** that do require it.
737737
*/
738738
#define SQLITE_FCNTL_LOCKSTATE 1
739739
#define SQLITE_GET_LOCKPROXYFILE 2
740740
#define SQLITE_SET_LOCKPROXYFILE 3
@@ -1312,11 +1312,11 @@
13121312
** </dd>
13131313
**
13141314
** <dt>SQLITE_CONFIG_SCRATCH</dt>
13151315
** <dd> ^This option specifies a static memory buffer that SQLite can use for
13161316
** scratch memory. There are three arguments: A pointer an 8-byte
1317
-** aligned memory buffer from which the scrach allocations will be
1317
+** aligned memory buffer from which the scratch allocations will be
13181318
** drawn, the size of each scratch allocation (sz),
13191319
** and the maximum number of scratch allocations (N). The sz
13201320
** argument must be a multiple of 16.
13211321
** The first argument must be a pointer to an 8-byte aligned buffer
13221322
** of at least sz*N bytes of memory.
@@ -1464,11 +1464,11 @@
14641464
** <dl>
14651465
** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
14661466
** <dd> ^This option takes three additional arguments that determine the
14671467
** [lookaside memory allocator] configuration for the [database connection].
14681468
** ^The first argument (the third parameter to [sqlite3_db_config()] is a
1469
-** pointer to an memory buffer to use for lookaside memory.
1469
+** pointer to a memory buffer to use for lookaside memory.
14701470
** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
14711471
** may be NULL in which case SQLite will allocate the
14721472
** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the
14731473
** size of each lookaside buffer slot. ^The third argument is the number of
14741474
** slots. The size of the buffer in the first argument must be greater than
@@ -1496,11 +1496,11 @@
14961496
**
14971497
** <dt>SQLITE_DBCONFIG_ENABLE_TRIGGER</dt>
14981498
** <dd> ^This option is used to enable or disable [CREATE TRIGGER | triggers].
14991499
** There should be two additional arguments.
15001500
** The first argument is an integer which is 0 to disable triggers,
1501
-** positive to enable trigers or negative to leave the setting unchanged.
1501
+** positive to enable triggers or negative to leave the setting unchanged.
15021502
** The second parameter is a pointer to an integer into which
15031503
** is written 0 or 1 to indicate whether triggers are disabled or enabled
15041504
** following this call. The second parameter may be a NULL pointer, in
15051505
** which case the trigger setting is not reported back. </dd>
15061506
**
@@ -2108,11 +2108,11 @@
21082108
SQLITE_API void sqlite3_randomness(int N, void *P);
21092109
21102110
/*
21112111
** CAPI3REF: Compile-Time Authorization Callbacks
21122112
**
2113
-** ^This routine registers a authorizer callback with a particular
2113
+** ^This routine registers an authorizer callback with a particular
21142114
** [database connection], supplied in the first argument.
21152115
** ^The authorizer callback is invoked as SQL statements are being compiled
21162116
** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
21172117
** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various
21182118
** points during the compilation process, as logic is being created
@@ -2754,11 +2754,11 @@
27542754
** will accept either a protected or an unprotected sqlite3_value.
27552755
** Every interface that accepts sqlite3_value arguments specifies
27562756
** whether or not it requires a protected sqlite3_value.
27572757
**
27582758
** The terms "protected" and "unprotected" refer to whether or not
2759
-** a mutex is held. A internal mutex is held for a protected
2759
+** a mutex is held. An internal mutex is held for a protected
27602760
** sqlite3_value object but no mutex is held for an unprotected
27612761
** sqlite3_value object. If SQLite is compiled to be single-threaded
27622762
** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)
27632763
** or if SQLite is run in one of reduced mutex modes
27642764
** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]
@@ -3440,11 +3440,11 @@
34403440
**
34413441
** ^These functions (collectively known as "function creation routines")
34423442
** are used to add SQL functions or aggregates or to redefine the behavior
34433443
** of existing SQL functions or aggregates. The only differences between
34443444
** these routines are the text encoding expected for
3445
-** the the second parameter (the name of the function being created)
3445
+** the second parameter (the name of the function being created)
34463446
** and the presence or absence of a destructor callback for
34473447
** the application data pointer.
34483448
**
34493449
** ^The first parameter is the [database connection] to which the SQL
34503450
** function is to be added. ^If an application uses more than one database
@@ -3485,11 +3485,11 @@
34853485
** pointers to C-language functions that implement the SQL function or
34863486
** aggregate. ^A scalar SQL function requires an implementation of the xFunc
34873487
** callback only; NULL pointers must be passed as the xStep and xFinal
34883488
** parameters. ^An aggregate SQL function requires an implementation of xStep
34893489
** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing
3490
-** SQL function or aggregate, pass NULL poiners for all three function
3490
+** SQL function or aggregate, pass NULL pointers for all three function
34913491
** callbacks.
34923492
**
34933493
** ^(If the ninth parameter to sqlite3_create_function_v2() is not NULL,
34943494
** then it is destructor for the application data pointer.
34953495
** The destructor is invoked when the function is deleted, either by being
@@ -3919,11 +3919,11 @@
39193919
** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep
39203920
** force strings to be UTF16 with native byte order.
39213921
** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin
39223922
** on an even byte address.
39233923
**
3924
-** ^The fourth argument, pArg, is a application data pointer that is passed
3924
+** ^The fourth argument, pArg, is an application data pointer that is passed
39253925
** through as the first argument to the collating function callback.
39263926
**
39273927
** ^The fifth argument, xCallback, is a pointer to the collating function.
39283928
** ^Multiple collating functions can be registered using the same name but
39293929
** with different eTextRep parameters and SQLite will use whichever
@@ -3935,11 +3935,11 @@
39353935
** ^The collating function callback is invoked with a copy of the pArg
39363936
** application data pointer and with two strings in the encoding specified
39373937
** by the eTextRep argument. The collating function must return an
39383938
** integer that is negative, zero, or positive
39393939
** if the first string is less than, equal to, or greater than the second,
3940
-** respectively. A collating function must alway return the same answer
3940
+** respectively. A collating function must always return the same answer
39413941
** given the same inputs. If two or more collating functions are registered
39423942
** to the same collation name (using different eTextRep values) then all
39433943
** must give an equivalent answer when invoked with equivalent strings.
39443944
** The collating function must obey the following properties for all
39453945
** strings A, B, and C:
@@ -4347,11 +4347,11 @@
43474347
** <ul>
43484348
** <li> The soft heap limit is set to zero.
43494349
** <li> Memory accounting is disabled using a combination of the
43504350
** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and
43514351
** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option.
4352
-** <li> An alternative page cache implementation is specifed using
4352
+** <li> An alternative page cache implementation is specified using
43534353
** [sqlite3_config]([SQLITE_CONFIG_PCACHE],...).
43544354
** <li> The page cache allocates from its own memory pool supplied
43554355
** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
43564356
** from the heap.
43574357
** </ul>)^
@@ -4568,11 +4568,11 @@
45684568
45694569
/*
45704570
** CAPI3REF: Virtual Table Object
45714571
** KEYWORDS: sqlite3_module {virtual table module}
45724572
**
4573
-** This structure, sometimes called a a "virtual table module",
4573
+** This structure, sometimes called a "virtual table module",
45744574
** defines the implementation of a [virtual tables].
45754575
** This structure consists mostly of methods for the module.
45764576
**
45774577
** ^A virtual table module is created by filling in a persistent
45784578
** instance of this structure and passing a pointer to that instance
@@ -4880,11 +4880,11 @@
48804880
** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
48814881
** then the BLOB handle is marked as "expired".
48824882
** This is true if any column of the row is changed, even a column
48834883
** other than the one the BLOB handle is open on.)^
48844884
** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for
4885
-** a expired BLOB handle fail with an return code of [SQLITE_ABORT].
4885
+** an expired BLOB handle fail with a return code of [SQLITE_ABORT].
48864886
** ^(Changes written into a BLOB prior to the BLOB expiring are not
48874887
** rolled back by the expiration of the BLOB. Such changes will eventually
48884888
** commit if the transaction continues to completion.)^
48894889
**
48904890
** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
48914891
--- 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.6"
111 #define SQLITE_VERSION_NUMBER 3007006
112 #define SQLITE_SOURCE_ID "2011-04-05 22:08:24 3eeb0ff78d04891b5fd1a3d99a9fb8cfbed77a81"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
@@ -730,11 +730,11 @@
730 ** when the database connection has [PRAGMA synchronous] set to OFF.)^
731 ** Some specialized VFSes need this signal in order to operate correctly
732 ** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most
733 ** VFSes do not need this signal and should silently ignore this opcode.
734 ** Applications should not call [sqlite3_file_control()] with this
735 ** opcode as doing so may disrupt the operation of the specilized VFSes
736 ** that do require it.
737 */
738 #define SQLITE_FCNTL_LOCKSTATE 1
739 #define SQLITE_GET_LOCKPROXYFILE 2
740 #define SQLITE_SET_LOCKPROXYFILE 3
@@ -1312,11 +1312,11 @@
1312 ** </dd>
1313 **
1314 ** <dt>SQLITE_CONFIG_SCRATCH</dt>
1315 ** <dd> ^This option specifies a static memory buffer that SQLite can use for
1316 ** scratch memory. There are three arguments: A pointer an 8-byte
1317 ** aligned memory buffer from which the scrach allocations will be
1318 ** drawn, the size of each scratch allocation (sz),
1319 ** and the maximum number of scratch allocations (N). The sz
1320 ** argument must be a multiple of 16.
1321 ** The first argument must be a pointer to an 8-byte aligned buffer
1322 ** of at least sz*N bytes of memory.
@@ -1464,11 +1464,11 @@
1464 ** <dl>
1465 ** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
1466 ** <dd> ^This option takes three additional arguments that determine the
1467 ** [lookaside memory allocator] configuration for the [database connection].
1468 ** ^The first argument (the third parameter to [sqlite3_db_config()] is a
1469 ** pointer to an memory buffer to use for lookaside memory.
1470 ** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
1471 ** may be NULL in which case SQLite will allocate the
1472 ** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the
1473 ** size of each lookaside buffer slot. ^The third argument is the number of
1474 ** slots. The size of the buffer in the first argument must be greater than
@@ -1496,11 +1496,11 @@
1496 **
1497 ** <dt>SQLITE_DBCONFIG_ENABLE_TRIGGER</dt>
1498 ** <dd> ^This option is used to enable or disable [CREATE TRIGGER | triggers].
1499 ** There should be two additional arguments.
1500 ** The first argument is an integer which is 0 to disable triggers,
1501 ** positive to enable trigers or negative to leave the setting unchanged.
1502 ** The second parameter is a pointer to an integer into which
1503 ** is written 0 or 1 to indicate whether triggers are disabled or enabled
1504 ** following this call. The second parameter may be a NULL pointer, in
1505 ** which case the trigger setting is not reported back. </dd>
1506 **
@@ -2108,11 +2108,11 @@
2108 SQLITE_API void sqlite3_randomness(int N, void *P);
2109
2110 /*
2111 ** CAPI3REF: Compile-Time Authorization Callbacks
2112 **
2113 ** ^This routine registers a authorizer callback with a particular
2114 ** [database connection], supplied in the first argument.
2115 ** ^The authorizer callback is invoked as SQL statements are being compiled
2116 ** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
2117 ** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various
2118 ** points during the compilation process, as logic is being created
@@ -2754,11 +2754,11 @@
2754 ** will accept either a protected or an unprotected sqlite3_value.
2755 ** Every interface that accepts sqlite3_value arguments specifies
2756 ** whether or not it requires a protected sqlite3_value.
2757 **
2758 ** The terms "protected" and "unprotected" refer to whether or not
2759 ** a mutex is held. A internal mutex is held for a protected
2760 ** sqlite3_value object but no mutex is held for an unprotected
2761 ** sqlite3_value object. If SQLite is compiled to be single-threaded
2762 ** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)
2763 ** or if SQLite is run in one of reduced mutex modes
2764 ** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]
@@ -3440,11 +3440,11 @@
3440 **
3441 ** ^These functions (collectively known as "function creation routines")
3442 ** are used to add SQL functions or aggregates or to redefine the behavior
3443 ** of existing SQL functions or aggregates. The only differences between
3444 ** these routines are the text encoding expected for
3445 ** the the second parameter (the name of the function being created)
3446 ** and the presence or absence of a destructor callback for
3447 ** the application data pointer.
3448 **
3449 ** ^The first parameter is the [database connection] to which the SQL
3450 ** function is to be added. ^If an application uses more than one database
@@ -3485,11 +3485,11 @@
3485 ** pointers to C-language functions that implement the SQL function or
3486 ** aggregate. ^A scalar SQL function requires an implementation of the xFunc
3487 ** callback only; NULL pointers must be passed as the xStep and xFinal
3488 ** parameters. ^An aggregate SQL function requires an implementation of xStep
3489 ** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing
3490 ** SQL function or aggregate, pass NULL poiners for all three function
3491 ** callbacks.
3492 **
3493 ** ^(If the ninth parameter to sqlite3_create_function_v2() is not NULL,
3494 ** then it is destructor for the application data pointer.
3495 ** The destructor is invoked when the function is deleted, either by being
@@ -3919,11 +3919,11 @@
3919 ** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep
3920 ** force strings to be UTF16 with native byte order.
3921 ** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin
3922 ** on an even byte address.
3923 **
3924 ** ^The fourth argument, pArg, is a application data pointer that is passed
3925 ** through as the first argument to the collating function callback.
3926 **
3927 ** ^The fifth argument, xCallback, is a pointer to the collating function.
3928 ** ^Multiple collating functions can be registered using the same name but
3929 ** with different eTextRep parameters and SQLite will use whichever
@@ -3935,11 +3935,11 @@
3935 ** ^The collating function callback is invoked with a copy of the pArg
3936 ** application data pointer and with two strings in the encoding specified
3937 ** by the eTextRep argument. The collating function must return an
3938 ** integer that is negative, zero, or positive
3939 ** if the first string is less than, equal to, or greater than the second,
3940 ** respectively. A collating function must alway return the same answer
3941 ** given the same inputs. If two or more collating functions are registered
3942 ** to the same collation name (using different eTextRep values) then all
3943 ** must give an equivalent answer when invoked with equivalent strings.
3944 ** The collating function must obey the following properties for all
3945 ** strings A, B, and C:
@@ -4347,11 +4347,11 @@
4347 ** <ul>
4348 ** <li> The soft heap limit is set to zero.
4349 ** <li> Memory accounting is disabled using a combination of the
4350 ** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and
4351 ** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option.
4352 ** <li> An alternative page cache implementation is specifed using
4353 ** [sqlite3_config]([SQLITE_CONFIG_PCACHE],...).
4354 ** <li> The page cache allocates from its own memory pool supplied
4355 ** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
4356 ** from the heap.
4357 ** </ul>)^
@@ -4568,11 +4568,11 @@
4568
4569 /*
4570 ** CAPI3REF: Virtual Table Object
4571 ** KEYWORDS: sqlite3_module {virtual table module}
4572 **
4573 ** This structure, sometimes called a a "virtual table module",
4574 ** defines the implementation of a [virtual tables].
4575 ** This structure consists mostly of methods for the module.
4576 **
4577 ** ^A virtual table module is created by filling in a persistent
4578 ** instance of this structure and passing a pointer to that instance
@@ -4880,11 +4880,11 @@
4880 ** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
4881 ** then the BLOB handle is marked as "expired".
4882 ** This is true if any column of the row is changed, even a column
4883 ** other than the one the BLOB handle is open on.)^
4884 ** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for
4885 ** a expired BLOB handle fail with an return code of [SQLITE_ABORT].
4886 ** ^(Changes written into a BLOB prior to the BLOB expiring are not
4887 ** rolled back by the expiration of the BLOB. Such changes will eventually
4888 ** commit if the transaction continues to completion.)^
4889 **
4890 ** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
4891
--- 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.6"
111 #define SQLITE_VERSION_NUMBER 3007006
112 #define SQLITE_SOURCE_ID "2011-04-07 15:24:08 bf78acb9dfacde0f08a5b3ceac13480f12a06168"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
@@ -730,11 +730,11 @@
730 ** when the database connection has [PRAGMA synchronous] set to OFF.)^
731 ** Some specialized VFSes need this signal in order to operate correctly
732 ** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most
733 ** VFSes do not need this signal and should silently ignore this opcode.
734 ** Applications should not call [sqlite3_file_control()] with this
735 ** opcode as doing so may disrupt the operation of the specialized VFSes
736 ** that do require it.
737 */
738 #define SQLITE_FCNTL_LOCKSTATE 1
739 #define SQLITE_GET_LOCKPROXYFILE 2
740 #define SQLITE_SET_LOCKPROXYFILE 3
@@ -1312,11 +1312,11 @@
1312 ** </dd>
1313 **
1314 ** <dt>SQLITE_CONFIG_SCRATCH</dt>
1315 ** <dd> ^This option specifies a static memory buffer that SQLite can use for
1316 ** scratch memory. There are three arguments: A pointer an 8-byte
1317 ** aligned memory buffer from which the scratch allocations will be
1318 ** drawn, the size of each scratch allocation (sz),
1319 ** and the maximum number of scratch allocations (N). The sz
1320 ** argument must be a multiple of 16.
1321 ** The first argument must be a pointer to an 8-byte aligned buffer
1322 ** of at least sz*N bytes of memory.
@@ -1464,11 +1464,11 @@
1464 ** <dl>
1465 ** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
1466 ** <dd> ^This option takes three additional arguments that determine the
1467 ** [lookaside memory allocator] configuration for the [database connection].
1468 ** ^The first argument (the third parameter to [sqlite3_db_config()] is a
1469 ** pointer to a memory buffer to use for lookaside memory.
1470 ** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
1471 ** may be NULL in which case SQLite will allocate the
1472 ** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the
1473 ** size of each lookaside buffer slot. ^The third argument is the number of
1474 ** slots. The size of the buffer in the first argument must be greater than
@@ -1496,11 +1496,11 @@
1496 **
1497 ** <dt>SQLITE_DBCONFIG_ENABLE_TRIGGER</dt>
1498 ** <dd> ^This option is used to enable or disable [CREATE TRIGGER | triggers].
1499 ** There should be two additional arguments.
1500 ** The first argument is an integer which is 0 to disable triggers,
1501 ** positive to enable triggers or negative to leave the setting unchanged.
1502 ** The second parameter is a pointer to an integer into which
1503 ** is written 0 or 1 to indicate whether triggers are disabled or enabled
1504 ** following this call. The second parameter may be a NULL pointer, in
1505 ** which case the trigger setting is not reported back. </dd>
1506 **
@@ -2108,11 +2108,11 @@
2108 SQLITE_API void sqlite3_randomness(int N, void *P);
2109
2110 /*
2111 ** CAPI3REF: Compile-Time Authorization Callbacks
2112 **
2113 ** ^This routine registers an authorizer callback with a particular
2114 ** [database connection], supplied in the first argument.
2115 ** ^The authorizer callback is invoked as SQL statements are being compiled
2116 ** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
2117 ** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various
2118 ** points during the compilation process, as logic is being created
@@ -2754,11 +2754,11 @@
2754 ** will accept either a protected or an unprotected sqlite3_value.
2755 ** Every interface that accepts sqlite3_value arguments specifies
2756 ** whether or not it requires a protected sqlite3_value.
2757 **
2758 ** The terms "protected" and "unprotected" refer to whether or not
2759 ** a mutex is held. An internal mutex is held for a protected
2760 ** sqlite3_value object but no mutex is held for an unprotected
2761 ** sqlite3_value object. If SQLite is compiled to be single-threaded
2762 ** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)
2763 ** or if SQLite is run in one of reduced mutex modes
2764 ** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]
@@ -3440,11 +3440,11 @@
3440 **
3441 ** ^These functions (collectively known as "function creation routines")
3442 ** are used to add SQL functions or aggregates or to redefine the behavior
3443 ** of existing SQL functions or aggregates. The only differences between
3444 ** these routines are the text encoding expected for
3445 ** the second parameter (the name of the function being created)
3446 ** and the presence or absence of a destructor callback for
3447 ** the application data pointer.
3448 **
3449 ** ^The first parameter is the [database connection] to which the SQL
3450 ** function is to be added. ^If an application uses more than one database
@@ -3485,11 +3485,11 @@
3485 ** pointers to C-language functions that implement the SQL function or
3486 ** aggregate. ^A scalar SQL function requires an implementation of the xFunc
3487 ** callback only; NULL pointers must be passed as the xStep and xFinal
3488 ** parameters. ^An aggregate SQL function requires an implementation of xStep
3489 ** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing
3490 ** SQL function or aggregate, pass NULL pointers for all three function
3491 ** callbacks.
3492 **
3493 ** ^(If the ninth parameter to sqlite3_create_function_v2() is not NULL,
3494 ** then it is destructor for the application data pointer.
3495 ** The destructor is invoked when the function is deleted, either by being
@@ -3919,11 +3919,11 @@
3919 ** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep
3920 ** force strings to be UTF16 with native byte order.
3921 ** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin
3922 ** on an even byte address.
3923 **
3924 ** ^The fourth argument, pArg, is an application data pointer that is passed
3925 ** through as the first argument to the collating function callback.
3926 **
3927 ** ^The fifth argument, xCallback, is a pointer to the collating function.
3928 ** ^Multiple collating functions can be registered using the same name but
3929 ** with different eTextRep parameters and SQLite will use whichever
@@ -3935,11 +3935,11 @@
3935 ** ^The collating function callback is invoked with a copy of the pArg
3936 ** application data pointer and with two strings in the encoding specified
3937 ** by the eTextRep argument. The collating function must return an
3938 ** integer that is negative, zero, or positive
3939 ** if the first string is less than, equal to, or greater than the second,
3940 ** respectively. A collating function must always return the same answer
3941 ** given the same inputs. If two or more collating functions are registered
3942 ** to the same collation name (using different eTextRep values) then all
3943 ** must give an equivalent answer when invoked with equivalent strings.
3944 ** The collating function must obey the following properties for all
3945 ** strings A, B, and C:
@@ -4347,11 +4347,11 @@
4347 ** <ul>
4348 ** <li> The soft heap limit is set to zero.
4349 ** <li> Memory accounting is disabled using a combination of the
4350 ** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and
4351 ** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option.
4352 ** <li> An alternative page cache implementation is specified using
4353 ** [sqlite3_config]([SQLITE_CONFIG_PCACHE],...).
4354 ** <li> The page cache allocates from its own memory pool supplied
4355 ** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
4356 ** from the heap.
4357 ** </ul>)^
@@ -4568,11 +4568,11 @@
4568
4569 /*
4570 ** CAPI3REF: Virtual Table Object
4571 ** KEYWORDS: sqlite3_module {virtual table module}
4572 **
4573 ** This structure, sometimes called a "virtual table module",
4574 ** defines the implementation of a [virtual tables].
4575 ** This structure consists mostly of methods for the module.
4576 **
4577 ** ^A virtual table module is created by filling in a persistent
4578 ** instance of this structure and passing a pointer to that instance
@@ -4880,11 +4880,11 @@
4880 ** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
4881 ** then the BLOB handle is marked as "expired".
4882 ** This is true if any column of the row is changed, even a column
4883 ** other than the one the BLOB handle is open on.)^
4884 ** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for
4885 ** an expired BLOB handle fail with a return code of [SQLITE_ABORT].
4886 ** ^(Changes written into a BLOB prior to the BLOB expiring are not
4887 ** rolled back by the expiration of the BLOB. Such changes will eventually
4888 ** commit if the transaction continues to completion.)^
4889 **
4890 ** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
4891

Keyboard Shortcuts

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