Packageat.db.sql
Classpublic class SQLEngine
InheritanceSQLEngine Inheritance flash.events.EventDispatcher



Public Properties
 PropertyDefined by
  databaseConnection : Connection
[read-only] Returns the SQL Connection for this instance of the SQLEngine
SQLEngine
  debugMode : Boolean
[static][write-only]
SQLEngine
Protected Properties
 PropertyDefined by
  sqlConnection : Connection
SQLEngine
  transactionQueue : TransactionQueue
SQLEngine
  transactionSync : TransactionSync
SQLEngine
Public Methods
 MethodDefined by
  
SQLEngine(pDBFileName:String, pTableArray:ArrayCollection = null)
SQLEngine
  
addTransaction(sqlStatement:ISQLStatement, resultHandler:Function = null, async:Boolean = false):void
This function will add an ISQLStatement to the transaction queue.
SQLEngine
  
Closes the database connections
SQLEngine
  
compactDB():void
Reclaims all unused space in the database.
SQLEngine
  
dbBegin():void
Begins a transaction within which all SQL statements executed against the connection's database or databases are grouped.
SQLEngine
  
dbCommit():void
Commits an existing transaction, causing any actions performed by the transaction's statements to be permanently applied to the database.
SQLEngine
  
executeSync(sqlStatement:ISQLStatement):Object
Executes an ISQLStatement immediately (synchronously) and will return it's result.
SQLEngine
  
openDatabase():void
Opens the database connections.
SQLEngine
Events
 EventSummaryDefined by
    SQLEngine
    SQLEngine
    SQLEngine
   This class contains the functionality to create a SQLite database and pump SQL statements synchronously and asynchronously with little management upon the end user.SQLEngine
    SQLEngine
    SQLEngine
Property detail
databaseConnectionproperty
databaseConnection:Connection  [read-only]

Returns the SQL Connection for this instance of the SQLEngine

Implementation
    public function get databaseConnection():Connection
debugModeproperty 
debugMode:Boolean  [write-only]Implementation
    public function set debugMode(value:Boolean):void
sqlConnectionproperty 
protected var sqlConnection:Connection
transactionQueueproperty 
protected var transactionQueue:TransactionQueue
transactionSyncproperty 
protected var transactionSync:TransactionSync
Constructor detail
SQLEngine()constructor
public function SQLEngine(pDBFileName:String, pTableArray:ArrayCollection = null)Parameters
pDBFileName:String
 
pTableArray:ArrayCollection (default = null)
Method detail
addTransaction()method
public function addTransaction(sqlStatement:ISQLStatement, resultHandler:Function = null, async:Boolean = false):void

This function will add an ISQLStatement to the transaction queue. Once the statement as completed it will fire the resultHandler. This funciton is useful for bulk inserts/updates and Asynchronously selecting large datasets. For smaller select statements consider using executeSync.

Parameters
sqlStatement:ISQLStatement
 
resultHandler:Function (default = null)
 
async:Boolean (default = false)
closeDatabase()method 
public function closeDatabase():void

Closes the database connections

compactDB()method 
public function compactDB():void

Reclaims all unused space in the database. When an object (table, index, or trigger) is dropped from the database, it leaves behind empty space. This makes the database file larger than it needs to be, but can speed up INSERT operations. Over time, INSERT and DELETE operations can leave the database file structure fragmented, which slows down disk access to the database contents. This method compacts the database file, eliminating free pages, aligning table data to be contiguous, and otherwise cleaning up the database file structure. Only call this function when all DB operations are complete.

dbBegin()method 
public function dbBegin():void

Begins a transaction within which all SQL statements executed against the connection's database or databases are grouped.

dbCommit()method 
public function dbCommit():void

Commits an existing transaction, causing any actions performed by the transaction's statements to be permanently applied to the database.

executeSync()method 
public function executeSync(sqlStatement:ISQLStatement):Object

Executes an ISQLStatement immediately (synchronously) and will return it's result. This function is not intended for bulk inserts/updates and Asynchronously selecting large datasets. For these operations consider using addTransaction.

Parameters
sqlStatement:ISQLStatement

Returns
Object
openDatabase()method 
public function openDatabase():void

Opens the database connections. This happens upon instantiation of SQLEngine and does not necessarly need to be called.

Event detail
closeevent 
Event object type: flash.events.SQLEvent

completeevent  
Event object type: flash.events.Event

errorevent  
Event object type: flash.events.SQLErrorEvent

openevent  
Event object type: flash.events.SQLEvent

This class contains the functionality to create a SQLite database and pump SQL statements synchronously and asynchronously with little management upon the end user. As asynchronous SQL statements are completed functions can automaically be executed. Synchronous statements can be executed however there are consequences to doing so because synchronous execution halts system processing until the SQL Statement has completed. When desiging your classes that utilize the SQL Engine consider utilizing asynchronous database calls at to not halt execution and cause pauses in visual elements. Example: (GET ALL RECORDS FROM TABLE tableA WITH AN ID OF 1) var sqlEngine:SQLEngine = new SQLEngine("temp.db"); var sqlStmt:SQLEngineStatement = new SQLStatement(); sqlStmt.SQLQueryText = "SELECT FROM tableA WHERE (tableA.id=

progressevent  
Event object type: flash.events.ProgressEvent

resultevent  
Event object type: flash.events.SQLEvent