On Fri, Oct 15, 2010 at 1:49 AM, David Powell <djpow...@djpowell.net> wrote:
> I'm in favour of down-casing - at least by default.  Some processing is going 
> to happen anyway, as column names might contain spaces, which wouldn't
> be allowed in keywords.
>
> --
> Dave

One of the more significant nuisances in Clojure/Java interop is that
if you use some sort of wrapper library which converts Clojure things
to Java, and then converts from Java back to Clojure, you often end up
with something different than you started.  Anywhere we can ameliorate
this, we should.

For example, if I create a table using clojure.contrib.sql, where the
column names are things like :numberOfApples, and then I load in a
bunch of maps of the form {:numberOfApples 2}, {:numberOfApples 5},
and so on, then when I fetch them out of the database, I really need
them to be {:numberOfApples 2}, etc. so that I can compare them with
the original maps used to fill the database to begin with.

Right now, I get back {:numberofapples 2}.  Yes, SQL is usually case
insensitive, but Clojure is not, so everything breaks down if you
don't get back the maps in the form you started with.  Since SQL
typically *stores* the column names internally in mixed case (even
though it ignores the case for querying purposes), you might as well
retrieve them in mixed case so it matches the form you started with.

Why would I write my column names using mixed case?  Because I once
tried using :number-of-apples to match Clojure's conventions, but got
burned by a number of third-party tools gagging on the hyphens.

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