little3399 Active Member Licensed User Longtime User Apr 9, 2015 #1 Hi, everybody... I have a question about sqlite db synchronization ... Usually I will copy to sqlite db file to the File.DirDefaultExternal Dir ... but sometime the app maybe to upgade and the some sqlite db table structure will be change ... So in this case how to synchronization the new sqlite db and the old sqlite db ? in fact, our synchroniztion method was to uninstall the old app first ,and install the new app ... I want to ask .... Is the any good advice to synchronization sqlite db ? Tks!
Hi, everybody... I have a question about sqlite db synchronization ... Usually I will copy to sqlite db file to the File.DirDefaultExternal Dir ... but sometime the app maybe to upgade and the some sqlite db table structure will be change ... So in this case how to synchronization the new sqlite db and the old sqlite db ? in fact, our synchroniztion method was to uninstall the old app first ,and install the new app ... I want to ask .... Is the any good advice to synchronization sqlite db ? Tks!
S sorex Expert Licensed User Longtime User Apr 9, 2015 #2 is it just a database to consult data? Upvote 0
eurojam Well-Known Member Licensed User Longtime User Apr 9, 2015 #3 Hey Little, I usually have a table dbVersion in my sqlite database and proof the dbversion on the device against the needed version of the app (when the app starts). If the app needs a newer version, for example after updating the app, the new DB will be copied from File.DirAssets to File.DirDefaultExternal or File.DirInternal... may be there are better ways to make this, but this works for my apps cheers stefan Upvote 0
Hey Little, I usually have a table dbVersion in my sqlite database and proof the dbversion on the device against the needed version of the app (when the app starts). If the app needs a newer version, for example after updating the app, the new DB will be copied from File.DirAssets to File.DirDefaultExternal or File.DirInternal... may be there are better ways to make this, but this works for my apps cheers stefan
little3399 Active Member Licensed User Longtime User Apr 9, 2015 #4 Hi, eurojam the new DB copy from File.DirAssets , because the File.DirAssets was read-only ,so the the new DB will always be as the new DB ... so every time the APP start ... will copy from File.DirAssets ... Upvote 0
Hi, eurojam the new DB copy from File.DirAssets , because the File.DirAssets was read-only ,so the the new DB will always be as the new DB ... so every time the APP start ... will copy from File.DirAssets ...
eurojam Well-Known Member Licensed User Longtime User Apr 9, 2015 #5 No, the new DB carried out with the new App Version has the version code 23 (for example). Starting the app the Activity_Create will do the following things: look if the is a database in the File.DirInternal: if not, no problem, copy the database from File.DirAssets and continue with the app if there is already a database then check the version: Code: Copy txt = "SELECT * from dbversion where dbversion = 23;" Cursor1 = SQL1.ExecQuery(txt) If Cursor1.RowCount = 0 Then 'database is older, now copy new version to File.DirInternal and continue the app End If This will only happen, if the the existing database is older Upvote 0
No, the new DB carried out with the new App Version has the version code 23 (for example). Starting the app the Activity_Create will do the following things: look if the is a database in the File.DirInternal: if not, no problem, copy the database from File.DirAssets and continue with the app if there is already a database then check the version: Code: Copy txt = "SELECT * from dbversion where dbversion = 23;" Cursor1 = SQL1.ExecQuery(txt) If Cursor1.RowCount = 0 Then 'database is older, now copy new version to File.DirInternal and continue the app End If This will only happen, if the the existing database is older
little3399 Active Member Licensed User Longtime User Apr 9, 2015 #6 HI, Eurojam I have been found the simple way to solve this promble, that is let the sqlite db name same as the VersionName, such as when the App versionname update to 2.2 , so the sqlite db alse change to db2_2.db , and the sqlite db can be placed on the File.DirAssert.... when the App can not found the db2_2.db file, and just to copy it from File.DirAsset ... that means the app using the new db ... Upvote 0
HI, Eurojam I have been found the simple way to solve this promble, that is let the sqlite db name same as the VersionName, such as when the App versionname update to 2.2 , so the sqlite db alse change to db2_2.db , and the sqlite db can be placed on the File.DirAssert.... when the App can not found the db2_2.db file, and just to copy it from File.DirAsset ... that means the app using the new db ...