korma / Korma

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

Inconsistency between select, update and insert. #211

Closed siscia closed 9 years ago

siscia commented 10 years ago

I find the behaviour of select, update and insert inconsistent, let me explain.

IMHO

[1]: it may happen that I want to save in the db some data who are linked to some other, for any reason. Let's say that for calculate the row a I need to multiply the value of the row b times a value that change during the time and that such computation is pretty heavy, plus the row a is very important and I need to access it very quickly. I just run a prepare and my life is easy, but if I change the value of b such prepare should re-run [2]: I just try it in the repl, after some test fails, I can understand this behaviour in any way.

immoh commented 10 years ago

[1] I disagree that this should be the default behavior as you need this only if your prepare fn depends on the columns that are not updated. If it does you can always run select manually before updating.

[2] Currently insert is not returning the inserted row but the generated keys as returned by the driver. For some drivers, this may be the entire row but some will only return the generated primary key. There have been some requests to change this behavior to return the entire row, what would be the benefit to change it to nil?