MySQL driver ClientFoundRows
configuration option doesn't change RowsAffected
for Update call
#6756
Labels
ClientFoundRows
configuration option doesn't change RowsAffected
for Update call
#6756
GORM Playground Link
go-gorm/playground#1
To be added
Description
To do an update currently, I have to call
.Find()
to verify the primaryKey exists before calling.Update()
. To avoid the firstFind
call, I thought I could checkRowsAffected
for the update call, but it will return 0 even if the primaryKey is found but the data I'm updating is the exact same as what's in the DB.MySQL has an option
ClientFoundRows
which changes the return result to whether the db found any rows to update, regardless of whether any rows were actually updated. This is what I want to return to indicate that rows were found, so that I don't need to callFind
first. Unfortunately, this configuration does not seem to change the result ofRowsAffected
when testing:Thus I think there's a bug in how gorm is handling the
ClientFoundRows
option for MySQL?The text was updated successfully, but these errors were encountered: