Introduction to SQLite in Adobe AIR
I just got back from joining the European on AIR tour in Amsterdam and Brussels and it rocked big time!
Two great events with hundreds of developers attending to learn all about the Adobe Integrated Runtime. For me it was an opportunity to deep dive in the SQLite database API and build a couple of interesting demo’s. Talked to so many people with fantastic ideas and eager to get started with AIR that I’m sure we’ll be seeing some amazing things happening in the coming months.
As promised here are the slides for my SQLite talk as well as the downloads for the various demo apps and flash.data.SQLConnection and flash.data.SQLStatement wrapper classes.
SQLite in Adobe AIR slides
SQLite Contact Manager
The “SQLite Contact Manager” is a simple AIR application that allows you to add, edit, delete and search contacts in a local SQLite database.

SQLite wrapper classes
I’ve written some classes to easily work with SQLConnection and SQLStatement classes in Flex as MXML tags and hook them up using events.
<sql:SQLite id="contacts_db" file="contacts.db" open="allcontacts_query.execute()" />
<sql:Query id="allcontacts_query" connection="{contacts_db.connection}"
sql="SELECT * FROM contacts"
result="contacts_dg.dataProvider = allcontacts_query.data" />
<mx:DataGrid id="contacts_dg" left="0" right="0" top="0" bottom="0"/>
The code above assumes you already have a contacts table in contacts.db and some entries to get returned. The DataGrid component has its dataProvider property bound to the data that we get back from the allcontacts_query.
Any time this query gets executed the DataGrid component will update its data as needed. You can download the SQLite and Query classes below.
SQLite Editor
The “SQLite Editor” application allows you to easily run queries on a local SQLite database and uses SQLConnection.loadSchema() and introspection to list all tables in the database.

SQLite YouTube Database
The “SQLite YouTube Database” application allows you to load your favorite YouTube video’s in and store them as a binary data in a local SQLite database so you can view them when offline, share them with friends and extract FLV’s back out of.


This work, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.0 Belgium License.
No related posts.


