Skip to content

Export To JSON Full or Partial #59

Description

@jjgl

Hi,

I am trying to use getDatabaseExport but getting the error below.
I've tried both passing 'full' and 'partial' as parameters.

For partial I made sure to have attribute 'last_modified' on all tables and called createSyncTable and setSyncDate methods.

The response I get invariably is:

{"message":"ExportToJson command failed : exportToJson(message: "Error get tables \'Partial\' failed : Query result not well formatted")","export":{}}

or

response: {"message":"ExportToJson command failed : exportToJson(message: "Error get tables \'Full\' failed : Query result not well formatted")","export":{}}

I tried looking up the errors above, but couldn't find an explanation.

This is a database schema that is working. I can select, insert, delete, update...
My schema does have foreign keys, which I found out used to be an issue on version 2.0.XX, so I'm discarding that as a potential source of the problem, but still worth mentioning.

To reproduce
1 - import a JSON db schema as outlined on your docs
2 - createSyncTable CapacitorSQLite.createSyncTable();
3 - insert values into (a) table, including last_modified i.e.:1608124489426
4 - setSyncDate CapacitorSQLite.setSyncDate({syncdate:date}); where date is a string i.e.: 1608125030631
5 - call getDatabaseExport CapacitorSQLite.exportToJson({ jsonexportmode: mode }); where mode is a string with either values 'full' or 'partial'.

The expected behaviour would be to get a JSON of the database changes "@returns Promise"

Smartphone (please complete the following information):

  • Device: iphone XS
  • OS: 14.2
  • Browser stock browser, safari
  • Version 14

Additional info:
Running app with command:
"ionic cap run ios -l --external" from VS code.
The project is built with ionic, angular and capacitor.

I did have to assume certain things such as setSyncDate parameter.
The documentation says:

Prop Type Description
syncdate string Set the synchronization date

but couldn't find additional examples or explanations.

Can syncdate be:

  • "ms since epoch" (seems to work, returns true)
  • or a timestamp in format YYYY-mm-dd HH:mm:ss (no, it returns false)

but its an empiric process.

I hope the documentation contained examples or explanations for the input and output parameters.

I really appreciate all your work and hope I am just making a silly mistake here.

While trying to find a solution I ran into the following tutorial that also has an issue with the same export method so I'm inclined to thinking its not just me:
https://devdactic.com/sqlite-ionic-app-with-capacitor/
https://youtu.be/2kTT3k8ztL8

Looking forward to some feedback.
Regards,
J

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions