Fossil SCM

Update SQLite to the latest version 3.7.1 beta.

drh 2010-08-20 19:56 trunk
Commit 79c9de763a272f3c29a24c11a5d6d1301ae08874
2 files changed +72 -34 +1 -1
+72 -34
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -216,20 +216,22 @@
216216
#endif
217217
218218
/* Maximum page size. The upper bound on this value is 65536. This a limit
219219
** imposed by the use of 16-bit offsets within each page.
220220
**
221
-** If this limit is changed, then the compiled library is technically
222
-** incompatible with an SQLite library compiled with a different limit. If
223
-** a process operating on a database with a page-size of 65536 bytes
224
-** crashes, then an instance of SQLite compiled with the default page-size
225
-** limit will not be able to rollback the aborted transaction. This could
226
-** lead to database corruption.
221
+** Earlier versions of SQLite allowed the user to change this value at
222
+** compile time. This is no longer permitted, on the grounds that it creates
223
+** a library that is technically incompatible with an SQLite library
224
+** compiled with a different limit. If a process operating on a database
225
+** with a page-size of 65536 bytes crashes, then an instance of SQLite
226
+** compiled with the default page-size limit will not be able to rollback
227
+** the aborted transaction. This could lead to database corruption.
227228
*/
228
-#ifndef SQLITE_MAX_PAGE_SIZE
229
-# define SQLITE_MAX_PAGE_SIZE 65536
229
+#ifdef SQLITE_MAX_PAGE_SIZE
230
+# undef SQLITE_MAX_PAGE_SIZE
230231
#endif
232
+#define SQLITE_MAX_PAGE_SIZE 65536
231233
232234
233235
/*
234236
** The default size of a database page.
235237
*/
@@ -642,11 +644,11 @@
642644
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
643645
** [sqlite_version()] and [sqlite_source_id()].
644646
*/
645647
#define SQLITE_VERSION "3.7.1"
646648
#define SQLITE_VERSION_NUMBER 3007001
647
-#define SQLITE_SOURCE_ID "2010-08-17 19:49:14 acb171d4cfef2fec8833f761019f5c81f0d138a0"
649
+#define SQLITE_SOURCE_ID "2010-08-20 15:32:21 5523ecd32295c188e3bf5dbd57d92d2879461e32"
648650
649651
/*
650652
** CAPI3REF: Run-Time Library Version Numbers
651653
** KEYWORDS: sqlite3_version, sqlite3_sourceid
652654
**
@@ -14339,11 +14341,11 @@
1433914341
1434014342
/*
1434114343
** Set the "type" of an allocation.
1434214344
*/
1434314345
SQLITE_PRIVATE void sqlite3MemdebugSetType(void *p, u8 eType){
14344
- if( p ){
14346
+ if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){
1434514347
struct MemBlockHdr *pHdr;
1434614348
pHdr = sqlite3MemsysGetHeader(p);
1434714349
assert( pHdr->iForeGuard==FOREGUARD );
1434814350
pHdr->eType = eType;
1434914351
}
@@ -14358,11 +14360,11 @@
1435814360
**
1435914361
** assert( sqlite3MemdebugHasType(p, MEMTYPE_DB) );
1436014362
*/
1436114363
SQLITE_PRIVATE int sqlite3MemdebugHasType(void *p, u8 eType){
1436214364
int rc = 1;
14363
- if( p ){
14365
+ if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){
1436414366
struct MemBlockHdr *pHdr;
1436514367
pHdr = sqlite3MemsysGetHeader(p);
1436614368
assert( pHdr->iForeGuard==FOREGUARD ); /* Allocation is valid */
1436714369
if( (pHdr->eType&eType)==0 ){
1436814370
rc = 0;
@@ -14380,11 +14382,11 @@
1438014382
**
1438114383
** assert( sqlite3MemdebugNoType(p, MEMTYPE_DB) );
1438214384
*/
1438314385
SQLITE_PRIVATE int sqlite3MemdebugNoType(void *p, u8 eType){
1438414386
int rc = 1;
14385
- if( p ){
14387
+ if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){
1438614388
struct MemBlockHdr *pHdr;
1438714389
pHdr = sqlite3MemsysGetHeader(p);
1438814390
assert( pHdr->iForeGuard==FOREGUARD ); /* Allocation is valid */
1438914391
if( (pHdr->eType&eType)!=0 ){
1439014392
rc = 0;
@@ -33010,10 +33012,29 @@
3301033012
sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, -iSize);
3301133013
sqlite3_free(p);
3301233014
}
3301333015
}
3301433016
33017
+#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
33018
+/*
33019
+** Return the size of a pache allocation
33020
+*/
33021
+static int pcache1MemSize(void *p){
33022
+ assert( sqlite3_mutex_held(pcache1.mutex) );
33023
+ if( p>=pcache1.pStart && p<pcache1.pEnd ){
33024
+ return pcache1.szSlot;
33025
+ }else{
33026
+ int iSize;
33027
+ assert( sqlite3MemdebugHasType(p, MEMTYPE_PCACHE) );
33028
+ sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
33029
+ iSize = sqlite3MallocSize(p);
33030
+ sqlite3MemdebugSetType(p, MEMTYPE_PCACHE);
33031
+ return iSize;
33032
+ }
33033
+}
33034
+#endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */
33035
+
3301533036
/*
3301633037
** Allocate a new page object initially associated with cache pCache.
3301733038
*/
3301833039
static PgHdr1 *pcache1AllocPage(PCache1 *pCache){
3301933040
int nByte = sizeof(PgHdr1) + pCache->szPage;
@@ -33558,11 +33579,11 @@
3355833579
int nFree = 0;
3355933580
if( pcache1.pStart==0 ){
3356033581
PgHdr1 *p;
3356133582
pcache1EnterMutex();
3356233583
while( (nReq<0 || nFree<nReq) && (p=pcache1.pLruTail) ){
33563
- nFree += sqlite3MallocSize(PGHDR1_TO_PAGE(p));
33584
+ nFree += pcache1MemSize(PGHDR1_TO_PAGE(p));
3356433585
pcache1PinPage(p);
3356533586
pcache1RemoveFromHash(p);
3356633587
pcache1FreePage(p);
3356733588
}
3356833589
pcache1LeaveMutex();
@@ -35185,11 +35206,11 @@
3518535206
assert( eLock!=NO_LOCK || pagerUseWal(pPager)==0 );
3518635207
if( isOpen(pPager->fd) ){
3518735208
assert( pPager->eLock>=eLock );
3518835209
rc = sqlite3OsUnlock(pPager->fd, eLock);
3518935210
if( pPager->eLock!=UNKNOWN_LOCK ){
35190
- pPager->eLock = eLock;
35211
+ pPager->eLock = (u8)eLock;
3519135212
}
3519235213
IOTRACE(("UNLOCK %p %d\n", pPager, eLock))
3519335214
}
3519435215
return rc;
3519535216
}
@@ -35209,11 +35230,11 @@
3520935230
3521035231
assert( eLock==SHARED_LOCK || eLock==RESERVED_LOCK || eLock==EXCLUSIVE_LOCK );
3521135232
if( pPager->eLock<eLock || pPager->eLock==UNKNOWN_LOCK ){
3521235233
rc = sqlite3OsLock(pPager->fd, eLock);
3521335234
if( rc==SQLITE_OK && (pPager->eLock!=UNKNOWN_LOCK||eLock==EXCLUSIVE_LOCK) ){
35214
- pPager->eLock = eLock;
35235
+ pPager->eLock = (u8)eLock;
3521535236
IOTRACE(("LOCK %p %d\n", pPager, eLock))
3521635237
}
3521735238
}
3521835239
return rc;
3521935240
}
@@ -35636,10 +35657,18 @@
3563635657
if( SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+20, &iSectorSize))
3563735658
|| SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+24, &iPageSize))
3563835659
){
3563935660
return rc;
3564035661
}
35662
+
35663
+ /* Versions of SQLite prior to 3.5.8 set the page-size field of the
35664
+ ** journal header to zero. In this case, assume that the Pager.pageSize
35665
+ ** variable is already set to the correct page size.
35666
+ */
35667
+ if( iPageSize==0 ){
35668
+ iPageSize = pPager->pageSize;
35669
+ }
3564135670
3564235671
/* Check that the values read from the page-size and sector-size fields
3564335672
** are within range. To be 'in range', both values need to be a power
3564435673
** of two greater than or equal to 512 or 32, and not greater than their
3564535674
** respective compile time maximum limits.
@@ -37494,11 +37523,11 @@
3749437523
assert( pageSize==0 || (pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE) );
3749537524
if( (pPager->memDb==0 || pPager->dbSize==0)
3749637525
&& sqlite3PcacheRefCount(pPager->pPCache)==0
3749737526
&& pageSize && pageSize!=(u32)pPager->pageSize
3749837527
){
37499
- char *pNew; /* New temp space */
37528
+ char *pNew = NULL; /* New temp space */
3750037529
i64 nByte = 0;
3750137530
3750237531
if( pPager->eState>PAGER_OPEN && isOpen(pPager->fd) ){
3750337532
rc = sqlite3OsFileSize(pPager->fd, &nByte);
3750437533
}
@@ -37507,11 +37536,11 @@
3750737536
if( !pNew ) rc = SQLITE_NOMEM;
3750837537
}
3750937538
3751037539
if( rc==SQLITE_OK ){
3751137540
pager_reset(pPager);
37512
- pPager->dbSize = nByte/pageSize;
37541
+ pPager->dbSize = (Pgno)(nByte/pageSize);
3751337542
pPager->pageSize = pageSize;
3751437543
sqlite3PageFree(pPager->pTmpSpace);
3751537544
pPager->pTmpSpace = pNew;
3751637545
sqlite3PcacheSetPageSize(pPager->pPCache, pageSize);
3751737546
}
@@ -41910,11 +41939,11 @@
4191041939
4191141940
/* If nTruncate is non-zero, this is a commit record. */
4191241941
if( nTruncate ){
4191341942
pWal->hdr.mxFrame = iFrame;
4191441943
pWal->hdr.nPage = nTruncate;
41915
- pWal->hdr.szPage = (szPage&0xff00) | (szPage>>16);
41944
+ pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16));
4191641945
testcase( szPage<=32768 );
4191741946
testcase( szPage>=65536 );
4191841947
aFrameCksum[0] = pWal->hdr.aFrameCksum[0];
4191941948
aFrameCksum[1] = pWal->hdr.aFrameCksum[1];
4192041949
}
@@ -43337,11 +43366,11 @@
4333743366
rc = walIndexAppend(pWal, iFrame, pLast->pgno);
4333843367
}
4333943368
4334043369
if( rc==SQLITE_OK ){
4334143370
/* Update the private copy of the header. */
43342
- pWal->hdr.szPage = (szPage&0xff00) | (szPage>>16);
43371
+ pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16));
4334343372
testcase( szPage<=32768 );
4334443373
testcase( szPage>=65536 );
4334543374
pWal->hdr.mxFrame = iFrame;
4334643375
if( isCommit ){
4334743376
pWal->hdr.iChange++;
@@ -45873,11 +45902,11 @@
4587345902
u16 pc; /* Address of a freeblock within pPage->aData[] */
4587445903
u8 hdr; /* Offset to beginning of page header */
4587545904
u8 *data; /* Equal to pPage->aData */
4587645905
BtShared *pBt; /* The main btree structure */
4587745906
int usableSize; /* Amount of usable space on each page */
45878
- int cellOffset; /* Offset from start of page to first cell pointer */
45907
+ u16 cellOffset; /* Offset from start of page to first cell pointer */
4587945908
int nFree; /* Number of unused bytes on the page */
4588045909
int top; /* First byte of the cell content area */
4588145910
int iCellFirst; /* First allowable cell or freeblock offset */
4588245911
int iCellLast; /* Last possible cell or freeblock offset */
4588345912
@@ -45988,11 +46017,11 @@
4598846017
data[hdr] = (char)flags;
4598946018
first = hdr + 8 + 4*((flags&PTF_LEAF)==0 ?1:0);
4599046019
memset(&data[hdr+1], 0, 4);
4599146020
data[hdr+7] = 0;
4599246021
put2byte(&data[hdr+5], pBt->usableSize);
45993
- pPage->nFree = pBt->usableSize - first;
46022
+ pPage->nFree = (u16)(pBt->usableSize - first);
4599446023
decodeFlags(pPage, flags);
4599546024
pPage->hdrOffset = hdr;
4599646025
pPage->cellOffset = first;
4599746026
pPage->nOverflow = 0;
4599846027
assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
@@ -46817,11 +46846,11 @@
4681746846
){
4681846847
goto page1_init_failed;
4681946848
}
4682046849
assert( (pageSize & 7)==0 );
4682146850
usableSize = pageSize - page1[20];
46822
- if( pageSize!=pBt->pageSize ){
46851
+ if( (u32)pageSize!=pBt->pageSize ){
4682346852
/* After reading the first page of the database assuming a page size
4682446853
** of BtShared.pageSize, we have discovered that the page-size is
4682546854
** actually pageSize. Unlock the database, leave pBt->pPage1 at
4682646855
** zero and return SQLITE_OK. The caller will call this function
4682746856
** again with the correct page-size.
@@ -46856,18 +46885,18 @@
4685646885
** 2-byte pointer to the cell
4685746886
** 4-byte child pointer
4685846887
** 9-byte nKey value
4685946888
** 4-byte nData value
4686046889
** 4-byte overflow page pointer
46861
- ** So a cell consists of a 2-byte poiner, a header which is as much as
46890
+ ** So a cell consists of a 2-byte pointer, a header which is as much as
4686246891
** 17 bytes long, 0 to N bytes of payload, and an optional 4 byte overflow
4686346892
** page pointer.
4686446893
*/
46865
- pBt->maxLocal = (pBt->usableSize-12)*64/255 - 23;
46866
- pBt->minLocal = (pBt->usableSize-12)*32/255 - 23;
46867
- pBt->maxLeaf = pBt->usableSize - 35;
46868
- pBt->minLeaf = (pBt->usableSize-12)*32/255 - 23;
46894
+ pBt->maxLocal = (u16)((pBt->usableSize-12)*64/255 - 23);
46895
+ pBt->minLocal = (u16)((pBt->usableSize-12)*32/255 - 23);
46896
+ pBt->maxLeaf = (u16)(pBt->usableSize - 35);
46897
+ pBt->minLeaf = (u16)((pBt->usableSize-12)*32/255 - 23);
4686946898
assert( pBt->maxLeaf + 23 <= MX_CELL_SIZE(pBt) );
4687046899
pBt->pPage1 = pPage1;
4687146900
pBt->nPage = nPage;
4687246901
return SQLITE_OK;
4687346902
@@ -46916,12 +46945,12 @@
4691646945
data = pP1->aData;
4691746946
rc = sqlite3PagerWrite(pP1->pDbPage);
4691846947
if( rc ) return rc;
4691946948
memcpy(data, zMagicHeader, sizeof(zMagicHeader));
4692046949
assert( sizeof(zMagicHeader)==16 );
46921
- data[16] = (pBt->pageSize>>8)&0xff;
46922
- data[17] = (pBt->pageSize>>16)&0xff;
46950
+ data[16] = (u8)((pBt->pageSize>>8)&0xff);
46951
+ data[17] = (u8)((pBt->pageSize>>16)&0xff);
4692346952
data[18] = 1;
4692446953
data[19] = 1;
4692546954
assert( pBt->usableSize<=pBt->pageSize && pBt->usableSize+255>=pBt->pageSize);
4692646955
data[20] = (u8)(pBt->pageSize - pBt->usableSize);
4692746956
data[21] = 64;
@@ -49599,11 +49628,11 @@
4959949628
BtShared *pBt = pPage->pBt;
4960049629
CellInfo info;
4960149630
Pgno ovflPgno;
4960249631
int rc;
4960349632
int nOvfl;
49604
- u16 ovflPageSize;
49633
+ u32 ovflPageSize;
4960549634
4960649635
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
4960749636
btreeParseCellPtr(pPage, pCell, &info);
4960849637
if( info.iOverflow==0 ){
4960949638
return SQLITE_OK; /* No overflow pages. Return without doing anything */
@@ -50051,11 +50080,11 @@
5005150080
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
5005250081
assert( sqlite3PagerIswriteable(pParent->pDbPage) );
5005350082
assert( pPage->nOverflow==1 );
5005450083
5005550084
/* This error condition is now caught prior to reaching this function */
50056
- if( NEVER(pPage->nCell<=0) ) return SQLITE_CORRUPT_BKPT;
50085
+ if( pPage->nCell<=0 ) return SQLITE_CORRUPT_BKPT;
5005750086
5005850087
/* Allocate a new page. This page will become the right-sibling of
5005950088
** pPage. Make the parent page writable, so that the new divider cell
5006050089
** may be inserted. If both these operations are successful, proceed.
5006150090
*/
@@ -50459,11 +50488,11 @@
5045950488
u8 *pTemp;
5046050489
assert( nCell<nMaxCells );
5046150490
szCell[nCell] = sz;
5046250491
pTemp = &aSpace1[iSpace1];
5046350492
iSpace1 += sz;
50464
- assert( sz<=pBt->pageSize/4 );
50493
+ assert( sz<=pBt->maxLocal+23 );
5046550494
assert( iSpace1<=pBt->pageSize );
5046650495
memcpy(pTemp, apDiv[i], sz);
5046750496
apCell[nCell] = pTemp+leafCorrection;
5046850497
assert( leafCorrection==0 || leafCorrection==4 );
5046950498
szCell[nCell] = szCell[nCell] - leafCorrection;
@@ -50705,11 +50734,11 @@
5070550734
assert(leafCorrection==4);
5070650735
sz = cellSizePtr(pParent, pCell);
5070750736
}
5070850737
}
5070950738
iOvflSpace += sz;
50710
- assert( sz<=pBt->pageSize/4 );
50739
+ assert( sz<=pBt->maxLocal+23 );
5071150740
assert( iOvflSpace<=pBt->pageSize );
5071250741
insertCell(pParent, nxDiv, pCell, sz, pTemp, pNew->pgno, &rc);
5071350742
if( rc!=SQLITE_OK ) goto balance_cleanup;
5071450743
assert( sqlite3PagerIswriteable(pParent->pDbPage) );
5071550744
@@ -52796,10 +52825,19 @@
5279652825
** page sizes of the source and destination differ.
5279752826
*/
5279852827
if( nSrcPgsz!=nDestPgsz && sqlite3PagerIsMemdb(pDestPager) ){
5279952828
rc = SQLITE_READONLY;
5280052829
}
52830
+
52831
+#ifdef SQLITE_HAS_CODEC
52832
+ /* Backup is not possible if the page size of the destination is changing
52833
+ ** a a codec is in use.
52834
+ */
52835
+ if( nSrcPgsz!=nDestPgsz && sqlite3PagerGetCodec(pDestPager)!=0 ){
52836
+ rc = SQLITE_READONLY;
52837
+ }
52838
+#endif
5280152839
5280252840
/* This loop runs once for each destination page spanned by the source
5280352841
** page. For each iteration, variable iOff is set to the byte offset
5280452842
** of the destination page.
5280552843
*/
@@ -68200,11 +68238,11 @@
6820068238
if( bOk==0 || i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
6820168239
sqlite3ErrorMsg(pParse, "variable number must be between ?1 and ?%d",
6820268240
db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]);
6820368241
}
6820468242
if( i>pParse->nVar ){
68205
- pParse->nVar = i;
68243
+ pParse->nVar = (int)i;
6820668244
}
6820768245
}else{
6820868246
/* Wildcards like ":aaa", "$aaa" or "@aaa". Reuse the same variable
6820968247
** number as the prior appearance of the same name, or if the name
6821068248
** has never appeared before, reuse the same variable number
6821168249
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -216,20 +216,22 @@
216 #endif
217
218 /* Maximum page size. The upper bound on this value is 65536. This a limit
219 ** imposed by the use of 16-bit offsets within each page.
220 **
221 ** If this limit is changed, then the compiled library is technically
222 ** incompatible with an SQLite library compiled with a different limit. If
223 ** a process operating on a database with a page-size of 65536 bytes
224 ** crashes, then an instance of SQLite compiled with the default page-size
225 ** limit will not be able to rollback the aborted transaction. This could
226 ** lead to database corruption.
 
227 */
228 #ifndef SQLITE_MAX_PAGE_SIZE
229 # define SQLITE_MAX_PAGE_SIZE 65536
230 #endif
 
231
232
233 /*
234 ** The default size of a database page.
235 */
@@ -642,11 +644,11 @@
642 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
643 ** [sqlite_version()] and [sqlite_source_id()].
644 */
645 #define SQLITE_VERSION "3.7.1"
646 #define SQLITE_VERSION_NUMBER 3007001
647 #define SQLITE_SOURCE_ID "2010-08-17 19:49:14 acb171d4cfef2fec8833f761019f5c81f0d138a0"
648
649 /*
650 ** CAPI3REF: Run-Time Library Version Numbers
651 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
652 **
@@ -14339,11 +14341,11 @@
14339
14340 /*
14341 ** Set the "type" of an allocation.
14342 */
14343 SQLITE_PRIVATE void sqlite3MemdebugSetType(void *p, u8 eType){
14344 if( p ){
14345 struct MemBlockHdr *pHdr;
14346 pHdr = sqlite3MemsysGetHeader(p);
14347 assert( pHdr->iForeGuard==FOREGUARD );
14348 pHdr->eType = eType;
14349 }
@@ -14358,11 +14360,11 @@
14358 **
14359 ** assert( sqlite3MemdebugHasType(p, MEMTYPE_DB) );
14360 */
14361 SQLITE_PRIVATE int sqlite3MemdebugHasType(void *p, u8 eType){
14362 int rc = 1;
14363 if( p ){
14364 struct MemBlockHdr *pHdr;
14365 pHdr = sqlite3MemsysGetHeader(p);
14366 assert( pHdr->iForeGuard==FOREGUARD ); /* Allocation is valid */
14367 if( (pHdr->eType&eType)==0 ){
14368 rc = 0;
@@ -14380,11 +14382,11 @@
14380 **
14381 ** assert( sqlite3MemdebugNoType(p, MEMTYPE_DB) );
14382 */
14383 SQLITE_PRIVATE int sqlite3MemdebugNoType(void *p, u8 eType){
14384 int rc = 1;
14385 if( p ){
14386 struct MemBlockHdr *pHdr;
14387 pHdr = sqlite3MemsysGetHeader(p);
14388 assert( pHdr->iForeGuard==FOREGUARD ); /* Allocation is valid */
14389 if( (pHdr->eType&eType)!=0 ){
14390 rc = 0;
@@ -33010,10 +33012,29 @@
33010 sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, -iSize);
33011 sqlite3_free(p);
33012 }
33013 }
33014
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33015 /*
33016 ** Allocate a new page object initially associated with cache pCache.
33017 */
33018 static PgHdr1 *pcache1AllocPage(PCache1 *pCache){
33019 int nByte = sizeof(PgHdr1) + pCache->szPage;
@@ -33558,11 +33579,11 @@
33558 int nFree = 0;
33559 if( pcache1.pStart==0 ){
33560 PgHdr1 *p;
33561 pcache1EnterMutex();
33562 while( (nReq<0 || nFree<nReq) && (p=pcache1.pLruTail) ){
33563 nFree += sqlite3MallocSize(PGHDR1_TO_PAGE(p));
33564 pcache1PinPage(p);
33565 pcache1RemoveFromHash(p);
33566 pcache1FreePage(p);
33567 }
33568 pcache1LeaveMutex();
@@ -35185,11 +35206,11 @@
35185 assert( eLock!=NO_LOCK || pagerUseWal(pPager)==0 );
35186 if( isOpen(pPager->fd) ){
35187 assert( pPager->eLock>=eLock );
35188 rc = sqlite3OsUnlock(pPager->fd, eLock);
35189 if( pPager->eLock!=UNKNOWN_LOCK ){
35190 pPager->eLock = eLock;
35191 }
35192 IOTRACE(("UNLOCK %p %d\n", pPager, eLock))
35193 }
35194 return rc;
35195 }
@@ -35209,11 +35230,11 @@
35209
35210 assert( eLock==SHARED_LOCK || eLock==RESERVED_LOCK || eLock==EXCLUSIVE_LOCK );
35211 if( pPager->eLock<eLock || pPager->eLock==UNKNOWN_LOCK ){
35212 rc = sqlite3OsLock(pPager->fd, eLock);
35213 if( rc==SQLITE_OK && (pPager->eLock!=UNKNOWN_LOCK||eLock==EXCLUSIVE_LOCK) ){
35214 pPager->eLock = eLock;
35215 IOTRACE(("LOCK %p %d\n", pPager, eLock))
35216 }
35217 }
35218 return rc;
35219 }
@@ -35636,10 +35657,18 @@
35636 if( SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+20, &iSectorSize))
35637 || SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+24, &iPageSize))
35638 ){
35639 return rc;
35640 }
 
 
 
 
 
 
 
 
35641
35642 /* Check that the values read from the page-size and sector-size fields
35643 ** are within range. To be 'in range', both values need to be a power
35644 ** of two greater than or equal to 512 or 32, and not greater than their
35645 ** respective compile time maximum limits.
@@ -37494,11 +37523,11 @@
37494 assert( pageSize==0 || (pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE) );
37495 if( (pPager->memDb==0 || pPager->dbSize==0)
37496 && sqlite3PcacheRefCount(pPager->pPCache)==0
37497 && pageSize && pageSize!=(u32)pPager->pageSize
37498 ){
37499 char *pNew; /* New temp space */
37500 i64 nByte = 0;
37501
37502 if( pPager->eState>PAGER_OPEN && isOpen(pPager->fd) ){
37503 rc = sqlite3OsFileSize(pPager->fd, &nByte);
37504 }
@@ -37507,11 +37536,11 @@
37507 if( !pNew ) rc = SQLITE_NOMEM;
37508 }
37509
37510 if( rc==SQLITE_OK ){
37511 pager_reset(pPager);
37512 pPager->dbSize = nByte/pageSize;
37513 pPager->pageSize = pageSize;
37514 sqlite3PageFree(pPager->pTmpSpace);
37515 pPager->pTmpSpace = pNew;
37516 sqlite3PcacheSetPageSize(pPager->pPCache, pageSize);
37517 }
@@ -41910,11 +41939,11 @@
41910
41911 /* If nTruncate is non-zero, this is a commit record. */
41912 if( nTruncate ){
41913 pWal->hdr.mxFrame = iFrame;
41914 pWal->hdr.nPage = nTruncate;
41915 pWal->hdr.szPage = (szPage&0xff00) | (szPage>>16);
41916 testcase( szPage<=32768 );
41917 testcase( szPage>=65536 );
41918 aFrameCksum[0] = pWal->hdr.aFrameCksum[0];
41919 aFrameCksum[1] = pWal->hdr.aFrameCksum[1];
41920 }
@@ -43337,11 +43366,11 @@
43337 rc = walIndexAppend(pWal, iFrame, pLast->pgno);
43338 }
43339
43340 if( rc==SQLITE_OK ){
43341 /* Update the private copy of the header. */
43342 pWal->hdr.szPage = (szPage&0xff00) | (szPage>>16);
43343 testcase( szPage<=32768 );
43344 testcase( szPage>=65536 );
43345 pWal->hdr.mxFrame = iFrame;
43346 if( isCommit ){
43347 pWal->hdr.iChange++;
@@ -45873,11 +45902,11 @@
45873 u16 pc; /* Address of a freeblock within pPage->aData[] */
45874 u8 hdr; /* Offset to beginning of page header */
45875 u8 *data; /* Equal to pPage->aData */
45876 BtShared *pBt; /* The main btree structure */
45877 int usableSize; /* Amount of usable space on each page */
45878 int cellOffset; /* Offset from start of page to first cell pointer */
45879 int nFree; /* Number of unused bytes on the page */
45880 int top; /* First byte of the cell content area */
45881 int iCellFirst; /* First allowable cell or freeblock offset */
45882 int iCellLast; /* Last possible cell or freeblock offset */
45883
@@ -45988,11 +46017,11 @@
45988 data[hdr] = (char)flags;
45989 first = hdr + 8 + 4*((flags&PTF_LEAF)==0 ?1:0);
45990 memset(&data[hdr+1], 0, 4);
45991 data[hdr+7] = 0;
45992 put2byte(&data[hdr+5], pBt->usableSize);
45993 pPage->nFree = pBt->usableSize - first;
45994 decodeFlags(pPage, flags);
45995 pPage->hdrOffset = hdr;
45996 pPage->cellOffset = first;
45997 pPage->nOverflow = 0;
45998 assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
@@ -46817,11 +46846,11 @@
46817 ){
46818 goto page1_init_failed;
46819 }
46820 assert( (pageSize & 7)==0 );
46821 usableSize = pageSize - page1[20];
46822 if( pageSize!=pBt->pageSize ){
46823 /* After reading the first page of the database assuming a page size
46824 ** of BtShared.pageSize, we have discovered that the page-size is
46825 ** actually pageSize. Unlock the database, leave pBt->pPage1 at
46826 ** zero and return SQLITE_OK. The caller will call this function
46827 ** again with the correct page-size.
@@ -46856,18 +46885,18 @@
46856 ** 2-byte pointer to the cell
46857 ** 4-byte child pointer
46858 ** 9-byte nKey value
46859 ** 4-byte nData value
46860 ** 4-byte overflow page pointer
46861 ** So a cell consists of a 2-byte poiner, a header which is as much as
46862 ** 17 bytes long, 0 to N bytes of payload, and an optional 4 byte overflow
46863 ** page pointer.
46864 */
46865 pBt->maxLocal = (pBt->usableSize-12)*64/255 - 23;
46866 pBt->minLocal = (pBt->usableSize-12)*32/255 - 23;
46867 pBt->maxLeaf = pBt->usableSize - 35;
46868 pBt->minLeaf = (pBt->usableSize-12)*32/255 - 23;
46869 assert( pBt->maxLeaf + 23 <= MX_CELL_SIZE(pBt) );
46870 pBt->pPage1 = pPage1;
46871 pBt->nPage = nPage;
46872 return SQLITE_OK;
46873
@@ -46916,12 +46945,12 @@
46916 data = pP1->aData;
46917 rc = sqlite3PagerWrite(pP1->pDbPage);
46918 if( rc ) return rc;
46919 memcpy(data, zMagicHeader, sizeof(zMagicHeader));
46920 assert( sizeof(zMagicHeader)==16 );
46921 data[16] = (pBt->pageSize>>8)&0xff;
46922 data[17] = (pBt->pageSize>>16)&0xff;
46923 data[18] = 1;
46924 data[19] = 1;
46925 assert( pBt->usableSize<=pBt->pageSize && pBt->usableSize+255>=pBt->pageSize);
46926 data[20] = (u8)(pBt->pageSize - pBt->usableSize);
46927 data[21] = 64;
@@ -49599,11 +49628,11 @@
49599 BtShared *pBt = pPage->pBt;
49600 CellInfo info;
49601 Pgno ovflPgno;
49602 int rc;
49603 int nOvfl;
49604 u16 ovflPageSize;
49605
49606 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
49607 btreeParseCellPtr(pPage, pCell, &info);
49608 if( info.iOverflow==0 ){
49609 return SQLITE_OK; /* No overflow pages. Return without doing anything */
@@ -50051,11 +50080,11 @@
50051 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
50052 assert( sqlite3PagerIswriteable(pParent->pDbPage) );
50053 assert( pPage->nOverflow==1 );
50054
50055 /* This error condition is now caught prior to reaching this function */
50056 if( NEVER(pPage->nCell<=0) ) return SQLITE_CORRUPT_BKPT;
50057
50058 /* Allocate a new page. This page will become the right-sibling of
50059 ** pPage. Make the parent page writable, so that the new divider cell
50060 ** may be inserted. If both these operations are successful, proceed.
50061 */
@@ -50459,11 +50488,11 @@
50459 u8 *pTemp;
50460 assert( nCell<nMaxCells );
50461 szCell[nCell] = sz;
50462 pTemp = &aSpace1[iSpace1];
50463 iSpace1 += sz;
50464 assert( sz<=pBt->pageSize/4 );
50465 assert( iSpace1<=pBt->pageSize );
50466 memcpy(pTemp, apDiv[i], sz);
50467 apCell[nCell] = pTemp+leafCorrection;
50468 assert( leafCorrection==0 || leafCorrection==4 );
50469 szCell[nCell] = szCell[nCell] - leafCorrection;
@@ -50705,11 +50734,11 @@
50705 assert(leafCorrection==4);
50706 sz = cellSizePtr(pParent, pCell);
50707 }
50708 }
50709 iOvflSpace += sz;
50710 assert( sz<=pBt->pageSize/4 );
50711 assert( iOvflSpace<=pBt->pageSize );
50712 insertCell(pParent, nxDiv, pCell, sz, pTemp, pNew->pgno, &rc);
50713 if( rc!=SQLITE_OK ) goto balance_cleanup;
50714 assert( sqlite3PagerIswriteable(pParent->pDbPage) );
50715
@@ -52796,10 +52825,19 @@
52796 ** page sizes of the source and destination differ.
52797 */
52798 if( nSrcPgsz!=nDestPgsz && sqlite3PagerIsMemdb(pDestPager) ){
52799 rc = SQLITE_READONLY;
52800 }
 
 
 
 
 
 
 
 
 
52801
52802 /* This loop runs once for each destination page spanned by the source
52803 ** page. For each iteration, variable iOff is set to the byte offset
52804 ** of the destination page.
52805 */
@@ -68200,11 +68238,11 @@
68200 if( bOk==0 || i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
68201 sqlite3ErrorMsg(pParse, "variable number must be between ?1 and ?%d",
68202 db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]);
68203 }
68204 if( i>pParse->nVar ){
68205 pParse->nVar = i;
68206 }
68207 }else{
68208 /* Wildcards like ":aaa", "$aaa" or "@aaa". Reuse the same variable
68209 ** number as the prior appearance of the same name, or if the name
68210 ** has never appeared before, reuse the same variable number
68211
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -216,20 +216,22 @@
216 #endif
217
218 /* Maximum page size. The upper bound on this value is 65536. This a limit
219 ** imposed by the use of 16-bit offsets within each page.
220 **
221 ** Earlier versions of SQLite allowed the user to change this value at
222 ** compile time. This is no longer permitted, on the grounds that it creates
223 ** a library that is technically incompatible with an SQLite library
224 ** compiled with a different limit. If a process operating on a database
225 ** with a page-size of 65536 bytes crashes, then an instance of SQLite
226 ** compiled with the default page-size limit will not be able to rollback
227 ** the aborted transaction. This could lead to database corruption.
228 */
229 #ifdef SQLITE_MAX_PAGE_SIZE
230 # undef SQLITE_MAX_PAGE_SIZE
231 #endif
232 #define SQLITE_MAX_PAGE_SIZE 65536
233
234
235 /*
236 ** The default size of a database page.
237 */
@@ -642,11 +644,11 @@
644 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
645 ** [sqlite_version()] and [sqlite_source_id()].
646 */
647 #define SQLITE_VERSION "3.7.1"
648 #define SQLITE_VERSION_NUMBER 3007001
649 #define SQLITE_SOURCE_ID "2010-08-20 15:32:21 5523ecd32295c188e3bf5dbd57d92d2879461e32"
650
651 /*
652 ** CAPI3REF: Run-Time Library Version Numbers
653 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
654 **
@@ -14339,11 +14341,11 @@
14341
14342 /*
14343 ** Set the "type" of an allocation.
14344 */
14345 SQLITE_PRIVATE void sqlite3MemdebugSetType(void *p, u8 eType){
14346 if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){
14347 struct MemBlockHdr *pHdr;
14348 pHdr = sqlite3MemsysGetHeader(p);
14349 assert( pHdr->iForeGuard==FOREGUARD );
14350 pHdr->eType = eType;
14351 }
@@ -14358,11 +14360,11 @@
14360 **
14361 ** assert( sqlite3MemdebugHasType(p, MEMTYPE_DB) );
14362 */
14363 SQLITE_PRIVATE int sqlite3MemdebugHasType(void *p, u8 eType){
14364 int rc = 1;
14365 if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){
14366 struct MemBlockHdr *pHdr;
14367 pHdr = sqlite3MemsysGetHeader(p);
14368 assert( pHdr->iForeGuard==FOREGUARD ); /* Allocation is valid */
14369 if( (pHdr->eType&eType)==0 ){
14370 rc = 0;
@@ -14380,11 +14382,11 @@
14382 **
14383 ** assert( sqlite3MemdebugNoType(p, MEMTYPE_DB) );
14384 */
14385 SQLITE_PRIVATE int sqlite3MemdebugNoType(void *p, u8 eType){
14386 int rc = 1;
14387 if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){
14388 struct MemBlockHdr *pHdr;
14389 pHdr = sqlite3MemsysGetHeader(p);
14390 assert( pHdr->iForeGuard==FOREGUARD ); /* Allocation is valid */
14391 if( (pHdr->eType&eType)!=0 ){
14392 rc = 0;
@@ -33010,10 +33012,29 @@
33012 sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, -iSize);
33013 sqlite3_free(p);
33014 }
33015 }
33016
33017 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
33018 /*
33019 ** Return the size of a pache allocation
33020 */
33021 static int pcache1MemSize(void *p){
33022 assert( sqlite3_mutex_held(pcache1.mutex) );
33023 if( p>=pcache1.pStart && p<pcache1.pEnd ){
33024 return pcache1.szSlot;
33025 }else{
33026 int iSize;
33027 assert( sqlite3MemdebugHasType(p, MEMTYPE_PCACHE) );
33028 sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
33029 iSize = sqlite3MallocSize(p);
33030 sqlite3MemdebugSetType(p, MEMTYPE_PCACHE);
33031 return iSize;
33032 }
33033 }
33034 #endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */
33035
33036 /*
33037 ** Allocate a new page object initially associated with cache pCache.
33038 */
33039 static PgHdr1 *pcache1AllocPage(PCache1 *pCache){
33040 int nByte = sizeof(PgHdr1) + pCache->szPage;
@@ -33558,11 +33579,11 @@
33579 int nFree = 0;
33580 if( pcache1.pStart==0 ){
33581 PgHdr1 *p;
33582 pcache1EnterMutex();
33583 while( (nReq<0 || nFree<nReq) && (p=pcache1.pLruTail) ){
33584 nFree += pcache1MemSize(PGHDR1_TO_PAGE(p));
33585 pcache1PinPage(p);
33586 pcache1RemoveFromHash(p);
33587 pcache1FreePage(p);
33588 }
33589 pcache1LeaveMutex();
@@ -35185,11 +35206,11 @@
35206 assert( eLock!=NO_LOCK || pagerUseWal(pPager)==0 );
35207 if( isOpen(pPager->fd) ){
35208 assert( pPager->eLock>=eLock );
35209 rc = sqlite3OsUnlock(pPager->fd, eLock);
35210 if( pPager->eLock!=UNKNOWN_LOCK ){
35211 pPager->eLock = (u8)eLock;
35212 }
35213 IOTRACE(("UNLOCK %p %d\n", pPager, eLock))
35214 }
35215 return rc;
35216 }
@@ -35209,11 +35230,11 @@
35230
35231 assert( eLock==SHARED_LOCK || eLock==RESERVED_LOCK || eLock==EXCLUSIVE_LOCK );
35232 if( pPager->eLock<eLock || pPager->eLock==UNKNOWN_LOCK ){
35233 rc = sqlite3OsLock(pPager->fd, eLock);
35234 if( rc==SQLITE_OK && (pPager->eLock!=UNKNOWN_LOCK||eLock==EXCLUSIVE_LOCK) ){
35235 pPager->eLock = (u8)eLock;
35236 IOTRACE(("LOCK %p %d\n", pPager, eLock))
35237 }
35238 }
35239 return rc;
35240 }
@@ -35636,10 +35657,18 @@
35657 if( SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+20, &iSectorSize))
35658 || SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+24, &iPageSize))
35659 ){
35660 return rc;
35661 }
35662
35663 /* Versions of SQLite prior to 3.5.8 set the page-size field of the
35664 ** journal header to zero. In this case, assume that the Pager.pageSize
35665 ** variable is already set to the correct page size.
35666 */
35667 if( iPageSize==0 ){
35668 iPageSize = pPager->pageSize;
35669 }
35670
35671 /* Check that the values read from the page-size and sector-size fields
35672 ** are within range. To be 'in range', both values need to be a power
35673 ** of two greater than or equal to 512 or 32, and not greater than their
35674 ** respective compile time maximum limits.
@@ -37494,11 +37523,11 @@
37523 assert( pageSize==0 || (pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE) );
37524 if( (pPager->memDb==0 || pPager->dbSize==0)
37525 && sqlite3PcacheRefCount(pPager->pPCache)==0
37526 && pageSize && pageSize!=(u32)pPager->pageSize
37527 ){
37528 char *pNew = NULL; /* New temp space */
37529 i64 nByte = 0;
37530
37531 if( pPager->eState>PAGER_OPEN && isOpen(pPager->fd) ){
37532 rc = sqlite3OsFileSize(pPager->fd, &nByte);
37533 }
@@ -37507,11 +37536,11 @@
37536 if( !pNew ) rc = SQLITE_NOMEM;
37537 }
37538
37539 if( rc==SQLITE_OK ){
37540 pager_reset(pPager);
37541 pPager->dbSize = (Pgno)(nByte/pageSize);
37542 pPager->pageSize = pageSize;
37543 sqlite3PageFree(pPager->pTmpSpace);
37544 pPager->pTmpSpace = pNew;
37545 sqlite3PcacheSetPageSize(pPager->pPCache, pageSize);
37546 }
@@ -41910,11 +41939,11 @@
41939
41940 /* If nTruncate is non-zero, this is a commit record. */
41941 if( nTruncate ){
41942 pWal->hdr.mxFrame = iFrame;
41943 pWal->hdr.nPage = nTruncate;
41944 pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16));
41945 testcase( szPage<=32768 );
41946 testcase( szPage>=65536 );
41947 aFrameCksum[0] = pWal->hdr.aFrameCksum[0];
41948 aFrameCksum[1] = pWal->hdr.aFrameCksum[1];
41949 }
@@ -43337,11 +43366,11 @@
43366 rc = walIndexAppend(pWal, iFrame, pLast->pgno);
43367 }
43368
43369 if( rc==SQLITE_OK ){
43370 /* Update the private copy of the header. */
43371 pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16));
43372 testcase( szPage<=32768 );
43373 testcase( szPage>=65536 );
43374 pWal->hdr.mxFrame = iFrame;
43375 if( isCommit ){
43376 pWal->hdr.iChange++;
@@ -45873,11 +45902,11 @@
45902 u16 pc; /* Address of a freeblock within pPage->aData[] */
45903 u8 hdr; /* Offset to beginning of page header */
45904 u8 *data; /* Equal to pPage->aData */
45905 BtShared *pBt; /* The main btree structure */
45906 int usableSize; /* Amount of usable space on each page */
45907 u16 cellOffset; /* Offset from start of page to first cell pointer */
45908 int nFree; /* Number of unused bytes on the page */
45909 int top; /* First byte of the cell content area */
45910 int iCellFirst; /* First allowable cell or freeblock offset */
45911 int iCellLast; /* Last possible cell or freeblock offset */
45912
@@ -45988,11 +46017,11 @@
46017 data[hdr] = (char)flags;
46018 first = hdr + 8 + 4*((flags&PTF_LEAF)==0 ?1:0);
46019 memset(&data[hdr+1], 0, 4);
46020 data[hdr+7] = 0;
46021 put2byte(&data[hdr+5], pBt->usableSize);
46022 pPage->nFree = (u16)(pBt->usableSize - first);
46023 decodeFlags(pPage, flags);
46024 pPage->hdrOffset = hdr;
46025 pPage->cellOffset = first;
46026 pPage->nOverflow = 0;
46027 assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
@@ -46817,11 +46846,11 @@
46846 ){
46847 goto page1_init_failed;
46848 }
46849 assert( (pageSize & 7)==0 );
46850 usableSize = pageSize - page1[20];
46851 if( (u32)pageSize!=pBt->pageSize ){
46852 /* After reading the first page of the database assuming a page size
46853 ** of BtShared.pageSize, we have discovered that the page-size is
46854 ** actually pageSize. Unlock the database, leave pBt->pPage1 at
46855 ** zero and return SQLITE_OK. The caller will call this function
46856 ** again with the correct page-size.
@@ -46856,18 +46885,18 @@
46885 ** 2-byte pointer to the cell
46886 ** 4-byte child pointer
46887 ** 9-byte nKey value
46888 ** 4-byte nData value
46889 ** 4-byte overflow page pointer
46890 ** So a cell consists of a 2-byte pointer, a header which is as much as
46891 ** 17 bytes long, 0 to N bytes of payload, and an optional 4 byte overflow
46892 ** page pointer.
46893 */
46894 pBt->maxLocal = (u16)((pBt->usableSize-12)*64/255 - 23);
46895 pBt->minLocal = (u16)((pBt->usableSize-12)*32/255 - 23);
46896 pBt->maxLeaf = (u16)(pBt->usableSize - 35);
46897 pBt->minLeaf = (u16)((pBt->usableSize-12)*32/255 - 23);
46898 assert( pBt->maxLeaf + 23 <= MX_CELL_SIZE(pBt) );
46899 pBt->pPage1 = pPage1;
46900 pBt->nPage = nPage;
46901 return SQLITE_OK;
46902
@@ -46916,12 +46945,12 @@
46945 data = pP1->aData;
46946 rc = sqlite3PagerWrite(pP1->pDbPage);
46947 if( rc ) return rc;
46948 memcpy(data, zMagicHeader, sizeof(zMagicHeader));
46949 assert( sizeof(zMagicHeader)==16 );
46950 data[16] = (u8)((pBt->pageSize>>8)&0xff);
46951 data[17] = (u8)((pBt->pageSize>>16)&0xff);
46952 data[18] = 1;
46953 data[19] = 1;
46954 assert( pBt->usableSize<=pBt->pageSize && pBt->usableSize+255>=pBt->pageSize);
46955 data[20] = (u8)(pBt->pageSize - pBt->usableSize);
46956 data[21] = 64;
@@ -49599,11 +49628,11 @@
49628 BtShared *pBt = pPage->pBt;
49629 CellInfo info;
49630 Pgno ovflPgno;
49631 int rc;
49632 int nOvfl;
49633 u32 ovflPageSize;
49634
49635 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
49636 btreeParseCellPtr(pPage, pCell, &info);
49637 if( info.iOverflow==0 ){
49638 return SQLITE_OK; /* No overflow pages. Return without doing anything */
@@ -50051,11 +50080,11 @@
50080 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
50081 assert( sqlite3PagerIswriteable(pParent->pDbPage) );
50082 assert( pPage->nOverflow==1 );
50083
50084 /* This error condition is now caught prior to reaching this function */
50085 if( pPage->nCell<=0 ) return SQLITE_CORRUPT_BKPT;
50086
50087 /* Allocate a new page. This page will become the right-sibling of
50088 ** pPage. Make the parent page writable, so that the new divider cell
50089 ** may be inserted. If both these operations are successful, proceed.
50090 */
@@ -50459,11 +50488,11 @@
50488 u8 *pTemp;
50489 assert( nCell<nMaxCells );
50490 szCell[nCell] = sz;
50491 pTemp = &aSpace1[iSpace1];
50492 iSpace1 += sz;
50493 assert( sz<=pBt->maxLocal+23 );
50494 assert( iSpace1<=pBt->pageSize );
50495 memcpy(pTemp, apDiv[i], sz);
50496 apCell[nCell] = pTemp+leafCorrection;
50497 assert( leafCorrection==0 || leafCorrection==4 );
50498 szCell[nCell] = szCell[nCell] - leafCorrection;
@@ -50705,11 +50734,11 @@
50734 assert(leafCorrection==4);
50735 sz = cellSizePtr(pParent, pCell);
50736 }
50737 }
50738 iOvflSpace += sz;
50739 assert( sz<=pBt->maxLocal+23 );
50740 assert( iOvflSpace<=pBt->pageSize );
50741 insertCell(pParent, nxDiv, pCell, sz, pTemp, pNew->pgno, &rc);
50742 if( rc!=SQLITE_OK ) goto balance_cleanup;
50743 assert( sqlite3PagerIswriteable(pParent->pDbPage) );
50744
@@ -52796,10 +52825,19 @@
52825 ** page sizes of the source and destination differ.
52826 */
52827 if( nSrcPgsz!=nDestPgsz && sqlite3PagerIsMemdb(pDestPager) ){
52828 rc = SQLITE_READONLY;
52829 }
52830
52831 #ifdef SQLITE_HAS_CODEC
52832 /* Backup is not possible if the page size of the destination is changing
52833 ** a a codec is in use.
52834 */
52835 if( nSrcPgsz!=nDestPgsz && sqlite3PagerGetCodec(pDestPager)!=0 ){
52836 rc = SQLITE_READONLY;
52837 }
52838 #endif
52839
52840 /* This loop runs once for each destination page spanned by the source
52841 ** page. For each iteration, variable iOff is set to the byte offset
52842 ** of the destination page.
52843 */
@@ -68200,11 +68238,11 @@
68238 if( bOk==0 || i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
68239 sqlite3ErrorMsg(pParse, "variable number must be between ?1 and ?%d",
68240 db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]);
68241 }
68242 if( i>pParse->nVar ){
68243 pParse->nVar = (int)i;
68244 }
68245 }else{
68246 /* Wildcards like ":aaa", "$aaa" or "@aaa". Reuse the same variable
68247 ** number as the prior appearance of the same name, or if the name
68248 ** has never appeared before, reuse the same variable number
68249
+1 -1
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107107
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108108
** [sqlite_version()] and [sqlite_source_id()].
109109
*/
110110
#define SQLITE_VERSION "3.7.1"
111111
#define SQLITE_VERSION_NUMBER 3007001
112
-#define SQLITE_SOURCE_ID "2010-08-17 19:49:14 acb171d4cfef2fec8833f761019f5c81f0d138a0"
112
+#define SQLITE_SOURCE_ID "2010-08-20 15:32:21 5523ecd32295c188e3bf5dbd57d92d2879461e32"
113113
114114
/*
115115
** CAPI3REF: Run-Time Library Version Numbers
116116
** KEYWORDS: sqlite3_version, sqlite3_sourceid
117117
**
118118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.7.1"
111 #define SQLITE_VERSION_NUMBER 3007001
112 #define SQLITE_SOURCE_ID "2010-08-17 19:49:14 acb171d4cfef2fec8833f761019f5c81f0d138a0"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.7.1"
111 #define SQLITE_VERSION_NUMBER 3007001
112 #define SQLITE_SOURCE_ID "2010-08-20 15:32:21 5523ecd32295c188e3bf5dbd57d92d2879461e32"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118

Keyboard Shortcuts

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