PreparedStatement class

A statement parsed once and re-bindable. Hold on to the prepared statement and call execute repeatedly with different parameter values to avoid re-parsing.

Constructors

PreparedStatement.internal({required Database db, required Statement stmt, required String sql, required int positionalCount, required Set<String> namedParams})
Internal constructor used by Database.prepare. Application code should not call this directly.

Properties

hashCode → int
The hash code for this object.
no setterinherited
namedParams → Set<String>
Named parameter spellings (with leading sigil) referenced in the SQL. e.g. {':name', '@id'}.
final
positionalCount → int
Highest 1-based positional parameter index referenced in the SQL (also = number of values execute expects in positional).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sql → String
Original SQL source (for diagnostics/toString).
final

Methods

execute({List<Object?> positional = const [], Map<String, Object?> named = const {}}) → Future<QueryResult>
Execute the statement with positional (1-based, in source order) and/or named bindings.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited