OLD | NEW |
1 # 2003 April 4 | 1 # 2003 April 4 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 catchsql { | 780 catchsql { |
781 ATTACH 'test2.db' AS t2; | 781 ATTACH 'test2.db' AS t2; |
782 } | 782 } |
783 } {1 {database is locked}} | 783 } {1 {database is locked}} |
784 do_test attach-8.4 { | 784 do_test attach-8.4 { |
785 db errorcode | 785 db errorcode |
786 } {5} | 786 } {5} |
787 db2 close | 787 db2 close |
788 file delete -force test2.db | 788 file delete -force test2.db |
789 | 789 |
| 790 # Test that it is possible to attach the same database more than |
| 791 # once when not in shared-cache mode. That this is not possible in |
| 792 # shared-cache mode is tested in shared7.test. |
| 793 do_test attach-9.1 { |
| 794 file delete -force test4.db |
| 795 execsql { |
| 796 ATTACH 'test4.db' AS aux1; |
| 797 CREATE TABLE aux1.t1(a, b); |
| 798 INSERT INTO aux1.t1 VALUES(1, 2); |
| 799 ATTACH 'test4.db' AS aux2; |
| 800 SELECT * FROM aux2.t1; |
| 801 } |
| 802 } {1 2} |
| 803 do_test attach-9.2 { |
| 804 catchsql { |
| 805 BEGIN; |
| 806 INSERT INTO aux1.t1 VALUES(3, 4); |
| 807 INSERT INTO aux2.t1 VALUES(5, 6); |
| 808 } |
| 809 } {1 {database is locked}} |
| 810 do_test attach-9.3 { |
| 811 execsql { |
| 812 COMMIT; |
| 813 SELECT * FROM aux2.t1; |
| 814 } |
| 815 } {1 2 3 4} |
790 | 816 |
| 817 # Ticket [abe728bbc311d81334dae9762f0db87c07a98f79]. |
| 818 # Multi-database commit on an attached TEMP database. |
| 819 # |
| 820 do_test attach-10.1 { |
| 821 execsql { |
| 822 ATTACH '' AS noname; |
| 823 ATTACH ':memory:' AS inmem; |
| 824 BEGIN; |
| 825 CREATE TABLE noname.noname(x); |
| 826 CREATE TABLE inmem.inmem(y); |
| 827 CREATE TABLE main.main(z); |
| 828 COMMIT; |
| 829 SELECT name FROM noname.sqlite_master; |
| 830 SELECT name FROM inmem.sqlite_master; |
| 831 } |
| 832 } {noname inmem} |
| 833 do_test attach-10.2 { |
| 834 lrange [execsql { |
| 835 PRAGMA database_list; |
| 836 }] 9 end |
| 837 } {4 noname {} 5 inmem {}} |
791 finish_test | 838 finish_test |
OLD | NEW |