There are two hooks for naming strategies in java.jdbc:

* :identifiers - for converting ResultSet column names to keywords
* :entities - for converting Clojure keywords/string to SQL entity names

:identifiers defaults to clojure.string/lower-case - so SQL column
names become lowercase keywords.

:entities defaults to identity - so Clojure keywords and strings
simply become SQL table and column names as-is.

A call to the quoted function is a suitable argument for :entities -
available on delete!, insert!, update!, create-table-ddl and
drop-table-ddl. For the execute! and query functions (and others), you
pass raw SQL so you are expected to have taken care of quoting
entities yourself.

    (insert! db-spec :fruit {:name "Apple" :appearance "Round" :cost
99} :entities (quoted \`))

In the generated SQL, this will produce `fruit`, `name`, `appearance`,
and `cost`.

The docstrings on the new API could certainly make that clearer. I'm
planning to overhaul the docstrings now the API is stable and public -
since I can see that the arglists alone are far from satisfactory -
and I'm also in the middle of a major overhaul of the java.jdbc
section of clojure-doc.org to provide more examples, with full
tutorials on each of the major functions.

Does that help?

Sean


On Sat, Dec 21, 2013 at 11:56 AM, rod naph <rod.n...@gmail.com> wrote:
> with the new release of java.jdbc 0.3.0 i can't quite work out how the
> quoting support for column names is supposed to work.  i can see the
> strategy for the deprecated namespace, but the new core namespace only
> contains a function "quoted" - which isn't used directly at all.
>
> so what's the deal now - do we need to handle this in client code, or am i
> missing a trick?
>
> thanks,
> rod.
>
> --
> --
> 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.



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