3

有没有办法从 ClojureQL 的 disj 生成 sql 查询!康杰!并更新!函数,而不是直接执行它们?

4

1 回答 1

1

不,这些方法直接执行它们各自的预处理语句。它们都很基本。对于conj!and update-in!,请查看您可以在内部命名空间中找到的and函数中format的调用:conj-rowsupdate-vals

 (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'swith-naming-strategywith-quoted-identifiers宏作为表名,而另一个则不能。

于 2011-09-08T16:26:05.367 回答