[plt-scheme] How to use sqlite?

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Thu Feb 19 22:57:22 EST 2009

I just found a segfault with finalize on 64-bit linux. Is that what
you're using?

I haven't been able to figure out the solution yet though.


On Thu, Feb 19, 2009 at 10:22 PM,  <synx13+plt at gmail.com> wrote:
> My code it is broke. The following example script seems to segfault any
> plt executable, when using (planet jaymccarthy/sqlite:3). I know the
> point of prepared statements is being able to run them twice, so not
> sure what I'm doing wrong here.
> #lang scheme
> (require (prefix-in sqlite3: (planet jaymccarthy/sqlite:3)))
> (let ((db (sqlite3:open ':memory:)))
>  (sqlite3:exec/ignore db "CREATE TABLE foo (id INTEGER PRIMARY KEY, bar INTEGER, baz TEXT);")
>  (let ((insert-statement (sqlite3:prepare db "INSERT INTO foo (bar,baz) VALUES (?,?);")))
>    (sqlite3:run insert-statement 2 "two")
>    (sqlite3:reset insert-statement) ; eww
>    (display "Hmm..\n")
>    (sqlite3:run insert-statement 3 "three")
>    (display "HMM..\n")
>    (sqlite3:finalize insert-statement)) ; ewwww
>    (sqlite3:close db))
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the users mailing list.