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);
final now = DateTime.now().toUtc();
final dbConnection = await executionContext;
try {
final rows = await dbConnection!.query(
sql,
substitutionValues: substitutionValues,
timeoutInSeconds: timeout.inSeconds,
);
final 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;
}
}