1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Perform updates in search order. Ticket #602. (CVS 1221)

FossilOrigin-Name: cf1cec74ae039cd7cbc8a1032d29f067dedb4210
This commit is contained in:
drh
2004-02-10 13:41:52 +00:00
parent 4bc058593b
commit fb044c1d1c
4 changed files with 84 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
C Fix\sfor\sticket\s#603.\s(CVS\s1220)
D 2004-02-10T13:19:35
C Perform\supdates\sin\ssearch\sorder.\s\sTicket\s#602.\s(CVS\s1221)
D 2004-02-10T13:41:52
F Makefile.in cfd75c46b335881999333a9e4b982fa8491f200b
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -61,7 +61,7 @@ F src/trigger.c ce83e017b407d046e909d05373d7f8ee70f9f7f9
F src/update.c 24260b4fda00c9726d27699a0561d53c0dccc397
F src/util.c 64995b5949a5d377629ffd2598747bc771cade1e
F src/vacuum.c 77485a64a6e4e358170f150fff681c1624a092b0
F src/vdbe.c 81aee8e52dad45d11d6bf1217d24dbb11652e4cb
F src/vdbe.c 546bb0a81686016380bab34db458c6e255a6dd23
F src/vdbe.h 3957844e46fea71fd030e78f6a3bd2f7e320fb43
F src/vdbeInt.h 8a3baf749115cba81a810b7a52208aef055eda7b
F src/vdbeaux.c c55d87d6658487e87ef09ca80c1aa2f314024fed
@@ -140,7 +140,7 @@ F test/trigger2.test 0767ab30cb5a2c8402c8524f3d566b410b6f5263
F test/trigger3.test a95ccace88291449f5eae7139ec438a42f90654d
F test/trigger4.test 542afce45774e8f8e1130b96b8675f414d6e4bd8
F test/unique.test 0e38d4cc7affeef2527720d1dafd1f6870f02f2b
F test/update.test 2ef5a6655f2966f0aef733a9f4495b3fe8e16809
F test/update.test b29bd9061a1150426dab6959806fcc73a41b1217
F test/vacuum.test 9447f1d7633b083c9b97f807fa05f9b27ada7503
F test/version.test 605fd0d7e7d571370c32b12dbf395b58953de246
F test/view.test 1ee12c6f8f4791a2c0655120d5562a49400cfe53
@@ -183,7 +183,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
P 9c6b4758a4b13a91f71be17751a76c0c14b4d4c3
R e70e91f6a291b1c18b8a920bc42f6278
P d0624d257789ac3f4cd3a7473bb741030c999b65
R ebe97ced16ef0c70fcbd5351d23e8ea5
U drh
Z 3d5a2564e13058b07959ec71127488ac
Z c5b53421362378360594d03b5da09dfe

View File

@@ -1 +1 @@
d0624d257789ac3f4cd3a7473bb741030c999b65
cf1cec74ae039cd7cbc8a1032d29f067dedb4210

View File

@@ -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.257 2004/02/08 18:07:35 drh Exp $
** $Id: vdbe.c,v 1.258 2004/02/10 13:41:52 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -3784,11 +3784,21 @@ case OP_ListWrite: {
/* Opcode: ListRewind * * *
**
** Rewind the temporary buffer back to the beginning. This is
** now a no-op.
** Rewind the temporary buffer back to the beginning.
*/
case OP_ListRewind: {
/* This is now a no-op */
/* What this opcode codes, really, is reverse the order of the
** linked list of Keylist structures so that they are read out
** in the same order that they were read in. */
Keylist *pRev, *pTop;
pRev = 0;
while( p->pList ){
pTop = p->pList;
p->pList = pTop->pNext;
pTop->pNext = pRev;
pRev = pTop;
}
p->pList = pRev;
break;
}

View File

@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the UPDATE statement.
#
# $Id: update.test,v 1.14 2003/08/05 13:13:39 drh Exp $
# $Id: update.test,v 1.15 2004/02/10 13:41:53 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -498,4 +498,65 @@ do_test update-11.2 {
integrity_check update-12.1
# Ticket 602. Updates should occur in the same order as the records
# were discovered in the WHERE clause.
#
do_test update-13.1 {
execsql {
BEGIN;
CREATE TABLE t2(a);
INSERT INTO t2 VALUES(1);
INSERT INTO t2 VALUES(2);
INSERT INTO t2 SELECT a+2 FROM t2;
INSERT INTO t2 SELECT a+4 FROM t2;
INSERT INTO t2 SELECT a+8 FROM t2;
INSERT INTO t2 SELECT a+16 FROM t2;
INSERT INTO t2 SELECT a+32 FROM t2;
INSERT INTO t2 SELECT a+64 FROM t2;
INSERT INTO t2 SELECT a+128 FROM t2;
INSERT INTO t2 SELECT a+256 FROM t2;
INSERT INTO t2 SELECT a+512 FROM t2;
INSERT INTO t2 SELECT a+1024 FROM t2;
COMMIT;
SELECT count(*) FROM t2;
}
} {2048}
do_test update-13.2 {
execsql {
SELECT count(*) FROM t2 WHERE a=rowid;
}
} {2048}
do_test update-13.3 {
execsql {
UPDATE t2 SET rowid=rowid-1;
SELECT count(*) FROM t2 WHERE a=rowid+1;
}
} {2048}
do_test update-13.3 {
execsql {
UPDATE t2 SET rowid=rowid+10000;
UPDATE t2 SET rowid=rowid-9999;
SELECT count(*) FROM t2 WHERE a=rowid;
}
} {2048}
do_test update-13.4 {
execsql {
BEGIN;
INSERT INTO t2 SELECT a+2048 FROM t2;
INSERT INTO t2 SELECT a+4096 FROM t2;
INSERT INTO t2 SELECT a+8192 FROM t2;
SELECT count(*) FROM t2 WHERE a=rowid;
COMMIT;
}
} 16384
do_test update-13.5 {
execsql {
UPDATE t2 SET rowid=rowid-1;
SELECT count(*) FROM t2 WHERE a=rowid+1;
}
} 16384
integrity_check update-13.6
finish_test