Query constructor
Query(
- SQLite sqlite,
- List<
Sql> columns, - Sql? search,
- Sql? where,
- List<
QueryOrdering> order, - QueryDistinction distinction,
- int limit,
Creates a Query using the given query configuration parameters.
Implementation
Query(
this.sqlite,
this.columns,
this.search,
this.where,
this.order,
this.distinction,
this.limit,
) {
checkState(
limit == -1 || limit > 0,
message: () =>
"Query.new: the limit argument must be -1 to indicate no limit "
"or greater than 0 to set the limit; got $limit",
);
String strAllColumns = [
columnRowId,
columnKeyId,
for (var ordering in order) ////
ordering.sql.str,
for (var column in columns) ////
column.str,
].join(", ");
String strFrom = search == null ? tableMapping : search!.str;
String strWhere = where == null ? "" : "(${where!.str}) AND ";
_msgSelect = MessageFormat(
"SELECT ${escapeFormat(strAllColumns)} FROM ${escapeFormat(strFrom)} "
"WHERE ${escapeFormat(strWhere)}{0} ORDER BY {1} LIMIT $limit",
);
initialize();
}