/ Check-in [13e501d1]
Login

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

Overview
Comment:Add more tests to make sure that sqlite_changes() works when using the non-callback API. Ticket #250. (CVS 876)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 13e501d190e327cc6fc16e182819ea9d7bb9c566
User & Date: drh 2003-03-01 19:53:16
Context
2003-03-07
19:50
Do not allow an empty string to be inserted into an INTEGER PRIMARY KEY. (CVS 877) check-in: 2aba40be user: drh tags: trunk
2003-03-01
19:53
Add more tests to make sure that sqlite_changes() works when using the non-callback API. Ticket #250. (CVS 876) check-in: 13e501d1 user: drh tags: trunk
19:45
Get the non-callback API working with the EXPLAIN keyword and for PRAGMAs. Tickets #258 and #257. Update the API documentation on the sqlite_changes() routine to explain how it works with the non-callback API. Ticket #250. (CVS 875) check-in: 620e1065 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/capi2.test.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
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
...
407
408
409
410
411
412
413

414
415
416
417
418

419
420
421
422
423
424
425
426
427
428
429



430
431
432
433
434
435
436
437
438
439
440



441
442
443
444
445
446
447
448
449
#    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 script testing the callback-free C/C++ API.
#
# $Id: capi2.test,v 1.5 2003/03/01 19:45:35 drh Exp $
#

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

# Check basic functionality
#
................................................................................
  sqlite_finalize $VM
} {}
do_test capi2-3.9 {
  execsql {CREATE UNIQUE INDEX i1 ON t1(a)}
  set VM [sqlite_compile $DB {INSERT INTO t1 VALUES(1,2,3)} TAIL]
  set TAIL
} {}

do_test capi2-3.10 {
  set N {}
  set VALUE {}
  set COLNAME {}
  list [sqlite_step $VM N VALUE COLNAME] [set N] [set VALUE] [set COLNAME]
} {SQLITE_DONE 0 {} {}}

do_test capi2-3.11 {
  sqlite_finalize $VM
} {}

do_test capi2-3.12 {
  list [catch {sqlite_finalize $VM} msg] [set msg]
} {1 {(21) library routine called out of sequence}}
do_test capi2-3.13 {
  set VM [sqlite_compile $DB {INSERT INTO t1 VALUES(1,3,4)} TAIL]
  list [sqlite_step $VM N VALUE COLNAME] [set N] [set VALUE] [set COLNAME]
} {SQLITE_ERROR 0 {} {}}

do_test capi2-3.14 {
  list [catch {sqlite_finalize $VM} msg] [set msg]
} {1 {(19) uniqueness constraint failed}}
do_test capi2-3.15 {
  set VM [sqlite_compile $DB {CREATE TABLE t2(a NOT NULL, b)} TAIL]
  set TAIL
} {}
................................................................................
  }
} {0 1}
do_test capi2-7.4 {
  stepsql $DB {
    INSERT INTO t1 SELECT a+1,b+1,c+1 FROM t1;
  }
} {0 1}

do_test capi2-7.5 {
  stepsql $DB {
    UPDATE t1 SET a=a+10;
  }
} {0 2}

do_test capi2-7.6 {
  stepsql $DB {
    SELECT * FROM t1;
  }
} {0 21 2 3 22 3 4}
do_test capi2-7.7 {
  stepsql $DB {
    INSERT INTO t1 SELECT a+2,b+2,c+2 FROM t1;
  }
} {0 2}
do_test capi2-7.8 {



  stepsql $DB {
    SELECT * FROM t1;
  }
} {0 21 2 3 22 3 4 23 4 5 24 5 6}
do_test capi2-7.9 {
  stepsql $DB {
    UPDATE t1 SET a=a-20;
    SELECT * FROM t1;
  }
} {0 4 1 2 3 2 3 4 3 4 5 4 5 6}
do_test capi2-7.10 {



  set x [stepsql $DB {EXPLAIN SELECT * FROM t1}]
  lindex $x 0
} {0}



db2 close

finish_test







|







 







>






>



>







>







 







>





>











>
>
>




|





|
>
>
>









7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
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
182
183
184
185
...
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
#    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 script testing the callback-free C/C++ API.
#
# $Id: capi2.test,v 1.6 2003/03/01 19:53:16 drh Exp $
#

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

# Check basic functionality
#
................................................................................
  sqlite_finalize $VM
} {}
do_test capi2-3.9 {
  execsql {CREATE UNIQUE INDEX i1 ON t1(a)}
  set VM [sqlite_compile $DB {INSERT INTO t1 VALUES(1,2,3)} TAIL]
  set TAIL
} {}
do_test capi2-3.9b {db changes} {0}
do_test capi2-3.10 {
  set N {}
  set VALUE {}
  set COLNAME {}
  list [sqlite_step $VM N VALUE COLNAME] [set N] [set VALUE] [set COLNAME]
} {SQLITE_DONE 0 {} {}}
do_test capi2-3.10b {db changes} {1}
do_test capi2-3.11 {
  sqlite_finalize $VM
} {}
do_test capi2-3.11b {db changes} {1}
do_test capi2-3.12 {
  list [catch {sqlite_finalize $VM} msg] [set msg]
} {1 {(21) library routine called out of sequence}}
do_test capi2-3.13 {
  set VM [sqlite_compile $DB {INSERT INTO t1 VALUES(1,3,4)} TAIL]
  list [sqlite_step $VM N VALUE COLNAME] [set N] [set VALUE] [set COLNAME]
} {SQLITE_ERROR 0 {} {}}
do_test capi2-3.13b {db changes} {0}
do_test capi2-3.14 {
  list [catch {sqlite_finalize $VM} msg] [set msg]
} {1 {(19) uniqueness constraint failed}}
do_test capi2-3.15 {
  set VM [sqlite_compile $DB {CREATE TABLE t2(a NOT NULL, b)} TAIL]
  set TAIL
} {}
................................................................................
  }
} {0 1}
do_test capi2-7.4 {
  stepsql $DB {
    INSERT INTO t1 SELECT a+1,b+1,c+1 FROM t1;
  }
} {0 1}
do_test capi2-7.4b {db changes} {1}
do_test capi2-7.5 {
  stepsql $DB {
    UPDATE t1 SET a=a+10;
  }
} {0 2}
do_test capi2-7.5b {db changes} {2}
do_test capi2-7.6 {
  stepsql $DB {
    SELECT * FROM t1;
  }
} {0 21 2 3 22 3 4}
do_test capi2-7.7 {
  stepsql $DB {
    INSERT INTO t1 SELECT a+2,b+2,c+2 FROM t1;
  }
} {0 2}
do_test capi2-7.8 {
  db changes
} {2}
do_test capi2-7.9 {
  stepsql $DB {
    SELECT * FROM t1;
  }
} {0 21 2 3 22 3 4 23 4 5 24 5 6}
do_test capi2-7.10 {
  stepsql $DB {
    UPDATE t1 SET a=a-20;
    SELECT * FROM t1;
  }
} {0 4 1 2 3 2 3 4 3 4 5 4 5 6}
do_test capi2-7.11 {
  db changes
} {0}
do_test capi2-7.12 {
  set x [stepsql $DB {EXPLAIN SELECT * FROM t1}]
  lindex $x 0
} {0}



db2 close

finish_test