korma / Korma

Tasty SQL for Clojure.
http://sqlkorma.com
1.48k stars 222 forks source link

Missing REPLACE or UPSERT and SELECT FOR UPDATE #395

Open Janderio opened 5 years ago

Janderio commented 5 years ago

When using MariaDB REPLACE as addition to INSERT would be nice to have here.

See: https://mariadb.com/kb/en/library/replace/ It's just try to insert but update if exists. and https://mariadb.com/kb/en/library/set-transaction/#read-committed (Locking reads) if you want a max + 1 for insert without giving double a chance where auto_increment does not work.

(If one of you know how to "INSERT ... VALUES (SELECT MAX(..)+1) ..) .." in KORMA would be nice to know!)