SQLite

Check-in [8b8c0b749a]
Login

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

Overview
Comment:Add tests, including some for the sqlite3_expanded_sql() API.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | sqlite3_trace_v2
Files: files | file ages | folders
SHA1: 8b8c0b749a9a1daca49e7ea9351e253443bb1fc2
User & Date: mistachkin 2016-07-15 00:07:47.847
Context
2016-07-15
00:09
Modify one test result to be case-insensitive. (check-in: 5ccbeeea7d user: mistachkin tags: sqlite3_trace_v2)
00:07
Add tests, including some for the sqlite3_expanded_sql() API. (check-in: 8b8c0b749a user: mistachkin tags: sqlite3_trace_v2)
2016-07-14
23:17
More work on the Tcl interface and tests for the sqlite3_trace_v2() API. (check-in: f3c4aa97d8 user: mistachkin tags: sqlite3_trace_v2)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/trace3.test.
1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
# 2016 July 14
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    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 test file is the "sqlite3_trace_v2()" API.

#

set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !trace { finish_test ; return }
set ::testprefix trace3











|
|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 2016 July 14
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    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 test file is the "sqlite3_trace_v2()" and "sqlite3_expanded_sql()"
# APIs.
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !trace { finish_test ; return }
set ::testprefix trace3

109
110
111
112
113
114
115





116




117


















































118
119
120
121
122
123
124
  set ::stmtlist(record) {}
  db trace_v2 trace_v2_record {profile row}
  execsql {
    SELECT a, b FROM t1 ORDER BY a;
  }
  set ::stmtlist(record)
} "/^[string trim [string repeat {-?\d+ } 16]] \\\{-?\\d+ -?\\d+\\\}\$/"










do_test trace3-7.1 {


















































  set ::stmtlist(record) {}
  db trace_v2 trace_v2_record close
  db close
  set ::stmtlist(record)
} {/^-?\d+$/}

finish_test







>
>
>
>
>
|
>
>
>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
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
  set ::stmtlist(record) {}
  db trace_v2 trace_v2_record {profile row}
  execsql {
    SELECT a, b FROM t1 ORDER BY a;
  }
  set ::stmtlist(record)
} "/^[string trim [string repeat {-?\d+ } 16]] \\\{-?\\d+ -?\\d+\\\}\$/"
do_test trace3-6.2 {
  set ::stmtlist(record) {}
  db trace_v2 trace_v2_record {statement profile row}
  execsql {
    SELECT a, b FROM t1 ORDER BY a;
  }
  set ::stmtlist(record)
} "/^\\\{-?\\d+ \\\{SELECT a, b FROM t1 ORDER BY a;\\\}\\\} [string trim \
[string repeat {-?\d+ } 16]] \\\{-?\\d+ -?\\d+\\\}\$/"

do_test trace3-7.1 {
  set DB [sqlite3_connection_pointer db]

  set STMT [sqlite3_prepare_v2 $DB \
      "SELECT a, b FROM t1 WHERE b = ? ORDER BY a;" -1 TAIL]
} {/^[0-9A-F]+$/}

do_test trace3-8.1 {
  list [sqlite3_bind_null $STMT 1] [sqlite3_expanded_sql $STMT]
} {{} {SELECT a, b FROM t1 WHERE b = NULL ORDER BY a;}}
do_test trace3-8.2 {
  list [sqlite3_bind_int $STMT 1 123] [sqlite3_expanded_sql $STMT]
} {{} {SELECT a, b FROM t1 WHERE b = 123 ORDER BY a;}}
do_test trace3-8.3 {
  list [sqlite3_bind_int64 $STMT 1 123] [sqlite3_expanded_sql $STMT]
} {{} {SELECT a, b FROM t1 WHERE b = 123 ORDER BY a;}}
do_test trace3-8.4 {
  list [sqlite3_bind_text $STMT 1 "some string" 11] \
      [sqlite3_expanded_sql $STMT]
} {{} {SELECT a, b FROM t1 WHERE b = 'some string' ORDER BY a;}}
do_test trace3-8.5 {
  list [sqlite3_bind_text $STMT 1 "some 'bad' string" 17] \
      [sqlite3_expanded_sql $STMT]
} {{} {SELECT a, b FROM t1 WHERE b = 'some ''bad'' string' ORDER BY a;}}
do_test trace3-8.6 {
  list [sqlite3_bind_double $STMT 1 123] [sqlite3_expanded_sql $STMT]
} {{} {SELECT a, b FROM t1 WHERE b = 123.0 ORDER BY a;}}
do_test trace3-8.7 {
  list [sqlite3_bind_text16 $STMT 1 \
      [encoding convertto unicode hi\000yall\000] 16] \
      [sqlite3_expanded_sql $STMT]
} {{} {SELECT a, b FROM t1 WHERE b = 'hi' ORDER BY a;}}
do_test trace3-8.8 {
  list [sqlite3_bind_blob $STMT 1 "\x12\x34\x56" 3] \
      [sqlite3_expanded_sql $STMT]
} {{} {SELECT a, b FROM t1 WHERE b = x'123456' ORDER BY a;}}

do_test trace3-9.1 {
  db trace_v2 ""
  db trace_v2
} {}
do_test trace3-9.2 {
  unset -nocomplain ::stmtlist
  db trace_v2 "" {statement profile row}
  execsql {
    SELECT a, b FROM t1 ORDER BY a;
  }
  array get ::stmtlist
} {}

do_test trace3-10.1 {
  set ::stmtlist(record) {}
  db trace_v2 trace_v2_record close
  db close
  set ::stmtlist(record)
} {/^-?\d+$/}

finish_test