Remove unnecessary where for batch.deleteAll

This commit is contained in:
Alexander Wilde 2022-11-21 13:39:06 +00:00
parent 6e16a8b8b6
commit d165ee1bd8
2 changed files with 6 additions and 3 deletions

View File

@ -147,8 +147,11 @@ class Batch {
/// ///
/// See also: /// See also:
/// - [DatabaseConnectionUser.delete] /// - [DatabaseConnectionUser.delete]
void deleteAll<T extends Table, D>(TableInfo<T, D> table) => void deleteAll<T extends Table, D>(TableInfo<T, D> table) {
deleteWhere(table, (tbl) => const Constant(true)); _addUpdate(table, UpdateKind.delete);
final stmt = DeleteStatement(_user, table);
_addContext(stmt.constructQuery());
}
/// Executes the custom [sql] statement with variables instantiated to [args]. /// Executes the custom [sql] statement with variables instantiated to [args].
/// ///

View File

@ -59,7 +59,7 @@ void main() {
'UPDATE "users" SET "name" = ? WHERE "name" = ?;', 'UPDATE "users" SET "name" = ? WHERE "name" = ?;',
'UPDATE "categories" SET "desc" = ?, "priority" = 0 WHERE "id" = ?;', 'UPDATE "categories" SET "desc" = ?, "priority" = 0 WHERE "id" = ?;',
'DELETE FROM "categories" WHERE "id" = ?;', 'DELETE FROM "categories" WHERE "id" = ?;',
'DELETE FROM "categories" WHERE 1;', 'DELETE FROM "categories";',
'DELETE FROM "todos" WHERE "id" = ?;', 'DELETE FROM "todos" WHERE "id" = ?;',
'some custom statement', 'some custom statement',
], ],