Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add eponymous virtual table "schemapool". For inspecting the current contents of the schema-pool. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | reuse-schema |
Files: | files | file ages | folders |
SHA3-256: |
2ebeb747832bd53284ab23b4c2558f0f |
User & Date: | dan 2019-02-11 19:34:38.391 |
Context
2019-02-11
| ||
20:13 | Merge latest trunk changes into this branch. (check-in: dbedd81bf2 user: dan tags: reuse-schema) | |
19:34 | Add eponymous virtual table "schemapool". For inspecting the current contents of the schema-pool. (check-in: 2ebeb74783 user: dan tags: reuse-schema) | |
2019-02-09
| ||
17:47 | Fix virtual table support for SQLITE_OPEN_REUSABLE_SCHEMA connections. (check-in: 3ca8856a7b user: dan tags: reuse-schema) | |
Changes
Changes to Makefile.in.
︙ | ︙ | |||
412 413 414 415 416 417 418 419 420 421 422 423 424 425 | $(TOP)/src/test_mutex.c \ $(TOP)/src/test_onefile.c \ $(TOP)/src/test_osinst.c \ $(TOP)/src/test_pcache.c \ $(TOP)/src/test_quota.c \ $(TOP)/src/test_rtree.c \ $(TOP)/src/test_schema.c \ $(TOP)/src/test_server.c \ $(TOP)/src/test_superlock.c \ $(TOP)/src/test_syscall.c \ $(TOP)/src/test_tclsh.c \ $(TOP)/src/test_tclvar.c \ $(TOP)/src/test_thread.c \ $(TOP)/src/test_vfs.c \ | > | 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | $(TOP)/src/test_mutex.c \ $(TOP)/src/test_onefile.c \ $(TOP)/src/test_osinst.c \ $(TOP)/src/test_pcache.c \ $(TOP)/src/test_quota.c \ $(TOP)/src/test_rtree.c \ $(TOP)/src/test_schema.c \ $(TOP)/src/test_schemapool.c \ $(TOP)/src/test_server.c \ $(TOP)/src/test_superlock.c \ $(TOP)/src/test_syscall.c \ $(TOP)/src/test_tclsh.c \ $(TOP)/src/test_tclvar.c \ $(TOP)/src/test_thread.c \ $(TOP)/src/test_vfs.c \ |
︙ | ︙ | |||
467 468 469 470 471 472 473 474 475 476 477 478 479 480 | # TESTSRC2 = \ $(TOP)/src/attach.c \ $(TOP)/src/backup.c \ $(TOP)/src/bitvec.c \ $(TOP)/src/btree.c \ $(TOP)/src/build.c \ $(TOP)/src/ctime.c \ $(TOP)/src/date.c \ $(TOP)/src/dbpage.c \ $(TOP)/src/dbstat.c \ $(TOP)/src/expr.c \ $(TOP)/src/func.c \ $(TOP)/src/global.c \ | > | 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | # TESTSRC2 = \ $(TOP)/src/attach.c \ $(TOP)/src/backup.c \ $(TOP)/src/bitvec.c \ $(TOP)/src/btree.c \ $(TOP)/src/build.c \ $(TOP)/src/callback.c \ $(TOP)/src/ctime.c \ $(TOP)/src/date.c \ $(TOP)/src/dbpage.c \ $(TOP)/src/dbstat.c \ $(TOP)/src/expr.c \ $(TOP)/src/func.c \ $(TOP)/src/global.c \ |
︙ | ︙ |
Changes to Makefile.msc.
︙ | ︙ | |||
1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 | $(TOP)\src\test_mutex.c \ $(TOP)\src\test_onefile.c \ $(TOP)\src\test_osinst.c \ $(TOP)\src\test_pcache.c \ $(TOP)\src\test_quota.c \ $(TOP)\src\test_rtree.c \ $(TOP)\src\test_schema.c \ $(TOP)\src\test_server.c \ $(TOP)\src\test_superlock.c \ $(TOP)\src\test_syscall.c \ $(TOP)\src\test_tclsh.c \ $(TOP)\src\test_tclvar.c \ $(TOP)\src\test_thread.c \ $(TOP)\src\test_vfs.c \ | > | 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 | $(TOP)\src\test_mutex.c \ $(TOP)\src\test_onefile.c \ $(TOP)\src\test_osinst.c \ $(TOP)\src\test_pcache.c \ $(TOP)\src\test_quota.c \ $(TOP)\src\test_rtree.c \ $(TOP)\src\test_schema.c \ $(TOP)\src\test_schemapool.c \ $(TOP)\src\test_server.c \ $(TOP)\src\test_superlock.c \ $(TOP)\src\test_syscall.c \ $(TOP)\src\test_tclsh.c \ $(TOP)\src\test_tclvar.c \ $(TOP)\src\test_thread.c \ $(TOP)\src\test_vfs.c \ |
︙ | ︙ |
Changes to main.mk.
︙ | ︙ | |||
337 338 339 340 341 342 343 344 345 346 347 348 349 350 | $(TOP)/src/test_mutex.c \ $(TOP)/src/test_onefile.c \ $(TOP)/src/test_osinst.c \ $(TOP)/src/test_pcache.c \ $(TOP)/src/test_quota.c \ $(TOP)/src/test_rtree.c \ $(TOP)/src/test_schema.c \ $(TOP)/src/test_server.c \ $(TOP)/src/test_sqllog.c \ $(TOP)/src/test_superlock.c \ $(TOP)/src/test_syscall.c \ $(TOP)/src/test_tclsh.c \ $(TOP)/src/test_tclvar.c \ $(TOP)/src/test_thread.c \ | > | 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | $(TOP)/src/test_mutex.c \ $(TOP)/src/test_onefile.c \ $(TOP)/src/test_osinst.c \ $(TOP)/src/test_pcache.c \ $(TOP)/src/test_quota.c \ $(TOP)/src/test_rtree.c \ $(TOP)/src/test_schema.c \ $(TOP)/src/test_schemapool.c \ $(TOP)/src/test_server.c \ $(TOP)/src/test_sqllog.c \ $(TOP)/src/test_superlock.c \ $(TOP)/src/test_syscall.c \ $(TOP)/src/test_tclsh.c \ $(TOP)/src/test_tclvar.c \ $(TOP)/src/test_thread.c \ |
︙ | ︙ | |||
388 389 390 391 392 393 394 395 396 397 398 399 400 401 | #TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c TESTSRC2 = \ $(TOP)/src/attach.c \ $(TOP)/src/backup.c \ $(TOP)/src/btree.c \ $(TOP)/src/build.c \ $(TOP)/src/date.c \ $(TOP)/src/dbpage.c \ $(TOP)/src/dbstat.c \ $(TOP)/src/expr.c \ $(TOP)/src/func.c \ $(TOP)/src/global.c \ $(TOP)/src/insert.c \ | > | 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | #TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c TESTSRC2 = \ $(TOP)/src/attach.c \ $(TOP)/src/backup.c \ $(TOP)/src/btree.c \ $(TOP)/src/build.c \ $(TOP)/src/callback.c \ $(TOP)/src/date.c \ $(TOP)/src/dbpage.c \ $(TOP)/src/dbstat.c \ $(TOP)/src/expr.c \ $(TOP)/src/func.c \ $(TOP)/src/global.c \ $(TOP)/src/insert.c \ |
︙ | ︙ |
Changes to src/callback.c.
︙ | ︙ | |||
43 44 45 46 47 48 49 50 51 52 53 54 | static void assert_schema_state_ok(sqlite3 *db){ if( IsReuseSchema(db) && db->magic!=SQLITE_MAGIC_ZOMBIE ){ int i; for(i=0; i<db->nDb; i++){ if( i!=1 ){ Db *pDb = &db->aDb[i]; Btree *pBt = pDb->pBt; if( pDb->pSPool ){ if( DbHasProperty(db, i, DB_SchemaLoaded)==0 ){ assert( pDb->pSchema->tblHash.count==0 ); assert( pDb->pSchema==&pDb->pSPool->sSchema ); }else{ | > > < < | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | static void assert_schema_state_ok(sqlite3 *db){ if( IsReuseSchema(db) && db->magic!=SQLITE_MAGIC_ZOMBIE ){ int i; for(i=0; i<db->nDb; i++){ if( i!=1 ){ Db *pDb = &db->aDb[i]; Btree *pBt = pDb->pBt; assert( pBt==0 || sqlite3BtreeSchema(pBt, 0, 0)==0 ); assert( pDb->pSchema ); if( pDb->pSPool ){ if( DbHasProperty(db, i, DB_SchemaLoaded)==0 ){ assert( pDb->pSchema->tblHash.count==0 ); assert( pDb->pSchema==&pDb->pSPool->sSchema ); }else{ assert( pDb->pSchema!=&pDb->pSPool->sSchema ); } }else{ assert( DbHasProperty(db, i, DB_SchemaLoaded)==0 ); assert( pDb->pSchema->tblHash.count==0 ); assert( pDb->pSchema!=&pDb->pSPool->sSchema ); } } } } } #else |
︙ | ︙ | |||
534 535 536 537 538 539 540 541 542 543 544 545 546 547 | /* ** Global linked list of SchemaPool objects. Read and write access must ** be protected by the SQLITE_MUTEX_STATIC_MASTER mutex. */ static SchemaPool *SQLITE_WSD schemaPoolList = 0; /* ** Check that the schema of db iDb is writable (either because it is the temp ** db schema or because the db handle was opened without ** SQLITE_OPEN_REUSE_SCHEMA). If so, do nothing. Otherwise, leave an ** error in the Parse object. */ void sqlite3SchemaWritable(Parse *pParse, int iDb){ | > > > > | 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 | /* ** Global linked list of SchemaPool objects. Read and write access must ** be protected by the SQLITE_MUTEX_STATIC_MASTER mutex. */ static SchemaPool *SQLITE_WSD schemaPoolList = 0; #ifdef SQLITE_TEST SchemaPool *sqlite3SchemaPoolList(void){ return schemaPoolList; } #endif /* ** Check that the schema of db iDb is writable (either because it is the temp ** db schema or because the db handle was opened without ** SQLITE_OPEN_REUSE_SCHEMA). If so, do nothing. Otherwise, leave an ** error in the Parse object. */ void sqlite3SchemaWritable(Parse *pParse, int iDb){ |
︙ | ︙ | |||
657 658 659 660 661 662 663 | } } if( rc==SQLITE_OK ){ assert( pSPool->nRef>=1 ); pDb->pSPool = 0; pSPool->nRef--; if( pSPool->nRef<=0 ){ | < | 661 662 663 664 665 666 667 668 669 670 671 672 673 674 | } } if( rc==SQLITE_OK ){ assert( pSPool->nRef>=1 ); pDb->pSPool = 0; pSPool->nRef--; if( pSPool->nRef<=0 ){ SchemaPool **pp; while( pSPool->pSchema ){ Schema *pNext = pSPool->pSchema->pNext; schemaDelete(pSPool->pSchema); pSPool->pSchema = pNext; } for(pp=&schemaPoolList; (*pp)!=pSPool; pp=&((*pp)->pNext)); |
︙ | ︙ |
Changes to src/prepare.c.
︙ | ︙ | |||
222 223 224 225 226 227 228 229 230 231 232 233 234 235 | azArg[3] = 0; initData.db = db; initData.iDb = iDb; initData.rc = SQLITE_OK; initData.pzErrMsg = pzErrMsg; initData.mInitFlags = mFlags; initData.nInitRow = 0; sqlite3InitCallback(&initData, 3, (char **)azArg, 0); if( initData.rc ){ rc = initData.rc; goto error_out; } /* Create a cursor to hold the database open | > | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | azArg[3] = 0; initData.db = db; initData.iDb = iDb; initData.rc = SQLITE_OK; initData.pzErrMsg = pzErrMsg; initData.mInitFlags = mFlags; initData.nInitRow = 0; initData.cksum = 0; sqlite3InitCallback(&initData, 3, (char **)azArg, 0); if( initData.rc ){ rc = initData.rc; goto error_out; } /* Create a cursor to hold the database open |
︙ | ︙ |
Added src/test_schemapool.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | /* ** 2006 June 10 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing the virtual table interfaces. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. */ /* ** None of this works unless we have virtual tables. */ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_TEST) #include "sqliteInt.h" #include <tcl.h> /* The code in this file defines a sqlite3 virtual-table module with ** the following schema. */ #define SCHEMAPOOL_SCHEMA \ "CREATE TABLE x(" \ " cksum INTEGER, " \ " nref INTEGER, " \ " nschema INTEGER " \ ")" typedef struct schemapool_vtab schemapool_vtab; typedef struct schemapool_cursor schemapool_cursor; /* A schema table object */ struct schemapool_vtab { sqlite3_vtab base; }; /* A schema table cursor object */ struct schemapool_cursor { sqlite3_vtab_cursor base; sqlite3_int64 *aData; int iRow; int nRow; }; /* ** Table destructor for the schema module. */ static int schemaPoolDestroy(sqlite3_vtab *pVtab){ sqlite3_free(pVtab); return 0; } /* ** Table constructor for the schema module. */ static int schemaPoolCreate( sqlite3 *db, void *pAux, int argc, const char *const*argv, sqlite3_vtab **ppVtab, char **pzErr ){ int rc = SQLITE_NOMEM; schemapool_vtab *pVtab = sqlite3_malloc(sizeof(schemapool_vtab)); if( pVtab ){ memset(pVtab, 0, sizeof(schemapool_vtab)); rc = sqlite3_declare_vtab(db, SCHEMAPOOL_SCHEMA); } *ppVtab = (sqlite3_vtab *)pVtab; return rc; } /* ** Open a new cursor on the schema table. */ static int schemaPoolOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ int rc = SQLITE_NOMEM; schemapool_cursor *pCur; pCur = sqlite3_malloc(sizeof(schemapool_cursor)); if( pCur ){ memset(pCur, 0, sizeof(schemapool_cursor)); *ppCursor = (sqlite3_vtab_cursor*)pCur; rc = SQLITE_OK; } return rc; } /* ** Close a schema table cursor. */ static int schemaPoolClose(sqlite3_vtab_cursor *cur){ schemapool_cursor *pCur = (schemapool_cursor*)cur; sqlite3_free(pCur->aData); sqlite3_free(pCur); return SQLITE_OK; } /* ** Retrieve a column of data. */ static int schemaPoolColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){ schemapool_cursor *pCur = (schemapool_cursor*)cur; assert( i==0 || i==1 || i==2 ); sqlite3_result_int64(ctx, pCur->aData[pCur->iRow*3 + i]); return SQLITE_OK; } /* ** Retrieve the current rowid. */ static int schemaPoolRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){ schemapool_cursor *pCur = (schemapool_cursor*)cur; *pRowid = pCur->iRow + 1; return SQLITE_OK; } static int schemaPoolEof(sqlite3_vtab_cursor *cur){ schemapool_cursor *pCur = (schemapool_cursor*)cur; return pCur->iRow>=pCur->nRow; } /* ** Advance the cursor to the next row. */ static int schemaPoolNext(sqlite3_vtab_cursor *cur){ schemapool_cursor *pCur = (schemapool_cursor*)cur; pCur->iRow++; return SQLITE_OK; } struct SchemaPool { int nRef; /* Number of pointers to this object */ u64 cksum; /* Checksum for this Schema contents */ Schema *pSchema; /* Linked list of Schema objects */ Schema sSchema; /* The single dummy schema object */ SchemaPool *pNext; /* Next element in schemaPoolList */ }; extern SchemaPool *sqlite3SchemaPoolList(void); /* ** Reset a schemaPool table cursor. */ static int schemaPoolFilter( sqlite3_vtab_cursor *pVtabCursor, int idxNum, const char *idxStr, int argc, sqlite3_value **argv ){ SchemaPool *pSPool; schemapool_cursor *pCur = (schemapool_cursor*)pVtabCursor; sqlite3_free(pCur->aData); pCur->aData = 0; pCur->nRow = 0; pCur->iRow = 0; for(pSPool = sqlite3SchemaPoolList(); pSPool; pSPool=pSPool->pNext){ pCur->nRow++; } if( pCur->nRow ){ int iRow = 0; pCur->aData = (i64*)sqlite3_malloc(3 * pCur->nRow * sizeof(i64)); if( pCur->aData==0 ) return SQLITE_NOMEM; for(pSPool = sqlite3SchemaPoolList(); pSPool; pSPool=pSPool->pNext){ Schema *p; i64 nSchema = 0; for(p=pSPool->pSchema; p; p=p->pNext){ nSchema++; } pCur->aData[0 + iRow*3] = pSPool->cksum; pCur->aData[1 + iRow*3] = (i64)pSPool->nRef; pCur->aData[2 + iRow*3] = nSchema; iRow++; } } return SQLITE_OK; } /* ** Analyse the WHERE condition. */ static int schemaPoolBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ return SQLITE_OK; } /* ** A virtual table module that merely echos method calls into TCL ** variables. */ static sqlite3_module schemaPoolModule = { 0, /* iVersion */ schemaPoolCreate, schemaPoolCreate, schemaPoolBestIndex, schemaPoolDestroy, schemaPoolDestroy, schemaPoolOpen, /* xOpen - open a cursor */ schemaPoolClose, /* xClose - close a cursor */ schemaPoolFilter, /* xFilter - configure scan constraints */ schemaPoolNext, /* xNext - advance a cursor */ schemaPoolEof, /* xEof */ schemaPoolColumn, /* xColumn - read data */ schemaPoolRowid, /* xRowid - read data */ 0, /* xUpdate */ 0, /* xBegin */ 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ }; /* ** Decode a pointer to an sqlite3 object. */ extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb); /* ** Register the schema virtual table module. */ static int SQLITE_TCLAPI register_schemapool_module( ClientData clientData, /* Not used */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "DB"); return TCL_ERROR; } if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; #ifndef SQLITE_OMIT_VIRTUALTABLE sqlite3_create_module(db, "schemapool", &schemaPoolModule, 0); #endif return TCL_OK; } #endif /* ** Register commands with the TCL interpreter. */ int Sqlitetestschemapool_Init(Tcl_Interp *interp){ static struct { char *zName; Tcl_ObjCmdProc *xProc; void *clientData; } aObjCmd[] = { { "register_schemapool_module", register_schemapool_module, 0 }, }; int i; for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){ Tcl_CreateObjCommand(interp, aObjCmd[i].zName, aObjCmd[i].xProc, aObjCmd[i].clientData, 0); } return TCL_OK; } |
Changes to src/test_tclsh.c.
︙ | ︙ | |||
73 74 75 76 77 78 79 80 81 82 83 84 85 86 | extern int Sqlitetest_demovfs_Init(Tcl_Interp *); extern int Sqlitetest_func_Init(Tcl_Interp*); extern int Sqlitetest_hexio_Init(Tcl_Interp*); extern int Sqlitetest_init_Init(Tcl_Interp*); extern int Sqlitetest_malloc_Init(Tcl_Interp*); extern int Sqlitetest_mutex_Init(Tcl_Interp*); extern int Sqlitetestschema_Init(Tcl_Interp*); extern int Sqlitetestsse_Init(Tcl_Interp*); extern int Sqlitetesttclvar_Init(Tcl_Interp*); extern int Sqlitetestfs_Init(Tcl_Interp*); extern int SqlitetestThread_Init(Tcl_Interp*); extern int SqlitetestOnefile_Init(); extern int SqlitetestOsinst_Init(Tcl_Interp*); extern int Sqlitetestbackup_Init(Tcl_Interp*); | > | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | extern int Sqlitetest_demovfs_Init(Tcl_Interp *); extern int Sqlitetest_func_Init(Tcl_Interp*); extern int Sqlitetest_hexio_Init(Tcl_Interp*); extern int Sqlitetest_init_Init(Tcl_Interp*); extern int Sqlitetest_malloc_Init(Tcl_Interp*); extern int Sqlitetest_mutex_Init(Tcl_Interp*); extern int Sqlitetestschema_Init(Tcl_Interp*); extern int Sqlitetestschemapool_Init(Tcl_Interp*); extern int Sqlitetestsse_Init(Tcl_Interp*); extern int Sqlitetesttclvar_Init(Tcl_Interp*); extern int Sqlitetestfs_Init(Tcl_Interp*); extern int SqlitetestThread_Init(Tcl_Interp*); extern int SqlitetestOnefile_Init(); extern int SqlitetestOsinst_Init(Tcl_Interp*); extern int Sqlitetestbackup_Init(Tcl_Interp*); |
︙ | ︙ | |||
142 143 144 145 146 147 148 149 150 151 152 153 154 155 | Sqlitetest_demovfs_Init(interp); Sqlitetest_func_Init(interp); Sqlitetest_hexio_Init(interp); Sqlitetest_init_Init(interp); Sqlitetest_malloc_Init(interp); Sqlitetest_mutex_Init(interp); Sqlitetestschema_Init(interp); Sqlitetesttclvar_Init(interp); Sqlitetestfs_Init(interp); SqlitetestThread_Init(interp); SqlitetestOnefile_Init(); SqlitetestOsinst_Init(interp); Sqlitetestbackup_Init(interp); Sqlitetestintarray_Init(interp); | > | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | Sqlitetest_demovfs_Init(interp); Sqlitetest_func_Init(interp); Sqlitetest_hexio_Init(interp); Sqlitetest_init_Init(interp); Sqlitetest_malloc_Init(interp); Sqlitetest_mutex_Init(interp); Sqlitetestschema_Init(interp); Sqlitetestschemapool_Init(interp); Sqlitetesttclvar_Init(interp); Sqlitetestfs_Init(interp); SqlitetestThread_Init(interp); SqlitetestOnefile_Init(); SqlitetestOsinst_Init(interp); Sqlitetestbackup_Init(interp); Sqlitetestintarray_Init(interp); |
︙ | ︙ |
Changes to test/reuse2.test.
︙ | ︙ | |||
52 53 54 55 56 57 58 59 | sqlite3 db test.db -reuse-schema 1 do_execsql_test 2.1 { SELECT * FROM ft } {{one two three}} } finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | sqlite3 db test.db -reuse-schema 1 do_execsql_test 2.1 { SELECT * FROM ft } {{one two three}} } #-------------------------------------------------------------------------- reset_db do_execsql_test 3.0 { CREATE TABLE t1(x INTEGER PRIMARY KEY, y UNIQUE, z); CREATE INDEX i1 ON t1(z); PRAGMA schema_version; } {2} do_test 3.1 { sqlite3 db1 test.db -reuse-schema 1 sqlite3 db2 test.db -reuse-schema 1 } {} do_execsql_test -db db1 3.2.1 { SELECT * FROM t1 } do_execsql_test -db db2 3.2.2 { SELECT * FROM t1 } register_schemapool_module db do_execsql_test 3.3 { SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool; } {nref=2 nschema=1} sqlite3 db3 test.db -reuse-schema 1 register_schemapool_module db3 do_execsql_test 3.5 { SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool; } {nref=2 nschema=1} do_execsql_test -db db3 3.6 { SELECT * FROM t1; SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool; } {nref=3 nschema=1} do_execsql_test 3.7 { CREATE TABLE t2(x); } do_execsql_test 3.8 { SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool; } {nref=3 nschema=1} do_execsql_test -db db1 3.9.1 { SELECT * FROM t1 } do_execsql_test 3.9.2 { SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1; } {nref=1 nschema=1 nref=2 nschema=1} do_execsql_test -db db2 3.10.1 { SELECT * FROM t1 } do_execsql_test 3.10.2 { SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1; } {nref=1 nschema=1 nref=2 nschema=1} do_execsql_test -db db3 3.11.1 { SELECT * FROM t1 } do_execsql_test 3.11.2 { SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1; } {nref=3 nschema=1} finish_test |