spoof
 All Data Structures Namespaces Files Functions Variables Pages
Connection Class Reference
Inheritance diagram for Connection:
Collaboration diagram for Connection:

Public Member Functions

 __construct (IConfig $config)
 isConnected ()
 getConnection ()
 disconnect ()
 getFeatureLevel ($feature)
- Public Member Functions inherited from IConnection
 connect ()

Data Fields

 $driver

Protected Attributes

 $connection
 $config
 $features = array()

Detailed Description

A database connection class. This class is a wrapper around PHP's PDO database connection object.


Constructor & Destructor Documentation

__construct ( IConfig  $config)
Constructor for the database connection object instantiates the object but does not connect it to a database
@param IConfig $config database connection configuration object
@throw ConfigException when DSN specified with $config object has invalid format
@throw \lib360\db\object\NotFoundException when driver specified with $config cannot be loaded
Todo:
extra logging when throws exception?

TODO implement some logging here

Implements IConnection.


Member Function Documentation

disconnect ( )

Closes the connection

Implements IConnection.

getConnection ( )

Retrieves the underlying connection object

Returns:
connection object if connected, NULL otherwise
getFeatureLevel (   $feature)

Get feature support level

Parameters:
string$feature
Returns:
mixed feature support level

Implements IConnection.

isConnected ( )

Checks whether the database connection is active

Returns:
boolean TRUE if connected, boolean FALSE otherwise TODO is there a better way to check if connection is live?

Implements IConnection.


Field Documentation

$config
protected

Connection configuration object. Internal property used to store database connection configuration object.

$connection
protected

Connection object. Internal property used to store the PHP PDO connection object.

$driver

Driver object. Used to retrieve connection specific behavior.

$features = array()
protected

Features array Used to specify support for specific features. Extending classes should specify what features and levels they support.


The documentation for this class was generated from the following file: