SqlBuilder class final

Builds and inspects typed SQL without constructing a driver or a database.

Inheritance
Available extensions

Constructors

SqlBuilder(SqlDialect dialect)
Builds SQL using the dialect's offline defaults.
SqlBuilder.withCapabilities(Capabilities capabilities)
Builds SQL using an explicitly supplied engine capability profile.
const

Properties

capabilities Capabilities
The selected engine's limits and supported SQL features.
final
dialect SqlDialect
The SQL dialect selected by the context's capabilities.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
inSession bool
Whether this view borrows one leased connection.
no setterinherited
inTransaction bool
Whether this view borrows an active transaction.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

execute(SqlCommand command, {ExecutionOptions options = const ExecutionOptions(), Iterable<TableSchema> changedTables = const []}) Future<SqlResult>
Executes bound SQL and declares tables affected by raw writes.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
query<R>(SqlQuery<R> query, {ExecutionOptions options = const ExecutionOptions(), Iterable<TableSchema> changedTables = const []}) Future<List<R>>

Available on QueryContext, provided by the SqlExecution extension

Executes once and decodes the actual metadata and rows. No wrapper or LIMIT is added. Use this for SELECT or native DML RETURNING.
raw(Sql sql, {ExecutionOptions options = const ExecutionOptions(), Iterable<TableSchema> changedTables = const []}) Future<SqlResult>

Available on QueryContext, provided by the SqlExecution extension

Executes exactly the supplied statement and returns positional rows, labels and write metadata. Raw writes declare changedTables for watches.
registerSchema(Iterable<TableSchema> tables) → void
Registers foreign-key effects for change subscriptions.
inherited
run<R>(Future<R> action(SqlConnection), {AcquisitionOptions acquire = const AcquisitionOptions()}) Future<R>
Executes work on a leased connection, or rejects an unbound context.
inherited
streamSql<R>(SqlQuery<R> query, {int batchSize = 128, ExecutionOptions options = const ExecutionOptions()}) Stream<R>

Available on QueryContext, provided by the SqlExecution extension

Streams typed rows through one cursor with bounded batch fetching. Compilation is immediate; a connection is acquired on listen. Result labels are bound on the first batch, even when empty, without a second query. Cancel or finish before leaving a session/transaction callback.
table<R, F extends Fields>(Table<R, F> definition) TableSet<R, F>
Binds a manual or generated table definition to this context.
inherited
toString() String
A string representation of this object.
inherited

Operators

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