On Fri, Apr 22, 2011 at 10:32 PM, Shantanu Kumar
<kumar.shant...@gmail.com> wrote:
> Listed below:
Thank you!

> 1. Allow _ (underscore) in field names

This already seems to work. I just tested the following - can you elaborate:

(deftest test-create
  (jdbc/with-connection (worldsingles-db)
    (jdbc/create-table :jdbcTestTable [:id :int] [:name_first
"varchar(32)"] ["name_last" "varchar(32)"])))

It created the following table:

mysql> desc jdbcTestTable;
+------------+-------------+------+-----+---------+-------+
| Field      | Type        | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+-------+
| id         | int(11)     | YES  |     | NULL    |       |
| name_first | varchar(32) | YES  |     | NULL    |       |
| name_last  | varchar(32) | YES  |     | NULL    |       |
+------------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

I agree that translating - / _ would be more idiomatic. I'm not sure
it needs to be more sophisticated than that tho'...

> 2. Provide a mechanism to show the SQL being executed (configurable,
> so that it can be turned off)

Good idea. Even better, a way to access statistics about the prepared
statement after execution - timing etc?

> 3. Allow users to flexibly convert from Clojure name to DB entity name

Right now you can specify :name or "name" in arguments. Records come
back with entity names as keywords. Could you elaborate on what you'd
want to see here, beyond the - / _ translation mentioned above?

> 4. Allow users to flexibly convert from DB entity name to Clojure name
> (this affects resultset-seq)

As per 3. could you give an example use case? I saw what your library
provides but I'm not entirely sure how many folks would need that
flexibility. What do others think?

> 5. Provide a mode to prevent write operations

Interesting idea but isn't that better handled by grants on the user
accessing the database?

> 6. An INSERT function that returns the generated key(s)

The current clojure.java.jdbc does this (I added a first cut of it as
part of the initial new version but it needs some streamlining). I was
disappointed the original c.c.sql just returned nil from insert
operations so I changed it to return a sequence of vector pairs
containing update counts and the resultset-seq map from the generated
keys. It's ugly right now so I'm looking for input there.
* Do we need the update counts?
* Do we need the map?
* Or just the key values?
* For multiple inserts, do we want to return a sequence of generated
keys, one per insert?
* Should there be a specific method to insert (one set of values | one
record) that returns keys?
* Or should it simply default to that for insert operations that have
a (single set of values | single record).

My personal feeling is that it should return just the key values, in a
vector, one per inserted record, with an option to turn it off, per
insert operation). Maybe as a convenience, if you only insert one
record, you get back just a key, rather than a vector of one key?

> 7. The function for creating tables is non-portable across databases
> -- make it known in the docstring

Or work hard to make it more portable :)

To me, a bigger problem is that c.j.j doesn't strop the entity names
so you can't have, e.g., columns named like SQL keywords. That will
definitely get fixed because the application I'm working on has such
column names. Of course stropping varies across database vendors...

> I am sure others will have additional points to share. I would suggest
> the configuration aspect be split into a separate library from
> c.c.sql. Even more importantly, I think it needs a certain degree of
> incubation before being promoted to clojure.java.jdbc.

Could you elaborate on the deficiencies you see in the configuration
part of c.j.j? I think your library provides some nice syntactic sugar
on creating the DB spec but since most projects do it only once per
application, I'm not sure that needs to be in standard library?
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.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

Reply via email to