Re: Tcl interface: array not created when ...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Tcl interface: array not created when ...

Rob Sciuk


To: [hidden email]
Subject: [sqlite] Bug : Tcl interface: array not created when call "db
eval {...} ?array-name? ?script?"

     [ The following text is in the "ISO-8859-1" character set. ]
     [ Your display is set for the "US-ASCII" character set.  ]
     [ Some characters may be displayed incorrectly. ]

Hi All!
I use sqlite3 ver 3.7.15.1 and simple test:

1. package require sqlite3
2. sqlite3 db :memory:
3. db eval {CREATE TABLE x(a,b)}
4. db eval {INSERT INTO x VALUES(1,2)}
5. #set tempvar ""
6. db eval {SELECT a,b FROM x} tempvar {
7.   puts "a = $tempvar(a)"
8. }
9. db close

When line 5 commented this test run ok. If we uncomment line 5 then
tcl interpreter
fail with error "can't read "tempvar(a)": variable isn't array". Looks
like
sqlite engine don't check/unset variable "array-name" (like most other tcl
commands, thats accept "varName"/"arrayName").


--
dixi.

Dixi,

try replacing "set tempvar """ with:

  array set tempvar {}

Cheers,
Rob.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users