diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tclsqlite.c | 12 | ||||
-rw-r--r-- | src/test_async.c | 2 | ||||
-rw-r--r-- | src/test_stat.c | 23 |
3 files changed, 23 insertions, 14 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 23b7e8e84..a2d352c3b 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -3488,6 +3488,11 @@ static char zMainloop[] = "}\n" ; #endif +#if TCLSH==2 +static char zMainloop[] = +#include "spaceanal_tcl.h" +; +#endif #ifdef SQLITE_TEST static void init_all(Tcl_Interp *); @@ -3609,6 +3614,9 @@ int TCLSH_MAIN(int argc, char **argv){ ** sqlite3_initialize() is. */ sqlite3_shutdown(); +#if TCLSH==2 + sqlite3_config(SQLITE_CONFIG_SINGLETHREAD); +#endif Tcl_FindExecutable(argv[0]); interp = Tcl_CreateInterp(); @@ -3624,14 +3632,14 @@ int TCLSH_MAIN(int argc, char **argv){ Tcl_SetVar(interp, "argv", argv[i], TCL_GLOBAL_ONLY | TCL_LIST_ELEMENT | TCL_APPEND_VALUE); } - if( Tcl_EvalFile(interp, argv[1])!=TCL_OK ){ + if( TCLSH==1 && Tcl_EvalFile(interp, argv[1])!=TCL_OK ){ const char *zInfo = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY); if( zInfo==0 ) zInfo = Tcl_GetStringResult(interp); fprintf(stderr,"%s: %s\n", *argv, zInfo); return 1; } } - if( argc<=1 ){ + if( TCLSH==2 || argc<=1 ){ Tcl_GlobalEval(interp, zMainloop); } return 0; diff --git a/src/test_async.c b/src/test_async.c index 313645dec..c760eea1f 100644 --- a/src/test_async.c +++ b/src/test_async.c @@ -229,7 +229,7 @@ static int testAsyncControl( ** of this module. */ int Sqlitetestasync_Init(Tcl_Interp *interp){ -#if SQLITE_ENABLE_ASYNCIO +#ifdef SQLITE_ENABLE_ASYNCIO Tcl_CreateObjCommand(interp,"sqlite3async_start",testAsyncStart,0,0); Tcl_CreateObjCommand(interp,"sqlite3async_wait",testAsyncWait,0,0); diff --git a/src/test_stat.c b/src/test_stat.c index 1a44c38f8..527c8b323 100644 --- a/src/test_stat.c +++ b/src/test_stat.c @@ -9,6 +9,13 @@ ** May you share freely, never taking more than you give. ** ****************************************************************************** +** +** This file contains an implementation of the "dbstat" virtual table. +** +** The dbstat virtual table is used to extract low-level formatting +** information from an SQLite database in order to implement the +** "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script +** for an example implementation. */ #include "sqliteInt.h" @@ -21,9 +28,11 @@ ** root-node path is '/'. ** ** The value of the path for the left-most child page of the root of -** a b-tree is '/000/'. The next to left-most child of the root page is +** a b-tree is '/000/'. (Btrees store content ordered from left to right +** so the pages to the left have smaller keys than the pages to the right.) +** The next to left-most child of the root page is ** '/001', and so on, each sibling page identified by a 3-digit hex -** value. The children of the 450th left-most sibling have paths such +** value. The children of the 451st left-most sibling have paths such ** as '/1c2/000/, '/1c2/001/' etc. ** ** Overflow pages are specified by appending a '+' character and a @@ -40,7 +49,7 @@ ** the overflow pages associated with a cell will appear earlier in the ** sort-order than its child page: ** -** '/1c2/000/' // Left-most child of 450th child of root +** '/1c2/000/' // Left-most child of 451st child of root */ #define VTAB_SCHEMA \ "CREATE TABLE xx( " \ @@ -348,13 +357,6 @@ static int statDecodePage(Btree *pBt, StatPage *p){ return SQLITE_OK; } -static void statSetPath(StatPage *p, StatPage *pParent){ - if( pParent ){ - p->zPath = sqlite3_mprintf("%s%.3x/", pParent->zPath, pParent->iCell); - }else{ - } -} - /* ** Move a statvfs cursor to the next entry in the file. */ @@ -601,4 +603,3 @@ int SqlitetestStat_Init(Tcl_Interp *interp){ return TCL_OK; } #endif - |