SQL Lite local data question!

Hi everyone, 

I load my game in to the Apple Store and I’m hiding some
information on the basis of the device SQLLite such as level, points
etc.

When I update the game, is the local information deleting after the
update?

How can I protect the players history after the updating?

Thanks all, 

I don’t think files copied to the documents map are deleted with an update.

Hi,

If you store the database where you have your main.lua file it will be overwritten each time an update is made so therefore the first thing you need to do is copy the database over to the Documents directory and each time you make an update (might be in an update stage or each time the app is started or whatever) verify that if the database doesn’t exist copy the database from the Resource directory (which is where main.lua and all the other files of your app are stored) and if it already exists it should not overwrite it.

The Documents directory will not be overwritten when an update is downloaded.

http://docs.coronalabs.com/api/library/system/DocumentsDirectory.html

http://docs.coronalabs.com/api/library/system/ResourceDirectory.html

Best regards,

Tomas

Tomas,

Thank you so much for your helpful explanation:) 

Just to add to this, system.ResourcesDirectory is a read-only location.  You can’t write data to an SQLite database located there, so if you are successfully saving values and retrieving them, then you are likely writing them to an update safe location.

Rob

I don’t think files copied to the documents map are deleted with an update.

Hi,

If you store the database where you have your main.lua file it will be overwritten each time an update is made so therefore the first thing you need to do is copy the database over to the Documents directory and each time you make an update (might be in an update stage or each time the app is started or whatever) verify that if the database doesn’t exist copy the database from the Resource directory (which is where main.lua and all the other files of your app are stored) and if it already exists it should not overwrite it.

The Documents directory will not be overwritten when an update is downloaded.

http://docs.coronalabs.com/api/library/system/DocumentsDirectory.html

http://docs.coronalabs.com/api/library/system/ResourceDirectory.html

Best regards,

Tomas

Tomas,

Thank you so much for your helpful explanation:) 

Just to add to this, system.ResourcesDirectory is a read-only location.  You can’t write data to an SQLite database located there, so if you are successfully saving values and retrieving them, then you are likely writing them to an update safe location.

Rob