10
10
#***********************************************************************
12
# $Id: shared.test,v 1.21 2006/01/23 21:38:03 drh Exp $
12
# $Id: shared.test,v 1.31 2008/04/28 16:19:35 danielk1977 Exp $
14
14
set testdir [file dirname $argv0]
15
15
source $testdir/tester.tcl
18
ifcapable !shared_cache {
18
# These tests cannot be run without the ATTACH command.
20
ifcapable !shared_cache||!attach {
573
575
do_test shared-$av.7.2 {
574
576
# This test case deletes the contents of table t1 (the one at the start of
575
# the file) while many cursors are open on table t2 and it's index. All of
577
# the file) while many cursors are open on table t2 and its index. All of
576
578
# the non-root pages will be moved from the end to the start of the file
577
579
# when the DELETE is committed - this test verifies that moving the pages
578
580
# does not disturb the open cursors.
668
672
string range [execsql {PRAGMA encoding;} db2] 0 end-2
677
file delete -force test.db test2.db
679
do_test shared-$av.8.3.2 {
681
execsql { CREATE TABLE def(d, e, f) }
682
execsql { PRAGMA encoding }
684
do_test shared-$av.8.3.3 {
685
set zDb16 "[encoding convertto unicode test.db]\x00\x00"
686
set db16 [sqlite3_open16 $zDb16 {}]
688
set stmt [sqlite3_prepare $db16 "SELECT sql FROM sqlite_master" -1 DUMMY]
690
set sql [sqlite3_column_text $stmt 0]
691
sqlite3_finalize $stmt
693
} {CREATE TABLE def(d, e, f)}
694
do_test shared-$av.8.3.4 {
695
set stmt [sqlite3_prepare $db16 "PRAGMA encoding" -1 DUMMY]
697
set enc [sqlite3_column_text $stmt 0]
698
sqlite3_finalize $stmt
704
# Bug #2547 is causing this to fail.
670
706
do_test shared-$av.8.2.3 {
672
708
SELECT * FROM aux.sqlite_master;
674
710
} {1 {attached databases must use the same text encoding as main database}}
678
715
catch {db2 close}
888
if {[llength [info command sqlite3_shared_cache_report]]==1} {
889
do_test shared-$av.11.9 {
890
string tolower [sqlite3_shared_cache_report]
891
} [string tolower [list [file normalize test.db] 2]]
852
894
do_test shared-$av.11.11 {
899
# This tests that if it is impossible to free any pages, SQLite will
900
# exceed the limit set by PRAGMA cache_size.
901
file delete -force test.db test.db-journal
903
ifcapable pager_pragmas {
904
do_test shared-$av.12.1 {
906
PRAGMA cache_size = 10;
911
do_test shared-$av.12.2 {
912
set ::db_handles [list]
913
for {set i 1} {$i < 15} {incr i} {
914
lappend ::db_handles db$i
916
execsql "CREATE TABLE db${i}(a, b, c)" db$i
917
execsql "INSERT INTO db${i} VALUES(1, 2, 3)"
920
proc nested_select {handles} {
921
[lindex $handles 0] eval "SELECT * FROM [lindex $handles 0]" {
922
lappend ::res $a $b $c
923
if {[llength $handles]>1} {
924
nested_select [lrange $handles 1 end]
928
do_test shared-$av.12.3 {
930
nested_select $::db_handles
932
} [string range [string repeat "1 2 3 " [llength $::db_handles]] 0 end-1]
934
do_test shared-$av.12.X {
936
foreach h $::db_handles {
859
943
sqlite3_enable_shared_cache $::enable_shared_cache