execute method
Executes an arbitrary command.
Implementation
@override
Future<dynamic> execute(String sql,
{Map<String, dynamic>? substitutionValues, Duration? timeout}) async {
timeout ??= const Duration(seconds: 30);
var now = DateTime.now().toUtc();
var dbConnection = await executionContext;
try {
var rows = await dbConnection.query(sql,
substitutionValues: substitutionValues,
timeoutInSeconds: timeout.inSeconds);
var mappedRows = rows.map((row) => row.toList()).toList();
logger.finest(() =>
"Query:execute (${DateTime.now().toUtc().difference(now).inMilliseconds}ms) $sql -> $mappedRows");
return mappedRows;
} on PostgreSQLException catch (e) {
final interpreted = _interpretException(e);
if (interpreted != null) {
throw interpreted;
}
rethrow;
}
}