-C Add\svoid*\sargument\sto\ssqlite3_create_module\sto\sreplace\ssqlite3_module.pAux.\s(CVS\s3251)
-D 2006-06-15T04:28:13
+C Simple\stests\sand\sfixes\sfor\swriting\sto\svirtual\stables.\s(CVS\s3252)
+D 2006-06-15T07:29:01
F Makefile.in 200f6dc376ecfd9b01e5359c4e0c10c02f649b34
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/auth.c 9ae84d2d94eb96195e04515715e08e85963e96c2
F src/btree.c ed343b3dbcbc7da9ac481ef2b98c4239fe6d9629
F src/btree.h 40055cfc09defd1146bc5b922399c035f969e56d
-F src/build.c 076619b2a5cbdbdabf5201fc45dda488d7f3cbe6
+F src/build.c a295396a6a5624604c729c3b895902c8b2b1dc5e
F src/callback.c fd9bb39f7ff6b52bad8365617abc61c720640429
F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
F src/date.c cd2bd5d1ebc6fa12d6312f69789ae5b0a2766f2e
F src/func.c 01e559893b5e43bea85135ad3e481d86c447942a
F src/hash.c 449f3d6620193aa557f5d86cbc5cc6b87702b185
F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564
-F src/insert.c bda00a0e4be8bf4e591186e710075662781293d0
+F src/insert.c eba160c6d7f2c44232ff0f168f7b047e20d6f473
F src/legacy.c fa15d505dd4e45044177ee4d1c6aeaf8c836d390
F src/loadext.c d8c7bd14e6ebc4e9f1ff269475bf63e131919449
F src/main.c 7875e8835539d4f16e8b62fad1dee9bda2091272
F src/test5.c 7162f8526affb771c4ed256826eee7bb9eca265f
F src/test6.c 60a02961ceb7b3edc25f5dc5c1ac2556622a76de
F src/test7.c 03fa8d787f6aebc6d1f72504d52f33013ad2c8e3
-F src/test8.c c8da12c237a507273dba8cb11a9f88d2252bd031
+F src/test8.c e88baeff5530fbf0d028a48fbffab71440a5b953
F src/test_async.c e3deaedd4d86a56391b81808fde9e44fbd92f1d3
F src/test_loadext.c 22065d601a18878e5542191001f0eaa5d77c0ed8
F src/test_md5.c 6c42bc0a3c0b54be34623ff77a0eec32b2fa96e3
F src/utf.c ab81ac59084ff1c07d421eb1a0a84ec809603b44
F src/util.c ca6ee72772c0f5dc04d2e0ab1973fd3b6a9bf79d
F src/vacuum.c 5b37d0f436f8e1ffacd17934e44720b38d2247f9
-F src/vdbe.c 64427e4b088ee26e9a8710724ef0a8ab5b9fd1e6
+F src/vdbe.c 4a66e5815c50e7f39454fe75d2e3f342785ea20a
F src/vdbe.h 258b5d1c0aaa72192f09ff0568ce42b383f156fa
F src/vdbeInt.h 6ccb7eaae76ebd761470f6a035501ff33aa92c20
F src/vdbeapi.c 6af0e7160af260052a7a4500464221a03dada75f
F src/vdbeaux.c de49c1943146ad97538bc2bb0bce7f2c5e5db4f2
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
F src/vdbemem.c 5f0afe3b92bb2c037f8d5d697f7c151fa50783a3
-F src/vtab.c 3b58aa4a54288efe7b1b0cddcdeac239ffa3f071
+F src/vtab.c 745148c6f83f7c146ce93cc22c6716ff05a246e2
F src/where.c d7c3cc011834882b2d58ebb3a6a1a569ead7ebd7
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/vacuum2.test 5aea8c88a65cb29f7d175296e7c819c6158d838c
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
F test/view.test 16e2774fe35e47a07ac4471b7f0bcc948b1aa6d5
-F test/vtab1.test 3897a14010f3e74cd64dd03c71e8c87248facbea
+F test/vtab1.test 89937da89d774b9174b93a327330e4ea3fb0f03a
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 9e96511f83476e489fa62a05241393a851cbac5c
-R 3b2eab4f54e22efb7b510b16ba4f9657
+P 470a3a0b20775be1226fb4d477c798d8da2d5708
+R 2a51dd29d0ce74e2c7cf789f7bd17241
U danielk1977
-Z 15129ea2cdd7a9095da7badd4764cc47
+Z 0d507f27fec3f378ea4bc0c20801973d
-470a3a0b20775be1226fb4d477c798d8da2d5708
\ No newline at end of file
+88fa510e4c684513bbb59031d034fdb5c51a6a15
\ No newline at end of file
** COMMIT
** ROLLBACK
**
-** $Id: build.c,v 1.400 2006/06/14 19:00:21 drh Exp $
+** $Id: build.c,v 1.401 2006/06/15 07:29:01 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
Table *pTab = pParse->pNewTable;
char *zType = 0;
int iCol = -1, i;
- if( pTab==0 ) goto primary_key_exit;
+ if( pTab==0 || IN_DECLARE_VTAB ) goto primary_key_exit;
if( pTab->hasPrimKey ){
sqlite3ErrorMsg(pParse,
"table \"%s\" has more than one primary key", pTab->zName);
){
#ifndef SQLITE_OMIT_CHECK
Table *pTab = pParse->pNewTable;
- if( pTab ){
+ if( pTab && !IN_DECLARE_VTAB ){
/* The CHECK expression must be duplicated so that tokens refer
** to malloced space and not the (ephemeral) text of the CREATE TABLE
** statement */
Table *p;
int i;
- if( (p = pParse->pNewTable)==0 ) return;
+ if( (p = pParse->pNewTable)==0 || IN_DECLARE_VTAB ) return;
i = p->nCol-1;
if( sqlite3LocateCollSeq(pParse, zType, nType) ){
char *z;
assert( pTo!=0 );
- if( p==0 || pParse->nErr ) goto fk_end;
+ if( p==0 || pParse->nErr || IN_DECLARE_VTAB ) goto fk_end;
if( pFromCol==0 ){
int iCol = p->nCol-1;
if( iCol<0 ) goto fk_end;
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
-** $Id: insert.c,v 1.166 2006/06/14 19:00:21 drh Exp $
+** $Id: insert.c,v 1.167 2006/06/15 07:29:01 danielk1977 Exp $
*/
#include "sqliteInt.h"
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE
if( IsVirtual(pTab) ){
- sqlite3VdbeOp3(v, OP_VUpdate, 0, pTab->nCol+1,
+ sqlite3VdbeOp3(v, OP_VUpdate, 0, pTab->nCol+2,
(const char*)pTab->pVtab, P3_VTAB);
}else
#endif
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test8.c,v 1.20 2006/06/15 04:28:13 danielk1977 Exp $
+** $Id: test8.c,v 1.21 2006/06/15 07:29:01 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
rc = sqlite3_prepare(db, zDelete, -1, &pStmt, 0);
assert( rc!=SQLITE_OK || pStmt );
if( rc==SQLITE_OK ){
+ sqlite3_bind_value(pStmt, 1, apData[0]);
sqlite3_step(pStmt);
rc = sqlite3_finalize(pStmt);
}
for(ii=0; ii<pVtab->nCol && zInsert && zValues; ii++){
char *zNew = sqlite3_mprintf("%s, %Q", zInsert, pVtab->aCol[ii]);
- sqliteFree(zInsert);
+ sqlite3_free(zInsert);
zInsert = zNew;
zNew = sqlite3_mprintf("%s, ?", zValues);
- sqliteFree(zValues);
+ sqlite3_free(zValues);
zValues = zNew;
}
}
}
- sqliteFree(zValues);
- sqliteFree(zInsert);
- sqliteFree(zQuery);
+ sqlite3_free(zValues);
+ sqlite3_free(zInsert);
+ sqlite3_free(zQuery);
if( rc==SQLITE_OK && (!zValues || !zInsert || !zQuery) ){
+ sqlite3FailedMalloc();
rc = SQLITE_NOMEM;
}
}
** 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.560 2006/06/14 19:00:22 drh Exp $
+** $Id: vdbe.c,v 1.561 2006/06/15 07:29:01 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
for(i = 0; i<nArg; i++, pX++){
apArg[i] = pX->flags ? storeTypeInfo(pX,0), pX : 0;
}
+ if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
rc = pModule->xUpdate(pVtab, nArg, apArg);
+ if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
}
popStack(&pTos, nArg);
break;
** the evaluator loop. So we can leave it out when NDEBUG is defined.
*/
#ifndef NDEBUG
- /* Sanity checking on the top element of the stack */
- if( pTos>=p->aStack ){
+ /* Sanity checking on the top element of the stack. If the previous
+ ** instruction was VNoChange, then the flags field of the top
+ ** of the stack is set to 0. This is technically invalid for a memory
+ ** cell, so avoid calling MemSanity() in this case.
+ */
+ if( pTos>=p->aStack && pTos->flags ){
sqlite3VdbeMemSanity(pTos);
}
assert( pc>=-1 && pc<p->nOp );
*************************************************************************
** This file contains code used to help implement virtual tables.
**
-** $Id: vtab.c,v 1.12 2006/06/15 04:28:13 danielk1977 Exp $
+** $Id: vtab.c,v 1.13 2006/06/15 07:29:01 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE
#include "sqliteInt.h"
}
/* If we are rereading the sqlite_master table create the in-memory
- ** record of the table.
- **
- ** TODO: If the module is already registered, should we call xConnect()
- ** here, or should it wait until the table is first referenced? Maybe
- ** it's better to be lazy here, in case xConnect() is expensive to call
- ** and the schema is reparsed a number of times.
+ ** record of the table. If the module has already been registered,
+ ** also call the xConnect method here.
*/
else {
Table *pOld;
# This file implements regression tests for SQLite library. The
# focus of this file is creating and dropping virtual tables.
#
-# $Id: vtab1.test,v 1.15 2006/06/14 22:07:11 drh Exp $
+# $Id: vtab1.test,v 1.16 2006/06/15 07:29:01 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# in that file for the special behaviour of the Tcl $echo_module variable.
#
# TODO:
-#
-# * How to test the sqlite3_index_constraint_usage.omit field? Or
-# sqlite3_index_info.orderByConsumed?
+# * How to test the sqlite3_index_constraint_usage.omit field?
+# * vtab1-5.*
+# *
#
} [list xBestIndex {SELECT rowid, * FROM 'treal'} \
xFilter {SELECT rowid, * FROM 'treal'} ]
+execsql {
+ DROP TABLE t1;
+ DROP TABLE treal;
+}
+
+#----------------------------------------------------------------------
+# Test cases vtab1-6 test INSERT, UPDATE and DELETE operations
+# on virtual tables.
+do_test vtab1-6-1 {
+ execsql { SELECT sql FROM sqlite_master }
+} {}
+do_test vtab1-6-2 {
+ execsql {
+ CREATE TABLE treal(a PRIMARY KEY, b, c);
+ CREATE VIRTUAL TABLE techo USING echo(treal);
+ SELECT name FROM sqlite_master WHERE type = 'table';
+ }
+} {treal techo}
+do_test vtab1-6-3 {
+ execsql {
+ INSERT INTO techo VALUES(1, 2, 3);
+ SELECT * FROM techo;
+ }
+} {1 2 3}
+do_test vtab1-6-4 {
+ execsql {
+ UPDATE techo SET a = 5;
+ SELECT * FROM techo;
+ }
+} {5 2 3}
+do_test vtab1-6-5 {
+ execsql {
+ DELETE FROM techo;
+ SELECT * FROM techo;
+ }
+} {}
+# check_echo_table vtab1-6.3 treal techo
+
finish_test
+