chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Strange format sqlite3 interaction


From: John Gillespie
Subject: [Chicken-users] Strange format sqlite3 interaction
Date: Fri, 01 Dec 2006 13:43:00 -0500

The problem illustrated below is driving me crazy(er). When sqlite3:prepare is called with a literal string, it works as advertised. When called using format to generate the string, it fails! Presumably, the string generated by format is being corrupted somewhere before sqlite gets ahold of it. The trick of first binding the format-generated string to q and then calling sqlite3:prepare appears to fix the problem, but when I use a let binding for q in a function even that fails. All very strange! Has anyone else seen this problem?

(Except for this one issue, sqlite3 is working very well for me.)

Version 2.5 - macosx-unix-gnu-ppc - [ dload ptables applyhook ]
(c)2000-2006 Felix L. Winkelmann
#;1> (require-extension sqlite3)
; loading /usr/local/lib/chicken/1/sqlite3.so ...
; loading /usr/local/lib/chicken/1/tinyclos-base.so ...
; loading /usr/local/lib/chicken/1/synch-support.so ...
#;2> (define *tdb* (sqlite3:open "/Users/john/Misc/dbs/text.db"))
#;3> (sqlite3:prepare *tdb* "select * from nodes where id=1")
#<sqlite3:statement>
""
#;4> (sqlite3:prepare *tdb* (format "select * from nodes where id=~a" 1))
Error: (sqlite3:prepare) near "?": syntax error
#<sqlite3:database>
"select * from nodes where id=1"

        Call history:

<eval> (sqlite3:prepare *tdb* (format "select * from nodes where id=~a" 1)) <eval> (format "select * from nodes where id=~a" 1) <--
#;4> (define q (format "select * from nodes where id=~a" 1))
#;5> (sqlite3:prepare *tdb* q)
#<sqlite3:statement>
""
#;6>






reply via email to

[Prev in Thread] Current Thread [Next in Thread]