SQLite

Check-in [f66491ab2b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Remove an assert() that was failing if there were any open incremental blob handles when a statement transaction was rolled back. (CVS 5326)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f66491ab2ba3645d4e44e33ec6fa0ab94b2989be
User & Date: danielk1977 2008-06-28 15:33:25.000
Context
2008-06-30
07:53
Add a couple of tests to see if the new compound select optimizations work when the compound select is hidden inside a view. (CVS 5327) (check-in: 1a711249c2 user: danielk1977 tags: trunk)
2008-06-28
15:33
Remove an assert() that was failing if there were any open incremental blob handles when a statement transaction was rolled back. (CVS 5326) (check-in: f66491ab2b user: danielk1977 tags: trunk)
11:29
Added reminder message to terminate SQL statements with a semicolon on shell startup. This closes #3099. (CVS 5325) (check-in: 0ab0b030de user: mihailim tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/btree.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
** 2004 April 6
**
** 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.
**
*************************************************************************
** $Id: btree.c,v 1.469 2008/06/23 09:50:51 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
** Including a description of file format and an overview of operation.
*/
#include "btreeInt.h"












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
** 2004 April 6
**
** 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.
**
*************************************************************************
** $Id: btree.c,v 1.470 2008/06/28 15:33:25 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
** Including a description of file format and an overview of operation.
*/
#include "btreeInt.h"

2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
int sqlite3BtreeRollbackStmt(Btree *p){
  int rc = SQLITE_OK;
  BtShared *pBt = p->pBt;
  sqlite3BtreeEnter(p);
  pBt->db = p->db;
  if( pBt->inStmt && !pBt->readOnly ){
    rc = sqlite3PagerStmtRollback(pBt->pPager);
    assert( countWriteCursors(pBt)==0 );
    pBt->inStmt = 0;
  }
  sqlite3BtreeLeave(p);
  return rc;
}

/*







<







2686
2687
2688
2689
2690
2691
2692

2693
2694
2695
2696
2697
2698
2699
int sqlite3BtreeRollbackStmt(Btree *p){
  int rc = SQLITE_OK;
  BtShared *pBt = p->pBt;
  sqlite3BtreeEnter(p);
  pBt->db = p->db;
  if( pBt->inStmt && !pBt->readOnly ){
    rc = sqlite3PagerStmtRollback(pBt->pPager);

    pBt->inStmt = 0;
  }
  sqlite3BtreeLeave(p);
  return rc;
}

/*
Changes to test/incrblob2.test.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#    May you share freely, never taking more than you give.
#
#***********************************************************************
#
# Test that it is possible to have two open blob handles on a single
# blob object.
#
# $Id: incrblob2.test,v 1.7 2008/06/26 18:04:03 danielk1977 Exp $
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable {!autovacuum || !pragma || !incrblob} {
  finish_test







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#    May you share freely, never taking more than you give.
#
#***********************************************************************
#
# Test that it is possible to have two open blob handles on a single
# blob object.
#
# $Id: incrblob2.test,v 1.8 2008/06/28 15:33:26 danielk1977 Exp $
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable {!autovacuum || !pragma || !incrblob} {
  finish_test
349
350
351
352
353
354
355






356
357


358








359







360























361
362
363
  expr {[sqlite3_memory_highwater]<(5 * 1024 * 1024)}
} {1}

do_test incrblob2-7.5 {
  close $h
} {}







#do_test incrblob2-8.5 {
  #execsql BEGIN


  #db eval {SELECT * FROM t2} {








  #execsql "DROP TABLE t2"







  #}























#} {}

finish_test







>
>
>
>
>
>
|
|
>
>
|
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|


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
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
  expr {[sqlite3_memory_highwater]<(5 * 1024 * 1024)}
} {1}

do_test incrblob2-7.5 {
  close $h
} {}

#---------------------------------------------------------------------------
# The following tests, incrblob2-8.*, test that nothing terrible happens
# when a statement transaction is rolled back while there are open 
# incremental-blob handles. At one point an assert() was failing when
# this was attempted.
#
do_test incrblob2-8.1 {
  execsql BEGIN
  set h [db incrblob t2 B 1]
  set rc [catch {
    db eval {SELECT * FROM t2} { execsql "DROP TABLE t2" }
  } msg] 
  list $rc $msg
} {1 {database table is locked}}
do_test incrblob2-8.2 {
  close $h
  execsql COMMIT
} {}
do_test incrblob2-8.3 {
  execsql {
    CREATE TABLE t3(a INTEGER UNIQUE, b TEXT);
    INSERT INTO t3 VALUES(1, 'aaaaaaaaaaaaaaaaaaaa');
    INSERT INTO t3 VALUES(2, 'bbbbbbbbbbbbbbbbbbbb');
    INSERT INTO t3 VALUES(3, 'cccccccccccccccccccc');
    INSERT INTO t3 VALUES(4, 'dddddddddddddddddddd');
    INSERT INTO t3 VALUES(5, 'eeeeeeeeeeeeeeeeeeee');
  }
} {}
do_test incrblob2-8.4 {
  execsql BEGIN
  set h [db incrblob t3 b 3]
  sqlite3_blob_read $h 0 20
} {cccccccccccccccccccc}
do_test incrblob2-8.5 {
  catchsql {UPDATE t3 SET a = 6 WHERE a > 3}
} {1 {column a is not unique}}
do_test incrblob2-8.6 {
  catchsql {UPDATE t3 SET a = 6 WHERE a > 3}
} {1 {column a is not unique}}
do_test incrblob2-8.7 {
  sqlite3_blob_read $h 0 20
} {cccccccccccccccccccc}
do_test incrblob2-8.8 {
  catchsql {UPDATE t3 SET a = 6 WHERE a = 3 OR a = 5}
} {1 {column a is not unique}}
do_test incrblob2-8.9 {
  set rc [catch {sqlite3_blob_read $h 0 20} msg]
  list $rc $msg
} {1 SQLITE_ABORT}
do_test incrblob2-8.X {
  close $h
} {}

finish_test