Titanium.Database.install Question
If I package a large DB in the resource directory, what exactly does Titanium.Database.install do? Does it copy the database, making 2 copies of it, or does it leave it where I installed it originally? I don't want there to be the db file I pack with the app and another installed version of the file, since there will be lots of data in the db.
3 Answers
-
For android it is similar. The .install() method copies to a writeable directory so that your code is able to update the database. The issue here is that both iOS and Android make the Resources folder (and subfolders) read only. Thus if it opened it in place, you could not make changes to the data.
The read-only status also precludes Titanium from deleting the original copy in the resources folder after the .install has made the copy.
Instead of including the db with your app, consider installing without it and downloading on first use. It is what I do.
-
On the iPhone, install does exactly what you suspect. It copies the database file you have in Resources into the ApplicationSupportDirectory/database. The name of the file is the same name you used in the install call with .sql appended.
-
What about for android?