Fossil SCM

Update the built-in SQLite to version 3.8.10.1.

drh 2015-05-09 12:17 trunk
Commit 28188c4dd97fa96a7c4d25d4ac0a3e6c8169cb11
2 files changed +44 -18 +2 -2
+44 -18
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3
-** version 3.8.10. By combining all the individual C code files into this
3
+** version 3.8.10.1. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
77
** of 5% or more are commonly seen when SQLite is compiled as a single
88
** translation unit.
@@ -316,13 +316,13 @@
316316
**
317317
** See also: [sqlite3_libversion()],
318318
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
319319
** [sqlite_version()] and [sqlite_source_id()].
320320
*/
321
-#define SQLITE_VERSION "3.8.10"
321
+#define SQLITE_VERSION "3.8.10.1"
322322
#define SQLITE_VERSION_NUMBER 3008010
323
-#define SQLITE_SOURCE_ID "2015-05-07 11:53:08 cf975957b9ae671f34bb65f049acf351e650d437"
323
+#define SQLITE_SOURCE_ID "2015-05-09 12:14:55 05b4b1f2a937c06c90db70c09890038f6c98ec40"
324324
325325
/*
326326
** CAPI3REF: Run-Time Library Version Numbers
327327
** KEYWORDS: sqlite3_version, sqlite3_sourceid
328328
**
@@ -14123,10 +14123,13 @@
1412314123
#if SQLITE_ENABLE_CEROD
1412414124
"ENABLE_CEROD",
1412514125
#endif
1412614126
#if SQLITE_ENABLE_COLUMN_METADATA
1412714127
"ENABLE_COLUMN_METADATA",
14128
+#endif
14129
+#if SQLITE_ENABLE_DBSTAT_VTAB
14130
+ "ENABLE_DBSTAT_VTAB",
1412814131
#endif
1412914132
#if SQLITE_ENABLE_EXPENSIVE_ASSERT
1413014133
"ENABLE_EXPENSIVE_ASSERT",
1413114134
#endif
1413214135
#if SQLITE_ENABLE_FTS1
@@ -155331,10 +155334,11 @@
155331155334
};
155332155335
155333155336
struct StatTable {
155334155337
sqlite3_vtab base;
155335155338
sqlite3 *db;
155339
+ int iDb; /* Index of database to analyze */
155336155340
};
155337155341
155338155342
#ifndef get2byte
155339155343
# define get2byte(x) ((x)[0]<<8 | (x)[1])
155340155344
#endif
@@ -155349,11 +155353,21 @@
155349155353
sqlite3_vtab **ppVtab,
155350155354
char **pzErr
155351155355
){
155352155356
StatTable *pTab = 0;
155353155357
int rc = SQLITE_OK;
155358
+ int iDb;
155354155359
155360
+ if( argc>=4 ){
155361
+ iDb = sqlite3FindDbName(db, argv[3]);
155362
+ if( iDb<0 ){
155363
+ *pzErr = sqlite3_mprintf("no such database: %s", argv[3]);
155364
+ return SQLITE_ERROR;
155365
+ }
155366
+ }else{
155367
+ iDb = 0;
155368
+ }
155355155369
rc = sqlite3_declare_vtab(db, VTAB_SCHEMA);
155356155370
if( rc==SQLITE_OK ){
155357155371
pTab = (StatTable *)sqlite3_malloc64(sizeof(StatTable));
155358155372
if( pTab==0 ) rc = SQLITE_NOMEM;
155359155373
}
@@ -155360,10 +155374,11 @@
155360155374
155361155375
assert( rc==SQLITE_OK || pTab==0 );
155362155376
if( rc==SQLITE_OK ){
155363155377
memset(pTab, 0, sizeof(StatTable));
155364155378
pTab->db = db;
155379
+ pTab->iDb = iDb;
155365155380
}
155366155381
155367155382
*ppVtab = (sqlite3_vtab*)pTab;
155368155383
return rc;
155369155384
}
@@ -155414,20 +155429,26 @@
155414155429
155415155430
pCsr = (StatCursor *)sqlite3_malloc64(sizeof(StatCursor));
155416155431
if( pCsr==0 ){
155417155432
rc = SQLITE_NOMEM;
155418155433
}else{
155434
+ char *zSql;
155419155435
memset(pCsr, 0, sizeof(StatCursor));
155420155436
pCsr->base.pVtab = pVTab;
155421155437
155422
- rc = sqlite3_prepare_v2(pTab->db,
155438
+ zSql = sqlite3_mprintf(
155423155439
"SELECT 'sqlite_master' AS name, 1 AS rootpage, 'table' AS type"
155424155440
" UNION ALL "
155425
- "SELECT name, rootpage, type FROM sqlite_master WHERE rootpage!=0"
155426
- " ORDER BY name", -1,
155427
- &pCsr->pStmt, 0
155428
- );
155441
+ "SELECT name, rootpage, type"
155442
+ " FROM \"%w\".sqlite_master WHERE rootpage!=0"
155443
+ " ORDER BY name", pTab->db->aDb[pTab->iDb].zName);
155444
+ if( zSql==0 ){
155445
+ rc = SQLITE_NOMEM;
155446
+ }else{
155447
+ rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pStmt, 0);
155448
+ sqlite3_free(zSql);
155449
+ }
155429155450
if( rc!=SQLITE_OK ){
155430155451
sqlite3_free(pCsr);
155431155452
pCsr = 0;
155432155453
}
155433155454
}
@@ -155589,11 +155610,11 @@
155589155610
** Populate the pCsr->iOffset and pCsr->szPage member variables. Based on
155590155611
** the current value of pCsr->iPageno.
155591155612
*/
155592155613
static void statSizeAndOffset(StatCursor *pCsr){
155593155614
StatTable *pTab = (StatTable *)((sqlite3_vtab_cursor *)pCsr)->pVtab;
155594
- Btree *pBt = pTab->db->aDb[0].pBt;
155615
+ Btree *pBt = pTab->db->aDb[pTab->iDb].pBt;
155595155616
Pager *pPager = sqlite3BtreePager(pBt);
155596155617
sqlite3_file *fd;
155597155618
sqlite3_int64 x[2];
155598155619
155599155620
/* The default page size and offset */
@@ -155603,11 +155624,11 @@
155603155624
/* If connected to a ZIPVFS backend, override the page size and
155604155625
** offset with actual values obtained from ZIPVFS.
155605155626
*/
155606155627
fd = sqlite3PagerFile(pPager);
155607155628
x[0] = pCsr->iPageno;
155608
- if( sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){
155629
+ if( fd->pMethods!=0 && sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){
155609155630
pCsr->iOffset = x[0];
155610155631
pCsr->szPage = (int)x[1];
155611155632
}
155612155633
}
155613155634
@@ -155615,13 +155636,14 @@
155615155636
** Move a statvfs cursor to the next entry in the file.
155616155637
*/
155617155638
static int statNext(sqlite3_vtab_cursor *pCursor){
155618155639
int rc;
155619155640
int nPayload;
155641
+ char *z;
155620155642
StatCursor *pCsr = (StatCursor *)pCursor;
155621155643
StatTable *pTab = (StatTable *)pCursor->pVtab;
155622
- Btree *pBt = pTab->db->aDb[0].pBt;
155644
+ Btree *pBt = pTab->db->aDb[pTab->iDb].pBt;
155623155645
Pager *pPager = sqlite3BtreePager(pBt);
155624155646
155625155647
sqlite3_free(pCsr->zPath);
155626155648
pCsr->zPath = 0;
155627155649
@@ -155637,12 +155659,13 @@
155637155659
return sqlite3_reset(pCsr->pStmt);
155638155660
}
155639155661
rc = sqlite3PagerGet(pPager, iRoot, &pCsr->aPage[0].pPg);
155640155662
pCsr->aPage[0].iPgno = iRoot;
155641155663
pCsr->aPage[0].iCell = 0;
155642
- pCsr->aPage[0].zPath = sqlite3_mprintf("/");
155664
+ pCsr->aPage[0].zPath = z = sqlite3_mprintf("/");
155643155665
pCsr->iPage = 0;
155666
+ if( z==0 ) rc = SQLITE_NOMEM;
155644155667
}else{
155645155668
pCsr->isEof = 1;
155646155669
return sqlite3_reset(pCsr->pStmt);
155647155670
}
155648155671
}else{
@@ -155661,11 +155684,11 @@
155661155684
pCsr->zName = (char *)sqlite3_column_text(pCsr->pStmt, 0);
155662155685
pCsr->iPageno = pCell->aOvfl[pCell->iOvfl];
155663155686
pCsr->zPagetype = "overflow";
155664155687
pCsr->nCell = 0;
155665155688
pCsr->nMxPayload = 0;
155666
- pCsr->zPath = sqlite3_mprintf(
155689
+ pCsr->zPath = z = sqlite3_mprintf(
155667155690
"%s%.3x+%.6x", p->zPath, p->iCell, pCell->iOvfl
155668155691
);
155669155692
if( pCell->iOvfl<pCell->nOvfl-1 ){
155670155693
pCsr->nUnused = 0;
155671155694
pCsr->nPayload = nUsable - 4;
@@ -155673,11 +155696,11 @@
155673155696
pCsr->nPayload = pCell->nLastOvfl;
155674155697
pCsr->nUnused = nUsable - 4 - pCsr->nPayload;
155675155698
}
155676155699
pCell->iOvfl++;
155677155700
statSizeAndOffset(pCsr);
155678
- return SQLITE_OK;
155701
+ return z==0 ? SQLITE_NOMEM : SQLITE_OK;
155679155702
}
155680155703
if( p->iRightChildPg ) break;
155681155704
p->iCell++;
155682155705
}
155683155706
@@ -155695,12 +155718,13 @@
155695155718
}else{
155696155719
p[1].iPgno = p->aCell[p->iCell].iChildPg;
155697155720
}
155698155721
rc = sqlite3PagerGet(pPager, p[1].iPgno, &p[1].pPg);
155699155722
p[1].iCell = 0;
155700
- p[1].zPath = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell);
155723
+ p[1].zPath = z = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell);
155701155724
p->iCell++;
155725
+ if( z==0 ) rc = SQLITE_NOMEM;
155702155726
}
155703155727
155704155728
155705155729
/* Populate the StatCursor fields with the values to be returned
155706155730
** by the xColumn() and xRowid() methods.
@@ -155729,11 +155753,12 @@
155729155753
break;
155730155754
}
155731155755
pCsr->nCell = p->nCell;
155732155756
pCsr->nUnused = p->nUnused;
155733155757
pCsr->nMxPayload = p->nMxPayload;
155734
- pCsr->zPath = sqlite3_mprintf("%s", p->zPath);
155758
+ pCsr->zPath = z = sqlite3_mprintf("%s", p->zPath);
155759
+ if( z==0 ) rc = SQLITE_NOMEM;
155735155760
nPayload = 0;
155736155761
for(i=0; i<p->nCell; i++){
155737155762
nPayload += p->aCell[i].nLocal;
155738155763
}
155739155764
pCsr->nPayload = nPayload;
@@ -155765,11 +155790,11 @@
155765155790
int i
155766155791
){
155767155792
StatCursor *pCsr = (StatCursor *)pCursor;
155768155793
switch( i ){
155769155794
case 0: /* name */
155770
- sqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_STATIC);
155795
+ sqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_TRANSIENT);
155771155796
break;
155772155797
case 1: /* path */
155773155798
sqlite3_result_text(ctx, pCsr->zPath, -1, SQLITE_TRANSIENT);
155774155799
break;
155775155800
case 2: /* pageno */
@@ -155791,11 +155816,12 @@
155791155816
sqlite3_result_int(ctx, pCsr->nMxPayload);
155792155817
break;
155793155818
case 8: /* pgoffset */
155794155819
sqlite3_result_int64(ctx, pCsr->iOffset);
155795155820
break;
155796
- case 9: /* pgsize */
155821
+ default: /* pgsize */
155822
+ assert( i==9 );
155797155823
sqlite3_result_int(ctx, pCsr->szPage);
155798155824
break;
155799155825
}
155800155826
return SQLITE_OK;
155801155827
}
155802155828
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.8.10. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -316,13 +316,13 @@
316 **
317 ** See also: [sqlite3_libversion()],
318 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
319 ** [sqlite_version()] and [sqlite_source_id()].
320 */
321 #define SQLITE_VERSION "3.8.10"
322 #define SQLITE_VERSION_NUMBER 3008010
323 #define SQLITE_SOURCE_ID "2015-05-07 11:53:08 cf975957b9ae671f34bb65f049acf351e650d437"
324
325 /*
326 ** CAPI3REF: Run-Time Library Version Numbers
327 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
328 **
@@ -14123,10 +14123,13 @@
14123 #if SQLITE_ENABLE_CEROD
14124 "ENABLE_CEROD",
14125 #endif
14126 #if SQLITE_ENABLE_COLUMN_METADATA
14127 "ENABLE_COLUMN_METADATA",
 
 
 
14128 #endif
14129 #if SQLITE_ENABLE_EXPENSIVE_ASSERT
14130 "ENABLE_EXPENSIVE_ASSERT",
14131 #endif
14132 #if SQLITE_ENABLE_FTS1
@@ -155331,10 +155334,11 @@
155331 };
155332
155333 struct StatTable {
155334 sqlite3_vtab base;
155335 sqlite3 *db;
 
155336 };
155337
155338 #ifndef get2byte
155339 # define get2byte(x) ((x)[0]<<8 | (x)[1])
155340 #endif
@@ -155349,11 +155353,21 @@
155349 sqlite3_vtab **ppVtab,
155350 char **pzErr
155351 ){
155352 StatTable *pTab = 0;
155353 int rc = SQLITE_OK;
 
155354
 
 
 
 
 
 
 
 
 
155355 rc = sqlite3_declare_vtab(db, VTAB_SCHEMA);
155356 if( rc==SQLITE_OK ){
155357 pTab = (StatTable *)sqlite3_malloc64(sizeof(StatTable));
155358 if( pTab==0 ) rc = SQLITE_NOMEM;
155359 }
@@ -155360,10 +155374,11 @@
155360
155361 assert( rc==SQLITE_OK || pTab==0 );
155362 if( rc==SQLITE_OK ){
155363 memset(pTab, 0, sizeof(StatTable));
155364 pTab->db = db;
 
155365 }
155366
155367 *ppVtab = (sqlite3_vtab*)pTab;
155368 return rc;
155369 }
@@ -155414,20 +155429,26 @@
155414
155415 pCsr = (StatCursor *)sqlite3_malloc64(sizeof(StatCursor));
155416 if( pCsr==0 ){
155417 rc = SQLITE_NOMEM;
155418 }else{
 
155419 memset(pCsr, 0, sizeof(StatCursor));
155420 pCsr->base.pVtab = pVTab;
155421
155422 rc = sqlite3_prepare_v2(pTab->db,
155423 "SELECT 'sqlite_master' AS name, 1 AS rootpage, 'table' AS type"
155424 " UNION ALL "
155425 "SELECT name, rootpage, type FROM sqlite_master WHERE rootpage!=0"
155426 " ORDER BY name", -1,
155427 &pCsr->pStmt, 0
155428 );
 
 
 
 
 
155429 if( rc!=SQLITE_OK ){
155430 sqlite3_free(pCsr);
155431 pCsr = 0;
155432 }
155433 }
@@ -155589,11 +155610,11 @@
155589 ** Populate the pCsr->iOffset and pCsr->szPage member variables. Based on
155590 ** the current value of pCsr->iPageno.
155591 */
155592 static void statSizeAndOffset(StatCursor *pCsr){
155593 StatTable *pTab = (StatTable *)((sqlite3_vtab_cursor *)pCsr)->pVtab;
155594 Btree *pBt = pTab->db->aDb[0].pBt;
155595 Pager *pPager = sqlite3BtreePager(pBt);
155596 sqlite3_file *fd;
155597 sqlite3_int64 x[2];
155598
155599 /* The default page size and offset */
@@ -155603,11 +155624,11 @@
155603 /* If connected to a ZIPVFS backend, override the page size and
155604 ** offset with actual values obtained from ZIPVFS.
155605 */
155606 fd = sqlite3PagerFile(pPager);
155607 x[0] = pCsr->iPageno;
155608 if( sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){
155609 pCsr->iOffset = x[0];
155610 pCsr->szPage = (int)x[1];
155611 }
155612 }
155613
@@ -155615,13 +155636,14 @@
155615 ** Move a statvfs cursor to the next entry in the file.
155616 */
155617 static int statNext(sqlite3_vtab_cursor *pCursor){
155618 int rc;
155619 int nPayload;
 
155620 StatCursor *pCsr = (StatCursor *)pCursor;
155621 StatTable *pTab = (StatTable *)pCursor->pVtab;
155622 Btree *pBt = pTab->db->aDb[0].pBt;
155623 Pager *pPager = sqlite3BtreePager(pBt);
155624
155625 sqlite3_free(pCsr->zPath);
155626 pCsr->zPath = 0;
155627
@@ -155637,12 +155659,13 @@
155637 return sqlite3_reset(pCsr->pStmt);
155638 }
155639 rc = sqlite3PagerGet(pPager, iRoot, &pCsr->aPage[0].pPg);
155640 pCsr->aPage[0].iPgno = iRoot;
155641 pCsr->aPage[0].iCell = 0;
155642 pCsr->aPage[0].zPath = sqlite3_mprintf("/");
155643 pCsr->iPage = 0;
 
155644 }else{
155645 pCsr->isEof = 1;
155646 return sqlite3_reset(pCsr->pStmt);
155647 }
155648 }else{
@@ -155661,11 +155684,11 @@
155661 pCsr->zName = (char *)sqlite3_column_text(pCsr->pStmt, 0);
155662 pCsr->iPageno = pCell->aOvfl[pCell->iOvfl];
155663 pCsr->zPagetype = "overflow";
155664 pCsr->nCell = 0;
155665 pCsr->nMxPayload = 0;
155666 pCsr->zPath = sqlite3_mprintf(
155667 "%s%.3x+%.6x", p->zPath, p->iCell, pCell->iOvfl
155668 );
155669 if( pCell->iOvfl<pCell->nOvfl-1 ){
155670 pCsr->nUnused = 0;
155671 pCsr->nPayload = nUsable - 4;
@@ -155673,11 +155696,11 @@
155673 pCsr->nPayload = pCell->nLastOvfl;
155674 pCsr->nUnused = nUsable - 4 - pCsr->nPayload;
155675 }
155676 pCell->iOvfl++;
155677 statSizeAndOffset(pCsr);
155678 return SQLITE_OK;
155679 }
155680 if( p->iRightChildPg ) break;
155681 p->iCell++;
155682 }
155683
@@ -155695,12 +155718,13 @@
155695 }else{
155696 p[1].iPgno = p->aCell[p->iCell].iChildPg;
155697 }
155698 rc = sqlite3PagerGet(pPager, p[1].iPgno, &p[1].pPg);
155699 p[1].iCell = 0;
155700 p[1].zPath = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell);
155701 p->iCell++;
 
155702 }
155703
155704
155705 /* Populate the StatCursor fields with the values to be returned
155706 ** by the xColumn() and xRowid() methods.
@@ -155729,11 +155753,12 @@
155729 break;
155730 }
155731 pCsr->nCell = p->nCell;
155732 pCsr->nUnused = p->nUnused;
155733 pCsr->nMxPayload = p->nMxPayload;
155734 pCsr->zPath = sqlite3_mprintf("%s", p->zPath);
 
155735 nPayload = 0;
155736 for(i=0; i<p->nCell; i++){
155737 nPayload += p->aCell[i].nLocal;
155738 }
155739 pCsr->nPayload = nPayload;
@@ -155765,11 +155790,11 @@
155765 int i
155766 ){
155767 StatCursor *pCsr = (StatCursor *)pCursor;
155768 switch( i ){
155769 case 0: /* name */
155770 sqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_STATIC);
155771 break;
155772 case 1: /* path */
155773 sqlite3_result_text(ctx, pCsr->zPath, -1, SQLITE_TRANSIENT);
155774 break;
155775 case 2: /* pageno */
@@ -155791,11 +155816,12 @@
155791 sqlite3_result_int(ctx, pCsr->nMxPayload);
155792 break;
155793 case 8: /* pgoffset */
155794 sqlite3_result_int64(ctx, pCsr->iOffset);
155795 break;
155796 case 9: /* pgsize */
 
155797 sqlite3_result_int(ctx, pCsr->szPage);
155798 break;
155799 }
155800 return SQLITE_OK;
155801 }
155802
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.8.10.1. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -316,13 +316,13 @@
316 **
317 ** See also: [sqlite3_libversion()],
318 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
319 ** [sqlite_version()] and [sqlite_source_id()].
320 */
321 #define SQLITE_VERSION "3.8.10.1"
322 #define SQLITE_VERSION_NUMBER 3008010
323 #define SQLITE_SOURCE_ID "2015-05-09 12:14:55 05b4b1f2a937c06c90db70c09890038f6c98ec40"
324
325 /*
326 ** CAPI3REF: Run-Time Library Version Numbers
327 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
328 **
@@ -14123,10 +14123,13 @@
14123 #if SQLITE_ENABLE_CEROD
14124 "ENABLE_CEROD",
14125 #endif
14126 #if SQLITE_ENABLE_COLUMN_METADATA
14127 "ENABLE_COLUMN_METADATA",
14128 #endif
14129 #if SQLITE_ENABLE_DBSTAT_VTAB
14130 "ENABLE_DBSTAT_VTAB",
14131 #endif
14132 #if SQLITE_ENABLE_EXPENSIVE_ASSERT
14133 "ENABLE_EXPENSIVE_ASSERT",
14134 #endif
14135 #if SQLITE_ENABLE_FTS1
@@ -155331,10 +155334,11 @@
155334 };
155335
155336 struct StatTable {
155337 sqlite3_vtab base;
155338 sqlite3 *db;
155339 int iDb; /* Index of database to analyze */
155340 };
155341
155342 #ifndef get2byte
155343 # define get2byte(x) ((x)[0]<<8 | (x)[1])
155344 #endif
@@ -155349,11 +155353,21 @@
155353 sqlite3_vtab **ppVtab,
155354 char **pzErr
155355 ){
155356 StatTable *pTab = 0;
155357 int rc = SQLITE_OK;
155358 int iDb;
155359
155360 if( argc>=4 ){
155361 iDb = sqlite3FindDbName(db, argv[3]);
155362 if( iDb<0 ){
155363 *pzErr = sqlite3_mprintf("no such database: %s", argv[3]);
155364 return SQLITE_ERROR;
155365 }
155366 }else{
155367 iDb = 0;
155368 }
155369 rc = sqlite3_declare_vtab(db, VTAB_SCHEMA);
155370 if( rc==SQLITE_OK ){
155371 pTab = (StatTable *)sqlite3_malloc64(sizeof(StatTable));
155372 if( pTab==0 ) rc = SQLITE_NOMEM;
155373 }
@@ -155360,10 +155374,11 @@
155374
155375 assert( rc==SQLITE_OK || pTab==0 );
155376 if( rc==SQLITE_OK ){
155377 memset(pTab, 0, sizeof(StatTable));
155378 pTab->db = db;
155379 pTab->iDb = iDb;
155380 }
155381
155382 *ppVtab = (sqlite3_vtab*)pTab;
155383 return rc;
155384 }
@@ -155414,20 +155429,26 @@
155429
155430 pCsr = (StatCursor *)sqlite3_malloc64(sizeof(StatCursor));
155431 if( pCsr==0 ){
155432 rc = SQLITE_NOMEM;
155433 }else{
155434 char *zSql;
155435 memset(pCsr, 0, sizeof(StatCursor));
155436 pCsr->base.pVtab = pVTab;
155437
155438 zSql = sqlite3_mprintf(
155439 "SELECT 'sqlite_master' AS name, 1 AS rootpage, 'table' AS type"
155440 " UNION ALL "
155441 "SELECT name, rootpage, type"
155442 " FROM \"%w\".sqlite_master WHERE rootpage!=0"
155443 " ORDER BY name", pTab->db->aDb[pTab->iDb].zName);
155444 if( zSql==0 ){
155445 rc = SQLITE_NOMEM;
155446 }else{
155447 rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pStmt, 0);
155448 sqlite3_free(zSql);
155449 }
155450 if( rc!=SQLITE_OK ){
155451 sqlite3_free(pCsr);
155452 pCsr = 0;
155453 }
155454 }
@@ -155589,11 +155610,11 @@
155610 ** Populate the pCsr->iOffset and pCsr->szPage member variables. Based on
155611 ** the current value of pCsr->iPageno.
155612 */
155613 static void statSizeAndOffset(StatCursor *pCsr){
155614 StatTable *pTab = (StatTable *)((sqlite3_vtab_cursor *)pCsr)->pVtab;
155615 Btree *pBt = pTab->db->aDb[pTab->iDb].pBt;
155616 Pager *pPager = sqlite3BtreePager(pBt);
155617 sqlite3_file *fd;
155618 sqlite3_int64 x[2];
155619
155620 /* The default page size and offset */
@@ -155603,11 +155624,11 @@
155624 /* If connected to a ZIPVFS backend, override the page size and
155625 ** offset with actual values obtained from ZIPVFS.
155626 */
155627 fd = sqlite3PagerFile(pPager);
155628 x[0] = pCsr->iPageno;
155629 if( fd->pMethods!=0 && sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){
155630 pCsr->iOffset = x[0];
155631 pCsr->szPage = (int)x[1];
155632 }
155633 }
155634
@@ -155615,13 +155636,14 @@
155636 ** Move a statvfs cursor to the next entry in the file.
155637 */
155638 static int statNext(sqlite3_vtab_cursor *pCursor){
155639 int rc;
155640 int nPayload;
155641 char *z;
155642 StatCursor *pCsr = (StatCursor *)pCursor;
155643 StatTable *pTab = (StatTable *)pCursor->pVtab;
155644 Btree *pBt = pTab->db->aDb[pTab->iDb].pBt;
155645 Pager *pPager = sqlite3BtreePager(pBt);
155646
155647 sqlite3_free(pCsr->zPath);
155648 pCsr->zPath = 0;
155649
@@ -155637,12 +155659,13 @@
155659 return sqlite3_reset(pCsr->pStmt);
155660 }
155661 rc = sqlite3PagerGet(pPager, iRoot, &pCsr->aPage[0].pPg);
155662 pCsr->aPage[0].iPgno = iRoot;
155663 pCsr->aPage[0].iCell = 0;
155664 pCsr->aPage[0].zPath = z = sqlite3_mprintf("/");
155665 pCsr->iPage = 0;
155666 if( z==0 ) rc = SQLITE_NOMEM;
155667 }else{
155668 pCsr->isEof = 1;
155669 return sqlite3_reset(pCsr->pStmt);
155670 }
155671 }else{
@@ -155661,11 +155684,11 @@
155684 pCsr->zName = (char *)sqlite3_column_text(pCsr->pStmt, 0);
155685 pCsr->iPageno = pCell->aOvfl[pCell->iOvfl];
155686 pCsr->zPagetype = "overflow";
155687 pCsr->nCell = 0;
155688 pCsr->nMxPayload = 0;
155689 pCsr->zPath = z = sqlite3_mprintf(
155690 "%s%.3x+%.6x", p->zPath, p->iCell, pCell->iOvfl
155691 );
155692 if( pCell->iOvfl<pCell->nOvfl-1 ){
155693 pCsr->nUnused = 0;
155694 pCsr->nPayload = nUsable - 4;
@@ -155673,11 +155696,11 @@
155696 pCsr->nPayload = pCell->nLastOvfl;
155697 pCsr->nUnused = nUsable - 4 - pCsr->nPayload;
155698 }
155699 pCell->iOvfl++;
155700 statSizeAndOffset(pCsr);
155701 return z==0 ? SQLITE_NOMEM : SQLITE_OK;
155702 }
155703 if( p->iRightChildPg ) break;
155704 p->iCell++;
155705 }
155706
@@ -155695,12 +155718,13 @@
155718 }else{
155719 p[1].iPgno = p->aCell[p->iCell].iChildPg;
155720 }
155721 rc = sqlite3PagerGet(pPager, p[1].iPgno, &p[1].pPg);
155722 p[1].iCell = 0;
155723 p[1].zPath = z = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell);
155724 p->iCell++;
155725 if( z==0 ) rc = SQLITE_NOMEM;
155726 }
155727
155728
155729 /* Populate the StatCursor fields with the values to be returned
155730 ** by the xColumn() and xRowid() methods.
@@ -155729,11 +155753,12 @@
155753 break;
155754 }
155755 pCsr->nCell = p->nCell;
155756 pCsr->nUnused = p->nUnused;
155757 pCsr->nMxPayload = p->nMxPayload;
155758 pCsr->zPath = z = sqlite3_mprintf("%s", p->zPath);
155759 if( z==0 ) rc = SQLITE_NOMEM;
155760 nPayload = 0;
155761 for(i=0; i<p->nCell; i++){
155762 nPayload += p->aCell[i].nLocal;
155763 }
155764 pCsr->nPayload = nPayload;
@@ -155765,11 +155790,11 @@
155790 int i
155791 ){
155792 StatCursor *pCsr = (StatCursor *)pCursor;
155793 switch( i ){
155794 case 0: /* name */
155795 sqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_TRANSIENT);
155796 break;
155797 case 1: /* path */
155798 sqlite3_result_text(ctx, pCsr->zPath, -1, SQLITE_TRANSIENT);
155799 break;
155800 case 2: /* pageno */
@@ -155791,11 +155816,12 @@
155816 sqlite3_result_int(ctx, pCsr->nMxPayload);
155817 break;
155818 case 8: /* pgoffset */
155819 sqlite3_result_int64(ctx, pCsr->iOffset);
155820 break;
155821 default: /* pgsize */
155822 assert( i==9 );
155823 sqlite3_result_int(ctx, pCsr->szPage);
155824 break;
155825 }
155826 return SQLITE_OK;
155827 }
155828
+2 -2
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -109,13 +109,13 @@
109109
**
110110
** See also: [sqlite3_libversion()],
111111
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
112112
** [sqlite_version()] and [sqlite_source_id()].
113113
*/
114
-#define SQLITE_VERSION "3.8.10"
114
+#define SQLITE_VERSION "3.8.10.1"
115115
#define SQLITE_VERSION_NUMBER 3008010
116
-#define SQLITE_SOURCE_ID "2015-05-07 11:53:08 cf975957b9ae671f34bb65f049acf351e650d437"
116
+#define SQLITE_SOURCE_ID "2015-05-09 12:14:55 05b4b1f2a937c06c90db70c09890038f6c98ec40"
117117
118118
/*
119119
** CAPI3REF: Run-Time Library Version Numbers
120120
** KEYWORDS: sqlite3_version, sqlite3_sourceid
121121
**
122122
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -109,13 +109,13 @@
109 **
110 ** See also: [sqlite3_libversion()],
111 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
112 ** [sqlite_version()] and [sqlite_source_id()].
113 */
114 #define SQLITE_VERSION "3.8.10"
115 #define SQLITE_VERSION_NUMBER 3008010
116 #define SQLITE_SOURCE_ID "2015-05-07 11:53:08 cf975957b9ae671f34bb65f049acf351e650d437"
117
118 /*
119 ** CAPI3REF: Run-Time Library Version Numbers
120 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
121 **
122
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -109,13 +109,13 @@
109 **
110 ** See also: [sqlite3_libversion()],
111 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
112 ** [sqlite_version()] and [sqlite_source_id()].
113 */
114 #define SQLITE_VERSION "3.8.10.1"
115 #define SQLITE_VERSION_NUMBER 3008010
116 #define SQLITE_SOURCE_ID "2015-05-09 12:14:55 05b4b1f2a937c06c90db70c09890038f6c98ec40"
117
118 /*
119 ** CAPI3REF: Run-Time Library Version Numbers
120 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
121 **
122

Keyboard Shortcuts

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