Also, is there any form of update that returns the record updated (and what if it wasn't updated for some reason)?
t
Toshihiro Nakamura
12/08/2022, 2:43 PM
Update query returns a new record that may have a new version number and a new timestamp:
Copy code
val updatedAddress = db.runQuery { QueryDsl.update(a).single(newAddress) }
However, the record does not include updates on the database side.
Toshihiro Nakamura
12/08/2022, 2:44 PM
To get a new record from database, you have to issue a new select query.
d
dave08
12/08/2022, 2:47 PM
Oh.. and with the
set { }
version, I'd suppose that even more so... (that's the one I'm using...). the
single()
version only updates what changed, or all the fields?
t
Toshihiro Nakamura
12/08/2022, 2:56 PM
The
set {}
version does not return new records. The
single()
version updates all the fields.
d
dave08
12/08/2022, 2:58 PM
I wonder if the dbs like postgres that support returning things in the same update could somehow be supported, while for those that don't it could be a new request...