A few more test cases to improve coverage of virtual table module related code. (CVS 3292)
FossilOrigin-Name: 255aa9121a2ef4fec7fa5523e52969acc96f4b40
This commit is contained in:
parent
5017dc387d
commit
65fd59f731
26
manifest
26
manifest
@ -1,5 +1,5 @@
|
||||
C Add\stests\sto\simprove\scoverage\sof\svtab.c.\s(CVS\s3291)
|
||||
D 2006-06-24T09:34:23
|
||||
C A\sfew\smore\stest\scases\sto\simprove\scoverage\sof\svirtual\stable\smodule\srelated\scode.\s(CVS\s3292)
|
||||
D 2006-06-24T11:51:33
|
||||
F Makefile.in f839b470345d3cb4b0644068474623fe2464b5d3
|
||||
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
@ -43,13 +43,13 @@ F src/date.c cd2bd5d1ebc6fa12d6312f69789ae5b0a2766f2e
|
||||
F src/delete.c 804384761144fe1a5035b99f4bd7d706976831bd
|
||||
F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
|
||||
F src/expr.c 78b521337d628b1fd9d87b12dbbe771247aab585
|
||||
F src/func.c a8a52723878b38ad275513b81260c29980332504
|
||||
F src/func.c f357a81bcdd83684cb198a8ad96be1c21e29f85c
|
||||
F src/hash.c 449f3d6620193aa557f5d86cbc5cc6b87702b185
|
||||
F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564
|
||||
F src/insert.c 63f01d3f4e0ba7ed171934a24aece2191824faec
|
||||
F src/legacy.c fa15d505dd4e45044177ee4d1c6aeaf8c836d390
|
||||
F src/loadext.c b08c5f5a57b78afd8cd0dd1677e98519e18db56f
|
||||
F src/main.c efdd186a443ec8015d0fa6049a031df667f3efd2
|
||||
F src/main.c b71877c9c3cd491417fc7d4bbc785ddab411034c
|
||||
F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
|
||||
F src/os.c 59f05de8c5777c34876607114a2fbe55ae578235
|
||||
F src/os.h ac2ccb4f48902c1611a7e1f171eb81d17e3b8eb2
|
||||
@ -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 3e0d66d6b82bd2dda88031788a9169e322b3bf5f
|
||||
F src/test8.c 257b310d5e113abde281124363b2c2bbec2fe8bf
|
||||
F src/test_async.c e3deaedd4d86a56391b81808fde9e44fbd92f1d3
|
||||
F src/test_loadext.c 22065d601a18878e5542191001f0eaa5d77c0ed8
|
||||
F src/test_md5.c 6c42bc0a3c0b54be34623ff77a0eec32b2fa96e3
|
||||
@ -93,19 +93,19 @@ F src/test_server.c a6460daed0b92ecbc2531b6dc73717470e7a648c
|
||||
F src/test_tclvar.c c52f67fbe06d32804af2ba9a2d7aadfc15f5910c
|
||||
F src/tokenize.c 7b448440dfd6e984d6bef7ac7fc60f1d26eaf8e7
|
||||
F src/trigger.c 0fc40125820409a6274834a6e04ad804d96e2793
|
||||
F src/update.c 686b13db8b28a129a2407aaffc8b7588d1104e0b
|
||||
F src/update.c e3f5b7e9e1008e809248ea98bc76844f9a610f7a
|
||||
F src/utf.c ab81ac59084ff1c07d421eb1a0a84ec809603b44
|
||||
F src/util.c ca6ee72772c0f5dc04d2e0ab1973fd3b6a9bf79d
|
||||
F src/vacuum.c 5b37d0f436f8e1ffacd17934e44720b38d2247f9
|
||||
F src/vdbe.c 294e2f35fbd81f5b1e4bd918d2d0bb38313d4b11
|
||||
F src/vdbe.c 77679f2e01cb7bbd5087dca96c79116b66119a8f
|
||||
F src/vdbe.h 258b5d1c0aaa72192f09ff0568ce42b383f156fa
|
||||
F src/vdbeInt.h 37d74cc5651547d76c11682c67286bdf4099b54b
|
||||
F src/vdbeapi.c 6af0e7160af260052a7a4500464221a03dada75f
|
||||
F src/vdbeaux.c 1144cee0a5644c26f63e7fa34574dcd9349ac799
|
||||
F src/vdbeaux.c bac87915260c99081ebe824a3b12c3c3f1b2bc73
|
||||
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
|
||||
F src/vdbemem.c 5f0afe3b92bb2c037f8d5d697f7c151fa50783a3
|
||||
F src/vtab.c 1eaa23c1a52c96927076c196c5b19752efd02111
|
||||
F src/where.c 6175449f1ff97a5bfea4068a35c050456c632e89
|
||||
F src/where.c 8ba6fa490be2d39ff8208a387816d3c61172a400
|
||||
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
|
||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||
F test/all.test 5df90d015ca63fcef2a4b62c24f7316b66c4bfd4
|
||||
@ -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 566632d6c0e722222679228e4cb5bca72411a9cb
|
||||
F test/vtab1.test d78c94f5ebe6947f1509280a533ac1ffe7a84dba
|
||||
F test/vtab2.test e57f9865368df26ef5eb8bc630962d82086f174b
|
||||
F test/vtab3.test f38d6d7d19f08bffdadce4d5b8cba078f8118587
|
||||
F test/vtab4.test 4b4293341443839ef6dc02f8d9e614702a6c67ff
|
||||
@ -373,7 +373,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
||||
P 4630e11d9a697a7fa29a0a1bbca91da4ad2bde7b
|
||||
R c24a599dff967aa04649cf25f3993ffe
|
||||
P 0c5f4ee39cb76747cf01398867fed2c7ae3edc84
|
||||
R 2d3154b85b2d1db6b9e65d6433ce4721
|
||||
U danielk1977
|
||||
Z 795fb524dae0f40446874bdb9f8a49ca
|
||||
Z c6c7a990fc60a21156c29c57e99dddc4
|
||||
|
@ -1 +1 @@
|
||||
0c5f4ee39cb76747cf01398867fed2c7ae3edc84
|
||||
255aa9121a2ef4fec7fa5523e52969acc96f4b40
|
@ -16,7 +16,7 @@
|
||||
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
|
||||
** All other code has file scope.
|
||||
**
|
||||
** $Id: func.c,v 1.131 2006/06/17 14:12:48 drh Exp $
|
||||
** $Id: func.c,v 1.132 2006/06/24 11:51:33 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@ -681,13 +681,13 @@ static void soundexFunc(sqlite3_context *context, int argc, sqlite3_value **argv
|
||||
** A function that loads a shared-library extension then returns NULL.
|
||||
*/
|
||||
static void loadExt(sqlite3_context *context, int argc, sqlite3_value **argv){
|
||||
const char *zFile = sqlite3_value_text(argv[0]);
|
||||
const char *zFile = (const char *)sqlite3_value_text(argv[0]);
|
||||
const char *zProc = 0;
|
||||
sqlite3 *db = sqlite3_user_data(context);
|
||||
char *zErrMsg = 0;
|
||||
|
||||
if( argc==2 ){
|
||||
zProc = sqlite3_value_text(argv[1]);
|
||||
zProc = (const char *)sqlite3_value_text(argv[1]);
|
||||
}
|
||||
if( sqlite3_load_extension(db, zFile, zProc, &zErrMsg) ){
|
||||
sqlite3_result_error(context, zErrMsg, -1);
|
||||
|
@ -14,7 +14,7 @@
|
||||
** other files are for internal use by SQLite and should not be
|
||||
** accessed by users of the library.
|
||||
**
|
||||
** $Id: main.c,v 1.347 2006/06/23 11:34:55 danielk1977 Exp $
|
||||
** $Id: main.c,v 1.348 2006/06/24 11:51:33 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@ -474,6 +474,7 @@ int sqlite3CreateFunc(
|
||||
p->xStep = xStep;
|
||||
p->xFinalize = xFinal;
|
||||
p->pUserData = pUserData;
|
||||
p->nArg = nArg;
|
||||
}
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
16
src/test8.c
16
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.36 2006/06/24 09:34:23 danielk1977 Exp $
|
||||
** $Id: test8.c,v 1.37 2006/06/24 11:51:34 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "tcl.h"
|
||||
@ -189,7 +189,7 @@ static int getIndexArray(
|
||||
** corresponding entry in aIndex[] to 1.
|
||||
*/
|
||||
while( pStmt && sqlite3_step(pStmt)==SQLITE_ROW ){
|
||||
const char *zIdx = sqlite3_column_text(pStmt, 1);
|
||||
const char *zIdx = (const char *)sqlite3_column_text(pStmt, 1);
|
||||
sqlite3_stmt *pStmt2 = 0;
|
||||
zSql = sqlite3MPrintf("PRAGMA index_info(%s)", zIdx);
|
||||
if( !zSql ){
|
||||
@ -268,7 +268,7 @@ static int echoDeclareVtab(
|
||||
-1, &pStmt, 0);
|
||||
sqlite3_bind_text(pStmt, 1, argv[3], -1, 0);
|
||||
if( sqlite3_step(pStmt)==SQLITE_ROW ){
|
||||
const char *zCreateTable = sqlite3_column_text(pStmt, 0);
|
||||
const char *zCreateTable = (const char *)sqlite3_column_text(pStmt, 0);
|
||||
sqlite3_declare_vtab(db, zCreateTable);
|
||||
rc = sqlite3_finalize(pStmt);
|
||||
} else {
|
||||
@ -542,7 +542,7 @@ static int echoFilter(
|
||||
appendToEchoModule(pVtab->interp, "xFilter");
|
||||
appendToEchoModule(pVtab->interp, idxStr);
|
||||
for(i=0; i<argc; i++){
|
||||
appendToEchoModule(pVtab->interp, sqlite3_value_text(argv[i]));
|
||||
appendToEchoModule(pVtab->interp, (const char*)sqlite3_value_text(argv[i]));
|
||||
}
|
||||
|
||||
sqlite3_finalize(pCur->pStmt);
|
||||
@ -695,8 +695,12 @@ static int echoBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
|
||||
** the ORDER BY clause.
|
||||
*/
|
||||
if( pIdxInfo->nOrderBy==1 && pVtab->aIndex[pIdxInfo->aOrderBy->iColumn] ){
|
||||
char *zCol = pVtab->aCol[pIdxInfo->aOrderBy->iColumn];
|
||||
int iCol = pIdxInfo->aOrderBy->iColumn;
|
||||
char *zCol = pVtab->aCol[iCol];
|
||||
char *zDir = pIdxInfo->aOrderBy->desc?"DESC":"ASC";
|
||||
if( iCol<0 ){
|
||||
zCol = "rowid";
|
||||
}
|
||||
zNew = sqlite3_mprintf(" ORDER BY %s %s", zCol, zDir);
|
||||
string_concat(&zQuery, zNew, 1);
|
||||
pIdxInfo->orderByConsumed = 1;
|
||||
@ -965,7 +969,7 @@ static int declare_vtab(
|
||||
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
|
||||
rc = sqlite3_declare_vtab(db, Tcl_GetString(objv[2]));
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_SetResult(interp, sqlite3_errmsg(db), TCL_VOLATILE);
|
||||
Tcl_SetResult(interp, (char *)sqlite3_errmsg(db), TCL_VOLATILE);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
|
@ -12,7 +12,7 @@
|
||||
** This file contains C code routines that are called by the parser
|
||||
** to handle UPDATE statements.
|
||||
**
|
||||
** $Id: update.c,v 1.131 2006/06/19 03:05:10 danielk1977 Exp $
|
||||
** $Id: update.c,v 1.132 2006/06/24 11:51:34 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@ -571,10 +571,9 @@ static void updateVirtualTable(
|
||||
if( pRowid ){
|
||||
pEList = sqlite3ExprListAppend(pEList, sqlite3ExprDup(pRowid), 0);
|
||||
}
|
||||
assert( pTab->iPKey<0 );
|
||||
for(i=0; i<pTab->nCol; i++){
|
||||
if( i==pTab->iPKey ){
|
||||
pExpr = sqlite3Expr(TK_NULL, 0, 0, 0);
|
||||
}else if( aXRef[i]>=0 ){
|
||||
if( aXRef[i]>=0 ){
|
||||
pExpr = sqlite3ExprDup(pChanges->a[aXRef[i]].pExpr);
|
||||
}else{
|
||||
pExpr = sqlite3CreateIdExpr(pTab->aCol[i].zName);
|
||||
|
@ -43,7 +43,7 @@
|
||||
** in this file for details. If in doubt, do not deviate from existing
|
||||
** commenting and indentation practices when changing or adding code.
|
||||
**
|
||||
** $Id: vdbe.c,v 1.568 2006/06/23 14:32:08 danielk1977 Exp $
|
||||
** $Id: vdbe.c,v 1.569 2006/06/24 11:51:34 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@ -4548,9 +4548,9 @@ case OP_TableLock: { /* no-push */
|
||||
#endif /* SQLITE_OMIT_SHARED_CACHE */
|
||||
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
/* Opcode: VCreate P1 * P3
|
||||
/* Opcode: VBegin * * P3
|
||||
**
|
||||
** P3 is the name of a virtual table in database P1. Call the xCreate method
|
||||
** P3 a pointer to an sqlite3_vtab structure. Call the xBegin method
|
||||
** for that table.
|
||||
*/
|
||||
case OP_VBegin: { /* no-push */
|
||||
|
@ -261,10 +261,6 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs, int *pMaxStack){
|
||||
if( pOp->p1==SQLITE_CONSTRAINT && pOp->p2==OE_Abort ){
|
||||
doesStatementRollback = 1;
|
||||
}
|
||||
}else if( opcode==OP_IdxInsert ){
|
||||
if( pOp->p2 ){
|
||||
doesStatementRollback = 1;
|
||||
}
|
||||
}else if( opcode==OP_Statement ){
|
||||
hasStatementBegin = 1;
|
||||
}else if( opcode==OP_VFilter ){
|
||||
@ -1384,7 +1380,8 @@ int sqlite3VdbeHalt(Vdbe *p){
|
||||
}
|
||||
}
|
||||
|
||||
if( p->pc>=0 ){
|
||||
/* We have successfully halted and closed the VM. Record this fact. */
|
||||
if( p->pc>=0 ){
|
||||
db->activeVdbeCnt--;
|
||||
}
|
||||
p->magic = VDBE_MAGIC_HALT;
|
||||
|
@ -16,7 +16,7 @@
|
||||
** so is applicable. Because this module is responsible for selecting
|
||||
** indices, you might also think of this module as the "query optimizer".
|
||||
**
|
||||
** $Id: where.c,v 1.222 2006/06/23 08:05:31 danielk1977 Exp $
|
||||
** $Id: where.c,v 1.223 2006/06/24 11:51:35 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@ -1900,7 +1900,7 @@ WhereInfo *sqlite3WhereBegin(
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
else if( pLevel->pIdxInfo ){
|
||||
sqlite3_index_info *pIdxInfo = pLevel->pIdxInfo;
|
||||
zMsg = sqlite3MPrintf("%z VIRTUAL TABLE INDEX %d:%s",
|
||||
zMsg = sqlite3MPrintf("%z VIRTUAL TABLE INDEX %d:%s", zMsg,
|
||||
pIdxInfo->idxNum, pIdxInfo->idxStr);
|
||||
}
|
||||
#endif
|
||||
|
@ -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.32 2006/06/24 09:34:24 danielk1977 Exp $
|
||||
# $Id: vtab1.test,v 1.33 2006/06/24 11:51:35 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -803,6 +803,35 @@ do_test vtab1.10-3 {
|
||||
INSERT INTO e VALUES(1, 2, 3);
|
||||
}
|
||||
} {1 {SQL logic error or missing database}}
|
||||
do_test vtab1.10-4 {
|
||||
catch {execsql {
|
||||
EXPLAIN SELECT * FROM e WHERE rowid = 2;
|
||||
EXPLAIN QUERY PLAN SELECT * FROM e WHERE rowid = 2 ORDER BY rowid;
|
||||
}}
|
||||
} {0}
|
||||
|
||||
do_test vtab1.10-5 {
|
||||
set echo_module ""
|
||||
execsql {
|
||||
SELECT * FROM e WHERE rowid||'' MATCH 'pattern';
|
||||
}
|
||||
set echo_module
|
||||
} [list \
|
||||
xBestIndex {SELECT rowid, * FROM 'r'} \
|
||||
xFilter {SELECT rowid, * FROM 'r'} \
|
||||
]
|
||||
proc match_func {args} {return ""}
|
||||
do_test vtab1.10-6 {
|
||||
set echo_module ""
|
||||
db function match match_func
|
||||
execsql {
|
||||
SELECT * FROM e WHERE match('pattern', rowid, 'pattern2');
|
||||
}
|
||||
set echo_module
|
||||
} [list \
|
||||
xBestIndex {SELECT rowid, * FROM 'r'} \
|
||||
xFilter {SELECT rowid, * FROM 'r'} \
|
||||
]
|
||||
|
||||
finish_test
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user