[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Re: Problem with sqlite3 egg
From: |
Alejandro Forero Cuervo |
Subject: |
[Chicken-users] Re: Problem with sqlite3 egg |
Date: |
Fri, 10 Aug 2007 11:54:47 -0500 |
User-agent: |
Mutt/1.5.16 (2007-06-11) |
> if you pass an SQL string to sqlite3:for-each-row as the statement, the
> code compiles this string creating a temporary statement handle which is
> then finalized upon exit from the dynamic scope of sqlite3:for-each-row
> using a dynamic-wind construct.
That makes perfect sense, I understand the problem now.
I've settled down on the following style:
(define (db-exec db sql)
(iterator->stream
(lambda (collect _)
(receive (stmt rest)
(sqlite3:prepare db sql)
(sqlite3:for-each-row (compose c vector) stmt)
(sqlite3:finalize! stmt)))))
This is because my code just calls db-exec with the SQL string and the
DB handle and expectes db-exec to return the stream with the results.
If I where to use sqlite3:call-with-temporary-statements, I would have
to make changes to all my code, not just to the db-exec function.
I have one question, though. In the unlikely chance that a stream
returned by db-exec doesn't get traversed until the end, the call to
sqlite3:finalize! won't be made. Will the garbage collector take care
of finalizing the sqlite3:statement (by means of a finalizer on the
statement object) anyway?
Thanks for your help, Thomas!
Alejo.
http://azul.freaks-unidos.net/
- Re: [Chicken-users] Question about easyffi, (continued)
- Re: [Chicken-users] Question about easyffi, Ivan Raikov, 2007/08/06
- Re: [Chicken-users] Question about easyffi, felix winkelmann, 2007/08/06
- Re: [Chicken-users] Question about easyffi, Ivan Raikov, 2007/08/06
- Re: [Chicken-users] Question about easyffi, felix winkelmann, 2007/08/06
- Re: [Chicken-users] Question about easyffi, Ivan Raikov, 2007/08/06
- Re: [Chicken-users] Question about easyffi, felix winkelmann, 2007/08/06
- Re: [Chicken-users] Question about easyffi, Ivan Raikov, 2007/08/06
- Re: [Chicken-users] Question about easyffi, felix winkelmann, 2007/08/06
- [Chicken-users] Problem with sqlite3 egg, Alejandro Forero Cuervo, 2007/08/08
- [Chicken-users] Re: Problem with sqlite3 egg, Thomas Christian Chust, 2007/08/09
- [Chicken-users] Re: Problem with sqlite3 egg,
Alejandro Forero Cuervo <=
- [Chicken-users] Re: Problem with sqlite3 egg, Thomas Christian Chust, 2007/08/10