fix: sqlite parameters limit

This commit is contained in:
wuzihao051119
2025-07-17 14:11:44 +08:00
parent 184c7390a1
commit 5d99eabe05
6 changed files with 64 additions and 37 deletions
@@ -326,12 +326,14 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
return transaction(() async {
if (assetsToUnLink.isNotEmpty) {
await _db.batch(
(batch) => batch.deleteWhere(
_db.localAlbumAssetEntity,
(f) => f.assetId.isIn(assetsToUnLink) & f.albumId.equals(albumId),
),
);
await _db.batch((batch) {
for (final assetToUnLink in assetsToUnLink) {
batch.deleteWhere(
_db.localAlbumAssetEntity,
(row) => row.assetId.equals(assetToUnLink) & row.albumId.equals(albumId),
);
}
});
}
await _deleteAssets(assetsToDelete);
@@ -359,7 +361,9 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
}
return _db.batch((batch) {
batch.deleteWhere(_db.localAssetEntity, (f) => f.id.isIn(ids));
for (final id in ids) {
batch.deleteWhere(_db.localAssetEntity, (row) => row.id.equals(id));
}
});
}