interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / test / tkt2686.test

81 lines · 1830 bytes Raw Blame History
1# 2007 Oct 3
2#
3# The author disclaims copyright to this source code. In place of
4# a legal notice, here is a blessing:
5#
6# May you do good and not evil.
7# May you find forgiveness for yourself and forgive others.
8# May you share freely, never taking more than you give.
9#
10#***********************************************************************
11#
12# This file is to test that ticket #2686 has been fixed.
13#
14# $Id: tkt2686.test,v 1.3 2008/02/02 02:48:52 drh Exp $
15#
16
17set testdir [file dirname $argv0]
18source $testdir/tester.tcl
19
20ifcapable !subquery {
21 finish_test
22 return
23}
24
25db eval {
26 PRAGMA page_size=1024;
27 PRAGMA max_page_count=50;
28 PRAGMA auto_vacuum=0;
29 CREATE TABLE filler (fill);
30}
31for {set i 1} {$i<2000} {incr i} {
32 do_test tkt2686-$i.1 {
33 db eval BEGIN
34 set rc [catch {
35 while 1 {
36 db eval {INSERT INTO filler (fill) VALUES (randstr(1000, 10000)) }
37 }
38 } msg]
39 lappend rc $msg
40 } {1 {database or disk is full}}
41 do_test tkt2686-$i.2 {
42 execsql {
43 DELETE FROM filler
44 WHERE rowid <= (SELECT MAX(rowid) FROM filler LIMIT 20)
45 }
46 } {}
47 integrity_check tkt2686-$i.3
48 catch {db eval COMMIT}
49}
50
51db close
52forcedelete test.db test.db-journal
53sqlite3 db test.db
54
55db eval {
56 PRAGMA page_size=1024;
57 PRAGMA max_page_count=50;
58 PRAGMA auto_vacuum=1;
59 CREATE TABLE filler (fill);
60}
61for {set i 10000} {$i<12000} {incr i} {
62 do_test tkt2686-$i.1 {
63 db eval BEGIN
64 set rc [catch {
65 while 1 {
66 db eval {INSERT INTO filler (fill) VALUES (randstr(1000, 10000)) }
67 }
68 } msg]
69 lappend rc $msg
70 } {1 {database or disk is full}}
71 do_test tkt2686-$i.2 {
72 execsql {
73 DELETE FROM filler
74 WHERE rowid <= (SELECT MAX(rowid) FROM filler LIMIT 20)
75 }
76 } {}
77 integrity_check tkt2686-$i.3
78 catch {db eval COMMIT}
79}
80
81finish_test