mirror of
https://github.com/sqlite/sqlite.git
synced 2026-01-06 08:01:16 +03:00
Miscellaneous test coverage improvements. (CVS 4734)
FossilOrigin-Name: 720bc20a11275ffe139df9203f23e0683b9b4db1
This commit is contained in:
29
manifest
29
manifest
@@ -1,5 +1,5 @@
|
||||
C Remove\ssome\sunused\sbranches\sfrom\sinternal\sfunction\ssqlite3PagerDontRollback().\s(CVS\s4733)
|
||||
D 2008-01-21T13:04:35
|
||||
C Miscellaneous\stest\scoverage\simprovements.\s(CVS\s4734)
|
||||
D 2008-01-21T16:22:46
|
||||
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
|
||||
F Makefile.in 30789bf70614bad659351660d76b8e533f3340e9
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@@ -86,17 +86,17 @@ F src/btmutex.c 5d39da37c9d1282f3c6f9967afae6a34ee36b7ff
|
||||
F src/btree.c a3125bd53a4112f2f259af858ef2eff63e397c9b
|
||||
F src/btree.h 19dcf5ad23c17b98855da548e9a8e3eb4429d5eb
|
||||
F src/btreeInt.h 1c5a9da165718ef7de81e35ce9ab5d9ba9283f76
|
||||
F src/build.c 27a3be10a7186515915ac73c40667dc55beacbac
|
||||
F src/build.c deb031f71a1797de99db01ec2ffbd060722ce0c6
|
||||
F src/callback.c 77b302b0d41468dcda78c70e706e5b84577f0fa0
|
||||
F src/complete.c 4cf68fd75d60257524cbe74f87351b9848399131
|
||||
F src/date.c 8ce763c68143b1e8fb6f79dcfc8b801853c97017
|
||||
F src/delete.c 739ccbab8fa7478762bded5c9cc67f16a4d09dbe
|
||||
F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
|
||||
F src/expr.c 07318c7e5e3062e2d33314f72819ea420b210dc1
|
||||
F src/func.c a7f44eaca16faec54d50756168f1665958b16f25
|
||||
F src/func.c 8e3d0c59961dc403716767308ee764504179054b
|
||||
F src/hash.c 45a7005aac044b6c86bd7e49c44bc15d30006d6c
|
||||
F src/hash.h 031cd9f915aff27e12262cb9eb570ac1b8326b53
|
||||
F src/insert.c 969b543eedaeb3ec4cd52cd6931db94da67388c3
|
||||
F src/insert.c a741d7f0643f52995475d866004eb779578cd773
|
||||
F src/journal.c 807bed7a158979ac8d63953e1774e8d85bff65e2
|
||||
F src/legacy.c 4ac53191fad2e3c4d59bde1228879b2dc5a96d66
|
||||
F src/limits.h 71ab25f17e35e0a9f3f6f234b8ed49cc56731d35
|
||||
@@ -133,7 +133,7 @@ F src/printf.c eb27822ba2eec669161409ca31279a24c26ac910
|
||||
F src/random.c 02ef38b469237482f1ea14a78b2087cfbaec48bd
|
||||
F src/select.c 9fb094cc0c8acdcbf3581fdfc4490e997b5d1d1e
|
||||
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
|
||||
F src/shell.c 0691a3d52dc37cf6ac2f74838e5ff8ae1055ac9b
|
||||
F src/shell.c ca06cb687c40a8bff6307b5fad41a0e86a0f8558
|
||||
F src/sqlite.h.in 2a7e3776534bbe6ff2cdc058f3abebe91e7e429f
|
||||
F src/sqlite3ext.h a93f59cdee3638dc0c9c086f80df743a4e68c3cb
|
||||
F src/sqliteInt.h 9c3384439e402016037115ad143ed0c3adbd1c93
|
||||
@@ -168,7 +168,7 @@ F src/update.c 31edd9c9764e80753930bd5f9b43e0edb404636f
|
||||
F src/utf.c ef4b7d83bae533b76c3e1bf635b113fdad86a736
|
||||
F src/util.c deda8c5a400530e1c27c03619cc4cd1a06fc5281
|
||||
F src/vacuum.c 3f34f278809bf3eb0b62ec46ff779e9c385b28f0
|
||||
F src/vdbe.c 7d193674c491c28b670194862e108c976f5bf3ae
|
||||
F src/vdbe.c e7ec3089f1e2ee5ab47b66d2be940f4e8b0029a7
|
||||
F src/vdbe.h 58a7d931ffb704e034b2a725981cfa5bd406fad9
|
||||
F src/vdbeInt.h 835e6f0337ce89d705ef9a162338788808adc4b7
|
||||
F src/vdbeapi.c cb8c427a3ab646490c83204a98e94eff03ee2e89
|
||||
@@ -235,7 +235,7 @@ F test/collate8.test 7ed2461305ac959886a064dc1e3cf15e155a183f
|
||||
F test/collate9.test 0867eabc1222ab0bc308fc09a7fb30770334c3cd
|
||||
F test/collateA.test e86542420ef1b9fd98bbe6d857ea8eec20c177bb
|
||||
F test/colmeta.test 6505c73ab58796afcb7c89ba9f429d573fbc6e53
|
||||
F test/conflict.test 79b5214ef7a52f3e58a50ae5c60c37e7594d04e9
|
||||
F test/conflict.test bb29b052c60a1f7eb6382be77902061d1f305318
|
||||
F test/corrupt.test 18c7a995b1af76a8c8600b996257f2c7b7bff083
|
||||
F test/corrupt2.test 572f8df0303d0ce63ddad5c5c9101a83a345ae46
|
||||
F test/corrupt3.test 263e8bb04e2728df832fddf6973cf54c91db0c32
|
||||
@@ -263,6 +263,7 @@ F test/enc3.test adb01b50ca1084658437eb68987969e8fa409276
|
||||
F test/exclusive.test ebaf72ce9ff8f7ab3a09bf8f58fd65393dfff386
|
||||
F test/exclusive2.test d13bf66753dca46e61241d35d36ab7c868b0d313
|
||||
F test/exclusive3.test 0e49c35b7e7cb8e7280b4ce3f0359d30b207d2ff
|
||||
F test/exec.test e949714dc127eaa5ecc7d723efec1ec27118fdd7
|
||||
F test/expr.test 6e666e5f47fbe6c23295d8c9f2b6c28109bf9ba8
|
||||
F test/filefmt.test 053b622009fbbb74dd37921ffad374d852c13cd8
|
||||
F test/fkey1.test dcb4f28eb22d5141f15161d6bdca9a4f58c95729
|
||||
@@ -328,7 +329,7 @@ F test/in2.test b1f447f4f0f67e9f83ff931e7e2e30873f9ea055
|
||||
F test/in3.test 2f829007cc8d25d17b859f7fe882ef2bd2e2eb49
|
||||
F test/incrblob.test 854c23b7ff8dd3822f675936b22c094655b3c739
|
||||
F test/incrblob_err.test 5273097dc7c97f9b7008423a6ffd5c80d21923cb
|
||||
F test/incrvacuum.test 9f49457edc25229e43ed29849d4ce4c3e67387b0
|
||||
F test/incrvacuum.test 1a2b0bddc76629afeb41e3d8ea3e4563982d16b9
|
||||
F test/incrvacuum2.test a958e378c193c4012cb3787804d863487f1dfad1
|
||||
F test/incrvacuum_ioerr.test cb331403b8dea3c5bae6163861ff25037b0df56a
|
||||
F test/index.test cbf301cdb2da43e4eac636c3400c2439af1834ad
|
||||
@@ -337,7 +338,7 @@ F test/index3.test f66718cd92ce1216819d47e6a156755e4b2c4ca1
|
||||
F test/insert.test aef273dd1cee84cc92407469e6bd1b3cdcb76908
|
||||
F test/insert2.test 4f3a04d168c728ed5ec2c88842e772606c7ce435
|
||||
F test/insert3.test 9a4ef3526fd3cca8b05278020ec3100448b4c677
|
||||
F test/insert4.test 6919ddacd79c2cfeb9785b0f84217f9cb14853b5
|
||||
F test/insert4.test 6e382eaf7295a4463e6f29ea20fcd8e63d097eeb
|
||||
F test/insert5.test 509017213328147d3acdfa2c441bfd82362dda41
|
||||
F test/interrupt.test 42e7cf98646fd9cb4a3b131a93ed3c50b9e149f1
|
||||
F test/intpkey.test 537669fd535f62632ca64828e435b9e54e8d677f
|
||||
@@ -608,7 +609,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
||||
P 0bf4e7fefdbbf7be4e32195473563158f22f1869
|
||||
R 431eb43674e4abe644622d49d27f61d8
|
||||
U danielk1977
|
||||
Z 19f9e86a1ac105470be774b290b8b793
|
||||
P 3d4252b06b42151874ee437c3a484e818232a5c9
|
||||
R 0e6133fb44fd0259245f9422ed93f88d
|
||||
U drh
|
||||
Z 709a57783bc2736f970ed40cdf181568
|
||||
|
||||
@@ -1 +1 @@
|
||||
3d4252b06b42151874ee437c3a484e818232a5c9
|
||||
720bc20a11275ffe139df9203f23e0683b9b4db1
|
||||
12
src/build.c
12
src/build.c
@@ -22,7 +22,7 @@
|
||||
** COMMIT
|
||||
** ROLLBACK
|
||||
**
|
||||
** $Id: build.c,v 1.467 2008/01/17 16:22:15 drh Exp $
|
||||
** $Id: build.c,v 1.468 2008/01/21 16:22:46 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@@ -3206,15 +3206,7 @@ int sqlite3OpenTempDatabase(Parse *pParse){
|
||||
pParse->rc = rc;
|
||||
return 1;
|
||||
}
|
||||
if( db->flags & !db->autoCommit ){
|
||||
rc = sqlite3BtreeBeginTrans(db->aDb[1].pBt, 1);
|
||||
if( rc!=SQLITE_OK ){
|
||||
sqlite3ErrorMsg(pParse, "unable to get a write lock on "
|
||||
"the temporary database file");
|
||||
pParse->rc = rc;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
assert( (db->flags & SQLITE_InTrans)==0 || db->autoCommit );
|
||||
assert( db->aDb[1].pSchema );
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
|
||||
** All other code has file scope.
|
||||
**
|
||||
** $Id: func.c,v 1.182 2008/01/19 23:50:26 drh Exp $
|
||||
** $Id: func.c,v 1.183 2008/01/21 16:22:46 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@@ -1149,10 +1149,7 @@ static void test_auxdata(
|
||||
char *zAux = sqlite3_get_auxdata(pCtx, i);
|
||||
if( zAux ){
|
||||
zRet[i*2] = '1';
|
||||
if( strcmp(zAux, z) ){
|
||||
sqlite3_result_error(pCtx, "auxdata corruption", -1);
|
||||
return;
|
||||
}
|
||||
assert( strcmp(zAux,z)==0 );
|
||||
}else {
|
||||
zRet[i*2] = '0';
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
** This file contains C code routines that are called by the parser
|
||||
** to handle INSERT statements in SQLite.
|
||||
**
|
||||
** $Id: insert.c,v 1.226 2008/01/19 03:35:59 drh Exp $
|
||||
** $Id: insert.c,v 1.227 2008/01/21 16:22:46 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@@ -1113,9 +1113,7 @@ void sqlite3GenerateConstraintChecks(
|
||||
onError = OE_Abort;
|
||||
}
|
||||
|
||||
if( onError==OE_Replace && pTab->pIndex==0 ){
|
||||
seenReplace = 1;
|
||||
}else{
|
||||
if( onError!=OE_Replace || pTab->pIndex ){
|
||||
if( isUpdate ){
|
||||
j2 = sqlite3VdbeAddOp3(v, OP_Eq, regRowid, 0, regRowid-1);
|
||||
}
|
||||
@@ -1398,7 +1396,7 @@ static int xferCompatibleIndex(Index *pDest, Index *pSrc){
|
||||
return 0; /* Different sort orders */
|
||||
}
|
||||
if( pSrc->azColl[i]!=pDest->azColl[i] ){
|
||||
return 0; /* Different sort orders */
|
||||
return 0; /* Different collating sequences */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
14
src/shell.c
14
src/shell.c
@@ -12,7 +12,7 @@
|
||||
** This file contains code to implement the "sqlite" command line
|
||||
** utility for accessing SQLite databases.
|
||||
**
|
||||
** $Id: shell.c,v 1.173 2008/01/14 15:20:08 drh Exp $
|
||||
** $Id: shell.c,v 1.174 2008/01/21 16:22:46 drh Exp $
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -1154,13 +1154,13 @@ static int do_meta_command(char *zLine, struct callback_data *p){
|
||||
p->showHeader = 1;
|
||||
memset(p->colWidth,0,ArraySize(p->colWidth));
|
||||
p->colWidth[0] = 4; /* addr */
|
||||
p->colWidth[1] = 14; /* opcode */
|
||||
p->colWidth[2] = 10; /* P1 */
|
||||
p->colWidth[3] = 10; /* P2 */
|
||||
p->colWidth[4] = 10; /* P3 */
|
||||
p->colWidth[5] = 20; /* P4 */
|
||||
p->colWidth[1] = 13; /* opcode */
|
||||
p->colWidth[2] = 4; /* P1 */
|
||||
p->colWidth[3] = 4; /* P2 */
|
||||
p->colWidth[4] = 4; /* P3 */
|
||||
p->colWidth[5] = 13; /* P4 */
|
||||
p->colWidth[6] = 2; /* P5 */
|
||||
p->colWidth[7] = 7; /* Comment */
|
||||
p->colWidth[7] = 13; /* Comment */
|
||||
}else if (p->explainPrev.valid) {
|
||||
p->explainPrev.valid = 0;
|
||||
p->mode = p->explainPrev.mode;
|
||||
|
||||
107
src/vdbe.c
107
src/vdbe.c
@@ -43,7 +43,7 @@
|
||||
** in this file for details. If in doubt, do not deviate from existing
|
||||
** commenting and indentation practices when changing or adding code.
|
||||
**
|
||||
** $Id: vdbe.c,v 1.702 2008/01/19 23:50:26 drh Exp $
|
||||
** $Id: vdbe.c,v 1.703 2008/01/21 16:22:46 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@@ -1038,26 +1038,29 @@ case OP_Concat: { /* same as TK_CONCAT, in1, in2, out3 */
|
||||
|
||||
/* Opcode: Add P1 P2 P3 * *
|
||||
**
|
||||
** Add the value in P1 to the value in P2 and store the result in P3.
|
||||
** If either operand is NULL, the result is NULL.
|
||||
** Add the value in register P1 to the value in register P2
|
||||
** and store the result in regiser P3.
|
||||
** If either input is NULL, the result is NULL.
|
||||
*/
|
||||
/* Opcode: Multiply P1 P2 P3 * *
|
||||
**
|
||||
**
|
||||
** Multiply the value in P1 by the value in P2 and store the result in P3.
|
||||
** If either operand is NULL, the result is NULL.
|
||||
** Multiply the value in regiser P1 by the value in regiser P2
|
||||
** and store the result in register P3.
|
||||
** If either input is NULL, the result is NULL.
|
||||
*/
|
||||
/* Opcode: Subtract P1 P2 P3 * *
|
||||
**
|
||||
** Subtract the value in P1 from the value in P2 and store the result
|
||||
** in P3.
|
||||
** If either operand is NULL, the result is NULL.
|
||||
** Subtract the value in register P1 from the value in register P2
|
||||
** and store the result in register P3.
|
||||
** If either input is NULL, the result is NULL.
|
||||
*/
|
||||
/* Opcode: Divide P1 P2 P3 * *
|
||||
**
|
||||
** Divide the value in P1 by the value in P2 and store the result
|
||||
** in P3. If the value in P2 is zero, then the result is NULL.
|
||||
** If either operand is NULL, the result is NULL.
|
||||
** Divide the value in register P1 by the value in register P2
|
||||
** and store the result in register P3. If the value in register P2
|
||||
** is zero, then the result is NULL.
|
||||
** If either input is NULL, the result is NULL.
|
||||
*/
|
||||
/* Opcode: Remainder P1 P2 P3 * *
|
||||
**
|
||||
@@ -1262,27 +1265,27 @@ case OP_Function: {
|
||||
**
|
||||
** Take the bit-wise AND of the values in register P1 and P2 and
|
||||
** store the result in register P3.
|
||||
** If either operand is NULL, the result is NULL.
|
||||
** If either input is NULL, the result is NULL.
|
||||
*/
|
||||
/* Opcode: BitOr P1 P2 P3 * *
|
||||
**
|
||||
** Take the bit-wise OR of the values in register P1 and P2 and
|
||||
** store the result in register P3.
|
||||
** If either operand is NULL, the result is NULL.
|
||||
** If either input is NULL, the result is NULL.
|
||||
*/
|
||||
/* Opcode: ShiftLeft P1 P2 P3 * *
|
||||
**
|
||||
** Shift the integer value in register P2 to the left by the
|
||||
** number of bits specified by the integer in P1.
|
||||
** number of bits specified by the integer in regiser P1.
|
||||
** Store the result in register P3.
|
||||
** If either operand is NULL, the result is NULL.
|
||||
** If either input is NULL, the result is NULL.
|
||||
*/
|
||||
/* Opcode: ShiftRight P1 P2 P3 * *
|
||||
**
|
||||
** Shift the integer value in register P2 to the right by the
|
||||
** number of bits specified by the integer in P1.
|
||||
** number of bits specified by the integer in register P1.
|
||||
** Store the result in register P3.
|
||||
** If either operand is NULL, the result is NULL.
|
||||
** If either input is NULL, the result is NULL.
|
||||
*/
|
||||
case OP_BitAnd: /* same as TK_BITAND, in1, in2, out3 */
|
||||
case OP_BitOr: /* same as TK_BITOR, in1, in2, out3 */
|
||||
@@ -1311,7 +1314,7 @@ case OP_ShiftRight: { /* same as TK_RSHIFT, in1, in2, out3 */
|
||||
|
||||
/* Opcode: AddImm P1 P2 * * *
|
||||
**
|
||||
** Add P2 the value in register P1.
|
||||
** Add the constant P2 the value in register P1.
|
||||
** The result is always an integer.
|
||||
**
|
||||
** To force any register to be an integer, just add 0.
|
||||
@@ -1475,7 +1478,7 @@ case OP_ToInt: { /* same as TK_TO_INT, in1 */
|
||||
** Force the value in register P1 to be a floating point number.
|
||||
** If The value is currently an integer, convert it.
|
||||
** If the value is text or blob, try to convert it to an integer using the
|
||||
** equivalent of atoi() and store 0 if no such conversion is possible.
|
||||
** equivalent of atoi() and store 0.0 if no such conversion is possible.
|
||||
**
|
||||
** A NULL value is not changed by this routine. It remains NULL.
|
||||
*/
|
||||
@@ -1502,9 +1505,11 @@ case OP_ToReal: { /* same as TK_TO_REAL, in1 */
|
||||
**
|
||||
** The SQLITE_AFF_MASK portion of P5 must be an affinity character -
|
||||
** SQLITE_AFF_TEXT, SQLITE_AFF_INTEGER, and so forth. An attempt is made
|
||||
** to coerce both operands according to this affinity before the
|
||||
** to coerce both inputs according to this affinity before the
|
||||
** comparison is made. If the SQLITE_AFF_MASK is 0x00, then numeric
|
||||
** affinity is used.
|
||||
** affinity is used. Note that the affinity conversions are stored
|
||||
** back into the input registers P1 and P3. So this opcode can cause
|
||||
** persistent changes to registers P1 and P3.
|
||||
**
|
||||
** Once any conversions have taken place, and neither value is NULL,
|
||||
** the values are compared. If both values are blobs then memcmp() is
|
||||
@@ -1704,22 +1709,6 @@ case OP_BitNot: { /* same as TK_BITNOT, in1 */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Opcode: Noop * * * * *
|
||||
**
|
||||
** Do nothing. This instruction is often useful as a jump
|
||||
** destination.
|
||||
*/
|
||||
/*
|
||||
** The magic Explain opcode are only inserted when explain==2 (which
|
||||
** is to say when the EXPLAIN QUERY PLAN syntax is used.)
|
||||
** This opcode records information from the optimizer. It is the
|
||||
** the same as a no-op. This opcodesnever appears in a real VM program.
|
||||
*/
|
||||
case OP_Explain:
|
||||
case OP_Noop: {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Opcode: If P1 P2 P3 * *
|
||||
**
|
||||
** Jump to P2 if the value in register P1 is true. The value is
|
||||
@@ -2280,7 +2269,8 @@ case OP_AutoCommit: {
|
||||
**
|
||||
** P1 is the index of the database file on which the transaction is
|
||||
** started. Index 0 is the main database file and index 1 is the
|
||||
** file used for temporary tables.
|
||||
** file used for temporary tables. Indices of 2 or more are used for
|
||||
** attached databases.
|
||||
**
|
||||
** If P2 is non-zero, then a write-transaction is started. A RESERVED lock is
|
||||
** obtained on the database file when a write-transaction is started. No
|
||||
@@ -2452,8 +2442,9 @@ case OP_VerifyCookie: {
|
||||
**
|
||||
** Open a read-only cursor for the database table whose root page is
|
||||
** P2 in a database file. The database file is determined by P3.
|
||||
** P3==0 means the main database and P3==1 means the database used for
|
||||
** temporary tables. Give the new cursor an identifier of P1. The P1
|
||||
** P3==0 means the main database, P3==1 means the database used for
|
||||
** temporary tables, and P3>1 means used the corresponding attached
|
||||
** database. Give the new cursor an identifier of P1. The P1
|
||||
** values need not be contiguous but all P1 values should be small integers.
|
||||
** It is an error for P1 to be negative.
|
||||
**
|
||||
@@ -3570,6 +3561,8 @@ case OP_Rewind: { /* jump */
|
||||
** to the following instruction. But if the cursor advance was successful,
|
||||
** jump immediately to P2.
|
||||
**
|
||||
** The P1 cursor must be for a real table, not a pseudo-table.
|
||||
**
|
||||
** See also: Prev
|
||||
*/
|
||||
/* Opcode: Prev P1 P2 * * *
|
||||
@@ -3578,11 +3571,14 @@ case OP_Rewind: { /* jump */
|
||||
** table or index. If there is no previous key/value pairs then fall through
|
||||
** to the following instruction. But if the cursor backup was successful,
|
||||
** jump immediately to P2.
|
||||
**
|
||||
** The P1 cursor must be for a real table, not a pseudo-table.
|
||||
*/
|
||||
case OP_Prev: /* jump */
|
||||
case OP_Next: { /* jump */
|
||||
Cursor *pC;
|
||||
BtCursor *pCrsr;
|
||||
int res;
|
||||
|
||||
CHECK_FOR_INTERRUPT;
|
||||
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
|
||||
@@ -3590,25 +3586,22 @@ case OP_Next: { /* jump */
|
||||
if( pC==0 ){
|
||||
break; /* See ticket #2273 */
|
||||
}
|
||||
if( (pCrsr = pC->pCursor)!=0 ){
|
||||
int res;
|
||||
if( pC->nullRow ){
|
||||
res = 1;
|
||||
}else{
|
||||
assert( pC->deferredMoveto==0 );
|
||||
rc = pOp->opcode==OP_Next ? sqlite3BtreeNext(pCrsr, &res) :
|
||||
sqlite3BtreePrevious(pCrsr, &res);
|
||||
pC->nullRow = res;
|
||||
pC->cacheStatus = CACHE_STALE;
|
||||
}
|
||||
pCrsr = pC->pCursor;
|
||||
assert( pCrsr );
|
||||
if( pC->nullRow ){
|
||||
res = 1;
|
||||
}else{
|
||||
assert( pC->deferredMoveto==0 );
|
||||
rc = pOp->opcode==OP_Next ? sqlite3BtreeNext(pCrsr, &res) :
|
||||
sqlite3BtreePrevious(pCrsr, &res);
|
||||
pC->nullRow = res;
|
||||
pC->cacheStatus = CACHE_STALE;
|
||||
if( res==0 ){
|
||||
pc = pOp->p2 - 1;
|
||||
#ifdef SQLITE_TEST
|
||||
sqlite3_search_count++;
|
||||
#endif
|
||||
}
|
||||
}else{
|
||||
pC->nullRow = 1;
|
||||
}
|
||||
pC->rowidIsValid = 0;
|
||||
break;
|
||||
@@ -3987,12 +3980,12 @@ case OP_DropTrigger: {
|
||||
** If no problems are found, store a NULL in register P1.
|
||||
**
|
||||
** The register P3 contains the maximum number of allowed errors.
|
||||
** At most reg[P3] errors will be reported.
|
||||
** In other words, the analysis stops as soon as reg[P1] errors are
|
||||
** seen. Reg[P1] is updated with the number of errors remaining.
|
||||
** At most reg(P3) errors will be reported.
|
||||
** In other words, the analysis stops as soon as reg(P1) errors are
|
||||
** seen. Reg(P1) is updated with the number of errors remaining.
|
||||
**
|
||||
** The root page numbers of all tables in the database are integer
|
||||
** stored in reg[P1], reg[P1+1], reg[P1+2], .... There are P2 tables
|
||||
** stored in reg(P1), reg(P1+1), reg(P1+2), .... There are P2 tables
|
||||
** total.
|
||||
**
|
||||
** If P5 is not zero, the check is done on the auxiliary database
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# This file implements tests for the conflict resolution extension
|
||||
# to SQLite.
|
||||
#
|
||||
# $Id: conflict.test,v 1.30 2007/08/21 14:27:02 danielk1977 Exp $
|
||||
# $Id: conflict.test,v 1.31 2008/01/21 16:22:46 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -759,5 +759,34 @@ do_test conflict-11.5 {
|
||||
} {1 2 3 7 8 9}
|
||||
integrity_check conflict-11.6
|
||||
|
||||
# Make sure UPDATE OR REPLACE works on tables that have only
|
||||
# an INTEGER PRIMARY KEY.
|
||||
#
|
||||
do_test conflict-12.1 {
|
||||
execsql {
|
||||
CREATE TABLE t5(a INTEGER PRIMARY KEY, b text);
|
||||
INSERT INTO t5 VALUES(1,'one');
|
||||
INSERT INTO t5 VALUES(2,'two');
|
||||
SELECT * FROM t5
|
||||
}
|
||||
} {1 one 2 two}
|
||||
do_test conflict-12.2 {
|
||||
execsql {
|
||||
UPDATE OR IGNORE t5 SET a=a+1 WHERE a=1;
|
||||
SELECT * FROM t5;
|
||||
}
|
||||
} {1 one 2 two}
|
||||
do_test conflict-12.3 {
|
||||
catchsql {
|
||||
UPDATE t5 SET a=a+1 WHERE a=1;
|
||||
}
|
||||
} {1 {PRIMARY KEY must be unique}}
|
||||
do_test conflict-12.4 {
|
||||
execsql {
|
||||
UPDATE OR REPLACE t5 SET a=a+1 WHERE a=1;
|
||||
SELECT * FROM t5;
|
||||
}
|
||||
} {2 one}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
37
test/exec.test
Normal file
37
test/exec.test
Normal file
@@ -0,0 +1,37 @@
|
||||
# 2008 Jan 21
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library.
|
||||
#
|
||||
# This file implements tests for the sqlite3_exec interface
|
||||
#
|
||||
# $Id: exec.test,v 1.1 2008/01/21 16:22:46 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
do_test exec-1.1 {
|
||||
execsql {
|
||||
CREATE TABLE t1(a,b);
|
||||
INSERT INTO t1 VALUES(1,2);
|
||||
SELECT * FROM t1;
|
||||
}
|
||||
} {1 2}
|
||||
do_test exec-1.2 {
|
||||
sqlite3_exec db {/* comment */;;; SELECT * FROM t1; /* comment */}
|
||||
} {0 {a b 1 2}}
|
||||
do_test exec-1.3 {
|
||||
sqlite3 db2 test.db
|
||||
db2 eval {CREATE TABLE t2(x, y);}
|
||||
db2 close
|
||||
sqlite3_exec db {SELECT * FROM t1}
|
||||
} {0 {a b 1 2}}
|
||||
|
||||
finish_test
|
||||
@@ -14,7 +14,7 @@
|
||||
# Note: There are also some tests for incremental vacuum and IO
|
||||
# errors in incrvacuum_ioerr.test.
|
||||
#
|
||||
# $Id: incrvacuum.test,v 1.17 2008/01/19 20:11:26 drh Exp $
|
||||
# $Id: incrvacuum.test,v 1.18 2008/01/21 16:22:46 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -712,5 +712,20 @@ do_test incrvacuum-13.5 {
|
||||
}
|
||||
} {0}
|
||||
|
||||
|
||||
# Verify that the incremental_vacuum pragma fails gracefully if it
|
||||
# is used against an invalid database file.
|
||||
#
|
||||
do_test incrvacuum-14.1 {
|
||||
set out [open invalid.db w]
|
||||
puts $out "This is not an SQLite database file"
|
||||
close $out
|
||||
sqlite3 db3 invalid.db
|
||||
catchsql {
|
||||
PRAGMA incremental_vacuum(10);
|
||||
} db3
|
||||
} {1 {file is encrypted or is not a database}}
|
||||
|
||||
db2 close
|
||||
db3 close
|
||||
finish_test
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the INSERT transfer optimization.
|
||||
#
|
||||
# $Id: insert4.test,v 1.9 2007/11/12 15:29:19 danielk1977 Exp $
|
||||
# $Id: insert4.test,v 1.10 2008/01/21 16:22:46 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -264,13 +264,42 @@ do_test insert4-5.2 {
|
||||
} {1 {table t4 has 2 columns but 3 values were supplied}}
|
||||
|
||||
do_test insert4-6.1 {
|
||||
set ::sqlite3_xferopt_count 0
|
||||
execsql {
|
||||
CREATE INDEX t2_i2 ON t2(x, y COLLATE nocase);
|
||||
CREATE INDEX t2_i1 ON t2(x ASC, y DESC);
|
||||
CREATE INDEX t3_i1 ON t3(a, b);
|
||||
INSERT INTO t2 SELECT * FROM t3;
|
||||
}
|
||||
} {}
|
||||
set ::sqlite3_xferopt_count
|
||||
} {0}
|
||||
do_test insert4-6.2 {
|
||||
set ::sqlite3_xferopt_count 0
|
||||
execsql {
|
||||
DROP INDEX t2_i2;
|
||||
INSERT INTO t2 SELECT * FROM t3;
|
||||
}
|
||||
set ::sqlite3_xferopt_count
|
||||
} {0}
|
||||
do_test insert4-6.3 {
|
||||
set ::sqlite3_xferopt_count 0
|
||||
execsql {
|
||||
DROP INDEX t2_i1;
|
||||
CREATE INDEX t2_i1 ON t2(x ASC, y ASC);
|
||||
INSERT INTO t2 SELECT * FROM t3;
|
||||
}
|
||||
set ::sqlite3_xferopt_count
|
||||
} {1}
|
||||
do_test insert4-6.4 {
|
||||
set ::sqlite3_xferopt_count 0
|
||||
execsql {
|
||||
DROP INDEX t2_i1;
|
||||
CREATE INDEX t2_i1 ON t2(x ASC, y COLLATE RTRIM);
|
||||
INSERT INTO t2 SELECT * FROM t3;
|
||||
}
|
||||
set ::sqlite3_xferopt_count
|
||||
} {0}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user