/ Check-in [78dfe832]
Login

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

Overview
Comment:Add a test to verify that 3.6.17 releases read-locks obtained to read the database schema even if the connection is not currently in auto-commit mode.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:78dfe8321db9debfcd4a7f3daf4223d0cbf23ab9
User & Date: dan 2009-08-17 09:29:09
Context
2009-08-17
13:42
Enhanced documentation and minor code tweaks in preparation for hardening the sqlite3_initialize/shutdown interfaces against initialization failures. check-in: 98c49e61 user: drh tags: trunk
09:29
Add a test to verify that 3.6.17 releases read-locks obtained to read the database schema even if the connection is not currently in auto-commit mode. check-in: 78dfe832 user: dan tags: trunk
2009-08-14
18:18
Update the amalgamation builder so that it avoids putting redundant SQLITE_API macros on declarations. check-in: 0d5b0587 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added test/lock7.test.



























































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# 2009 August 17
#
# 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.
#
#***********************************************************************
#
# Check that reading the database schema from within an active transaction
# does not establish a SHARED lock on the database file if one is not
# already held (or, more accurately, that the SHARED lock is released after
# reading the database schema).
#

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

do_test lock7-1.1 {
  execsql { CREATE TABLE t1(a, b) }
  db close

  sqlite3 db1 test.db
  sqlite3 db2 test.db

  db1 eval {BEGIN}
  db2 eval {BEGIN}
} {}

do_test lock7-1.2 {
  execsql { PRAGMA lock_status } db1
} {main unlocked temp closed}
do_test lock7-1.3 {
  execsql { PRAGMA lock_status } db2
} {main unlocked temp closed}

do_test lock7-1.4 {
  catchsql { INSERT INTO t1 VALUES(1, 1) } db1
} {0 {}}
do_test lock7-1.5 {
  catchsql { INSERT INTO t1 VALUES(2, 2) } db2
} {1 {database is locked}}

do_test lock7-1.6 {
  execsql { PRAGMA lock_status } db1
} {main reserved temp closed}
do_test lock7-1.7 {
  execsql { PRAGMA lock_status } db2
} {main unlocked temp closed}

do_test lock7-1.8 {
  execsql { COMMIT } db1
} {}

db1 close
db2 close

finish_test