SQLite

Check-in [fda637f453]
Login

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

Overview
Comment:Added tests trying (unsuccessfully) to reproduce ticket #304. (CVS 957)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fda637f453d35b74f676997fcf056a948ccd771b
User & Date: drh 2003-05-04 20:42:56.000
Context
2003-05-06
20:35
Restrain the flattener in the presence of outer joins. Ticket #306. (CVS 958) (check-in: 6d4b6597e5 user: drh tags: trunk)
2003-05-04
20:42
Added tests trying (unsuccessfully) to reproduce ticket #304. (CVS 957) (check-in: fda637f453 user: drh tags: trunk)
18:30
Shell command-line parsing enhancements suggested by Mike Hall. (CVS 956) (check-in: 5656fe48b1 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/delete.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2001 September 15
#
# 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.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the DELETE FROM statement.
#
# $Id: delete.test,v 1.11 2002/07/19 18:52:41 drh Exp $

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

# Try to delete from a non-existant table.
#
do_test delete-1.1 {













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2001 September 15
#
# 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.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the DELETE FROM statement.
#
# $Id: delete.test,v 1.12 2003/05/04 20:42:56 drh Exp $

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

# Try to delete from a non-existant table.
#
do_test delete-1.1 {
236
237
238
239
240
241
242
243


244





































245
    INSERT INTO t3 SELECT a+2 FROM t3;
    CREATE TABLE t4 AS SELECT * FROM t3;
    PRAGMA count_changes=ON;
    DELETE FROM t3;
    DELETE FROM t4;
  }
} {4 4}









































finish_test








>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
    INSERT INTO t3 SELECT a+2 FROM t3;
    CREATE TABLE t4 AS SELECT * FROM t3;
    PRAGMA count_changes=ON;
    DELETE FROM t3;
    DELETE FROM t4;
  }
} {4 4}

# Make sure error messages are consistent when attempting to delete
# from a read-only database.  Ticket #304.
#
do_test delete-8.0 {
  execsql {
    PRAGMA count_changes=OFF;
    INSERT INTO t3 VALUES(123);
    SELECT * FROM t3;
  }
} {123}
db close
catch {file attributes test.db -permissions 0444}
catch {file attributes test.db -readonly 1}
sqlite db test.db
do_test delete-8.1 {
  catchsql {
    DELETE FROM t3;
  }
} {1 {attempt to write a readonly database}}
do_test delete-8.2 {
  execsql {SELECT * FROM t3} 
} {123}
do_test delete-8.3 {
  catchsql {
    DELETE FROM t3 WHERE 1;
  }
} {1 {attempt to write a readonly database}}
do_test delete-8.4 {
  execsql {SELECT * FROM t3} 
} {123}
do_test delete-8.5 {
  catchsql {
    DELETE FROM t3 WHERE a<100;
  }
} {0 {}}
do_test delete-8.6 {
  execsql {SELECT * FROM t3}
} {123}


finish_test