| OLD | NEW |
| 1 # 2009 April 30 | 1 # 2009 April 30 |
| 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 #*********************************************************************** |
| 11 # | 11 # |
| 12 # Make sure that attaching the same database multiple times in | 12 # Make sure that attaching the same database multiple times in |
| 13 # shared cache mode fails. | 13 # shared cache mode fails. |
| 14 # | 14 # |
| 15 # $Id: shared7.test,v 1.1 2009/04/30 13:30:33 drh Exp $ | 15 # $Id: shared7.test,v 1.1 2009/04/30 13:30:33 drh Exp $ |
| 16 | 16 |
| 17 set testdir [file dirname $argv0] | 17 set testdir [file dirname $argv0] |
| 18 source $testdir/tester.tcl | 18 source $testdir/tester.tcl |
| 19 ifcapable !shared_cache { finish_test ; return } | 19 ifcapable !shared_cache { finish_test ; return } |
| 20 | 20 |
| 21 do_test shared7-1.1 { | 21 do_test shared7-1.1 { |
| 22 set ::enable_shared_cache [sqlite3_enable_shared_cache 1] | 22 set ::enable_shared_cache [sqlite3_enable_shared_cache 1] |
| 23 sqlite3_enable_shared_cache | 23 sqlite3_enable_shared_cache |
| 24 } {1} | 24 } {1} |
| 25 | 25 |
| 26 # EVIDENCE-OF: R-05098-06501 In shared cache mode, attempting to attach |
| 27 # the same database file more than once results in an error. |
| 28 # |
| 26 do_test shared7-1.2 { | 29 do_test shared7-1.2 { |
| 27 db close | 30 db close |
| 28 sqlite3 db test.db | 31 sqlite3 db test.db |
| 29 db eval { | 32 db eval { |
| 30 CREATE TABLE t1(x); | 33 CREATE TABLE t1(x); |
| 31 } | 34 } |
| 32 catchsql { | 35 catchsql { |
| 33 ATTACH 'test.db' AS err1; | 36 ATTACH 'test.db' AS err1; |
| 34 } | 37 } |
| 35 } {1 {database is already attached}} | 38 } {1 {database is already attached}} |
| 36 | 39 |
| 37 do_test shared7-1.3 { | 40 do_test shared7-1.3 { |
| 38 file delete -force test2.db test2.db-journal | 41 forcedelete test2.db test2.db-journal |
| 39 db eval { | 42 db eval { |
| 40 ATTACH 'test2.db' AS test2; | 43 ATTACH 'test2.db' AS test2; |
| 41 CREATE TABLE test2.t2(y); | 44 CREATE TABLE test2.t2(y); |
| 42 } | 45 } |
| 43 catchsql { | 46 catchsql { |
| 44 ATTACH 'test2.db' AS err2; | 47 ATTACH 'test2.db' AS err2; |
| 45 } | 48 } |
| 46 } {1 {database is already attached}} | 49 } {1 {database is already attached}} |
| 47 do_test shared7-1.4 { | 50 do_test shared7-1.4 { |
| 48 catchsql { | 51 catchsql { |
| 49 ATTACH 'test.db' AS err1; | 52 ATTACH 'test.db' AS err1; |
| 50 } | 53 } |
| 51 } {1 {database is already attached}} | 54 } {1 {database is already attached}} |
| 52 | 55 |
| 53 | 56 |
| 54 sqlite3_enable_shared_cache $::enable_shared_cache | 57 sqlite3_enable_shared_cache $::enable_shared_cache |
| 55 finish_test | 58 finish_test |
| OLD | NEW |