aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test8.c12
-rw-r--r--src/vtab.c5
2 files changed, 10 insertions, 7 deletions
diff --git a/src/test8.c b/src/test8.c
index 70f1ebb75..77fe96eda 100644
--- a/src/test8.c
+++ b/src/test8.c
@@ -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]);
}
diff --git a/src/vtab.c b/src/vtab.c
index 9f56cb45e..9d0766a0c 100644
--- a/src/vtab.c
+++ b/src/vtab.c
@@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to help implement virtual tables.
**
-** $Id: vtab.c,v 1.18 2006/06/17 11:30:32 danielk1977 Exp $
+** $Id: vtab.c,v 1.19 2006/06/21 13:21:51 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE
#include "sqliteInt.h"
@@ -92,6 +92,7 @@ void sqlite3VtabBeginParse(
int iDb; /* The database the table is being created in */
Table *pTable; /* The new virtual table */
Token *pDummy; /* Dummy arg for sqlite3TwoPartName() */
+ char *zTab;
sqlite3StartTable(pParse, pName1, pName2, 0, 0, 1, 0);
pTable = pParse->pNewTable;
@@ -101,6 +102,8 @@ void sqlite3VtabBeginParse(
pTable->isVirtual = 1;
pTable->nModuleArg = 0;
addModuleArgument(pTable, sqlite3NameFromToken(pModuleName));
+ zTab = sqlite3NameFromToken((pName2&&pName2->z)?pName2:pName1);
+ addModuleArgument(pTable, zTab);
pParse->sNameToken.n = pModuleName->z + pModuleName->n - pName1->z;
#ifndef SQLITE_OMIT_AUTHORIZATION