Merge pull request #2161 from North101/develop

Remove unnecessary where clause for batch.deleteAll
This commit is contained in:
Simon Binder 2022-11-21 23:00:00 +01:00 committed by GitHub
commit df76457819
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -147,8 +147,11 @@ class Batch {
///
/// See also:
/// - [DatabaseConnectionUser.delete]
void deleteAll<T extends Table, D>(TableInfo<T, D> table) =>
deleteWhere(table, (tbl) => const Constant(true));
void deleteAll<T extends Table, D>(TableInfo<T, D> table) {
_addUpdate(table, UpdateKind.delete);
final stmt = DeleteStatement(_user, table);
_addContext(stmt.constructQuery());
}
/// 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 "categories" SET "desc" = ?, "priority" = 0 WHERE "id" = ?;',
'DELETE FROM "categories" WHERE "id" = ?;',
'DELETE FROM "categories" WHERE 1;',
'DELETE FROM "categories";',
'DELETE FROM "todos" WHERE "id" = ?;',
'some custom statement',
],