O'Reilly logo

Adobe AIR 1.5 Cookbook by Koen De Weggheleire, Koen DeWeggheleire, Marco Casario, David Tucker, Rich Tretola

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10. Embedded SQL Database Programming

Adobe AIR doesn’t include only Flash Player to execute SWF content and only the WebKit engine to load HTML content and JavaScript. AIR also has an embedded version of the SQLite database engine that makes the runtime truly complete; SQLite gives developers the opportunity to store data locally offline and to do it via the same language they use to store data for web applications: SQL.

Widely used across platforms, SQLite is an open source, award-winning database engine that implements the SQL-92 specifications (http://www.sqlite.org/omitted.html).

SQLite in Adobe AIR gives applications the ability to persistently store data and easily manage it. This data can be stored locally in offline situations but then can be synchronized with network data store. With the 1.5 version of Adobe AIR, it isn’t possible, however, to natively connect to remote databases.

To be able to access, store, and manipulate data in a SQLite database in Adobe AIR, you first must create the database as a local file. Each database needs its own local file. The AIR SDKs contain the APIs you need to work with SQLite via ActionScript or JavaScript. For ActionScript code, SQL database classes are in the flash.data package, whereas for JavaScript, the classes can be directly instanced by using AIR aliases (you just have to import the AIRAliases.js file into your HTML document).

Creating a Database

Problem

You need to create a local database using SQLite.

Solution

Create a local ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required