honeysql

rpatrelle 2024-09-06T14:31:19.283549Z

I want to understand how to manage simple quote used to manage string literals with honey sql . For example, I want to express such sql request in honey sql :

SELECT TO_CHAR(date, 'HH24:MI') FROM my_table
Only way I found now is to use raw . I am not satisfied by this solution:
(sql/format {:select [[[:to_char :date [:raw "'HH24:MI'"]]]]
               :from :my_table})
I probably missed something in documentation...

p-himik 2024-09-06T14:34:09.900879Z

You can use :inline.

p-himik 2024-09-06T14:34:53.561389Z

(sql/format {:select [[[:to_char :date [:inline "HH24:MI"]]]]})
=> ["SELECT TO_CHAR(date, 'HH24:MI')"]

rpatrelle 2024-09-06T14:44:44.230099Z

Ok, thanks