How to sync the data from mysql to SQLITE mobile application?

I get a new project which is using ionic framework and the data from mysql server should save into SQLite database (mobile) when they have an internet connection. But, when they dont have internet connection they also can view the data which mean into offline mode. So, how to sync the data from mysql to SQLite database ? Sorry, bad english because english not my first language :grin:

Regards,

I think there is no any plugin or anything else that is going to help you to do this. I actually made a complicated one, and working on the next one. You have to actually be very good at nesting promises, and understanding the problems that may occur during callbacks ( it will :slight_smile: ).

Also i dont know if you got the basics arleady. We r using https://github.com/litehelpers/Cordova-sqlite-storage. It uses the same sintax as web db., so you can easily run automated tests in the browser by replacing the plugin dependency.

We had a couple things, which are just do not works. (like writing an insert into command, using select as source).

And reaching the limit of running a certain amount of executes in one transaction (some kind of a heap error, when inserting bigger amount of data [like 3-5k or more rows]). Although its solvable, and if i am right, its only occur on android.

Getting data, and then inserting into the db is of course not that hard. But you may have to think of some kind of synchronization logic. Like don’t delete product if its inactive, but the user still has it on his stock, and he still wants to sell it. (in case of a sales management, or sg. like that, application)

As i said, i did worked a lot with the mentioned kind of architecture (working offline mode, + synchronization).

So if you have some questions in general, or in depth, feel free to ask.

My opinion also same like you. I already followed another tutorial about SQLite with ionic framework and now I want to move to the next stage which mean to develop the real project. I also thought, it will got the problem when sync the data into SQLite because this project have a lot of data in mysql database. If you can imagine, this project will be like this:

  • data people from all state in mysql database. For eg. new york, chicago, london.
  • end user can view the data from what they want. For eg. end user want to look the data from new york and they will submit request form to the mysql server then the server will response. After that, the server will send back the data from end user request to the sqlite mobile application and at the same time it will save into sqlite db. After that process, the data will display to the end user.

This project sound like ‘crazy’ application. But, I need to do it because this task come from my boss :smile: . My first plan is I want to direct my application to the server like facebook application but my boss want this application can use when end user dont have internet connection .I think I have to explain to my boss about constraints to the development of this system :smile:

Requesting some data, and then saving it, doesn’t requires too much of a work, if you know the principles of nesting promise objects, and calling web APIs from client.

And if you make to a point, where you actually cant insert a bigger chunk of data to the database, just have a look at this. It worked in our case.

Other then that, feel free to ask about other stuff.

I already create my own code and logic. But, I got some issue that I dont know how to fix it. You can refer from this link . Saving data from web service (JSON) into SQLITE