Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de l'interface DatabaseInterface
+ Graphe d'héritage de DatabaseInterface:

Fonctions membres publiques

 connect ()
 
 connected ()
 
 createDatabase ($options, $utf=true)
 
 decodeBinary ($data)
 
 disconnect ()
 
 dropTable ($table, $ifExists=true)
 
 escape ($text, $extra=false)
 
 execute ()
 
 getAffectedRows ()
 
 getCollation ()
 
 getConnection ()
 
 getConnectionCollation ()
 
 getConnectionEncryption ()
 
 isConnectionEncryptionSupported ()
 
 isMinimumVersion ()
 
 getCount ()
 
 getDateFormat ()
 
 getMinimum ()
 
 getName ()
 
 getNullDate ()
 
 getNumRows ()
 
 getQuery ($new=false)
 
 getServerType ()
 
 getTableColumns ($table, $typeOnly=true)
 
 getTableKeys ($tables)
 
 getTableList ()
 
 getVersion ()
 
 hasUtfSupport ()
 
 insertid ()
 
 insertObject ($table, &$object, $key=null)
 
 loadAssoc ()
 
 loadAssocList ($key=null, $column=null)
 
 loadColumn ($offset=0)
 
 loadObject ($class=\stdClass::class)
 
 loadObjectList ($key='', $class=\stdClass::class)
 
 loadResult ()
 
 loadRow ()
 
 loadRowList ($key=null)
 
 lockTable ($tableName)
 
 quote ($text, $escape=true)
 
 quoteBinary ($data)
 
 quoteName ($name, $as=null)
 
 renameTable ($oldTable, $newTable, $backup=null, $prefix=null)
 
 replacePrefix ($sql, $prefix='#__')
 
 select ($database)
 
 setQuery ($query, $offset=0, $limit=0)
 
 transactionCommit ($toSavepoint=false)
 
 transactionRollback ($toSavepoint=false)
 
 transactionStart ($asSavepoint=false)
 
 truncateTable ($table)
 
 unlockTables ()
 
 updateObject ($table, &$object, $key, $nulls=false)
 

Fonctions membres publiques statiques

static isSupported ()
 

Description détaillée

Joomla Framework Database Interface

Depuis
1.0

Documentation des fonctions membres

◆ connect()

connect ( )

Connects to the database if needed.

Renvoie
void
Depuis
2.0.0
Exceptions

Implémenté dans MysqliDriver, MysqlDriver, PdoDriver, PgsqlDriver, et SqliteDriver.

◆ connected()

connected ( )

Determines if the connection to the server is active.

Renvoie
boolean
Depuis
2.0.0

Implémenté dans PdoDriver, et MysqliDriver.

◆ createDatabase()

createDatabase (   $options,
  $utf = true 
)

Create a new database using information from $options object.

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
boolean|resource
Depuis
2.0.0
Exceptions

Implémenté dans DatabaseDriver, et SqliteDriver.

◆ decodeBinary()

decodeBinary (   $data)

Replace special placeholder representing binary field with the original string.

Paramètres
string | resource$dataEncoded string or resource.
Renvoie
string The original string.
Depuis
1.7.0

Implémenté dans DatabaseDriver, et PgsqlDriver.

◆ disconnect()

disconnect ( )

Disconnects the database.

Renvoie
void
Depuis
2.0.0

Implémenté dans DatabaseDriver, et MysqliDriver.

◆ dropTable()

dropTable (   $table,
  $ifExists = true 
)

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
$this
Depuis
2.0.0
Exceptions

Implémenté dans DatabaseDriver.

◆ escape()

escape (   $text,
  $extra = false 
)

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
2.0.0

Implémenté dans MysqlDriver, PdoDriver, MysqliDriver, et SqliteDriver.

◆ execute()

execute ( )

Execute the SQL statement.

Renvoie
boolean
Depuis
2.0.0
Exceptions

Implémenté dans DatabaseDriver, et PdoDriver.

◆ getAffectedRows()

getAffectedRows ( )

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

Renvoie
integer
Depuis
2.0.0

Implémenté dans DatabaseDriver.

◆ getCollation()

getCollation ( )

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

Renvoie
string|boolean The collation in use by the database or boolean false if not supported.
Depuis
2.0.0

Implémenté dans MysqliDriver, MysqlDriver, SqliteDriver, et PgsqlDriver.

◆ getConnection()

getConnection ( )

Method that provides access to the underlying database connection.

Renvoie
resource The underlying database connection resource.
Depuis
2.0.0

Implémenté dans DatabaseDriver.

◆ 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
Depuis
2.0.0

Implémenté dans MysqliDriver, MysqlDriver, SqliteDriver, et PgsqlDriver.

◆ getConnectionEncryption()

getConnectionEncryption ( )

Method to get the database encryption details (cipher and protocol) in use.

Renvoie
string The database encryption details.
Depuis
2.0.0

Implémenté dans MysqliDriver, MysqlDriver, SqliteDriver, et PgsqlDriver.

◆ getCount()

getCount ( )

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

Renvoie
integer
Depuis
2.0.0

Implémenté dans DatabaseDriver.

◆ getDateFormat()

getDateFormat ( )

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

Renvoie
string
Depuis
2.0.0

Implémenté dans DatabaseDriver.

◆ getMinimum()

getMinimum ( )

Get the minimum supported database version.

Renvoie
string
Depuis
2.0.0

Implémenté dans DatabaseDriver, MysqliDriver, et MysqlDriver.

◆ getName()

getName ( )

Get the name of the database driver.

Renvoie
string
Depuis
2.0.0

Implémenté dans DatabaseDriver.

◆ getNullDate()

getNullDate ( )

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

Renvoie
string
Depuis
2.0.0

Implémenté dans MysqliDriver, DatabaseDriver, et MysqlDriver.

◆ getNumRows()

getNumRows ( )

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

Renvoie
integer
Depuis
2.0.0

Implémenté dans DatabaseDriver.

◆ getQuery()

getQuery (   $new = false)

Get the current query object or a new QueryInterface object.

Paramètres
boolean$newFalse to return the current query object, True to return a new QueryInterface object.
Renvoie
QueryInterface
Depuis
2.0.0
Exceptions

Implémenté dans DatabaseDriver.

◆ getServerType()

getServerType ( )

Get the server family type.

Renvoie
string
Depuis
2.0.0

Implémenté dans DatabaseDriver.

◆ getTableColumns()

getTableColumns (   $table,
  $typeOnly = true 
)

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
Depuis
2.0.0
Exceptions

Implémenté dans MysqliDriver, MysqlDriver, SqliteDriver, et PgsqlDriver.

◆ getTableKeys()

getTableKeys (   $tables)

Retrieves field information about the given tables.

Paramètres
mixed$tablesA table name or a list of table names.
Renvoie
array
Depuis
2.0.0
Exceptions

Implémenté dans MysqliDriver, MysqlDriver, PgsqlDriver, et SqliteDriver.

◆ getTableList()

getTableList ( )

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

Renvoie
array
Depuis
2.0.0
Exceptions

Implémenté dans MysqliDriver, MysqlDriver, PgsqlDriver, et SqliteDriver.

◆ getVersion()

getVersion ( )

Get the version of the database connector.

Renvoie
string
Depuis
2.0.0

Implémenté dans MysqliDriver, PdoDriver, MysqlDriver, et SqliteDriver.

◆ 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
2.0.0

Implémenté dans DatabaseDriver.

◆ insertid()

insertid ( )

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
2.0.0

Implémenté dans MysqliDriver, et PdoDriver.

◆ 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
Depuis
2.0.0
Exceptions

Implémenté dans DatabaseDriver, PgsqlDriver, MysqliDriver, et MysqlDriver.

◆ isConnectionEncryptionSupported()

isConnectionEncryptionSupported ( )

Method to test if the database TLS connections encryption are supported.

Renvoie
boolean Whether the database supports TLS connections encryption.
Depuis
2.0.0

Implémenté dans MysqliDriver, MysqlDriver, SqliteDriver, et PgsqlDriver.

◆ 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
2.0.0

Implémenté dans DatabaseDriver.

◆ isSupported()

static isSupported ( )
static

Test to see if the connector is available.

Renvoie
boolean
Depuis
1.0

Implémenté dans PgsqlDriver, PdoDriver, SqliteDriver, MysqliDriver, et MysqlDriver.

◆ 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
2.0.0
Exceptions

Implémenté dans DatabaseDriver.

◆ 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: 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$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
2.0.0
Exceptions

Implémenté dans DatabaseDriver.

◆ 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
2.0.0
Exceptions

Implémenté dans DatabaseDriver.

◆ loadObject()

loadObject (   $class = \stdClass::class)

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
2.0.0
Exceptions

Implémenté dans DatabaseDriver.

◆ loadObjectList()

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

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
2.0.0
Exceptions

Implémenté dans DatabaseDriver.

◆ 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
2.0.0
Exceptions

Implémenté dans DatabaseDriver.

◆ 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
2.0.0
Exceptions

Implémenté dans DatabaseDriver.

◆ loadRowList()

loadRowList (   $key = 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
string$keyThe name of a field on which to key the result array.
Renvoie
mixed The return value or null if the query failed.
Depuis
2.0.0
Exceptions

Implémenté dans DatabaseDriver.

◆ lockTable()

lockTable (   $tableName)

Locks a table in the database.

Paramètres
string$tableNameThe name of the table to unlock.
Renvoie
$this
Depuis
2.0.0
Exceptions

Implémenté dans MysqliDriver, MysqlDriver, PgsqlDriver, et SqliteDriver.

◆ quote()

quote (   $text,
  $escape = true 
)

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

Paramètres
array | string$textA string or an array of strings to quote.
boolean$escapeTrue (default) to escape the string, false to leave it unchanged.
Renvoie
string
Depuis
2.0.0

Implémenté dans DatabaseDriver.

◆ quoteBinary()

quoteBinary (   $data)

Quotes a binary string to database requirements for use in database queries.

Paramètres
string$dataA binary string to quote.
Renvoie
string The binary quoted input string.
Depuis
1.7.0

Implémenté dans DatabaseDriver, et PgsqlDriver.

◆ 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
array | string$nameThe identifier name to wrap in quotes, or an array of identifier names to wrap in quotes. Each type supports dot-notation name.
array | string$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
array|string The quote wrapped name, same type of $name.
Depuis
2.0.0

Implémenté dans DatabaseDriver.

◆ renameTable()

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

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
$this
Depuis
2.0.0
Exceptions

Implémenté dans MysqliDriver, MysqlDriver, PgsqlDriver, et SqliteDriver.

◆ replacePrefix()

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

This function replaces a string identifier with the configured table prefix.

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

Implémenté dans DatabaseDriver, et PgsqlDriver.

◆ select()

select (   $database)

Select a database for use.

Paramètres
string$databaseThe name of the database to select for use.
Renvoie
boolean
Depuis
2.0.0
Exceptions

Implémenté dans MysqliDriver, PdoDriver, SqliteDriver, et MysqlDriver.

◆ 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 Query object or a string.
integer$offsetThe affected row offset to set. {
Obsolète:
3.0 Use LimitableInterface::setLimit() instead}
Paramètres
integer$limitThe maximum affected rows to set. {
Obsolète:
3.0 Use LimitableInterface::setLimit() instead}
Renvoie
$this
Depuis
2.0.0

Implémenté dans DatabaseDriver.

◆ transactionCommit()

transactionCommit (   $toSavepoint = false)

Method to commit a transaction.

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

Implémenté dans MysqliDriver, MysqlDriver, PdoDriver, PgsqlDriver, et SqliteDriver.

◆ transactionRollback()

transactionRollback (   $toSavepoint = false)

Method to roll back a transaction.

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

Implémenté dans MysqliDriver, MysqlDriver, PdoDriver, PgsqlDriver, et SqliteDriver.

◆ transactionStart()

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
2.0.0
Exceptions

Implémenté dans MysqliDriver, MysqlDriver, PdoDriver, PgsqlDriver, et SqliteDriver.

◆ truncateTable()

truncateTable (   $table)

Method to truncate a table.

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

Implémenté dans DatabaseDriver, et SqliteDriver.

◆ unlockTables()

unlockTables ( )

Unlocks tables in the database.

Renvoie
$this
Depuis
2.0.0
Exceptions

Implémenté dans MysqliDriver, PgsqlDriver, MysqlDriver, et SqliteDriver.

◆ 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 | string$keyThe name of the primary key.
boolean$nullsTrue to update null fields or false to ignore them.
Renvoie
boolean
Depuis
2.0.0
Exceptions

Implémenté dans DatabaseDriver, et PgsqlDriver.


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