@seancorfield How to write something like select concat(IFNULL(S.FIRST_NAME,''),' ',IFNULL(S.LAST_NAME,''),' (',R.DESCRIPTION,')') name from sometable
? Do I need to use sql/raw
?
@gdrte I'd have to experiment. Mostly that should be regular SQL function call syntax but probably some sql/inline
for the values that should not be lifted out as parameters.
Something like
user=> (-> (select #sql/call [:concat #sql/call [:ifnull :firstname #sql/inline "''"] #sql/inline "' '" #sql/call [:ifnull :lastname #sql/inline "''"] #sql/inline "' ('" :description #sql/inline "')'"]) (from :sometable) (h/format))
["SELECT concat(ifnull(firstname, ''), ' ', ifnull(lastname, ''), ' (', description, ')') FROM sometable"]
user=>
but frankly that is so ugly I wouldn't bother using HoneySQL for this, I'd just use a raw SQL string.Sure, will go with raw SQL then. Thank you.
I’ve configured hugsql along with honeysql, since by default hugsql uses clojure.java.jdbc, I hope it won’t cause any trouble doing best of both worlds.