* Always put ORDER BY
before LIMIT
.
This commit is contained in:
parent
fa01fd982e
commit
f18c23c5f9
2 changed files with 3 additions and 2 deletions
|
@ -6,6 +6,7 @@ callbacks.
|
|||
* Make `JoinBuilder` take `to` as a `String Function()`. This will allow
|
||||
ORM queries to reference their joined subqueries.
|
||||
* Removed deprecated `Join`, `toSql`, `sanitizeExpression`, `isAscii`.
|
||||
* Always put `ORDER BY` before `LIMIT`.
|
||||
|
||||
# 2.0.1
|
||||
* Apply `package:pedantic` fixes.
|
||||
|
|
|
@ -241,12 +241,12 @@ abstract class Query<T, Where extends QueryWhere> extends QueryBase<T> {
|
|||
var whereClause =
|
||||
where.compile(tableName: includeTableName ? tableName : null);
|
||||
if (whereClause.isNotEmpty) b.write(' WHERE $whereClause');
|
||||
if (_limit != null) b.write(' LIMIT $_limit');
|
||||
if (_offset != null) b.write(' OFFSET $_offset');
|
||||
if (_groupBy != null) b.write(' GROUP BY $_groupBy');
|
||||
for (var item in _orderBy) {
|
||||
b.write(' ORDER BY ${item.compile()}');
|
||||
}
|
||||
if (_limit != null) b.write(' LIMIT $_limit');
|
||||
if (_offset != null) b.write(' OFFSET $_offset');
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue