SQLite

Check-in [a0ab3902f1]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add trivial test case to make sure shared-cache mode does not automatically turn on exclusive-locking mode.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a0ab3902f1431c962a5d034647ef3c6876dc0e75
User & Date: dan 2010-09-15 11:42:04.000
Context
2010-09-15
17:54
Added the sqlite3_soft_heap_limit64() interface. Deprecate the older sqlite3_soft_heap_limit() interface. (check-in: 82268a2c3d user: drh tags: trunk)
11:42
Add trivial test case to make sure shared-cache mode does not automatically turn on exclusive-locking mode. (check-in: a0ab3902f1 user: dan tags: trunk)
2010-09-14
18:56
Further tests for compound SELECT statements. (check-in: a0f01ebab9 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/lock_common.tcl.
54
55
56
57
58
59
60

61
62
63
64
65
66
67
    uplevel set $varname $tn
    uplevel $script

    code2 { db2 close }
    code3 { db3 close }
    catch { close $::code2_chan }
    catch { close $::code3_chan }

  }
}

# Launch another testfixture process to be controlled by this one. A
# channel name is returned that may be passed as the first argument to proc
# 'testfixture' to execute a command. The child testfixture process is shut
# down by closing the channel.







>







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
    uplevel set $varname $tn
    uplevel $script

    code2 { db2 close }
    code3 { db3 close }
    catch { close $::code2_chan }
    catch { close $::code3_chan }
    catch { db close }
  }
}

# Launch another testfixture process to be controlled by this one. A
# channel name is returned that may be passed as the first argument to proc
# 'testfixture' to execute a command. The child testfixture process is shut
# down by closing the channel.
Changes to test/savepoint.test.
1022
1023
1024
1025
1026
1027
1028

1029
1030
1031
1032
1033
1034
1035
#-------------------------------------------------------------------------
# This next block of tests verifies that a problem reported on the mailing
# list has been resolved. At one point the second "CREATE TABLE t6" would
# fail as table t6 still existed in the internal cache of the db schema
# (even though it had been removed from the database by the ROLLBACK 
# command).
#

do_execsql_test savepoint-17.1 {
  BEGIN;
    CREATE TABLE t6(a, b);
    INSERT INTO t6 VALUES(1, 2);
    SAVEPOINT one;
      INSERT INTO t6 VALUES(3, 4);
    ROLLBACK TO one;







>







1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
#-------------------------------------------------------------------------
# This next block of tests verifies that a problem reported on the mailing
# list has been resolved. At one point the second "CREATE TABLE t6" would
# fail as table t6 still existed in the internal cache of the db schema
# (even though it had been removed from the database by the ROLLBACK 
# command).
#
sqlite3 db test.db
do_execsql_test savepoint-17.1 {
  BEGIN;
    CREATE TABLE t6(a, b);
    INSERT INTO t6 VALUES(1, 2);
    SAVEPOINT one;
      INSERT INTO t6 VALUES(3, 4);
    ROLLBACK TO one;
Changes to test/shared2.test.
9
10
11
12
13
14
15


16
17
18
19
20
21
22
#
#***********************************************************************
#
# $Id: shared2.test,v 1.8 2009/06/05 17:09:12 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl


db close

ifcapable !shared_cache {
  finish_test
  return
}
set ::enable_shared_cache [sqlite3_enable_shared_cache 1]







>
>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#
#***********************************************************************
#
# $Id: shared2.test,v 1.8 2009/06/05 17:09:12 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/lock_common.tcl
source $testdir/malloc_common.tcl
db close

ifcapable !shared_cache {
  finish_test
  return
}
set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
161
162
163
164
165
166
167









168
169
170
  # The following statement would crash when attempting to sqlite3_free()
  # a pointer allocated from a lookaside buffer.
  execsql { CREATE INDEX i1 ON t2(a) } db2
} {}

db close
db2 close










sqlite3_enable_shared_cache $::enable_shared_cache
finish_test







>
>
>
>
>
>
>
>
>



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
  # The following statement would crash when attempting to sqlite3_free()
  # a pointer allocated from a lookaside buffer.
  execsql { CREATE INDEX i1 ON t2(a) } db2
} {}

db close
db2 close

# The following test verifies that shared-cache mode does not automatically
# turn on exclusive-locking mode for some reason.
do_multiclient_test {tn} {
  sql1 { CREATE TABLE t1(a, b) }
  sql2 { CREATE TABLE t2(a, b) }
  do_test shared2-6.$tn.1 { sql1 { SELECT * FROM t2 } } {}
  do_test shared2-6.$tn.2 { sql2 { SELECT * FROM t1 } } {}
}

sqlite3_enable_shared_cache $::enable_shared_cache
finish_test