blob: 5e7de8209dc7a30f64281f44b37116db4943d549 [file] [log] [blame]
drh82a48512003-09-06 22:45:20 +00001# 2003 September 6
2#
3# The author disclaims copyright to this source code. In place of
4# a legal notice, here is a blessing:
5#
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.
9#
10#***********************************************************************
11# This file implements regression tests for SQLite library. The
12# focus of this script testing the sqlite_bind API.
13#
drh288d37f2005-06-22 08:48:06 +000014# $Id: bind.test,v 1.32 2005/06/22 08:48:07 drh Exp $
drh82a48512003-09-06 22:45:20 +000015#
16
17set testdir [file dirname $argv0]
18source $testdir/tester.tcl
19
danielk197717240fd2004-05-26 00:07:25 +000020proc sqlite_step {stmt N VALS COLS} {
21 upvar VALS vals
22 upvar COLS cols
23 set vals [list]
24 set cols [list]
25
26 set rc [sqlite3_step $stmt]
27 for {set i 0} {$i < [sqlite3_column_count $stmt]} {incr i} {
28 lappend cols [sqlite3_column_name $stmt $i]
29 }
30 for {set i 0} {$i < [sqlite3_data_count $stmt]} {incr i} {
drheb2e1762004-05-27 01:53:56 +000031 lappend vals [sqlite3_column_text $stmt $i]
danielk197717240fd2004-05-26 00:07:25 +000032 }
33
34 return $rc
35}
36
drh82a48512003-09-06 22:45:20 +000037do_test bind-1.1 {
38 db close
drhef4ac8f2004-06-19 00:16:31 +000039 set DB [sqlite3 db test.db]
drh2c6674c2004-08-25 04:07:01 +000040 execsql {CREATE TABLE t1(a,b,c);}
41 set VM [sqlite3_prepare $DB {INSERT INTO t1 VALUES(:1,?,:abc)} -1 TAIL]
drh82a48512003-09-06 22:45:20 +000042 set TAIL
43} {}
drh75f6a032004-07-15 14:15:00 +000044do_test bind-1.1.1 {
45 sqlite3_bind_parameter_count $VM
46} 3
drh895d7472004-08-20 16:02:39 +000047do_test bind-1.1.2 {
48 sqlite3_bind_parameter_name $VM 1
drh2c6674c2004-08-25 04:07:01 +000049} {:1}
drh895d7472004-08-20 16:02:39 +000050do_test bind-1.1.3 {
51 sqlite3_bind_parameter_name $VM 2
52} {}
53do_test bind-1.1.4 {
54 sqlite3_bind_parameter_name $VM 3
drh2c6674c2004-08-25 04:07:01 +000055} {:abc}
drh82a48512003-09-06 22:45:20 +000056do_test bind-1.2 {
57 sqlite_step $VM N VALUES COLNAMES
58} {SQLITE_DONE}
59do_test bind-1.3 {
60 execsql {SELECT rowid, * FROM t1}
61} {1 {} {} {}}
62do_test bind-1.4 {
danielk1977106bb232004-05-21 10:08:53 +000063 sqlite3_reset $VM
drh82a48512003-09-06 22:45:20 +000064 sqlite_bind $VM 1 {test value 1} normal
65 sqlite_step $VM N VALUES COLNAMES
66} SQLITE_DONE
67do_test bind-1.5 {
68 execsql {SELECT rowid, * FROM t1}
69} {1 {} {} {} 2 {test value 1} {} {}}
70do_test bind-1.6 {
danielk1977106bb232004-05-21 10:08:53 +000071 sqlite3_reset $VM
drh82a48512003-09-06 22:45:20 +000072 sqlite_bind $VM 3 {'test value 2'} normal
73 sqlite_step $VM N VALUES COLNAMES
74} SQLITE_DONE
75do_test bind-1.7 {
76 execsql {SELECT rowid, * FROM t1}
77} {1 {} {} {} 2 {test value 1} {} {} 3 {test value 1} {} {'test value 2'}}
78do_test bind-1.8 {
danielk1977106bb232004-05-21 10:08:53 +000079 sqlite3_reset $VM
drh82a48512003-09-06 22:45:20 +000080 set sqlite_static_bind_value 123
81 sqlite_bind $VM 1 {} static
82 sqlite_bind $VM 2 {abcdefg} normal
83 sqlite_bind $VM 3 {} null
84 execsql {DELETE FROM t1}
85 sqlite_step $VM N VALUES COLNAMES
86 execsql {SELECT rowid, * FROM t1}
87} {1 123 abcdefg {}}
88do_test bind-1.9 {
danielk1977106bb232004-05-21 10:08:53 +000089 sqlite3_reset $VM
drh82a48512003-09-06 22:45:20 +000090 sqlite_bind $VM 1 {456} normal
91 sqlite_step $VM N VALUES COLNAMES
92 execsql {SELECT rowid, * FROM t1}
93} {1 123 abcdefg {} 2 456 abcdefg {}}
94
drh82a48512003-09-06 22:45:20 +000095do_test bind-1.99 {
danielk1977106bb232004-05-21 10:08:53 +000096 sqlite3_finalize $VM
danielk19773cf86062004-05-26 10:11:05 +000097} SQLITE_OK
drh82a48512003-09-06 22:45:20 +000098
drh6bf89572004-11-03 16:27:01 +000099# Prepare the statement in different ways depending on whether or not
100# the $var processing is compiled into the library.
101#
102ifcapable {tclvar} {
103 do_test bind-2.1 {
104 execsql {
105 DELETE FROM t1;
106 }
drh288d37f2005-06-22 08:48:06 +0000107 set VM [sqlite3_prepare $DB {INSERT INTO t1 VALUES($one,$::two,$x(-z-))}\
drh48e5aa22005-01-11 17:46:41 +0000108 -1 TX]
drh6bf89572004-11-03 16:27:01 +0000109 set TX
110 } {}
111 set v1 {$one}
112 set v2 {$::two}
drh288d37f2005-06-22 08:48:06 +0000113 set v3 {$x(-z-)}
drh6bf89572004-11-03 16:27:01 +0000114}
115ifcapable {!tclvar} {
116 do_test bind-2.1 {
117 execsql {
118 DELETE FROM t1;
119 }
120 set VM [sqlite3_prepare $DB {INSERT INTO t1 VALUES(:one,:two,:_)} -1 TX]
121 set TX
122 } {}
123 set v1 {:one}
124 set v2 {:two}
125 set v3 {:_}
126}
127
drh895d7472004-08-20 16:02:39 +0000128do_test bind-2.1.1 {
129 sqlite3_bind_parameter_count $VM
130} 3
131do_test bind-2.1.2 {
132 sqlite3_bind_parameter_name $VM 1
drh6bf89572004-11-03 16:27:01 +0000133} $v1
drh895d7472004-08-20 16:02:39 +0000134do_test bind-2.1.3 {
135 sqlite3_bind_parameter_name $VM 2
drh6bf89572004-11-03 16:27:01 +0000136} $v2
drh895d7472004-08-20 16:02:39 +0000137do_test bind-2.1.4 {
138 sqlite3_bind_parameter_name $VM 3
drh6bf89572004-11-03 16:27:01 +0000139} $v3
drhfa6bc002004-09-07 16:19:52 +0000140do_test bind-2.1.5 {
drh6bf89572004-11-03 16:27:01 +0000141 sqlite3_bind_parameter_index $VM $v1
drhfa6bc002004-09-07 16:19:52 +0000142} 1
143do_test bind-2.1.6 {
drh6bf89572004-11-03 16:27:01 +0000144 sqlite3_bind_parameter_index $VM $v2
drhfa6bc002004-09-07 16:19:52 +0000145} 2
146do_test bind-2.1.7 {
drh6bf89572004-11-03 16:27:01 +0000147 sqlite3_bind_parameter_index $VM $v3
drhfa6bc002004-09-07 16:19:52 +0000148} 3
149do_test bind-2.1.8 {
150 sqlite3_bind_parameter_index $VM {:hi}
151} 0
danielk197751e3d8e2004-05-20 01:12:34 +0000152
153# 32 bit Integers
154do_test bind-2.2 {
drh241db312004-06-22 12:46:53 +0000155 sqlite3_bind_int $VM 1 123
156 sqlite3_bind_int $VM 2 456
157 sqlite3_bind_int $VM 3 789
danielk197751e3d8e2004-05-20 01:12:34 +0000158 sqlite_step $VM N VALUES COLNAMES
danielk1977106bb232004-05-21 10:08:53 +0000159 sqlite3_reset $VM
danielk197751e3d8e2004-05-20 01:12:34 +0000160 execsql {SELECT rowid, * FROM t1}
161} {1 123 456 789}
162do_test bind-2.3 {
drh241db312004-06-22 12:46:53 +0000163 sqlite3_bind_int $VM 2 -2000000000
164 sqlite3_bind_int $VM 3 2000000000
danielk197751e3d8e2004-05-20 01:12:34 +0000165 sqlite_step $VM N VALUES COLNAMES
danielk1977106bb232004-05-21 10:08:53 +0000166 sqlite3_reset $VM
danielk197751e3d8e2004-05-20 01:12:34 +0000167 execsql {SELECT rowid, * FROM t1}
168} {1 123 456 789 2 123 -2000000000 2000000000}
169do_test bind-2.4 {
danielk197735bb9d02004-05-24 12:55:54 +0000170 execsql {SELECT typeof(a), typeof(b), typeof(c) FROM t1}
171} {integer integer integer integer integer integer}
danielk197751e3d8e2004-05-20 01:12:34 +0000172do_test bind-2.5 {
173 execsql {
174 DELETE FROM t1;
175 }
176} {}
177
178# 64 bit Integers
179do_test bind-3.1 {
180 sqlite3_bind_int64 $VM 1 32
181 sqlite3_bind_int64 $VM 2 -2000000000000
182 sqlite3_bind_int64 $VM 3 2000000000000
183 sqlite_step $VM N VALUES COLNAMES
danielk1977106bb232004-05-21 10:08:53 +0000184 sqlite3_reset $VM
danielk197751e3d8e2004-05-20 01:12:34 +0000185 execsql {SELECT rowid, * FROM t1}
186} {1 32 -2000000000000 2000000000000}
187do_test bind-3.2 {
danielk197735bb9d02004-05-24 12:55:54 +0000188 execsql {SELECT typeof(a), typeof(b), typeof(c) FROM t1}
189} {integer integer integer}
danielk197751e3d8e2004-05-20 01:12:34 +0000190do_test bind-3.3 {
191 execsql {
192 DELETE FROM t1;
193 }
194} {}
195
196# Doubles
197do_test bind-4.1 {
198 sqlite3_bind_double $VM 1 1234.1234
199 sqlite3_bind_double $VM 2 0.00001
200 sqlite3_bind_double $VM 3 123456789
201 sqlite_step $VM N VALUES COLNAMES
danielk1977106bb232004-05-21 10:08:53 +0000202 sqlite3_reset $VM
drhab34b8f2005-03-20 23:18:57 +0000203 set x [execsql {SELECT rowid, * FROM t1}]
204 regsub {1e-005} $x {1e-05} y
205 set y
drh92febd92004-08-20 18:34:20 +0000206} {1 1234.1234 1e-05 123456789.0}
danielk197751e3d8e2004-05-20 01:12:34 +0000207do_test bind-4.2 {
danielk197735bb9d02004-05-24 12:55:54 +0000208 execsql {SELECT typeof(a), typeof(b), typeof(c) FROM t1}
209} {real real real}
danielk197751e3d8e2004-05-20 01:12:34 +0000210do_test bind-4.3 {
211 execsql {
212 DELETE FROM t1;
213 }
214} {}
215
216# NULL
217do_test bind-5.1 {
218 sqlite3_bind_null $VM 1
219 sqlite3_bind_null $VM 2
220 sqlite3_bind_null $VM 3
221 sqlite_step $VM N VALUES COLNAMES
danielk1977106bb232004-05-21 10:08:53 +0000222 sqlite3_reset $VM
danielk197751e3d8e2004-05-20 01:12:34 +0000223 execsql {SELECT rowid, * FROM t1}
224} {1 {} {} {}}
225do_test bind-5.2 {
danielk197735bb9d02004-05-24 12:55:54 +0000226 execsql {SELECT typeof(a), typeof(b), typeof(c) FROM t1}
227} {null null null}
danielk197751e3d8e2004-05-20 01:12:34 +0000228do_test bind-5.3 {
229 execsql {
230 DELETE FROM t1;
231 }
232} {}
233
234# UTF-8 text
235do_test bind-6.1 {
236 sqlite3_bind_text $VM 1 hellothere 5
danielk1977c572ef72004-05-27 09:28:41 +0000237 sqlite3_bind_text $VM 2 ".." 1
danielk197751e3d8e2004-05-20 01:12:34 +0000238 sqlite3_bind_text $VM 3 world -1
239 sqlite_step $VM N VALUES COLNAMES
danielk1977106bb232004-05-21 10:08:53 +0000240 sqlite3_reset $VM
danielk197751e3d8e2004-05-20 01:12:34 +0000241 execsql {SELECT rowid, * FROM t1}
242} {1 hello . world}
243do_test bind-6.2 {
danielk197735bb9d02004-05-24 12:55:54 +0000244 execsql {SELECT typeof(a), typeof(b), typeof(c) FROM t1}
245} {text text text}
danielk197751e3d8e2004-05-20 01:12:34 +0000246do_test bind-6.3 {
247 execsql {
248 DELETE FROM t1;
249 }
250} {}
251
252# UTF-16 text
drh6c626082004-11-14 21:56:29 +0000253ifcapable {utf16} {
254 do_test bind-7.1 {
255 sqlite3_bind_text16 $VM 1 [encoding convertto unicode hellothere] 10
256 sqlite3_bind_text16 $VM 2 [encoding convertto unicode ""] 0
257 sqlite3_bind_text16 $VM 3 [encoding convertto unicode world] 10
258 sqlite_step $VM N VALUES COLNAMES
259 sqlite3_reset $VM
260 execsql {SELECT rowid, * FROM t1}
261 } {1 hello {} world}
262 do_test bind-7.2 {
263 execsql {SELECT typeof(a), typeof(b), typeof(c) FROM t1}
264 } {text text text}
265}
danielk197751e3d8e2004-05-20 01:12:34 +0000266do_test bind-7.3 {
267 execsql {
268 DELETE FROM t1;
269 }
270} {}
271
danielk19776622cce2004-05-20 11:00:52 +0000272# Test that the 'out of range' error works.
273do_test bind-8.1 {
274 catch { sqlite3_bind_null $VM 0 }
275} {1}
276do_test bind-8.2 {
277 sqlite3_errmsg $DB
drhb08153d2004-11-20 20:18:55 +0000278} {bind or column index out of range}
drh6c626082004-11-14 21:56:29 +0000279ifcapable {utf16} {
280 do_test bind-8.3 {
281 encoding convertfrom unicode [sqlite3_errmsg16 $DB]
drhb08153d2004-11-20 20:18:55 +0000282 } {bind or column index out of range}
drh6c626082004-11-14 21:56:29 +0000283}
danielk19776622cce2004-05-20 11:00:52 +0000284do_test bind-8.4 {
285 sqlite3_bind_null $VM 1
286 sqlite3_errmsg $DB
287} {not an error}
288do_test bind-8.5 {
289 catch { sqlite3_bind_null $VM 4 }
290} {1}
291do_test bind-8.6 {
292 sqlite3_errmsg $DB
drhb08153d2004-11-20 20:18:55 +0000293} {bind or column index out of range}
drh6c626082004-11-14 21:56:29 +0000294ifcapable {utf16} {
295 do_test bind-8.7 {
296 encoding convertfrom unicode [sqlite3_errmsg16 $DB]
drhb08153d2004-11-20 20:18:55 +0000297 } {bind or column index out of range}
drh6c626082004-11-14 21:56:29 +0000298}
danielk19776622cce2004-05-20 11:00:52 +0000299
danielk1977f4618892004-06-28 13:09:11 +0000300do_test bind-8.8 {
301 catch { sqlite3_bind_blob $VM 0 "abc" 3 }
302} {1}
303do_test bind-8.9 {
304 catch { sqlite3_bind_blob $VM 4 "abc" 3 }
305} {1}
306do_test bind-8.10 {
307 catch { sqlite3_bind_text $VM 0 "abc" 3 }
308} {1}
drh6c626082004-11-14 21:56:29 +0000309ifcapable {utf16} {
310 do_test bind-8.11 {
311 catch { sqlite3_bind_text16 $VM 4 "abc" 2 }
312 } {1}
313}
danielk1977f4618892004-06-28 13:09:11 +0000314do_test bind-8.12 {
315 catch { sqlite3_bind_int $VM 0 5 }
316} {1}
317do_test bind-8.13 {
318 catch { sqlite3_bind_int $VM 4 5 }
319} {1}
320do_test bind-8.14 {
321 catch { sqlite3_bind_double $VM 0 5.0 }
322} {1}
323do_test bind-8.15 {
324 catch { sqlite3_bind_double $VM 4 6.0 }
325} {1}
danielk19776622cce2004-05-20 11:00:52 +0000326
drhfa6bc002004-09-07 16:19:52 +0000327do_test bind-8.99 {
danielk1977106bb232004-05-21 10:08:53 +0000328 sqlite3_finalize $VM
danielk19773cf86062004-05-26 10:11:05 +0000329} SQLITE_OK
danielk197751e3d8e2004-05-20 01:12:34 +0000330
drhfa6bc002004-09-07 16:19:52 +0000331do_test bind-9.1 {
332 execsql {
333 CREATE TABLE t2(a,b,c,d,e,f);
334 }
335 set rc [catch {
336 sqlite3_prepare $DB {
337 INSERT INTO t2(a) VALUES(?0)
338 } -1 TAIL
339 } msg]
340 lappend rc $msg
341} {1 {(1) variable number must be between ?1 and ?999}}
342do_test bind-9.2 {
343 set rc [catch {
344 sqlite3_prepare $DB {
345 INSERT INTO t2(a) VALUES(?1000)
346 } -1 TAIL
347 } msg]
348 lappend rc $msg
349} {1 {(1) variable number must be between ?1 and ?999}}
350do_test bind-9.3 {
351 set VM [
352 sqlite3_prepare $DB {
353 INSERT INTO t2(a,b) VALUES(?1,?999)
354 } -1 TAIL
355 ]
356 sqlite3_bind_parameter_count $VM
357} {999}
358catch {sqlite3_finalize $VM}
359do_test bind-9.4 {
360 set VM [
361 sqlite3_prepare $DB {
362 INSERT INTO t2(a,b,c,d) VALUES(?1,?999,?,?)
363 } -1 TAIL
364 ]
365 sqlite3_bind_parameter_count $VM
366} {1001}
367do_test bind-9.5 {
368 sqlite3_bind_int $VM 1 1
369 sqlite3_bind_int $VM 999 999
370 sqlite3_bind_int $VM 1000 1000
371 sqlite3_bind_int $VM 1001 1001
372 sqlite3_step $VM
373} SQLITE_DONE
374do_test bind-9.6 {
375 sqlite3_finalize $VM
376} SQLITE_OK
377do_test bind-9.7 {
378 execsql {SELECT * FROM t2}
379} {1 999 1000 1001 {} {}}
danielk197751e3d8e2004-05-20 01:12:34 +0000380
drh6bf89572004-11-03 16:27:01 +0000381ifcapable {tclvar} {
382 do_test bind-10.1 {
drh6bf89572004-11-03 16:27:01 +0000383 set VM [
384 sqlite3_prepare $DB {
385 INSERT INTO t2(a,b,c,d,e,f) VALUES(:abc,$abc,:abc,$ab,$abc,:abc)
386 } -1 TAIL
387 ]
388 sqlite3_bind_parameter_count $VM
389 } 3
390 set v1 {$abc}
391 set v2 {$ab}
392}
393ifcapable {!tclvar} {
394 do_test bind-10.1 {
drh6bf89572004-11-03 16:27:01 +0000395 set VM [
396 sqlite3_prepare $DB {
397 INSERT INTO t2(a,b,c,d,e,f) VALUES(:abc,:xyz,:abc,:xy,:xyz,:abc)
398 } -1 TAIL
399 ]
400 sqlite3_bind_parameter_count $VM
401 } 3
402 set v1 {:xyz}
403 set v2 {:xy}
404}
drhfa6bc002004-09-07 16:19:52 +0000405do_test bind-10.2 {
406 sqlite3_bind_parameter_index $VM :abc
407} 1
408do_test bind-10.3 {
drh6bf89572004-11-03 16:27:01 +0000409 sqlite3_bind_parameter_index $VM $v1
drhfa6bc002004-09-07 16:19:52 +0000410} 2
411do_test bind-10.4 {
drh6bf89572004-11-03 16:27:01 +0000412 sqlite3_bind_parameter_index $VM $v2
drhfa6bc002004-09-07 16:19:52 +0000413} 3
414do_test bind-10.5 {
415 sqlite3_bind_parameter_name $VM 1
416} :abc
417do_test bind-10.6 {
418 sqlite3_bind_parameter_name $VM 2
drh6bf89572004-11-03 16:27:01 +0000419} $v1
drhfa6bc002004-09-07 16:19:52 +0000420do_test bind-10.7 {
421 sqlite3_bind_parameter_name $VM 3
drh6bf89572004-11-03 16:27:01 +0000422} $v2
drhc5cdca62005-01-11 16:54:14 +0000423do_test bind-10.7.1 {
424 sqlite3_bind_parameter_name 0 1 ;# Ignore if VM is NULL
425} {}
426do_test bind-10.7.2 {
427 sqlite3_bind_parameter_name $VM 0 ;# Ignore if index too small
428} {}
429do_test bind-10.7.3 {
430 sqlite3_bind_parameter_name $VM 4 ;# Ignore if index is too big
431} {}
drhfa6bc002004-09-07 16:19:52 +0000432do_test bind-10.8 {
433 sqlite3_bind_int $VM 1 1
434 sqlite3_bind_int $VM 2 2
435 sqlite3_bind_int $VM 3 3
436 sqlite3_step $VM
437} SQLITE_DONE
drhc5cdca62005-01-11 16:54:14 +0000438do_test bind-10.8.1 {
439 # Binding attempts after program start should fail
440 set rc [catch {
441 sqlite3_bind_int $VM 1 1
442 } msg]
443 lappend rc $msg
444} {1 {}}
drhfa6bc002004-09-07 16:19:52 +0000445do_test bind-10.9 {
446 sqlite3_finalize $VM
447} SQLITE_OK
448do_test bind-10.10 {
449 execsql {SELECT * FROM t2}
450} {1 999 1000 1001 {} {} 1 2 1 3 2 1}
drh82a48512003-09-06 22:45:20 +0000451
drh971a7c82004-09-24 12:48:12 +0000452# Ticket #918
453#
454do_test bind-10.11 {
455 catch {sqlite3_finalize $VM}
456 set VM [
457 sqlite3_prepare $DB {
458 INSERT INTO t2(a,b,c,d,e,f) VALUES(:abc,?,?4,:pqr,:abc,?4)
459 } -1 TAIL
460 ]
461 sqlite3_bind_parameter_count $VM
462} 5
drhc5cdca62005-01-11 16:54:14 +0000463do_test bind-10.11.1 {
464 sqlite3_bind_parameter_index 0 :xyz ;# ignore NULL VM arguments
465} 0
drh971a7c82004-09-24 12:48:12 +0000466do_test bind-10.12 {
467 sqlite3_bind_parameter_index $VM :xyz
468} 0
469do_test bind-10.13 {
470 sqlite3_bind_parameter_index $VM {}
471} 0
472do_test bind-10.14 {
473 sqlite3_bind_parameter_index $VM :pqr
474} 5
475do_test bind-10.15 {
476 sqlite3_bind_parameter_index $VM ?4
477} 4
478do_test bind-10.16 {
479 sqlite3_bind_parameter_name $VM 1
480} :abc
danielk1977b3bce662005-01-29 08:32:43 +0000481do_test bind-10.17 {
drh971a7c82004-09-24 12:48:12 +0000482 sqlite3_bind_parameter_name $VM 2
483} {}
danielk1977b3bce662005-01-29 08:32:43 +0000484do_test bind-10.18 {
drh971a7c82004-09-24 12:48:12 +0000485 sqlite3_bind_parameter_name $VM 3
486} {}
danielk1977b3bce662005-01-29 08:32:43 +0000487do_test bind-10.19 {
drh971a7c82004-09-24 12:48:12 +0000488 sqlite3_bind_parameter_name $VM 4
489} {?4}
danielk1977b3bce662005-01-29 08:32:43 +0000490do_test bind-10.20 {
drh971a7c82004-09-24 12:48:12 +0000491 sqlite3_bind_parameter_name $VM 5
492} :pqr
493catch {sqlite3_finalize $VM}
494
drh48e5aa22005-01-11 17:46:41 +0000495# Make sure we catch an unterminated "(" in a Tcl-style variable name
496#
danielk19774489f9b2005-01-20 02:17:01 +0000497ifcapable tclvar {
498 do_test bind-11.1 {
499 catchsql {SELECT * FROM sqlite_master WHERE name=$abc(123 and sql NOT NULL;}
500 } {1 {unrecognized token: "$abc(123"}}
501}
drh48e5aa22005-01-11 17:46:41 +0000502
drh82a48512003-09-06 22:45:20 +0000503finish_test