Use transaction executor in delete

This commit is contained in:
Tobe O 2019-10-09 12:13:25 -04:00
parent 0ae331d38c
commit b6e0dfa8c9
2 changed files with 3 additions and 2 deletions

View file

@ -279,7 +279,7 @@ abstract class Query<T, Where extends QueryWhere> extends QueryBase<T> {
// TODO: Can this be done with just *one* query?
var existing = await get(tx);
//var sql = compile(preamble: 'SELECT $tableName.id', withFields: false);
return executor
return tx
.query(tableName, sql, substitutionValues)
.then((_) => existing);
});

View file

@ -125,8 +125,9 @@ belongsToTests(FutureOr<QueryExecutor> Function() createExecutor,
});
test('delete stream', () async {
printSeparator('Delete stream test');
var query = new BookQuery()..where.name.equals(deathlyHallows.name);
print(query.compile(Set()));
print(query.compile(Set(), preamble: 'DELETE', withFields: false));
var books = await query.delete(executor);
expect(books, hasLength(1));