doni49 Posted December 16, 2015 Share Posted December 16, 2015 I'm working on an android app that will sync with the a MySQL server. The data will be stored locally in SQLite for offline use. I'm trying to figure out what engine would work best for this (isam etc). It's my understanding that "Transaction safe" engine is good for preventing data loss. Is that because of the way the data doesn't actually committed until the app sends the commit instruction? In the following scenario, what kind of data loss would I be open to? Does "transaction safe" prevent this kind of loss? My plan has been: If creating a new record while offline, do so but assign a field called "localID" (which would be an auto increment column) with a unique id number. This localID will not be stored on the server and will ONLY be used on that device. When creating a new record while online (or sending a new record that was previously created while offline), the data will be sent and as confirmation of receipt of the new data, the server will return an array (via json) of the id numbers of the newly created rows. I will be using Google Cloud Messaging so that the server data is updated, all subscribed devices will be told the id numbers for all the rows they need to process (along with info telling whether this is a NEW record, an UPDATE to an existing record or delete the record. When devices receive the GCM message, they'll will know what records to get and how to deal with them. Each row on the server will have a "version" id and every time one row is updated, the version number will be incremented. This way if the server sees an update to a record and the version number is lower than what's on the server, the sending device will be instructed to inform the user of this. The one thing I haven't figured out in that is how to deal with an edit from two different devices of the same row. There shouldn't be more than a few devices that could possibly change any record. So I'm thinking that one way might be that when the server sees the row being updated from two diff devices at the same time, it could send back a GCM message which would prompt the user to decide which is valid. But I'm not sure if I like that. This is all given as background in hopes of getting some informed advice but I'm open to suggestions for dealing with the duplicate data issue. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.