doCountSQL method
FutureOr<int>
doCountSQL(
- String entityName,
- String table,
- SQL sql,
- Transaction transaction,
- PostgreSQLConnectionWrapper connection,
override
Implementation
@override
FutureOr<int> doCountSQL(String entityName, String table, SQL sql,
Transaction transaction, PostgreSQLConnectionWrapper connection) {
return connection
.mappedResultsQuery(sql.sql,
substitutionValues: sql.parametersByPlaceholder)
.resolveMapped((results) {
var count = results
.map((e) {
var tableResults = e[table] ?? e[''];
var count = tableResults?['count'] ?? 0;
return count is int ? count : int.tryParse(count.toString().trim());
})
.whereType<int>()
.first;
return count;
});
}