Skip to content

Commit 42aa6a4

Browse files
committed
fix issue#504&#509 & update to jeep-sqlite2.5.8
1 parent a6aa6ce commit 42aa6a4

File tree

8 files changed

+37
-18
lines changed

8 files changed

+37
-18
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# 5.5.2 (2024-01-25)
2+
3+
### Chore
4+
5+
- Update to jeep-sqlite@2.5.8
6+
7+
8+
### Bug Fixes
9+
10+
- Fix exportToJson getSchema PRIMARY
11+
- Fix allow exportToJson when mode equals "full" and no "sync_table"
12+
- Fix out of memory since 1.9.0 issue#509 by upgrading sql.js to release 1.10.2
13+
114
# 5.5.1 (2024-01-22)
215

316
### Bug Fixes
0 Bytes
Binary file not shown.

android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/Database.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,8 +1181,10 @@ public JSObject exportToJson(String mode, Boolean isEncrypted) throws Exception
11811181
long syncTime = date.getTime() / 1000L;
11821182
toJson.setLastExportDate(this, syncTime);
11831183
} else {
1184-
throw new Exception("No sync_table available");
1185-
}
1184+
if(inJson.getMode().equals("partial")) {
1185+
throw new Exception("No sync_table available");
1186+
}
1187+
}
11861188
// launch the export process
11871189
JsonSQLite retJson = toJson.createExportObject(this, inJson);
11881190
// retJson.print();

android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/ImportExportJson/ExportToJson.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ private ArrayList<JsonColumn> getSchema(String sqlStmt) throws Exception {
362362
String pk = sc.substring(oPar + 1, cPar);
363363
row[0] = "CPK_" + pk.replaceAll("§", "_");
364364
row[0] = row[0].replaceAll("_ ", "_");
365-
row[1] = sc.substring(cPar + 2);
365+
row[1] = sc.substring(0,cPar + 1);
366366
jsonRow.setConstraint(row[0]);
367367
}
368368
case "CONSTRAINT" -> {

electron/src/electron-utils/Database.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,9 @@ export class Database {
691691
new Date().toISOString(),
692692
);
693693
} else {
694-
throw new Error(`No sync_table available`);
694+
if (inJson.mode === 'partial') {
695+
throw new Error(`No sync_table available`);
696+
}
695697
}
696698
let jsonResult: any = this.exportToJsonUtil.createExportObject(
697699
this.database,

ios/Plugin/Database.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,9 @@ class Database {
689689
// Set the last exported date
690690
try ExportToJson.setLastExportDate(mDB: self, sTime: syncTime)
691691
} else {
692-
throw DatabaseError.exportToJson(message: "No sync_table available")
692+
if expMode == "partial" {
693+
throw DatabaseError.exportToJson(message: "No sync_table available")
694+
}
693695
}
694696
// Launch the export process
695697
let data: [String: Any] = [

package-lock.json

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,6 @@
9797
}
9898
},
9999
"dependencies": {
100-
"jeep-sqlite": "^2.5.7"
100+
"jeep-sqlite": "^2.5.8"
101101
}
102102
}

0 commit comments

Comments
 (0)