~ubuntu-branches/ubuntu/maverick/sqlite3/maverick-updates

« back to all changes in this revision

Viewing changes to test/progress.test

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2008-10-01 20:16:18 UTC
  • mfrom: (3.1.20 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081001201618-yfvqqj1qs29wdtcc
Tags: 3.5.9-5
Backport fix for distinct on indexes (closes: #500792).

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
# This file implements regression tests for SQLite library.  The
12
12
# focus of this file is testing the 'progress callback'.
13
13
#
14
 
# $Id: progress.test,v 1.6 2006/05/26 19:57:20 drh Exp $
 
14
# $Id: progress.test,v 1.8 2007/06/15 14:53:53 danielk1977 Exp $
15
15
 
16
16
set testdir [file dirname $argv0]
17
17
source $testdir/tester.tcl
97
97
  }
98
98
} 10
99
99
 
100
 
# Test that an active transaction remains active and not rolled back after the
101
 
# progress query abandons a query. 
 
100
# Test that an active transaction remains active and not rolled back 
 
101
# after the progress query abandons a query. 
 
102
#
 
103
# UPDATE: It is now recognised that this is a sure route to database
 
104
# corruption. So the transaction is rolled back.
102
105
do_test progress-1.3 {
103
106
 
104
107
  db progress 0 ""
111
114
    INSERT INTO t1 VALUES(12)
112
115
  }
113
116
  db progress 0 ""
114
 
  execsql COMMIT
 
117
  catchsql COMMIT
 
118
} {1 {cannot commit - no transaction is active}}
 
119
do_test progress-1.3.1 {
115
120
  execsql {
116
121
    SELECT count(*) FROM t1
117
122
  }
118
 
} 11
 
123
} 10
119
124
 
120
125
# Check that a value of 0 for N means no progress callback
121
126
do_test progress-1.4 {
143
148
  db eval {
144
149
    SELECT sum(a) FROM t1
145
150
  }
146
 
} {66}
 
151
} {55}
147
152
do_test progress-1.6 {
148
153
  set ::rx
149
 
} {11}
 
154
} {10}
 
155
 
 
156
# Check that abandoning a query using the progress handler does
 
157
# not cause other queries to abort. Ticket #2415.
 
158
do_test progress-1.7 {
 
159
  execsql {
 
160
    CREATE TABLE abc(a, b, c);
 
161
    INSERT INTO abc VALUES(1, 2, 3);
 
162
    INSERT INTO abc VALUES(4, 5, 6);
 
163
    INSERT INTO abc VALUES(7, 8, 9);
 
164
  }
 
165
 
 
166
  set ::res [list]
 
167
  db eval {SELECT a, b, c FROM abc} {
 
168
    lappend ::res $a $b $c
 
169
    db progress 10 "expr 1"
 
170
    catch {db eval {SELECT a, b, c FROM abc} { }} msg
 
171
    lappend ::res $msg
 
172
  }
 
173
 
 
174
  set ::res
 
175
} {1 2 3 interrupted 4 5 6 interrupted 7 8 9 interrupted}
150
176
 
151
177
finish_test