executeQuery method
Executes a SQL query and returns the result set.
The connectionId must be a valid active connection.
The sql must be a non-empty SQL SELECT statement.
Returns a QueryResult containing columns and rows on success, or a ValidationError if SQL is empty, or a QueryError if execution fails.
Implementation
Future<Result<QueryResult>> executeQuery(
String connectionId,
String sql,
) async {
if (sql.trim().isEmpty) {
return const Failure<QueryResult, OdbcError>(
ValidationError(message: 'SQL query cannot be empty'),
);
}
return _repository.executeQuery(connectionId, sql);
}