Packagecom.ericfeminella.sql.utils
Classpublic class SQLConnectionHelper

SQLConnectionHelper is an all static class which provides a centralized location from which all SQLConnection instances can be managed and retrieved.

SQLConnectionHelper utilizes the nativePath property of a File object used to create the connection. This is utilized to uniquely identify each cached SQLConnection database instance within the connections map.



Public Methods
 MethodDefined by
  
close(databasePath:String):void
[static] Closes the connection to the previously cached SQLConnection instance.
SQLConnectionHelper
  
getConnection(name:String):SQLConnection
[static] Retrieves a managed SQLConnection instance based on the unique name of the database, i.e.
SQLConnectionHelper
Protected Constants
 ConstantDefined by
  connections : Dictionary
[static] Contains a mapping of each unique SQLConnection instance
SQLConnectionHelper
Method detail
close()method
public static function close(databasePath:String):void

Closes the connection to the previously cached SQLConnection instance.

Parameters
databasePath:String — The database path of the SQLConnection

Throws
— UnmanagedSQLConnectionException

Example
The following example demonstrates how SQLConnectionHelper can be utilized to close a shared SQLConnection
   
   var databasePath:String = File.userDirectory.nativePath + File.separator + "foo.db"
   SQLConnectionHelper.close( databasePath );
   
   

getConnection()method 
public static function getConnection(name:String):SQLConnection

Retrieves a managed SQLConnection instance based on the unique name of the database, i.e. File.nativePath.

Typically the unique name of the database is based on the nativePath property File of the connections associated File object

Parameters
name:String — unique name of the SQLConnection database

Returns
SQLConnection — managed SQLConnection instance

Example
The following example demonstrates how SQLConnectionHelper can be utilized to retrieve a reference to a shared SQLConnection
   
   var databasePath:String = File.userDirectory.nativePath + File.separator + "foo.db"
   var connection:SQLConnection = SQLConnectionHelper.getConnection( databasePath );
   
   

Constant detail
connectionsconstant
protected static const connections:Dictionary

Contains a mapping of each unique SQLConnection instance