Joomla CMS  3.8.5 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.8.5 et du framework Joomla Platform intégré
Référence de la classe JDatabaseDriver
+ Graphe d'héritage de JDatabaseDriver:

Fonctions membres publiques

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

Fonctions membres publiques statiques

static getConnectors ()
 
static getInstance ($options=array())
 
static splitSql ($sql)
 
- Fonctions membres publiques statiques hérités de JDatabase
static getConnectors ()
 
static getInstance ($options=array())
 
static splitSql ($query)
 
static test ()
 
- Fonctions membres publiques statiques hérités de JDatabaseInterface
static isSupported ()
 

Champs de données

 $name
 
 $serverType
 

Fonctions membres protégées

 fetchArray ($cursor=null)
 
 fetchAssoc ($cursor=null)
 
 fetchObject ($cursor=null, $class='stdClass')
 
 freeResult ($cursor=null)
 
 getCreateDatabaseQuery ($options, $utf)
 
 getDatabase ()
 
 quoteNameStr ($strArr)
 

Attributs protégés

 $connection
 
 $count = 0
 
 $cursor
 
 $debug = false
 
 $limit = 0
 
 $log = array()
 
 $timings = array()
 
 $callStacks = array()
 
 $nameQuote
 
 $nullDate
 
 $offset = 0
 
 $options
 
 $sql
 
 $tablePrefix
 
 $utf = true
 
 $utf8mb4 = false
 
 $errorNum = 0
 
 $errorMsg
 
 $transactionDepth = 0
 
 $disconnectHandlers = array()
 

Attributs protégés statiques

static $instances = array()
 
static $dbMinimum
 

Attributs privés

 $_database
 

Description détaillée

Joomla Platform Database Driver Class

Depuis
12.1

string|array q() q($text, $escape = true) Alias for quote method string|array qn() qn($name, $as = null) Alias for quoteName method

Documentation des constructeurs et destructeur

◆ __construct()

__construct (   $options)

Constructor.

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

Références $options.

◆ __destruct()

__destruct ( )

Destructor.

Depuis
3.8.0

Documentation des fonctions membres

◆ __call()

__call (   $method,
  $args 
)

Magic method to provide method alias support for quote() and quoteName().

Paramètres
string$methodThe called method.
array$argsThe array of arguments passed to the method.
Renvoie
mixed The aliased method's return value or null.
Depuis
11.1

Références null.

◆ addDisconnectHandler()

addDisconnectHandler (   $callable)

Adds a function callable just before disconnecting the database. Parameter of the callable is $this JDatabaseDriver

Paramètres
callable$callableFunction to call in disconnect() method just before disconnecting from database
Renvoie
void
Depuis
CMS 3.1.2

◆ alterDbCharacterSet()

alterDbCharacterSet (   $dbName)

Alter database's character set, obtaining query string from protected member.

Paramètres
string$dbNameThe database name that will be altered
Renvoie
string The query that alter the database query string
Depuis
12.2
Exceptions
RuntimeException

◆ alterTableCharacterSet()

alterTableCharacterSet (   $tableName,
  $rethrow = false 
)

Alter a table's character set, obtaining an array of queries to do so from a protected method. The conversion is wrapped in a transaction, if supported by the database driver. Otherwise the table will be locked before the conversion. This prevents data corruption.

Paramètres
string$tableNameThe name of the table to alter
boolean$rethrowTrue to rethrow database exceptions. Default: false (exceptions are suppressed)
Renvoie
boolean True if successful
Depuis
CMS 3.5.0
Exceptions
RuntimeExceptionIf the table name is empty
ExceptionRelayed from the database layer if a database error occurs and $rethrow == true

Références $query.

◆ connect()

connect ( )
abstract

Connects to the database if needed.

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

◆ connected()

connected ( )
abstract

Determines if the connection to the server is active.

Renvoie
boolean True if connected to the database engine.
Depuis
11.1

◆ convertUtf8mb4QueryToUtf8()

convertUtf8mb4QueryToUtf8 (   $query)

Automatically downgrade a CREATE TABLE or ALTER TABLE query from utf8mb4 (UTF-8 Multibyte) to plain utf8. Used when the server doesn't support UTF-8 Multibyte.

Paramètres
string$queryThe query to convert
Renvoie
string The converted query

Références $query.

◆ createDatabase()

createDatabase (   $options,
  $utf = true 
)

Create a new database using information from $options object, obtaining query string from protected member.

Paramètres
stdClass$optionsObject used to pass user and database name to database driver. This object must have "db_name" and "db_user" set.
boolean$utfTrue if the database supports the UTF-8 character set.
Renvoie
string The query that creates database
Depuis
12.2
Exceptions
RuntimeException

Références $options, et elseif.

◆ disconnect()

disconnect ( )
abstract

Disconnects the database.

Renvoie
void
Depuis
12.1

◆ dropTable()

dropTable (   $table,
  $ifExists = true 
)
abstract

Drops a table from the database.

Paramètres
string$tableThe name of the database table to drop.
boolean$ifExistsOptionally specify that the table must exist before it is dropped.
Renvoie
JDatabaseDriver Returns this object to support chaining.
Depuis
11.4
Exceptions
RuntimeException

◆ escape()

escape (   $text,
  $extra = false 
)
abstract

Escapes a string for usage in an SQL statement.

Paramètres
string$textThe string to be escaped.
boolean$extraOptional parameter to provide extra escaping.
Renvoie
string The escaped string.
Depuis
11.1

◆ execute()

JDatabaseQuery string The current SQL statement to execute ( )
abstract

Execute the SQL statement.

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

◆ fetchArray()

fetchArray (   $cursor = null)
abstractprotected

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
11.1

◆ fetchAssoc()

fetchAssoc (   $cursor = null)
abstractprotected

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
11.1

◆ fetchObject()

fetchObject (   $cursor = null,
  $class = 'stdClass' 
)
abstractprotected

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$classThe class name to use for the returned row object.
Renvoie
mixed Either the next row from the result set or false if there are no more rows.
Depuis
11.1

◆ freeResult()

freeResult (   $cursor = null)
abstractprotected

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
11.1

◆ getAffectedRows()

getAffectedRows ( )
abstract

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

Renvoie
integer The number of affected rows.
Depuis
11.1

◆ getAlterDbCharacterSet()

getAlterDbCharacterSet (   $dbName)

Return the query string to alter the database character set.

Paramètres
string$dbNameThe database name
Renvoie
string The query that alter the database query string
Depuis
12.2

◆ getAlterTableCharacterSet()

getAlterTableCharacterSet (   $tableName)

Get the query strings to alter the character set and collation of a table.

Paramètres
string$tableNameThe name of the table
Renvoie
string[] The queries required to alter the table's character set and collation
Depuis
CMS 3.5.0

We also need to convert each text column, modifying their character set and collation. This allows us to change, for example, a utf8_bin collated column to a utf8mb4_bin collated column.

If the collation is in the form charset_collationType_ci or charset_collationType we have to change the charset but leave the collationType intact (e.g. utf8_bin must become utf8mb4_bin, NOT utf8mb4_general_ci).

When the last part of the old collation is not _ci we have a charset_collationType format, something like utf8_bin. Therefore the new collation only has two parts.

Références $columns, et $default.

◆ getCallStacks()

getCallStacks ( )

Get the database driver SQL statement log.

Renvoie
array SQL statements executed by the database driver.
Depuis
CMS 3.1.2

◆ getCollation()

getCollation ( )
abstract

Method to get the database collation in use by sampling a text field of a table in the database.

Renvoie
mixed The collation in use by the database or boolean false if not supported.
Depuis
11.1

◆ getConnection()

getConnection ( )

Method that provides access to the underlying database connection. Useful for when you need to call a proprietary method such as postgresql's lo_* methods.

Renvoie
resource The underlying database connection resource.
Depuis
11.1

◆ getConnectionCollation()

getConnectionCollation ( )

Method to get the database connection collation, as reported by the driver. If the connector doesn't support reporting this value please return an empty string.

Renvoie
string

◆ getConnectors()

static getConnectors ( )
static

Get a list of available database connectors. The list will only be populated with connectors that both the class exists and the static test method returns true. This gives us the ability to have a multitude of connector classes that are self-aware as to whether or not they are able to be used on a given system.

Renvoie
array An array of available database connectors.
Depuis
11.1

Références $class, et $file.

Référencé par JDatabase\getConnectors(), JFormFieldDatabaseConnection\getOptions(), et InstallationModelSetup\getPhpOptions().

◆ getCount()

getCount ( )

Get the total number of SQL statements executed by the database driver.

Renvoie
integer
Depuis
11.1

Références $count.

◆ getCreateDatabaseQuery()

getCreateDatabaseQuery (   $options,
  $utf 
)
protected

Return the query string to create new Database. Each database driver, other than MySQL, need to override this member to return correct string.

Paramètres
stdClass$optionsObject used to pass user and database name to database driver. This object must have "db_name" and "db_user" set.
boolean$utfTrue if the database supports the UTF-8 character set.
Renvoie
string The query that creates database
Depuis
12.2

Références $options.

◆ getDatabase()

getDatabase ( )
protected

Gets the name of the database used by this conneciton.

Renvoie
string
Depuis
11.4

◆ getDateFormat()

getDateFormat ( )

Returns a PHP date() function compliant date format for the database driver.

Renvoie
string The format string.
Depuis
11.1

◆ getExporter()

getExporter ( )

Gets an exporter class object.

Renvoie
JDatabaseExporter An exporter object.
Depuis
12.1
Exceptions
RuntimeException

Références $class, et name.

◆ getImporter()

getImporter ( )

Gets an importer class object.

Renvoie
JDatabaseImporter An importer object.
Depuis
12.1
Exceptions
RuntimeException

Références $class, et name.

◆ getInstance()

static getInstance (   $options = array())
static

Method to return a JDatabaseDriver instance based on the given options. There are three global options and then the rest are specific to the database driver. The 'driver' option defines which JDatabaseDriver class is used for the connection – the default is 'mysqli'. The 'database' option determines which database is to be used for the connection. The 'select' option determines whether the connector should automatically select the chosen database.

Instances are unique to the given options and new objects are only created when a unique options array is passed into the method. This ensures that we don't end up with unnecessary database connection resources.

Paramètres
array$optionsParameters to be passed to the database driver.
Renvoie
JDatabaseDriver A database object.
Depuis
11.1
Exceptions
RuntimeException

Références $class, $options, JDatabaseDriverPdomysql\isSupported(), JDatabaseDriverMysqli\isSupported(), et null.

Référencé par DatabaseLogger\connect(), InstallationModelDatabase\createDatabase(), Factory\createDbo(), InstallationHelperDatabase\getDbo(), JDatabase\getInstance(), et ConfigModelApplication\save().

◆ getIterator()

getIterator (   $column = null,
  $class = 'stdClass' 
)

Get a new iterator on the current query.

Paramètres
string$columnAn option column to use as the iterator key.
string$classThe class of object that is returned.
Renvoie
JDatabaseIterator A new database iterator.
Depuis
12.1
Exceptions
RuntimeException

Références $class, et name.

◆ getLog()

getLog ( )

Get the database driver SQL statement log.

Renvoie
array SQL statements executed by the database driver.
Depuis
11.1

◆ getMinimum()

getMinimum ( )

Get the minimum supported database version.

Renvoie
string The minimum version number for the database driver.
Depuis
12.1

◆ getName()

getName ( )

Get the name of the database driver. If $this->name is not set it will try guessing the driver name from the class name.

Renvoie
string
Depuis
CMS 3.5.0

Références $className, $name, et name.

◆ getNullDate()

getNullDate ( )

Get the null or zero representation of a timestamp for the database driver.

Renvoie
string Null or zero representation of a timestamp.
Depuis
11.1

◆ getNumRows()

getNumRows (   $cursor = null)
abstract

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
11.1

◆ getPrefix()

getPrefix ( )

Get the common table prefix for the database driver.

Renvoie
string The common database table prefix.
Depuis
11.1

◆ getQuery()

getQuery (   $new = false)

Get the current query object or a new JDatabaseQuery object.

Paramètres
boolean$newFalse to return the current query object, True to return a new JDatabaseQuery object.
Renvoie
JDatabaseQuery The current query object or a new object extending the JDatabaseQuery class.
Depuis
11.1
Exceptions
RuntimeException

Références $class, et name.

◆ getServerType()

getServerType ( )

Get the server family type, e.g. mysql, postgresql, oracle, sqlite, mssql. If $this->serverType is not set it will attempt guessing the server family type from the driver name. If this is not possible the driver name will be returned instead.

Renvoie
string
Depuis
CMS 3.5.0

Références $name, et elseif.

◆ getTableColumns()

getTableColumns (   $table,
  $typeOnly = true 
)
abstract

Retrieves field information about the given tables.

Paramètres
string$tableThe name of the database table.
boolean$typeOnlyTrue (default) to only return field types.
Renvoie
array An array of fields by table.
Depuis
11.1
Exceptions
RuntimeException

◆ getTableCreate()

getTableCreate (   $tables)
abstract

Shows the table CREATE statement that creates the given tables.

Paramètres
mixed$tablesA table name or a list of table names.
Renvoie
array A list of the create SQL for the tables.
Depuis
11.1
Exceptions
RuntimeException

◆ getTableKeys()

getTableKeys (   $table)
abstract

Retrieves keys information about the given table.

Paramètres
string$tableThe name of the table.
Renvoie
array An array of keys for the table.
Depuis
11.1
Exceptions
RuntimeException

◆ getTableList()

getTableList ( )
abstract

Method to get an array of all tables in the database.

Renvoie
array An array of all the tables in the database.
Depuis
11.1
Exceptions
RuntimeException

◆ getTimings()

getTimings ( )

Get the database driver SQL statement log.

Renvoie
array SQL statements executed by the database driver.
Depuis
CMS 3.1.2

◆ getUTFSupport()

getUTFSupport ( )

Determine whether or not the database engine supports UTF-8 character encoding.

Renvoie
boolean True if the database engine supports UTF-8 character encoding.
Depuis
11.1
Obsolète:
12.3 (Platform) & 4.0 (CMS) - Use hasUTFSupport() instead

◆ getVersion()

getVersion ( )
abstract

Get the version of the database connector

Renvoie
string The database connector version.
Depuis
11.1

◆ hasUTF8mb4Support()

hasUTF8mb4Support ( )

Determine whether the database engine support the UTF-8 Multibyte (utf8mb4) character encoding. This applies to MySQL databases.

Renvoie
boolean True if the database engine supports UTF-8 Multibyte.
Depuis
CMS 3.5.0

◆ hasUTFSupport()

hasUTFSupport ( )

Determine whether or not the database engine supports UTF-8 character encoding.

Renvoie
boolean True if the database engine supports UTF-8 character encoding.
Depuis
12.1

◆ insertid()

insertid ( )
abstract

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

Renvoie
mixed The value of the auto-increment field from the last inserted row.
Depuis
11.1

◆ insertObject()

insertObject (   $table,
$object,
  $key = null 
)

Inserts a row into a table based on an object's properties.

Paramètres
string$tableThe name of the database table to insert into.
object&$objectA reference to an object whose public properties match the table fields.
string$keyThe name of the primary key. If provided the object property is updated.
Renvoie
boolean True on success.
Depuis
11.1
Exceptions
RuntimeException

Références $fields, $id, $key, $query, et null.

◆ isMinimumVersion()

isMinimumVersion ( )

Method to check whether the installed database version is supported by the database driver

Renvoie
boolean True if the database version is supported
Depuis
12.1

◆ loadAssoc()

loadAssoc ( )

Method to get the first row of the result set from the database query as an associative array of ['field_name' => 'row_value'].

Renvoie
mixed The return value or null if the query failed.
Depuis
11.1
Exceptions
RuntimeException

Références null.

◆ loadAssocList()

loadAssocList (   $key = null,
  $column = null 
)

Method to get an array of the result set rows from the database query where each row is an associative array of ['field_name' => 'row_value']. The array of rows can optionally be keyed by a field name, but defaults to a sequential numeric array.

NOTE: Chosing to key the result array by a non-unique field name can result in unwanted behavior and should be avoided.

Paramètres
string$keyThe name of a field on which to key the result array.
string$columnAn optional column name. Instead of the whole row, only this column value will be in the result array.
Renvoie
mixed The return value or null if the query failed.
Depuis
11.1
Exceptions
RuntimeException

Références $key, $row, et $value.

◆ loadColumn()

loadColumn (   $offset = 0)

Method to get an array of values from the $offset field in each row of the result set from the database query.

Paramètres
integer$offsetThe row offset to use to build the result array.
Renvoie
mixed The return value or null if the query failed.
Depuis
11.1
Exceptions
RuntimeException

Références $offset, et $row.

◆ loadNextObject()

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
11.1
Exceptions
RuntimeException
Obsolète:
12.3 (Platform) & 4.0 (CMS) - Use getIterator() instead

Références $class, $row, et null.

◆ loadNextRow()

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
11.1
Exceptions
RuntimeException
Obsolète:
4.0 (CMS) Use JDatabaseDriver::getIterator() instead

Références $row, et null.

◆ loadObject()

loadObject (   $class = 'stdClass')

Method to get the first row of 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 return value or null if the query failed.
Depuis
11.1
Exceptions
RuntimeException

Références $class, et null.

◆ loadObjectList()

loadObjectList (   $key = '',
  $class = 'stdClass' 
)

Method to get an array of the result set rows from the database query where each row is an object. The array of objects can optionally be keyed by a field name, but defaults to a sequential numeric array.

NOTE: Choosing to key the result array by a non-unique field name can result in unwanted behavior and should be avoided.

Paramètres
string$keyThe name of a field on which to key the result array.
string$classThe class name to use for the returned row objects.
Renvoie
mixed The return value or null if the query failed.
Depuis
11.1
Exceptions
RuntimeException

Références $class, $key, et $row.

◆ loadResult()

loadResult ( )

Method to get the first field of the first row of the result set from the database query.

Renvoie
mixed The return value or null if the query failed.
Depuis
11.1
Exceptions
RuntimeException

Références $row, et null.

◆ loadRow()

loadRow ( )

Method to get the first row of the result set from the database query as an array. Columns are indexed numerically so the first column in the result set would be accessible via $row[0], etc.

Renvoie
mixed The return value or null if the query failed.
Depuis
11.1
Exceptions
RuntimeException

Références $row, et null.

◆ loadRowList()

loadRowList (   $index = null)

Method to get an array of the result set rows from the database query where each row is an array. The array of objects can optionally be keyed by a field offset, but defaults to a sequential numeric array.

NOTE: Choosing to key the result array by a non-unique field can result in unwanted behavior and should be avoided.

Paramètres
integer$indexThe index of a field on which to key the result array.
Renvoie
mixed The return value or null if the query failed.
Depuis
11.1
Exceptions
RuntimeException

Références $row, et null.

◆ lockTable()

lockTable (   $tableName)
abstract

Locks a table in the database.

Paramètres
string$tableNameThe name of the table to unlock.
Renvoie
JDatabaseDriver Returns this object to support chaining.
Depuis
11.4
Exceptions
RuntimeException

◆ quote()

quote (   $text,
  $escape = true 
)

Quotes and optionally escapes a string to database requirements for use in database queries.

Paramètres
mixed$textA string or an array of strings to quote.
boolean$escapeTrue (default) to escape the string, false to leave it unchanged.
Renvoie
string|array The quoted input.
Note
Accepting an array of strings was added in 12.3.
Depuis
11.1

Références $text.

◆ quoteName()

quoteName (   $name,
  $as = null 
)

Wrap an SQL statement identifier name such as column, table or database names in quotes to prevent injection risks and reserved word conflicts.

Paramètres
mixed$nameThe identifier name to wrap in quotes, or an array of identifier names to wrap in quotes. Each type supports dot-notation name.
mixed$asThe AS query part associated to $name. It can be string or array, in latter case it has to be same length of $name; if is null there will not be any AS part for string or array element.
Renvoie
mixed The quote wrapped name, same type of $name.
Depuis
11.1

Références $count, $i, $name, et elseif.

◆ quoteNameStr()

quoteNameStr (   $strArr)
protected

Quote strings coming from quoteName call.

Paramètres
array$strArrArray of strings coming from quoteName dot-explosion.
Renvoie
string Dot-imploded string of quoted parts.
Depuis
11.3

Références $parts.

◆ renameTable()

renameTable (   $oldTable,
  $newTable,
  $backup = null,
  $prefix = null 
)
abstract

Renames a table in the database.

Paramètres
string$oldTableThe name of the table to be renamed
string$newTableThe new name for the table.
string$backupTable prefix
string$prefixFor the table - used to rename constraints in non-mysql databases
Renvoie
JDatabaseDriver Returns this object to support chaining.
Depuis
11.4
Exceptions
RuntimeException

◆ replacePrefix()

replacePrefix (   $sql,
  $prefix = '#__' 
)

This function replaces a string identifier $prefix with the string held is the tablePrefix class variable.

Paramètres
string$sqlThe SQL statement to prepare.
string$prefixThe common table prefix.
Renvoie
string The processed SQL statement.
Depuis
11.1

Références $n, et $prefix.

◆ select()

select (   $database)
abstract

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
11.1
Exceptions
RuntimeException

◆ setDebug()

setDebug (   $level)

Sets the database debugging state for the driver.

Paramètres
boolean$levelTrue to enable debugging.
Renvoie
boolean The old debugging level.
Depuis
11.1

◆ setQuery()

setQuery (   $query,
  $offset = 0,
  $limit = 0 
)

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.
Renvoie
JDatabaseDriver This object to support method chaining.
Depuis
11.1

Références $limit, $offset, et $query.

◆ setUtf()

setUtf ( )
abstract

Set the connection to use UTF-8 character encoding.

Renvoie
boolean True on success.
Depuis
11.1

◆ splitSql()

static splitSql (   $sql)
static

Splits a string of multiple queries into an array of individual queries. Single line or line end comments and multi line comments are stripped off.

Paramètres
string$sqlInput SQL string with which to split into individual queries.
Renvoie
array The queries from the input string separated into an array.
Depuis
11.1

Références $current, $i, $query, $start, et elseif.

Référencé par ChangeSet\getUpdateQueries(), Installer\parseSchemaUpdates(), Installer\parseSQLFiles(), et JDatabase\splitSql().

◆ transactionCommit()

transactionCommit (   $toSavepoint = false)
abstract

Method to commit a transaction.

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

◆ transactionRollback()

transactionRollback (   $toSavepoint = false)
abstract

Method to roll back a transaction.

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

◆ transactionStart()

transactionStart (   $asSavepoint = false)
abstract

Method to initialize a transaction.

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

◆ truncateTable()

truncateTable (   $table)

Method to truncate a table.

Paramètres
string$tableThe table to truncate
Renvoie
void
Depuis
11.3
Exceptions
RuntimeException

◆ unlockTables()

unlockTables ( )
abstract

Unlocks tables in the database.

Renvoie
JDatabaseDriver Returns this object to support chaining.
Depuis
11.4
Exceptions
RuntimeException

◆ updateObject()

updateObject (   $table,
$object,
  $key,
  $nulls = false 
)

Updates a row in a table based on an object's properties.

Paramètres
string$tableThe name of the database table to update.
object&$objectA reference to an object whose public properties match the table fields.
array$keyThe name of the primary key.
boolean$nullsTrue to update null fields or false to ignore them.
Renvoie
boolean True on success.
Depuis
11.1
Exceptions
RuntimeException

Références $fields, $key, et null.

Documentation des champs

◆ $_database

$_database
private

◆ $callStacks

$callStacks = array()
protected

◆ $connection

$connection
protected

◆ $count

$count = 0
protected

◆ $cursor

$cursor
protected

◆ $dbMinimum

$dbMinimum
staticprotected

◆ $debug

$debug = false
protected

◆ $disconnectHandlers

$disconnectHandlers = array()
protected

◆ $errorMsg

$errorMsg
protected

◆ $errorNum

$errorNum = 0
protected

◆ $instances

$instances = array()
staticprotected

◆ $limit

$limit = 0
protected

◆ $log

$log = array()
protected

◆ $name

$name

◆ $nameQuote

$nameQuote
protected

◆ $nullDate

$nullDate
protected

◆ $offset

$offset = 0
protected

◆ $options

$options
protected

◆ $serverType

$serverType

◆ $sql

$sql
protected

◆ $tablePrefix

$tablePrefix
protected

◆ $timings

$timings = array()
protected

◆ $transactionDepth

$transactionDepth = 0
protected

◆ $utf

$utf = true
protected

◆ $utf8mb4

$utf8mb4 = false
protected

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