| OLD | NEW |
| 1 /* | 1 /* |
| 2 ** 2006 June 10 | 2 ** 2006 June 10 |
| 3 ** | 3 ** |
| 4 ** The author disclaims copyright to this source code. In place of | 4 ** The author disclaims copyright to this source code. In place of |
| 5 ** a legal notice, here is a blessing: | 5 ** a legal notice, here is a blessing: |
| 6 ** | 6 ** |
| 7 ** May you do good and not evil. | 7 ** May you do good and not evil. |
| 8 ** May you find forgiveness for yourself and forgive others. | 8 ** May you find forgiveness for yourself and forgive others. |
| 9 ** May you share freely, never taking more than you give. | 9 ** May you share freely, never taking more than you give. |
| 10 ** | 10 ** |
| 11 ************************************************************************* | 11 ************************************************************************* |
| 12 ** Code for testing the virtual table interfaces. This code | 12 ** Code for testing the virtual table interfaces. This code |
| 13 ** is not included in the SQLite library. It is used for automated | 13 ** is not included in the SQLite library. It is used for automated |
| 14 ** testing of the SQLite library. | 14 ** testing of the SQLite library. |
| 15 ** | |
| 16 ** $Id: test8.c,v 1.78 2009/04/29 11:50:54 danielk1977 Exp $ | |
| 17 */ | 15 */ |
| 18 #include "sqliteInt.h" | 16 #include "sqliteInt.h" |
| 19 #include "tcl.h" | 17 #include "tcl.h" |
| 20 #include <stdlib.h> | 18 #include <stdlib.h> |
| 21 #include <string.h> | 19 #include <string.h> |
| 22 | 20 |
| 23 #ifndef SQLITE_OMIT_VIRTUALTABLE | 21 #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 24 | 22 |
| 25 typedef struct echo_vtab echo_vtab; | 23 typedef struct echo_vtab echo_vtab; |
| 26 typedef struct echo_cursor echo_cursor; | 24 typedef struct echo_cursor echo_cursor; |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 ** from within an xDestroy method call. | 478 ** from within an xDestroy method call. |
| 481 */ | 479 */ |
| 482 if( rc==SQLITE_OK && argc==5 ){ | 480 if( rc==SQLITE_OK && argc==5 ){ |
| 483 char *zSql; | 481 char *zSql; |
| 484 echo_vtab *pVtab = *(echo_vtab **)ppVtab; | 482 echo_vtab *pVtab = *(echo_vtab **)ppVtab; |
| 485 pVtab->zLogName = sqlite3_mprintf("%s", argv[4]); | 483 pVtab->zLogName = sqlite3_mprintf("%s", argv[4]); |
| 486 zSql = sqlite3_mprintf("CREATE TABLE %Q(logmsg)", pVtab->zLogName); | 484 zSql = sqlite3_mprintf("CREATE TABLE %Q(logmsg)", pVtab->zLogName); |
| 487 rc = sqlite3_exec(db, zSql, 0, 0, 0); | 485 rc = sqlite3_exec(db, zSql, 0, 0, 0); |
| 488 sqlite3_free(zSql); | 486 sqlite3_free(zSql); |
| 489 if( rc!=SQLITE_OK ){ | 487 if( rc!=SQLITE_OK ){ |
| 490 *pzErr = sqlite3DbStrDup(0, sqlite3_errmsg(db)); | 488 *pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db)); |
| 491 } | 489 } |
| 492 } | 490 } |
| 493 | 491 |
| 494 if( *ppVtab && rc!=SQLITE_OK ){ | 492 if( *ppVtab && rc!=SQLITE_OK ){ |
| 495 echoDestructor(*ppVtab); | 493 echoDestructor(*ppVtab); |
| 496 *ppVtab = 0; | 494 *ppVtab = 0; |
| 497 } | 495 } |
| 498 | 496 |
| 499 if( rc==SQLITE_OK ){ | 497 if( rc==SQLITE_OK ){ |
| 500 (*(echo_vtab**)ppVtab)->inTransaction = 1; | 498 (*(echo_vtab**)ppVtab)->inTransaction = 1; |
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1334 { "sqlite3_declare_vtab", declare_vtab, 0 }, | 1332 { "sqlite3_declare_vtab", declare_vtab, 0 }, |
| 1335 }; | 1333 }; |
| 1336 int i; | 1334 int i; |
| 1337 for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){ | 1335 for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){ |
| 1338 Tcl_CreateObjCommand(interp, aObjCmd[i].zName, | 1336 Tcl_CreateObjCommand(interp, aObjCmd[i].zName, |
| 1339 aObjCmd[i].xProc, aObjCmd[i].clientData, 0); | 1337 aObjCmd[i].xProc, aObjCmd[i].clientData, 0); |
| 1340 } | 1338 } |
| 1341 #endif | 1339 #endif |
| 1342 return TCL_OK; | 1340 return TCL_OK; |
| 1343 } | 1341 } |
| OLD | NEW |