Can you not simply:

(jdbc/with-connection db2
    (jdbc/with-query-results results
      query
      {:result-type :forward-only
       :fetch-size 1000}
      (jdbc/with-connection db1
         ;; read and write?
       )))

?
On Tue, Oct 9, 2012 at 2:53 PM, Brian Craft <craft.br...@gmail.com> wrote:
>
> On Tuesday, October 9, 2012 12:11:28 PM UTC-7, Tassilo Horn wrote:
>>
>> Brian Craft <craft...@gmail.com> writes:
>>
>> Hi Brian,
>>
>> > If (read-stuff) is not lazy, then this looks pretty simple: all the
>> > data is loaded in memory & returned to (write-stuff).  If the data is
>> > large you wouldn't want it all in memory. What then? Could you make
>> > read-stuff return a lazy sequence? My impression after a brief
>> > experiment is that this doesn't work: when the inner with-connection*
>> > returns, the db connection is closed. A lazy sequence from
>> > (read-stuff) then can't be evaluated w/o throwing an error.
>>
>> Yes, that's true.  Maybe Korma [1] is better suited for this kind of
>> operation.
>>
>
> Damn. I was hoping there was some lispy fp thing I was missing here, but
> *db* really is just a global variable that fails in the same way that
> globals fail in all languages.
>
> Thanks for the link to korma.
>
> --
> 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

-- 
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