customSelect method

Selectable<QueryRow> customSelect(
  1. String query, {
  2. List<Variable<Object>> variables = const [],
  3. Set<ResultSetImplementation> readsFrom = const {},

Creates a custom select statement from the given sql query.

The query can be run once by calling Selectable.get.

For an auto-updating query stream, the readsFrom parameter needs to be set to the tables the SQL statement reads from - drift can't infer it automatically like for other queries constructed with its Dart API. When, can be used to construct an updating stream.

For queries that are known to only return a single row, Selectable.getSingle and Selectable.watchSingle can be used as well.

If you use variables in your query (for instance with "?"), they will be bound to the variables you specify on this query.


Selectable<QueryRow> customSelect(String query,
    {List<Variable> variables = const [],
    Set<ResultSetImplementation> readsFrom = const {}}) {
  return CustomSelectStatement(query, variables, readsFrom, this);