selectExpressions method

Selectable<TypedResult> selectExpressions(
  1. Iterable<Expression<Object>> columns
)

Creates a select statement without a FROM clause selecting columns.

In SQL, select statements without a table will return a single row where all the columns are evaluated. Of course, columns cannot refer to columns from a table as these are unavailable without a FROM clause.

To run or watch the select statement, call Selectable.get or Selectable.watch. Each returns a list of TypedResult rows, for which a column can be read with TypedResult.read.

This example uses selectExpressions to query the current time set on the database server:

final row = await selectExpressions([currentDateAndTime]).getSingle();
final databaseTime = row.read(currentDateAndTime)!;

Implementation

Selectable<TypedResult> selectExpressions(Iterable<Expression> columns) {
  return SelectWithoutTables(this, columns);
}