Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe JDatabaseDriverPdo
+ Graphe d'héritage de JDatabaseDriverPdo:
+ Graphe de collaboration de JDatabaseDriverPdo:

Liste de tous les membres

Fonctions membres publiques

 __construct ($options)
 __destruct ()
 connect ()
 disconnect ()
 escape ($text, $extra=false)
 execute ()
 getOption ($key)
 getConnectedQuery ()
 setOption ($key, $value)
 connected ()
 getAffectedRows ()
 getNumRows ($cursor=null)
 insertid ()
 select ($database)
 setQuery ($query, $offset=null, $limit=null, $driverOptions=array())
 setUTF ()
 transactionCommit ($toSavepoint=false)
 transactionRollback ($toSavepoint=false)
 transactionStart ($asSavepoint=false)
 loadNextObject ($class= 'stdClass')
 loadNextAssoc ()
 loadNextRow ()
 __sleep ()
 __wakeup ()
- Fonctions membres publiques inherited from JDatabaseDriver
 __call ($method, $args)
 alterDbCharacterSet ($dbName)
 createDatabase ($options, $utf=true)
 addDisconnectHandler ($callable)
 dropTable ($table, $ifExists=true)
 getCollation ()
 getConnection ()
 getCount ()
 getDateFormat ()
 getLog ()
 getTimings ()
 getCallStacks ()
 getMinimum ()
 getNullDate ()
 getPrefix ()
 getExporter ()
 getImporter ()
 getQuery ($new=false)
 getIterator ($column=null, $class= 'stdClass')
 getTableColumns ($table, $typeOnly=true)
 getTableCreate ($tables)
 getTableKeys ($tables)
 getTableList ()
 getUTFSupport ()
 hasUTFSupport ()
 getVersion ()
 insertObject ($table, &$object, $key=null)
 isMinimumVersion ()
 loadAssoc ()
 loadAssocList ($key=null, $column=null)
 loadColumn ($offset=0)
 loadObject ($class= 'stdClass')
 loadObjectList ($key= '', $class= 'stdClass')
 loadResult ()
 loadRow ()
 loadRowList ($key=null)
 lockTable ($tableName)
 quote ($text, $escape=true)
 quoteName ($name, $as=null)
 replacePrefix ($sql, $prefix= '#__')
 renameTable ($oldTable, $newTable, $backup=null, $prefix=null)
 setDebug ($level)
 setQuery ($query, $offset=0, $limit=0)
 truncateTable ($table)
 updateObject ($table, &$object, $key, $nulls=false)
 unlockTables ()
- Fonctions membres publiques inherited from JDatabase
 query ()
 getErrorMsg ($escaped=false)
 getErrorNum ()
 stderr ($showSQL=false)

Fonctions membres publiques statiques

static isSupported ()
- Fonctions membres publiques statiques inherited from JDatabaseDriver
static getConnectors ()
static getInstance ($options=array())
static splitSql ($sql)
- Fonctions membres publiques statiques inherited from JDatabase
static test ()

Attributs publics

 $name = 'pdo'
- Attributs publics inherited from JDatabaseDriver

Fonctions membres protégées

 fetchArray ($cursor=null)
 fetchAssoc ($cursor=null)
 fetchObject ($cursor=null, $class= 'stdClass')
 freeResult ($cursor=null)
- Fonctions membres protégées inherited from JDatabaseDriver
 getAlterDbCharacterSet ($dbName)
 getCreateDatabaseQuery ($options, $utf)
 getDatabase ()
 quoteNameStr ($strArr)

Attributs protégés

 $nameQuote = "'"
 $nullDate = '0000-00-00 00:00:00'
 $prepared
 $executed = false
- Attributs protégés inherited from JDatabaseDriver
 $connection
 $count = 0
 $cursor
 $debug = false
 $limit = 0
 $log = array()
 $timings = array()
 $callStacks = array()
 $offset = 0
 $options
 $sql
 $tablePrefix
 $utf = true
 $errorNum = 0
 $errorMsg
 $transactionDepth = 0
 $disconnectHandlers = array()

Additional Inherited Members

- Attributs protégés statiques inherited from JDatabaseDriver
static $instances = array()
static $dbMinimum

Description détaillée

Définition à la ligne 20 du fichier pdo.php.


Documentation des constructeurs et destructeur

JDatabaseDriverPdo::__construct (   $options)

Constructor.

Paramètres:
array$optionsList of options used to configure the connection
Depuis:
12.1

Réimplémentée à partir de JDatabaseDriver.

Réimplémentée dans JDatabaseDriverOracle.

Définition à la ligne 71 du fichier pdo.php.

{
// Get some basic values from the options.
$options['driver'] = (isset($options['driver'])) ? $options['driver'] : 'odbc';
$options['dsn'] = (isset($options['dsn'])) ? $options['dsn'] : '';
$options['host'] = (isset($options['host'])) ? $options['host'] : 'localhost';
$options['database'] = (isset($options['database'])) ? $options['database'] : '';
$options['user'] = (isset($options['user'])) ? $options['user'] : '';
$options['password'] = (isset($options['password'])) ? $options['password'] : '';
$options['driverOptions'] = (isset($options['driverOptions'])) ? $options['driverOptions'] : array();
// Finalize initialisation
}
JDatabaseDriverPdo::__destruct ( )

Destructor.

Depuis:
12.1

Réimplémentée dans JDatabaseDriverOracle, et JDatabaseDriverSqlite.

Définition à la ligne 91 du fichier pdo.php.

{
$this->disconnect();
}

Documentation des fonctions membres

JDatabaseDriverPdo::__sleep ( )

PDO does not support serialize

Renvoie:
array
Depuis:
12.3

Définition à la ligne 985 du fichier pdo.php.

{
$serializedProperties = array();
$reflect = new ReflectionClass($this);
// Get properties of the current class
$properties = $reflect->getProperties();
foreach ($properties as $property)
{
// Do not serialize properties that are PDO
if ($property->isStatic() == false && !($this->{$property->name} instanceof PDO))
{
array_push($serializedProperties, $property->name);
}
}
return $serializedProperties;
}
JDatabaseDriverPdo::__wakeup ( )

Wake up after serialization

Renvoie:
array
Depuis:
12.3

Définition à la ligne 1013 du fichier pdo.php.

{
// Get connection back
$this->__construct($this->options);
}
JDatabaseDriverPdo::connect ( )

Connects to the database if needed.

Renvoie:
void Returns void if the database connected successfully.
Depuis:
12.1
Exceptions:
RuntimeException

Réimplémentée à partir de JDatabaseDriver.

Réimplémentée dans JDatabaseDriverOracle.

Définition à la ligne 104 du fichier pdo.php.

{
if ($this->connection)
{
return;
}
// Make sure the PDO extension for PHP is installed and enabled.
if (!self::isSupported())
{
throw new RuntimeException('PDO Extension is not available.', 1);
}
$replace = array();
$with = array();
// Find the correct PDO DSN Format to use:
switch ($this->options['driver'])
{
case 'cubrid':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 33000;
$format = 'cubrid:host=#HOST#;port=#PORT#;dbname=#DBNAME#';
$replace = array('#HOST#', '#PORT#', '#DBNAME#');
$with = array($this->options['host'], $this->options['port'], $this->options['database']);
break;
case 'dblib':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 1433;
$format = 'dblib:host=#HOST#;port=#PORT#;dbname=#DBNAME#';
$replace = array('#HOST#', '#PORT#', '#DBNAME#');
$with = array($this->options['host'], $this->options['port'], $this->options['database']);
break;
case 'firebird':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 3050;
$format = 'firebird:dbname=#DBNAME#';
$replace = array('#DBNAME#');
$with = array($this->options['database']);
break;
case 'ibm':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 56789;
if (!empty($this->options['dsn']))
{
$format = 'ibm:DSN=#DSN#';
$replace = array('#DSN#');
$with = array($this->options['dsn']);
}
else
{
$format = 'ibm:hostname=#HOST#;port=#PORT#;database=#DBNAME#';
$replace = array('#HOST#', '#PORT#', '#DBNAME#');
$with = array($this->options['host'], $this->options['port'], $this->options['database']);
}
break;
case 'informix':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 1526;
$this->options['protocol'] = (isset($this->options['protocol'])) ? $this->options['protocol'] : 'onsoctcp';
if (!empty($this->options['dsn']))
{
$format = 'informix:DSN=#DSN#';
$replace = array('#DSN#');
$with = array($this->options['dsn']);
}
else
{
$format = 'informix:host=#HOST#;service=#PORT#;database=#DBNAME#;server=#SERVER#;protocol=#PROTOCOL#';
$replace = array('#HOST#', '#PORT#', '#DBNAME#', '#SERVER#', '#PROTOCOL#');
$with = array($this->options['host'], $this->options['port'], $this->options['database'], $this->options['server'], $this->options['protocol']);
}
break;
case 'mssql':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 1433;
$format = 'mssql:host=#HOST#;port=#PORT#;dbname=#DBNAME#';
$replace = array('#HOST#', '#PORT#', '#DBNAME#');
$with = array($this->options['host'], $this->options['port'], $this->options['database']);
break;
case 'mysql':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 3306;
$format = 'mysql:host=#HOST#;port=#PORT#;dbname=#DBNAME#';
$replace = array('#HOST#', '#PORT#', '#DBNAME#');
$with = array($this->options['host'], $this->options['port'], $this->options['database']);
break;
case 'oci':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 1521;
$this->options['charset'] = (isset($this->options['charset'])) ? $this->options['charset'] : 'AL32UTF8';
if (!empty($this->options['dsn']))
{
$format = 'oci:dbname=#DSN#';
$replace = array('#DSN#');
$with = array($this->options['dsn']);
}
else
{
$format = 'oci:dbname=//#HOST#:#PORT#/#DBNAME#';
$replace = array('#HOST#', '#PORT#', '#DBNAME#');
$with = array($this->options['host'], $this->options['port'], $this->options['database']);
}
$format .= ';charset=' . $this->options['charset'];
break;
case 'odbc':
$format = 'odbc:DSN=#DSN#;UID:#USER#;PWD=#PASSWORD#';
$replace = array('#DSN#', '#USER#', '#PASSWORD#');
$with = array($this->options['dsn'], $this->options['user'], $this->options['password']);
break;
case 'pgsql':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 5432;
$format = 'pgsql:host=#HOST#;port=#PORT#;dbname=#DBNAME#';
$replace = array('#HOST#', '#PORT#', '#DBNAME#');
$with = array($this->options['host'], $this->options['port'], $this->options['database']);
break;
case 'sqlite':
if (isset($this->options['version']) && $this->options['version'] == 2)
{
$format = 'sqlite2:#DBNAME#';
}
else
{
$format = 'sqlite:#DBNAME#';
}
$replace = array('#DBNAME#');
$with = array($this->options['database']);
break;
case 'sybase':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 1433;
$format = 'mssql:host=#HOST#;port=#PORT#;dbname=#DBNAME#';
$replace = array('#HOST#', '#PORT#', '#DBNAME#');
$with = array($this->options['host'], $this->options['port'], $this->options['database']);
break;
}
// Create the connection string:
$connectionString = str_replace($replace, $with, $format);
try
{
$this->connection = new PDO(
$connectionString,
$this->options['user'],
$this->options['password'],
$this->options['driverOptions']
);
}
catch (PDOException $e)
{
throw new RuntimeException('Could not connect to PDO: ' . $e->getMessage(), 2, $e);
}
}
JDatabaseDriverPdo::connected ( )

Determines if the connection to the server is active.

Renvoie:
boolean True if connected to the database engine.
Depuis:
12.1

Réimplémentée à partir de JDatabaseDriver.

Définition à la ligne 547 du fichier pdo.php.

{
// Flag to prevent recursion into this function.
static $checkingConnected = false;
if ($checkingConnected)
{
// Reset this flag and throw an exception.
$checkingConnected = true;
die('Recursion trying to check if connected.');
}
// Backup the query state.
$query = $this->sql;
try
{
// Set the checking connection flag.
$checkingConnected = true;
// Run a simple query to check the connection.
$this->setQuery($this->getConnectedQuery());
$status = (bool) $this->loadResult();
}
// If we catch an exception here, we must not be connected.
catch (Exception $e)
{
$status = false;
}
// Restore the query state.
$this->sql = $query;
$this->limit = $limit;
$this->offset = $offset;
$this->prepared = $prepared;
$checkingConnected = false;
return $status;
}
JDatabaseDriverPdo::disconnect ( )

Disconnects the database.

Renvoie:
void
Depuis:
12.1

Réimplémentée à partir de JDatabaseDriver.

Réimplémentée dans JDatabaseDriverOracle, et JDatabaseDriverSqlite.

Définition à la ligne 307 du fichier pdo.php.

{
foreach ($this->disconnectHandlers as $h)
{
call_user_func_array($h, array( &$this));
}
$this->freeResult();
unset($this->connection);
}
JDatabaseDriverPdo::escape (   $text,
  $extra = false 
)

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.

Paramètres:
string$textThe string to be escaped.
boolean$extraUnused optional parameter to provide extra escaping.
Renvoie:
string The escaped string.
Depuis:
12.1

Réimplémentée à partir de JDatabaseDriver.

Réimplémentée dans JDatabaseDriverSqlite.

Définition à la ligne 339 du fichier pdo.php.

{
if (is_int($text) || is_float($text))
{
return $text;
}
$text = str_replace("'", "''", $text);
return addcslashes($text, "\000\n\r\\\032");
}
JDatabaseDriverPdo::execute ( )

Execute the SQL statement.

Renvoie:
mixed A database cursor resource on success, boolean false on failure.
Depuis:
12.1
Exceptions:
RuntimeException
Exception

Réimplémentée à partir de JDatabaseDriver.

Définition à la ligne 360 du fichier pdo.php.

Références JLog\add(), JLog\DEBUG, JLog\ERROR, et JText\sprintf().

{
$this->connect();
if (!is_object($this->connection))
{
JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'database');
throw new RuntimeException($this->errorMsg, $this->errorNum);
}
// Take a local copy so that we don't modify the original query and cause issues later
$query = $this->replacePrefix((string) $this->sql);
if (!($this->sql instanceof JDatabaseQuery) && ($this->limit > 0 || $this->offset > 0))
{
// @TODO
$query .= ' LIMIT ' . $this->offset . ', ' . $this->limit;
}
// Increment the query counter.
$this->count++;
// Reset the error values.
$this->errorNum = 0;
$this->errorMsg = '';
// If debugging is enabled then let's log the query.
if ($this->debug)
{
// Add the query to the object queue.
$this->log[] = $query;
JLog::add($query, JLog::DEBUG, 'databasequery');
$this->timings[] = microtime(true);
}
// Execute the query.
$this->executed = false;
if ($this->prepared instanceof PDOStatement)
{
// Bind the variables:
if ($this->sql instanceof JDatabaseQueryPreparable)
{
$bounded =& $this->sql->getBounded();
foreach ($bounded as $key => $obj)
{
$this->prepared->bindParam($key, $obj->value, $obj->dataType, $obj->length, $obj->driverOptions);
}
}
$this->executed = $this->prepared->execute();
}
if ($this->debug)
{
$this->timings[] = microtime(true);
if (defined('DEBUG_BACKTRACE_IGNORE_ARGS'))
{
$this->callStacks[] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
}
else
{
$this->callStacks[] = debug_backtrace();
}
}
// If an error occurred handle it.
if (!$this->executed)
{
// Get the error number and message before we execute any more queries.
$errorNum = (int) $this->connection->errorCode();
$errorMsg = (string) 'SQL: ' . implode(", ", $this->connection->errorInfo());
// Check if the server was disconnected.
if (!$this->connected())
{
try
{
// Attempt to reconnect.
$this->connection = null;
$this->connect();
}
// If connect fails, ignore that exception and throw the normal exception.
catch (RuntimeException $e)
{
// Get the error number and message.
$this->errorNum = (int) $this->connection->errorCode();
$this->errorMsg = (string) 'SQL: ' . implode(", ", $this->connection->errorInfo());
// Throw the normal query exception.
JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'databasequery');
throw new RuntimeException($this->errorMsg, $this->errorNum);
}
// Since we were able to reconnect, run the query again.
return $this->execute();
}
// The server was not disconnected.
else
{
// Get the error number and message from before we tried to reconnect.
$this->errorNum = $errorNum;
$this->errorMsg = $errorMsg;
// Throw the normal query exception.
JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'databasequery');
throw new RuntimeException($this->errorMsg, $this->errorNum);
}
}
}

+ Voici le graphe d'appel pour cette fonction :

JDatabaseDriverPdo::fetchArray (   $cursor = null)
protected

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

Paramètres:
mixed$cursorThe optional result set cursor from which to fetch the row.
Renvoie:
mixed Either the next row from the result set or false if there are no more rows.
Depuis:
12.1

Réimplémentée à partir de JDatabaseDriver.

Définition à la ligne 797 du fichier pdo.php.

{
if (!empty($cursor) && $cursor instanceof PDOStatement)
{
return $cursor->fetch(PDO::FETCH_NUM);
}
if ($this->prepared instanceof PDOStatement)
{
return $this->prepared->fetch(PDO::FETCH_NUM);
}
}
JDatabaseDriverPdo::fetchAssoc (   $cursor = null)
protected

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

Paramètres:
mixed$cursorThe optional result set cursor from which to fetch the row.
Renvoie:
mixed Either the next row from the result set or false if there are no more rows.
Depuis:
12.1

Réimplémentée à partir de JDatabaseDriver.

Définition à la ligne 818 du fichier pdo.php.

{
if (!empty($cursor) && $cursor instanceof PDOStatement)
{
return $cursor->fetch(PDO::FETCH_ASSOC);
}
if ($this->prepared instanceof PDOStatement)
{
return $this->prepared->fetch(PDO::FETCH_ASSOC);
}
}
JDatabaseDriverPdo::fetchObject (   $cursor = null,
  $class = 'stdClass' 
)
protected

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

Paramètres:
mixed$cursorThe optional result set cursor from which to fetch the row.
string$classUnused, only necessary so method signature will be the same as parent.
Renvoie:
mixed Either the next row from the result set or false if there are no more rows.
Depuis:
12.1

Réimplémentée à partir de JDatabaseDriver.

Définition à la ligne 840 du fichier pdo.php.

{
if (!empty($cursor) && $cursor instanceof PDOStatement)
{
return $cursor->fetchObject($class);
}
if ($this->prepared instanceof PDOStatement)
{
return $this->prepared->fetchObject($class);
}
}
JDatabaseDriverPdo::freeResult (   $cursor = null)
protected

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

Paramètres:
mixed$cursorThe optional result set cursor from which to fetch the row.
Renvoie:
void
Depuis:
12.1

Réimplémentée à partir de JDatabaseDriver.

Définition à la ligne 861 du fichier pdo.php.

{
$this->executed = false;
if ($cursor instanceof PDOStatement)
{
$cursor->closeCursor();
$cursor = null;
}
if ($this->prepared instanceof PDOStatement)
{
$this->prepared->closeCursor();
$this->prepared = null;
}
}
JDatabaseDriverPdo::getAffectedRows ( )

Get the number of affected rows for the previous executed SQL statement. Only applicable for DELETE, INSERT, or UPDATE statements.

Renvoie:
integer The number of affected rows.
Depuis:
12.1

Réimplémentée à partir de JDatabaseDriver.

Définition à la ligne 598 du fichier pdo.php.

{
$this->connect();
if ($this->prepared instanceof PDOStatement)
{
return $this->prepared->rowCount();
}
else
{
return 0;
}
}
JDatabaseDriverPdo::getConnectedQuery ( )

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

Renvoie:
string The query to check the health of the DB.
Depuis:
12.2

Réimplémentée dans JDatabaseDriverOracle.

Définition à la ligne 500 du fichier pdo.php.

{
return 'SELECT 1';
}
JDatabaseDriverPdo::getNumRows (   $cursor = null)

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

Paramètres:
resource$cursorAn optional database cursor resource to extract the row count from.
Renvoie:
integer The number of returned rows.
Depuis:
12.1

Réimplémentée à partir de JDatabaseDriver.

Définition à la ligne 621 du fichier pdo.php.

{
$this->connect();
if ($cursor instanceof PDOStatement)
{
return $cursor->rowCount();
}
elseif ($this->prepared instanceof PDOStatement)
{
return $this->prepared->rowCount();
}
else
{
return 0;
}
}
JDatabaseDriverPdo::getOption (   $key)

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

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

Paramètres:
mixed$keyOne of the PDO::ATTR_* Constants
Renvoie:
mixed
Depuis:
12.1

Définition à la ligne 486 du fichier pdo.php.

{
$this->connect();
return $this->connection->getAttribute($key);
}
JDatabaseDriverPdo::insertid ( )

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

Renvoie:
string The value of the auto-increment field from the last inserted row.
Depuis:
12.1

Réimplémentée à partir de JDatabaseDriver.

Définition à la ligne 646 du fichier pdo.php.

{
$this->connect();
// Error suppress this to prevent PDO warning us that the driver doesn't support this operation.
return @$this->connection->lastInsertId();
}
static JDatabaseDriverPdo::isSupported ( )
static

Test to see if the PDO extension is available. Override as needed to check for specific PDO Drivers.

Renvoie:
boolean True on success, false otherwise.
Depuis:
12.1

Implémente JDatabaseInterface.

Réimplémentée dans JDatabaseDriverOracle, et JDatabaseDriverSqlite.

Définition à la ligne 535 du fichier pdo.php.

{
return defined('PDO::ATTR_DRIVER_NAME');
}
JDatabaseDriverPdo::loadNextAssoc ( )

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

Renvoie:
mixed The result of the query as an array, false if there are no more rows.
Depuis:
12.1
Exceptions:
RuntimeException

Définition à la ligne 920 du fichier pdo.php.

{
$this->connect();
// Execute the query and get the result set cursor.
if (!$this->executed)
{
if (!($this->execute()))
{
return $this->errorNum ? null : false;
}
}
// Get the next row from the result set as an object of type $class.
if ($row = $this->fetchAssoc())
{
return $row;
}
// Free up system resources and return.
$this->freeResult();
return false;
}
JDatabaseDriverPdo::loadNextObject (   $class = 'stdClass')

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

Paramètres:
string$classThe class name to use for the returned row object.
Renvoie:
mixed The result of the query as an array, false if there are no more rows.
Depuis:
12.1
Exceptions:
RuntimeException

Réimplémentée à partir de JDatabaseDriver.

Définition à la ligne 887 du fichier pdo.php.

{
$this->connect();
// Execute the query and get the result set cursor.
if (!$this->executed)
{
if (!($this->execute()))
{
return $this->errorNum ? null : false;
}
}
// Get the next row from the result set as an object of type $class.
if ($row = $this->fetchObject(null, $class))
{
return $row;
}
// Free up system resources and return.
$this->freeResult();
return false;
}
JDatabaseDriverPdo::loadNextRow ( )

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

Renvoie:
mixed The result of the query as an array, false if there are no more rows.
Depuis:
12.1
Exceptions:
RuntimeException

Réimplémentée à partir de JDatabaseDriver.

Définition à la ligne 953 du fichier pdo.php.

{
$this->connect();
// Execute the query and get the result set cursor.
if (!$this->executed)
{
if (!($this->execute()))
{
return $this->errorNum ? null : false;
}
}
// Get the next row from the result set as an object of type $class.
if ($row = $this->fetchArray())
{
return $row;
}
// Free up system resources and return.
$this->freeResult();
return false;
}
JDatabaseDriverPdo::select (   $database)

Select a database for use.

Paramètres:
string$databaseThe name of the database to select for use.
Renvoie:
boolean True if the database was successfully selected.
Depuis:
12.1
Exceptions:
RuntimeException

Réimplémentée à partir de JDatabaseDriver.

Réimplémentée dans JDatabaseDriverOracle, et JDatabaseDriverSqlite.

Définition à la ligne 664 du fichier pdo.php.

{
$this->connect();
return true;
}
JDatabaseDriverPdo::setOption (   $key,
  $value 
)

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);

Paramètres:
integer$keyOne of the PDO::ATTR_* Constants
mixed$valueOne of the associated PDO Constants related to the particular attribute key.
Renvoie:
boolean
Depuis:
12.1

Définition à la ligne 520 du fichier pdo.php.

{
$this->connect();
return $this->connection->setAttribute($key, $value);
}
JDatabaseDriverPdo::setQuery (   $query,
  $offset = null,
  $limit = null,
  $driverOptions = array() 
)

Sets the SQL statement string for later execution.

Paramètres:
mixed$queryThe SQL statement to set either as a JDatabaseQuery object or a string.
integer$offsetThe affected row offset to set.
integer$limitThe maximum affected rows to set.
array$driverOptionsThe optional PDO driver options
Renvoie:
JDatabaseDriver This object to support method chaining.
Depuis:
12.1

Définition à la ligne 683 du fichier pdo.php.

{
$this->connect();
$this->freeResult();
if (is_string($query))
{
// Allows taking advantage of bound variables in a direct query:
$query = $this->getQuery(true)->setQuery($query);
}
if ($query instanceof JDatabaseQueryLimitable && !is_null($offset) && !is_null($limit))
{
$query->setLimit($limit, $offset);
}
$query = $this->replacePrefix((string) $query);
$this->prepared = $this->connection->prepare($query, $driverOptions);
// Store reference to the JDatabaseQuery instance:
return $this;
}
JDatabaseDriverPdo::setUTF ( )

Set the connection to use UTF-8 character encoding.

Renvoie:
boolean True on success.
Depuis:
12.1

Réimplémentée à partir de JDatabaseDriver.

Réimplémentée dans JDatabaseDriverOracle, et JDatabaseDriverSqlite.

Définition à la ligne 717 du fichier pdo.php.

{
return false;
}
JDatabaseDriverPdo::transactionCommit (   $toSavepoint = false)

Method to commit a transaction.

Paramètres:
boolean$toSavepointIf true, commit to the last savepoint.
Renvoie:
void
Depuis:
12.1
Exceptions:
RuntimeException

Réimplémentée à partir de JDatabaseDriver.

Réimplémentée dans JDatabaseDriverOracle, et JDatabaseDriverSqlite.

Définition à la ligne 732 du fichier pdo.php.

{
$this->connect();
if (!$toSavepoint || $this->transactionDepth == 1)
{
$this->connection->commit();
}
$this->transactionDepth--;
}
JDatabaseDriverPdo::transactionRollback (   $toSavepoint = false)

Method to roll back a transaction.

Paramètres:
boolean$toSavepointIf true, rollback to the last savepoint.
Renvoie:
void
Depuis:
12.1
Exceptions:
RuntimeException

Réimplémentée à partir de JDatabaseDriver.

Réimplémentée dans JDatabaseDriverOracle, et JDatabaseDriverSqlite.

Définition à la ligne 754 du fichier pdo.php.

{
$this->connect();
if (!$toSavepoint || $this->transactionDepth == 1)
{
$this->connection->rollBack();
}
$this->transactionDepth--;
}
JDatabaseDriverPdo::transactionStart (   $asSavepoint = false)

Method to initialize a transaction.

Paramètres:
boolean$asSavepointIf true and a transaction is already active, a savepoint will be created.
Renvoie:
void
Depuis:
12.1
Exceptions:
RuntimeException

Réimplémentée à partir de JDatabaseDriver.

Réimplémentée dans JDatabaseDriverOracle, et JDatabaseDriverSqlite.

Définition à la ligne 776 du fichier pdo.php.

{
$this->connect();
if (!$asSavepoint || !$this->transactionDepth)
{
$this->connection->beginTransaction();
}
$this->transactionDepth++;
}

Documentation des données membres

JDatabaseDriverPdo::$executed = false
protected

Définition à la ligne 62 du fichier pdo.php.

JDatabaseDriverPdo::$name = 'pdo'

Réimplémentée à partir de JDatabaseDriver.

Réimplémentée dans JDatabaseDriverOracle, et JDatabaseDriverSqlite.

Définition à la ligne 28 du fichier pdo.php.

JDatabaseDriverPdo::$nameQuote = "'"
protected

Réimplémentée à partir de JDatabaseDriver.

Réimplémentée dans JDatabaseDriverOracle, et JDatabaseDriverSqlite.

Définition à la ligne 39 du fichier pdo.php.

JDatabaseDriverPdo::$nullDate = '0000-00-00 00:00:00'
protected

Réimplémentée à partir de JDatabaseDriver.

Définition à la ligne 48 du fichier pdo.php.

JDatabaseDriverPdo::$prepared
protected

Définition à la ligne 54 du fichier pdo.php.


La documentation de cette classe a été générée à partir du fichier suivant :