use remoteDb
This commit is contained in:
@@ -1661,19 +1661,6 @@ class FilesDB with SqlDbBase {
|
||||
return FileLoadResult(filteredFiles, files.length == limit);
|
||||
}
|
||||
|
||||
Future<int> remoteFileCount() async {
|
||||
final db = await instance.sqliteAsyncDB;
|
||||
final results = await db.getAll('''
|
||||
SELECT DISTINCT $columnUploadedFileID FROM $filesTable
|
||||
WHERE $columnUploadedFileID IS NOT NULL AND $columnUploadedFileID IS NOT -1
|
||||
''');
|
||||
final ids = <int>{};
|
||||
for (final result in results) {
|
||||
ids.add(result[columnUploadedFileID] as int);
|
||||
}
|
||||
return ids.length;
|
||||
}
|
||||
|
||||
///Returns "columnName1 = ?, columnName2 = ?, ..."
|
||||
String _generateUpdateAssignmentsWithPlaceholders({
|
||||
required int? fileGenId,
|
||||
|
||||
@@ -115,6 +115,15 @@ class RemoteDB with SqlDbBase {
|
||||
);
|
||||
}
|
||||
|
||||
Future<int> rowCount(
|
||||
RemoteTable table,
|
||||
) async {
|
||||
final row = await _sqliteDB.get(
|
||||
'SELECT COUNT(*) as count FROM ${table.name}',
|
||||
);
|
||||
return row['count'] as int;
|
||||
}
|
||||
|
||||
Future<Set<T>> _getByIds<T>(
|
||||
Set<int> ids,
|
||||
String table,
|
||||
|
||||
@@ -7,6 +7,7 @@ import "package:photos/db/files_db.dart";
|
||||
import "package:photos/db/ml/db.dart";
|
||||
import "package:photos/db/ml/filedata.dart";
|
||||
import "package:photos/db/ml/offlinedb.dart";
|
||||
import "package:photos/db/remote/db.dart";
|
||||
import "package:photos/extensions/list.dart";
|
||||
import "package:photos/models/file/extensions/file_props.dart";
|
||||
import "package:photos/models/file/file.dart";
|
||||
@@ -370,7 +371,7 @@ bool _shouldDiscardRemoteEmbedding(FileDataEntity fileML) {
|
||||
}
|
||||
|
||||
Future<int> getIndexableFileCount() async {
|
||||
return FilesDB.instance.remoteFileCount();
|
||||
return remoteDB.rowCount(RemoteTable.files);
|
||||
}
|
||||
|
||||
Future<String> getImagePathForML(EnteFile enteFile) async {
|
||||
|
||||
Reference in New Issue
Block a user