Creating and Accessing SQLite Database

Adobe AIR runtime includes full support for embedded SQLite database which is available for use to the applications. It implements majority of SQL92 specification and does not require any setup or configuration (other than programmatic instantiation and creation of tables). Each database is contained within a single file within the application file system. The following is a sample Flash ActionScript code to create and access the SQLite from an application running on BlackBerry PlayBook.

import flash.filesystem.File;
import flash.data.*;
var myDB:File = File.applicationStorageDirectory.resolvePath("mydatabase.db");
var sqlConn:SQLConnection = new SQLConnection();
var sqlStatement:SQLStatement = new SQLStatement();
sqlConn.open(myDB);
sqlStatement.sqlConnection = sqlConn;
sqlStatement.text = "SELECT * FROM table1";
sqlStatement.execute();
var result:Array = sqlStatement.getResult().data;

Additional References:
Comments