Use transaction executor in delete
This commit is contained in:
parent
0ae331d38c
commit
b6e0dfa8c9
2 changed files with 3 additions and 2 deletions
|
@ -279,7 +279,7 @@ abstract class Query<T, Where extends QueryWhere> extends QueryBase<T> {
|
||||||
// TODO: Can this be done with just *one* query?
|
// TODO: Can this be done with just *one* query?
|
||||||
var existing = await get(tx);
|
var existing = await get(tx);
|
||||||
//var sql = compile(preamble: 'SELECT $tableName.id', withFields: false);
|
//var sql = compile(preamble: 'SELECT $tableName.id', withFields: false);
|
||||||
return executor
|
return tx
|
||||||
.query(tableName, sql, substitutionValues)
|
.query(tableName, sql, substitutionValues)
|
||||||
.then((_) => existing);
|
.then((_) => existing);
|
||||||
});
|
});
|
||||||
|
|
|
@ -125,8 +125,9 @@ belongsToTests(FutureOr<QueryExecutor> Function() createExecutor,
|
||||||
});
|
});
|
||||||
|
|
||||||
test('delete stream', () async {
|
test('delete stream', () async {
|
||||||
|
printSeparator('Delete stream test');
|
||||||
var query = new BookQuery()..where.name.equals(deathlyHallows.name);
|
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);
|
var books = await query.delete(executor);
|
||||||
expect(books, hasLength(1));
|
expect(books, hasLength(1));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue