QueryExecuted class
Fired after every query executes.
This is the primary event for observing database queries. It includes the SQL that was executed, the bound parameters, and execution timing.
Example
connection.listen((event) {
print('Query: ${event.sql} took ${event.time}ms');
if (event.time > 1000) {
logger.warning('Slow query detected: ${event.sql}');
}
});
- Inheritance
-
- Object
- Event
- ConnectionEvent
- QueryExecuted
Constructors
-
QueryExecuted({required String sql, required List<
Object?> bindings, required double time, required OrmConnection connection, int? rowCount, Object? error, StackTrace? stackTrace, DateTime? timestamp})
Properties
-
bindings
→ List<
Object?> -
The bound parameter values.
final
- connection → OrmConnection
-
The connection where this event occurred.
finalinherited
- connectionName → String
-
The name of the connection (convenience accessor).
finalinherited
- error → Object?
-
Error that occurred during execution, if any.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- rowCount → int?
-
Number of rows returned (for SELECT) or affected (for mutations).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sql → String
-
The SQL that was executed.
final
- stackTrace → StackTrace?
-
Stack trace captured when error is populated.
final
- succeeded → bool
-
Whether the query completed successfully.
no setter
- time → double
-
Execution time in milliseconds.
final
- timestamp → DateTime
-
When the event occurred.
finalinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toRawSql(
) → String - Get raw SQL with bindings substituted.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited