SimpleSelectStatement<T extends HasResultSet, D> class
A select statement that doesn't use joins.
For more information, see DatabaseConnectionUser.select.
- Inheritance
- Implemented types
- Mixed-in types
-
- SingleTableQueryMixin<
T, D> - LimitContainerMixin<
T, D> - Selectable<
D>
- SingleTableQueryMixin<
- Available extensions
Constructors
-
SimpleSelectStatement.new(DatabaseConnectionUser database, ResultSetImplementation<
T, D> table, {bool distinct = false}) - Used internally by drift, users will want to call DatabaseConnectionUser.select instead.
Properties
- database ↔ DatabaseConnectionUser
-
The database this statement should be sent to.
getter/setter pairinherited
- distinct → bool
-
Whether duplicate rows should be eliminated from the result (this is a
SELECT DISTINCT
statement in sql). Defaults to false.final - hashCode → int
-
The hash code for this object.
no setterinherited
- limitExpr ↔ Limit?
-
The
LIMIT
clause for this statement.getter/setter pairinherited - orderByExpr ↔ OrderBy?
-
The
ORDER BY
clause for this statementgetter/setter pairinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
table
↔ ResultSetImplementation<
T, D> -
The (main) table or view that this query operates on.
getter/setter pairinherited
-
watchedTables
→ Set<
ResultSetImplementation> -
The tables this select statement reads from.
no setter
- whereExpr ↔ Where?
-
The
WHERE
clause for this statementgetter/setter pairinherited - writeReturningClause ↔ bool
-
Whether a
RETURNING *
clause should be added to this statement.getter/setter pairinherited
Methods
-
addColumns(
List< Expression< expressions) → JoinedSelectStatement<Object> >HasResultSet, dynamic> - Adds a custom expression to the query.
-
asyncMap<
N> (FutureOr< N> mapper(D)) → Selectable<N> -
Maps this selectable by the
mapper
function.inherited -
constructQuery(
) → GenerationContext -
Constructs the query that can then be sent to the database executor.
inherited
-
get(
) → Future< List< D> > -
Executes this statement and returns the result.
override
-
getSingle(
) → Future< D> -
Executes this statement, like Selectable.get, but only returns one
value. the query returns no or too many rows, the returned future will
complete with an error.
inherited
-
getSingleOrNull(
) → Future< D?> -
Executes this statement, like Selectable.get, but only returns one
value. If the result too many values, this method will throw. If no
row is returned,
null
will be returned instead.inherited -
join(
List< Join< joins) → JoinedSelectStatement<HasResultSet, dynamic> >HasResultSet, dynamic> - Creates a select statement that operates on more than one table by applying the given joins.
-
limit(
int limit, {int? offset}) → void -
Limits the amount of rows returned by capping them at
limit
. Ifoffset
is provided as well, the firstoffset
rows will be skipped and not included in the result.inherited -
map<
N> (N mapper(D)) → Selectable< N> -
Maps this selectable by the
mapper
function.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
orderBy(
List< OrderClauseGenerator< clauses) → voidT> > - Orders the result by the given clauses. The clauses coming first in the list have a higher priority, the later clauses are only considered if the first clause considers two rows to be equal.
-
toString(
) → String -
A string representation of this object.
inherited
-
watch(
) → Stream< List< D> > -
Creates an auto-updating stream of the result that emits new items
whenever any table used in this statement changes.
override
-
watchSingle(
) → Stream< D> -
Creates an auto-updating stream of this statement, similar to
Selectable.watch. However, it is assumed that the query will only emit
one result, so instead of returning a
Stream<List<T>>
, this returns aStream<T>
. If, at any point, the query emits no or more than one rows, an error will be added to the stream instead.inherited -
watchSingleOrNull(
) → Stream< D?> -
Creates an auto-updating stream of this statement, similar to
Selectable.watch. However, it is assumed that the query will only
emit one result, so instead of returning a
Stream<List<T>>
, this returns aStream<T?>
. If the query emits more than one row at some point, an error will be emitted to the stream instead. If the query emits zero rows at some point,null
will be added to the stream instead.inherited -
where(
Expression< bool> filter(T tbl)) → void -
Makes this statement only include rows that match the
filter
.inherited -
whereSamePrimaryKey(
Insertable< D> d) → void -
Available on SingleTableQueryMixin<
Applies a where statement so that the row with the same primary key asT, D> , provided by the QueryTableExtensions extensiond
will be matched. -
writeInto(
GenerationContext context) → void -
Writes this component into the
context
by writing to its GenerationContext.buffer or by introducing bound variables. When writing into the buffer, no whitespace around the this component should be introduced. When a component consists of multiple composed component, it's responsible for introducing whitespace between its child components.inherited -
writeStartPart(
GenerationContext ctx) → void -
Subclasses must override this and write the part of the statement that
comes before the where and limit expression..
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited