/ Check-in [fb62f4e3]
Login

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

Overview
Comment:When rolling back a savepoint, reset the changeCountDone flag.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:fb62f4e3a7ceaa60ff6af2196ccf35b48759307e
User & Date: dan 2010-07-07 17:53:52
Context
2010-07-07
18:38
Add further test cases to savepoint.test. check-in: f825205d user: dan tags: trunk
17:53
When rolling back a savepoint, reset the changeCountDone flag. check-in: fb62f4e3 user: dan tags: trunk
16:51
When using MSVC to build test code, suppress the popup dialog when abort is called from the sqlite_abort() test function. check-in: 55d3d39f user: shaneh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/pager.c.

2542
2543
2544
2545
2546
2547
2548

2549
2550
2551
2552
2553
2554
2555
    }
  }

  /* Set the database size back to the value it was before the savepoint 
  ** being reverted was opened.
  */
  pPager->dbSize = pSavepoint ? pSavepoint->nOrig : pPager->dbOrigSize;


  if( !pSavepoint && pagerUseWal(pPager) ){
    return pagerRollbackWal(pPager);
  }

  /* Use pPager->journalOff as the effective size of the main rollback
  ** journal.  The actual file might be larger than this in







>







2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
    }
  }

  /* Set the database size back to the value it was before the savepoint 
  ** being reverted was opened.
  */
  pPager->dbSize = pSavepoint ? pSavepoint->nOrig : pPager->dbOrigSize;
  pPager->changeCountDone = pPager->tempFile;

  if( !pSavepoint && pagerUseWal(pPager) ){
    return pagerRollbackWal(pPager);
  }

  /* Use pPager->journalOff as the effective size of the main rollback
  ** journal.  The actual file might be larger than this in

Changes to test/savepoint.test.

9
10
11
12
13
14
15


16
17
18
19
20
21
22
...
901
902
903
904
905
906
907
908


























































909
#
#***********************************************************************
#
# $Id: savepoint.test,v 1.13 2009/07/18 08:30:45 danielk1977 Exp $

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



#----------------------------------------------------------------------
# The following tests - savepoint-1.* - test that the SAVEPOINT, RELEASE
# and ROLLBACK TO comands are correctly parsed, and that the auto-commit
# flag is correctly set and unset as a result.
#
do_test savepoint-1.1 {
................................................................................
          INSERT INTO t1 VALUES(15, 16);
        ROLLBACK TO s1;
      ROLLBACK;
      SELECT * FROM t1;
    }
  } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16}
}



























































finish_test







>
>







 








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
#
#***********************************************************************
#
# $Id: savepoint.test,v 1.13 2009/07/18 08:30:45 danielk1977 Exp $

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

#----------------------------------------------------------------------
# The following tests - savepoint-1.* - test that the SAVEPOINT, RELEASE
# and ROLLBACK TO comands are correctly parsed, and that the auto-commit
# flag is correctly set and unset as a result.
#
do_test savepoint-1.1 {
................................................................................
          INSERT INTO t1 VALUES(15, 16);
        ROLLBACK TO s1;
      ROLLBACK;
      SELECT * FROM t1;
    }
  } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16}
}

db close
file delete test.db
do_multiclient_test tn {
  do_test savepoint-14.$tn.1 {
    sql1 {
      CREATE TABLE foo(x);
      INSERT INTO foo VALUES(1);
      INSERT INTO foo VALUES(2);
    }
  
    sql2 {
      BEGIN;
        SELECT * FROM foo;
    }
  } {1 2}
  do_test savepoint-14.$tn.2 {
    sql1 {
      SAVEPOINT one;
      INSERT INTO foo VALUES(1);
    }
    csql1 { RELEASE one }
  } {1 {database is locked}}
  do_test savepoint-14.$tn.3 {
    sql1 { ROLLBACK TO one }
    sql2 { COMMIT }
    sql1 { RELEASE one }
  } {}

  do_test savepoint-14.$tn.4 {
    sql2 {
      BEGIN;
        SELECT * FROM foo;
    }
  } {1 2}
  do_test savepoint-14.$tn.5 {
    sql1 {
      SAVEPOINT one;
      INSERT INTO foo VALUES(1);
    }
    csql1 { RELEASE one }
  } {1 {database is locked}}
  do_test savepoint-14.$tn.6 {
    sql2 { COMMIT }
    sql1 {
      ROLLBACK TO one;
      INSERT INTO foo VALUES(3);
      INSERT INTO foo VALUES(4);
      INSERT INTO foo VALUES(5);
      RELEASE one;
    }
  } {}

  do_test savepoint-14.$tn.7 {
    sql2 { CREATE INDEX fooidx ON foo(x); }
    sql3 { PRAGMA integrity_check }
  } {ok}
}

finish_test