Fossil SCM
Update the built-in SQLite to version 3.8.10.1.
Commit
28188c4dd97fa96a7c4d25d4ac0a3e6c8169cb11
Parent
901427f5cd1f2ca…
2 files changed
+44
-18
+2
-2
+44
-18
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | /****************************************************************************** |
| 2 | 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 | |
| 3 | +** version 3.8.10.1. By combining all the individual C code files into this | |
| 4 | 4 | ** single large file, the entire code can be compiled as a single translation |
| 5 | 5 | ** unit. This allows many compilers to do optimizations that would not be |
| 6 | 6 | ** possible if the files were compiled separately. Performance improvements |
| 7 | 7 | ** of 5% or more are commonly seen when SQLite is compiled as a single |
| 8 | 8 | ** translation unit. |
| @@ -316,13 +316,13 @@ | ||
| 316 | 316 | ** |
| 317 | 317 | ** See also: [sqlite3_libversion()], |
| 318 | 318 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 319 | 319 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 320 | 320 | */ |
| 321 | -#define SQLITE_VERSION "3.8.10" | |
| 321 | +#define SQLITE_VERSION "3.8.10.1" | |
| 322 | 322 | #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" | |
| 324 | 324 | |
| 325 | 325 | /* |
| 326 | 326 | ** CAPI3REF: Run-Time Library Version Numbers |
| 327 | 327 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 328 | 328 | ** |
| @@ -14123,10 +14123,13 @@ | ||
| 14123 | 14123 | #if SQLITE_ENABLE_CEROD |
| 14124 | 14124 | "ENABLE_CEROD", |
| 14125 | 14125 | #endif |
| 14126 | 14126 | #if SQLITE_ENABLE_COLUMN_METADATA |
| 14127 | 14127 | "ENABLE_COLUMN_METADATA", |
| 14128 | +#endif | |
| 14129 | +#if SQLITE_ENABLE_DBSTAT_VTAB | |
| 14130 | + "ENABLE_DBSTAT_VTAB", | |
| 14128 | 14131 | #endif |
| 14129 | 14132 | #if SQLITE_ENABLE_EXPENSIVE_ASSERT |
| 14130 | 14133 | "ENABLE_EXPENSIVE_ASSERT", |
| 14131 | 14134 | #endif |
| 14132 | 14135 | #if SQLITE_ENABLE_FTS1 |
| @@ -155331,10 +155334,11 @@ | ||
| 155331 | 155334 | }; |
| 155332 | 155335 | |
| 155333 | 155336 | struct StatTable { |
| 155334 | 155337 | sqlite3_vtab base; |
| 155335 | 155338 | sqlite3 *db; |
| 155339 | + int iDb; /* Index of database to analyze */ | |
| 155336 | 155340 | }; |
| 155337 | 155341 | |
| 155338 | 155342 | #ifndef get2byte |
| 155339 | 155343 | # define get2byte(x) ((x)[0]<<8 | (x)[1]) |
| 155340 | 155344 | #endif |
| @@ -155349,11 +155353,21 @@ | ||
| 155349 | 155353 | sqlite3_vtab **ppVtab, |
| 155350 | 155354 | char **pzErr |
| 155351 | 155355 | ){ |
| 155352 | 155356 | StatTable *pTab = 0; |
| 155353 | 155357 | int rc = SQLITE_OK; |
| 155358 | + int iDb; | |
| 155354 | 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 | + } | |
| 155355 | 155369 | rc = sqlite3_declare_vtab(db, VTAB_SCHEMA); |
| 155356 | 155370 | if( rc==SQLITE_OK ){ |
| 155357 | 155371 | pTab = (StatTable *)sqlite3_malloc64(sizeof(StatTable)); |
| 155358 | 155372 | if( pTab==0 ) rc = SQLITE_NOMEM; |
| 155359 | 155373 | } |
| @@ -155360,10 +155374,11 @@ | ||
| 155360 | 155374 | |
| 155361 | 155375 | assert( rc==SQLITE_OK || pTab==0 ); |
| 155362 | 155376 | if( rc==SQLITE_OK ){ |
| 155363 | 155377 | memset(pTab, 0, sizeof(StatTable)); |
| 155364 | 155378 | pTab->db = db; |
| 155379 | + pTab->iDb = iDb; | |
| 155365 | 155380 | } |
| 155366 | 155381 | |
| 155367 | 155382 | *ppVtab = (sqlite3_vtab*)pTab; |
| 155368 | 155383 | return rc; |
| 155369 | 155384 | } |
| @@ -155414,20 +155429,26 @@ | ||
| 155414 | 155429 | |
| 155415 | 155430 | pCsr = (StatCursor *)sqlite3_malloc64(sizeof(StatCursor)); |
| 155416 | 155431 | if( pCsr==0 ){ |
| 155417 | 155432 | rc = SQLITE_NOMEM; |
| 155418 | 155433 | }else{ |
| 155434 | + char *zSql; | |
| 155419 | 155435 | memset(pCsr, 0, sizeof(StatCursor)); |
| 155420 | 155436 | pCsr->base.pVtab = pVTab; |
| 155421 | 155437 | |
| 155422 | - rc = sqlite3_prepare_v2(pTab->db, | |
| 155438 | + zSql = sqlite3_mprintf( | |
| 155423 | 155439 | "SELECT 'sqlite_master' AS name, 1 AS rootpage, 'table' AS type" |
| 155424 | 155440 | " 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 | + } | |
| 155429 | 155450 | if( rc!=SQLITE_OK ){ |
| 155430 | 155451 | sqlite3_free(pCsr); |
| 155431 | 155452 | pCsr = 0; |
| 155432 | 155453 | } |
| 155433 | 155454 | } |
| @@ -155589,11 +155610,11 @@ | ||
| 155589 | 155610 | ** Populate the pCsr->iOffset and pCsr->szPage member variables. Based on |
| 155590 | 155611 | ** the current value of pCsr->iPageno. |
| 155591 | 155612 | */ |
| 155592 | 155613 | static void statSizeAndOffset(StatCursor *pCsr){ |
| 155593 | 155614 | 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; | |
| 155595 | 155616 | Pager *pPager = sqlite3BtreePager(pBt); |
| 155596 | 155617 | sqlite3_file *fd; |
| 155597 | 155618 | sqlite3_int64 x[2]; |
| 155598 | 155619 | |
| 155599 | 155620 | /* The default page size and offset */ |
| @@ -155603,11 +155624,11 @@ | ||
| 155603 | 155624 | /* If connected to a ZIPVFS backend, override the page size and |
| 155604 | 155625 | ** offset with actual values obtained from ZIPVFS. |
| 155605 | 155626 | */ |
| 155606 | 155627 | fd = sqlite3PagerFile(pPager); |
| 155607 | 155628 | x[0] = pCsr->iPageno; |
| 155608 | - if( sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){ | |
| 155629 | + if( fd->pMethods!=0 && sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){ | |
| 155609 | 155630 | pCsr->iOffset = x[0]; |
| 155610 | 155631 | pCsr->szPage = (int)x[1]; |
| 155611 | 155632 | } |
| 155612 | 155633 | } |
| 155613 | 155634 | |
| @@ -155615,13 +155636,14 @@ | ||
| 155615 | 155636 | ** Move a statvfs cursor to the next entry in the file. |
| 155616 | 155637 | */ |
| 155617 | 155638 | static int statNext(sqlite3_vtab_cursor *pCursor){ |
| 155618 | 155639 | int rc; |
| 155619 | 155640 | int nPayload; |
| 155641 | + char *z; | |
| 155620 | 155642 | StatCursor *pCsr = (StatCursor *)pCursor; |
| 155621 | 155643 | StatTable *pTab = (StatTable *)pCursor->pVtab; |
| 155622 | - Btree *pBt = pTab->db->aDb[0].pBt; | |
| 155644 | + Btree *pBt = pTab->db->aDb[pTab->iDb].pBt; | |
| 155623 | 155645 | Pager *pPager = sqlite3BtreePager(pBt); |
| 155624 | 155646 | |
| 155625 | 155647 | sqlite3_free(pCsr->zPath); |
| 155626 | 155648 | pCsr->zPath = 0; |
| 155627 | 155649 | |
| @@ -155637,12 +155659,13 @@ | ||
| 155637 | 155659 | return sqlite3_reset(pCsr->pStmt); |
| 155638 | 155660 | } |
| 155639 | 155661 | rc = sqlite3PagerGet(pPager, iRoot, &pCsr->aPage[0].pPg); |
| 155640 | 155662 | pCsr->aPage[0].iPgno = iRoot; |
| 155641 | 155663 | pCsr->aPage[0].iCell = 0; |
| 155642 | - pCsr->aPage[0].zPath = sqlite3_mprintf("/"); | |
| 155664 | + pCsr->aPage[0].zPath = z = sqlite3_mprintf("/"); | |
| 155643 | 155665 | pCsr->iPage = 0; |
| 155666 | + if( z==0 ) rc = SQLITE_NOMEM; | |
| 155644 | 155667 | }else{ |
| 155645 | 155668 | pCsr->isEof = 1; |
| 155646 | 155669 | return sqlite3_reset(pCsr->pStmt); |
| 155647 | 155670 | } |
| 155648 | 155671 | }else{ |
| @@ -155661,11 +155684,11 @@ | ||
| 155661 | 155684 | pCsr->zName = (char *)sqlite3_column_text(pCsr->pStmt, 0); |
| 155662 | 155685 | pCsr->iPageno = pCell->aOvfl[pCell->iOvfl]; |
| 155663 | 155686 | pCsr->zPagetype = "overflow"; |
| 155664 | 155687 | pCsr->nCell = 0; |
| 155665 | 155688 | pCsr->nMxPayload = 0; |
| 155666 | - pCsr->zPath = sqlite3_mprintf( | |
| 155689 | + pCsr->zPath = z = sqlite3_mprintf( | |
| 155667 | 155690 | "%s%.3x+%.6x", p->zPath, p->iCell, pCell->iOvfl |
| 155668 | 155691 | ); |
| 155669 | 155692 | if( pCell->iOvfl<pCell->nOvfl-1 ){ |
| 155670 | 155693 | pCsr->nUnused = 0; |
| 155671 | 155694 | pCsr->nPayload = nUsable - 4; |
| @@ -155673,11 +155696,11 @@ | ||
| 155673 | 155696 | pCsr->nPayload = pCell->nLastOvfl; |
| 155674 | 155697 | pCsr->nUnused = nUsable - 4 - pCsr->nPayload; |
| 155675 | 155698 | } |
| 155676 | 155699 | pCell->iOvfl++; |
| 155677 | 155700 | statSizeAndOffset(pCsr); |
| 155678 | - return SQLITE_OK; | |
| 155701 | + return z==0 ? SQLITE_NOMEM : SQLITE_OK; | |
| 155679 | 155702 | } |
| 155680 | 155703 | if( p->iRightChildPg ) break; |
| 155681 | 155704 | p->iCell++; |
| 155682 | 155705 | } |
| 155683 | 155706 | |
| @@ -155695,12 +155718,13 @@ | ||
| 155695 | 155718 | }else{ |
| 155696 | 155719 | p[1].iPgno = p->aCell[p->iCell].iChildPg; |
| 155697 | 155720 | } |
| 155698 | 155721 | rc = sqlite3PagerGet(pPager, p[1].iPgno, &p[1].pPg); |
| 155699 | 155722 | 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); | |
| 155701 | 155724 | p->iCell++; |
| 155725 | + if( z==0 ) rc = SQLITE_NOMEM; | |
| 155702 | 155726 | } |
| 155703 | 155727 | |
| 155704 | 155728 | |
| 155705 | 155729 | /* Populate the StatCursor fields with the values to be returned |
| 155706 | 155730 | ** by the xColumn() and xRowid() methods. |
| @@ -155729,11 +155753,12 @@ | ||
| 155729 | 155753 | break; |
| 155730 | 155754 | } |
| 155731 | 155755 | pCsr->nCell = p->nCell; |
| 155732 | 155756 | pCsr->nUnused = p->nUnused; |
| 155733 | 155757 | 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; | |
| 155735 | 155760 | nPayload = 0; |
| 155736 | 155761 | for(i=0; i<p->nCell; i++){ |
| 155737 | 155762 | nPayload += p->aCell[i].nLocal; |
| 155738 | 155763 | } |
| 155739 | 155764 | pCsr->nPayload = nPayload; |
| @@ -155765,11 +155790,11 @@ | ||
| 155765 | 155790 | int i |
| 155766 | 155791 | ){ |
| 155767 | 155792 | StatCursor *pCsr = (StatCursor *)pCursor; |
| 155768 | 155793 | switch( i ){ |
| 155769 | 155794 | case 0: /* name */ |
| 155770 | - sqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_STATIC); | |
| 155795 | + sqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_TRANSIENT); | |
| 155771 | 155796 | break; |
| 155772 | 155797 | case 1: /* path */ |
| 155773 | 155798 | sqlite3_result_text(ctx, pCsr->zPath, -1, SQLITE_TRANSIENT); |
| 155774 | 155799 | break; |
| 155775 | 155800 | case 2: /* pageno */ |
| @@ -155791,11 +155816,12 @@ | ||
| 155791 | 155816 | sqlite3_result_int(ctx, pCsr->nMxPayload); |
| 155792 | 155817 | break; |
| 155793 | 155818 | case 8: /* pgoffset */ |
| 155794 | 155819 | sqlite3_result_int64(ctx, pCsr->iOffset); |
| 155795 | 155820 | break; |
| 155796 | - case 9: /* pgsize */ | |
| 155821 | + default: /* pgsize */ | |
| 155822 | + assert( i==9 ); | |
| 155797 | 155823 | sqlite3_result_int(ctx, pCsr->szPage); |
| 155798 | 155824 | break; |
| 155799 | 155825 | } |
| 155800 | 155826 | return SQLITE_OK; |
| 155801 | 155827 | } |
| 155802 | 155828 |
| --- 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 @@ | ||
| 109 | 109 | ** |
| 110 | 110 | ** See also: [sqlite3_libversion()], |
| 111 | 111 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 112 | 112 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 113 | 113 | */ |
| 114 | -#define SQLITE_VERSION "3.8.10" | |
| 114 | +#define SQLITE_VERSION "3.8.10.1" | |
| 115 | 115 | #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" | |
| 117 | 117 | |
| 118 | 118 | /* |
| 119 | 119 | ** CAPI3REF: Run-Time Library Version Numbers |
| 120 | 120 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 121 | 121 | ** |
| 122 | 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" |
| 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 |