diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/test8.c | 12 | ||||
-rw-r--r-- | src/vtab.c | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/test8.c b/src/test8.c index 77fe96eda..ca04dc9c7 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.29 2006/06/21 13:21:51 danielk1977 Exp $ +** $Id: test8.c,v 1.30 2006/06/21 16:02:43 danielk1977 Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -194,12 +194,12 @@ static int echoDeclareVtab( ){ int rc = SQLITE_OK; - if( argc==3 ){ + if( argc==4 ){ 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[2], -1, 0); + sqlite3_bind_text(pStmt, 1, argv[3], -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[2], &pVtab->aIndex); + rc = getIndexArray(db, argv[3], &pVtab->aIndex); } if( rc==SQLITE_OK ){ - rc = getColumnNames(db, argv[2], &pVtab->aCol, &pVtab->nCol); + rc = getColumnNames(db, argv[3], &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[2]); + pVtab->zTableName = sqlite3MPrintf("%s", argv[3]); for(i=0; i<argc; i++){ appendToEchoModule(pVtab->interp, argv[i]); } diff --git a/src/vtab.c b/src/vtab.c index 9d0766a0c..576ffa123 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.19 2006/06/21 13:21:51 danielk1977 Exp $ +** $Id: vtab.c,v 1.20 2006/06/21 16:02:43 danielk1977 Exp $ */ #ifndef SQLITE_OMIT_VIRTUALTABLE #include "sqliteInt.h" @@ -92,18 +92,20 @@ 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; if( pTable==0 || pParse->nErr ) return; assert( 0==pTable->pIndex ); + iDb = sqlite3SchemaToIndex(pParse->db, pTable->pSchema); + assert( iDb>=0 ); + pTable->isVirtual = 1; pTable->nModuleArg = 0; addModuleArgument(pTable, sqlite3NameFromToken(pModuleName)); - zTab = sqlite3NameFromToken((pName2&&pName2->z)?pName2:pName1); - addModuleArgument(pTable, zTab); + addModuleArgument(pTable, sqlite3StrDup(pParse->db->aDb[iDb].zName)); + addModuleArgument(pTable, sqlite3StrDup(pTable->zName)); pParse->sNameToken.n = pModuleName->z + pModuleName->n - pName1->z; #ifndef SQLITE_OMIT_AUTHORIZATION @@ -112,8 +114,6 @@ void sqlite3VtabBeginParse( ** sqlite_master table, has already been made by sqlite3StartTable(). ** The second call, to obtain permission to create the table, is made now. */ - iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pDummy); - assert( iDb>=0 ); if( sqlite3AuthCheck(pParse, SQLITE_CREATE_VTABLE, pTable->zName, pTable->azModuleArg[0], pParse->db->aDb[iDb].zName) ){ |