Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Have OP_IdxRowid handle the case where the index entry it is reading from is deleted. (CVS 6461) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
cdad29b582ca832f6a717d8a6e3f3bca |
User & Date: | danielk1977 2009-04-07 09:16:57.000 |
Context
2009-04-07
| ||
11:21 | Change "... myfunction() { ... }" to "... myfunction(void) { ... }" in a few pla ces. Ticket #3783. (CVS 6462) (check-in: 6f79e6ae0d user: danielk1977 tags: trunk) | |
09:16 | Have OP_IdxRowid handle the case where the index entry it is reading from is deleted. (CVS 6461) (check-in: cdad29b582 user: danielk1977 tags: trunk) | |
05:35 | Compile fixes and improvements for vxwork: fixed deadlock in semClose, detect if fcntl is usable, fall back to named semaphores if not. (CVS 6460) (check-in: efd0682b7e user: chw tags: trunk) | |
Changes
Changes to src/vdbe.c.
︙ | ︙ | |||
39 40 41 42 43 44 45 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** 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.830 2009/04/07 09:16:57 danielk1977 Exp $ */ #include "sqliteInt.h" #include "vdbeInt.h" /* ** The following global variable is incremented every time a cursor ** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test |
︙ | ︙ | |||
4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 | ** ** See also: Rowid, MakeRecord. */ case OP_IdxRowid: { /* out2-prerelease */ int i = pOp->p1; BtCursor *pCrsr; VdbeCursor *pC; assert( i>=0 && i<p->nCursor ); assert( p->apCsr[i]!=0 ); if( (pCrsr = (pC = p->apCsr[i])->pCursor)!=0 ){ i64 rowid; | > | > | 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 | ** ** See also: Rowid, MakeRecord. */ case OP_IdxRowid: { /* out2-prerelease */ int i = pOp->p1; BtCursor *pCrsr; VdbeCursor *pC; assert( i>=0 && i<p->nCursor ); assert( p->apCsr[i]!=0 ); if( (pCrsr = (pC = p->apCsr[i])->pCursor)!=0 ){ i64 rowid; rc = sqlite3VdbeCursorMoveto(pC); if( rc ) goto abort_due_to_error; assert( pC->deferredMoveto==0 ); assert( pC->isTable==0 ); if( !pC->nullRow ){ rc = sqlite3VdbeIdxRowid(pCrsr, &rowid); if( rc!=SQLITE_OK ){ goto abort_due_to_error; } |
︙ | ︙ |
Changes to test/delete.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2001 September 15 # # 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. The # focus of this file is testing the DELETE FROM statement. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2001 September 15 # # 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. The # focus of this file is testing the DELETE FROM statement. # # $Id: delete.test,v 1.25 2009/04/07 09:16:57 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Try to delete from a non-existant table. # do_test delete-1.1 { |
︙ | ︙ | |||
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | # -readonly flag is taken so seriously that a subsequent [file delete -force] # (required before the next test file can be executed) will fail. # catch {file attributes test.db -readonly 0} db close file delete -force test.db test.db-journal do_test delete-9.1 { sqlite3 db test.db execsql { CREATE TABLE t5(a, b); CREATE TABLE t6(c, d); INSERT INTO t5 VALUES(1, 2); INSERT INTO t5 VALUES(3, 4); INSERT INTO t5 VALUES(5, 6); INSERT INTO t6 VALUES('a', 'b'); INSERT INTO t6 VALUES('c', 'd'); | > > > > > > > < > > | > > > > > > | > > > | > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | # -readonly flag is taken so seriously that a subsequent [file delete -force] # (required before the next test file can be executed) will fail. # catch {file attributes test.db -readonly 0} db close file delete -force test.db test.db-journal # The following tests verify that SQLite correctly handles the case # where an index B-Tree is being scanned, the rowid column being read # from each index entry and another statement deletes some rows from # the index B-Tree. At one point this (obscure) scenario was causing # SQLite to return spurious SQLITE_CORRUPT errors and arguably incorrect # query results. # do_test delete-9.1 { sqlite3 db test.db execsql { CREATE TABLE t5(a, b); CREATE TABLE t6(c, d); INSERT INTO t5 VALUES(1, 2); INSERT INTO t5 VALUES(3, 4); INSERT INTO t5 VALUES(5, 6); INSERT INTO t6 VALUES('a', 'b'); INSERT INTO t6 VALUES('c', 'd'); CREATE INDEX i5 ON t5(a); CREATE INDEX i6 ON t6(c); } } {} do_test delete-9.2 { set res [list] db eval { SELECT t5.rowid AS r, c, d FROM t5, t6 ORDER BY a } { if {$r==2} { breakpoint ; db eval { DELETE FROM t5 } } lappend res $r $c $d } set res } {1 a b 1 c d 2 a b {} c d} do_test delete-9.3 { execsql { INSERT INTO t5 VALUES(1, 2); INSERT INTO t5 VALUES(3, 4); INSERT INTO t5 VALUES(5, 6); } set res [list] db eval { SELECT t5.rowid AS r, c, d FROM t5, t6 ORDER BY a } { if {$r==2} { breakpoint ; db eval { DELETE FROM t5 WHERE rowid = 2 } } lappend res $r $c $d } set res } {1 a b 1 c d 2 a b {} c d 3 a b 3 c d} do_test delete-9.4 { execsql { DELETE FROM t5; INSERT INTO t5 VALUES(1, 2); INSERT INTO t5 VALUES(3, 4); INSERT INTO t5 VALUES(5, 6); } set res [list] db eval { SELECT t5.rowid AS r, c, d FROM t5, t6 ORDER BY a } { if {$r==2} { breakpoint ; db eval { DELETE FROM t5 WHERE rowid = 1 } } lappend res $r $c $d } set res } {1 a b 1 c d 2 a b 2 c d 3 a b 3 c d} do_test delete-9.5 { execsql { DELETE FROM t5; INSERT INTO t5 VALUES(1, 2); INSERT INTO t5 VALUES(3, 4); INSERT INTO t5 VALUES(5, 6); } set res [list] db eval { SELECT t5.rowid AS r, c, d FROM t5, t6 ORDER BY a } { if {$r==2} { breakpoint ; db eval { DELETE FROM t5 WHERE rowid = 3 } } lappend res $r $c $d } set res } {1 a b 1 c d 2 a b 2 c d} finish_test |