honeysql

Discussion of https://github.com/seancorfield/honeysql :slightly_smiling_face:
OliverM 2020-03-26T18:11:59.002700Z

Can HoneySQL further transform parameterized SQL into pure SQL? E.g. instead of

(-> (insert-into :properties)
    (columns :name :surname :age)
    (values
     [["Jon" "Smith" 34]
      ["Andrew" "Cooper" 12]
      ["Jane" "Daniels" 56]])
    sql/format)
=> [#sql/regularize
    "INSERT INTO properties (name, surname, age)
     VALUES (?, ?, ?), (?, ?, ?), (?, ?, ?)"
    "Jon" "Smith" 34 "Andrew" "Cooper" 12 "Jane" "Daniels" 56]
is there something that can return
"INSERT INTO properties (name, surname, age)
 VALUES ("Jon", "Smith", 34),
        ("Andrew", "Cooper", 12)
        ("Jane", "Daniels", 56)"

seancorfield 2020-03-26T18:23:23.003700Z

No, because HoneySQL doesn't know how to transform Clojure values to SQL fragments -- that's handled by the JDBC driver when the statement is being prepared (in clojure.java.jdbc or next.jdbc).

OliverM 2020-03-26T18:35:05.004Z

Thanks @seancorfield, good to know