Ensure whitespace specified as part of a virtual table constructor argument is correctly passed to the constructor function. (CVS 3290)

FossilOrigin-Name: 4630e11d9a697a7fa29a0a1bbca91da4ad2bde7b
This commit is contained in:
danielk1977 2006-06-24 08:51:05 +00:00
parent cc013f891c
commit 33b3933c15
6 changed files with 41 additions and 41 deletions

@ -1,5 +1,5 @@
C Clean\sup\sand\sclarify\scode\sin\stest8.c.\s(CVS\s3289) C Ensure\swhitespace\sspecified\sas\spart\sof\sa\svirtual\stable\sconstructor\sargument\sis\scorrectly\spassed\sto\sthe\sconstructor\sfunction.\s(CVS\s3290)
D 2006-06-24T06:36:11 D 2006-06-24T08:51:05
F Makefile.in f839b470345d3cb4b0644068474623fe2464b5d3 F Makefile.in f839b470345d3cb4b0644068474623fe2464b5d3
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -74,7 +74,7 @@ F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
F src/shell.c ad73192b30a338a58fe81183d4a5d5a1d4e51d36 F src/shell.c ad73192b30a338a58fe81183d4a5d5a1d4e51d36
F src/sqlite.h.in 698928d10c9960e14c008a9dfcbb1d785fc1d039 F src/sqlite.h.in 698928d10c9960e14c008a9dfcbb1d785fc1d039
F src/sqlite3ext.h e334107f6cad0d00c0414e04189742a45ce916b1 F src/sqlite3ext.h e334107f6cad0d00c0414e04189742a45ce916b1
F src/sqliteInt.h 83920044668752bc05fde6176e5dea30851cdce0 F src/sqliteInt.h 474a098e2fe94758275b5186b9fc484683994db8
F src/table.c f64ec4fbfe333f8df925bc6ba494f55e05b0e75e F src/table.c f64ec4fbfe333f8df925bc6ba494f55e05b0e75e
F src/tclsqlite.c 32d9e0147077f2e2c127c5f214fb3fe03ef97d18 F src/tclsqlite.c 32d9e0147077f2e2c127c5f214fb3fe03ef97d18
F src/test1.c 233d5c83d11f34aa1c02eb72011ba9a30b72e078 F src/test1.c 233d5c83d11f34aa1c02eb72011ba9a30b72e078
@ -91,7 +91,7 @@ F src/test_md5.c 6c42bc0a3c0b54be34623ff77a0eec32b2fa96e3
F src/test_schema.c 5aeddd60a60c3070de4c5bfa4f5c333c7769109c F src/test_schema.c 5aeddd60a60c3070de4c5bfa4f5c333c7769109c
F src/test_server.c a6460daed0b92ecbc2531b6dc73717470e7a648c F src/test_server.c a6460daed0b92ecbc2531b6dc73717470e7a648c
F src/test_tclvar.c c52f67fbe06d32804af2ba9a2d7aadfc15f5910c F src/test_tclvar.c c52f67fbe06d32804af2ba9a2d7aadfc15f5910c
F src/tokenize.c 6ebcafa6622839968dda4418a7b6945f277a128f F src/tokenize.c 7b448440dfd6e984d6bef7ac7fc60f1d26eaf8e7
F src/trigger.c 0fc40125820409a6274834a6e04ad804d96e2793 F src/trigger.c 0fc40125820409a6274834a6e04ad804d96e2793
F src/update.c 686b13db8b28a129a2407aaffc8b7588d1104e0b F src/update.c 686b13db8b28a129a2407aaffc8b7588d1104e0b
F src/utf.c ab81ac59084ff1c07d421eb1a0a84ec809603b44 F src/utf.c ab81ac59084ff1c07d421eb1a0a84ec809603b44
@ -104,7 +104,7 @@ F src/vdbeapi.c 6af0e7160af260052a7a4500464221a03dada75f
F src/vdbeaux.c 1144cee0a5644c26f63e7fa34574dcd9349ac799 F src/vdbeaux.c 1144cee0a5644c26f63e7fa34574dcd9349ac799
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5 F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
F src/vdbemem.c 5f0afe3b92bb2c037f8d5d697f7c151fa50783a3 F src/vdbemem.c 5f0afe3b92bb2c037f8d5d697f7c151fa50783a3
F src/vtab.c fd7e62d6efa403a7aa082a0e9535e5677669cabb F src/vtab.c 1f3d6758eabffa381080b540fbf5ffd2b3b208db
F src/where.c 6175449f1ff97a5bfea4068a35c050456c632e89 F src/where.c 6175449f1ff97a5bfea4068a35c050456c632e89
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42 F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
@ -291,7 +291,7 @@ F test/vacuum.test 37f998b841cb335397c26d9bbc3457182af2565f
F test/vacuum2.test 5aea8c88a65cb29f7d175296e7c819c6158d838c F test/vacuum2.test 5aea8c88a65cb29f7d175296e7c819c6158d838c
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102 F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
F test/view.test 16e2774fe35e47a07ac4471b7f0bcc948b1aa6d5 F test/view.test 16e2774fe35e47a07ac4471b7f0bcc948b1aa6d5
F test/vtab1.test 55c7415e8b6c05a648c57434b97dcd709bec4e53 F test/vtab1.test 1513060e02136c9ba0a83c201698de7c5846f7e6
F test/vtab2.test e57f9865368df26ef5eb8bc630962d82086f174b F test/vtab2.test e57f9865368df26ef5eb8bc630962d82086f174b
F test/vtab3.test f38d6d7d19f08bffdadce4d5b8cba078f8118587 F test/vtab3.test f38d6d7d19f08bffdadce4d5b8cba078f8118587
F test/vtab4.test 4b4293341443839ef6dc02f8d9e614702a6c67ff F test/vtab4.test 4b4293341443839ef6dc02f8d9e614702a6c67ff
@ -373,7 +373,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 0534f6e15b84560124c3f1abd05f2967d10261c4 P 4acf7594a6c47142e7112d2cd9766a563401879b
R 28bdb392366e183c1a405e5b76b10720 R beecc5e611a3a30bf373ae1be7ae7d60
U danielk1977 U danielk1977
Z baad93a642a5a5dec8ca0ab524eb163c Z 14efa5deb3b9156b894cf23e7d8a3299

@ -1 +1 @@
4acf7594a6c47142e7112d2cd9766a563401879b 4630e11d9a697a7fa29a0a1bbca91da4ad2bde7b

@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** Internal interface definitions for SQLite. ** Internal interface definitions for SQLite.
** **
** @(#) $Id: sqliteInt.h,v 1.511 2006/06/23 08:05:19 danielk1977 Exp $ ** @(#) $Id: sqliteInt.h,v 1.512 2006/06/24 08:51:05 danielk1977 Exp $
*/ */
#ifndef _SQLITEINT_H_ #ifndef _SQLITEINT_H_
#define _SQLITEINT_H_ #define _SQLITEINT_H_
@ -1307,9 +1307,7 @@ struct Parse {
TriggerStack *trigStack; /* Trigger actions being coded */ TriggerStack *trigStack; /* Trigger actions being coded */
const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */ const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */
#ifndef SQLITE_OMIT_VIRTUALTABLE #ifndef SQLITE_OMIT_VIRTUALTABLE
int nArgAlloc; /* Number of bytes allocated for zArg[] */ Token sArg; /* Complete text of a module argument */
int nArgUsed; /* Number of bytes of zArg[] used so far */
char *zArg; /* Complete text of a module argument */
u8 declareVtab; /* True if inside sqlite3_declare_vtab() */ u8 declareVtab; /* True if inside sqlite3_declare_vtab() */
Table *pVirtualLock; /* Require virtual table lock on this table */ Table *pVirtualLock; /* Require virtual table lock on this table */
#endif #endif

@ -15,7 +15,7 @@
** individual tokens and sends those tokens one-by-one over to the ** individual tokens and sends those tokens one-by-one over to the
** parser for analysis. ** parser for analysis.
** **
** $Id: tokenize.c,v 1.120 2006/06/12 11:24:37 danielk1977 Exp $ ** $Id: tokenize.c,v 1.121 2006/06/24 08:51:05 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" #include "os.h"
@ -484,10 +484,6 @@ abort_parse:
} }
#endif #endif
#ifndef SQLITE_OMIT_VIRTUALTABLE
sqliteFree(pParse->zArg);
#endif
if( !IN_DECLARE_VTAB ){ if( !IN_DECLARE_VTAB ){
/* If the pParse->declareVtab flag is set, do not delete any table /* If the pParse->declareVtab flag is set, do not delete any table
** structure built up in pParse->pNewTable. The calling code (see vtab.c) ** structure built up in pParse->pNewTable. The calling code (see vtab.c)

@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** This file contains code used to help implement virtual tables. ** This file contains code used to help implement virtual tables.
** **
** $Id: vtab.c,v 1.22 2006/06/23 11:34:55 danielk1977 Exp $ ** $Id: vtab.c,v 1.23 2006/06/24 08:51:05 danielk1977 Exp $
*/ */
#ifndef SQLITE_OMIT_VIRTUALTABLE #ifndef SQLITE_OMIT_VIRTUALTABLE
#include "sqliteInt.h" #include "sqliteInt.h"
@ -138,10 +138,11 @@ void sqlite3VtabBeginParse(
** virtual table currently under construction in pParse->pTable. ** virtual table currently under construction in pParse->pTable.
*/ */
static void addArgumentToVtab(Parse *pParse){ static void addArgumentToVtab(Parse *pParse){
if( pParse->nArgUsed && pParse->pNewTable ){ if( pParse->sArg.z && pParse->pNewTable ){
addModuleArgument(pParse->pNewTable, sqliteStrDup(pParse->zArg)); char *z = pParse->sArg.z;
int n = pParse->sArg.n;
addModuleArgument(pParse->pNewTable, sqliteStrNDup(z, n));
} }
pParse->nArgUsed = 0;
} }
/* /*
@ -155,9 +156,7 @@ void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){
Module *pMod = 0; Module *pMod = 0;
addArgumentToVtab(pParse); addArgumentToVtab(pParse);
sqliteFree(pParse->zArg); pParse->sArg.z = 0;
pParse->zArg = 0;
pParse->nArgAlloc = 0;
/* Lookup the module name. */ /* Lookup the module name. */
pTab = pParse->pNewTable; pTab = pParse->pNewTable;
@ -242,7 +241,8 @@ void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){
*/ */
void sqlite3VtabArgInit(Parse *pParse){ void sqlite3VtabArgInit(Parse *pParse){
addArgumentToVtab(pParse); addArgumentToVtab(pParse);
pParse->nArgUsed = 0; pParse->sArg.z = 0;
pParse->sArg.n = 0;
} }
/* /*
@ -250,20 +250,14 @@ void sqlite3VtabArgInit(Parse *pParse){
** in an argument to the module name in a CREATE VIRTUAL TABLE statement. ** in an argument to the module name in a CREATE VIRTUAL TABLE statement.
*/ */
void sqlite3VtabArgExtend(Parse *pParse, Token *p){ void sqlite3VtabArgExtend(Parse *pParse, Token *p){
if( pParse->nArgUsed + p->n + 2 >= pParse->nArgAlloc ){ Token *pArg = &pParse->sArg;
pParse->nArgAlloc = pParse->nArgAlloc*2 + p->n + 200; if( pArg->z==0 ){
pParse->zArg = sqliteRealloc(pParse->zArg, pParse->nArgAlloc); pArg->z = p->z;
if( pParse->zArg==0 ){ pArg->n = p->n;
pParse->nArgAlloc = 0; }else{
return; assert(pArg->z < p->z);
} pArg->n = (p->z + p->n - pArg->z);
} }
if( pParse->nArgUsed ){
pParse->zArg[pParse->nArgUsed++] = ' ';
}
memcpy(&pParse->zArg[pParse->nArgUsed], p->z, p->n);
pParse->nArgUsed += p->n;
pParse->zArg[pParse->nArgUsed] = 0;
} }
/* /*

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this file is creating and dropping virtual tables. # focus of this file is creating and dropping virtual tables.
# #
# $Id: vtab1.test,v 1.30 2006/06/23 14:32:09 danielk1977 Exp $ # $Id: vtab1.test,v 1.31 2006/06/24 08:51:05 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -763,5 +763,17 @@ do_test vtab1.9-2 {
} }
} {r} } {r}
do_test vtab1.9-3 {
set echo_module ""
execsql {
CREATE VIRTUAL TABLE e USING echo(r, e_log, virtual 1 2 3 varchar(32));
}
set echo_module
} [list \
xCreate echo main e r e_log {virtual 1 2 3 varchar(32)} \
xSync echo(r) \
xCommit echo(r) \
]
finish_test finish_test