/ 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 Unified Diffs Show Whitespace Changes Patch

Changes to src/test1.c.

7579
7580
7581
7582
7583
7584
7585

7586
7587
7588
7589
7590
7591
7592
7593
7594
7595



7596
7597
7598
7599
7600
7601
7602
....
7603
7604
7605
7606
7607
7608
7609
7610


7611
7612
7613
7614
7615
7616
7617
7618

7619
7620
7621



7622
7623
7624
7625
7626
7627
7628
  Tcl_Interp *interp,
  int objc,
  Tcl_Obj *CONST objv[]
){
  static const struct {
    const char *zName;
    int eVal;

  } aSetting[] = {
    { "FKEY",            SQLITE_DBCONFIG_ENABLE_FKEY },
    { "TRIGGER",         SQLITE_DBCONFIG_ENABLE_TRIGGER },
    { "FTS3_TOKENIZER",  SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER },
    { "LOAD_EXTENSION",  SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION },
    { "NO_CKPT_ON_CLOSE",SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE },
    { "QPSG",            SQLITE_DBCONFIG_ENABLE_QPSG },
    { "TRIGGER_EQP",     SQLITE_DBCONFIG_TRIGGER_EQP },
    { "RESET_DB",        SQLITE_DBCONFIG_RESET_DATABASE },
    { "DEFENSIVE",       SQLITE_DBCONFIG_DEFENSIVE },



  };
  int i;
  int v;
  const char *zSetting;
  sqlite3 *db;

  if( objc!=4 ){
................................................................................
    Tcl_WrongNumArgs(interp, 1, objv, "DB SETTING VALUE");
    return TCL_ERROR;
  }
  if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
  zSetting = Tcl_GetString(objv[2]);
  if( sqlite3_strglob("SQLITE_*", zSetting)==0 ) zSetting += 7;
  if( sqlite3_strglob("DBCONFIG_*", zSetting)==0 ) zSetting += 9;
  if( sqlite3_strglob("ENABLE_*", zSetting)==0 ) zSetting += 7;


  for(i=0; i<ArraySize(aSetting); i++){
    if( strcmp(zSetting, aSetting[i].zName)==0 ) break;
  }
  if( i>=ArraySize(aSetting) ){
    Tcl_SetObjResult(interp,
      Tcl_NewStringObj("unknown sqlite3_db_config setting", -1));
    return TCL_ERROR;
  }

  if( Tcl_GetIntFromObj(interp, objv[3], &v) ) return TCL_ERROR;
  sqlite3_db_config(db, aSetting[i].eVal, v, &v);
  Tcl_SetObjResult(interp, Tcl_NewIntObj(v));



  return TCL_OK;
}

/*
** Change the name of the main database schema from "main" to "icecube".
*/
static int SQLITE_TCLAPI test_dbconfig_maindbname_icecube(







>

|
|
|
|
|
|
|
|
|
>
>
>







 







|
>
>








>



>
>
>







7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
....
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
  Tcl_Interp *interp,
  int objc,
  Tcl_Obj *CONST objv[]
){
  static const struct {
    const char *zName;
    int eVal;
    int eArgType;
  } aSetting[] = {
    { "FKEY",            SQLITE_DBCONFIG_ENABLE_FKEY,            0 },
    { "TRIGGER",         SQLITE_DBCONFIG_ENABLE_TRIGGER,         0 },
    { "FTS3_TOKENIZER",  SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER,  0 },
    { "LOAD_EXTENSION",  SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION,  0 },
    { "NO_CKPT_ON_CLOSE",SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE,       0 },
    { "QPSG",            SQLITE_DBCONFIG_ENABLE_QPSG,            0 },
    { "TRIGGER_EQP",     SQLITE_DBCONFIG_TRIGGER_EQP,            0 },
    { "RESET_DB",        SQLITE_DBCONFIG_RESET_DATABASE,         0 },
    { "DEFENSIVE",       SQLITE_DBCONFIG_DEFENSIVE,              0 },
    { "WRITABLE_SCHEMA", SQLITE_DBCONFIG_WRITABLE_SCHEMA,        0 },
    { "ENABLE_VTAB",     SQLITE_DBCONFIG_ENABLE_VTAB,            1 },
    { "DISABLE_VTAB",    SQLITE_DBCONFIG_DISABLE_VTAB,           1 },
  };
  int i;
  int v;
  const char *zSetting;
  sqlite3 *db;

  if( objc!=4 ){
................................................................................
    Tcl_WrongNumArgs(interp, 1, objv, "DB SETTING VALUE");
    return TCL_ERROR;
  }
  if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
  zSetting = Tcl_GetString(objv[2]);
  if( sqlite3_strglob("SQLITE_*", zSetting)==0 ) zSetting += 7;
  if( sqlite3_strglob("DBCONFIG_*", zSetting)==0 ) zSetting += 9;
  if( sqlite3_strglob("ENABLE_*", zSetting)==0 && zSetting[7]!='V' ){
    zSetting += 7;
  }
  for(i=0; i<ArraySize(aSetting); i++){
    if( strcmp(zSetting, aSetting[i].zName)==0 ) break;
  }
  if( i>=ArraySize(aSetting) ){
    Tcl_SetObjResult(interp,
      Tcl_NewStringObj("unknown sqlite3_db_config setting", -1));
    return TCL_ERROR;
  }
  if( aSetting[i].eArgType==0 ){
    if( Tcl_GetIntFromObj(interp, objv[3], &v) ) return TCL_ERROR;
    sqlite3_db_config(db, aSetting[i].eVal, v, &v);
    Tcl_SetObjResult(interp, Tcl_NewIntObj(v));
  }else if( aSetting[i].eArgType==1 ){
    sqlite3_db_config(db, aSetting[i].eVal, Tcl_GetString(objv[3]));
  }
  return TCL_OK;
}

/*
** Change the name of the main database schema from "main" to "icecube".
*/
static int SQLITE_TCLAPI test_dbconfig_maindbname_icecube(