1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Incremental work on parsing/storing and invoking the xCreate callback for virtual tables. (CVS 3212)

FossilOrigin-Name: 8ffbab79d5a76dea0f87cf551d5b6ad4f0fab337
This commit is contained in:
danielk1977
2006-06-12 06:09:17 +00:00
parent b9bb7c187e
commit 78efaba10e
8 changed files with 120 additions and 43 deletions

View File

@@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
** $Id: test8.c,v 1.1 2006/06/11 23:41:56 drh Exp $
** $Id: test8.c,v 1.2 2006/06/12 06:09:19 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@@ -21,6 +21,15 @@
#include <stdlib.h>
#include <string.h>
/*
** Global Tcl variable $echo_module is a list. This routine appends
** the string element zArg to that list in interpreter interp.
*/
static void appendToEchoModule(const sqlite3_module *pModule, const char *zArg){
int flags = (TCL_APPEND_VALUE | TCL_LIST_ELEMENT | TCL_GLOBAL_ONLY);
Tcl_SetVar((Tcl_Interp *)(pModule->pAux), "echo_module", zArg, flags);
}
/* Methods for the echo module */
static int echoCreate(
sqlite3 *db,
@@ -32,11 +41,11 @@ static int echoCreate(
Tcl_Interp *interp = pModule->pAux;
*ppVtab = pModule->pAux;
Tcl_SetVar(interp, "echo_module", "xCreate", TCL_GLOBAL_ONLY);
appendToEchoModule(pModule, "xCreate");
for(i=0; i<argc; i++){
Tcl_SetVar(interp, "echo_module", argv[i],
TCL_APPEND_VALUE | TCL_LIST_ELEMENT | TCL_GLOBAL_ONLY);
appendToEchoModule(pModule, argv[i]);
}
return 0;
}
static int echoConnect(
@@ -74,12 +83,12 @@ static int echoDestroy(sqlite3_vtab *pVtab){
** variables.
*/
static sqlite3_module echoModule = {
0,
"echo",
0,
0, /* iVersion */
"echo", /* zName */
0, /* pAux */
echoCreate,
echoConnect,
0,
0, /* xBestIndex */
echoDisconnect,
echoDestroy,
};