Open Journal Systems  2.4.4
 All Classes Namespaces Functions Variables Groups Pages
DBConnection Class Reference

Public Member Functions

 connect ()
 
 DBConnection ()
 
 disconnect ()
 
getConn ()
 
getDBConn ()
 
 getDriver ()
 
getInstance ($setInstance=null)
 
 getNumQueries ()
 
 initConn ()
 
 initCustomDBConnection ($driver, $host, $username, $password, $databaseName, $persistent=true, $connectionCharset=false, $connectOnInit=true, $debug=false, $forceNew=false)
 
 initDefaultDBConnection ()
 
 isConnected ()
 
 logQuery ($sql, $start, $params=array())
 
 reconnect ($forceNew=false)
 

Public Attributes

 $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 129 of file DBConnection.inc.php.

Referenced by initConn(), and reconnect().

DBConnection::DBConnection ( )

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

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

References initDefaultDBConnection().

Referenced by getInstance().

DBConnection::disconnect ( )

Disconnect from the database.

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

Referenced by reconnect().

& DBConnection::getConn ( )

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

Returns
ADONewConnection

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

References getInstance().

Referenced by PKPApplication\buildErrorMessage(), DAO\DAO(), XmlToSqlTool\execute(), DBDataXMLParser\executeData(), and AdminFunctionsHandler\systemInfo().

& DBConnection::getDBConn ( )

Return the database connection object.

Returns
ADONewConnection

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

References $dbconn.

DBConnection::getDriver ( )

Return the name of the driver used for this connection.

Returns
string

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

References $driver.

& DBConnection::getInstance (   $setInstance = null)

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

Parameters
$setInstanceDBConnection
Returns
DBConnection

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

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

Referenced by getConn(), DAO\getDriver(), and Installer\preInstall().

DBConnection::getNumQueries ( )

Get number of database queries executed.

Returns
int

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

DBConnection::initConn ( )

Initialize database connection object and establish connection to the database.

Returns
boolean

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

References connect().

Referenced by initCustomDBConnection(), and initDefaultDBConnection().

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 94 of file DBConnection.inc.php.

References $driver, and initConn().

DBConnection::initDefaultDBConnection ( )

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

Returns
boolean

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

References Config\getVar(), and initConn().

Referenced by DBConnection().

DBConnection::isConnected ( )

Check if a database connection has been established.

Returns
boolean

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

DBConnection::logQuery (   $sql,
  $start,
  $params = array() 
)

Log a SQL query and execution time in the PKPProfiler debug log

Parameters
$sqlstring SQL statement being run
$startstring a float representing the unix microtime the query started

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

References Registry\get(), Config\getVar(), and Core\microtime().

Referenced by DAO\retrieve(), DAO\retrieveCached(), DAO\retrieveLimit(), DAO\retrieveRange(), and DAO\update().

DBConnection::reconnect (   $forceNew = false)

Reconnect to the database.

Parameters
$forceNewboolean force a new connection

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

References connect(), and disconnect().

Member Data Documentation

DBConnection::$dbconn

The underlying database connection object

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

Referenced by getDBConn().

DBConnection::$driver

Database connection parameters

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

Referenced by getDriver(), and initCustomDBConnection().


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