-C Make\sthe\slast_insert_rowid\smethod\sin\sthe\sTCL\sinterface\swork\swith\n64-bit\srowids.\s(CVS\s3283)
-D 2006-06-21T19:30:34
+C Test\sthe\shandling\sof\serrors\sin\svirtual\stable\smethods.\s(CVS\s3284)
+D 2006-06-22T09:53:49
F Makefile.in f839b470345d3cb4b0644068474623fe2464b5d3
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/insert.c 63f01d3f4e0ba7ed171934a24aece2191824faec
F src/legacy.c fa15d505dd4e45044177ee4d1c6aeaf8c836d390
F src/loadext.c b08c5f5a57b78afd8cd0dd1677e98519e18db56f
-F src/main.c 7101314a365120465bf5e308caaf518b7776430c
+F src/main.c 645a02be048d60ead33e53e10e0b84fb002bf7ca
F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
F src/os.c 59f05de8c5777c34876607114a2fbe55ae578235
F src/os.h ac2ccb4f48902c1611a7e1f171eb81d17e3b8eb2
F src/select.c 380fa06c99ae01050c0054c4b1db91e9f1d8322d
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
F src/shell.c ad73192b30a338a58fe81183d4a5d5a1d4e51d36
-F src/sqlite.h.in 7855b46387f3f6ac1925301f450df9cbd7a1269b
+F src/sqlite.h.in b8c6139b3af13a2c361a8a5aeabb28aa3eef1ae1
F src/sqlite3ext.h e334107f6cad0d00c0414e04189742a45ce916b1
F src/sqliteInt.h d79b031593462dfcbc8c122a5f698a00e6b124fa
F src/table.c f64ec4fbfe333f8df925bc6ba494f55e05b0e75e
F src/test5.c 7162f8526affb771c4ed256826eee7bb9eca265f
F src/test6.c 60a02961ceb7b3edc25f5dc5c1ac2556622a76de
F src/test7.c 03fa8d787f6aebc6d1f72504d52f33013ad2c8e3
-F src/test8.c d584dc94c0a62afb21bca311d2958defc6684236
+F src/test8.c b8014836e18b9f42d0ac5c190efcc8318694c14e
F src/test_async.c e3deaedd4d86a56391b81808fde9e44fbd92f1d3
F src/test_loadext.c 22065d601a18878e5542191001f0eaa5d77c0ed8
F src/test_md5.c 6c42bc0a3c0b54be34623ff77a0eec32b2fa96e3
-F src/test_schema.c 741238e40158a4ff88e450bdcf60836570283a71
+F src/test_schema.c 5aeddd60a60c3070de4c5bfa4f5c333c7769109c
F src/test_server.c a6460daed0b92ecbc2531b6dc73717470e7a648c
F src/test_tclvar.c c52f67fbe06d32804af2ba9a2d7aadfc15f5910c
F src/tokenize.c 6ebcafa6622839968dda4418a7b6945f277a128f
F src/utf.c ab81ac59084ff1c07d421eb1a0a84ec809603b44
F src/util.c ca6ee72772c0f5dc04d2e0ab1973fd3b6a9bf79d
F src/vacuum.c 5b37d0f436f8e1ffacd17934e44720b38d2247f9
-F src/vdbe.c 4b55bfea65855201b8f2e07102ad70ea1d21b7f6
+F src/vdbe.c 2c36e0badc0bcc14f099e95ec84470c479fbd399
F src/vdbe.h 258b5d1c0aaa72192f09ff0568ce42b383f156fa
F src/vdbeInt.h 6ccb7eaae76ebd761470f6a035501ff33aa92c20
F src/vdbeapi.c 6af0e7160af260052a7a4500464221a03dada75f
F test/vacuum2.test 5aea8c88a65cb29f7d175296e7c819c6158d838c
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
F test/view.test 16e2774fe35e47a07ac4471b7f0bcc948b1aa6d5
-F test/vtab1.test 5bb366f18287c9b4c8af110a810c10eb713fb58b
+F test/vtab1.test 3f21d81e599afd100e60830f5f0426c1f74febda
F test/vtab2.test e57f9865368df26ef5eb8bc630962d82086f174b
F test/vtab3.test f38d6d7d19f08bffdadce4d5b8cba078f8118587
F test/vtab4.test 4b4293341443839ef6dc02f8d9e614702a6c67ff
F test/vtab5.test 9fb8f335651afe8f870011e2f68e5b00c5ad03cd
F test/vtab6.test 0b4fe07e421b2b9a334bec8781e75cbd8e230bd3
+F test/vtab_err.test 7b435152e5555ca01645cbd15864430a80c44765
F test/where.test ee7c9a6659b07e1ee61177f6e7ff71565ee2c9df
F test/where2.test a16476a5913e75cf65b38f2daa6157a6b7791394
F test/where3.test 3b5ad2c58069e12be2bd86bc5e211a82810521aa
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 2d2805785f473afc202df532df84c45e6f0dc0f1
-R d6693457ff045b088af9dc2f8803cb5d
-U drh
-Z ebff9741f160eff78cf3357f860940cd
+P d50c37975de7639627422cbed40eb03a431874d5
+R deba37635ada8fb35f1bc556c53eccea
+U danielk1977
+Z fb72a1410426354cd3d1ca1870332bcd
-d50c37975de7639627422cbed40eb03a431874d5
\ No newline at end of file
+51b729d9d9f8a60cdfb552809e4aa10012f4eb68
\ No newline at end of file
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.345 2006/06/16 16:08:55 danielk1977 Exp $
+** $Id: main.c,v 1.346 2006/06/22 09:53:49 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
db->aDb[i].inTrans = 0;
}
}
+ sqlite3VtabRollback(db);
if( db->flags&SQLITE_InternChanges ){
sqlite3ResetInternalSchema(db, 0);
}
- sqlite3VtabRollback(db);
/* If one has been configured, invoke the rollback-hook callback */
if( db->xRollbackCallback && (inTrans || !db->autoCommit) ){
** This header file defines the interface that the SQLite library
** presents to client programs.
**
-** @(#) $Id: sqlite.h.in,v 1.180 2006/06/17 09:39:56 danielk1977 Exp $
+** @(#) $Id: sqlite.h.in,v 1.181 2006/06/22 09:53:50 danielk1977 Exp $
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr,
int argc, sqlite3_value **argv);
int (*xNext)(sqlite3_vtab_cursor*);
+ int (*xEof)(sqlite3_vtab_cursor*);
int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int);
int (*xRowid)(sqlite3_vtab_cursor*, sqlite_int64 *pRowid);
int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite_int64 *);
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test8.c,v 1.30 2006/06/21 16:02:43 danielk1977 Exp $
+** $Id: test8.c,v 1.31 2006/06/22 09:53:50 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
sqlite3 *db;
char *zTableName; /* Name of the real table */
+ char *zLogName; /* Name of the log table */
int nCol; /* Number of columns in the real table */
int *aIndex; /* Array of size nCol. True if column has an index */
char **aCol; /* Array of size nCol. Column names */
){
int rc = SQLITE_OK;
- if( argc==4 ){
+ if( argc>=4 ){
sqlite3_stmt *pStmt = 0;
sqlite3_prepare(db,
"SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ?",
int argc, char **argv,
sqlite3_vtab **ppVtab
){
+ int rc = SQLITE_OK;
appendToEchoModule((Tcl_Interp *)(pAux), "xCreate");
- return echoConstructor(db, pAux, argc, argv, ppVtab);
+ rc = echoConstructor(db, pAux, argc, argv, ppVtab);
+#if 0
+ if( rc==SQLITE_OK && argc==5 ){
+ char *zSql;
+ echo_vtab *pVtab = *(echo_vtab **)ppVtab;
+ pVtab->zLogName = sqlite3MPrintf("%s", argv[4]);
+ zSql = sqlite3MPrintf("CREATE TABLE %Q(logmsg)", pVtab->zLogName);
+ rc = sqlite3_exec(db, zSql, 0, 0, 0);
+ sqliteFree(zSql);
+ }
+#endif
+ return rc;
}
static int echoConnect(
sqlite3 *db,
return echoDestructor(pVtab);
}
static int echoDestroy(sqlite3_vtab *pVtab){
+ int rc = SQLITE_OK;
+ echo_vtab *p = (echo_vtab *)pVtab;
appendToEchoModule(((echo_vtab *)pVtab)->interp, "xDestroy");
- return echoDestructor(pVtab);
+#if 0
+ if( p && p->zLogName ){
+ char *zSql;
+ zSql = sqlite3MPrintf("DROP TABLE %Q", p->zLogName);
+ rc = sqlite3_exec(p->db, zSql, 0, 0, 0);
+ sqliteFree(zSql);
+ }
+#endif
+ if( rc==SQLITE_OK ){
+ rc = echoDestructor(pVtab);
+ }
+ return rc;
}
static int echoOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){
return SQLITE_OK;
}
+/*
+** Return non-zero if the cursor does not currently point to a valid record
+** (i.e if the scan has finished), or zero otherwise.
+*/
+static int echoEof(sqlite3_vtab_cursor *cur){
+ return (((echo_cursor *)cur)->pStmt ? 0 : 1);
+}
+
static int echoNext(sqlite3_vtab_cursor *cur){
int rc;
echo_cursor *pCur = (echo_cursor *)cur;
rc = sqlite3_step(pCur->pStmt);
if( rc==SQLITE_ROW ){
- rc = 1;
- } else {
- pCur->errcode = sqlite3_finalize(pCur->pStmt);
+ rc = SQLITE_OK;
+ }else{
+ rc = sqlite3_finalize(pCur->pStmt);
pCur->pStmt = 0;
- rc = 0;
}
return rc;
if( rc==SQLITE_OK ){
ret = echoNext(pVtabCursor);
}else{
+ assert( !pCur->pStmt );
ret = 0;
pCur->errcode = rc;
}
echoClose, /* xClose - close a cursor */
echoFilter, /* xFilter - configure scan constraints */
echoNext, /* xNext - advance a cursor */
+ echoEof, /* xEof */
echoColumn, /* xColumn - read data */
echoRowid, /* xRowid - read data */
echoUpdate, /* xUpdate - write data */
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test_schema.c,v 1.5 2006/06/20 11:01:08 danielk1977 Exp $
+** $Id: test_schema.c,v 1.6 2006/06/22 09:53:50 danielk1977 Exp $
*/
/* The code in this file defines a sqlite3 virtual-table module that
return rc;
}
+static int schemaEof(sqlite3_vtab_cursor *cur){
+ schema_cursor *pCur = (schema_cursor *)cur;
+ return (pCur->pDbList ? 0 : 1);
+}
+
/*
** Advance the cursor to the next row.
*/
char *zSql = 0;
while( !pCur->pColumnList || SQLITE_ROW!=sqlite3_step(pCur->pColumnList) ){
- if( SQLITE_OK!=(rc = finalize(&pCur->pColumnList)) ) goto fail;
+ if( SQLITE_OK!=(rc = finalize(&pCur->pColumnList)) ) goto next_exit;
while( !pCur->pTableList || SQLITE_ROW!=sqlite3_step(pCur->pTableList) ){
- if( SQLITE_OK!=(rc = finalize(&pCur->pTableList)) ) goto fail;
+ if( SQLITE_OK!=(rc = finalize(&pCur->pTableList)) ) goto next_exit;
assert(pCur->pDbList);
while( SQLITE_ROW!=sqlite3_step(pCur->pDbList) ){
- if( SQLITE_OK!=(rc = finalize(&pCur->pDbList)) ) goto fail;
- return 0;
+ rc = finalize(&pCur->pDbList);
+ goto next_exit;
}
/* Set zSql to the SQL to pull the list of tables from the
}
if( !zSql ){
rc = SQLITE_NOMEM;
- goto fail;
+ goto next_exit;
}
rc = sqlite3_prepare(pVtab->db, zSql, -1, &pCur->pTableList, 0);
sqlite3_free(zSql);
- if( rc!=SQLITE_OK ) goto fail;
+ if( rc!=SQLITE_OK ) goto next_exit;
}
/* Set zSql to the SQL to the table_info pragma for the table currently
if( !zSql ){
rc = SQLITE_NOMEM;
- goto fail;
+ goto next_exit;
}
rc = sqlite3_prepare(pVtab->db, zSql, -1, &pCur->pColumnList, 0);
sqlite3_free(zSql);
- if( rc!=SQLITE_OK ) goto fail;
+ if( rc!=SQLITE_OK ) goto next_exit;
}
pCur->rowid++;
-fail:
+next_exit:
/* TODO: Handle rc */
- return 1;
+ return rc;
}
/*
schemaClose, /* xClose - close a cursor */
schemaFilter, /* xFilter - configure scan constraints */
schemaNext, /* xNext - advance a cursor */
+ schemaEof, /* xEof */
schemaColumn, /* xColumn - read data */
schemaRowid, /* xRowid - read data */
};
** 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.564 2006/06/16 21:13:22 drh Exp $
+** $Id: vdbe.c,v 1.565 2006/06/22 09:53:50 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
}
if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
- res = pModule->xFilter(pCur->pVtabCursor, pTos->i, pOp->p3, nArg, apArg);
+ rc = pModule->xFilter(pCur->pVtabCursor, pTos->i, pOp->p3, nArg, apArg);
+ if( rc==SQLITE_OK ){
+ res = pModule->xEof(pCur->pVtabCursor);
+ }
if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
- if( res==0 ){
+ if( res ){
pc = pOp->p2 - 1;
}
}
** some other method is next invoked on the save virtual table cursor.
*/
if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
- res = pModule->xNext(pCur->pVtabCursor);
+ rc = pModule->xNext(pCur->pVtabCursor);
+ if( rc==SQLITE_OK ){
+ res = pModule->xEof(pCur->pVtabCursor);
+ }
if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
- if( res ){
- /* If there is data (or an error), jump to P2 */
+ if( !res ){
+ /* If there is data, jump to P2 */
pc = pOp->p2 - 1;
}
}
# This file implements regression tests for SQLite library. The
# focus of this file is creating and dropping virtual tables.
#
-# $Id: vtab1.test,v 1.28 2006/06/21 16:02:44 danielk1977 Exp $
+# $Id: vtab1.test,v 1.29 2006/06/22 09:53:50 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
xSync echo(real_abc) \
xCommit echo(real_abc) \
]
+do_test vtab1.8-2 {
+ execsql {
+ DROP TABLE aux.e2;
+ DROP TABLE treal;
+ DROP TABLE techo;
+ DROP TABLE echo_abc;
+ DROP TABLE real_abc;
+ }
+} {}
+
+if 0 {
+ do_test vtab1.9-1 {
+ set echo_module ""
+ execsql {
+ CREATE TABLE r(a, b, c);
+ CREATE VIRTUAL TABLE e USING echo(r, e_log);
+ SELECT name FROM sqlite_master;
+ }
+ } {r e e_log}
+ do_test vtab1.9-2 {
+ explain {
+ DROP TABLE e;
+ }
+ execsql {
+ PRAGMA vdbe_trace = 1;
+ DROP TABLE e;
+ SELECT name FROM sqlite_master;
+ }
+ } {r}
+}
finish_test
--- /dev/null
+# 2006 June 10
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+#
+# $Id: vtab_err.test,v 1.1 2006/06/22 09:53:50 danielk1977 Exp $
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+ifcapable !vtab {
+ finish_test
+ return
+}
+
+do_ioerr_test vtab_err-1 -tclprep {
+ register_echo_module [sqlite3_connection_pointer db]
+} -sqlbody {
+ BEGIN;
+ CREATE TABLE r(a PRIMARY KEY, b, c);
+ CREATE VIRTUAL TABLE e USING echo(r);
+ INSERT INTO e VALUES(1, 2, 3);
+ INSERT INTO e VALUES('a', 'b', 'c');
+ UPDATE e SET c = 10;
+ DELETE FROM e WHERE a = 'a';
+ COMMIT;
+ BEGIN;
+ CREATE TABLE r2(a, b, c);
+ INSERT INTO r2 SELECT * FROM e;
+ INSERT INTO e SELECT a||'x', b, c FROM r2;
+ COMMIT;
+}
+
+
+finish_test
+