codecowboy
codecowboy

Reputation: 10095

Can I embed a sqlite database in an Air application?

Is it always necessary to create a database for the user in an adobe air application or can you ship an empty database as part of the distributed app?

Upvotes: 3

Views: 1268

Answers (1)

dirkgently
dirkgently

Reputation: 111130

Look up the section 'Distributing a pre-populated database' in Flex 3.0 documentation. From the documentation:

[...]As an alternative to creating the database, structure, and data programmatically, you can distribute a pre-populated database with your application. To distribute a predefined database, include the database file in the application's AIR package.

Like all files that are included in an AIR package, a bundled database file is installed in the application directory (the directory represented by the File.applicationDirectory property). However, files in that directory are read-only. Use the file from the AIR package as a "template" database. The first time a user runs the application, copy the original database file into the user's application storage directory (or another location), and use that database within the application.

So, the answer to your question:

can you ship an empty database as part of the distributed app?

is yes!

Upvotes: 7

Related Questions