有没有办法直接从ClojureQL的disj生成sql查询!conj!和更新!函数,而不是直接执行它们?
发布于 2011-09-09 00:26:05
不,这些方法直接执行它们各自的预准备语句。它们都是非常基础的。对于conj!和update-in!,请查看format名称空间中的conj-rows和update-vals函数中的internal调用:
(format "INSERT INTO %s %s VALUES (%s)"
(to-tablename table) columns template)
(format "UPDATE %s SET %s WHERE %s"
(to-tablename table) columns where)对于disj!,ClojureQL使用clojure.java.jdbc库delete-rows函数,该函数包含:
(format "DELETE FROM %s WHERE %s"
(as-identifier table) where)因此,基本上disj!可以使用java.jdbc的with-naming-strategy和with-quoted-identifiers宏来表示表名,而其他的则不能。
https://stackoverflow.com/questions/7335377
复制相似问题