<< Back to previous view

[JDBC-133] Provide optional :qualifier option to better support namespaced keywords as column identifiers Created: 14/Jun/16  Updated: 14/Jun/16  Resolved: 14/Jun/16

Status: Resolved
Project: java.jdbc
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Major
Reporter: Sean Corfield Assignee: Sean Corfield
Resolution: Completed Votes: 0
Labels: None


 Description   

Currently, you can pass an :identifiers function in options to a number of functions and java.jdbc calls (keyword (identifiers col-name)) to convert SQL column names into Clojure map keys. The default for :identifiers is clojure.string/lower-case.

With the increased focus on namespaced keywords in Clojure 1.9.0 (with the introduction of clojure.spec), it would be nice to have an easy way to tell these functions to produce qualified keywords. You can do that right now by specifying something like (comp #(str "foo/" %) str/lower-case) but that's ugly!

Suggestion: add optional :qualifier option that is used as the first argument in the keyword call, which defaults to nil.



 Comments   
Comment by Sean Corfield [ 14/Jun/16 10:08 PM ]

Will be in 0.6.2





[JDBC-134] postgres insert results should respect `indentifiers` option Created: 22/Jun/16  Updated: 23/Jun/16  Resolved: 22/Jun/16

Status: Resolved
Project: java.jdbc
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Ryan Fowler Assignee: Sean Corfield
Resolution: Completed Votes: 0
Labels: None
Environment:

postgres


Attachments: Text File 0001-test-if-insert-results-respect-identifiers.patch    

 Description   

When `(insert-multi!)` is called against a postgres database with row maps, the inserted row is returned but there's not an `identifiers` option to change the field names into the application's normal key format.

I attached a failing test. If you want to provide a little direction, I'd be willing to work on a fix as well.



 Comments   
Comment by Sean Corfield [ 22/Jun/16 11:55 AM ]

Good catch. Yes, Postgres is the only DB that returns rows, rather than just numbers, and I only ran across that recently so there's never been a need for :identifiers on insertion. Does this apply only to insert-multi! or does it affect insert! too?

Comment by Ryan Fowler [ 22/Jun/16 2:27 PM ]

It affects both. Both return the result of insert-cols! without modification.

Comment by Sean Corfield [ 22/Jun/16 6:24 PM ]

Thanks for confirmation!

Comment by Sean Corfield [ 22/Jun/16 10:09 PM ]

Will be in 0.6.2. Also made sure the tests exercise :qualifier with inserts.

Comment by Ryan Fowler [ 23/Jun/16 9:16 AM ]

Awesome, Thanks!





Generated at Wed Jun 29 02:25:42 CDT 2016 using JIRA 4.4#649-r158309.