1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Add the table name to the arguments passed to the virtual table methods xCreate/xConnect. (CVS 3281)

FossilOrigin-Name: 7dc36d1c798aa8b30b88a528fc9e69b342f278c7
This commit is contained in:
danielk1977
2006-06-21 13:21:50 +00:00
parent 5ee9d6977f
commit d07e543f29
5 changed files with 22 additions and 19 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.28 2006/06/21 07:02:34 danielk1977 Exp $
** $Id: test8.c,v 1.29 2006/06/21 13:21:51 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@@ -194,12 +194,12 @@ static int echoDeclareVtab(
){
int rc = SQLITE_OK;
if( argc==2 ){
if( argc==3 ){
sqlite3_stmt *pStmt = 0;
sqlite3_prepare(db,
"SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ?",
-1, &pStmt, 0);
sqlite3_bind_text(pStmt, 1, argv[1], -1, 0);
sqlite3_bind_text(pStmt, 1, argv[2], -1, 0);
if( sqlite3_step(pStmt)==SQLITE_ROW ){
const char *zCreateTable = sqlite3_column_text(pStmt, 0);
#ifndef SQLITE_OMIT_VIRTUALTABLE
@@ -210,10 +210,10 @@ static int echoDeclareVtab(
}
sqlite3_finalize(pStmt);
if( rc==SQLITE_OK ){
rc = getIndexArray(db, argv[1], &pVtab->aIndex);
rc = getIndexArray(db, argv[2], &pVtab->aIndex);
}
if( rc==SQLITE_OK ){
rc = getColumnNames(db, argv[1], &pVtab->aCol, &pVtab->nCol);
rc = getColumnNames(db, argv[2], &pVtab->aCol, &pVtab->nCol);
}
}
@@ -245,7 +245,7 @@ static int echoConstructor(
pVtab = sqliteMalloc( sizeof(*pVtab) );
pVtab->interp = (Tcl_Interp *)pAux;
pVtab->db = db;
pVtab->zTableName = sqlite3MPrintf("%s", argv[1]);
pVtab->zTableName = sqlite3MPrintf("%s", argv[2]);
for(i=0; i<argc; i++){
appendToEchoModule(pVtab->interp, argv[i]);
}