/ Check-in [c7052428]
Login

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

Overview
Comment:Add the vtab enable/disable options to the sqlite3_db_config TCL command in the testfixture.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | disable-vtab
Files: files | file ages | folders
SHA3-256: c70524280f629056fc9d95014f599f8ece1db45cb1c8d0479ee4e8278685bcc8
User & Date: drh 2019-04-04 22:05:22
Context
2019-04-04
22:05
Add the vtab enable/disable options to the sqlite3_db_config TCL command in the testfixture. Leaf check-in: c7052428 user: drh tags: disable-vtab
20:21
Provide a DBCONFIG to enable or disable virtual tables that match a LIKE pattern. check-in: b40a4edc user: drh tags: disable-vtab
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test1.c.

  7579   7579     Tcl_Interp *interp,
  7580   7580     int objc,
  7581   7581     Tcl_Obj *CONST objv[]
  7582   7582   ){
  7583   7583     static const struct {
  7584   7584       const char *zName;
  7585   7585       int eVal;
         7586  +    int eArgType;
  7586   7587     } aSetting[] = {
  7587         -    { "FKEY",            SQLITE_DBCONFIG_ENABLE_FKEY },
  7588         -    { "TRIGGER",         SQLITE_DBCONFIG_ENABLE_TRIGGER },
  7589         -    { "FTS3_TOKENIZER",  SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER },
  7590         -    { "LOAD_EXTENSION",  SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION },
  7591         -    { "NO_CKPT_ON_CLOSE",SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE },
  7592         -    { "QPSG",            SQLITE_DBCONFIG_ENABLE_QPSG },
  7593         -    { "TRIGGER_EQP",     SQLITE_DBCONFIG_TRIGGER_EQP },
  7594         -    { "RESET_DB",        SQLITE_DBCONFIG_RESET_DATABASE },
  7595         -    { "DEFENSIVE",       SQLITE_DBCONFIG_DEFENSIVE },
         7588  +    { "FKEY",            SQLITE_DBCONFIG_ENABLE_FKEY,            0 },
         7589  +    { "TRIGGER",         SQLITE_DBCONFIG_ENABLE_TRIGGER,         0 },
         7590  +    { "FTS3_TOKENIZER",  SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER,  0 },
         7591  +    { "LOAD_EXTENSION",  SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION,  0 },
         7592  +    { "NO_CKPT_ON_CLOSE",SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE,       0 },
         7593  +    { "QPSG",            SQLITE_DBCONFIG_ENABLE_QPSG,            0 },
         7594  +    { "TRIGGER_EQP",     SQLITE_DBCONFIG_TRIGGER_EQP,            0 },
         7595  +    { "RESET_DB",        SQLITE_DBCONFIG_RESET_DATABASE,         0 },
         7596  +    { "DEFENSIVE",       SQLITE_DBCONFIG_DEFENSIVE,              0 },
         7597  +    { "WRITABLE_SCHEMA", SQLITE_DBCONFIG_WRITABLE_SCHEMA,        0 },
         7598  +    { "ENABLE_VTAB",     SQLITE_DBCONFIG_ENABLE_VTAB,            1 },
         7599  +    { "DISABLE_VTAB",    SQLITE_DBCONFIG_DISABLE_VTAB,           1 },
  7596   7600     };
  7597   7601     int i;
  7598   7602     int v;
  7599   7603     const char *zSetting;
  7600   7604     sqlite3 *db;
  7601   7605   
  7602   7606     if( objc!=4 ){
................................................................................
  7603   7607       Tcl_WrongNumArgs(interp, 1, objv, "DB SETTING VALUE");
  7604   7608       return TCL_ERROR;
  7605   7609     }
  7606   7610     if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
  7607   7611     zSetting = Tcl_GetString(objv[2]);
  7608   7612     if( sqlite3_strglob("SQLITE_*", zSetting)==0 ) zSetting += 7;
  7609   7613     if( sqlite3_strglob("DBCONFIG_*", zSetting)==0 ) zSetting += 9;
  7610         -  if( sqlite3_strglob("ENABLE_*", zSetting)==0 ) zSetting += 7;
         7614  +  if( sqlite3_strglob("ENABLE_*", zSetting)==0 && zSetting[7]!='V' ){
         7615  +    zSetting += 7;
         7616  +  }
  7611   7617     for(i=0; i<ArraySize(aSetting); i++){
  7612   7618       if( strcmp(zSetting, aSetting[i].zName)==0 ) break;
  7613   7619     }
  7614   7620     if( i>=ArraySize(aSetting) ){
  7615   7621       Tcl_SetObjResult(interp,
  7616   7622         Tcl_NewStringObj("unknown sqlite3_db_config setting", -1));
  7617   7623       return TCL_ERROR;
  7618   7624     }
  7619         -  if( Tcl_GetIntFromObj(interp, objv[3], &v) ) return TCL_ERROR;
  7620         -  sqlite3_db_config(db, aSetting[i].eVal, v, &v);
  7621         -  Tcl_SetObjResult(interp, Tcl_NewIntObj(v));
         7625  +  if( aSetting[i].eArgType==0 ){
         7626  +    if( Tcl_GetIntFromObj(interp, objv[3], &v) ) return TCL_ERROR;
         7627  +    sqlite3_db_config(db, aSetting[i].eVal, v, &v);
         7628  +    Tcl_SetObjResult(interp, Tcl_NewIntObj(v));
         7629  +  }else if( aSetting[i].eArgType==1 ){
         7630  +    sqlite3_db_config(db, aSetting[i].eVal, Tcl_GetString(objv[3]));
         7631  +  }
  7622   7632     return TCL_OK;
  7623   7633   }
  7624   7634   
  7625   7635   /*
  7626   7636   ** Change the name of the main database schema from "main" to "icecube".
  7627   7637   */
  7628   7638   static int SQLITE_TCLAPI test_dbconfig_maindbname_icecube(