Fork me on GitHub
#hugsql
<
2022-03-23
>
metame17:03:03

Trying to integrate hugsql in an existing project to replace yesql. Have an insert query like:

-- :name insert-scim-user!
insert into scim_user
(user_id, account_id, data)
values
(:user_id, :account_id, :data)
When I call it (insert-scim-user<! db {:user_id "blahblah" :account_id 2039 :data "{}"}) Get exception: SQLException Statement.executeQuery() cannot issue statements that do not produce result sets. com.mysql.cj.jdbc.exceptions.SQLError.createSQLException (SQLError.java:129) This is using:
[com.layerware/hugsql "0.5.1"]
[org.clojure/java.jdbc "0.7.10"]
[mysql/mysql-connector-java "8.0.28"]
The project was originally on [mysql/mysql-connector-java "5.1.35"] and produced a similar error. I upgraded to it latest driver to see if it would resolve but still the same. The error on 5.1.35 was: SQLException Can not issue data manipulation statements with executeQuery(). com.mysql.jdbc.SQLError.createSQLException (SQLError.java:998) Inserts are working fine in our yesql code with these deps.

metame18:03:55

ok reading docs closer, I see the command syntax now facepalm

lukasz19:03:23

Yeah, you need to add :! after the function name in the SQL file

👍 1