java.jdbc

Adding stropping and qualified identifiers to java.jdbc

Details

  • Type: Enhancement Enhancement
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code

Description

Following the following discussion:

https://groups.google.com/d/topic/clojure/j7fXdkFMrec/discussion

I've implemented a simple stropping feature that also provide a way to supply qualified identifiers and a function (as-identifier) that can be reused in user code. The implementation can be found there:

https://github.com/budu/java.jdbc/commit/0822d323cd4d267533a88241be68cb184ff9bf28

It's also attached to this issue.

Here's some example of how that feature could be used:

user> (create-table :foo [:bar :integer] [:baz :text])
"CREATE TABLE foo (bar integer, baz text)"
user> (create-table [:schema :foo] [:bar :integer] [:baz :text])
"CREATE TABLE schema.foo (bar integer, baz text)"
user> (with-stropping \" identity (create-table [:schema :foo] [:bar :integer] [:baz :text]))
"CREATE TABLE \"schema\".\"foo\" (\"bar\" integer, \"baz\" text)"
user> (with-stropping [[ ]] identity (create-table [:schema :foo] [:bar :integer] [:baz :text]))
"CREATE TABLE [schema].[foo] ([bar] integer, [baz] text)"

Activity

Hide
Sean Corfield added a comment -

with-naming-strategy, with-quoted-identifiers, as-quoted-str address this.

Show
Sean Corfield added a comment - with-naming-strategy, with-quoted-identifiers, as-quoted-str address this.
Hide
Sean Corfield added a comment -

Duplicate of https://github.com/clojure/java.jdbc/issues/7 - thanx for the patch!

Show
Sean Corfield added a comment - Duplicate of https://github.com/clojure/java.jdbc/issues/7 - thanx for the patch!

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: