>
SQLite in Adobe AIR
Welcome, Guest

by Gagan on Monday, 28 December 2009
SQLite in Adobe AIR


step 1 : Create a 'File' (object) which will be responsible for creating and maintaining the database file (usually with a .db extension).

public var exampleDBFile:File;

exampleDBFile=File.documentsDirectory;
exampleDBFile=exampleDBFile.resolvePath("ExampleDatabase.db");

�step 2 :� Create a new SQL connection

public var exampleDB:SQLConnection;

exampleDB=new SQLConnection();
��� ��� ��� exampleDB.addEventListener(SQLEvent.OPEN,onExampleDBConnected);
��� ��� ��� exampleDB.addEventListener(SQLErrorEvent.ERROR,onExampleDBError);
��� ��� ��� exampleDB.open(exampleDBFile);
��� ��� }
��� ���
��� ��� public function onExampleDBConnected(evt:Event):void
��� ��� {
��� ������� if(evt.type=='open')
��� ��� ��� {
��� ��� ��� ��� trace("database opened");
��� ��� ��� }
��� ��� }
��� ���
��� ��� public function onExampleDBError(evt:SQLErrorEvent):void
��� ��� {
��� ��� ��� trace("error : "+evt);
��� ��� }

 

step 3 : After the database has been created and connection has been established, we can run any sql query on it.

public function CreateTable():void
��� ��� {
��� ��� ��� dbStatement.sqlConnection=exampleDB;
��� ��� ��� var sqlQuery:String="create table IF NOT EXISTS Users (id integer primary key,name text);"
��� ��� ��� dbStatement.text=sqlQuery;
��� ��� ��� dbStatement.addEventListener(SQLEvent.RESULT,onDBStatementCreateTable);
��� ��� ��� try{
��� ��� ��� ��� dbStatement.execute();
��� ��� ��� }
��� ��� ��� catch(e:SQLError){trace(e);}
��� ��� }



Blogger Image
My Blog Title

Product Engineering, software engineering company, Product Development, Product Migration, Product Re-engineering, Product Maintenance, Product Testing Commercial Application Development, Business Software development, commercial software for startups, Application Support and Maintenance, software testing Product Maintenance, Outsource product maintenance, product support and maintenance Product Migration, Product Re-engineering, product re-engineering services Product Research, Product Engineering, UI Prototyping Services Software Testing Services, Quality Assurance services, professional software testers, Load Testing, Functional Testing, Cross Platform, Browser Testing, Test Automation, Testing Tools, software quality analysis Functional Testing Services, software quality analysis, Software Testing Services, Application Testing Services, Functional Testing Types Automated Testing, Automated Testing Services, automation testing, test script development, Automation Test Tools, outsource automation testing Load Testing, Performance Testing Services, Load Testing Tools Offshore Software Development, Outsource software services, offshore outsourcing services, offshore software development services, IT outsourcing services, software quality assurance services, Offshore IT services, Custom Application Development Services, Offshore Product Engineering Benefits of IT Outsourcing, Offshore Software Development companies, offshore software development firms Outsource planning, IT outsourcing, IT development services, offshore IT companies, offshore software development Offshore Software Development, Outsource software services, offshore outsourcing services, offshore software development services, IT outsourcing services, software quality assurance services, Offshore IT services, Custom Application Development Services, Offshore Product Engineering Offshore Software Development, Outsource software services, offshore outsourcing services, offshore software development services, IT outsourcing services, software quality assurance services, Offshore IT services, Custom Application Development Services, Offshore Product Engineering