ah, thank you so much for the hint, forcing the sequence did the trick.

out of curiousity: while the following works

(cql/run [*connection* result] (cql/query * people) (doall (take 5 result)))

this does not

(doall (cql/run [*connection* result] (cql/query * people) (take 5 result)))

suggesting that the ResultSet on which the lazy sequence relies for
realizing its values is closed once cql/run has returned - does this
sound like a reasonable explanation?


On Tue, Aug 11, 2009 at 9:30 PM, Christopher Wilson <
christopher.j.wil...@gmail.com> wrote:

>
> It looks like (speaking without having looked at the ClojureQL source)
> the results are being returned as a lazy sequence.  In the first case
> the sequence isn't being realized but it is in the second.
>
> On Tue, Aug 11, 2009 at 2:15 PM, Maximilian
> Karasz<maximilian.kar...@googlemail.com> wrote:
> > Hi,
> >
> > i've been wanting to play with clojureql for a while and now it seems i'm
> > pretty much stuck at the entry point...
> >
> > a simple example:
> >
> > ; set up includes, db connection info etc
> > (require '[dk.bestinclass.clojureql :as cql])
> > (cql/load-driver "com.mysql.jdbc.Driver")
> > (def *connection* (cql/make-connection-info "mysql" "//path_to/db" "user"
> > "password"))
> >
> >
> > so far so good. let's assume i have a table baned people and want to
> fetch
> > the first five entries:
> >
> > user=> (cql/run [*connection* result] (cql/query * people) (take 5
> result))
> > java.sql.SQLException: Operation not allowed after ResultSet closed
> >
> >
> > this is kind of unexpected... interestingly, the following works just
> fine:
> >
> >
> > (cql/run [*connection* result] (cql/query * people) (dosync (println
> (take 5
> > result))))
> >
> > ... prints 5 people...
> >
> > The ResultSet always seems to be closed unless i print it right away...
> what
> > am i doing wrong?
> >
> > cheers,
> >
> > -Max
> >
> > >
> >
>
>
>
> --
> Chris Wilson <christopher.j.wil...@gmail.com>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to