GenerationContext class
Contains information about a query while it's being constructed.
Constructors
- GenerationContext.new(DriftDatabaseOptions options, DatabaseConnectionUser? executor, {bool supportsVariables = true})
- Constructs a custom GenerationContext by setting the fields manually. See GenerationContext.fromDb for a more convenient factory.
- GenerationContext.fromDb(DatabaseConnectionUser executor, {bool supportsVariables = true})
- Constructs a GenerationContext by copying the relevant fields from the database.
Properties
- amountOfVariables → int
-
Returns the amount of variables that have been introduced when writing
this query.
no setter
- boundVariables → List
-
The values of introducedVariables that will be sent to the underlying
engine.
no setter
- buffer → StringBuffer
-
The string buffer contains the sql query as it's being constructed.
final
- dialect → SqlDialect
-
The SqlDialect that should be respected when generating the query.
no setter
- executor → DatabaseConnectionUser?
-
The actual DatabaseConnectionUser that's going to execute the generated
query.
final
- explicitVariableIndex ↔ int?
-
When set to a non-null value, Variables in this context will generate
explicit indices starting at explicitVariableIndex.
getter/setter pair
- generatingForView ↔ String?
-
When set to an entity name (view or table), generated column in that
entity definition will written into query as expression
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasMultipleTables ↔ bool
-
Whether the query obtained by this context operates on multiple tables.
getter/setter pair
-
introducedVariables
→ List<
Variable< Object> > -
All variables ("?" in sql) that were added to this context.
final
- options → DriftDatabaseOptions
-
The options to use when mapping values from and to the database.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sql → String
-
Gets the generated sql statement
no setter
- supportsVariables → bool
-
Whether variables are supported and can be written as
?
to be bound later.final - typeMapping → SqlTypes
-
The SqlTypes configuration used for mapping values to the database.
final
-
variableIndices
→ Iterable<
int> -
The variable indices occupied by this generation context.
no setter
-
watchedTables
→ List<
ResultSetImplementation> -
All tables that the generated query reads from.
final
Methods
-
identifier(
String columnName) → String -
Turns
columnName
into a safe SQL identifier by wrapping it in double quotes, or backticks depending on the dialect. -
introduceVariable(
Variable< Object> v, dynamic value) → void - Introduces a variable that will be sent to the database engine. Whenever this method is called, a question mark should be added to the buffer so that the prepared statement can be executed with the variable. The value must be a type that is supported by the sqflite library. A list of supported types can be found here.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
writeWhitespace(
) → void - Shortcut to add a single space to the buffer because it's used very often.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited