فهرست منبع

[mob][photos] pref: use sqlite_async for getFilesCreatedWithinDurations (#1478)

Vishnu Mohandas 1 سال پیش
والد
کامیت
a49448b9cc
1فایلهای تغییر یافته به همراه6 افزوده شده و 5 حذف شده
  1. 6 5
      mobile/lib/db/files_db.dart

+ 6 - 5
mobile/lib/db/files_db.dart

@@ -757,7 +757,7 @@ class FilesDB {
     if (durations.isEmpty) {
     if (durations.isEmpty) {
       return <EnteFile>[];
       return <EnteFile>[];
     }
     }
-    final db = await instance.database;
+    final db = await instance.sqliteAsyncDB;
     String whereClause = "( ";
     String whereClause = "( ";
     for (int index = 0; index < durations.length; index++) {
     for (int index = 0; index < durations.length; index++) {
       whereClause += "($columnCreationTime >= " +
       whereClause += "($columnCreationTime >= " +
@@ -772,11 +772,12 @@ class FilesDB {
       }
       }
     }
     }
     whereClause += ")";
     whereClause += ")";
-    final results = await db.query(
-      filesTable,
-      where: whereClause,
-      orderBy: '$columnCreationTime ' + order,
+    final query =
+        'SELECT * FROM $filesTable WHERE $whereClause ORDER BY $columnCreationTime $order';
+    final results = await db.getAll(
+      query,
     );
     );
+
     final files = convertToFiles(results);
     final files = convertToFiles(results);
     return applyDBFilters(
     return applyDBFilters(
       files,
       files,