|
| __get ($name) |
|
| __construct (array $options) |
|
| __destruct () |
|
| alterDbCharacterSet ($dbName) |
|
| createDatabase ($options, $utf=true) |
|
| disconnect () |
|
| dropTable ($table, $ifExists=true) |
|
| execute () |
|
| getAffectedRows () |
|
| getConnection () |
|
| getCount () |
|
| getDateFormat () |
|
| getMinimum () |
|
| getName () |
|
| getNumRows () |
|
| getServerType () |
|
| getNullDate () |
|
| getPrefix () |
|
| getExporter () |
|
| getImporter () |
|
| getQuery ($new=false) |
|
| getIterator ($column=null, $class=\stdClass::class) |
|
| getTableCreate ($tables) |
|
| hasUtfSupport () |
|
| insertObject ($table, &$object, $key=null) |
|
| isMinimumVersion () |
|
| loadAssoc () |
|
| loadAssocList ($key=null, $column=null) |
|
| loadColumn ($offset=0) |
|
| loadObject ($class=\stdClass::class) |
|
| loadObjectList ($key='', $class=\stdClass::class) |
|
| loadResult () |
|
| loadRow () |
|
| loadRowList ($key=null) |
|
| q ($text, $escape=true) |
|
| quote ($text, $escape=true) |
|
| quoteBinary ($data) |
|
| decodeBinary ($data) |
|
| qn ($name, $as=null) |
|
| quoteName ($name, $as=null) |
|
| replacePrefix ($sql, $prefix='#__') |
|
| getMonitor () |
|
| setMonitor (QueryMonitorInterface $monitor=null) |
|
| setQuery ($query, $offset=0, $limit=0) |
|
| setUtf () |
|
| truncateTable ($table) |
|
| updateObject ($table, &$object, $key, $nulls=false) |
|
| connect () |
|
| connected () |
|
| escape ($text, $extra=false) |
|
| getCollation () |
|
| getConnectionCollation () |
|
| getConnectionEncryption () |
|
| isConnectionEncryptionSupported () |
|
| getTableColumns ($table, $typeOnly=true) |
|
| getTableKeys ($tables) |
|
| getTableList () |
|
| getVersion () |
|
| insertid () |
|
| lockTable ($tableName) |
|
| renameTable ($oldTable, $newTable, $backup=null, $prefix=null) |
|
| select ($database) |
|
| transactionCommit ($toSavepoint=false) |
|
| transactionRollback ($toSavepoint=false) |
|
| transactionStart ($asSavepoint=false) |
|
| unlockTables () |
|
| setDispatcher (DispatcherInterface $dispatcher) |
|
Joomla Framework Database Driver Class
- Depuis
- 1.0
◆ __construct()
__construct |
( |
array |
$options | ) |
|
Constructor.
- Paramètres
-
array | $options | List of options used to configure the connection |
- Depuis
- 1.0
Références $options, et null.
◆ __destruct()
◆ __get()
Magic method to access properties of the database driver.
- Paramètres
-
string | $name | The name of the property. |
- Renvoie
- mixed A value if the property name is valid, null otherwise.
- Depuis
- 1.4.0
- Obsolète:
- 3.0 This is a B/C proxy since $this->name was previously public
Références $name, et class.
◆ alterDbCharacterSet()
alterDbCharacterSet |
( |
|
$dbName | ) |
|
Alter database's character set.
- Paramètres
-
string | $dbName | The database name that will be altered |
- Renvoie
- boolean|resource
- Depuis
- 2.0.0
- Exceptions
-
Références null.
◆ createDatabase()
createDatabase |
( |
|
$options, |
|
|
|
$utf = true |
|
) |
| |
Create a new database using information from $options object.
- Paramètres
-
\stdClass | $options | Object used to pass user and database name to database driver. This object must have "db_name" and "db_user" set. |
boolean | $utf | True if the database supports the UTF-8 character set. |
- Renvoie
- boolean|resource
- Depuis
- 2.0.0
- Exceptions
-
Implémente DatabaseInterface.
Références $options, et null.
◆ decodeBinary()
Replace special placeholder representing binary field with the original string.
- Paramètres
-
string | resource | $data | Encoded string or resource. |
- Renvoie
- string The original string.
- Depuis
- 1.7.0
Implémente DatabaseInterface.
Références $data.
◆ disconnect()
◆ dispatchEvent()
◆ dropTable()
dropTable |
( |
|
$table, |
|
|
|
$ifExists = true |
|
) |
| |
Drops a table from the database.
- Paramètres
-
string | $table | The name of the database table to drop. |
boolean | $ifExists | Optionally specify that the table must exist before it is dropped. |
- Renvoie
- $this
- Depuis
- 2.0.0
- Exceptions
-
Implémente DatabaseInterface.
Références $this.
◆ execute()
◆ fetchArray()
Method to fetch a row from the result set cursor as an array.
- Renvoie
- mixed Either the next row from the result set or false if there are no more rows.
- Depuis
- 1.0
◆ fetchAssoc()
Method to fetch a row from the result set cursor as an associative array.
- Renvoie
- mixed Either the next row from the result set or false if there are no more rows.
- Depuis
- 1.0
◆ fetchObject()
Method to fetch a row from the result set cursor as an object.
Note, the fetch mode should be configured before calling this method using StatementInterface::setFetchMode()
.
- Renvoie
- mixed Either the next row from the result set or false if there are no more rows.
- Depuis
- 1.0
◆ freeResult()
◆ getAffectedRows()
Get the number of affected rows for the previous executed SQL statement.
- Renvoie
- integer The number of affected rows in the previous operation
- Depuis
- 2.0.0
Implémente DatabaseInterface.
◆ getAlterDbCharacterSet()
getAlterDbCharacterSet |
( |
|
$dbName | ) |
|
|
protected |
Return the query string to alter the database character set.
- Paramètres
-
string | $dbName | The database name |
- Renvoie
- string The query that alter the database query string
- Depuis
- 1.6.0
◆ getConnection()
◆ getCount()
Get the total number of SQL statements executed by the database driver.
- Renvoie
- integer
- Depuis
- 1.0
Implémente DatabaseInterface.
Références $count.
◆ getCreateDatabaseQuery()
getCreateDatabaseQuery |
( |
|
$options, |
|
|
|
$utf |
|
) |
| |
|
protected |
Return the query string to create new Database.
- Paramètres
-
stdClass | $options | Object used to pass user and database name to database driver. This object must have "db_name" and "db_user" set. |
boolean | $utf | True if the database supports the UTF-8 character set. |
- Renvoie
- string The query that creates database
- Depuis
- 2.0.0
Références $options.
◆ getDatabase()
Gets the name of the database used by this connection.
- Renvoie
- string
- Depuis
- 1.0
◆ getDateFormat()
Returns a PHP date() function compliant date format for the database driver.
- Renvoie
- string
- Depuis
- 1.0
Implémente DatabaseInterface.
◆ getExporter()
◆ getImporter()
◆ getInstance()
static getInstance |
( |
array |
$options = [] | ) |
|
|
static |
◆ getIterator()
Get a new iterator on the current query.
- Paramètres
-
string | $column | An option column to use as the iterator key. |
string | $class | The class of object that is returned. |
- Renvoie
- DatabaseIterator
- Depuis
- 1.0
Calling setQuery free's the statement from the iterator which will break the iterator. So we set statement to null so that freeResult on the statement here has no affect. If you unset the iterator object then that will close the cursor and free the result.
Références $class, name, et null.
◆ getMinimum()
Get the minimum supported database version.
- Renvoie
- string
- Depuis
- 1.0
Implémente DatabaseInterface.
◆ getMonitor()
Get the query monitor.
- Renvoie
- QueryMonitorInterface|null The query monitor or null if not set.
- Depuis
- 2.0.0
◆ 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
- 1.4.0
Implémente DatabaseInterface.
Références $name, $this, et name.
◆ getNullDate()
◆ getNumRows()
Get the number of returned rows for the previous executed SQL statement.
- Renvoie
- integer The number of returned rows.
- Depuis
- 2.0.0
Implémente DatabaseInterface.
◆ getPrefix()
Get the common table prefix for the database driver.
- Renvoie
- string The common database table prefix.
- Depuis
- 1.0
◆ getQuery()
Get the current query object or a new DatabaseQuery object.
- Paramètres
-
boolean | $new | False to return the current query object, True to return a new DatabaseQuery object. |
- Renvoie
- DatabaseQuery
- Depuis
- 1.0
Implémente DatabaseInterface.
Références $sql, $this, et name.
Référencé par PgsqlDriver\getConnectionEncryption(), PgsqlDriver\getNamesKey(), PgsqlDriver\getSequenceIsCalled(), PgsqlDriver\getSequenceLastValue(), SqliteDriver\getTableList(), PgsqlDriver\getTableList(), PgsqlDriver\getTableSequences(), MysqlDriver\insertObject(), MysqliDriver\insertObject(), PgsqlDriver\insertObject(), PgsqlDriver\renameTable(), et PgsqlDriver\showTables().
◆ getServerType()
Get the server family type.
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
- 1.4.0
Implémente DatabaseInterface.
Références $name, et elseif.
◆ getTableCreate()
getTableCreate |
( |
|
$tables | ) |
|
|
abstract |
Shows the table CREATE statement that creates the given tables.
- Paramètres
-
mixed | $tables | A table name or a list of table names. |
- Renvoie
- array A list of the create SQL for the tables.
- Depuis
- 1.0
- Exceptions
-
◆ 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
- 1.0
Implémente DatabaseInterface.
◆ insertObject()
insertObject |
( |
|
$table, |
|
|
& |
$object, |
|
|
|
$key = null |
|
) |
| |
Inserts a row into a table based on an object's properties.
- Paramètres
-
string | $table | The name of the database table to insert into. |
object | $object | A reference to an object whose public properties match the table fields. |
string | $key | The name of the primary key. If provided the object property is updated. |
- Renvoie
- boolean
- Depuis
- 1.0
- Exceptions
-
Implémente DatabaseInterface.
Références $fields, $id, $key, $query, et null.
◆ 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
- 1.0
Implémente DatabaseInterface.
◆ 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
- 1.0
- Exceptions
-
Implémente DatabaseInterface.
Références null.
Référencé par PgsqlDriver\getRandom().
◆ 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 | $key | The name of a field on which to key the result array. |
string | $column | An 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
- 1.0
- Exceptions
-
Implémente DatabaseInterface.
Références $key, et $value.
Référencé par PgsqlDriver\getCollation(), et PgsqlDriver\getConnectionCollation().
◆ loadColumn()
loadColumn |
( |
|
$offset = 0 | ) |
|
◆ loadObject()
Method to get the first row of the result set from the database query as an object.
- Paramètres
-
string | $class | The class name to use for the returned row object. |
- Renvoie
- mixed The return value or null if the query failed.
- Depuis
- 1.0
- Exceptions
-
Implémente DatabaseInterface.
Références $class, class, et null.
◆ loadObjectList()
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 | $key | The name of a field on which to key the result array. |
string | $class | The class name to use for the returned row objects. |
- Renvoie
- mixed The return value or null if the query failed.
- Depuis
- 1.0
- Exceptions
-
Implémente DatabaseInterface.
Références $class, $key, et class.
Référencé par PgsqlDriver\getTableColumns(), PgsqlDriver\getTableKeys(), et PgsqlDriver\getTableSequences().
◆ loadResult()
◆ 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
- 1.0
- Exceptions
-
Implémente DatabaseInterface.
Références null.
Référencé par PgsqlDriver\getStringPositionSql().
◆ 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 | $key | The name of a field on which to key the result array. |
- Renvoie
- array An array of results.
- Depuis
- 1.0
- Exceptions
-
Implémente DatabaseInterface.
Références $key, et null.
◆ prepareStatement()
prepareStatement |
( |
string |
$query | ) |
|
|
abstractprotected |
Prepares a SQL statement for execution
- Paramètres
-
string | $query | The SQL query to be prepared. |
- Renvoie
- StatementInterface
- Depuis
- 2.0.0
- Exceptions
-
PrepareStatementFailureException | |
◆ q()
q |
( |
|
$text, |
|
|
|
$escape = true |
|
) |
| |
Alias for quote method
- Paramètres
-
array | string | $text | A string or an array of strings to quote. |
boolean | $escape | True (default) to escape the string, false to leave it unchanged. |
- Renvoie
- string The quoted input string.
- Depuis
- 1.0
Références $text.
◆ qn()
Alias for quoteName method
- Paramètres
-
array | string | $name | The identifier name to wrap in quotes, or an array of identifier names to wrap in quotes. Each type supports dot-notation name. |
array | string | $as | The 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
- 1.0
Références $name.
◆ quote()
quote |
( |
|
$text, |
|
|
|
$escape = true |
|
) |
| |
Quotes and optionally escapes a string to database requirements for use in database queries.
- Paramètres
-
array | string | $text | A string or an array of strings to quote. |
boolean | $escape | True (default) to escape the string, false to leave it unchanged. |
- Renvoie
- string The quoted input string.
- Depuis
- 1.0
Implémente DatabaseInterface.
Références $text.
Référencé par PgsqlDriver\getAlterDbCharacterSet(), PgsqlDriver\getCreateDbQuery(), PgsqlDriver\getNamesKey(), PgsqlDriver\getTableColumns(), PgsqlDriver\getTableKeys(), PgsqlDriver\getTableList(), PgsqlDriver\getTableSequences(), MysqlDriver\insertObject(), MysqliDriver\insertObject(), PgsqlDriver\renameTable(), PgsqlDriver\showTables(), et PgsqlDriver\sqlValue().
◆ quoteBinary()
Quotes a binary string to database requirements for use in database queries.
- Paramètres
-
string | $data | A binary string to quote. |
- Renvoie
- string The binary quoted input string.
- Depuis
- 1.7.0
Implémente DatabaseInterface.
Références $data.
◆ 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 | $name | The identifier name to wrap in quotes, or an array of identifier names to wrap in quotes. Each type supports dot-notation name. |
array | string | $as | The 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
- 1.0
Implémente DatabaseInterface.
Références $count, $i, $name, elseif, et null.
Référencé par MysqliDriver\getAlterDbCharacterSet(), PgsqlDriver\getAlterDbCharacterSet(), PgsqlDriver\getConnectionEncryption(), MysqlDriver\getCreateDatabaseQuery(), MysqliDriver\getCreateDatabaseQuery(), PgsqlDriver\getCreateDbQuery(), PgsqlDriver\getSequenceIsCalled(), PgsqlDriver\getSequenceLastValue(), MysqlDriver\getTableColumns(), MysqliDriver\getTableColumns(), MysqlDriver\getTableCreate(), MysqliDriver\getTableCreate(), MysqlDriver\getTableKeys(), MysqliDriver\getTableKeys(), PgsqlDriver\getTableSequences(), MysqlDriver\insertObject(), MysqliDriver\insertObject(), PgsqlDriver\insertObject(), PgsqlDriver\lockTable(), MysqlDriver\lockTable(), MysqliDriver\lockTable(), MysqlDriver\renameTable(), SqliteDriver\transactionRollback(), PgsqlDriver\transactionRollback(), MysqlDriver\transactionRollback(), MysqliDriver\transactionRollback(), SqliteDriver\transactionStart(), PgsqlDriver\transactionStart(), MysqlDriver\transactionStart(), SqliteDriver\truncateTable(), et PgsqlDriver\updateObject().
◆ quoteNameStr()
Quote strings coming from quoteName call.
- Paramètres
-
array | $strArr | Array of strings coming from quoteName dot-explosion. |
- Renvoie
- string Dot-imploded string of quoted parts.
- Depuis
- 1.0
- Obsolète:
- 2.0 Use quoteNameString instead
Références $parts, et null.
◆ quoteNameString()
quoteNameString |
( |
|
$name, |
|
|
|
$asSinglePart = false |
|
) |
| |
|
protected |
Quote string coming from quoteName call.
- Paramètres
-
string | $name | Identifier name to be quoted. |
boolean | $asSinglePart | Treat the name as a single part of the identifier. |
- Renvoie
- string Quoted identifier string.
- Depuis
- 1.7.0
Références $name.
◆ replacePrefix()
replacePrefix |
( |
|
$sql, |
|
|
|
$prefix = '#__' |
|
) |
| |
◆ setMonitor()
Set a query monitor.
- Paramètres
-
- Renvoie
- $this
- Depuis
- 2.0.0
Références $this.
◆ setQuery()
setQuery |
( |
|
$query, |
|
|
|
$offset = 0 , |
|
|
|
$limit = 0 |
|
) |
| |
Sets the SQL statement string for later execution.
- Paramètres
-
string | QueryInterface | $query | The SQL statement to set either as a Query object or a string. |
integer | $offset | The affected row offset to set. { |
- Obsolète:
- 3.0 Use LimitableInterface::setLimit() instead}
- Paramètres
-
integer | $limit | The maximum affected rows to set. { |
- Obsolète:
- 3.0 Use LimitableInterface::setLimit() instead}
- Renvoie
- $this
- Depuis
- 1.0
- Exceptions
-
Implémente DatabaseInterface.
Références $limit, Joomla\Database\Query\$offset, $query, $sql, $this, class, elseif, Joomla\Database\Query\limit(), et Joomla\Database\Query\offset().
Référencé par PgsqlDriver\connect(), PdoDriver\connected(), PgsqlDriver\getCollation(), MysqliDriver\getCollation(), PgsqlDriver\getConnectionCollation(), MysqliDriver\getConnectionCollation(), PgsqlDriver\getConnectionEncryption(), MysqliDriver\getConnectionEncryption(), PgsqlDriver\getDefaultSchema(), PgsqlDriver\getNamesKey(), PgsqlDriver\getRandom(), PgsqlDriver\getSequenceIsCalled(), PgsqlDriver\getSequenceLastValue(), PgsqlDriver\getStringPositionSql(), PgsqlDriver\getTableColumns(), SqliteDriver\getTableColumns(), MysqlDriver\getTableColumns(), MysqliDriver\getTableColumns(), MysqlDriver\getTableCreate(), MysqliDriver\getTableCreate(), SqliteDriver\getTableKeys(), PgsqlDriver\getTableKeys(), MysqlDriver\getTableKeys(), MysqliDriver\getTableKeys(), SqliteDriver\getTableList(), PgsqlDriver\getTableList(), MysqlDriver\getTableList(), MysqliDriver\getTableList(), PgsqlDriver\getTableSequences(), SqliteDriver\getVersion(), MysqlDriver\insertObject(), MysqliDriver\insertObject(), PgsqlDriver\insertObject(), PgsqlDriver\isConnectionEncryptionSupported(), MysqlDriver\isConnectionEncryptionSupported(), MysqliDriver\isConnectionEncryptionSupported(), PgsqlDriver\lockTable(), MysqlDriver\lockTable(), SqliteDriver\renameTable(), PgsqlDriver\renameTable(), MysqlDriver\renameTable(), MysqliDriver\renameTable(), PgsqlDriver\showTables(), SqliteDriver\transactionRollback(), PgsqlDriver\transactionRollback(), MysqlDriver\transactionRollback(), SqliteDriver\transactionStart(), PgsqlDriver\transactionStart(), MysqlDriver\transactionStart(), SqliteDriver\truncateTable(), MysqlDriver\unlockTables(), et PgsqlDriver\updateObject().
◆ setUtf()
Set the connection to use UTF-8 character encoding.
- Renvoie
- boolean True on success.
- Depuis
- 1.0
◆ splitSql()
◆ truncateTable()
Method to truncate a table.
- Paramètres
-
string | $table | The table to truncate |
- Renvoie
- void
- Depuis
- 1.0
- Exceptions
-
Implémente DatabaseInterface.
◆ updateObject()
updateObject |
( |
|
$table, |
|
|
& |
$object, |
|
|
|
$key, |
|
|
|
$nulls = false |
|
) |
| |
Updates a row in a table based on an object's properties.
- Paramètres
-
string | $table | The name of the database table to update. |
object | $object | A reference to an object whose public properties match the table fields. |
array | string | $key | The name of the primary key. |
boolean | $nulls | True to update null fields or false to ignore them. |
- Renvoie
- boolean True on success.
- Depuis
- 1.0
- Exceptions
-
Implémente DatabaseInterface.
Références $fields, $key, $val, et null.
◆ $connection
◆ $connectors
◆ $count
◆ $cursor
◆ $database
◆ $dbMinimum
◆ $errorMsg
◆ $errorNum
◆ $executed
◆ $factory
◆ $instances
◆ $limit
◆ $monitor
◆ $name
◆ $nameQuote
◆ $nullDate
◆ $offset
◆ $options
◆ $serverType
◆ $sql
◆ $statement
◆ $tablePrefix
◆ $transactionDepth
◆ $utf
La documentation de cette classe a été générée à partir du fichier suivant :