Returns the SQL Connection for this instance of the SQLEngine
public function get databaseConnection():Connection
public function set debugMode(value:Boolean):void
protected var sqlConnection:Connection
protected var transactionQueue:TransactionQueue
protected var transactionSync:TransactionSync
public function SQLEngine(pDBFileName:String, pTableArray:ArrayCollection = null)Parameters
pTableArray:ArrayCollection (default =
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.
resultHandler:Function (default =
async:Boolean (default =
public function closeDatabase():void
Closes the database connections
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.
public function dbBegin():void
Begins a transaction within which all SQL statements executed against the connection's database or databases are grouped.
public function dbCommit():void
Commits an existing transaction, causing any actions performed by the transaction's statements to be permanently applied to the database.
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.
public function openDatabase():void
Opens the database connections. This happens upon instantiation of SQLEngine and does not necessarly need to be called.
Event object type:
Event object type:
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.
(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=
Copyright 2009 AbelsonTaylor