Abstract Class JDatabaseDriverPdo

Description

Joomla Platform PDO Database Driver Class

Located in /libraries/joomla/database/driver/pdo.php (line 20)

JDatabase
   |
   --JDatabaseDriver
      |
      --JDatabaseDriverPdo
Direct descendents
Class Description
 class JDatabaseDriverOracle Oracle database driver
 class JDatabaseDriverSqlite SQLite database driver
Variable Summary
 array $executed
 string $name
 string $nameQuote
 string $nullDate
 resource $prepared
Method Summary
 static boolean isSupported ()
 JDatabaseDriverPdo __construct (array $options)
 void __destruct ()
 void connect ()
 boolean connected ()
 void disconnect ()
 string escape (string $text, [boolean $extra = false])
 mixed execute ()
 mixed fetchArray ([mixed $cursor = null])
 mixed fetchAssoc ([mixed $cursor = null])
 mixed fetchObject ([mixed $cursor = null], [string $class = 'stdClass'])
 void freeResult ([mixed $cursor = null])
 integer getAffectedRows ()
 string getConnectedQuery ()
 integer getNumRows ([resource $cursor = null])
 mixed getOption (mixed $key)
 string insertid ()
 mixed loadNextAssoc ()
 mixed loadNextObject ([string $class = 'stdClass'])
 mixed loadNextRow ()
 boolean select (string $database)
 boolean setOption (integer $key, mixed $value)
 JDatabaseDriver setQuery (mixed $query, [integer $offset = null], [integer $limit = null], [array $driverOptions = array()])
 boolean setUTF ()
 void transactionCommit ([boolean $toSavepoint = false])
 void transactionRollback ([boolean $toSavepoint = false])
 void transactionStart ([boolean $asSavepoint = false])
 array __sleep ()
 array __wakeup ()
Variables
array $executed = false (line 62)

Contains the current query execution status

  • since: 12.1
  • access: protected
string $name = 'pdo' (line 28)

The name of the database driver.

  • since: 12.1
  • access: public

Redefinition of:
JDatabaseDriver::$name
The name of the database driver.

Redefined in descendants as:
string $nameQuote = "'" (line 39)

The character(s) used to quote SQL statement names such as table names or field names, etc. The child classes should define this as necessary. If a single character string the same character is used for both sides of the quoted name, else the first character will be used for the opening quote and the second for the closing quote.

  • since: 12.1
  • access: protected

Redefinition of:
JDatabaseDriver::$nameQuote

Redefined in descendants as:
  • JDatabaseDriverOracle::$nameQuote : The character(s) used to quote SQL statement names such as table names or field names, etc. The child classes should define this as necessary. If a single character string the same character is used for both sides of the quoted name, else the first character will be used for the opening quote and the second for the closing quote.
  • JDatabaseDriverSqlite::$nameQuote : The character(s) used to quote SQL statement names such as table names or field names, etc. The child classes should define this as necessary. If a single character string the same character is used for both sides of the quoted name, else the first character will be used for the opening quote and the second for the closing quote.
string $nullDate = '0000-00-00 00:00:00' (line 48)

The null or zero representation of a timestamp for the database driver. This should be defined in child classes to hold the appropriate value for the engine.

  • since: 12.1
  • access: protected

Redefinition of:
JDatabaseDriver::$nullDate
resource $prepared (line 54)
  • var: The prepared statement.
  • since: 12.1
  • access: protected

Inherited Variables

Inherited from JDatabaseDriver

JDatabaseDriver::$callStacks
JDatabaseDriver::$connection
JDatabaseDriver::$count
JDatabaseDriver::$cursor
JDatabaseDriver::$dbMinimum
JDatabaseDriver::$debug
JDatabaseDriver::$disconnectHandlers
JDatabaseDriver::$errorMsg
JDatabaseDriver::$errorNum
JDatabaseDriver::$instances
JDatabaseDriver::$limit
JDatabaseDriver::$log
JDatabaseDriver::$offset
JDatabaseDriver::$options
JDatabaseDriver::$sql
JDatabaseDriver::$tablePrefix
JDatabaseDriver::$timings
JDatabaseDriver::$transactionDepth
JDatabaseDriver::$utf
Methods
static isSupported (line 535)

Test to see if the PDO extension is available.

Override as needed to check for specific PDO Drivers.

  • return: True on success, false otherwise.
  • since: 12.1
  • access: public
static boolean isSupported ()

Redefined in descendants as:
Constructor __construct (line 71)

Constructor.

  • since: 12.1
  • access: public
JDatabaseDriverPdo __construct (array $options)
  • array $options: List of options used to configure the connection

Redefinition of:
JDatabaseDriver::__construct()
Constructor.

Redefined in descendants as:
Destructor __destruct (line 91)

Destructor.

  • since: 12.1
  • access: public
void __destruct ()

Redefined in descendants as:
connect (line 104)

Connects to the database if needed.

  • return: Returns void if the database connected successfully.
  • since: 12.1
  • throws: RuntimeException
  • access: public
void connect ()

Redefinition of:
JDatabaseDriver::connect()
Connects to the database if needed.

Redefined in descendants as:
connected (line 547)

Determines if the connection to the server is active.

  • return: True if connected to the database engine.
  • since: 12.1
  • access: public
boolean connected ()

Redefinition of:
JDatabaseDriver::connected()
Determines if the connection to the server is active.
disconnect (line 307)

Disconnects the database.

  • since: 12.1
  • access: public
void disconnect ()

Redefinition of:
JDatabaseDriver::disconnect()
Disconnects the database.

Redefined in descendants as:
escape (line 339)

Method to escape a string for usage in an SQL statement.

Oracle escaping reference: http://www.orafaq.com/wiki/SQL_FAQ#How_does_one_escape_special_characters_when_writing_SQL_queries.3F

SQLite escaping notes: http://www.sqlite.org/faq.html#q14

Method body is as implemented by the Zend Framework

Note: Using query objects with bound variables is preferable to the below.

  • return: The escaped string.
  • since: 12.1
  • access: public
string escape (string $text, [boolean $extra = false])
  • string $text: The string to be escaped.
  • boolean $extra: Unused optional parameter to provide extra escaping.

Redefinition of:
JDatabaseDriver::escape()
Escapes a string for usage in an SQL statement.

Redefined in descendants as:
execute (line 360)

Execute the SQL statement.

  • return: A database cursor resource on success, boolean false on failure.
  • throws: RuntimeException
  • throws: Exception
  • since: 12.1
  • access: public
mixed execute ()

Redefinition of:
JDatabaseDriver::execute()
Execute the SQL statement.
fetchArray (line 797)

Method to fetch a row from the result set cursor as an array.

  • return: Either the next row from the result set or false if there are no more rows.
  • since: 12.1
  • access: protected
mixed fetchArray ([mixed $cursor = null])
  • mixed $cursor: The optional result set cursor from which to fetch the row.

Redefinition of:
JDatabaseDriver::fetchArray()
Method to fetch a row from the result set cursor as an array.
fetchAssoc (line 818)

Method to fetch a row from the result set cursor as an associative array.

  • return: Either the next row from the result set or false if there are no more rows.
  • since: 12.1
  • access: protected
mixed fetchAssoc ([mixed $cursor = null])
  • mixed $cursor: The optional result set cursor from which to fetch the row.

Redefinition of:
JDatabaseDriver::fetchAssoc()
Method to fetch a row from the result set cursor as an associative array.
fetchObject (line 840)

Method to fetch a row from the result set cursor as an object.

  • return: Either the next row from the result set or false if there are no more rows.
  • since: 12.1
  • access: protected
mixed fetchObject ([mixed $cursor = null], [string $class = 'stdClass'])
  • mixed $cursor: The optional result set cursor from which to fetch the row.
  • string $class: Unused, only necessary so method signature will be the same as parent.

Redefinition of:
JDatabaseDriver::fetchObject()
Method to fetch a row from the result set cursor as an object.
freeResult (line 861)

Method to free up the memory used for the result set.

  • since: 12.1
  • access: protected
void freeResult ([mixed $cursor = null])
  • mixed $cursor: The optional result set cursor from which to fetch the row.

Redefinition of:
JDatabaseDriver::freeResult()
Method to free up the memory used for the result set.
getAffectedRows (line 598)

Get the number of affected rows for the previous executed SQL statement.

Only applicable for DELETE, INSERT, or UPDATE statements.

  • return: The number of affected rows.
  • since: 12.1
  • access: public
integer getAffectedRows ()

Redefinition of:
JDatabaseDriver::getAffectedRows()
Get the number of affected rows for the previous executed SQL statement.
getConnectedQuery (line 500)

Get a query to run and verify the database is operational.

  • return: The query to check the health of the DB.
  • since: 12.2
  • access: public
string getConnectedQuery ()

Redefined in descendants as:
getNumRows (line 621)

Get the number of returned rows for the previous executed SQL statement.

  • return: The number of returned rows.
  • since: 12.1
  • access: public
integer getNumRows ([resource $cursor = null])
  • resource $cursor: An optional database cursor resource to extract the row count from.

Redefinition of:
JDatabaseDriver::getNumRows()
Get the number of returned rows for the previous executed SQL statement.
getOption (line 486)

Retrieve a PDO database connection attribute http://www.php.net/manual/en/pdo.getattribute.php

Usage: $db->getOption(PDO::ATTR_CASE);

  • since: 12.1
  • access: public
mixed getOption (mixed $key)
  • mixed $key: One of the PDO::ATTR_* Constants
insertid (line 646)

Method to get the auto-incremented value from the last INSERT statement.

  • return: The value of the auto-increment field from the last inserted row.
  • since: 12.1
  • access: public
string insertid ()

Redefinition of:
JDatabaseDriver::insertid()
Method to get the auto-incremented value from the last INSERT statement.
loadNextAssoc (line 920)

Method to get the next row in the result set from the database query as an array.

  • return: The result of the query as an array, false if there are no more rows.
  • since: 12.1
  • throws: RuntimeException
  • access: public
mixed loadNextAssoc ()
loadNextObject (line 887)

Method to get the next row in the result set from the database query as an object.

  • return: The result of the query as an array, false if there are no more rows.
  • since: 12.1
  • throws: RuntimeException
  • access: public
mixed loadNextObject ([string $class = 'stdClass'])
  • string $class: The class name to use for the returned row object.

Redefinition of:
JDatabaseDriver::loadNextObject()
Method to get the next row in the result set from the database query as an object.
loadNextRow (line 953)

Method to get the next row in the result set from the database query as an array.

  • return: The result of the query as an array, false if there are no more rows.
  • since: 12.1
  • throws: RuntimeException
  • access: public
mixed loadNextRow ()

Redefinition of:
JDatabaseDriver::loadNextRow()
Method to get the next row in the result set from the database query as an array.
select (line 664)

Select a database for use.

  • return: True if the database was successfully selected.
  • since: 12.1
  • throws: RuntimeException
  • access: public
boolean select (string $database)
  • string $database: The name of the database to select for use.

Redefinition of:
JDatabaseDriver::select()
Select a database for use.

Redefined in descendants as:
setOption (line 520)

Sets an attribute on the PDO database handle.

http://www.php.net/manual/en/pdo.setattribute.php

Usage: $db->setOption(PDO::ATTR_CASE, PDO::CASE_UPPER);

  • since: 12.1
  • access: public
boolean setOption (integer $key, mixed $value)
  • integer $key: One of the PDO::ATTR_* Constants
  • mixed $value: One of the associated PDO Constants related to the particular attribute key.
setQuery (line 683)

Sets the SQL statement string for later execution.

  • return: This object to support method chaining.
  • since: 12.1
  • access: public
JDatabaseDriver setQuery (mixed $query, [integer $offset = null], [integer $limit = null], [array $driverOptions = array()])
  • mixed $query: The SQL statement to set either as a JDatabaseQuery object or a string.
  • integer $offset: The affected row offset to set.
  • integer $limit: The maximum affected rows to set.
  • array $driverOptions: The optional PDO driver options

Redefinition of:
JDatabaseDriver::setQuery()
Sets the SQL statement string for later execution.
setUTF (line 717)

Set the connection to use UTF-8 character encoding.

  • return: True on success.
  • since: 12.1
  • access: public
boolean setUTF ()

Redefinition of:
JDatabaseDriver::setUTF()
Set the connection to use UTF-8 character encoding.

Redefined in descendants as:
transactionCommit (line 732)

Method to commit a transaction.

  • since: 12.1
  • throws: RuntimeException
  • access: public
void transactionCommit ([boolean $toSavepoint = false])
  • boolean $toSavepoint: If true, commit to the last savepoint.

Redefinition of:
JDatabaseDriver::transactionCommit()
Method to commit a transaction.

Redefined in descendants as:
transactionRollback (line 754)

Method to roll back a transaction.

  • since: 12.1
  • throws: RuntimeException
  • access: public
void transactionRollback ([boolean $toSavepoint = false])
  • boolean $toSavepoint: If true, rollback to the last savepoint.

Redefinition of:
JDatabaseDriver::transactionRollback()
Method to roll back a transaction.

Redefined in descendants as:
transactionStart (line 776)

Method to initialize a transaction.

  • since: 12.1
  • throws: RuntimeException
  • access: public
void transactionStart ([boolean $asSavepoint = false])
  • boolean $asSavepoint: If true and a transaction is already active, a savepoint will be created.

Redefinition of:
JDatabaseDriver::transactionStart()
Method to initialize a transaction.

Redefined in descendants as:
__sleep (line 985)

PDO does not support serialize

  • since: 12.3
  • access: public
array __sleep ()
__wakeup (line 1013)

Wake up after serialization

  • since: 12.3
  • access: public
array __wakeup ()

Inherited Methods

Inherited From JDatabaseDriver

 JDatabaseDriver::__construct()
 JDatabaseDriver::addDisconnectHandler()
 JDatabaseDriver::alterDbCharacterSet()
 JDatabaseDriver::connect()
 JDatabaseDriver::connected()
 JDatabaseDriver::createDatabase()
 JDatabaseDriver::disconnect()
 JDatabaseDriver::dropTable()
 JDatabaseDriver::escape()
 JDatabaseDriver::execute()
 JDatabaseDriver::fetchArray()
 JDatabaseDriver::fetchAssoc()
 JDatabaseDriver::fetchObject()
 JDatabaseDriver::freeResult()
 JDatabaseDriver::getAffectedRows()
 JDatabaseDriver::getAlterDbCharacterSet()
 JDatabaseDriver::getCallStacks()
 JDatabaseDriver::getCollation()
 JDatabaseDriver::getConnection()
 JDatabaseDriver::getConnectors()
 JDatabaseDriver::getCount()
 JDatabaseDriver::getCreateDatabaseQuery()
 JDatabaseDriver::getDatabase()
 JDatabaseDriver::getDateFormat()
 JDatabaseDriver::getExporter()
 JDatabaseDriver::getImporter()
 JDatabaseDriver::getInstance()
 JDatabaseDriver::getIterator()
 JDatabaseDriver::getLog()
 JDatabaseDriver::getMinimum()
 JDatabaseDriver::getNullDate()
 JDatabaseDriver::getNumRows()
 JDatabaseDriver::getPrefix()
 JDatabaseDriver::getQuery()
 JDatabaseDriver::getTableColumns()
 JDatabaseDriver::getTableCreate()
 JDatabaseDriver::getTableKeys()
 JDatabaseDriver::getTableList()
 JDatabaseDriver::getTimings()
 JDatabaseDriver::getUTFSupport()
 JDatabaseDriver::getVersion()
 JDatabaseDriver::hasUTFSupport()
 JDatabaseDriver::insertid()
 JDatabaseDriver::insertObject()
 JDatabaseDriver::isMinimumVersion()
 JDatabaseDriver::loadAssoc()
 JDatabaseDriver::loadAssocList()
 JDatabaseDriver::loadColumn()
 JDatabaseDriver::loadNextObject()
 JDatabaseDriver::loadNextRow()
 JDatabaseDriver::loadObject()
 JDatabaseDriver::loadObjectList()
 JDatabaseDriver::loadResult()
 JDatabaseDriver::loadRow()
 JDatabaseDriver::loadRowList()
 JDatabaseDriver::lockTable()
 JDatabaseDriver::quote()
 JDatabaseDriver::quoteName()
 JDatabaseDriver::quoteNameStr()
 JDatabaseDriver::renameTable()
 JDatabaseDriver::replacePrefix()
 JDatabaseDriver::select()
 JDatabaseDriver::setDebug()
 JDatabaseDriver::setQuery()
 JDatabaseDriver::setUTF()
 JDatabaseDriver::splitSql()
 JDatabaseDriver::transactionCommit()
 JDatabaseDriver::transactionRollback()
 JDatabaseDriver::transactionStart()
 JDatabaseDriver::truncateTable()
 JDatabaseDriver::unlockTables()
 JDatabaseDriver::updateObject()
 JDatabaseDriver::__call()

Inherited From JDatabase

 JDatabase::getConnectors()
 JDatabase::getErrorMsg()
 JDatabase::getErrorNum()
 JDatabase::getInstance()
 JDatabase::query()
 JDatabase::splitSql()
 JDatabase::stderr()
 JDatabase::test()

Documentation generated on Tue, 19 Nov 2013 15:10:27 +0100 by phpDocumentor 1.4.3