Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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.

— asked June 11th 2010 by shawn gordhamer
  • db
  • iphone
  • mobile
0 Comments

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.

    — answered July 22nd 2011 by Doug Handy
    permalink
    0 Comments
  • 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.

    — answered June 11th 2010 by Mitch Shields
    permalink
    0 Comments
  • What about for android?

    — answered July 22nd 2011 by David Lowe
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.