/ Check-in [2ebeb747]
Login

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 | SQL archive
Timelines: family | ancestors | descendants | both | reuse-schema
Files: files | file ages | folders
SHA3-256:2ebeb747832bd53284ab23b4c2558f0fa550c0ea2b4a6c1640eeb83f8132c556
User & Date: dan 2019-02-11 19:34:38
Wiki:reuse-schema
Context
2019-02-11
20:13
Merge latest trunk changes into this branch. check-in: dbedd81b user: dan tags: reuse-schema
19:34
Add eponymous virtual table "schemapool". For inspecting the current contents of the schema-pool. check-in: 2ebeb747 user: dan tags: reuse-schema
2019-02-09
17:47
Fix virtual table support for SQLITE_OPEN_REUSABLE_SCHEMA connections. check-in: 3ca8856a user: dan tags: reuse-schema
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.in.

   412    412     $(TOP)/src/test_mutex.c \
   413    413     $(TOP)/src/test_onefile.c \
   414    414     $(TOP)/src/test_osinst.c \
   415    415     $(TOP)/src/test_pcache.c \
   416    416     $(TOP)/src/test_quota.c \
   417    417     $(TOP)/src/test_rtree.c \
   418    418     $(TOP)/src/test_schema.c \
          419  +  $(TOP)/src/test_schemapool.c \
   419    420     $(TOP)/src/test_server.c \
   420    421     $(TOP)/src/test_superlock.c \
   421    422     $(TOP)/src/test_syscall.c \
   422    423     $(TOP)/src/test_tclsh.c \
   423    424     $(TOP)/src/test_tclvar.c \
   424    425     $(TOP)/src/test_thread.c \
   425    426     $(TOP)/src/test_vfs.c \
................................................................................
   467    468   #
   468    469   TESTSRC2 = \
   469    470     $(TOP)/src/attach.c \
   470    471     $(TOP)/src/backup.c \
   471    472     $(TOP)/src/bitvec.c \
   472    473     $(TOP)/src/btree.c \
   473    474     $(TOP)/src/build.c \
          475  +  $(TOP)/src/callback.c \
   474    476     $(TOP)/src/ctime.c \
   475    477     $(TOP)/src/date.c \
   476    478     $(TOP)/src/dbpage.c \
   477    479     $(TOP)/src/dbstat.c \
   478    480     $(TOP)/src/expr.c \
   479    481     $(TOP)/src/func.c \
   480    482     $(TOP)/src/global.c \

Changes to Makefile.msc.

  1487   1487     $(TOP)\src\test_mutex.c \
  1488   1488     $(TOP)\src\test_onefile.c \
  1489   1489     $(TOP)\src\test_osinst.c \
  1490   1490     $(TOP)\src\test_pcache.c \
  1491   1491     $(TOP)\src\test_quota.c \
  1492   1492     $(TOP)\src\test_rtree.c \
  1493   1493     $(TOP)\src\test_schema.c \
         1494  +  $(TOP)\src\test_schemapool.c \
  1494   1495     $(TOP)\src\test_server.c \
  1495   1496     $(TOP)\src\test_superlock.c \
  1496   1497     $(TOP)\src\test_syscall.c \
  1497   1498     $(TOP)\src\test_tclsh.c \
  1498   1499     $(TOP)\src\test_tclvar.c \
  1499   1500     $(TOP)\src\test_thread.c \
  1500   1501     $(TOP)\src\test_vfs.c \

Changes to main.mk.

   337    337     $(TOP)/src/test_mutex.c \
   338    338     $(TOP)/src/test_onefile.c \
   339    339     $(TOP)/src/test_osinst.c \
   340    340     $(TOP)/src/test_pcache.c \
   341    341     $(TOP)/src/test_quota.c \
   342    342     $(TOP)/src/test_rtree.c \
   343    343     $(TOP)/src/test_schema.c \
          344  +  $(TOP)/src/test_schemapool.c \
   344    345     $(TOP)/src/test_server.c \
   345    346     $(TOP)/src/test_sqllog.c \
   346    347     $(TOP)/src/test_superlock.c \
   347    348     $(TOP)/src/test_syscall.c \
   348    349     $(TOP)/src/test_tclsh.c \
   349    350     $(TOP)/src/test_tclvar.c \
   350    351     $(TOP)/src/test_thread.c \
................................................................................
   388    389   #TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c
   389    390   
   390    391   TESTSRC2 = \
   391    392     $(TOP)/src/attach.c \
   392    393     $(TOP)/src/backup.c \
   393    394     $(TOP)/src/btree.c \
   394    395     $(TOP)/src/build.c \
          396  +  $(TOP)/src/callback.c \
   395    397     $(TOP)/src/date.c \
   396    398     $(TOP)/src/dbpage.c \
   397    399     $(TOP)/src/dbstat.c \
   398    400     $(TOP)/src/expr.c \
   399    401     $(TOP)/src/func.c \
   400    402     $(TOP)/src/global.c \
   401    403     $(TOP)/src/insert.c \

Changes to src/callback.c.

    43     43   static void assert_schema_state_ok(sqlite3 *db){
    44     44     if( IsReuseSchema(db) && db->magic!=SQLITE_MAGIC_ZOMBIE ){
    45     45       int i;
    46     46       for(i=0; i<db->nDb; i++){
    47     47         if( i!=1 ){
    48     48           Db *pDb = &db->aDb[i];
    49     49           Btree *pBt = pDb->pBt;
           50  +        assert( pBt==0 || sqlite3BtreeSchema(pBt, 0, 0)==0 );
           51  +        assert( pDb->pSchema );
    50     52           if( pDb->pSPool ){
    51     53             if( DbHasProperty(db, i, DB_SchemaLoaded)==0 ){
    52     54               assert( pDb->pSchema->tblHash.count==0 );
    53     55               assert( pDb->pSchema==&pDb->pSPool->sSchema );
    54     56             }else{
    55         -            assert( pBt==0 || pDb->pSchema!=sqlite3BtreeSchema(pBt, 0, 0) );
    56     57               assert( pDb->pSchema!=&pDb->pSPool->sSchema );
    57     58             }
    58     59           }else{
    59     60             assert( DbHasProperty(db, i, DB_SchemaLoaded)==0 );
    60     61             assert( pDb->pSchema->tblHash.count==0 );
    61         -          assert( pBt==0 || pDb->pSchema!=sqlite3BtreeSchema(pBt, 0, 0) );
    62     62             assert( pDb->pSchema!=&pDb->pSPool->sSchema );
    63     63           }
    64     64         }
    65     65       }
    66     66     }
    67     67   }
    68     68   #else
................................................................................
   534    534   
   535    535   /*
   536    536   ** Global linked list of SchemaPool objects. Read and write access must
   537    537   ** be protected by the SQLITE_MUTEX_STATIC_MASTER mutex.
   538    538   */
   539    539   static SchemaPool *SQLITE_WSD schemaPoolList = 0;
   540    540   
          541  +#ifdef SQLITE_TEST
          542  +SchemaPool *sqlite3SchemaPoolList(void){ return schemaPoolList; }
          543  +#endif
          544  +
   541    545   /*
   542    546   ** Check that the schema of db iDb is writable (either because it is the temp
   543    547   ** db schema or because the db handle was opened without
   544    548   ** SQLITE_OPEN_REUSE_SCHEMA). If so, do nothing. Otherwise, leave an 
   545    549   ** error in the Parse object.
   546    550   */
   547    551   void sqlite3SchemaWritable(Parse *pParse, int iDb){
................................................................................
   657    661           }
   658    662         }
   659    663         if( rc==SQLITE_OK ){
   660    664           assert( pSPool->nRef>=1 );
   661    665           pDb->pSPool = 0;
   662    666           pSPool->nRef--;
   663    667           if( pSPool->nRef<=0 ){
   664         -          Schema *pNext;
   665    668             SchemaPool **pp;
   666    669             while( pSPool->pSchema ){
   667    670               Schema *pNext = pSPool->pSchema->pNext;
   668    671               schemaDelete(pSPool->pSchema);
   669    672               pSPool->pSchema = pNext;
   670    673             }
   671    674             for(pp=&schemaPoolList; (*pp)!=pSPool; pp=&((*pp)->pNext));

Changes to src/prepare.c.

   222    222     azArg[3] = 0;
   223    223     initData.db = db;
   224    224     initData.iDb = iDb;
   225    225     initData.rc = SQLITE_OK;
   226    226     initData.pzErrMsg = pzErrMsg;
   227    227     initData.mInitFlags = mFlags;
   228    228     initData.nInitRow = 0;
          229  +  initData.cksum = 0;
   229    230     sqlite3InitCallback(&initData, 3, (char **)azArg, 0);
   230    231     if( initData.rc ){
   231    232       rc = initData.rc;
   232    233       goto error_out;
   233    234     }
   234    235   
   235    236     /* Create a cursor to hold the database open

Added src/test_schemapool.c.

            1  +/*
            2  +** 2006 June 10
            3  +**
            4  +** The author disclaims copyright to this source code.  In place of
            5  +** a legal notice, here is a blessing:
            6  +**
            7  +**    May you do good and not evil.
            8  +**    May you find forgiveness for yourself and forgive others.
            9  +**    May you share freely, never taking more than you give.
           10  +**
           11  +*************************************************************************
           12  +** Code for testing the virtual table interfaces.  This code
           13  +** is not included in the SQLite library.  It is used for automated
           14  +** testing of the SQLite library.
           15  +*/
           16  +
           17  +/*
           18  +** None of this works unless we have virtual tables.
           19  +*/
           20  +#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_TEST)
           21  +
           22  +#include "sqliteInt.h"
           23  +#include <tcl.h>
           24  +
           25  +/* The code in this file defines a sqlite3 virtual-table module with
           26  +** the following schema.
           27  +*/
           28  +#define SCHEMAPOOL_SCHEMA \
           29  +"CREATE TABLE x("         \
           30  +"  cksum   INTEGER, "     \
           31  +"  nref    INTEGER, "     \
           32  +"  nschema INTEGER  "     \
           33  +")"
           34  +
           35  +typedef struct schemapool_vtab schemapool_vtab;
           36  +typedef struct schemapool_cursor schemapool_cursor;
           37  +
           38  +/* A schema table object */
           39  +struct schemapool_vtab {
           40  +  sqlite3_vtab base;
           41  +};
           42  +
           43  +/* A schema table cursor object */
           44  +struct schemapool_cursor {
           45  +  sqlite3_vtab_cursor base;
           46  +  sqlite3_int64 *aData;
           47  +  int iRow;
           48  +  int nRow;
           49  +};
           50  +
           51  +/*
           52  +** Table destructor for the schema module.
           53  +*/
           54  +static int schemaPoolDestroy(sqlite3_vtab *pVtab){
           55  +  sqlite3_free(pVtab);
           56  +  return 0;
           57  +}
           58  +
           59  +/*
           60  +** Table constructor for the schema module.
           61  +*/
           62  +static int schemaPoolCreate(
           63  +  sqlite3 *db,
           64  +  void *pAux,
           65  +  int argc, const char *const*argv,
           66  +  sqlite3_vtab **ppVtab,
           67  +  char **pzErr
           68  +){
           69  +  int rc = SQLITE_NOMEM;
           70  +  schemapool_vtab *pVtab = sqlite3_malloc(sizeof(schemapool_vtab));
           71  +  if( pVtab ){
           72  +    memset(pVtab, 0, sizeof(schemapool_vtab));
           73  +    rc = sqlite3_declare_vtab(db, SCHEMAPOOL_SCHEMA);
           74  +  }
           75  +  *ppVtab = (sqlite3_vtab *)pVtab;
           76  +  return rc;
           77  +}
           78  +
           79  +/*
           80  +** Open a new cursor on the schema table.
           81  +*/
           82  +static int schemaPoolOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){
           83  +  int rc = SQLITE_NOMEM;
           84  +  schemapool_cursor *pCur;
           85  +  pCur = sqlite3_malloc(sizeof(schemapool_cursor));
           86  +  if( pCur ){
           87  +    memset(pCur, 0, sizeof(schemapool_cursor));
           88  +    *ppCursor = (sqlite3_vtab_cursor*)pCur;
           89  +    rc = SQLITE_OK;
           90  +  }
           91  +  return rc;
           92  +}
           93  +
           94  +/*
           95  +** Close a schema table cursor.
           96  +*/
           97  +static int schemaPoolClose(sqlite3_vtab_cursor *cur){
           98  +  schemapool_cursor *pCur = (schemapool_cursor*)cur;
           99  +  sqlite3_free(pCur->aData);
          100  +  sqlite3_free(pCur);
          101  +  return SQLITE_OK;
          102  +}
          103  +
          104  +/*
          105  +** Retrieve a column of data.
          106  +*/
          107  +static int schemaPoolColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){
          108  +  schemapool_cursor *pCur = (schemapool_cursor*)cur;
          109  +  assert( i==0 || i==1 || i==2 );
          110  +  sqlite3_result_int64(ctx, pCur->aData[pCur->iRow*3 + i]);
          111  +  return SQLITE_OK;
          112  +}
          113  +
          114  +/*
          115  +** Retrieve the current rowid.
          116  +*/
          117  +static int schemaPoolRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
          118  +  schemapool_cursor *pCur = (schemapool_cursor*)cur;
          119  +  *pRowid = pCur->iRow + 1;
          120  +  return SQLITE_OK;
          121  +}
          122  +
          123  +static int schemaPoolEof(sqlite3_vtab_cursor *cur){
          124  +  schemapool_cursor *pCur = (schemapool_cursor*)cur;
          125  +  return pCur->iRow>=pCur->nRow;
          126  +}
          127  +
          128  +/*
          129  +** Advance the cursor to the next row.
          130  +*/
          131  +static int schemaPoolNext(sqlite3_vtab_cursor *cur){
          132  +  schemapool_cursor *pCur = (schemapool_cursor*)cur;
          133  +  pCur->iRow++;
          134  +  return SQLITE_OK;
          135  +}
          136  +
          137  +struct SchemaPool {
          138  +  int nRef;                       /* Number of pointers to this object */
          139  +  u64 cksum;                      /* Checksum for this Schema contents */
          140  +  Schema *pSchema;                /* Linked list of Schema objects */
          141  +  Schema sSchema;                 /* The single dummy schema object */
          142  +  SchemaPool *pNext;              /* Next element in schemaPoolList */
          143  +};
          144  +extern SchemaPool *sqlite3SchemaPoolList(void);
          145  +
          146  +/*
          147  +** Reset a schemaPool table cursor.
          148  +*/
          149  +static int schemaPoolFilter(
          150  +  sqlite3_vtab_cursor *pVtabCursor, 
          151  +  int idxNum, const char *idxStr,
          152  +  int argc, sqlite3_value **argv
          153  +){
          154  +  SchemaPool *pSPool;
          155  +  schemapool_cursor *pCur = (schemapool_cursor*)pVtabCursor;
          156  +
          157  +  sqlite3_free(pCur->aData);
          158  +  pCur->aData = 0;
          159  +  pCur->nRow = 0;
          160  +  pCur->iRow = 0;
          161  +
          162  +  for(pSPool = sqlite3SchemaPoolList(); pSPool; pSPool=pSPool->pNext){
          163  +    pCur->nRow++;
          164  +  }
          165  +
          166  +  if( pCur->nRow ){
          167  +    int iRow = 0;
          168  +    pCur->aData = (i64*)sqlite3_malloc(3 * pCur->nRow * sizeof(i64));
          169  +    if( pCur->aData==0 ) return SQLITE_NOMEM;
          170  +    for(pSPool = sqlite3SchemaPoolList(); pSPool; pSPool=pSPool->pNext){
          171  +      Schema *p;
          172  +      i64 nSchema = 0;
          173  +      for(p=pSPool->pSchema; p; p=p->pNext){
          174  +        nSchema++;
          175  +      }
          176  +      pCur->aData[0 + iRow*3] = pSPool->cksum;
          177  +      pCur->aData[1 + iRow*3] = (i64)pSPool->nRef;
          178  +      pCur->aData[2 + iRow*3] = nSchema;
          179  +      iRow++;
          180  +    }
          181  +  }
          182  +
          183  +  return SQLITE_OK;
          184  +}
          185  +
          186  +/*
          187  +** Analyse the WHERE condition.
          188  +*/
          189  +static int schemaPoolBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
          190  +  return SQLITE_OK;
          191  +}
          192  +
          193  +/*
          194  +** A virtual table module that merely echos method calls into TCL
          195  +** variables.
          196  +*/
          197  +static sqlite3_module schemaPoolModule = {
          198  +  0,                           /* iVersion */
          199  +  schemaPoolCreate,
          200  +  schemaPoolCreate,
          201  +  schemaPoolBestIndex,
          202  +  schemaPoolDestroy,
          203  +  schemaPoolDestroy,
          204  +  schemaPoolOpen,              /* xOpen - open a cursor */
          205  +  schemaPoolClose,             /* xClose - close a cursor */
          206  +  schemaPoolFilter,            /* xFilter - configure scan constraints */
          207  +  schemaPoolNext,              /* xNext - advance a cursor */
          208  +  schemaPoolEof,               /* xEof */
          209  +  schemaPoolColumn,            /* xColumn - read data */
          210  +  schemaPoolRowid,             /* xRowid - read data */
          211  +  0,                           /* xUpdate */
          212  +  0,                           /* xBegin */
          213  +  0,                           /* xSync */
          214  +  0,                           /* xCommit */
          215  +  0,                           /* xRollback */
          216  +  0,                           /* xFindMethod */
          217  +  0,                           /* xRename */
          218  +};
          219  +
          220  +/*
          221  +** Decode a pointer to an sqlite3 object.
          222  +*/
          223  +extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb);
          224  +
          225  +/*
          226  +** Register the schema virtual table module.
          227  +*/
          228  +static int SQLITE_TCLAPI register_schemapool_module(
          229  +  ClientData clientData, /* Not used */
          230  +  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
          231  +  int objc,              /* Number of arguments */
          232  +  Tcl_Obj *CONST objv[]  /* Command arguments */
          233  +){
          234  +  sqlite3 *db;
          235  +  if( objc!=2 ){
          236  +    Tcl_WrongNumArgs(interp, 1, objv, "DB");
          237  +    return TCL_ERROR;
          238  +  }
          239  +  if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
          240  +#ifndef SQLITE_OMIT_VIRTUALTABLE
          241  +  sqlite3_create_module(db, "schemapool", &schemaPoolModule, 0);
          242  +#endif
          243  +  return TCL_OK;
          244  +}
          245  +
          246  +#endif
          247  +
          248  +/*
          249  +** Register commands with the TCL interpreter.
          250  +*/
          251  +int Sqlitetestschemapool_Init(Tcl_Interp *interp){
          252  +  static struct {
          253  +     char *zName;
          254  +     Tcl_ObjCmdProc *xProc;
          255  +     void *clientData;
          256  +  } aObjCmd[] = {
          257  +     { "register_schemapool_module", register_schemapool_module, 0 },
          258  +  };
          259  +  int i;
          260  +  for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){
          261  +    Tcl_CreateObjCommand(interp, aObjCmd[i].zName, 
          262  +        aObjCmd[i].xProc, aObjCmd[i].clientData, 0);
          263  +  }
          264  +  return TCL_OK;
          265  +}
          266  +

Changes to src/test_tclsh.c.

    73     73     extern int Sqlitetest_demovfs_Init(Tcl_Interp *);
    74     74     extern int Sqlitetest_func_Init(Tcl_Interp*);
    75     75     extern int Sqlitetest_hexio_Init(Tcl_Interp*);
    76     76     extern int Sqlitetest_init_Init(Tcl_Interp*);
    77     77     extern int Sqlitetest_malloc_Init(Tcl_Interp*);
    78     78     extern int Sqlitetest_mutex_Init(Tcl_Interp*);
    79     79     extern int Sqlitetestschema_Init(Tcl_Interp*);
           80  +  extern int Sqlitetestschemapool_Init(Tcl_Interp*);
    80     81     extern int Sqlitetestsse_Init(Tcl_Interp*);
    81     82     extern int Sqlitetesttclvar_Init(Tcl_Interp*);
    82     83     extern int Sqlitetestfs_Init(Tcl_Interp*);
    83     84     extern int SqlitetestThread_Init(Tcl_Interp*);
    84     85     extern int SqlitetestOnefile_Init();
    85     86     extern int SqlitetestOsinst_Init(Tcl_Interp*);
    86     87     extern int Sqlitetestbackup_Init(Tcl_Interp*);
................................................................................
   142    143     Sqlitetest_demovfs_Init(interp);
   143    144     Sqlitetest_func_Init(interp);
   144    145     Sqlitetest_hexio_Init(interp);
   145    146     Sqlitetest_init_Init(interp);
   146    147     Sqlitetest_malloc_Init(interp);
   147    148     Sqlitetest_mutex_Init(interp);
   148    149     Sqlitetestschema_Init(interp);
          150  +  Sqlitetestschemapool_Init(interp);
   149    151     Sqlitetesttclvar_Init(interp);
   150    152     Sqlitetestfs_Init(interp);
   151    153     SqlitetestThread_Init(interp);
   152    154     SqlitetestOnefile_Init();
   153    155     SqlitetestOsinst_Init(interp);
   154    156     Sqlitetestbackup_Init(interp);
   155    157     Sqlitetestintarray_Init(interp);

Changes to test/reuse2.test.

    52     52     sqlite3 db test.db -reuse-schema 1
    53     53   
    54     54     do_execsql_test 2.1 {
    55     55       SELECT * FROM ft
    56     56     } {{one two three}}
    57     57   }
    58     58   
           59  +#--------------------------------------------------------------------------
           60  +reset_db
           61  +do_execsql_test 3.0 {
           62  +  CREATE TABLE t1(x INTEGER PRIMARY KEY, y UNIQUE, z);
           63  +  CREATE INDEX i1 ON t1(z);
           64  +  PRAGMA schema_version;
           65  +} {2}
           66  +
           67  +do_test 3.1 {
           68  +  sqlite3 db1 test.db -reuse-schema 1
           69  +  sqlite3 db2 test.db -reuse-schema 1
           70  +} {}
           71  +
           72  +do_execsql_test -db db1 3.2.1 { SELECT * FROM t1 }
           73  +do_execsql_test -db db2 3.2.2 { SELECT * FROM t1 }
           74  +
           75  +register_schemapool_module db
           76  +do_execsql_test 3.3 { 
           77  +  SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool;
           78  +} {nref=2 nschema=1}
           79  +
           80  +sqlite3 db3 test.db -reuse-schema 1
           81  +register_schemapool_module db3
           82  +
           83  +do_execsql_test 3.5 { 
           84  +  SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool;
           85  +} {nref=2 nschema=1}
           86  +
           87  +do_execsql_test -db db3 3.6 { 
           88  +  SELECT * FROM t1;
           89  +  SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool;
           90  +} {nref=3 nschema=1}
           91  +
           92  +do_execsql_test 3.7 { 
           93  +  CREATE TABLE t2(x);
           94  +}
           95  +
           96  +do_execsql_test 3.8 { 
           97  +  SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool;
           98  +} {nref=3 nschema=1}
           99  +
          100  +do_execsql_test -db db1 3.9.1 { SELECT * FROM t1 }
          101  +do_execsql_test 3.9.2 { 
          102  +  SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
          103  +} {nref=1 nschema=1 nref=2 nschema=1}
          104  +
          105  +do_execsql_test -db db2 3.10.1 { SELECT * FROM t1 }
          106  +do_execsql_test 3.10.2 { 
          107  +  SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
          108  +} {nref=1 nschema=1 nref=2 nschema=1}
          109  +
          110  +do_execsql_test -db db3 3.11.1 { SELECT * FROM t1 }
          111  +do_execsql_test 3.11.2 { 
          112  +  SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
          113  +} {nref=3 nschema=1}
          114  +
    59    115   finish_test
          116  +