[mob][photos] Remove sqflite import in filesDB
This commit is contained in:
parent
ab9cef689d
commit
a7e0f3df7b
3 changed files with 12 additions and 13 deletions
|
@ -452,7 +452,8 @@ class FilesDB {
|
|||
|
||||
Future<void> insertMultiple(
|
||||
List<EnteFile> files, {
|
||||
ConflictAlgorithm conflictAlgorithm = ConflictAlgorithm.replace,
|
||||
SqliteAsyncConflictAlgorithm conflictAlgorithm =
|
||||
SqliteAsyncConflictAlgorithm.replace,
|
||||
}) async {
|
||||
if (files.isEmpty) return;
|
||||
|
||||
|
@ -1282,13 +1283,11 @@ class FilesDB {
|
|||
|
||||
Future<int> collectionFileCount(int collectionID) async {
|
||||
final db = await instance.sqliteAsyncDB;
|
||||
final count = Sqflite.firstIntValue(
|
||||
await db.execute(
|
||||
'SELECT COUNT(*) FROM $filesTable where $columnCollectionID = '
|
||||
'$collectionID AND $columnUploadedFileID IS NOT -1',
|
||||
),
|
||||
final row = await db.get(
|
||||
'SELECT COUNT(*) FROM $filesTable where $columnCollectionID = '
|
||||
'$collectionID AND $columnUploadedFileID IS NOT -1',
|
||||
);
|
||||
return count ?? 0;
|
||||
return row['COUNT(*)'] as int;
|
||||
}
|
||||
|
||||
Future<int> archivedFilesCount(
|
||||
|
@ -1884,7 +1883,7 @@ class FilesDB {
|
|||
|
||||
Future<void> _batchAndInsertFile(
|
||||
EnteFile file,
|
||||
ConflictAlgorithm conflictAlgorithm,
|
||||
SqliteAsyncConflictAlgorithm conflictAlgorithm,
|
||||
sqlite_async.SqliteDatabase db,
|
||||
List<List<Object?>> parameterSets,
|
||||
PrimitiveWrapper batchCounter, {
|
||||
|
@ -1905,7 +1904,7 @@ class FilesDB {
|
|||
}
|
||||
|
||||
Future<void> _insertBatch(
|
||||
ConflictAlgorithm conflictAlgorithm,
|
||||
SqliteAsyncConflictAlgorithm conflictAlgorithm,
|
||||
Iterable<String> columnNames,
|
||||
sqlite_async.SqliteDatabase db,
|
||||
List<List<Object?>> parameterSets,
|
||||
|
|
|
@ -21,8 +21,8 @@ import "package:photos/services/ignored_files_service.dart";
|
|||
import 'package:photos/services/local/local_sync_util.dart';
|
||||
import "package:photos/utils/debouncer.dart";
|
||||
import "package:photos/utils/photo_manager_util.dart";
|
||||
import "package:photos/utils/sqlite_util.dart";
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:sqflite/sqflite.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
class LocalSyncService {
|
||||
|
@ -184,7 +184,7 @@ class LocalSyncService {
|
|||
if (hasUnsyncedFiles) {
|
||||
await _db.insertMultiple(
|
||||
localDiffResult.uniqueLocalFiles!,
|
||||
conflictAlgorithm: ConflictAlgorithm.ignore,
|
||||
conflictAlgorithm: SqliteAsyncConflictAlgorithm.ignore,
|
||||
);
|
||||
_logger.info(
|
||||
"Inserted ${localDiffResult.uniqueLocalFiles?.length} "
|
||||
|
@ -321,7 +321,7 @@ class LocalSyncService {
|
|||
files.removeWhere((file) => existingLocalDs.contains(file.localID));
|
||||
await _db.insertMultiple(
|
||||
files,
|
||||
conflictAlgorithm: ConflictAlgorithm.ignore,
|
||||
conflictAlgorithm: SqliteAsyncConflictAlgorithm.ignore,
|
||||
);
|
||||
_logger.info('Inserted ${files.length} files');
|
||||
Bus.instance.fire(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
enum ConflictAlgorithm {
|
||||
enum SqliteAsyncConflictAlgorithm {
|
||||
/// When a constraint violation occurs, an immediate ROLLBACK occurs,
|
||||
/// thus ending the current transaction, and the command aborts with a
|
||||
/// return code of SQLITE_CONSTRAINT. If no transaction is active
|
||||
|
|
Loading…
Add table
Reference in a new issue