Closed nblixt closed 4 days ago
I did some more experimenting. Assuming the previous issue #513 was on to something with the types, I tried removing certain columns from my tables until I got the export working correctly. It looks like my exports work with data for column types integer, text, and boolean.
I started getting failures when attempting to export data from a table that used the real
type, which I was using to record latitude and longitude. Once I removed those columns from the schema and repeated the export, everything worked as expected.
In summation, there might be an issue using exportToJson
with the column of type real
.
Thanks for reporting that. Would you be willing to create a PR?
I did more testing and arrived at user error being the source of the issue. I was previously collecting latitude and longitude from device, but temporarily our client wanted to suspend collecting that data. When I looked back at how the data was being created, I found that I had replaced the previous geolocation values with empty strings.
The presence of an empty string in a REAL column was throwing an error only when using exportToJson
. Since this isn't how that should be used, I'm going to close this issue.
Thank you for your time.
Thank you for maintaining this plugin!
Plugin version: @capacitor-community/sqlite versions 5.7.0 and 5.7.4.
Platform(s): iOS. Android is unaffected.
Current behavior: When calling
await CapacitorSQLite.exportToJson({database: this.dbName, jsonexportmode: "partial", encrypted: false})
, the console output in Safari shows this error:exportToJson: Error get tables ‘Partial’ failed : Error value is not (string, nsnull,int64,double,[UInt8])
Expected behavior:
exportToJson
should create a JSON export of my local DB.Steps to reproduce: Here is my process when my app starts:
await CapacitorSQLite.addUpgradeStatement({database: this.dbName, upgrade: upgradeStatements})
Other information: My issue might be related to issue #513. Though, that issue was fixed in v5.6.1-3.
Capacitor doctor: