Open EasonYan opened 7 years ago
I'm afraid it is not possible to control the order of columns to update. The reason why columns are ordered is to generate consistent SQL across different Clojure versions.
Can you elaborate on reasons why the order makes difference in MySQL?
hi, I'm finding myself exactly in this situation. i want to batch update a unique key column by increments of 2, and korma renders the error duplicate entry. while standard sql allows me to order desc so statements can be executed, korma doesn't give me the chance of ordering by desc before executing. is there any other way except falling back to raw ?
@avabinary This issue is about order of columns, I think you are talking about order of rows. It should be fairly straightforward to make update support order-by, pull request welcome :)
@immoh would passing a sorted-map
into set-field
work?
I'm going through old issues and trying to clean them up. Has this issue persisted?
If there hasn't been a response to this issue in 2 weeks, I'll close the ticket.
@venantius I don't think it would. Korma is explicitly ordering column names so that generated SQL is same across Clojure versions.
(def my-map {:a 1 :b 2} (->(update* table) (set-field my-map) (exec) ) it seems that korma will always exec in an order like this "set a=1 and b=2",because letter a is always ahead of letter b。 my question is that are there any methods that can make korma exec like this "set b=2 and a=1"。because the set sequence make different in mysql.Thanks a lot!