Packageat.db.sql
Classpublic class Connection
InheritanceConnection Inheritance flash.events.EventDispatcher

This class maintains the sql connection for the SQLEngine. It handles sync and async connections, opening and closing of connections, compacting the database and table creation.



Public Properties
 PropertyDefined by
  dbConn : SQLConnection
[read-only] Returns the SQLConnection to the database.
Connection
  dbConnSync : SQLConnection
[read-only] Returns the SQLConnection to a Synchronous database connection
Connection
  debugMode : Boolean = false
[static] Enables debug mode out put.
Connection
  isAsynchrous : Boolean
[read-only] Returns a boolean if the database is currently in Asynchronous Mode.
Connection
  isDBOpened : Boolean
[read-only] Returns a boolean if the database has been sucessfully opened.
Connection
  tableCollection : ArrayCollection
A collection of IDatabaseTable objects used for creation of database tables if they do not exist.
Connection
  transactionQueue : TransactionQueue
A reference to the SQL Transaction Queue
Connection
Public Methods
 MethodDefined by
  
Connection(dbFileName:String, sqlEngine:SQLEngine, databaseTableList:ArrayCollection = null)
Constructs a new Connection class.
Connection
  
Closes the database connection.
Connection
  
compactDB():void
Reclaims all unused space in the database.
Connection
  
dbBegin():void
Sets the database connection to prepare to begin a batch transaction.
Connection
  
dbCommit():void
Sets the database connection to commit a batch transaction.
Connection
  
openDatabase():void
The method checks if the database file name supplied currently exists in the users application storage.
Connection
  
SetMode(executeMode:String):void
Switches betweeen Synchronous and Asynchronous execution mode
Connection
Protected Methods
 MethodDefined by
  
buildTables():void
Loops through all the tables passed via the _dbTableList and executes their table schema queries to build the tables on the fly.
Connection
Property detail
dbConnproperty
dbConn:SQLConnection  [read-only]

Returns the SQLConnection to the database.

Implementation
    public function get dbConn():SQLConnection
dbConnSyncproperty 
dbConnSync:SQLConnection  [read-only]

Returns the SQLConnection to a Synchronous database connection

Implementation
    public function get dbConnSync():SQLConnection
debugModeproperty 
public static var debugMode:Boolean = false

Enables debug mode out put.

isAsynchrousproperty 
isAsynchrous:Boolean  [read-only]

Returns a boolean if the database is currently in Asynchronous Mode.

Implementation
    public function get isAsynchrous():Boolean
isDBOpenedproperty 
isDBOpened:Boolean  [read-only]

Returns a boolean if the database has been sucessfully opened.

Implementation
    public function get isDBOpened():Boolean
tableCollectionproperty 
public var tableCollection:ArrayCollection

A collection of IDatabaseTable objects used for creation of database tables if they do not exist.

transactionQueueproperty 
public var transactionQueue:TransactionQueue

A reference to the SQL Transaction Queue

See also

Constructor detail
Connection()constructor
public function Connection(dbFileName:String, sqlEngine:SQLEngine, databaseTableList:ArrayCollection = null)

Constructs a new Connection class.

Parameters
dbFileName:String
 
sqlEngine:SQLEngine
 
databaseTableList:ArrayCollection (default = null)
Method detail
buildTables()method
protected function buildTables():void

Loops through all the tables passed via the _dbTableList and executes their table schema queries to build the tables on the fly.

closeDatabase()method 
public function closeDatabase():void

Closes the database connection.

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

Sets the database connection to prepare to begin a batch transaction.

See also

flash.data.SQLConnection.begin()
dbCommit()method 
public function dbCommit():void

Sets the database connection to commit a batch transaction.

See also

flash.data.SQLConnection.commit()
openDatabase()method 
public function openDatabase():void

The method checks if the database file name supplied currently exists in the users application storage. If not it will create the database file and if an array of tables were supplied it will call buildTables() method to populate the database with the tables.

SetMode()method 
public function SetMode(executeMode:String):void

Switches betweeen Synchronous and Asynchronous execution mode

Parameters
executeMode:String