Fix DB query to fetch owned files
This commit is contained in:
parent
d8bab76265
commit
a6b8d229dd
1 changed files with 4 additions and 13 deletions
|
@ -117,25 +117,16 @@ class FilesDB {
|
|||
final db = await instance.database;
|
||||
final results = await db.query(table,
|
||||
where: '$columnGeneratedID = ?', whereArgs: [generatedID]);
|
||||
final convertedResults = _convertToFiles(results);
|
||||
if (convertedResults.length == 0) {
|
||||
return null;
|
||||
} else {
|
||||
return convertedResults[1];
|
||||
}
|
||||
return _convertToFiles(results)[0];
|
||||
}
|
||||
|
||||
Future<List<File>> getOwnedFiles(int ownerID) async {
|
||||
final db = await instance.database;
|
||||
final whereArgs = List<dynamic>();
|
||||
if (ownerID != null) {
|
||||
whereArgs.add(ownerID);
|
||||
}
|
||||
final results = await db.query(
|
||||
table,
|
||||
// where: '$columnIsDeleted = 0' +
|
||||
// (ownerID == null ? '' : ' AND $columnOwnerID = ?'),
|
||||
// whereArgs: whereArgs,
|
||||
where: '$columnIsDeleted = 0' +
|
||||
(ownerID == null ? '' : ' AND $columnOwnerID = ?'),
|
||||
whereArgs: [ownerID],
|
||||
orderBy: '$columnCreationTime DESC',
|
||||
);
|
||||
return _convertToFiles(results);
|
||||
|
|
Loading…
Add table
Reference in a new issue