Re: Using dynamic variables in libraries [Re: ANN clojure.java.jdbc 0.2.0]

2012-05-03 Thread Phil Hagelberg
On Wed, May 2, 2012 at 10:15 PM, Sean Corfield wrote: > I think the problem is that "good" Clojure style is still evolving and > a lot of the libraries were started a while ago before the "no dynamic > variables" guideline really took hold. That's to be expected in a new > and evolving language.

Re: Using dynamic variables in libraries [Re: ANN clojure.java.jdbc 0.2.0]

2012-05-02 Thread Sean Corfield
Sorry for the slow response - we've been wrapped up in a gigantic data migration at work... On Tue, May 1, 2012 at 4:26 AM, Wolodja Wentland wrote: > It certainly does, but I am none the wiser. I always had the > feeling/impression > that dynamic variables are something to be avoided, but I see

Re: Using dynamic variables in libraries [Re: ANN clojure.java.jdbc 0.2.0]

2012-05-01 Thread Wolodja Wentland
On Fri, Apr 27, 2012 at 22:21 -0700, Sean Corfield wrote: > On Fri, Apr 27, 2012 at 4:14 AM, Wolodja Wentland wrote: > > Could you elaborate on that please? I see that dynamic variables are used > > quite > > often to give the user the ability to configure/change the behaviour of a > > library. T

Re: Using dynamic variables in libraries [Re: ANN clojure.java.jdbc 0.2.0]

2012-04-27 Thread Sean Corfield
On Fri, Apr 27, 2012 at 4:14 AM, Wolodja Wentland wrote: > Could you elaborate on that please? I see that dynamic variables are used > quite > often to give the user the ability to configure/change the behaviour of a > library. That approach is often coupled with a macro that changes the bindings

Using dynamic variables in libraries [Re: ANN clojure.java.jdbc 0.2.0]

2012-04-27 Thread Wolodja Wentland
On Thu, Apr 26, 2012 at 23:35 -0700, Sean Corfield wrote: > On Tue, Apr 24, 2012 at 8:30 PM, Michael wrote: > > Would it be possible to make resultset-seq a dynamic var > > No, that certainly is not going to happen. Dynamic vars are not the > right way to build an API in Clojure. Could you elabo

Re: ANN clojure.java.jdbc 0.2.0

2012-04-26 Thread Sean Corfield
It looks like there are two issues here... On Tue, Apr 24, 2012 at 8:04 PM, Michael wrote: > (defn- oracle-insert-sql [table pk-col-name pk-seq-name ks] >   (let [cols (apply str (interpose \, (map jdbc/as-identifier ks))) >         n (count ks) >         qmarks (apply str (interpose \, (repeat n

Re: ANN clojure.java.jdbc 0.2.0

2012-04-26 Thread Sean Corfield
On Tue, Apr 24, 2012 at 8:30 PM, Michael wrote: > Would it be possible to make resultset-seq a dynamic var No, that certainly is not going to happen. Dynamic vars are not the right way to build an API in Clojure. > bind in custom result set mapping without having to make two passes through > the

Re: ANN clojure.java.jdbc 0.2.0

2012-04-25 Thread Sean Corfield
Just so you don't think I'm ignoring these posts, I'm a bit tied up with work for the next week or so but will dig into your questions when I get a chance and I'd certainly like to make it easier for you to work with Oracle than it appears to be right now (although it would help me a lot if you cou

Re: ANN clojure.java.jdbc 0.2.0

2012-04-24 Thread Michael
I think I was leaking result sets. (defn oracle-insert-record [table pk-col-name pk-seq-name record] (let [sql (oracle-insert-sql table pk-col-name pk-seq-name (keys record))] (with-open [^PreparedStatement pstmt (.prepareStatement (jdbc/connection) sql,

Re: ANN clojure.java.jdbc 0.2.0

2012-04-24 Thread Michael
Would it be possible to make resultset-seq a dynamic var so that you can bind in custom result set mapping without having to make two passes through the results? For instance, I would want to map sql date/timestamp to joda DateTime and T/F to true/false directly. > > -- You received this mess

Re: ANN clojure.java.jdbc 0.2.0

2012-04-24 Thread Michael
Would be convenient to have set-parameters public. I'm experimenting with a couple of fns to insert into oracle and oracle's sequences for generated keys are a headache. What's below is not fully tested but should give you an idea of the sql I'm dealing with. Any pointers on how to leaverage ja