Adobe AIR - local SQL database queries
Below you can find examples of SQL statements(SELECT, INSERT, UPDATE, DELETE).
<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()" viewSourceURL="srcview/index.html"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; private var sqlConn:SQLConnection; private var sqlFile:File; private var categories:ArrayCollection; private function init():void { sqlFile = File.applicationStorageDirectory.resolvePath("DBSample.db"); sqlConn = new SQLConnection(); sqlConn.open(sqlFile, SQLMode.CREATE); } private function createCategories():void { var stmt:SQLStatement = new SQLStatement(); stmt.sqlConnection = sqlConn; stmt.text = "CREATE TABLE IF NOT EXISTS categories(" + "categoryid INTEGER PRIMARY KEY AUTOINCREMENT," + "name TEXT)"; stmt.execute(); var result:SQLResult = stmt.getResult(); categories = new ArrayCollection(result.data); } private function getCategories():void { var stmt:SQLStatement = new SQLStatement(); stmt.sqlConnection = sqlConn; stmt.text = "SELECT * FROM categories ORDER BY categoryid DESC"; stmt.execute(); var result:SQLResult = stmt.getResult(); } private function addCategory(value:String):void { var stmt:SQLStatement = new SQLStatement(); stmt.sqlConnection = sqlConn; // Statement stmt.text = "INSERT INTO categories " + "(name) VALUES (:name)"; stmt.parameters[":name"] = value; //OR Statement stmt.text = "INSERT INTO categories " + "(name) VALUES ('"+value+"')"; stmt.execute(); var result:SQLResult = stmt.getResult(); } private function updateCategory(name:String, categoryid:int):void { var stmt:SQLStatement = new SQLStatement(); stmt.sqlConnection = sqlConn; stmt.text = "UPDATE categories " + "SET name='"+name+"'" + "WHERE " + "categoryid='"+categoryid+"'"; stmt.execute(); var result:SQLResult = stmt.getResult(); getCategories(); } private function removeCategory(categoryid:int):void { var stmt:SQLStatement = new SQLStatement(); stmt.sqlConnection = sqlConn; // Statement stmt.text = "DELETE FROM categories WHERE categoryid=:categoryid"; stmt.parameters[":categoryid"] = categoryid; // OR Statement stmt.text = "DELETE FROM categories WHERE categoryid='"+categoryid+"'"; stmt.execute(); var result:SQLResult = stmt.getResult(); getCategories(); } ]]> </mx:Script> </mx:WindowedApplication>

I’m Mariusz Tkaczyk.