Skip to content

Commit

Permalink
Fix getDatabaseList & getMigratableDbList iOS/Android
Browse files Browse the repository at this point in the history
  • Loading branch information
jepiqueau committed Dec 30, 2023
1 parent eb39d81 commit dc32b4c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 5.5.1-4 (2023-12-30)

### Bug Fixes

- iOS Fix getDatabaseList & getMigratableDbList
- Android Fix getDatabaseList & getMigratableDbList

# 5.5.1-3 (2023-12-29)

### Bug Fixes
Expand Down
Binary file modified android/.gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -799,8 +799,10 @@ public JSArray getDatabaseList() throws Exception {
String[] listFiles = uFile.getListOfFiles(context);
JSArray retArray = new JSArray();
for (String file : listFiles) {
retArray.put(file);
}
if (file.contains("SQLite")) {
retArray.put(file);
}
}
if (retArray.length() > 0) {
return retArray;
} else {
Expand All @@ -819,7 +821,9 @@ public JSArray getMigratableDbList(String folderPath) throws Exception {
String[] listFiles = uMigrate.getMigratableList(context, folderPath);
JSArray retArray = new JSArray();
for (String file : listFiles) {
retArray.put(file);
if (!file.contains("SQLite")) {
retArray.put(file);
}
}
if (retArray.length() > 0) {
return retArray;
Expand Down
10 changes: 8 additions & 2 deletions ios/Plugin/CapacitorSQLite.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,10 @@ enum CapacitorSQLiteError: Error {
let aPath: String = try (UtilsFile.getFolderURL(folderPath: databaseLocation)).path
// get the database files
let dbList: [String] = try UtilsFile.getFileList(path: aPath, ext: ".db")
return dbList
// filter for db including SQLite
let dbWithSQLite = dbList.filter { $0.contains("SQLite") }

return dbWithSQLite

} catch let error {
let msg: String = "\(error)"
Expand All @@ -1564,7 +1567,10 @@ enum CapacitorSQLiteError: Error {
do {
let dbList: [String] = try UtilsMigrate
.getMigratableList(folderPath: folderPath)
return dbList
// filter for db not including SQLite
let dbNoSQLite = dbList.filter { !$0.contains("SQLite") }

return dbNoSQLite

} catch UtilsMigrateError.getMigratableList(let message) {
var msg: String = "getMigratableList:"
Expand Down

0 comments on commit dc32b4c

Please sign in to comment.