New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delimiter error when use two database #213

Closed
oscnet opened this Issue Mar 3, 2014 · 3 comments

Comments

Projects
None yet
3 participants
@oscnet
Copy link

oscnet commented Mar 3, 2014

(def db1 {:classname "com.mysql.jdbc.Driver"
              :subprotocol "mysql"
              :subname "//localhost:3306/aa"
              :useUnicode "yes"
              :characterEncoding "UTF-8"
              :user "aa"
              :delimiters "`"
              :password "--"})

(def db2 {
           :classname "oracle.jdbc.driver.OracleDriver"
           :subprotocol "oracle"
           :subname "thin:@//localhost:1521/ccc"
           :user "web"
           :password "cccccc"})

(defentity a  
  (database db2))

(defentity b
  (belongs-to a)
  (database db2))

 (->
   (select* b)
   (with a (fields :c))
   (where {:id id})
   (select)
   (as-sql))

get: 

SELECT "b".*, `a` . `c` 
FROM "b" LEFT JOIN "a" ON  ` a`  .`id`  = `b`.`a_id` 
WHERE ("b"."id" = ?)

table a use " but table b use `

@immoh

This comment has been minimized.

Copy link
Member

immoh commented Mar 25, 2014

Yes, I concur that this is a bug. Pull requests are welcome.

@cbenning

This comment has been minimized.

Copy link
Contributor

cbenning commented Apr 3, 2014

Had the exact same issue. The db-specific is being ignored in favor of global default. workaround, just use (set-delimiter "`"). I've dug to find the solution, but cannot. Seems like it happens before "delimit-str" in engine.clj is called.

@immoh

This comment has been minimized.

Copy link
Member

immoh commented Apr 15, 2014

This is fixed in 0.3.1

@immoh immoh closed this Apr 15, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment