doUpdateSQL method
FutureOr
doUpdateSQL(
- String entityName,
- String table,
- SQL sql,
- Object id,
- Transaction transaction,
- PostgreSQLConnectionWrapper connection, {
- bool allowAutoInsert = false,
override
Implementation
@override
FutureOr doUpdateSQL(String entityName, String table, SQL sql, Object id,
Transaction transaction, PostgreSQLConnectionWrapper connection,
{bool allowAutoInsert = false}) {
if (sql.isFullyDummy) return id;
return connection
.mappedResultsQuery(sql.sql,
substitutionValues: sql.parametersByPlaceholder)
.resolveMapped((results) {
if (results.isEmpty) {
var entry = sql.parametersByPlaceholder;
if (!allowAutoInsert) {
throw StateError(
"Can't update not stored entity into table `$table`: $entry");
}
var fields = sql.namedParameters!;
return _updateAutoInsert(
transaction, entityName, table, fields, connection);
}
return _resolveResultID(results, table, sql);
});
}