Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: third_party/sqlite/src/test/attach.test

Issue 6990047: Import SQLite 3.7.6.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/sqlite/src/test/async4.test ('k') | third_party/sqlite/src/test/attach4.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 catchsql { 145 catchsql {
146 ATTACH 'test.db' as MAIN; 146 ATTACH 'test.db' as MAIN;
147 } 147 }
148 } {1 {database MAIN is already in use}} 148 } {1 {database MAIN is already in use}}
149 do_test attach-1.18 { 149 do_test attach-1.18 {
150 catchsql { 150 catchsql {
151 ATTACH 'test.db' as db10; 151 ATTACH 'test.db' as db10;
152 ATTACH 'test.db' as db11; 152 ATTACH 'test.db' as db11;
153 } 153 }
154 } {0 {}} 154 } {0 {}}
155 do_test attach-1.19 { 155 if {$SQLITE_MAX_ATTACHED==10} {
156 catchsql { 156 do_test attach-1.19 {
157 ATTACH 'test.db' as db12; 157 catchsql {
158 } 158 ATTACH 'test.db' as db12;
159 } {1 {too many attached databases - max 10}} 159 }
160 do_test attach-1.19.1 { 160 } {1 {too many attached databases - max 10}}
161 db errorcode 161 do_test attach-1.19.1 {
162 } {1} 162 db errorcode
163 } {1}
164 }
163 do_test attach-1.20.1 { 165 do_test attach-1.20.1 {
164 execsql { 166 execsql {
165 DETACH db5; 167 DETACH db5;
166 } 168 }
167 } {} 169 } {}
168 ifcapable schema_pragmas { 170 ifcapable schema_pragmas {
169 do_test attach-1.20.2 { 171 do_test attach-1.20.2 {
170 db_list db 172 db_list db
171 } {0 main 2 db2 3 db3 4 db4 5 db6 6 db7 7 db8 8 db9 9 db10 10 db11} 173 } {0 main 2 db2 3 db3 4 db4 5 db6 6 db7 7 db8 8 db9 9 db10 10 db11}
172 } ;# ifcapable schema_pragmas 174 } ;# ifcapable schema_pragmas
173 integrity_check attach-1.20.3 175 integrity_check attach-1.20.3
174 ifcapable tempdb { 176 ifcapable tempdb {
175 execsql {select * from sqlite_temp_master} 177 execsql {select * from sqlite_temp_master}
176 } 178 }
177 do_test attach-1.21 { 179 do_test attach-1.21 {
178 catchsql { 180 catchsql {
179 ATTACH 'test.db' as db12; 181 ATTACH 'test.db' as db12;
180 } 182 }
181 } {0 {}} 183 } {0 {}}
182 do_test attach-1.22 { 184 if {$SQLITE_MAX_ATTACHED==10} {
183 catchsql { 185 do_test attach-1.22 {
184 ATTACH 'test.db' as db13; 186 catchsql {
185 } 187 ATTACH 'test.db' as db13;
186 } {1 {too many attached databases - max 10}} 188 }
187 do_test attach-1.22.1 { 189 } {1 {too many attached databases - max 10}}
188 db errorcode 190 do_test attach-1.22.1 {
189 } {1} 191 db errorcode
192 } {1}
193 }
190 do_test attach-1.23 { 194 do_test attach-1.23 {
191 catchsql { 195 catchsql {
192 DETACH "db14"; 196 DETACH "db14";
193 } 197 }
194 } {1 {no such database: db14}} 198 } {1 {no such database: db14}}
195 do_test attach-1.24 { 199 do_test attach-1.24 {
196 catchsql { 200 catchsql {
197 DETACH db12; 201 DETACH db12;
198 } 202 }
199 } {0 {}} 203 } {0 {}}
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 catchsql { 784 catchsql {
781 ATTACH 'test2.db' AS t2; 785 ATTACH 'test2.db' AS t2;
782 } 786 }
783 } {1 {database is locked}} 787 } {1 {database is locked}}
784 do_test attach-8.4 { 788 do_test attach-8.4 {
785 db errorcode 789 db errorcode
786 } {5} 790 } {5}
787 db2 close 791 db2 close
788 file delete -force test2.db 792 file delete -force test2.db
789 793
794 # Test that it is possible to attach the same database more than
795 # once when not in shared-cache mode. That this is not possible in
796 # shared-cache mode is tested in shared7.test.
797 do_test attach-9.1 {
798 file delete -force test4.db
799 execsql {
800 ATTACH 'test4.db' AS aux1;
801 CREATE TABLE aux1.t1(a, b);
802 INSERT INTO aux1.t1 VALUES(1, 2);
803 ATTACH 'test4.db' AS aux2;
804 SELECT * FROM aux2.t1;
805 }
806 } {1 2}
807 do_test attach-9.2 {
808 catchsql {
809 BEGIN;
810 INSERT INTO aux1.t1 VALUES(3, 4);
811 INSERT INTO aux2.t1 VALUES(5, 6);
812 }
813 } {1 {database is locked}}
814 do_test attach-9.3 {
815 execsql {
816 COMMIT;
817 SELECT * FROM aux2.t1;
818 }
819 } {1 2 3 4}
820
821 # Ticket [abe728bbc311d81334dae9762f0db87c07a98f79].
822 # Multi-database commit on an attached TEMP database.
823 #
824 do_test attach-10.1 {
825 execsql {
826 ATTACH '' AS noname;
827 ATTACH ':memory:' AS inmem;
828 BEGIN;
829 CREATE TABLE noname.noname(x);
830 CREATE TABLE inmem.inmem(y);
831 CREATE TABLE main.main(z);
832 COMMIT;
833 SELECT name FROM noname.sqlite_master;
834 SELECT name FROM inmem.sqlite_master;
835 }
836 } {noname inmem}
837 do_test attach-10.2 {
838 lrange [execsql {
839 PRAGMA database_list;
840 }] 9 end
841 } {4 noname {} 5 inmem {}}
790 842
791 finish_test 843 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/async4.test ('k') | third_party/sqlite/src/test/attach4.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698