mirror of https://github.com/AMT-Cheif/drift.git
Fix limit clause not being copied to join (#433)
This commit is contained in:
parent
e773adab59
commit
b2285e04ef
|
@ -2,6 +2,8 @@
|
|||
|
||||
- Fix `beforeOpen` callback deadlocking when using the isolate executor
|
||||
([#431](https://github.com/simolus3/moor/issues/431))
|
||||
- Fix limit clause not being applied when using `.join` afterwards
|
||||
([#433](https://github.com/simolus3/moor/issues/433))
|
||||
|
||||
## 2.4.1
|
||||
|
||||
|
|
|
@ -74,6 +74,9 @@ class SimpleSelectStatement<T extends Table, D extends DataClass>
|
|||
if (orderByExpr != null) {
|
||||
statement.orderBy(orderByExpr.terms);
|
||||
}
|
||||
if (limitExpr != null) {
|
||||
statement.limitExpr = limitExpr;
|
||||
}
|
||||
|
||||
return statement;
|
||||
}
|
||||
|
|
|
@ -116,6 +116,18 @@ void main() {
|
|||
argThat(contains('WHERE t.id < ? ORDER BY t.title ASC')), [3]));
|
||||
});
|
||||
|
||||
test('limit clause is kept', () async {
|
||||
final todos = db.alias(db.todosTable, 't');
|
||||
final categories = db.alias(db.categories, 'c');
|
||||
|
||||
final normalQuery = db.select(todos)..limit(10, offset: 5);
|
||||
|
||||
await normalQuery.join(
|
||||
[innerJoin(categories, categories.id.equalsExp(todos.category))]).get();
|
||||
|
||||
verify(executor.runSelect(argThat(contains('LIMIT 10 OFFSET 5')), []));
|
||||
});
|
||||
|
||||
test('can be watched', () {
|
||||
final todos = db.alias(db.todosTable, 't');
|
||||
final categories = db.alias(db.categories, 'c');
|
||||
|
|
Loading…
Reference in New Issue