1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

The callback on sqlite3_trace() is invoked the first time sqlite3_step()

is called after sqlite3_prepare() or sqlite3_reset().  Ticket #900. (CVS 1960)

FossilOrigin-Name: 0cc2f40e6afa157ead45140c4e28a9a33c469b73
This commit is contained in:
drh
2004-09-15 13:38:10 +00:00
parent fd241b0ea4
commit c16a03b54b
8 changed files with 86 additions and 63 deletions

View File

@ -12,7 +12,7 @@
#
# This file implements tests for the "sqlite3_trace()" API.
#
# $Id: trace.test,v 1.2 2004/06/30 02:35:51 danielk1977 Exp $
# $Id: trace.test,v 1.3 2004/09/15 13:38:11 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -38,10 +38,43 @@ do_test trace-1.3 {
} {1 2}
do_test trace-1.4 {
set ::stmtlist
} {{CREATE TABLE t1(a,b);} {INSERT INTO t1 VALUES(1,2);} {SELECT * FROM t1;} {}}
} {{CREATE TABLE t1(a,b);} {INSERT INTO t1 VALUES(1,2);} {SELECT * FROM t1;}}
do_test trace-1.5 {
db trace {}
db trace
} {}
# If we prepare a statement and execute it multiple times, the trace
# happens on each execution.
#
db close
set DB [sqlite3 db test.db]
do_test trace-2.1 {
set STMT [sqlite3_prepare $DB {INSERT INTO t1 VALUES(2,3)} -1 TAIL]
db trace trace_proc
proc trace_proc sql {
global TRACE_OUT
set TRACE_OUT $sql
}
set TRACE_OUT {}
sqlite3_step $STMT
set TRACE_OUT
} {INSERT INTO t1 VALUES(2,3)}
do_test trace-2.2 {
set TRACE_OUT {}
sqlite3_reset $STMT
set TRACE_OUT
} {}
do_test trace-2.3 {
sqlite3_step $STMT
set TRACE_OUT
} {INSERT INTO t1 VALUES(2,3)}
do_test trace-2.4 {
execsql {SELECT * FROM t1}
} {1 2 2 3 2 3}
do_test trace-2.5 {
set TRACE_OUT
} {SELECT * FROM t1}
finish_test