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

@ -1,5 +1,5 @@
C Add\stests\sto\smake\ssure\saltering\sor\sadding\san\sindex\sto\sa\svirtual\stable\sis\sprohibited.\s(CVS\s3280)
D 2006-06-21T12:36:25
C Add\sthe\stable\sname\sto\sthe\sarguments\spassed\sto\sthe\svirtual\stable\smethods\sxCreate/xConnect.\s(CVS\s3281)
D 2006-06-21T13:21:51
F Makefile.in f839b470345d3cb4b0644068474623fe2464b5d3
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -84,7 +84,7 @@ F src/test4.c 8b784cd82de158a2317cb4ac4bc86f91ad315e25
F src/test5.c 7162f8526affb771c4ed256826eee7bb9eca265f
F src/test6.c 60a02961ceb7b3edc25f5dc5c1ac2556622a76de
F src/test7.c 03fa8d787f6aebc6d1f72504d52f33013ad2c8e3
F src/test8.c 03563ba045b2c46dc98284144d3e0052d9ea08ba
F src/test8.c 58134b50229c6703cef5b2a48470502dc3de5c60
F src/test_async.c e3deaedd4d86a56391b81808fde9e44fbd92f1d3
F src/test_loadext.c 22065d601a18878e5542191001f0eaa5d77c0ed8
F src/test_md5.c 6c42bc0a3c0b54be34623ff77a0eec32b2fa96e3
@ -104,7 +104,7 @@ F src/vdbeapi.c 6af0e7160af260052a7a4500464221a03dada75f
F src/vdbeaux.c 2e4cb97e6d1612c0e108d68e038a7cd612bceb72
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
F src/vdbemem.c 5f0afe3b92bb2c037f8d5d697f7c151fa50783a3
F src/vtab.c 8fbf4a8f718229d2158826ed6e440f2d32a07c80
F src/vtab.c e65a7fd62d8dd71350c6289afc8e3e9bc8fe3138
F src/where.c 0a13357175678d51a218326bca389f20bb41e38b
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
@ -291,7 +291,7 @@ F test/vacuum.test 37f998b841cb335397c26d9bbc3457182af2565f
F test/vacuum2.test 5aea8c88a65cb29f7d175296e7c819c6158d838c
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
F test/view.test 16e2774fe35e47a07ac4471b7f0bcc948b1aa6d5
F test/vtab1.test a4a613abd0dc3d89e6c3850c8fdaf21b3235900b
F test/vtab1.test 482d1a593cf63a730ab4144d53f44b0b9a26d7e4
F test/vtab2.test e57f9865368df26ef5eb8bc630962d82086f174b
F test/vtab3.test f38d6d7d19f08bffdadce4d5b8cba078f8118587
F test/vtab4.test 4b4293341443839ef6dc02f8d9e614702a6c67ff
@ -372,7 +372,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P bcef48c54dd01cf089db16192e670cb0717988ac
R f99945aeb4a525d461aed39d7b881f31
P 6c3e8852ffbaf5ab52ffdf7ed3767fa1d4fd5882
R b9b6a3a1cf617e6ce2ebea89762bbd86
U danielk1977
Z 1883f2f742b7c696a0a5c5e4faa758d4
Z db7ca11b12957a39dfe19b08d7995731

View File

@ -1 +1 @@
6c3e8852ffbaf5ab52ffdf7ed3767fa1d4fd5882
7dc36d1c798aa8b30b88a528fc9e69b342f278c7

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]);
}

View File

@ -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

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is creating and dropping virtual tables.
#
# $Id: vtab1.test,v 1.26 2006/06/21 07:34:11 danielk1977 Exp $
# $Id: vtab1.test,v 1.27 2006/06/21 13:21:51 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -239,7 +239,7 @@ do_test vtab1.2.7 {
]
do_test vtab1.2.8 {
set echo_module
} {xConnect echo template}
} {xConnect echo t1 template}
# Drop table t1. This should cause the xDestroy (but not xDisconnect) method
# to be invoked.
@ -281,7 +281,7 @@ do_test vtab1-3.1 {
CREATE VIRTUAL TABLE t1 USING echo(treal);
}
set echo_module
} [list xCreate echo treal \
} [list xCreate echo t1 treal \
xSync echo(treal) \
xCommit echo(treal) \
]