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

Unified Diff: third_party/sqlite/src/test/attach4.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/test/attach.test ('k') | third_party/sqlite/src/test/attachmalloc.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/attach4.test
diff --git a/third_party/sqlite/src/test/attach4.test b/third_party/sqlite/src/test/attach4.test
new file mode 100644
index 0000000000000000000000000000000000000000..f597f5d0358ed333061bda96e58f41bc0b45827c
--- /dev/null
+++ b/third_party/sqlite/src/test/attach4.test
@@ -0,0 +1,116 @@
+# 200 July 1
+#
+# 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.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library. The
+# focus of this script is attaching many database files to a single
+# connection.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+set testprefix attach4
+
+ifcapable !attach {
+ finish_test
+ return
+}
+
+puts "Testing with SQLITE_MAX_ATTACHED=$SQLITE_MAX_ATTACHED"
+
+set files {main test.db}
+for {set ii 0} {$ii < $SQLITE_MAX_ATTACHED} {incr ii} {
+ lappend files aux$ii "test.db$ii"
+}
+
+do_test 1.1 {
+ sqlite3_limit db SQLITE_LIMIT_ATTACHED -1
+} $SQLITE_MAX_ATTACHED
+
+do_test 1.2.1 {
+ db close
+ foreach {name f} $files { forcedelete $f }
+ sqlite3 db test.db
+
+ foreach {name f} $files {
+ if {$name == "main"} continue
+ execsql "ATTACH '$f' AS $name"
+ }
+
+ db eval {PRAGMA database_list} {
+ lappend L $name [file tail $file]
+ }
+ set L
+} $files
+
+do_catchsql_test 1.2.2 {
+ ATTACH 'x.db' AS next;
+} [list 1 "too many attached databases - max $SQLITE_MAX_ATTACHED"]
+
+do_test 1.3 {
+ execsql BEGIN;
+ foreach {name f} $files {
+ execsql "CREATE TABLE $name.tbl(x)"
+ execsql "INSERT INTO $name.tbl VALUES('$f')"
+ }
+ execsql COMMIT;
+} {}
+
+do_test 1.4 {
+ set L [list]
+ foreach {name f} $files {
+ lappend L $name [execsql "SELECT x FROM $name.tbl"]
+ }
+ set L
+} $files
+
+set L [list]
+set S ""
+foreach {name f} $files {
+ if {[permutation] == "journaltest"} {
+ lappend L delete
+ } else {
+ lappend L wal
+ }
+ append S "
+ PRAGMA $name.journal_mode = WAL;
+ UPDATE $name.tbl SET x = '$name';
+ "
+}
+do_execsql_test 1.5 $S $L
+
+do_test 1.6 {
+ set L [list]
+ foreach {name f} $files {
+ lappend L [execsql "SELECT x FROM $name.tbl"] $f
+ }
+ set L
+} $files
+
+do_test 1.7 {
+ execsql BEGIN;
+ foreach {name f} $files {
+ execsql "UPDATE $name.tbl SET x = '$f'"
+ }
+ execsql COMMIT;
+} {}
+
+do_test 1.8 {
+ set L [list]
+ foreach {name f} $files {
+ lappend L $name [execsql "SELECT x FROM $name.tbl"]
+ }
+ set L
+} $files
+
+db close
+foreach {name f} $files { forcedelete $f }
+
+finish_test
« no previous file with comments | « third_party/sqlite/src/test/attach.test ('k') | third_party/sqlite/src/test/attachmalloc.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698