/ Check-in [3cb910f0]
Login

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

Overview
Comment:Adjust savepoint.test so that it can deal with SQLITE_TEMP_STORE=3. (CVS 6163)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:3cb910f0ce116af3f291cb913b32abc89493bcc5
User & Date: drh 2009-01-11 00:18:38
Context
2009-01-11
00:42
In io.test, reset the connection after manually deleting the journal file, so that the connection does not continue to use the old deleted journal file. (CVS 6164) check-in: 1e79f4f9 user: drh tags: trunk
00:18
Adjust savepoint.test so that it can deal with SQLITE_TEMP_STORE=3. (CVS 6163) check-in: 3cb910f0 user: drh tags: trunk
2009-01-10
18:51
Do not run crash8.test as part of the "journaltest" permutation. crash8.test uses "PRAGMA synchronous=off", which is incompatible with journaltest. (CVS 6162) check-in: 5f184da6 user: danielk1977 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/savepoint.test.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
...
584
585
586
587
588
589
590







591
592
593
594
595
596
597
...
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
...
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
...
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
...
804
805
806
807
808
809
810
811
#
#    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: savepoint.test,v 1.10 2009/01/07 10:35:19 danielk1977 Exp $

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


#----------------------------------------------------------------------
# The following tests - savepoint-1.* - test that the SAVEPOINT, RELEASE
................................................................................
} {1 {cannot DETACH database within transaction}}
do_test savepoint-10.1.3 {
  execsql {
    RELEASE one;
    DETACH aux;
  }
} {}








do_test savepoint-10.2.1 {
  file delete -force test3.db
  file delete -force test2.db
  execsql {
    ATTACH 'test2.db' AS aux1;
    ATTACH 'test3.db' AS aux2;
................................................................................
    SELECT name FROM aux1.sqlite_master 
      UNION ALL
    SELECT name FROM aux2.sqlite_master;
  }
} {t1 t2 t3}
do_test savepoint-10.2.2 {
  execsql { PRAGMA lock_status }
} {main unlocked temp unlocked aux1 unlocked aux2 unlocked}

do_test savepoint-10.2.3 {
  execsql {
    SAVEPOINT one;
    INSERT INTO t1 VALUES(1, 2);
    PRAGMA lock_status;
  }
} {main reserved temp unlocked aux1 unlocked aux2 unlocked}
do_test savepoint-10.2.4 {
  execsql {
    INSERT INTO t3 VALUES(3, 4);
    PRAGMA lock_status;
  }
} {main reserved temp unlocked aux1 unlocked aux2 reserved}
do_test savepoint-10.2.5 {
  execsql {
    SAVEPOINT two;
    INSERT INTO t2 VALUES(5, 6);
    PRAGMA lock_status;
  }
} {main reserved temp unlocked aux1 reserved aux2 reserved}
do_test savepoint-10.2.6 {
  execsql { SELECT * FROM t2 }
} {5 6}
do_test savepoint-10.2.7 {
  execsql { ROLLBACK TO two }
  execsql { SELECT * FROM t2 }
} {}
do_test savepoint-10.2.8 {
  execsql { PRAGMA lock_status }
} {main reserved temp unlocked aux1 reserved aux2 reserved}
do_test savepoint-10.2.9 {
  execsql { SELECT 'a', * FROM t1 UNION ALL SELECT 'b', * FROM t3 }
} {a 1 2 b 3 4}
do_test savepoint-10.2.9 {
  execsql {
    INSERT INTO t2 VALUES(5, 6);
    RELEASE one;
................................................................................
    SELECT * FROM t1;
    SELECT * FROM t2;
    SELECT * FROM t3;
  }
} {1 2 5 6 3 4}
do_test savepoint-10.2.9 {
  execsql { PRAGMA lock_status }
} {main unlocked temp unlocked aux1 unlocked aux2 unlocked}

do_test savepoint-10.2.10 {
  execsql { 
    SAVEPOINT one;
      INSERT INTO t1 VALUES('a', 'b');
      SAVEPOINT two;
        INSERT INTO t2 VALUES('c', 'd');
................................................................................
    SELECT * FROM t1;
    SELECT * FROM t2;
    SELECT * FROM t3;
  }
} {1 2 5 6 3 4}
do_test savepoint-10.2.14 {
  execsql { PRAGMA lock_status }
} {main unlocked temp unlocked aux1 unlocked aux2 unlocked}

#-------------------------------------------------------------------------
# The following tests - savepoint-11.* - test the interaction of 
# savepoints and creating or dropping tables and indexes in 
# auto-vacuum mode.
# 
do_test savepoint-11.1 {
................................................................................
  sqlite3_get_autocommit db
} {1}
do_test savepoint-12.4 {
  execsql { SAVEPOINT one }
} {}

finish_test








|







 







>
>
>
>
>
>
>







 







|







|





|






|









|







 







|







 







|







 







<
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
...
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
...
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
...
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
...
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
...
811
812
813
814
815
816
817

#
#    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: savepoint.test,v 1.11 2009/01/11 00:18:38 drh Exp $

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


#----------------------------------------------------------------------
# The following tests - savepoint-1.* - test that the SAVEPOINT, RELEASE
................................................................................
} {1 {cannot DETACH database within transaction}}
do_test savepoint-10.1.3 {
  execsql {
    RELEASE one;
    DETACH aux;
  }
} {}

# The lock state of the TEMP database can vary if SQLITE_TEMP_STORE=3
# And the following set of tests is only really interested in the status
# of the aux1 and aux2 locks.  So record the current lock status of
# TEMP for use in the answers.
set templockstate [lindex [db eval {PRAGMA lock_status}] 3]


do_test savepoint-10.2.1 {
  file delete -force test3.db
  file delete -force test2.db
  execsql {
    ATTACH 'test2.db' AS aux1;
    ATTACH 'test3.db' AS aux2;
................................................................................
    SELECT name FROM aux1.sqlite_master 
      UNION ALL
    SELECT name FROM aux2.sqlite_master;
  }
} {t1 t2 t3}
do_test savepoint-10.2.2 {
  execsql { PRAGMA lock_status }
} [list main unlocked temp $templockstate aux1 unlocked aux2 unlocked]

do_test savepoint-10.2.3 {
  execsql {
    SAVEPOINT one;
    INSERT INTO t1 VALUES(1, 2);
    PRAGMA lock_status;
  }
} [list main reserved temp $templockstate aux1 unlocked aux2 unlocked]
do_test savepoint-10.2.4 {
  execsql {
    INSERT INTO t3 VALUES(3, 4);
    PRAGMA lock_status;
  }
} [list main reserved temp $templockstate aux1 unlocked aux2 reserved]
do_test savepoint-10.2.5 {
  execsql {
    SAVEPOINT two;
    INSERT INTO t2 VALUES(5, 6);
    PRAGMA lock_status;
  }
} [list main reserved temp $templockstate aux1 reserved aux2 reserved]
do_test savepoint-10.2.6 {
  execsql { SELECT * FROM t2 }
} {5 6}
do_test savepoint-10.2.7 {
  execsql { ROLLBACK TO two }
  execsql { SELECT * FROM t2 }
} {}
do_test savepoint-10.2.8 {
  execsql { PRAGMA lock_status }
} [list main reserved temp $templockstate aux1 reserved aux2 reserved]
do_test savepoint-10.2.9 {
  execsql { SELECT 'a', * FROM t1 UNION ALL SELECT 'b', * FROM t3 }
} {a 1 2 b 3 4}
do_test savepoint-10.2.9 {
  execsql {
    INSERT INTO t2 VALUES(5, 6);
    RELEASE one;
................................................................................
    SELECT * FROM t1;
    SELECT * FROM t2;
    SELECT * FROM t3;
  }
} {1 2 5 6 3 4}
do_test savepoint-10.2.9 {
  execsql { PRAGMA lock_status }
} [list main unlocked temp $templockstate aux1 unlocked aux2 unlocked]

do_test savepoint-10.2.10 {
  execsql { 
    SAVEPOINT one;
      INSERT INTO t1 VALUES('a', 'b');
      SAVEPOINT two;
        INSERT INTO t2 VALUES('c', 'd');
................................................................................
    SELECT * FROM t1;
    SELECT * FROM t2;
    SELECT * FROM t3;
  }
} {1 2 5 6 3 4}
do_test savepoint-10.2.14 {
  execsql { PRAGMA lock_status }
} [list main unlocked temp $templockstate aux1 unlocked aux2 unlocked]

#-------------------------------------------------------------------------
# The following tests - savepoint-11.* - test the interaction of 
# savepoints and creating or dropping tables and indexes in 
# auto-vacuum mode.
# 
do_test savepoint-11.1 {
................................................................................
  sqlite3_get_autocommit db
} {1}
do_test savepoint-12.4 {
  execsql { SAVEPOINT one }
} {}

finish_test