[jOOQ/jOOQ#14573] Don't refresh if only identity is requested
Before this new feature set, we used to refresh only when generated keys didn't succeed, i.e. when columns other than the identity were requested. This must be maintained to avoid unnecessary queries.
This commit is contained in:
parent
b7a392066f
commit
0590c6b3ea
@ -475,7 +475,15 @@ public final class SettingsTools {
|
||||
*/
|
||||
public static final boolean returnAnyOnUpdatableRecord(Settings settings) {
|
||||
return !FALSE.equals(settings.isReturnIdentityOnUpdatableRecord())
|
||||
|| TRUE.equals(settings.isReturnAllOnUpdatableRecord())
|
||||
|| returnAnyNonIdentityOnUpdatableRecord(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether any non-identity value should be returned on an
|
||||
* {@link UpdatableRecord} operation.
|
||||
*/
|
||||
public static final boolean returnAnyNonIdentityOnUpdatableRecord(Settings settings) {
|
||||
return TRUE.equals(settings.isReturnAllOnUpdatableRecord())
|
||||
|| TRUE.equals(settings.isReturnDefaultOnUpdatableRecord())
|
||||
|| TRUE.equals(settings.isReturnComputedOnUpdatableRecord());
|
||||
}
|
||||
|
||||
@ -49,6 +49,7 @@ import static org.jooq.SQLDialect.MARIADB;
|
||||
import static org.jooq.SQLDialect.MYSQL;
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.conf.SettingsTools.returnAnyNonIdentityOnUpdatableRecord;
|
||||
import static org.jooq.conf.SettingsTools.returnAnyOnUpdatableRecord;
|
||||
import static org.jooq.conf.SettingsTools.updatablePrimaryKeys;
|
||||
import static org.jooq.conf.WriteIfReadonly.IGNORE;
|
||||
@ -227,7 +228,7 @@ public class TableRecordImpl<R extends TableRecord<R>> extends AbstractQualified
|
||||
|
||||
// [#1859] In some databases, not all fields can be fetched via getGeneratedKeys()
|
||||
Configuration c = configuration();
|
||||
if (returnAnyOnUpdatableRecord(c.settings())
|
||||
if (returnAnyNonIdentityOnUpdatableRecord(c.settings())
|
||||
|
||||
// [#11620] Refresh only if the RETURNING clause didn't run
|
||||
// E.g. in MySQL when there was no identity column
|
||||
|
||||
Loading…
Reference in New Issue
Block a user