SQLite

Check-in [3403d28a49]
Login

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

Overview
Comment:Add locks to the in-memory backend so that recursive writes will be detected and rejected. Ticket #436. (CVS 1089)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3403d28a49b27d3059d3d399ca057e8d33eb857a
User & Date: drh 2003-08-27 22:54:32.000
Context
2003-08-27
22:57
CVS missed a commit (because I pressed Ctrl-C in the middle). This extra commit will hopefully help clear things up. (CVS 1091) (check-in: 522c2efeb5 user: drh tags: trunk)
22:54
Add locks to the in-memory backend so that recursive writes will be detected and rejected. Ticket #436. (CVS 1089) (check-in: 3403d28a49 user: drh tags: trunk)
22:52
Add locks to the in-memory database so that recursive writes will be detected and rejected. Ticket #436. (CVS 1090) (check-in: 966b1a16f6 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/misc2.test.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc2.test,v 1.7 2003/08/26 11:25:58 drh Exp $

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

# Test for ticket #360
#
do_test misc2-1.1 {







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc2.test,v 1.8 2003/08/27 22:54:32 drh Exp $

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

# Test for ticket #360
#
do_test misc2-1.1 {
124
125
126
127
128
129
130



















































  sqlite db {}
  execsql {
    CREATE TABLE t1(a,b);
    INSERT INTO t1 VALUES(1,2);
    SELECT * FROM t1;
  }
} {1 2}


























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
  sqlite db {}
  execsql {
    CREATE TABLE t1(a,b);
    INSERT INTO t1 VALUES(1,2);
    SELECT * FROM t1;
  }
} {1 2}

# Make sure we get an error message (not a segfault) on an attempt to
# update a table from within the callback of a select on that same
# table.
#
do_test misc2-7.1 {
  db close
  file delete -force test.db
  sqlite db test.db
  execsql {
    CREATE TABLE t1(x);
    INSERT INTO t1 VALUES(1);
  }
  set rc [catch {
    db eval {SELECT rowid FROM t1} {} {
      db eval "DELETE FROM t1 WHERE rowid=$rowid"
    }
  } msg]
  lappend rc $msg
} {1 {database table is locked}}
do_test misc2-7.2 {
  set rc [catch {
    db eval {SELECT rowid FROM t1} {} {
      db eval "INSERT INTO t1 VALUES(3)"
    }
  } msg]
  lappend rc $msg
} {1 {database table is locked}}
do_test misc2-7.3 {
  db close
  file delete -force test.db
  sqlite db :memory:
  execsql {
    CREATE TABLE t1(x);
    INSERT INTO t1 VALUES(1);
  }
  set rc [catch {
    db eval {SELECT rowid FROM t1} {} {
      db eval "DELETE FROM t1 WHERE rowid=$rowid"
    }
  } msg]
  lappend rc $msg
} {1 {database table is locked}}
do_test misc2-7.4 {
  set rc [catch {
    db eval {SELECT rowid FROM t1} {} {
      db eval "INSERT INTO t1 VALUES(3)"
    }
  } msg]
  lappend rc $msg
} {1 {database table is locked}}