SQLite

Check-in [399e28283b]
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
Timelines: family | ancestors | disable-vtab
Files: files | file ages | folders
SHA1: 399e28283bca5ec20b6201adf2f09509667fa9f2
User & Date: drh 2013-06-12 02:53:39.933
Context
2013-06-12
02:53
Another attempt at disabling virtual tables. This one leaks memory. (Closed-Leaf check-in: 399e28283b 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: 6b77d61adb user: drh tags: disable-vtab)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vtab.c.
85
86
87
88
89
90
91














92
93
94
95
96
97
98

  sqlite3_mutex_enter(db->mutex);
  nName = sqlite3Strlen30(zName);
  if( (pMod = sqlite3HashFind(&db->aModule, zName, nName))!=0 ){
    if( pModule!=0 ){
      rc = SQLITE_MISUSE_BKPT;
    }else{














      pMod->pModule = &errorModule;
    }
  }else{
    pMod = (Module *)sqlite3DbMallocRaw(db, sizeof(Module) + nName + 1);
    if( pMod ){
      Module *pDel;
      char *zCopy = (char *)(&pMod[1]);







>
>
>
>
>
>
>
>
>
>
>
>
>
>







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

  sqlite3_mutex_enter(db->mutex);
  nName = sqlite3Strlen30(zName);
  if( (pMod = sqlite3HashFind(&db->aModule, zName, nName))!=0 ){
    if( pModule!=0 ){
      rc = SQLITE_MISUSE_BKPT;
    }else{
      int iDb;
      HashElem *j;
      VTable *pVTab;
      for(iDb=0; iDb<db->nDb; iDb++){
        Schema *pSchema = db->aDb[iDb].pSchema;
        for(j=sqliteHashFirst(&pSchema->tblHash); j; j=sqliteHashNext(j)){
          Table *pTab = (Table*)sqliteHashData(j);
          if( !IsVirtual(pTab) ) continue;
          pVTab = pTab->pVTable;
          if( pVTab->pMod!=pMod ) continue;
          pVTab->pVtab->pModule = &errorModule;
        }
      }
      if( pMod->xDestroy ) pMod->xDestroy(pMod->pAux);
      pMod->pModule = &errorModule;
    }
  }else{
    pMod = (Module *)sqlite3DbMallocRaw(db, sizeof(Module) + nName + 1);
    if( pMod ){
      Module *pDel;
      char *zCopy = (char *)(&pMod[1]);