3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
13 set testdir [file dirname $argv0]
14 source $testdir/tester.tcl
15 set testprefix changes2
18 CREATE TABLE some_table (
19 id INTEGER NOT NULL, value VARCHAR(40) NOT NULL, PRIMARY KEY (id)
21 INSERT INTO some_table (id, value) VALUES (1, 'v1');
24 set ::stmt [sqlite3_prepare_v2 db {
25 UPDATE some_table SET value='v2' WHERE id=1 RETURNING id
29 list [sqlite3_step $::stmt] [db changes]
33 list [sqlite3_step $::stmt] [db changes]
39 DROP TABLE some_table;
40 CREATE TABLE some_table (
41 id INTEGER NOT NULL, value VARCHAR(40) NOT NULL, PRIMARY KEY (id)
43 INSERT INTO some_table (id, value) VALUES (1, 'v1');
47 list [sqlite3_step $::stmt] [db changes]
51 list [sqlite3_step $::stmt] [db changes]
54 sqlite3_finalize $::stmt
56 #-------------------------------------------------------------------------
60 CREATE TABLE t1(a, b);
64 set ::stmt [sqlite3_prepare_v2 db {
65 INSERT INTO log VALUES(changes() || ' changes')
69 INSERT INTO t1 VALUES (1, 'v1'), (2, 'v2');
73 list [sqlite3_step $::stmt] [sqlite3_reset $::stmt]
74 } {SQLITE_DONE SQLITE_OK}
81 INSERT INTO t1 VALUES (3, 'v1'), (4, 'v2');
85 list [sqlite3_step $::stmt] [sqlite3_reset $::stmt]
86 } {SQLITE_DONE SQLITE_OK}
88 sqlite3_finalize $::stmt
92 } {{2 changes} {2 changes}}