/ Check-in [399e2828]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Another attempt at disabling virtual tables. This one leaks memory.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | disable-vtab
Files: files | file ages | folders
SHA1: 399e28283bca5ec20b6201adf2f09509667fa9f2
User & Date: drh 2013-06-12 02:53:39
Context
2013-06-12
02:53
Another attempt at disabling virtual tables. This one leaks memory. Closed-Leaf check-in: 399e2828 user: drh tags: disable-vtab
2013-06-11
22:41
Add the ability to disable future calls to virtual table methods by invoking sqlite3_create_module() with a NULL sqlite3_module pointer. check-in: 6b77d61a user: drh tags: disable-vtab
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vtab.c.

    85     85   
    86     86     sqlite3_mutex_enter(db->mutex);
    87     87     nName = sqlite3Strlen30(zName);
    88     88     if( (pMod = sqlite3HashFind(&db->aModule, zName, nName))!=0 ){
    89     89       if( pModule!=0 ){
    90     90         rc = SQLITE_MISUSE_BKPT;
    91     91       }else{
           92  +      int iDb;
           93  +      HashElem *j;
           94  +      VTable *pVTab;
           95  +      for(iDb=0; iDb<db->nDb; iDb++){
           96  +        Schema *pSchema = db->aDb[iDb].pSchema;
           97  +        for(j=sqliteHashFirst(&pSchema->tblHash); j; j=sqliteHashNext(j)){
           98  +          Table *pTab = (Table*)sqliteHashData(j);
           99  +          if( !IsVirtual(pTab) ) continue;
          100  +          pVTab = pTab->pVTable;
          101  +          if( pVTab->pMod!=pMod ) continue;
          102  +          pVTab->pVtab->pModule = &errorModule;
          103  +        }
          104  +      }
          105  +      if( pMod->xDestroy ) pMod->xDestroy(pMod->pAux);
    92    106         pMod->pModule = &errorModule;
    93    107       }
    94    108     }else{
    95    109       pMod = (Module *)sqlite3DbMallocRaw(db, sizeof(Module) + nName + 1);
    96    110       if( pMod ){
    97    111         Module *pDel;
    98    112         char *zCopy = (char *)(&pMod[1]);