/ Check-in [fb15f545]
Login

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

Overview
Comment:Add a test for [48f29963] that does not depend on FTS.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fb15f5458eb3e17ce9795c09bffe1224fea0eecd
User & Date: dan 2011-10-29 15:29:43
Context
2011-10-29
19:25
Update fkey_malloc.test to account for the sqlite3_errmsg() related changes in [8f88cc4e61] and [dcb7879347]. check-in: 5b82ec6f user: dan tags: trunk
15:29
Add a test for [48f29963] that does not depend on FTS. check-in: fb15f545 user: dan tags: trunk
12:42
Fix some code formatting in sqlite3Ext.h to avoid lines longer than 80 characters. check-in: 3ec20c30 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test8.c.

  1227   1227       );
  1228   1228       rc = sqlite3_exec(p->db, zSql, 0, 0, 0);
  1229   1229       sqlite3_free(zSql);
  1230   1230     }
  1231   1231   
  1232   1232     return rc;
  1233   1233   }
         1234  +
         1235  +static int echoSavepoint(sqlite3_vtab *pVTab, int iSavepoint){
         1236  +  assert( pVTab );
         1237  +  return SQLITE_OK;
         1238  +}
         1239  +
         1240  +static int echoRelease(sqlite3_vtab *pVTab, int iSavepoint){
         1241  +  assert( pVTab );
         1242  +  return SQLITE_OK;
         1243  +}
         1244  +
         1245  +static int echoRollbackTo(sqlite3_vtab *pVTab, int iSavepoint){
         1246  +  assert( pVTab );
         1247  +  return SQLITE_OK;
         1248  +}
  1234   1249   
  1235   1250   /*
  1236   1251   ** A virtual table module that merely "echos" the contents of another
  1237   1252   ** table (like an SQL VIEW).
  1238   1253   */
  1239   1254   static sqlite3_module echoModule = {
  1240         -  0,                         /* iVersion */
         1255  +  1,                         /* iVersion */
         1256  +  echoCreate,
         1257  +  echoConnect,
         1258  +  echoBestIndex,
         1259  +  echoDisconnect, 
         1260  +  echoDestroy,
         1261  +  echoOpen,                  /* xOpen - open a cursor */
         1262  +  echoClose,                 /* xClose - close a cursor */
         1263  +  echoFilter,                /* xFilter - configure scan constraints */
         1264  +  echoNext,                  /* xNext - advance a cursor */
         1265  +  echoEof,                   /* xEof */
         1266  +  echoColumn,                /* xColumn - read data */
         1267  +  echoRowid,                 /* xRowid - read data */
         1268  +  echoUpdate,                /* xUpdate - write data */
         1269  +  echoBegin,                 /* xBegin - begin transaction */
         1270  +  echoSync,                  /* xSync - sync transaction */
         1271  +  echoCommit,                /* xCommit - commit transaction */
         1272  +  echoRollback,              /* xRollback - rollback transaction */
         1273  +  echoFindFunction,          /* xFindFunction - function overloading */
         1274  +  echoRename                 /* xRename - rename the table */
         1275  +};
         1276  +
         1277  +static sqlite3_module echoModuleV2 = {
         1278  +  2,                         /* iVersion */
  1241   1279     echoCreate,
  1242   1280     echoConnect,
  1243   1281     echoBestIndex,
  1244   1282     echoDisconnect, 
  1245   1283     echoDestroy,
  1246   1284     echoOpen,                  /* xOpen - open a cursor */
  1247   1285     echoClose,                 /* xClose - close a cursor */
................................................................................
  1253   1291     echoUpdate,                /* xUpdate - write data */
  1254   1292     echoBegin,                 /* xBegin - begin transaction */
  1255   1293     echoSync,                  /* xSync - sync transaction */
  1256   1294     echoCommit,                /* xCommit - commit transaction */
  1257   1295     echoRollback,              /* xRollback - rollback transaction */
  1258   1296     echoFindFunction,          /* xFindFunction - function overloading */
  1259   1297     echoRename,                /* xRename - rename the table */
         1298  +  echoSavepoint,
         1299  +  echoRelease,
         1300  +  echoRollbackTo
  1260   1301   };
  1261   1302   
  1262   1303   /*
  1263   1304   ** Decode a pointer to an sqlite3 object.
  1264   1305   */
  1265   1306   extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb);
  1266   1307   
................................................................................
  1280   1321     sqlite3 *db;
  1281   1322     EchoModule *pMod;
  1282   1323     if( objc!=2 ){
  1283   1324       Tcl_WrongNumArgs(interp, 1, objv, "DB");
  1284   1325       return TCL_ERROR;
  1285   1326     }
  1286   1327     if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
         1328  +
         1329  +  /* Virtual table module "echo" */
  1287   1330     pMod = sqlite3_malloc(sizeof(EchoModule));
  1288   1331     pMod->interp = interp;
  1289   1332     sqlite3_create_module_v2(db, "echo", &echoModule, (void*)pMod, moduleDestroy);
         1333  +
         1334  +  /* Virtual table module "echo_v2" */
         1335  +  pMod = sqlite3_malloc(sizeof(EchoModule));
         1336  +  pMod->interp = interp;
         1337  +  sqlite3_create_module_v2(db, "echo_v2", 
         1338  +      &echoModuleV2, (void*)pMod, moduleDestroy
         1339  +  );
  1290   1340     return TCL_OK;
  1291   1341   }
  1292   1342   
  1293   1343   /*
  1294   1344   ** Tcl interface to sqlite3_declare_vtab, invoked as follows from Tcl:
  1295   1345   **
  1296   1346   ** sqlite3_declare_vtab DB SQL

Changes to test/vtab1.test.

  1173   1173       PRAGMA writable_schema = 1;
  1174   1174       INSERT INTO sqlite_master VALUES(
  1175   1175         'table', 't3', 't3', 0, 'INSERT INTO "%s%s" VALUES(1)'
  1176   1176       );
  1177   1177     }
  1178   1178     catchsql { CREATE VIRTUAL TABLE t4 USING echo(t3); }
  1179   1179   } {1 {vtable constructor failed: t4}}
         1180  +
         1181  +# This test verifies that ticket 48f29963 is fixed.
         1182  +#
         1183  +do_test vtab1-17.1 {
         1184  +  execsql { 
         1185  +    CREATE TABLE t5(a, b);
         1186  +    CREATE VIRTUAL TABLE e5 USING echo_v2(t5);
         1187  +    BEGIN;
         1188  +      INSERT INTO e5 VALUES(1, 2);
         1189  +      DROP TABLE e5;
         1190  +      SAVEPOINT one;
         1191  +      ROLLBACK TO one;
         1192  +    COMMIT;
         1193  +  }
         1194  +} {}
  1180   1195   
  1181   1196   unset -nocomplain echo_module_begin_fail
  1182   1197   finish_test