QueryGrammar class abstract

Compiles a QueryAst into SQL for one dialect (ADR-005). Placeholders are emitted while compiling, never rewritten textually afterwards.

Implementers

Constructors

QueryGrammar()
Grammars are stateless; QueryGrammar.forDialect picks one.
const

Properties

dialect → SqlDialect
The dialect it writes for.
no setter
hashCode → int
The hash code for this object.
no setterinherited
quoteClose → String
The character that closes a quoted identifier.
no setter
quoteOpen → String
Opening/closing identifier quotes.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
supportsReturning → bool
Whether INSERT ... RETURNING is supported.
no setter
supportsSavepoints → bool
Whether savepoints are supported, for nested transactions.
no setter

Methods

compileDelete(QueryAst query) → CompiledQuery
The DELETE of query's rows.
compileExists(QueryAst query) → CompiledQuery
The query returning whether query has a row.
compileInsert(String table, List<Map<String, Object?>> rows, {bool ignore = false}) → CompiledQuery
The INSERT of rows into table; ignore skips rows a unique constraint refuses.
compileInsertGetId(String table, Map<String, Object?> row, String idColumn) → CompiledQuery
Insert returning the generated id (RETURNING when supported).
compileLimitOffset(int? limit, int? offset, Compilation c) → String
LIMIT/OFFSET fragment (MySQL needs a limit when offset is given).
compileSelect(QueryAst query) → CompiledQuery
The SELECT statement of query.
compileTruncate(String table) → CompiledQuery
The statement emptying table.
compileUpdate(QueryAst query, Map<String, Object?> values) → CompiledQuery
The UPDATE of query's rows with values.
compileUpsert(String table, List<Map<String, Object?>> rows, List<String> uniqueBy, List<String> update) → CompiledQuery
The insert-or-update of rows on conflict of the unique columns.
datePart(String part, String column) → String
Expression extracting part from a column (date, year...).
excludedValue(String column) → String
Dialect name for value in upserts (excluded.col / VALUES(col)).
insertKeyword(bool ignore) → String
The insert keyword: INSERT, or the dialect's ignoring form.
jsonOperand(Object? value) → Object?
value as the text a jsonSelector gives, where the dialect compares strictly.
jsonSelector(String column, List<String> path) → String
Reads a JSON path as text.
jsonUpdate(String column, List<(List<String>, Object?)> values, Compilation c) → String
column with values, path to value, written into it.
jsonWhere(String column, String kind, String operator, Object? value, bool not, Compilation c) → String
JSON where fragment (contains / length).
lockClause(LockMode mode) → String
The row lock clause for mode.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parameter(int index) → String
Placeholder for the index-th (1-based) binding.
toString() → String
A string representation of this object.
inherited
wrap(Object identifier) → String
Quotes table.column, column as alias, table.* or *. Invalid characters throw instead of being interpolated (never trust input).
wrapUnion(String sql) → String
Wraps one side of a UNION (SQLite cannot parenthesize selects).

Operators

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

Static Methods

forDialect(SqlDialect dialect) → QueryGrammar
Picks the grammar for dialect.
jsonPath(List<String> path) → String
$."a"."b"[0]: the path of SQLite and MySQL.