On Tue, May 7, 2013 at 8:08 AM, Thomas Heller <th.hel...@gmail.com> wrote:
> 1) Why the keyword args to most functions?

Because they're optional for most people.

> entities/identifiers in
> particular. My SQL Tables have columns like "created_at", "created_by",
> since SQL doesnt like "-" as separators, I still want to use "-" in Clojure
> so on insert I do
>
> (j/insert! db table {:created-by 1, :name "test"} :entities #(str/replace %
> #"-" "_"))

Or:

(dsl/entities #(str/replace % #"-" "_")
  (j/insert! db table {:created-by 1, :name "test"}))

(and I'd make that a named function and wrap any blocks of DB code in
dsl/entities).

> All is fine until I want to use the return value of insert (aka the inserted
> record + the generated id) which then equals

Hmm, insert! should return either a sequence of just generated keys or
a sequence of row change counts. Not sure how you're getting the
translated column names back - can you show your exact code?

> In my case it would be sufficient if I could use the db map to specify this
> behavior, and one could still override this by just doing
>
> (j/insert! (assoc db :identifiers some-fn) table record). I realize that db
> is a "Connectable" and not always a map, but since its forced to a map under
> the hood anyways why not force it outside too.

And specifically the db object does not take part in the SQL
generation which is why this cannot work (I discussed this at length
in another thread).

> 2) Transaction Management? I dont quite understand what the point of the
> ":transaction?" option is since you should be able to infer this information
> at runtime? Seems to basically duplicate what Connection.setAutoCommit
> already does?

You would never need :transaction? unless you had some very specific,
strange edge case so you can just ignore it.

The implementation uses it and there have been some specific edge
cases people have requested for specific DBs where they've needed to
control transactions at that level.
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to