-C The\scallback-free\sAPI\sis\snow\sworking,\sthough\smuch\smore\stesting\sis\sneed.\s(CVS\s853)
-D 2003-01-29T14:06:08
+C Better\serror\smessages\son\sconstraint\sviolations.\s\sAdditional\stests\sand\sbug\sfixes\nfor\sthe\scallback-free\sAPI.\s(CVS\s854)
+D 2003-01-29T18:46:52
F Makefile.in 6606854b1512f185b8e8c779b8d7fc2750463d64
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F src/auth.c 9c2db0bc7707f2d2e227f47e3d557b41d44ade75
F src/btree.c eb4f430b062500d7533c031097d3ff8824eca3ba
F src/btree.h 17710339f7a8f46e3c7d6d0d4648ef19c584ffda
-F src/build.c 1a4c0d71863f0aa0be7e5a2148b103c3e761c771
+F src/build.c 6e0310086b8e2deef74f0d4fb3297c4e8fcf6222
F src/delete.c cbd499f3f9297504c42e328af89bef1a2113d04c
F src/encode.c faf03741efe921755ec371cf4a6984536de00042
-F src/expr.c 382839b92cb66a34cfa71cf1d2bc8fb818226c90
+F src/expr.c 359ae28321ce78d20ef38f4fd6ee7429b100186f
F src/func.c 90c583f0b91220f7cd411a2407deaf9327245d63
F src/hash.c 4fc39feb7b7711f6495ee9f2159559bedb043e1f
F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
-F src/insert.c db954e955970795819145a3649fd2ad116a58890
-F src/main.c f1c86161875337c6421cf988bf5595eda515851a
+F src/insert.c 13c2ef8984ce0f38701a8af89e4ba7a3c86c0701
+F src/main.c 764a72e6a4f021ae1d3db7e82dab625075f4fedb
F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
F src/os.c ed27e178e0c4b71f2807da81b8851f0fadc50778
F src/os.h afa3e096213bad86845f8bdca81a9e917505e401
F src/pager.c 95f5c5c775ed47e837ce02b407d80527d93e6c43
F src/pager.h 540833e8cb826b80ce2e39aa917deee5e12db626
-F src/parse.y aea0819c07ec9c81b810039df9be9d5705b1e497
-F src/printf.c e8e9a0605602cb1a3a2dc754e0978fa9064ecee7
+F src/parse.y cdaed5009423d851708848bd279147c268e6022e
+F src/printf.c f8fd911a8738f9b2eb07aca2870473d34707055d
F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
F src/select.c 13b8e5ea8aacaf204468518aed7b054a583f2f25
F src/shell.c cbb29252f0bd7b144d1e3126e64e17e5a314f2fd
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
F src/sqlite.h.in 6f648803f2ffb9beb35cb1cfa42b323d55519171
-F src/sqliteInt.h d4d1eb361e2121d62ec320e53e32b42569b7613e
+F src/sqliteInt.h f22092ed33fea784f58bcd57b90c0babd16a0e29
F src/table.c eed2098c9b577aa17f8abe89313a9c4413f57d63
F src/tclsqlite.c 9f2c00a92338c51171ded8943bd42d77f7e69e64
-F src/test1.c 2ef543e6e49329d5254c0ad4b09586a4eaad5ed4
+F src/test1.c a24735c6e6364ccaa73ce3b106859fb325b076d9
F src/test2.c 03f05e984c8e2f2badc44644d42baf72b249096b
F src/test3.c c12ea7f1c3fbbd58904e81e6cb10ad424e6fc728
F src/threadtest.c d641a5219e718e18a1a80a50eb9bb549f451f42e
F src/trigger.c da142decd2808bc39e801f3bb1f161dbc2bd4005
F src/update.c f06afa9bf1f777d17702e0f6e33cf44c44bc4f75
F src/util.c 757875a366be838d96c09f255631596a2f558fca
-F src/vdbe.c a9dd0f68751587eeff81afb404f9f63e4ac6185a
-F src/vdbe.h 162071f1dd0b43236930712f4238c59a6a0de298
+F src/vdbe.c de4c00495ed6d3c7798153996ea174881fc29b42
+F src/vdbe.h ed43771f1dc2b994d5c484fdf2eab357c6ef0ee3
F src/where.c 5bf7f1e1d756ab3d25a18b24bb42106cb8e14d18
F test/all.test 873d30e25a41b3aa48fec5633a7ec1816e107029
F test/auth.test 95aeda24f76b6fd028bdb3d6ae1e30b153d942fe
F test/btree2.test e3b81ec33dc2f89b3e6087436dfe605b870c9080
F test/btree3.test e597fb59be2ac0ea69c62aaa2064e998e528b665
F test/btree4.test fa955a3d7a8bc91d6084b7f494f9e5d1bdfb15b6
-F test/capi2.test 158d76afd093d71b4aac860c0d12511706b1d8d0
-F test/conflict.test 0173a12a257f73bac2c9d53ad44cac9b15ea517e
-F test/copy.test 55d60a4d5ed342a0fa08b7cd07d46d43ea0d0d7f
+F test/capi2.test 21f73319ae288d874f68787b5af4bd2022e25dcb
+F test/conflict.test d7d9dbea9909c1b843f9e89c8318fdb7ca07a5e5
+F test/copy.test 73df5ed3112e858e006a8b7ddb4c9bab6a25d0fb
F test/delete.test 5821a95a66061ae09723a88938f23d10d8a881ad
F test/expr.test 290e2617b89b5c5e3bf71f19367d285102128be4
F test/fkey1.test d65c824459916249bee501532d6154ddab0b5db7
F test/index.test 2a5a1b654f50ca0768fb10ae44b72e6a776b1f18
F test/insert.test a122afb86911e77c181d912348866a5b1a61eeab
F test/insert2.test c288375a64dad3295044714f0dfed4a193cf067f
-F test/intpkey.test f3620158fd7963af1306b01047277f10ae91a30b
+F test/intpkey.test e0e283b0cbeaa97eeee183e1cdb91fa73d720866
F test/ioerr.test 57d9bffaca18b34f9e976f786eadc2591d6efc6a
F test/join.test 178b25dc3c5be6cbdd195b904e66bee62475d0bf
F test/limit.test 9f26f874bc765df5b3f5c92d26d1b12eac6d4cf9
F test/malloc.test 7ba32a9ebd3aeed52ae4aaa6d42ca37e444536fd
F test/memleak.test b4f59aa44488793b00feff2011d77d0f05b22468
F test/minmax.test 29bc5727c3e4c792d5c4745833dd4b505905819e
-F test/misc1.test 9f9e8b6f824b4c388ce3ad0cabdc873e0d22e28e
+F test/misc1.test 6d61d1282f2d1f1c184f50e0373d9ffc7d42f744
F test/misuse.test a3aa2b18a97e4c409a1fcaff5151a4dd804a0162
-F test/notnull.test b1f3e42fc475b0b5827b27b2e9b562081995ff30
+F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
F test/null.test 5c2b57307e4b6178aae825eb65ddbee01e76b0fd
F test/pager.test d3a2e2f00999f97e056822a39d5ee2fad18bf12c
F test/pragma.test 0ca0773e2559ec9715f72d90695554dc3368e8f2
F test/select6.test efb8d0c07a440441db87db2c4ade6904e1407e85
F test/sort.test 61a729023ae4ac3be9b225dc0be026fb43fec4e6
F test/subselect.test f0fea8cf9f386d416d64d152e3c65f9116d0f50f
-F test/table.test 2a94f55b39008daa79b81f37aaf7be81386ca71e
+F test/table.test 371a1fc1c470982b2f68f9732f903a5d96f949c4
F test/tableapi.test 3c80421a889e1d106df16e5800fa787f0d2914a6
F test/tclsqlite.test 2441ab135e5af85110326b3e3b057e7257c144e1
F test/temptable.test 03b7bdb7d6ce2c658ad20c94b037652c6cad34e0
F test/tester.tcl 6f603d90881bd835ea27c568a7fecaa57dce91cc
F test/trans.test 10b53c77e2cc4ad9529c15fdcb390b8d5722ea65
F test/trigger1.test ec1da76e1a9f618deb96e505f459dcf8a23f2247
-F test/trigger2.test ee346d8c612e7f847c9543058f1b89d094d27ffb
+F test/trigger2.test 592daa956dc62b19930fe673405e389a80c5764e
F test/trigger3.test 870afef7997a5b86bf3ea893ce0c2e85d6356c72
F test/trigger4.test 9a5c1406344d743020c2753ae8d6dfe6eb75f818
-F test/unique.test 572aa791327c1e8d797932263e9d67f176cfdb44
-F test/update.test 7ffb062d580a972e7870d0f51d5af3ab9bfeae08
+F test/unique.test 22a46df72a3e0a3fd1a2d39e96fb59f18448dd5f
+F test/update.test e7b224f4ed652b3d6defdd6174ebc2ccd894307a
F test/vacuum.test 059871b312eb910bbe49dafde1d01490cc2c6bbe
F test/version.test 605fd0d7e7d571370c32b12dbf395b58953de246
F test/view.test c64fa39ea57f3c2066c854290f032ad13b23b83d
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P 065fa818ffc8d7562889172acea16e4e44e773ef
-R 0f5c157d8052fdb9f4b710d54301a2ba
+P 162b259188e6967fe9c3722da26b81aab5655d83
+R 715f66b82d831caba169ad25678a9655
U drh
-Z b732b2962b2533af4ee430d0fd255a71
+Z 12bd865865cbc9da0a476fa88511badb
-162b259188e6967fe9c3722da26b81aab5655d83
\ No newline at end of file
+ccc82f1ab4539a60ee5cc2625743c5389f9ccd8e
\ No newline at end of file
** ROLLBACK
** PRAGMA
**
-** $Id: build.c,v 1.126 2003/01/28 23:13:11 drh Exp $
+** $Id: build.c,v 1.127 2003/01/29 18:46:52 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
}
rc = sqliteVdbeFinalize(v, &pParse->zErrMsg);
if( rc ) pParse->nErr++;
- sqliteVdbeDelete(v);
pParse->pVdbe = 0;
pParse->rc = rc;
if( rc ) pParse->nErr++;
}
pParse->colNamesSet = 0;
pParse->schemaVerified = 0;
+ }else if( pParse->useCallback==0 ){
+ pParse->rc = SQLITE_ERROR;
}
pParse->nTab = 0;
pParse->nMem = 0;
sqliteVdbeAddOp(v, OP_MakeIdxKey, pIndex->nColumn, 0);
if( db->file_format>=4 ) sqliteAddIdxKeyType(v, pIndex);
sqliteVdbeAddOp(v, OP_IdxPut, 1, pIndex->onError!=OE_None);
+ sqliteVdbeChangeP3(v, -1, "indexed columns are not unique", P3_STATIC);
sqliteVdbeAddOp(v, OP_Next, 2, lbl1);
sqliteVdbeResolveLabel(v, lbl2);
sqliteVdbeAddOp(v, OP_Close, 2, 0);
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
-** $Id: expr.c,v 1.86 2003/01/18 20:11:07 drh Exp $
+** $Id: expr.c,v 1.87 2003/01/29 18:46:52 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
} else {
assert( pExpr->iColumn == OE_Ignore );
sqliteVdbeAddOp(v, OP_Goto, 0, pParse->trigStack->ignoreJump);
- sqliteVdbeChangeP3(v, -1, "(IGNORE jump)", -1);
+ sqliteVdbeChangeP3(v, -1, "(IGNORE jump)", 0);
}
}
break;
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
-** $Id: insert.c,v 1.71 2003/01/13 23:27:33 drh Exp $
+** $Id: insert.c,v 1.72 2003/01/29 18:46:52 drh Exp $
*/
#include "sqliteInt.h"
case OE_Rollback:
case OE_Abort:
case OE_Fail: {
+ char *zMsg = 0;
sqliteVdbeAddOp(v, OP_Halt, SQLITE_CONSTRAINT, onError);
+ sqliteSetString(&zMsg, pTab->zName, ".", pTab->aCol[i].zName,
+ " may not be NULL", 0);
+ sqliteVdbeChangeP3(v, -1, zMsg, P3_DYNAMIC);
break;
}
case OE_Ignore: {
case OE_Abort:
case OE_Fail: {
sqliteVdbeAddOp(v, OP_Halt, SQLITE_CONSTRAINT, onError);
+ sqliteVdbeChangeP3(v, -1, "PRIMARY KEY must be unique", P3_STATIC);
break;
}
case OE_Ignore: {
case OE_Abort:
case OE_Fail: {
sqliteVdbeAddOp(v, OP_Halt, SQLITE_CONSTRAINT, onError);
+ sqliteVdbeChangeP3(v, -1, "uniqueness constraint failed", P3_STATIC);
break;
}
case OE_Ignore: {
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.111 2003/01/29 14:06:08 drh Exp $
+** $Id: main.c,v 1.112 2003/01/29 18:46:53 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
sqlite_vm *pVm, /* The virtual machine to be destroyed */
char **pzErrMsg /* OUT: Write error messages here */
){
- return sqliteVdbeFinalize((Vdbe*)pVm, pzErrMsg);
+ int rc = sqliteVdbeFinalize((Vdbe*)pVm, pzErrMsg);
+ sqliteStrRealloc(pzErrMsg);
+ return rc;
}
/*
** the parser. Lemon will also generate a header file containing
** numeric codes for all of the tokens.
**
-** @(#) $Id: parse.y,v 1.89 2003/01/28 23:13:12 drh Exp $
+** @(#) $Id: parse.y,v 1.90 2003/01/29 18:46:53 drh Exp $
*/
%token_prefix TK_
%token_type {Token}
//
cmdlist ::= ecmd.
cmdlist ::= cmdlist ecmd.
-ecmd ::= explain cmd SEMI. {sqliteExec(pParse);}
+ecmd ::= explain cmdx SEMI.
ecmd ::= SEMI.
+cmdx ::= cmd. { sqliteExec(pParse); }
explain ::= EXPLAIN. { sqliteBeginParse(pParse, 1); }
explain ::= . { sqliteBeginParse(pParse, 0); }
}
}
+/*
+** sqlite_mprintf() works like printf(), but allocations memory to hold the
+** resulting string and returns a pointer to the allocated memory. Use
+** sqliteFree() to release the memory allocated.
+*/
+char *sqliteMPrintf(const char *zFormat, ...){
+ va_list ap;
+ struct sgMprintf sMprintf;
+ char *zNew;
+ char zBuf[200];
+
+ sMprintf.nChar = 0;
+ sMprintf.nAlloc = sizeof(zBuf);
+ sMprintf.zText = zBuf;
+ sMprintf.zBase = zBuf;
+ va_start(ap,zFormat);
+ vxprintf(mout,&sMprintf,zFormat,ap);
+ va_end(ap);
+ sMprintf.zText[sMprintf.nChar] = 0;
+ return sqliteRealloc(sMprintf.zText, sMprintf.nChar+1);
+}
+
/*
** sqlite_mprintf() works like printf(), but allocations memory to hold the
** resulting string and returns a pointer to the allocated memory. Use
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.158 2003/01/29 14:06:09 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.159 2003/01/29 18:46:53 drh Exp $
*/
#include "config.h"
#include "sqlite.h"
char *sqliteStrNDup(const char*, int);
# define sqliteCheckMemory(a,b)
#endif
+char *sqliteMPrintf(const char *,...);
void sqliteSetString(char **, const char *, ...);
void sqliteSetNString(char **, ...);
void sqliteDequote(char*);
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test1.c,v 1.18 2003/01/29 14:06:09 drh Exp $
+** $Id: test1.c,v 1.19 2003/01/29 18:46:53 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
}
if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
rc = sqlite_compile(db, argv[2], &zTail, &vm, &zErr);
+ Tcl_SetVar(interp, argv[3], zTail, 0);
if( rc ){
assert( vm==0 );
sprintf(zBuf, "(%d) ", rc);
sprintf(zBuf, "%p", vm);
Tcl_AppendResult(interp, zBuf, 0);
}
- Tcl_SetVar(interp, argv[3], zTail, 0);
return TCL_OK;
}
** 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.201 2003/01/29 14:06:09 drh Exp $
+** $Id: vdbe.c,v 1.202 2003/01/29 18:46:53 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
** is the same as executing Halt.
*/
case OP_Halt: {
+ p->magic = VDBE_MAGIC_HALT;
if( pOp->p1!=SQLITE_OK ){
p->rc = pOp->p1;
p->errorAction = pOp->p2;
if( pOp->p3 ){
sqliteSetString(&p->zErrMsg, pOp->p3, 0);
}
+ return SQLITE_ERROR;
}else{
p->rc = SQLITE_OK;
+ return SQLITE_DONE;
}
- p->magic = VDBE_MAGIC_HALT;
- return SQLITE_DONE;
}
/* Opcode: Integer P1 * P3
){
rc = SQLITE_CONSTRAINT;
if( pOp->p3 && pOp->p3[0] ){
- sqliteSetString(&p->zErrMsg, "duplicate index entry: ", pOp->p3,0);
+ sqliteSetString(&p->zErrMsg, pOp->p3, 0);
}
goto abort_due_to_error;
}
** should hold the error number.
*/
abort_due_to_error:
- sqliteSetString(&p->zErrMsg, sqlite_error_string(rc), 0);
+ if( p->zErrMsg==0 ){
+ sqliteSetString(&p->zErrMsg, sqlite_error_string(rc), 0);
+ }
goto vdbe_halt;
/* Jump to here if the sqlite_interrupt() API sets the interrupt
int sqliteVdbeFinalize(Vdbe *p, char **pzErrMsg){
sqlite *db = p->db;
Btree *pBt = p->pBt;
+ int rc;
if( p->magic!=VDBE_MAGIC_RUN && p->magic!=VDBE_MAGIC_HALT ){
sqliteSetString(pzErrMsg, sqlite_error_string(SQLITE_MISUSE), 0);
}
}
#endif
- return p->rc;
+ rc = p->rc;
+ sqliteVdbeDelete(p);
+ return rc;
}
** or VDBE. The VDBE implements an abstract machine that runs a
** simple program to access and modify the underlying database.
**
-** $Id: vdbe.h,v 1.63 2003/01/29 14:06:10 drh Exp $
+** $Id: vdbe.h,v 1.64 2003/01/29 18:46:53 drh Exp $
*/
#ifndef _SQLITE_VDBE_H_
#define _SQLITE_VDBE_H_
** Allowed values of VdbeOp.p3type
*/
#define P3_NOTUSED 0 /* The P3 parameter is not used */
-#define P3_DYNAMIC 1 /* Pointer to a string obtained from sqliteMalloc() */
-#define P3_STATIC (-1) /* Pointer to a static string */
-#define P3_POINTER (-2) /* P3 is a pointer to some structure or object */
+#define P3_DYNAMIC (-1) /* Pointer to a string obtained from sqliteMalloc() */
+#define P3_STATIC (-2) /* Pointer to a static string */
+#define P3_POINTER (-3) /* P3 is a pointer to some structure or object */
/*
** The following macro converts a relative address in the p2 field
# This file implements regression tests for SQLite library. The
# focus of this script testing the callback-free C/C++ API.
#
-# $Id: capi2.test,v 1.1 2003/01/29 14:06:10 drh Exp $
+# $Id: capi2.test,v 1.2 2003/01/29 18:46:54 drh Exp $
#
set testdir [file dirname $argv0]
#
do_test capi2-1.1 {
db close
- set ::DB [sqlite db test.db]
+ set DB [sqlite db test.db]
execsql {CREATE TABLE t1(a,b,c)}
- set ::VM [sqlite_compile $::DB {SELECT name, rowid FROM sqlite_master} tail]
- set tail
+ set VM [sqlite_compile $DB {SELECT name, rowid FROM sqlite_master} TAIL]
+ set TAIL
} {}
do_test capi2-1.2 {
- sqlite_step $::VM ::N ::VALUES ::COLNAMES
+ sqlite_step $VM N VALUES COLNAMES
} {SQLITE_ROW}
do_test capi2-1.3 {
- set ::N
+ set N
} {2}
do_test capi2-1.4 {
- set ::VALUES
+ set VALUES
} {t1 1}
do_test capi2-1.5 {
- set ::COLNAMES
+ set COLNAMES
} {name rowid text INTEGER}
do_test capi2-1.6 {
- set ::N x
- set ::VALUES y
- set ::COLNAMES z
- sqlite_step $::VM ::N ::VALUES ::COLNAMES
+ set N x
+ set VALUES y
+ set COLNAMES z
+ sqlite_step $VM N VALUES COLNAMES
} {SQLITE_DONE}
do_test capi2-1.7 {
- list $::N $::VALUES $::COLNAMES
+ list $N $VALUES $COLNAMES
} {2 {} {name rowid text INTEGER}}
do_test capi2-1.8 {
- set ::N x
- set ::VALUES y
- set ::COLNAMES z
- sqlite_step $::VM ::N ::VALUES ::COLNAMES
+ set N x
+ set VALUES y
+ set COLNAMES z
+ sqlite_step $VM N VALUES COLNAMES
} {SQLITE_MISUSE}
do_test capi2-1.9 {
- list $::N $::VALUES $::COLNAMES
+ list $N $VALUES $COLNAMES
} {x y z}
do_test capi2-1.10 {
- sqlite_finalize $::VM
+ sqlite_finalize $VM
} {}
# Check to make sure that the "tail" of a multi-statement SQL script
# is returned by sqlite_compile.
#
do_test capi2-2.1 {
- set ::SQL {
+ set SQL {
SELECT name, rowid FROM sqlite_master;
SELECT name, rowid FROM sqlite_temp_master;
-- A comment at the end
}
- set ::VM [sqlite_compile $::DB $::SQL ::SQL]
- set ::SQL
+ set VM [sqlite_compile $DB $SQL SQL]
+ set SQL
} {
SELECT name, rowid FROM sqlite_temp_master;
-- A comment at the end
}
do_test capi2-2.2 {
- set r [sqlite_step $::VM n val colname]
+ set r [sqlite_step $VM n val colname]
lappend r $n $val $colname
} {SQLITE_ROW 2 {t1 1} {name rowid text INTEGER}}
do_test capi2-2.3 {
- set r [sqlite_step $::VM n val colname]
+ set r [sqlite_step $VM n val colname]
lappend r $n $val $colname
} {SQLITE_DONE 2 {} {name rowid text INTEGER}}
do_test capi2-2.4 {
- sqlite_finalize $::VM
+ sqlite_finalize $VM
} {}
do_test capi2-2.5 {
- set ::VM [sqlite_compile $::DB $::SQL ::SQL]
- set ::SQL
+ set VM [sqlite_compile $DB $SQL SQL]
+ set SQL
} {
-- A comment at the end
}
do_test capi2-2.6 {
- set r [sqlite_step $::VM n val colname]
+ set r [sqlite_step $VM n val colname]
lappend r $n $val $colname
} {SQLITE_DONE 2 {} {name rowid text INTEGER}}
do_test capi2-2.7 {
- sqlite_finalize $::VM
+ sqlite_finalize $VM
} {}
do_test capi2-2.8 {
- set ::VM [sqlite_compile $::DB $::SQL ::SQL]
- list $::SQL $::VM
+ set VM [sqlite_compile $DB $SQL SQL]
+ list $SQL $VM
} {{} {}}
+# Check the error handling.
+#
+do_test capi2-3.1 {
+ set rc [catch {
+ sqlite_compile $DB {select bogus from sqlite_master} TAIL
+ } msg]
+ lappend rc $msg $TAIL
+} {1 {(1) no such column: bogus} {}}
+do_test capi2-3.2 {
+ set rc [catch {
+ sqlite_compile $DB {select bogus from } TAIL
+ } msg]
+ lappend rc $msg $TAIL
+} {1 {(1) near " ": syntax error} {}}
+do_test capi2-3.3 {
+ set rc [catch {
+ sqlite_compile $DB {;;;;select bogus from sqlite_master} TAIL
+ } msg]
+ lappend rc $msg $TAIL
+} {1 {(1) no such column: bogus} {}}
+do_test capi2-3.4 {
+ set rc [catch {
+ sqlite_compile $DB {select bogus from sqlite_master;x;} TAIL
+ } msg]
+ lappend rc $msg $TAIL
+} {1 {(1) no such column: bogus} {x;}}
+do_test capi2-3.5 {
+ set rc [catch {
+ sqlite_compile $DB {select bogus from sqlite_master;;;x;} TAIL
+ } msg]
+ lappend rc $msg $TAIL
+} {1 {(1) no such column: bogus} {;;x;}}
+do_test capi2-3.6 {
+ set rc [catch {
+ sqlite_compile $DB {select 5/0} TAIL
+ } VM]
+ lappend rc $TAIL
+} {0 {}}
+do_test capi2-3.7 {
+ set N {}
+ set VALUE {}
+ set COLNAME {}
+ list [sqlite_step $VM N VALUE COLNAME] [set N] [set VALUE] [set COLNAME]
+} {SQLITE_ROW 1 {{}} {5/0 NUMERIC}}
+do_test capi2-3.8 {
+ sqlite_finalize $VM
+} {}
+do_test capi2-3.9 {
+ execsql {CREATE UNIQUE INDEX i1 ON t1(a)}
+ set VM [sqlite_compile $DB {INSERT INTO t1 VALUES(1,2,3)} TAIL]
+ set TAIL
+} {}
+do_test capi2-3.10 {
+ set N {}
+ set VALUE {}
+ set COLNAME {}
+ list [sqlite_step $VM N VALUE COLNAME] [set N] [set VALUE] [set COLNAME]
+} {SQLITE_DONE 0 {} {}}
+do_test capi2-3.11 {
+ sqlite_finalize $VM
+} {}
+do_test capi2-3.12 {
+ list [catch {sqlite_finalize $VM} msg] [set msg]
+} {1 {(21) library routine called out of sequence}}
+do_test capi2-3.13 {
+ set VM [sqlite_compile $DB {INSERT INTO t1 VALUES(1,3,4)} TAIL]
+ list [sqlite_step $VM N VALUE COLNAME] [set N] [set VALUE] [set COLNAME]
+} {SQLITE_ERROR 0 {} {}}
+do_test capi2-3.14 {
+ list [catch {sqlite_finalize $VM} msg] [set msg]
+} {1 {(19) uniqueness constraint failed}}
+
finish_test
# This file implements tests for the conflict resolution extension
# to SQLite.
#
-# $Id: conflict.test,v 1.14 2002/08/18 20:28:07 drh Exp $
+# $Id: conflict.test,v 1.15 2003/01/29 18:46:54 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
22 REPLACE FAIL INSERT 0 5 1
23 IGNORE ROLLBACK INSERT 0 {} 1
} {
- if {$t0} {set t1 {constraint failed}}
+ if {$t0} {set t1 {t1.c may not be NULL}}
do_test conflict-5.$i {
if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"}
if {$conf2!=""} {set conf2 "ON CONFLICT $conf2"}
22 REPLACE FAIL UPDATE 0 {7 6 9} 1
23 IGNORE ROLLBACK UPDATE 0 {6 7 3 9} 1
} {
- if {$t0} {set t1 {constraint failed}}
+ if {$t0} {set t1 {uniqueness constraint failed}}
do_test conflict-6.$i {
if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"}
if {$conf2!=""} {set conf2 "ON CONFLICT $conf2"}
INSERT INTO t2 VALUES(3,1,3,3,3);
SELECT * FROM t2;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test conflict-9.6 {
catchsql {
UPDATE t2 SET b=b+1 WHERE b=1;
SELECT * FROM t2;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test conflict-9.7 {
catchsql {
BEGIN;
INSERT INTO t2 VALUES(3,1,3,3,3);
SELECT * FROM t2;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test conflict-9.8 {
execsql {COMMIT}
execsql {SELECT * FROM t3}
} {2}
-do_test conflict-9.6 {
+do_test conflict-9.9 {
catchsql {
BEGIN;
UPDATE t3 SET x=x+1;
UPDATE t2 SET b=b+1 WHERE b=1;
SELECT * FROM t2;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test conflict-9.10 {
execsql {COMMIT}
execsql {SELECT * FROM t3}
INSERT INTO t2 VALUES(3,3,3,1,3);
SELECT * FROM t2;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test conflict-9.12 {
catchsql {
UPDATE t2 SET d=d+1 WHERE d=1;
SELECT * FROM t2;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test conflict-9.13 {
catchsql {
BEGIN;
INSERT INTO t2 VALUES(3,3,3,1,3);
SELECT * FROM t2;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test conflict-9.14 {
execsql {COMMIT}
execsql {SELECT * FROM t3}
UPDATE t2 SET d=d+1 WHERE d=1;
SELECT * FROM t2;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test conflict-9.16 {
execsql {COMMIT}
execsql {SELECT * FROM t3}
INSERT INTO t2 VALUES(3,3,3,3,1);
SELECT * FROM t2;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test conflict-9.18 {
catchsql {
UPDATE t2 SET e=e+1 WHERE e=1;
SELECT * FROM t2;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test conflict-9.19 {
catchsql {
BEGIN;
INSERT INTO t2 VALUES(3,3,3,3,1);
SELECT * FROM t2;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test conflict-9.20 {
catch {execsql {COMMIT}}
execsql {SELECT * FROM t3}
UPDATE t2 SET e=e+1 WHERE e=1;
SELECT * FROM t2;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test conflict-9.22 {
catch {execsql {COMMIT}}
execsql {SELECT * FROM t3}
# This file implements regression tests for SQLite library. The
# focus of this file is testing the COPY statement.
#
-# $Id: copy.test,v 1.12 2002/07/30 17:20:41 drh Exp $
+# $Id: copy.test,v 1.13 2003/01/29 18:46:54 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
COPY t1 FROM 'data6.txt' USING DELIMITERS '|';
SELECT * FROM t1;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test copy-5.3 {
set fd [open data6.txt w]
puts $fd "33|22|44"
# This file implements tests for the special processing associated
# with INTEGER PRIMARY KEY columns.
#
-# $Id: intpkey.test,v 1.11 2002/08/15 01:26:11 drh Exp $
+# $Id: intpkey.test,v 1.12 2003/01/29 18:46:54 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
INSERT INTO t1 VALUES(5,'second','entry');
}} msg]
lappend r $msg
-} {1 {constraint failed}}
+} {1 {PRIMARY KEY must be unique}}
do_test intpkey-1.7 {
execsql {
SELECT rowid, * FROM t1;
# This file implements tests for miscellanous features that were
# left out of other test files.
#
-# $Id: misc1.test,v 1.18 2003/01/18 20:11:07 drh Exp $
+# $Id: misc1.test,v 1.19 2003/01/29 18:46:54 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
catchsql {
INSERT INTO t5 VALUES(1,2,4);
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test misc1-7.5 {
catchsql {
INSERT INTO t5 VALUES(0,2,4);
#
# This file implements tests for the NOT NULL constraint.
#
-# $Id: notnull.test,v 1.2 2002/01/31 15:54:23 drh Exp $
+# $Id: notnull.test,v 1.3 2003/01/29 18:46:54 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
INSERT INTO t1(b,c,d,e) VALUES(2,3,4,5);
SELECT * FROM t1 order by a;
}
-} {1 {constraint failed}}
+} {1 {t1.a may not be NULL}}
do_test notnull-1.3 {
catchsql {
DELETE FROM t1;
INSERT OR REPLACE INTO t1(b,c,d,e) VALUES(2,3,4,5);
SELECT * FROM t1 order by a;
}
-} {1 {constraint failed}}
+} {1 {t1.a may not be NULL}}
do_test notnull-1.5 {
catchsql {
DELETE FROM t1;
INSERT OR ABORT INTO t1(b,c,d,e) VALUES(2,3,4,5);
SELECT * FROM t1 order by a;
}
-} {1 {constraint failed}}
+} {1 {t1.a may not be NULL}}
do_test notnull-1.6 {
catchsql {
DELETE FROM t1;
INSERT INTO t1(a,b,c,d,e) VALUES(1,null,3,4,5);
SELECT * FROM t1 order by a;
}
-} {1 {constraint failed}}
+} {1 {t1.b may not be NULL}}
do_test notnull-1.11 {
catchsql {
DELETE FROM t1;
INSERT OR ABORT INTO t1(a,b,c,d,e) VALUES(1,2,null,4,5);
SELECT * FROM t1 order by a;
}
-} {1 {constraint failed}}
+} {1 {t1.c may not be NULL}}
do_test notnull-1.17 {
catchsql {
DELETE FROM t1;
INSERT OR ABORT INTO t1(a,b,c,d,e) VALUES(1,2,3,null,5);
SELECT * FROM t1 order by a;
}
-} {1 {constraint failed}}
+} {1 {t1.d may not be NULL}}
do_test notnull-1.18 {
catchsql {
DELETE FROM t1;
INSERT INTO t1(a,b,c,d,e) VALUES(1,2,3,4,null);
SELECT * FROM t1 order by a;
}
-} {1 {constraint failed}}
+} {1 {t1.e may not be NULL}}
do_test notnull-1.21 {
catchsql {
DELETE FROM t1;
UPDATE t1 SET a=null;
SELECT * FROM t1 ORDER BY a;
}
-} {1 {constraint failed}}
+} {1 {t1.a may not be NULL}}
do_test notnull-2.2 {
catchsql {
DELETE FROM t1;
UPDATE OR REPLACE t1 SET a=null;
SELECT * FROM t1 ORDER BY a;
}
-} {1 {constraint failed}}
+} {1 {t1.a may not be NULL}}
do_test notnull-2.3 {
catchsql {
DELETE FROM t1;
UPDATE OR ABORT t1 SET a=null;
SELECT * FROM t1 ORDER BY a;
}
-} {1 {constraint failed}}
+} {1 {t1.a may not be NULL}}
do_test notnull-2.5 {
catchsql {
DELETE FROM t1;
UPDATE t1 SET b=null;
SELECT * FROM t1 ORDER BY a;
}
-} {1 {constraint failed}}
+} {1 {t1.b may not be NULL}}
do_test notnull-2.6 {
catchsql {
DELETE FROM t1;
UPDATE t1 SET e=null, a=b, b=a;
SELECT * FROM t1 ORDER BY a;
}
-} {1 {constraint failed}}
+} {1 {t1.e may not be NULL}}
do_test notnull-3.0 {
execsql {
INSERT INTO t1(b,c,d,e) VALUES(2,3,4,5);
SELECT * FROM t1 order by a;
}
-} {1 {constraint failed}}
+} {1 {t1.a may not be NULL}}
do_test notnull-3.3 {
catchsql {
DELETE FROM t1;
INSERT OR REPLACE INTO t1(b,c,d,e) VALUES(2,3,4,5);
SELECT * FROM t1 order by a;
}
-} {1 {constraint failed}}
+} {1 {t1.a may not be NULL}}
do_test notnull-3.5 {
catchsql {
DELETE FROM t1;
INSERT OR ABORT INTO t1(b,c,d,e) VALUES(2,3,4,5);
SELECT * FROM t1 order by a;
}
-} {1 {constraint failed}}
+} {1 {t1.a may not be NULL}}
do_test notnull-3.6 {
catchsql {
DELETE FROM t1;
INSERT INTO t1(a,b,c,d,e) VALUES(1,null,3,4,5);
SELECT * FROM t1 order by a;
}
-} {1 {constraint failed}}
+} {1 {t1.b may not be NULL}}
do_test notnull-3.11 {
catchsql {
DELETE FROM t1;
INSERT OR ABORT INTO t1(a,b,c,d,e) VALUES(1,2,null,4,5);
SELECT * FROM t1 order by a;
}
-} {1 {constraint failed}}
+} {1 {t1.c may not be NULL}}
do_test notnull-3.17 {
catchsql {
DELETE FROM t1;
INSERT OR ABORT INTO t1(a,b,c,d,e) VALUES(1,2,3,null,5);
SELECT * FROM t1 order by a;
}
-} {1 {constraint failed}}
+} {1 {t1.d may not be NULL}}
do_test notnull-3.18 {
catchsql {
DELETE FROM t1;
INSERT INTO t1(a,b,c,d,e) VALUES(1,2,3,4,null);
SELECT * FROM t1 order by a;
}
-} {1 {constraint failed}}
+} {1 {t1.e may not be NULL}}
do_test notnull-3.21 {
catchsql {
DELETE FROM t1;
UPDATE t1 SET a=null;
SELECT * FROM t1 ORDER BY a;
}
-} {1 {constraint failed}}
+} {1 {t1.a may not be NULL}}
do_test notnull-4.2 {
catchsql {
DELETE FROM t1;
UPDATE OR REPLACE t1 SET a=null;
SELECT * FROM t1 ORDER BY a;
}
-} {1 {constraint failed}}
+} {1 {t1.a may not be NULL}}
do_test notnull-4.3 {
catchsql {
DELETE FROM t1;
UPDATE OR ABORT t1 SET a=null;
SELECT * FROM t1 ORDER BY a;
}
-} {1 {constraint failed}}
+} {1 {t1.a may not be NULL}}
do_test notnull-4.5 {
catchsql {
DELETE FROM t1;
UPDATE t1 SET b=null;
SELECT * FROM t1 ORDER BY a;
}
-} {1 {constraint failed}}
+} {1 {t1.b may not be NULL}}
do_test notnull-4.6 {
catchsql {
DELETE FROM t1;
UPDATE t1 SET e=null, a=b, b=a;
SELECT * FROM t1 ORDER BY a;
}
-} {1 {constraint failed}}
+} {1 {t1.e may not be NULL}}
finish_test
# This file implements regression tests for SQLite library. The
# focus of this file is testing the CREATE TABLE statement.
#
-# $Id: table.test,v 1.21 2003/01/04 16:48:10 drh Exp $
+# $Id: table.test,v 1.22 2003/01/29 18:46:54 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
CREATE TABLE t6(a REFERENCES t4(a) NOT NULL);
INSERT INTO t6 VALUES(NULL);
}
-} {1 {constraint failed}}
+} {1 {t6.a may not be NULL}}
do_test table-10.2 {
catchsql {
DROP TABLE t6;
catchsql {
INSERT OR ABORT INTO tbl values (2, 2, 3);
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test trigger2-6.1c {
execsql {
SELECT * from tbl;
catchsql {
INSERT OR FAIL INTO tbl values (2, 2, 3);
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test trigger2-6.1e {
execsql {
SELECT * from tbl;
catchsql {
INSERT OR ROLLBACK INTO tbl values (3, 2, 3);
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test trigger2-6.1h {
execsql {
SELECT * from tbl;
catchsql {
UPDATE OR ABORT tbl SET a = 4 WHERE a = 1;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test trigger2-6.2c {
execsql {
SELECT * from tbl;
catchsql {
UPDATE OR FAIL tbl SET a = 4 WHERE a = 1;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test trigger2-6.2e {
execsql {
SELECT * from tbl;
catchsql {
UPDATE OR ROLLBACK tbl SET a = 4 WHERE a = 1;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test trigger2-6.2h {
execsql {
SELECT * from tbl;
# focus of this file is testing the CREATE UNIQUE INDEX statement,
# and primary keys, and the UNIQUE constraint on table columns
#
-# $Id: unique.test,v 1.4 2002/05/26 20:54:35 drh Exp $
+# $Id: unique.test,v 1.5 2003/01/29 18:46:54 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
catchsql {
INSERT INTO t1(a,b,c) VALUES(1,3,4)
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test unique-1.4 {
execsql {
SELECT * FROM t1 ORDER BY a;
catchsql {
INSERT INTO t1(a,b,c) VALUES(3,2,4)
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test unique-1.6 {
execsql {
SELECT * FROM t1 ORDER BY a;
catchsql {
INSERT INTO t2 VALUES(1,5);
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test unique-2.4 {
catchsql {
SELECT * FROM t2 ORDER BY a
catchsql {
CREATE UNIQUE INDEX i2 ON t2(a);
}
-} {1 {constraint failed}}
+} {1 {indexed columns are not unique}}
do_test unique-2.9 {
catchsql {
CREATE INDEX i2 ON t2(a);
INSERT INTO t3(a,b,c,d) VALUES(1,4,3,5);
SELECT * FROM t3 ORDER BY a,b,c,d;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
# Make sure NULLs are distinct as far as the UNIQUE tests are
# concerned.
# This file implements regression tests for SQLite library. The
# focus of this file is testing the UPDATE statement.
#
-# $Id: update.test,v 1.10 2002/07/16 17:22:51 drh Exp $
+# $Id: update.test,v 1.11 2003/01/29 18:46:54 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
UPDATE t1 SET a=1, e=10 WHERE f=7;
SELECT * FROM t1;
}
-} {1 {constraint failed}}
+} {1 {PRIMARY KEY must be unique}}
do_test update-10.4 {
catchsql {
SELECT * FROM t1;
UPDATE t1 SET b=2, e=12 WHERE f=7;
SELECT * FROM t1;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test update-10.7 {
catchsql {
SELECT * FROM t1;
UPDATE t1 SET c=3, d=4, e=14 WHERE f=7;
SELECT * FROM t1;
}
-} {1 {constraint failed}}
+} {1 {uniqueness constraint failed}}
do_test update-10.10 {
catchsql {
SELECT * FROM t1;