Fork me on GitHub
#sql
<
2019-01-25
>
jaihindhreddy13:01:59

Can I do upsert on mysql with jdbc/insert-multi!?

jaihindhreddy13:01:38

By upsert I mean, on duplicate key update

seancorfield16:01:00

You'll have to use execute! for that @jaihindh.reddy

👍 5
jaihindhreddy16:01:55

This is what I came up with:

(-> (honey/insert-into :post)
            (honey/values posts)
            hon/format
            (update 0 str " on duplicate key update commentCount=values(commentCount), points=values(points)")
            (jdbc/execute! conn))