Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
DBConnection Class Reference

Public Member Functions

 connect ()
 
 DBConnection ()
 
 disconnect ()
 
getDBConn ()
 
 getDriver ()
 
 getNumQueries ()
 
 initConn ()
 
 initCustomDBConnection ($driver, $host, $username, $password, $databaseName, $persistent=true, $connectionCharset=false, $connectOnInit=true, $debug=false, $forceNew=false)
 
 initDefaultDBConnection ()
 
 isConnected ()
 
 reconnect ($forceNew=false)
 

Static Public Member Functions

static & getConn ()
 
static getInstance ($setInstance=null)
 

Public Attributes

 $connected
 
 $connectOnInit
 
 $dbconn
 
 $driver
 

Detailed Description

Class for accessing the low-level database connection. Currently integrated with ADOdb (from http://adodb.sourceforge.net).

Definition at line 18 of file DBConnection.inc.php.

Member Function Documentation

DBConnection::connect ( )

Establish connection to the database.

Returns
boolean

Definition at line 138 of file DBConnection.inc.php.

DBConnection::DBConnection ( )

Constructor. Calls initDefaultDBConnection if no arguments are passed, otherwise calls initCustomDBConnection with custom connection parameters.

Definition at line 57 of file DBConnection.inc.php.

Referenced by getNumQueries().

DBConnection::disconnect ( )

Disconnect from the database.

Definition at line 174 of file DBConnection.inc.php.

static& DBConnection::getConn ( )
static

Return a reference to a single static instance of the database connection.

Returns
ADONewConnection

Definition at line 239 of file DBConnection.inc.php.

References $driver.

Referenced by DAO\DAO(), and ServerInfoGridHandler\loadData().

& DBConnection::getDBConn ( )

Return the database connection object.

Returns
ADONewConnection

Definition at line 198 of file DBConnection.inc.php.

DBConnection::getDriver ( )

Return the name of the driver used for this connection.

Returns
string

Definition at line 248 of file DBConnection.inc.php.

static DBConnection::getInstance (   $setInstance = null)
static

Return a reference to a single static instance of the database connection manager.

Parameters
$setInstanceDBConnection
Returns
DBConnection

Definition at line 223 of file DBConnection.inc.php.

Referenced by DAO\getDriver(), and DatabaseTestCase\setUp().

DBConnection::getNumQueries ( )

Get number of database queries executed.

Returns
int

Definition at line 214 of file DBConnection.inc.php.

References DBConnection(), and Registry\get().

DBConnection::initConn ( )

Initialize database connection object and establish connection to the database.

Returns
boolean

Definition at line 122 of file DBConnection.inc.php.

DBConnection::initCustomDBConnection (   $driver,
  $host,
  $username,
  $password,
  $databaseName,
  $persistent = true,
  $connectionCharset = false,
  $connectOnInit = true,
  $debug = false,
  $forceNew = false 
)

Create new database connection with the specified connection parameters.

Parameters
$driverstring
$hoststring
$usernamestring
$passwordstring
$databaseNamestring
$persistentboolean use persistent connections (default true)
$connectionCharsetstring character set to use for the connection (default none)
$connectOnInitboolean establish database connection on initiation (default true)
$debugboolean enable verbose debug output (default false)
$forceNewboolean force a new connection (default false)
Returns
boolean

Definition at line 103 of file DBConnection.inc.php.

DBConnection::initDefaultDBConnection ( )

Create new database connection with the connection parameters from the system configuration.

Returns
boolean

Definition at line 73 of file DBConnection.inc.php.

DBConnection::isConnected ( )

Check if a database connection has been established.

Returns
boolean

Definition at line 206 of file DBConnection.inc.php.

DBConnection::reconnect (   $forceNew = false)

Reconnect to the database.

Parameters
$forceNewboolean force a new connection

Definition at line 185 of file DBConnection.inc.php.

Member Data Documentation

boolean DBConnection::$connected

indicate connection status

Definition at line 49 of file DBConnection.inc.php.

boolean DBConnection::$connectOnInit

establish connection on initiation

Definition at line 37 of file DBConnection.inc.php.

DBConnection::$dbconn

The underlying database connection object

Definition at line 21 of file DBConnection.inc.php.

DBConnection::$driver

Database connection parameters

Definition at line 24 of file DBConnection.inc.php.

Referenced by getConn().


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