Browse Source

[mob][photos] More use of sqlite async

laurenspriem 1 year ago
parent
commit
7370557b08
1 changed files with 7 additions and 7 deletions
  1. 7 7
      mobile/lib/face/db.dart

+ 7 - 7
mobile/lib/face/db.dart

@@ -146,8 +146,8 @@ class FaceMLDataDB {
   }
   }
 
 
   Future<Map<int, int>> clusterIdToFaceCount() async {
   Future<Map<int, int>> clusterIdToFaceCount() async {
-    final db = await instance.database;
-    final List<Map<String, dynamic>> maps = await db.rawQuery(
+    final db = await instance.sqliteAsyncDB;
+    final List<Map<String, dynamic>> maps = await db.getAll(
       'SELECT $fcClusterID, COUNT(*) as count FROM $faceClustersTable where $fcClusterID IS NOT NULL GROUP BY $fcClusterID ',
       'SELECT $fcClusterID, COUNT(*) as count FROM $faceClustersTable where $fcClusterID IS NOT NULL GROUP BY $fcClusterID ',
     );
     );
     final Map<int, int> result = {};
     final Map<int, int> result = {};
@@ -158,15 +158,15 @@ class FaceMLDataDB {
   }
   }
 
 
   Future<Set<int>> getPersonIgnoredClusters(String personID) async {
   Future<Set<int>> getPersonIgnoredClusters(String personID) async {
-    final db = await instance.database;
+    final db = await instance.sqliteAsyncDB;
     // find out clusterIds that are assigned to other persons using the clusters table
     // find out clusterIds that are assigned to other persons using the clusters table
-    final List<Map<String, dynamic>> maps = await db.rawQuery(
+    final List<Map<String, dynamic>> maps = await db.getAll(
       'SELECT $clusterIDColumn FROM $clusterPersonTable WHERE $personIdColumn != ? AND $personIdColumn IS NOT NULL',
       'SELECT $clusterIDColumn FROM $clusterPersonTable WHERE $personIdColumn != ? AND $personIdColumn IS NOT NULL',
       [personID],
       [personID],
     );
     );
     final Set<int> ignoredClusterIDs =
     final Set<int> ignoredClusterIDs =
         maps.map((e) => e[clusterIDColumn] as int).toSet();
         maps.map((e) => e[clusterIDColumn] as int).toSet();
-    final List<Map<String, dynamic>> rejectMaps = await db.rawQuery(
+    final List<Map<String, dynamic>> rejectMaps = await db.getAll(
       'SELECT $clusterIDColumn FROM $notPersonFeedback WHERE $personIdColumn = ?',
       'SELECT $clusterIDColumn FROM $notPersonFeedback WHERE $personIdColumn = ?',
       [personID],
       [personID],
     );
     );
@@ -176,8 +176,8 @@ class FaceMLDataDB {
   }
   }
 
 
   Future<Set<int>> getPersonClusterIDs(String personID) async {
   Future<Set<int>> getPersonClusterIDs(String personID) async {
-    final db = await instance.database;
-    final List<Map<String, dynamic>> maps = await db.rawQuery(
+    final db = await instance.sqliteAsyncDB;
+    final List<Map<String, dynamic>> maps = await db.getAll(
       'SELECT $clusterIDColumn FROM $clusterPersonTable WHERE $personIdColumn = ?',
       'SELECT $clusterIDColumn FROM $clusterPersonTable WHERE $personIdColumn = ?',
       [personID],
       [personID],
     );
     );