mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Better error messages on constraint violations. Additional tests and bug fixes
for the callback-free API. (CVS 854) FossilOrigin-Name: ccc82f1ab4539a60ee5cc2625743c5389f9ccd8e
This commit is contained in:
50
manifest
50
manifest
@@ -1,5 +1,5 @@
|
|||||||
C The\scallback-free\sAPI\sis\snow\sworking,\sthough\smuch\smore\stesting\sis\sneed.\s(CVS\s853)
|
C Better\serror\smessages\son\sconstraint\sviolations.\s\sAdditional\stests\sand\sbug\sfixes\nfor\sthe\scallback-free\sAPI.\s(CVS\s854)
|
||||||
D 2003-01-29T14:06:08
|
D 2003-01-29T18:46:52
|
||||||
F Makefile.in 6606854b1512f185b8e8c779b8d7fc2750463d64
|
F Makefile.in 6606854b1512f185b8e8c779b8d7fc2750463d64
|
||||||
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
||||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||||
@@ -21,31 +21,31 @@ F sqlite.1 83f4a9d37bdf2b7ef079a82d54eaf2e3509ee6ea
|
|||||||
F src/auth.c 9c2db0bc7707f2d2e227f47e3d557b41d44ade75
|
F src/auth.c 9c2db0bc7707f2d2e227f47e3d557b41d44ade75
|
||||||
F src/btree.c eb4f430b062500d7533c031097d3ff8824eca3ba
|
F src/btree.c eb4f430b062500d7533c031097d3ff8824eca3ba
|
||||||
F src/btree.h 17710339f7a8f46e3c7d6d0d4648ef19c584ffda
|
F src/btree.h 17710339f7a8f46e3c7d6d0d4648ef19c584ffda
|
||||||
F src/build.c 1a4c0d71863f0aa0be7e5a2148b103c3e761c771
|
F src/build.c 6e0310086b8e2deef74f0d4fb3297c4e8fcf6222
|
||||||
F src/delete.c cbd499f3f9297504c42e328af89bef1a2113d04c
|
F src/delete.c cbd499f3f9297504c42e328af89bef1a2113d04c
|
||||||
F src/encode.c faf03741efe921755ec371cf4a6984536de00042
|
F src/encode.c faf03741efe921755ec371cf4a6984536de00042
|
||||||
F src/expr.c 382839b92cb66a34cfa71cf1d2bc8fb818226c90
|
F src/expr.c 359ae28321ce78d20ef38f4fd6ee7429b100186f
|
||||||
F src/func.c 90c583f0b91220f7cd411a2407deaf9327245d63
|
F src/func.c 90c583f0b91220f7cd411a2407deaf9327245d63
|
||||||
F src/hash.c 4fc39feb7b7711f6495ee9f2159559bedb043e1f
|
F src/hash.c 4fc39feb7b7711f6495ee9f2159559bedb043e1f
|
||||||
F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
|
F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
|
||||||
F src/insert.c db954e955970795819145a3649fd2ad116a58890
|
F src/insert.c 13c2ef8984ce0f38701a8af89e4ba7a3c86c0701
|
||||||
F src/main.c f1c86161875337c6421cf988bf5595eda515851a
|
F src/main.c 764a72e6a4f021ae1d3db7e82dab625075f4fedb
|
||||||
F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
|
F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
|
||||||
F src/os.c ed27e178e0c4b71f2807da81b8851f0fadc50778
|
F src/os.c ed27e178e0c4b71f2807da81b8851f0fadc50778
|
||||||
F src/os.h afa3e096213bad86845f8bdca81a9e917505e401
|
F src/os.h afa3e096213bad86845f8bdca81a9e917505e401
|
||||||
F src/pager.c 95f5c5c775ed47e837ce02b407d80527d93e6c43
|
F src/pager.c 95f5c5c775ed47e837ce02b407d80527d93e6c43
|
||||||
F src/pager.h 540833e8cb826b80ce2e39aa917deee5e12db626
|
F src/pager.h 540833e8cb826b80ce2e39aa917deee5e12db626
|
||||||
F src/parse.y aea0819c07ec9c81b810039df9be9d5705b1e497
|
F src/parse.y cdaed5009423d851708848bd279147c268e6022e
|
||||||
F src/printf.c e8e9a0605602cb1a3a2dc754e0978fa9064ecee7
|
F src/printf.c f8fd911a8738f9b2eb07aca2870473d34707055d
|
||||||
F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
|
F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
|
||||||
F src/select.c 13b8e5ea8aacaf204468518aed7b054a583f2f25
|
F src/select.c 13b8e5ea8aacaf204468518aed7b054a583f2f25
|
||||||
F src/shell.c cbb29252f0bd7b144d1e3126e64e17e5a314f2fd
|
F src/shell.c cbb29252f0bd7b144d1e3126e64e17e5a314f2fd
|
||||||
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
|
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
|
||||||
F src/sqlite.h.in 6f648803f2ffb9beb35cb1cfa42b323d55519171
|
F src/sqlite.h.in 6f648803f2ffb9beb35cb1cfa42b323d55519171
|
||||||
F src/sqliteInt.h d4d1eb361e2121d62ec320e53e32b42569b7613e
|
F src/sqliteInt.h f22092ed33fea784f58bcd57b90c0babd16a0e29
|
||||||
F src/table.c eed2098c9b577aa17f8abe89313a9c4413f57d63
|
F src/table.c eed2098c9b577aa17f8abe89313a9c4413f57d63
|
||||||
F src/tclsqlite.c 9f2c00a92338c51171ded8943bd42d77f7e69e64
|
F src/tclsqlite.c 9f2c00a92338c51171ded8943bd42d77f7e69e64
|
||||||
F src/test1.c 2ef543e6e49329d5254c0ad4b09586a4eaad5ed4
|
F src/test1.c a24735c6e6364ccaa73ce3b106859fb325b076d9
|
||||||
F src/test2.c 03f05e984c8e2f2badc44644d42baf72b249096b
|
F src/test2.c 03f05e984c8e2f2badc44644d42baf72b249096b
|
||||||
F src/test3.c c12ea7f1c3fbbd58904e81e6cb10ad424e6fc728
|
F src/test3.c c12ea7f1c3fbbd58904e81e6cb10ad424e6fc728
|
||||||
F src/threadtest.c d641a5219e718e18a1a80a50eb9bb549f451f42e
|
F src/threadtest.c d641a5219e718e18a1a80a50eb9bb549f451f42e
|
||||||
@@ -53,8 +53,8 @@ F src/tokenize.c bc40937d6666f188037aa3e54f0a2661a6fef6d1
|
|||||||
F src/trigger.c da142decd2808bc39e801f3bb1f161dbc2bd4005
|
F src/trigger.c da142decd2808bc39e801f3bb1f161dbc2bd4005
|
||||||
F src/update.c f06afa9bf1f777d17702e0f6e33cf44c44bc4f75
|
F src/update.c f06afa9bf1f777d17702e0f6e33cf44c44bc4f75
|
||||||
F src/util.c 757875a366be838d96c09f255631596a2f558fca
|
F src/util.c 757875a366be838d96c09f255631596a2f558fca
|
||||||
F src/vdbe.c a9dd0f68751587eeff81afb404f9f63e4ac6185a
|
F src/vdbe.c de4c00495ed6d3c7798153996ea174881fc29b42
|
||||||
F src/vdbe.h 162071f1dd0b43236930712f4238c59a6a0de298
|
F src/vdbe.h ed43771f1dc2b994d5c484fdf2eab357c6ef0ee3
|
||||||
F src/where.c 5bf7f1e1d756ab3d25a18b24bb42106cb8e14d18
|
F src/where.c 5bf7f1e1d756ab3d25a18b24bb42106cb8e14d18
|
||||||
F test/all.test 873d30e25a41b3aa48fec5633a7ec1816e107029
|
F test/all.test 873d30e25a41b3aa48fec5633a7ec1816e107029
|
||||||
F test/auth.test 95aeda24f76b6fd028bdb3d6ae1e30b153d942fe
|
F test/auth.test 95aeda24f76b6fd028bdb3d6ae1e30b153d942fe
|
||||||
@@ -64,9 +64,9 @@ F test/btree.test 10e75aec120ecefc0edc4c912a0980a43db1b6c2
|
|||||||
F test/btree2.test e3b81ec33dc2f89b3e6087436dfe605b870c9080
|
F test/btree2.test e3b81ec33dc2f89b3e6087436dfe605b870c9080
|
||||||
F test/btree3.test e597fb59be2ac0ea69c62aaa2064e998e528b665
|
F test/btree3.test e597fb59be2ac0ea69c62aaa2064e998e528b665
|
||||||
F test/btree4.test fa955a3d7a8bc91d6084b7f494f9e5d1bdfb15b6
|
F test/btree4.test fa955a3d7a8bc91d6084b7f494f9e5d1bdfb15b6
|
||||||
F test/capi2.test 158d76afd093d71b4aac860c0d12511706b1d8d0
|
F test/capi2.test 21f73319ae288d874f68787b5af4bd2022e25dcb
|
||||||
F test/conflict.test 0173a12a257f73bac2c9d53ad44cac9b15ea517e
|
F test/conflict.test d7d9dbea9909c1b843f9e89c8318fdb7ca07a5e5
|
||||||
F test/copy.test 55d60a4d5ed342a0fa08b7cd07d46d43ea0d0d7f
|
F test/copy.test 73df5ed3112e858e006a8b7ddb4c9bab6a25d0fb
|
||||||
F test/delete.test 5821a95a66061ae09723a88938f23d10d8a881ad
|
F test/delete.test 5821a95a66061ae09723a88938f23d10d8a881ad
|
||||||
F test/expr.test 290e2617b89b5c5e3bf71f19367d285102128be4
|
F test/expr.test 290e2617b89b5c5e3bf71f19367d285102128be4
|
||||||
F test/fkey1.test d65c824459916249bee501532d6154ddab0b5db7
|
F test/fkey1.test d65c824459916249bee501532d6154ddab0b5db7
|
||||||
@@ -76,7 +76,7 @@ F test/in.test 15428c85d141edda7543bfc3f9a32ce65193717b
|
|||||||
F test/index.test 2a5a1b654f50ca0768fb10ae44b72e6a776b1f18
|
F test/index.test 2a5a1b654f50ca0768fb10ae44b72e6a776b1f18
|
||||||
F test/insert.test a122afb86911e77c181d912348866a5b1a61eeab
|
F test/insert.test a122afb86911e77c181d912348866a5b1a61eeab
|
||||||
F test/insert2.test c288375a64dad3295044714f0dfed4a193cf067f
|
F test/insert2.test c288375a64dad3295044714f0dfed4a193cf067f
|
||||||
F test/intpkey.test f3620158fd7963af1306b01047277f10ae91a30b
|
F test/intpkey.test e0e283b0cbeaa97eeee183e1cdb91fa73d720866
|
||||||
F test/ioerr.test 57d9bffaca18b34f9e976f786eadc2591d6efc6a
|
F test/ioerr.test 57d9bffaca18b34f9e976f786eadc2591d6efc6a
|
||||||
F test/join.test 178b25dc3c5be6cbdd195b904e66bee62475d0bf
|
F test/join.test 178b25dc3c5be6cbdd195b904e66bee62475d0bf
|
||||||
F test/limit.test 9f26f874bc765df5b3f5c92d26d1b12eac6d4cf9
|
F test/limit.test 9f26f874bc765df5b3f5c92d26d1b12eac6d4cf9
|
||||||
@@ -85,9 +85,9 @@ F test/main.test c66b564554b770ee7fdbf6a66c0cd90329bc2c85
|
|||||||
F test/malloc.test 7ba32a9ebd3aeed52ae4aaa6d42ca37e444536fd
|
F test/malloc.test 7ba32a9ebd3aeed52ae4aaa6d42ca37e444536fd
|
||||||
F test/memleak.test b4f59aa44488793b00feff2011d77d0f05b22468
|
F test/memleak.test b4f59aa44488793b00feff2011d77d0f05b22468
|
||||||
F test/minmax.test 29bc5727c3e4c792d5c4745833dd4b505905819e
|
F test/minmax.test 29bc5727c3e4c792d5c4745833dd4b505905819e
|
||||||
F test/misc1.test 9f9e8b6f824b4c388ce3ad0cabdc873e0d22e28e
|
F test/misc1.test 6d61d1282f2d1f1c184f50e0373d9ffc7d42f744
|
||||||
F test/misuse.test a3aa2b18a97e4c409a1fcaff5151a4dd804a0162
|
F test/misuse.test a3aa2b18a97e4c409a1fcaff5151a4dd804a0162
|
||||||
F test/notnull.test b1f3e42fc475b0b5827b27b2e9b562081995ff30
|
F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
|
||||||
F test/null.test 5c2b57307e4b6178aae825eb65ddbee01e76b0fd
|
F test/null.test 5c2b57307e4b6178aae825eb65ddbee01e76b0fd
|
||||||
F test/pager.test d3a2e2f00999f97e056822a39d5ee2fad18bf12c
|
F test/pager.test d3a2e2f00999f97e056822a39d5ee2fad18bf12c
|
||||||
F test/pragma.test 0ca0773e2559ec9715f72d90695554dc3368e8f2
|
F test/pragma.test 0ca0773e2559ec9715f72d90695554dc3368e8f2
|
||||||
@@ -103,18 +103,18 @@ F test/select5.test c2a6c4a003316ee42cbbd689eebef8fdce0db2ac
|
|||||||
F test/select6.test efb8d0c07a440441db87db2c4ade6904e1407e85
|
F test/select6.test efb8d0c07a440441db87db2c4ade6904e1407e85
|
||||||
F test/sort.test 61a729023ae4ac3be9b225dc0be026fb43fec4e6
|
F test/sort.test 61a729023ae4ac3be9b225dc0be026fb43fec4e6
|
||||||
F test/subselect.test f0fea8cf9f386d416d64d152e3c65f9116d0f50f
|
F test/subselect.test f0fea8cf9f386d416d64d152e3c65f9116d0f50f
|
||||||
F test/table.test 2a94f55b39008daa79b81f37aaf7be81386ca71e
|
F test/table.test 371a1fc1c470982b2f68f9732f903a5d96f949c4
|
||||||
F test/tableapi.test 3c80421a889e1d106df16e5800fa787f0d2914a6
|
F test/tableapi.test 3c80421a889e1d106df16e5800fa787f0d2914a6
|
||||||
F test/tclsqlite.test 2441ab135e5af85110326b3e3b057e7257c144e1
|
F test/tclsqlite.test 2441ab135e5af85110326b3e3b057e7257c144e1
|
||||||
F test/temptable.test 03b7bdb7d6ce2c658ad20c94b037652c6cad34e0
|
F test/temptable.test 03b7bdb7d6ce2c658ad20c94b037652c6cad34e0
|
||||||
F test/tester.tcl 6f603d90881bd835ea27c568a7fecaa57dce91cc
|
F test/tester.tcl 6f603d90881bd835ea27c568a7fecaa57dce91cc
|
||||||
F test/trans.test 10b53c77e2cc4ad9529c15fdcb390b8d5722ea65
|
F test/trans.test 10b53c77e2cc4ad9529c15fdcb390b8d5722ea65
|
||||||
F test/trigger1.test ec1da76e1a9f618deb96e505f459dcf8a23f2247
|
F test/trigger1.test ec1da76e1a9f618deb96e505f459dcf8a23f2247
|
||||||
F test/trigger2.test ee346d8c612e7f847c9543058f1b89d094d27ffb
|
F test/trigger2.test 592daa956dc62b19930fe673405e389a80c5764e
|
||||||
F test/trigger3.test 870afef7997a5b86bf3ea893ce0c2e85d6356c72
|
F test/trigger3.test 870afef7997a5b86bf3ea893ce0c2e85d6356c72
|
||||||
F test/trigger4.test 9a5c1406344d743020c2753ae8d6dfe6eb75f818
|
F test/trigger4.test 9a5c1406344d743020c2753ae8d6dfe6eb75f818
|
||||||
F test/unique.test 572aa791327c1e8d797932263e9d67f176cfdb44
|
F test/unique.test 22a46df72a3e0a3fd1a2d39e96fb59f18448dd5f
|
||||||
F test/update.test 7ffb062d580a972e7870d0f51d5af3ab9bfeae08
|
F test/update.test e7b224f4ed652b3d6defdd6174ebc2ccd894307a
|
||||||
F test/vacuum.test 059871b312eb910bbe49dafde1d01490cc2c6bbe
|
F test/vacuum.test 059871b312eb910bbe49dafde1d01490cc2c6bbe
|
||||||
F test/version.test 605fd0d7e7d571370c32b12dbf395b58953de246
|
F test/version.test 605fd0d7e7d571370c32b12dbf395b58953de246
|
||||||
F test/view.test c64fa39ea57f3c2066c854290f032ad13b23b83d
|
F test/view.test c64fa39ea57f3c2066c854290f032ad13b23b83d
|
||||||
@@ -155,7 +155,7 @@ F www/speed.tcl 4d463e2aea41f688ed320a937f93ff885be918c3
|
|||||||
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
|
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
|
||||||
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
|
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
|
||||||
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
|
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
|
||||||
P 065fa818ffc8d7562889172acea16e4e44e773ef
|
P 162b259188e6967fe9c3722da26b81aab5655d83
|
||||||
R 0f5c157d8052fdb9f4b710d54301a2ba
|
R 715f66b82d831caba169ad25678a9655
|
||||||
U drh
|
U drh
|
||||||
Z b732b2962b2533af4ee430d0fd255a71
|
Z 12bd865865cbc9da0a476fa88511badb
|
||||||
|
@@ -1 +1 @@
|
|||||||
162b259188e6967fe9c3722da26b81aab5655d83
|
ccc82f1ab4539a60ee5cc2625743c5389f9ccd8e
|
@@ -25,7 +25,7 @@
|
|||||||
** ROLLBACK
|
** ROLLBACK
|
||||||
** PRAGMA
|
** 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 "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -91,7 +91,6 @@ void sqliteExec(Parse *pParse){
|
|||||||
}
|
}
|
||||||
rc = sqliteVdbeFinalize(v, &pParse->zErrMsg);
|
rc = sqliteVdbeFinalize(v, &pParse->zErrMsg);
|
||||||
if( rc ) pParse->nErr++;
|
if( rc ) pParse->nErr++;
|
||||||
sqliteVdbeDelete(v);
|
|
||||||
pParse->pVdbe = 0;
|
pParse->pVdbe = 0;
|
||||||
pParse->rc = rc;
|
pParse->rc = rc;
|
||||||
if( rc ) pParse->nErr++;
|
if( rc ) pParse->nErr++;
|
||||||
@@ -100,6 +99,8 @@ void sqliteExec(Parse *pParse){
|
|||||||
}
|
}
|
||||||
pParse->colNamesSet = 0;
|
pParse->colNamesSet = 0;
|
||||||
pParse->schemaVerified = 0;
|
pParse->schemaVerified = 0;
|
||||||
|
}else if( pParse->useCallback==0 ){
|
||||||
|
pParse->rc = SQLITE_ERROR;
|
||||||
}
|
}
|
||||||
pParse->nTab = 0;
|
pParse->nTab = 0;
|
||||||
pParse->nMem = 0;
|
pParse->nMem = 0;
|
||||||
@@ -1666,6 +1667,7 @@ void sqliteCreateIndex(
|
|||||||
sqliteVdbeAddOp(v, OP_MakeIdxKey, pIndex->nColumn, 0);
|
sqliteVdbeAddOp(v, OP_MakeIdxKey, pIndex->nColumn, 0);
|
||||||
if( db->file_format>=4 ) sqliteAddIdxKeyType(v, pIndex);
|
if( db->file_format>=4 ) sqliteAddIdxKeyType(v, pIndex);
|
||||||
sqliteVdbeAddOp(v, OP_IdxPut, 1, pIndex->onError!=OE_None);
|
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);
|
sqliteVdbeAddOp(v, OP_Next, 2, lbl1);
|
||||||
sqliteVdbeResolveLabel(v, lbl2);
|
sqliteVdbeResolveLabel(v, lbl2);
|
||||||
sqliteVdbeAddOp(v, OP_Close, 2, 0);
|
sqliteVdbeAddOp(v, OP_Close, 2, 0);
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
** This file contains routines used for analyzing expressions and
|
** This file contains routines used for analyzing expressions and
|
||||||
** for generating VDBE code that evaluates expressions in SQLite.
|
** 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 "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -1216,7 +1216,7 @@ void sqliteExprCode(Parse *pParse, Expr *pExpr){
|
|||||||
} else {
|
} else {
|
||||||
assert( pExpr->iColumn == OE_Ignore );
|
assert( pExpr->iColumn == OE_Ignore );
|
||||||
sqliteVdbeAddOp(v, OP_Goto, 0, pParse->trigStack->ignoreJump);
|
sqliteVdbeAddOp(v, OP_Goto, 0, pParse->trigStack->ignoreJump);
|
||||||
sqliteVdbeChangeP3(v, -1, "(IGNORE jump)", -1);
|
sqliteVdbeChangeP3(v, -1, "(IGNORE jump)", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
** This file contains C code routines that are called by the parser
|
** This file contains C code routines that are called by the parser
|
||||||
** to handle INSERT statements in SQLite.
|
** 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"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -657,7 +657,11 @@ void sqliteGenerateConstraintChecks(
|
|||||||
case OE_Rollback:
|
case OE_Rollback:
|
||||||
case OE_Abort:
|
case OE_Abort:
|
||||||
case OE_Fail: {
|
case OE_Fail: {
|
||||||
|
char *zMsg = 0;
|
||||||
sqliteVdbeAddOp(v, OP_Halt, SQLITE_CONSTRAINT, onError);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case OE_Ignore: {
|
case OE_Ignore: {
|
||||||
@@ -707,6 +711,7 @@ void sqliteGenerateConstraintChecks(
|
|||||||
case OE_Abort:
|
case OE_Abort:
|
||||||
case OE_Fail: {
|
case OE_Fail: {
|
||||||
sqliteVdbeAddOp(v, OP_Halt, SQLITE_CONSTRAINT, onError);
|
sqliteVdbeAddOp(v, OP_Halt, SQLITE_CONSTRAINT, onError);
|
||||||
|
sqliteVdbeChangeP3(v, -1, "PRIMARY KEY must be unique", P3_STATIC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OE_Ignore: {
|
case OE_Ignore: {
|
||||||
@@ -760,6 +765,7 @@ void sqliteGenerateConstraintChecks(
|
|||||||
case OE_Abort:
|
case OE_Abort:
|
||||||
case OE_Fail: {
|
case OE_Fail: {
|
||||||
sqliteVdbeAddOp(v, OP_Halt, SQLITE_CONSTRAINT, onError);
|
sqliteVdbeAddOp(v, OP_Halt, SQLITE_CONSTRAINT, onError);
|
||||||
|
sqliteVdbeChangeP3(v, -1, "uniqueness constraint failed", P3_STATIC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OE_Ignore: {
|
case OE_Ignore: {
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
** other files are for internal use by SQLite and should not be
|
** other files are for internal use by SQLite and should not be
|
||||||
** accessed by users of the library.
|
** 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 "sqliteInt.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
@@ -716,7 +716,9 @@ int sqlite_finalize(
|
|||||||
sqlite_vm *pVm, /* The virtual machine to be destroyed */
|
sqlite_vm *pVm, /* The virtual machine to be destroyed */
|
||||||
char **pzErrMsg /* OUT: Write error messages here */
|
char **pzErrMsg /* OUT: Write error messages here */
|
||||||
){
|
){
|
||||||
return sqliteVdbeFinalize((Vdbe*)pVm, pzErrMsg);
|
int rc = sqliteVdbeFinalize((Vdbe*)pVm, pzErrMsg);
|
||||||
|
sqliteStrRealloc(pzErrMsg);
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
** the parser. Lemon will also generate a header file containing
|
** the parser. Lemon will also generate a header file containing
|
||||||
** numeric codes for all of the tokens.
|
** 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_prefix TK_
|
||||||
%token_type {Token}
|
%token_type {Token}
|
||||||
@@ -72,8 +72,9 @@ input ::= cmdlist.
|
|||||||
//
|
//
|
||||||
cmdlist ::= ecmd.
|
cmdlist ::= ecmd.
|
||||||
cmdlist ::= cmdlist ecmd.
|
cmdlist ::= cmdlist ecmd.
|
||||||
ecmd ::= explain cmd SEMI. {sqliteExec(pParse);}
|
ecmd ::= explain cmdx SEMI.
|
||||||
ecmd ::= SEMI.
|
ecmd ::= SEMI.
|
||||||
|
cmdx ::= cmd. { sqliteExec(pParse); }
|
||||||
explain ::= EXPLAIN. { sqliteBeginParse(pParse, 1); }
|
explain ::= EXPLAIN. { sqliteBeginParse(pParse, 1); }
|
||||||
explain ::= . { sqliteBeginParse(pParse, 0); }
|
explain ::= . { sqliteBeginParse(pParse, 0); }
|
||||||
|
|
||||||
|
22
src/printf.c
22
src/printf.c
@@ -679,6 +679,28 @@ static void mout(void *arg, char *zNewText, int nNewChar){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** 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
|
** sqlite_mprintf() works like printf(), but allocations memory to hold the
|
||||||
** resulting string and returns a pointer to the allocated memory. Use
|
** resulting string and returns a pointer to the allocated memory. Use
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** Internal interface definitions for SQLite.
|
** 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 "config.h"
|
||||||
#include "sqlite.h"
|
#include "sqlite.h"
|
||||||
@@ -924,6 +924,7 @@ void sqliteRealToSortable(double r, char *);
|
|||||||
char *sqliteStrNDup(const char*, int);
|
char *sqliteStrNDup(const char*, int);
|
||||||
# define sqliteCheckMemory(a,b)
|
# define sqliteCheckMemory(a,b)
|
||||||
#endif
|
#endif
|
||||||
|
char *sqliteMPrintf(const char *,...);
|
||||||
void sqliteSetString(char **, const char *, ...);
|
void sqliteSetString(char **, const char *, ...);
|
||||||
void sqliteSetNString(char **, ...);
|
void sqliteSetNString(char **, ...);
|
||||||
void sqliteDequote(char*);
|
void sqliteDequote(char*);
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
** is not included in the SQLite library. It is used for automated
|
** is not included in the SQLite library. It is used for automated
|
||||||
** testing of the SQLite library.
|
** 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 "sqliteInt.h"
|
||||||
#include "tcl.h"
|
#include "tcl.h"
|
||||||
@@ -726,6 +726,7 @@ static int test_compile(
|
|||||||
}
|
}
|
||||||
if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
|
if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
|
||||||
rc = sqlite_compile(db, argv[2], &zTail, &vm, &zErr);
|
rc = sqlite_compile(db, argv[2], &zTail, &vm, &zErr);
|
||||||
|
Tcl_SetVar(interp, argv[3], zTail, 0);
|
||||||
if( rc ){
|
if( rc ){
|
||||||
assert( vm==0 );
|
assert( vm==0 );
|
||||||
sprintf(zBuf, "(%d) ", rc);
|
sprintf(zBuf, "(%d) ", rc);
|
||||||
@@ -737,7 +738,6 @@ static int test_compile(
|
|||||||
sprintf(zBuf, "%p", vm);
|
sprintf(zBuf, "%p", vm);
|
||||||
Tcl_AppendResult(interp, zBuf, 0);
|
Tcl_AppendResult(interp, zBuf, 0);
|
||||||
}
|
}
|
||||||
Tcl_SetVar(interp, argv[3], zTail, 0);
|
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
18
src/vdbe.c
18
src/vdbe.c
@@ -36,7 +36,7 @@
|
|||||||
** in this file for details. If in doubt, do not deviate from existing
|
** in this file for details. If in doubt, do not deviate from existing
|
||||||
** commenting and indentation practices when changing or adding code.
|
** 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 "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -1710,17 +1710,18 @@ case OP_Return: {
|
|||||||
** is the same as executing Halt.
|
** is the same as executing Halt.
|
||||||
*/
|
*/
|
||||||
case OP_Halt: {
|
case OP_Halt: {
|
||||||
|
p->magic = VDBE_MAGIC_HALT;
|
||||||
if( pOp->p1!=SQLITE_OK ){
|
if( pOp->p1!=SQLITE_OK ){
|
||||||
p->rc = pOp->p1;
|
p->rc = pOp->p1;
|
||||||
p->errorAction = pOp->p2;
|
p->errorAction = pOp->p2;
|
||||||
if( pOp->p3 ){
|
if( pOp->p3 ){
|
||||||
sqliteSetString(&p->zErrMsg, pOp->p3, 0);
|
sqliteSetString(&p->zErrMsg, pOp->p3, 0);
|
||||||
}
|
}
|
||||||
|
return SQLITE_ERROR;
|
||||||
}else{
|
}else{
|
||||||
p->rc = SQLITE_OK;
|
p->rc = SQLITE_OK;
|
||||||
|
return SQLITE_DONE;
|
||||||
}
|
}
|
||||||
p->magic = VDBE_MAGIC_HALT;
|
|
||||||
return SQLITE_DONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Opcode: Integer P1 * P3
|
/* Opcode: Integer P1 * P3
|
||||||
@@ -4307,7 +4308,7 @@ case OP_IdxPut: {
|
|||||||
){
|
){
|
||||||
rc = SQLITE_CONSTRAINT;
|
rc = SQLITE_CONSTRAINT;
|
||||||
if( pOp->p3 && pOp->p3[0] ){
|
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;
|
goto abort_due_to_error;
|
||||||
}
|
}
|
||||||
@@ -5614,7 +5615,9 @@ abort_due_to_misuse:
|
|||||||
** should hold the error number.
|
** should hold the error number.
|
||||||
*/
|
*/
|
||||||
abort_due_to_error:
|
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;
|
goto vdbe_halt;
|
||||||
|
|
||||||
/* Jump to here if the sqlite_interrupt() API sets the interrupt
|
/* Jump to here if the sqlite_interrupt() API sets the interrupt
|
||||||
@@ -5659,6 +5662,7 @@ bad_instruction:
|
|||||||
int sqliteVdbeFinalize(Vdbe *p, char **pzErrMsg){
|
int sqliteVdbeFinalize(Vdbe *p, char **pzErrMsg){
|
||||||
sqlite *db = p->db;
|
sqlite *db = p->db;
|
||||||
Btree *pBt = p->pBt;
|
Btree *pBt = p->pBt;
|
||||||
|
int rc;
|
||||||
|
|
||||||
if( p->magic!=VDBE_MAGIC_RUN && p->magic!=VDBE_MAGIC_HALT ){
|
if( p->magic!=VDBE_MAGIC_RUN && p->magic!=VDBE_MAGIC_HALT ){
|
||||||
sqliteSetString(pzErrMsg, sqlite_error_string(SQLITE_MISUSE), 0);
|
sqliteSetString(pzErrMsg, sqlite_error_string(SQLITE_MISUSE), 0);
|
||||||
@@ -5727,5 +5731,7 @@ int sqliteVdbeFinalize(Vdbe *p, char **pzErrMsg){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return p->rc;
|
rc = p->rc;
|
||||||
|
sqliteVdbeDelete(p);
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
** or VDBE. The VDBE implements an abstract machine that runs a
|
** or VDBE. The VDBE implements an abstract machine that runs a
|
||||||
** simple program to access and modify the underlying database.
|
** 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_
|
#ifndef _SQLITE_VDBE_H_
|
||||||
#define _SQLITE_VDBE_H_
|
#define _SQLITE_VDBE_H_
|
||||||
@@ -50,9 +50,9 @@ typedef struct VdbeOp VdbeOp;
|
|||||||
** Allowed values of VdbeOp.p3type
|
** Allowed values of VdbeOp.p3type
|
||||||
*/
|
*/
|
||||||
#define P3_NOTUSED 0 /* The P3 parameter is not used */
|
#define P3_NOTUSED 0 /* The P3 parameter is not used */
|
||||||
#define P3_DYNAMIC 1 /* Pointer to a string obtained from sqliteMalloc() */
|
#define P3_DYNAMIC (-1) /* Pointer to a string obtained from sqliteMalloc() */
|
||||||
#define P3_STATIC (-1) /* Pointer to a static string */
|
#define P3_STATIC (-2) /* Pointer to a static string */
|
||||||
#define P3_POINTER (-2) /* P3 is a pointer to some structure or object */
|
#define P3_POINTER (-3) /* P3 is a pointer to some structure or object */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The following macro converts a relative address in the p2 field
|
** The following macro converts a relative address in the p2 field
|
||||||
|
134
test/capi2.test
134
test/capi2.test
@@ -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 script testing the callback-free C/C++ API.
|
# 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]
|
set testdir [file dirname $argv0]
|
||||||
@@ -21,88 +21,160 @@ source $testdir/tester.tcl
|
|||||||
#
|
#
|
||||||
do_test capi2-1.1 {
|
do_test capi2-1.1 {
|
||||||
db close
|
db close
|
||||||
set ::DB [sqlite db test.db]
|
set DB [sqlite db test.db]
|
||||||
execsql {CREATE TABLE t1(a,b,c)}
|
execsql {CREATE TABLE t1(a,b,c)}
|
||||||
set ::VM [sqlite_compile $::DB {SELECT name, rowid FROM sqlite_master} tail]
|
set VM [sqlite_compile $DB {SELECT name, rowid FROM sqlite_master} TAIL]
|
||||||
set tail
|
set TAIL
|
||||||
} {}
|
} {}
|
||||||
do_test capi2-1.2 {
|
do_test capi2-1.2 {
|
||||||
sqlite_step $::VM ::N ::VALUES ::COLNAMES
|
sqlite_step $VM N VALUES COLNAMES
|
||||||
} {SQLITE_ROW}
|
} {SQLITE_ROW}
|
||||||
do_test capi2-1.3 {
|
do_test capi2-1.3 {
|
||||||
set ::N
|
set N
|
||||||
} {2}
|
} {2}
|
||||||
do_test capi2-1.4 {
|
do_test capi2-1.4 {
|
||||||
set ::VALUES
|
set VALUES
|
||||||
} {t1 1}
|
} {t1 1}
|
||||||
do_test capi2-1.5 {
|
do_test capi2-1.5 {
|
||||||
set ::COLNAMES
|
set COLNAMES
|
||||||
} {name rowid text INTEGER}
|
} {name rowid text INTEGER}
|
||||||
do_test capi2-1.6 {
|
do_test capi2-1.6 {
|
||||||
set ::N x
|
set N x
|
||||||
set ::VALUES y
|
set VALUES y
|
||||||
set ::COLNAMES z
|
set COLNAMES z
|
||||||
sqlite_step $::VM ::N ::VALUES ::COLNAMES
|
sqlite_step $VM N VALUES COLNAMES
|
||||||
} {SQLITE_DONE}
|
} {SQLITE_DONE}
|
||||||
do_test capi2-1.7 {
|
do_test capi2-1.7 {
|
||||||
list $::N $::VALUES $::COLNAMES
|
list $N $VALUES $COLNAMES
|
||||||
} {2 {} {name rowid text INTEGER}}
|
} {2 {} {name rowid text INTEGER}}
|
||||||
do_test capi2-1.8 {
|
do_test capi2-1.8 {
|
||||||
set ::N x
|
set N x
|
||||||
set ::VALUES y
|
set VALUES y
|
||||||
set ::COLNAMES z
|
set COLNAMES z
|
||||||
sqlite_step $::VM ::N ::VALUES ::COLNAMES
|
sqlite_step $VM N VALUES COLNAMES
|
||||||
} {SQLITE_MISUSE}
|
} {SQLITE_MISUSE}
|
||||||
do_test capi2-1.9 {
|
do_test capi2-1.9 {
|
||||||
list $::N $::VALUES $::COLNAMES
|
list $N $VALUES $COLNAMES
|
||||||
} {x y z}
|
} {x y z}
|
||||||
do_test capi2-1.10 {
|
do_test capi2-1.10 {
|
||||||
sqlite_finalize $::VM
|
sqlite_finalize $VM
|
||||||
} {}
|
} {}
|
||||||
|
|
||||||
# Check to make sure that the "tail" of a multi-statement SQL script
|
# Check to make sure that the "tail" of a multi-statement SQL script
|
||||||
# is returned by sqlite_compile.
|
# is returned by sqlite_compile.
|
||||||
#
|
#
|
||||||
do_test capi2-2.1 {
|
do_test capi2-2.1 {
|
||||||
set ::SQL {
|
set SQL {
|
||||||
SELECT name, rowid FROM sqlite_master;
|
SELECT name, rowid FROM sqlite_master;
|
||||||
SELECT name, rowid FROM sqlite_temp_master;
|
SELECT name, rowid FROM sqlite_temp_master;
|
||||||
-- A comment at the end
|
-- A comment at the end
|
||||||
}
|
}
|
||||||
set ::VM [sqlite_compile $::DB $::SQL ::SQL]
|
set VM [sqlite_compile $DB $SQL SQL]
|
||||||
set ::SQL
|
set SQL
|
||||||
} {
|
} {
|
||||||
SELECT name, rowid FROM sqlite_temp_master;
|
SELECT name, rowid FROM sqlite_temp_master;
|
||||||
-- A comment at the end
|
-- A comment at the end
|
||||||
}
|
}
|
||||||
do_test capi2-2.2 {
|
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
|
lappend r $n $val $colname
|
||||||
} {SQLITE_ROW 2 {t1 1} {name rowid text INTEGER}}
|
} {SQLITE_ROW 2 {t1 1} {name rowid text INTEGER}}
|
||||||
do_test capi2-2.3 {
|
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
|
lappend r $n $val $colname
|
||||||
} {SQLITE_DONE 2 {} {name rowid text INTEGER}}
|
} {SQLITE_DONE 2 {} {name rowid text INTEGER}}
|
||||||
do_test capi2-2.4 {
|
do_test capi2-2.4 {
|
||||||
sqlite_finalize $::VM
|
sqlite_finalize $VM
|
||||||
} {}
|
} {}
|
||||||
do_test capi2-2.5 {
|
do_test capi2-2.5 {
|
||||||
set ::VM [sqlite_compile $::DB $::SQL ::SQL]
|
set VM [sqlite_compile $DB $SQL SQL]
|
||||||
set ::SQL
|
set SQL
|
||||||
} {
|
} {
|
||||||
-- A comment at the end
|
-- A comment at the end
|
||||||
}
|
}
|
||||||
do_test capi2-2.6 {
|
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
|
lappend r $n $val $colname
|
||||||
} {SQLITE_DONE 2 {} {name rowid text INTEGER}}
|
} {SQLITE_DONE 2 {} {name rowid text INTEGER}}
|
||||||
do_test capi2-2.7 {
|
do_test capi2-2.7 {
|
||||||
sqlite_finalize $::VM
|
sqlite_finalize $VM
|
||||||
} {}
|
} {}
|
||||||
do_test capi2-2.8 {
|
do_test capi2-2.8 {
|
||||||
set ::VM [sqlite_compile $::DB $::SQL ::SQL]
|
set VM [sqlite_compile $DB $SQL SQL]
|
||||||
list $::SQL $::VM
|
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
|
finish_test
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
# This file implements tests for the conflict resolution extension
|
# This file implements tests for the conflict resolution extension
|
||||||
# to SQLite.
|
# 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]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@@ -288,7 +288,7 @@ foreach {i conf1 conf2 cmd t0 t1 t2} {
|
|||||||
22 REPLACE FAIL INSERT 0 5 1
|
22 REPLACE FAIL INSERT 0 5 1
|
||||||
23 IGNORE ROLLBACK INSERT 0 {} 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 {
|
do_test conflict-5.$i {
|
||||||
if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"}
|
if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"}
|
||||||
if {$conf2!=""} {set conf2 "ON CONFLICT $conf2"}
|
if {$conf2!=""} {set conf2 "ON CONFLICT $conf2"}
|
||||||
@@ -356,7 +356,7 @@ foreach {i conf1 conf2 cmd t0 t1 t2} {
|
|||||||
22 REPLACE FAIL UPDATE 0 {7 6 9} 1
|
22 REPLACE FAIL UPDATE 0 {7 6 9} 1
|
||||||
23 IGNORE ROLLBACK UPDATE 0 {6 7 3 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 {
|
do_test conflict-6.$i {
|
||||||
if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"}
|
if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"}
|
||||||
if {$conf2!=""} {set conf2 "ON CONFLICT $conf2"}
|
if {$conf2!=""} {set conf2 "ON CONFLICT $conf2"}
|
||||||
@@ -532,13 +532,13 @@ do_test conflict-9.5 {
|
|||||||
INSERT INTO t2 VALUES(3,1,3,3,3);
|
INSERT INTO t2 VALUES(3,1,3,3,3);
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test conflict-9.6 {
|
do_test conflict-9.6 {
|
||||||
catchsql {
|
catchsql {
|
||||||
UPDATE t2 SET b=b+1 WHERE b=1;
|
UPDATE t2 SET b=b+1 WHERE b=1;
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test conflict-9.7 {
|
do_test conflict-9.7 {
|
||||||
catchsql {
|
catchsql {
|
||||||
BEGIN;
|
BEGIN;
|
||||||
@@ -546,19 +546,19 @@ do_test conflict-9.7 {
|
|||||||
INSERT INTO t2 VALUES(3,1,3,3,3);
|
INSERT INTO t2 VALUES(3,1,3,3,3);
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test conflict-9.8 {
|
do_test conflict-9.8 {
|
||||||
execsql {COMMIT}
|
execsql {COMMIT}
|
||||||
execsql {SELECT * FROM t3}
|
execsql {SELECT * FROM t3}
|
||||||
} {2}
|
} {2}
|
||||||
do_test conflict-9.6 {
|
do_test conflict-9.9 {
|
||||||
catchsql {
|
catchsql {
|
||||||
BEGIN;
|
BEGIN;
|
||||||
UPDATE t3 SET x=x+1;
|
UPDATE t3 SET x=x+1;
|
||||||
UPDATE t2 SET b=b+1 WHERE b=1;
|
UPDATE t2 SET b=b+1 WHERE b=1;
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test conflict-9.10 {
|
do_test conflict-9.10 {
|
||||||
execsql {COMMIT}
|
execsql {COMMIT}
|
||||||
execsql {SELECT * FROM t3}
|
execsql {SELECT * FROM t3}
|
||||||
@@ -568,13 +568,13 @@ do_test conflict-9.11 {
|
|||||||
INSERT INTO t2 VALUES(3,3,3,1,3);
|
INSERT INTO t2 VALUES(3,3,3,1,3);
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test conflict-9.12 {
|
do_test conflict-9.12 {
|
||||||
catchsql {
|
catchsql {
|
||||||
UPDATE t2 SET d=d+1 WHERE d=1;
|
UPDATE t2 SET d=d+1 WHERE d=1;
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test conflict-9.13 {
|
do_test conflict-9.13 {
|
||||||
catchsql {
|
catchsql {
|
||||||
BEGIN;
|
BEGIN;
|
||||||
@@ -582,7 +582,7 @@ do_test conflict-9.13 {
|
|||||||
INSERT INTO t2 VALUES(3,3,3,1,3);
|
INSERT INTO t2 VALUES(3,3,3,1,3);
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test conflict-9.14 {
|
do_test conflict-9.14 {
|
||||||
execsql {COMMIT}
|
execsql {COMMIT}
|
||||||
execsql {SELECT * FROM t3}
|
execsql {SELECT * FROM t3}
|
||||||
@@ -594,7 +594,7 @@ do_test conflict-9.15 {
|
|||||||
UPDATE t2 SET d=d+1 WHERE d=1;
|
UPDATE t2 SET d=d+1 WHERE d=1;
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test conflict-9.16 {
|
do_test conflict-9.16 {
|
||||||
execsql {COMMIT}
|
execsql {COMMIT}
|
||||||
execsql {SELECT * FROM t3}
|
execsql {SELECT * FROM t3}
|
||||||
@@ -604,13 +604,13 @@ do_test conflict-9.17 {
|
|||||||
INSERT INTO t2 VALUES(3,3,3,3,1);
|
INSERT INTO t2 VALUES(3,3,3,3,1);
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test conflict-9.18 {
|
do_test conflict-9.18 {
|
||||||
catchsql {
|
catchsql {
|
||||||
UPDATE t2 SET e=e+1 WHERE e=1;
|
UPDATE t2 SET e=e+1 WHERE e=1;
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test conflict-9.19 {
|
do_test conflict-9.19 {
|
||||||
catchsql {
|
catchsql {
|
||||||
BEGIN;
|
BEGIN;
|
||||||
@@ -618,7 +618,7 @@ do_test conflict-9.19 {
|
|||||||
INSERT INTO t2 VALUES(3,3,3,3,1);
|
INSERT INTO t2 VALUES(3,3,3,3,1);
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test conflict-9.20 {
|
do_test conflict-9.20 {
|
||||||
catch {execsql {COMMIT}}
|
catch {execsql {COMMIT}}
|
||||||
execsql {SELECT * FROM t3}
|
execsql {SELECT * FROM t3}
|
||||||
@@ -630,7 +630,7 @@ do_test conflict-9.21 {
|
|||||||
UPDATE t2 SET e=e+1 WHERE e=1;
|
UPDATE t2 SET e=e+1 WHERE e=1;
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test conflict-9.22 {
|
do_test conflict-9.22 {
|
||||||
catch {execsql {COMMIT}}
|
catch {execsql {COMMIT}}
|
||||||
execsql {SELECT * FROM t3}
|
execsql {SELECT * FROM t3}
|
||||||
|
@@ -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 testing the COPY statement.
|
# 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]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@@ -196,7 +196,7 @@ do_test copy-5.2 {
|
|||||||
COPY t1 FROM 'data6.txt' USING DELIMITERS '|';
|
COPY t1 FROM 'data6.txt' USING DELIMITERS '|';
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test copy-5.3 {
|
do_test copy-5.3 {
|
||||||
set fd [open data6.txt w]
|
set fd [open data6.txt w]
|
||||||
puts $fd "33|22|44"
|
puts $fd "33|22|44"
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
# This file implements tests for the special processing associated
|
# This file implements tests for the special processing associated
|
||||||
# with INTEGER PRIMARY KEY columns.
|
# 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]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@@ -76,7 +76,7 @@ do_test intpkey-1.6 {
|
|||||||
INSERT INTO t1 VALUES(5,'second','entry');
|
INSERT INTO t1 VALUES(5,'second','entry');
|
||||||
}} msg]
|
}} msg]
|
||||||
lappend r $msg
|
lappend r $msg
|
||||||
} {1 {constraint failed}}
|
} {1 {PRIMARY KEY must be unique}}
|
||||||
do_test intpkey-1.7 {
|
do_test intpkey-1.7 {
|
||||||
execsql {
|
execsql {
|
||||||
SELECT rowid, * FROM t1;
|
SELECT rowid, * FROM t1;
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
# This file implements tests for miscellanous features that were
|
# This file implements tests for miscellanous features that were
|
||||||
# left out of other test files.
|
# 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]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@@ -222,7 +222,7 @@ do_test misc1-7.4 {
|
|||||||
catchsql {
|
catchsql {
|
||||||
INSERT INTO t5 VALUES(1,2,4);
|
INSERT INTO t5 VALUES(1,2,4);
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test misc1-7.5 {
|
do_test misc1-7.5 {
|
||||||
catchsql {
|
catchsql {
|
||||||
INSERT INTO t5 VALUES(0,2,4);
|
INSERT INTO t5 VALUES(0,2,4);
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
#
|
#
|
||||||
# This file implements tests for the NOT NULL constraint.
|
# 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]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@@ -42,7 +42,7 @@ do_test notnull-1.2 {
|
|||||||
INSERT INTO t1(b,c,d,e) VALUES(2,3,4,5);
|
INSERT INTO t1(b,c,d,e) VALUES(2,3,4,5);
|
||||||
SELECT * FROM t1 order by a;
|
SELECT * FROM t1 order by a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.a may not be NULL}}
|
||||||
do_test notnull-1.3 {
|
do_test notnull-1.3 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
@@ -56,14 +56,14 @@ do_test notnull-1.4 {
|
|||||||
INSERT OR REPLACE INTO t1(b,c,d,e) VALUES(2,3,4,5);
|
INSERT OR REPLACE INTO t1(b,c,d,e) VALUES(2,3,4,5);
|
||||||
SELECT * FROM t1 order by a;
|
SELECT * FROM t1 order by a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.a may not be NULL}}
|
||||||
do_test notnull-1.5 {
|
do_test notnull-1.5 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
INSERT OR ABORT INTO t1(b,c,d,e) VALUES(2,3,4,5);
|
INSERT OR ABORT INTO t1(b,c,d,e) VALUES(2,3,4,5);
|
||||||
SELECT * FROM t1 order by a;
|
SELECT * FROM t1 order by a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.a may not be NULL}}
|
||||||
do_test notnull-1.6 {
|
do_test notnull-1.6 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
@@ -98,7 +98,7 @@ do_test notnull-1.10 {
|
|||||||
INSERT INTO t1(a,b,c,d,e) VALUES(1,null,3,4,5);
|
INSERT INTO t1(a,b,c,d,e) VALUES(1,null,3,4,5);
|
||||||
SELECT * FROM t1 order by a;
|
SELECT * FROM t1 order by a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.b may not be NULL}}
|
||||||
do_test notnull-1.11 {
|
do_test notnull-1.11 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
@@ -140,14 +140,14 @@ do_test notnull-1.16 {
|
|||||||
INSERT OR ABORT INTO t1(a,b,c,d,e) VALUES(1,2,null,4,5);
|
INSERT OR ABORT INTO t1(a,b,c,d,e) VALUES(1,2,null,4,5);
|
||||||
SELECT * FROM t1 order by a;
|
SELECT * FROM t1 order by a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.c may not be NULL}}
|
||||||
do_test notnull-1.17 {
|
do_test notnull-1.17 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
INSERT OR ABORT INTO t1(a,b,c,d,e) VALUES(1,2,3,null,5);
|
INSERT OR ABORT INTO t1(a,b,c,d,e) VALUES(1,2,3,null,5);
|
||||||
SELECT * FROM t1 order by a;
|
SELECT * FROM t1 order by a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.d may not be NULL}}
|
||||||
do_test notnull-1.18 {
|
do_test notnull-1.18 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
@@ -168,7 +168,7 @@ do_test notnull-1.20 {
|
|||||||
INSERT INTO t1(a,b,c,d,e) VALUES(1,2,3,4,null);
|
INSERT INTO t1(a,b,c,d,e) VALUES(1,2,3,4,null);
|
||||||
SELECT * FROM t1 order by a;
|
SELECT * FROM t1 order by a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.e may not be NULL}}
|
||||||
do_test notnull-1.21 {
|
do_test notnull-1.21 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
@@ -184,7 +184,7 @@ do_test notnull-2.1 {
|
|||||||
UPDATE t1 SET a=null;
|
UPDATE t1 SET a=null;
|
||||||
SELECT * FROM t1 ORDER BY a;
|
SELECT * FROM t1 ORDER BY a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.a may not be NULL}}
|
||||||
do_test notnull-2.2 {
|
do_test notnull-2.2 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
@@ -192,7 +192,7 @@ do_test notnull-2.2 {
|
|||||||
UPDATE OR REPLACE t1 SET a=null;
|
UPDATE OR REPLACE t1 SET a=null;
|
||||||
SELECT * FROM t1 ORDER BY a;
|
SELECT * FROM t1 ORDER BY a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.a may not be NULL}}
|
||||||
do_test notnull-2.3 {
|
do_test notnull-2.3 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
@@ -208,7 +208,7 @@ do_test notnull-2.4 {
|
|||||||
UPDATE OR ABORT t1 SET a=null;
|
UPDATE OR ABORT t1 SET a=null;
|
||||||
SELECT * FROM t1 ORDER BY a;
|
SELECT * FROM t1 ORDER BY a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.a may not be NULL}}
|
||||||
do_test notnull-2.5 {
|
do_test notnull-2.5 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
@@ -216,7 +216,7 @@ do_test notnull-2.5 {
|
|||||||
UPDATE t1 SET b=null;
|
UPDATE t1 SET b=null;
|
||||||
SELECT * FROM t1 ORDER BY a;
|
SELECT * FROM t1 ORDER BY a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.b may not be NULL}}
|
||||||
do_test notnull-2.6 {
|
do_test notnull-2.6 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
@@ -256,7 +256,7 @@ do_test notnull-2.10 {
|
|||||||
UPDATE t1 SET e=null, a=b, b=a;
|
UPDATE t1 SET e=null, a=b, b=a;
|
||||||
SELECT * FROM t1 ORDER BY a;
|
SELECT * FROM t1 ORDER BY a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.e may not be NULL}}
|
||||||
|
|
||||||
do_test notnull-3.0 {
|
do_test notnull-3.0 {
|
||||||
execsql {
|
execsql {
|
||||||
@@ -281,7 +281,7 @@ do_test notnull-3.2 {
|
|||||||
INSERT INTO t1(b,c,d,e) VALUES(2,3,4,5);
|
INSERT INTO t1(b,c,d,e) VALUES(2,3,4,5);
|
||||||
SELECT * FROM t1 order by a;
|
SELECT * FROM t1 order by a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.a may not be NULL}}
|
||||||
do_test notnull-3.3 {
|
do_test notnull-3.3 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
@@ -295,14 +295,14 @@ do_test notnull-3.4 {
|
|||||||
INSERT OR REPLACE INTO t1(b,c,d,e) VALUES(2,3,4,5);
|
INSERT OR REPLACE INTO t1(b,c,d,e) VALUES(2,3,4,5);
|
||||||
SELECT * FROM t1 order by a;
|
SELECT * FROM t1 order by a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.a may not be NULL}}
|
||||||
do_test notnull-3.5 {
|
do_test notnull-3.5 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
INSERT OR ABORT INTO t1(b,c,d,e) VALUES(2,3,4,5);
|
INSERT OR ABORT INTO t1(b,c,d,e) VALUES(2,3,4,5);
|
||||||
SELECT * FROM t1 order by a;
|
SELECT * FROM t1 order by a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.a may not be NULL}}
|
||||||
do_test notnull-3.6 {
|
do_test notnull-3.6 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
@@ -337,7 +337,7 @@ do_test notnull-3.10 {
|
|||||||
INSERT INTO t1(a,b,c,d,e) VALUES(1,null,3,4,5);
|
INSERT INTO t1(a,b,c,d,e) VALUES(1,null,3,4,5);
|
||||||
SELECT * FROM t1 order by a;
|
SELECT * FROM t1 order by a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.b may not be NULL}}
|
||||||
do_test notnull-3.11 {
|
do_test notnull-3.11 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
@@ -379,14 +379,14 @@ do_test notnull-3.16 {
|
|||||||
INSERT OR ABORT INTO t1(a,b,c,d,e) VALUES(1,2,null,4,5);
|
INSERT OR ABORT INTO t1(a,b,c,d,e) VALUES(1,2,null,4,5);
|
||||||
SELECT * FROM t1 order by a;
|
SELECT * FROM t1 order by a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.c may not be NULL}}
|
||||||
do_test notnull-3.17 {
|
do_test notnull-3.17 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
INSERT OR ABORT INTO t1(a,b,c,d,e) VALUES(1,2,3,null,5);
|
INSERT OR ABORT INTO t1(a,b,c,d,e) VALUES(1,2,3,null,5);
|
||||||
SELECT * FROM t1 order by a;
|
SELECT * FROM t1 order by a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.d may not be NULL}}
|
||||||
do_test notnull-3.18 {
|
do_test notnull-3.18 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
@@ -407,7 +407,7 @@ do_test notnull-3.20 {
|
|||||||
INSERT INTO t1(a,b,c,d,e) VALUES(1,2,3,4,null);
|
INSERT INTO t1(a,b,c,d,e) VALUES(1,2,3,4,null);
|
||||||
SELECT * FROM t1 order by a;
|
SELECT * FROM t1 order by a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.e may not be NULL}}
|
||||||
do_test notnull-3.21 {
|
do_test notnull-3.21 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
@@ -423,7 +423,7 @@ do_test notnull-4.1 {
|
|||||||
UPDATE t1 SET a=null;
|
UPDATE t1 SET a=null;
|
||||||
SELECT * FROM t1 ORDER BY a;
|
SELECT * FROM t1 ORDER BY a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.a may not be NULL}}
|
||||||
do_test notnull-4.2 {
|
do_test notnull-4.2 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
@@ -431,7 +431,7 @@ do_test notnull-4.2 {
|
|||||||
UPDATE OR REPLACE t1 SET a=null;
|
UPDATE OR REPLACE t1 SET a=null;
|
||||||
SELECT * FROM t1 ORDER BY a;
|
SELECT * FROM t1 ORDER BY a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.a may not be NULL}}
|
||||||
do_test notnull-4.3 {
|
do_test notnull-4.3 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
@@ -447,7 +447,7 @@ do_test notnull-4.4 {
|
|||||||
UPDATE OR ABORT t1 SET a=null;
|
UPDATE OR ABORT t1 SET a=null;
|
||||||
SELECT * FROM t1 ORDER BY a;
|
SELECT * FROM t1 ORDER BY a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.a may not be NULL}}
|
||||||
do_test notnull-4.5 {
|
do_test notnull-4.5 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
@@ -455,7 +455,7 @@ do_test notnull-4.5 {
|
|||||||
UPDATE t1 SET b=null;
|
UPDATE t1 SET b=null;
|
||||||
SELECT * FROM t1 ORDER BY a;
|
SELECT * FROM t1 ORDER BY a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.b may not be NULL}}
|
||||||
do_test notnull-4.6 {
|
do_test notnull-4.6 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DELETE FROM t1;
|
DELETE FROM t1;
|
||||||
@@ -495,6 +495,6 @@ do_test notnull-4.10 {
|
|||||||
UPDATE t1 SET e=null, a=b, b=a;
|
UPDATE t1 SET e=null, a=b, b=a;
|
||||||
SELECT * FROM t1 ORDER BY a;
|
SELECT * FROM t1 ORDER BY a;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t1.e may not be NULL}}
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
@@ -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 testing the CREATE TABLE statement.
|
# 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]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@@ -385,7 +385,7 @@ do_test table-10.1 {
|
|||||||
CREATE TABLE t6(a REFERENCES t4(a) NOT NULL);
|
CREATE TABLE t6(a REFERENCES t4(a) NOT NULL);
|
||||||
INSERT INTO t6 VALUES(NULL);
|
INSERT INTO t6 VALUES(NULL);
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {t6.a may not be NULL}}
|
||||||
do_test table-10.2 {
|
do_test table-10.2 {
|
||||||
catchsql {
|
catchsql {
|
||||||
DROP TABLE t6;
|
DROP TABLE t6;
|
||||||
|
@@ -448,7 +448,7 @@ do_test trigger2-6.1b {
|
|||||||
catchsql {
|
catchsql {
|
||||||
INSERT OR ABORT INTO tbl values (2, 2, 3);
|
INSERT OR ABORT INTO tbl values (2, 2, 3);
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test trigger2-6.1c {
|
do_test trigger2-6.1c {
|
||||||
execsql {
|
execsql {
|
||||||
SELECT * from tbl;
|
SELECT * from tbl;
|
||||||
@@ -458,7 +458,7 @@ do_test trigger2-6.1d {
|
|||||||
catchsql {
|
catchsql {
|
||||||
INSERT OR FAIL INTO tbl values (2, 2, 3);
|
INSERT OR FAIL INTO tbl values (2, 2, 3);
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test trigger2-6.1e {
|
do_test trigger2-6.1e {
|
||||||
execsql {
|
execsql {
|
||||||
SELECT * from tbl;
|
SELECT * from tbl;
|
||||||
@@ -474,7 +474,7 @@ do_test trigger2-6.1g {
|
|||||||
catchsql {
|
catchsql {
|
||||||
INSERT OR ROLLBACK INTO tbl values (3, 2, 3);
|
INSERT OR ROLLBACK INTO tbl values (3, 2, 3);
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test trigger2-6.1h {
|
do_test trigger2-6.1h {
|
||||||
execsql {
|
execsql {
|
||||||
SELECT * from tbl;
|
SELECT * from tbl;
|
||||||
@@ -501,7 +501,7 @@ do_test trigger2-6.2b {
|
|||||||
catchsql {
|
catchsql {
|
||||||
UPDATE OR ABORT tbl SET a = 4 WHERE a = 1;
|
UPDATE OR ABORT tbl SET a = 4 WHERE a = 1;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test trigger2-6.2c {
|
do_test trigger2-6.2c {
|
||||||
execsql {
|
execsql {
|
||||||
SELECT * from tbl;
|
SELECT * from tbl;
|
||||||
@@ -511,7 +511,7 @@ do_test trigger2-6.2d {
|
|||||||
catchsql {
|
catchsql {
|
||||||
UPDATE OR FAIL tbl SET a = 4 WHERE a = 1;
|
UPDATE OR FAIL tbl SET a = 4 WHERE a = 1;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test trigger2-6.2e {
|
do_test trigger2-6.2e {
|
||||||
execsql {
|
execsql {
|
||||||
SELECT * from tbl;
|
SELECT * from tbl;
|
||||||
@@ -530,7 +530,7 @@ do_test trigger2-6.2g {
|
|||||||
catchsql {
|
catchsql {
|
||||||
UPDATE OR ROLLBACK tbl SET a = 4 WHERE a = 1;
|
UPDATE OR ROLLBACK tbl SET a = 4 WHERE a = 1;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test trigger2-6.2h {
|
do_test trigger2-6.2h {
|
||||||
execsql {
|
execsql {
|
||||||
SELECT * from tbl;
|
SELECT * from tbl;
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
# focus of this file is testing the CREATE UNIQUE INDEX statement,
|
# focus of this file is testing the CREATE UNIQUE INDEX statement,
|
||||||
# and primary keys, and the UNIQUE constraint on table columns
|
# 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]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@@ -47,7 +47,7 @@ do_test unique-1.3 {
|
|||||||
catchsql {
|
catchsql {
|
||||||
INSERT INTO t1(a,b,c) VALUES(1,3,4)
|
INSERT INTO t1(a,b,c) VALUES(1,3,4)
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test unique-1.4 {
|
do_test unique-1.4 {
|
||||||
execsql {
|
execsql {
|
||||||
SELECT * FROM t1 ORDER BY a;
|
SELECT * FROM t1 ORDER BY a;
|
||||||
@@ -57,7 +57,7 @@ do_test unique-1.5 {
|
|||||||
catchsql {
|
catchsql {
|
||||||
INSERT INTO t1(a,b,c) VALUES(3,2,4)
|
INSERT INTO t1(a,b,c) VALUES(3,2,4)
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test unique-1.6 {
|
do_test unique-1.6 {
|
||||||
execsql {
|
execsql {
|
||||||
SELECT * FROM t1 ORDER BY a;
|
SELECT * FROM t1 ORDER BY a;
|
||||||
@@ -97,7 +97,7 @@ do_test unique-2.3 {
|
|||||||
catchsql {
|
catchsql {
|
||||||
INSERT INTO t2 VALUES(1,5);
|
INSERT INTO t2 VALUES(1,5);
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test unique-2.4 {
|
do_test unique-2.4 {
|
||||||
catchsql {
|
catchsql {
|
||||||
SELECT * FROM t2 ORDER BY a
|
SELECT * FROM t2 ORDER BY a
|
||||||
@@ -123,7 +123,7 @@ do_test unique-2.8 {
|
|||||||
catchsql {
|
catchsql {
|
||||||
CREATE UNIQUE INDEX i2 ON t2(a);
|
CREATE UNIQUE INDEX i2 ON t2(a);
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {indexed columns are not unique}}
|
||||||
do_test unique-2.9 {
|
do_test unique-2.9 {
|
||||||
catchsql {
|
catchsql {
|
||||||
CREATE INDEX i2 ON t2(a);
|
CREATE INDEX i2 ON t2(a);
|
||||||
@@ -160,7 +160,7 @@ do_test unique-3.4 {
|
|||||||
INSERT INTO t3(a,b,c,d) VALUES(1,4,3,5);
|
INSERT INTO t3(a,b,c,d) VALUES(1,4,3,5);
|
||||||
SELECT * FROM t3 ORDER BY a,b,c,d;
|
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
|
# Make sure NULLs are distinct as far as the UNIQUE tests are
|
||||||
# concerned.
|
# concerned.
|
||||||
|
@@ -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 testing the UPDATE statement.
|
# 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]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@@ -439,7 +439,7 @@ do_test update-10.3 {
|
|||||||
UPDATE t1 SET a=1, e=10 WHERE f=7;
|
UPDATE t1 SET a=1, e=10 WHERE f=7;
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {PRIMARY KEY must be unique}}
|
||||||
do_test update-10.4 {
|
do_test update-10.4 {
|
||||||
catchsql {
|
catchsql {
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
@@ -456,7 +456,7 @@ do_test update-10.6 {
|
|||||||
UPDATE t1 SET b=2, e=12 WHERE f=7;
|
UPDATE t1 SET b=2, e=12 WHERE f=7;
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test update-10.7 {
|
do_test update-10.7 {
|
||||||
catchsql {
|
catchsql {
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
@@ -473,7 +473,7 @@ do_test update-10.9 {
|
|||||||
UPDATE t1 SET c=3, d=4, e=14 WHERE f=7;
|
UPDATE t1 SET c=3, d=4, e=14 WHERE f=7;
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
}
|
}
|
||||||
} {1 {constraint failed}}
|
} {1 {uniqueness constraint failed}}
|
||||||
do_test update-10.10 {
|
do_test update-10.10 {
|
||||||
catchsql {
|
catchsql {
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
|
Reference in New Issue
Block a user