JDatabase
Implements interfaces:
Database connector class.
Located in /libraries/joomla/database/database.php (line 41)
JDatabase (Subpackage Database)
| Class | Description |
|---|---|
JDatabaseSQLSrv
|
SQL Server database driver |
JDatabaseMySQL
|
MySQL database driver |
JDatabase
renameTable
(string $oldTable, string $newTable, [string $backup = null], [string $prefix = null])
resource
$connection
(line 63)
integer
$count
= 0 (line 69)
resource
$cursor
(line 75)
boolean
$debug
= false (line 81)
string
$errorMsg
(line 147)
integer
$errorNum
= 0 (line 140)
boolean
$hasQuoted
= false (line 154)
array
$instances
= array() (line 167)
integer
$limit
= 0 (line 87)
array
$log
= array() (line 93)
string
$name
(line 57)
The name of the database driver.
- JDatabaseSQLSrv::$name : The name of the database driver.
- JDatabaseSQLAzure::$name : The name of the database driver.
- JDatabaseMySQL::$name : The name of the database driver.
- JDatabaseMySQLi::$name : The name of the database driver.
string
$nameQuote
(line 102)
- JDatabaseSQLSrv::$nameQuote : The character(s) used to quote SQL statement names such as table names or field names, etc. The child classes should define this as necessary. If a single character string the same character is used for both sides of the quoted name, else the first character will be used for the opening quote and the second for the closing quote.
- JDatabaseMySQL::$nameQuote : The character(s) used to quote SQL statement names such as table names or field names, etc. The child classes should define this as necessary. If a single character string the same character is used for both sides of the quoted name, else the first character will be used for the opening quote and the second for the closing quote.
string
$nullDate
(line 109)
- JDatabaseSQLSrv::$nullDate : The null or zero representation of a timestamp for the database driver. This should be defined in child classes to hold the appropriate value for the engine.
- JDatabaseMySQL::$nullDate : The null or zero representation of a timestamp for the database driver. This should be defined in child classes to hold the appropriate value for the engine.
integer
$offset
= 0 (line 115)
array
$quoted
= array() (line 161)
mixed
$sql
(line 121)
string
$tablePrefix
(line 127)
boolean
$utf
= true (line 133)
Constructor.
- array $options: List of options used to configure the connection
- JDatabaseSQLSrv::__construct() : Constructor.
- JDatabaseMySQL::__construct() : Constructor.
- JDatabaseMySQLi::__construct() : Constructor.
Adds a field or array of field names to the list that are to be quoted.
- mixed $quoted: Field name or array of names.
Determines if the connection to the server is active.
- JDatabaseSQLSrv::connected() : Determines if the connection to the server is active.
- JDatabaseMySQL::connected() : Determines if the connection to the server is active.
- JDatabaseMySQLi::connected() : Determines if the connection to the server is active.
Sets the debug level on or off
-
integer
$level:
- to disable debugging and 1 to enable it.
Drops a table from the database.
- string $table: The name of the database table to drop.
- boolean $ifExists: Optionally specify that the table must exist before it is dropped.
- JDatabaseSQLSrv::dropTable() : Drops a table from the database.
- JDatabaseMySQL::dropTable() : Drops a table from the database.
Method to escape a string for usage in an SQL statement.
- string $text: The string to be escaped.
- boolean $extra: Optional parameter to provide extra escaping.
- JDatabaseSQLSrv::escape() : Method to escape a string for usage in an SQL statement.
- JDatabaseMySQL::escape() : Method to escape a string for usage in an SQL statement.
- JDatabaseMySQLi::escape() : Method to escape a string for usage in an SQL statement.
Diagnostic method to return explain information for a query.
- JDatabaseSQLSrv::explain() : Diagnostic method to return explain information for a query.
- JDatabaseMySQL::explain() : Diagnostic method to return explain information for a query.
Method to fetch a row from the result set cursor as an array.
- mixed $cursor: The optional result set cursor from which to fetch the row.
- JDatabaseSQLSrv::fetchArray() : Method to fetch a row from the result set cursor as an array.
- JDatabaseMySQL::fetchArray() : Method to fetch a row from the result set cursor as an array.
- JDatabaseMySQLi::fetchArray() : Method to fetch a row from the result set cursor as an array.
Method to fetch a row from the result set cursor as an associative array.
- mixed $cursor: The optional result set cursor from which to fetch the row.
- JDatabaseSQLSrv::fetchAssoc() : Method to fetch a row from the result set cursor as an associative array.
- JDatabaseMySQL::fetchAssoc() : Method to fetch a row from the result set cursor as an associative array.
- JDatabaseMySQLi::fetchAssoc() : Method to fetch a row from the result set cursor as an associative array.
Method to fetch a row from the result set cursor as an object.
- mixed $cursor: The optional result set cursor from which to fetch the row.
- string $class: The class name to use for the returned row object.
- JDatabaseSQLSrv::fetchObject() : Method to fetch a row from the result set cursor as an object.
- JDatabaseMySQL::fetchObject() : Method to fetch a row from the result set cursor as an object.
- JDatabaseMySQLi::fetchObject() : Method to fetch a row from the result set cursor as an object.
Method to free up the memory used for the result set.
- mixed $cursor: The optional result set cursor from which to fetch the row.
- JDatabaseSQLSrv::freeResult() : Method to free up the memory used for the result set.
- JDatabaseMySQL::freeResult() : Method to free up the memory used for the result set.
- JDatabaseMySQLi::freeResult() : Method to free up the memory used for the result set.
Get the number of affected rows for the previous executed SQL statement.
- JDatabaseSQLSrv::getAffectedRows() : Get the number of affected rows for the previous executed SQL statement.
- JDatabaseMySQL::getAffectedRows() : Get the number of affected rows for the previous executed SQL statement.
- JDatabaseMySQLi::getAffectedRows() : Get the number of affected rows for the previous executed SQL statement.
Method to get the database collation in use by sampling a text field of a table in the database.
- JDatabaseSQLSrv::getCollation() : Method to get the database collation in use by sampling a text field of a table in the database.
- JDatabaseMySQL::getCollation() : Method to get the database collation in use by sampling a text field of a table in the database.
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.
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.
Get the total number of SQL statements executed by the database driver.
Returns a PHP date() function compliant date format for the database driver.
Gets the error message from the database connection.
- boolean $escaped: True to escape the message string for use in JavaScript.
Method to escape a string for usage in an SQL statement.
- string $text: The string to be escaped.
- boolean $extra: Optional parameter to provide extra escaping.
Method to return a JDatabase 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 'mysql'. 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.
- array $options: Parameters to be passed to the database driver.
Get the null or zero representation of a timestamp for the database driver.
Get the number of returned rows for the previous executed SQL statement.
- resource $cursor: An optional database cursor resource to extract the row count from.
- JDatabaseSQLSrv::getNumRows() : Get the number of returned rows for the previous executed SQL statement.
- JDatabaseMySQL::getNumRows() : Get the number of returned rows for the previous executed SQL statement.
- JDatabaseMySQLi::getNumRows() : Get the number of returned rows for the previous executed SQL statement.
Get the current query object or a new JDatabaseQuery object.
- boolean $new: False to return the current query object, True to return a new JDatabaseQuery object.
- JDatabaseSQLSrv::getQuery() : Get the current or query, or new JDatabaseQuery object.
- JDatabaseSQLAzure::getQuery() : Get the current query or new JDatabaseQuery object.
- JDatabaseMySQL::getQuery() : Get the current or query, or new JDatabaseQuery object.
- JDatabaseMySQLi::getQuery() : Get the current or query, or new JDatabaseQuery object.
Retrieves field information about the given tables.
- string $table: The name of the database table.
- boolean $typeOnly: True (default) to only return field types.
- JDatabaseSQLSrv::getTableColumns() : Retrieves field information about the given tables.
- JDatabaseMySQL::getTableColumns() : Retrieves field information about a given table.
Shows the table CREATE statement that creates the given tables.
- mixed $tables: A table name or a list of table names.
- JDatabaseSQLSrv::getTableCreate() : Shows the table CREATE statement that creates the given tables.
- JDatabaseMySQL::getTableCreate() : Shows the table CREATE statement that creates the given tables.
Retrieves field information about the given tables.
- mixed $tables: A table name or a list of table names.
- boolean $typeOnly: True to only return field types.
Retrieves field information about the given tables.
- mixed $tables: A table name or a list of table names.
- JDatabaseSQLSrv::getTableKeys() : Get the details list of keys for a table.
- JDatabaseMySQL::getTableKeys() : Get the details list of keys for a table.
Method to get an array of all tables in the database.
- JDatabaseSQLSrv::getTableList() : Method to get an array of all tables in the database.
- JDatabaseMySQL::getTableList() : Method to get an array of all tables in the database.
Get the total number of SQL statements executed by the database driver.
Determine whether or not the database engine supports UTF-8 character encoding.
Get the version of the database connector
- JDatabaseSQLSrv::getVersion() : Get the version of the database connector.
- JDatabaseMySQL::getVersion() : Get the version of the database connector.
- JDatabaseMySQLi::getVersion() : Get the version of the database connector.
Determines if the database engine supports UTF-8 character encoding.
- JDatabaseSQLSrv::hasUTF() : Determines if the database engine supports UTF-8 character encoding.
- JDatabaseMySQL::hasUTF() : Determines if the database engine supports UTF-8 character encoding.
- JDatabaseMySQLi::hasUTF() : Determines if the database engine supports UTF-8 character encoding.
Method to get the auto-incremented value from the last INSERT statement.
- JDatabaseSQLSrv::insertid() : Method to get the auto-incremented value from the last INSERT statement.
- JDatabaseMySQL::insertid() : Method to get the auto-incremented value from the last INSERT statement.
- JDatabaseMySQLi::insertid() : Method to get the auto-incremented value from the last INSERT statement.
Inserts a row into a table based on an object's properties.
- 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.
- JDatabaseSQLSrv::insertObject() : Inserts a row into a table based on an object's properties.
Checks if field name needs to be quoted.
- string $field: The field name to be checked.
Method to get the first row of the result set from the database query as an associative array of ['field_name' => 'row_value'].
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.
- 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.
Method to get an array of values from the $offset field in each row of the result set from the database query.
- integer $offset: The row offset to use to build the result array.
Method to get the next row in the result set from the database query as an object.
- string $class: The class name to use for the returned row object.
Method to get the next row in the result set from the database query as an array.
Method to get the first row of the result set from the database query as an object.
- string $class: The class name to use for the returned row object.
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.
- 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.
Method to get the first field of the first row of the result set from the database query.
- JDatabaseSQLSrv::loadResult() : Method to get the first field of the first row of the result set from the database query.
Method to get an array of values from the $offset field in each row of the result set from the database query.
- integer $offset: The row offset to use to build the result array.
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.
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.
- string $key: The name of a field on which to key the result array.
Locks a table in the database.
- string $tableName: The name of the table to unlock.
- JDatabaseSQLSrv::lockTable() : Locks a table in the database.
- JDatabaseMySQL::lockTable() : Locks a table in the database.
Wrap an SQL statement identifier name such as column, table or database names in quotes to prevent injection risks and reserved word conflicts.
- string $name: The identifier name to wrap in quotes.
Execute the SQL statement.
- JDatabaseSQLSrv::query() : Execute the SQL statement.
- JDatabaseMySQL::query() : Execute the SQL statement.
- JDatabaseMySQLi::query() : Execute the SQL statement.
Execute a query batch.
- boolean $abortOnError: Abort on error.
- boolean $transactionSafe: Transaction safe queries.
- JDatabaseSQLSrv::queryBatch() : Execute a query batch.
- JDatabaseMySQL::queryBatch() : Execute a query batch.
- JDatabaseMySQLi::queryBatch() : Execute a query batch.
Method to quote and optionally escape a string to database requirements for insertion into the database.
- string $text: The string to quote.
- boolean $escape: True (default) to escape the string, false to leave it unchanged.
Wrap an SQL statement identifier name such as column, table or database names in quotes to prevent injection risks and reserved word conflicts.
- mixed $name: The identifier name to wrap in quotes, or an array of identifier names to wrap in quotes. Each type supports dot-notation name.
- mixed $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.
Quote strings coming from quoteName call.
- array $strArr: Array of strings coming from quoteName dot-explosion.
Renames a table in the database.
- string $oldTable: The name of the table to be renamed
- string $newTable: The new name for the table.
- string $backup: Table prefix
- string $prefix: For the table - used to rename constraints in non-mysql databases
- JDatabaseSQLSrv::renameTable() : Renames a table in the database.
- JDatabaseMySQL::renameTable() : Renames a table in the database.
This function replaces a string identifier $prefix with the string held is the tablePrefix class variable.
- string $sql: The SQL statement to prepare.
- string $prefix: The common table prefix.
Select a database for use.
- string $database: The name of the database to select for use.
- JDatabaseSQLSrv::select() : Select a database for use.
- JDatabaseMySQL::select() : Select a database for use.
- JDatabaseMySQLi::select() : Select a database for use.
Sets the database debugging state for the driver.
- boolean $level: True to enable debugging.
Sets the SQL statement string for later execution.
- mixed $query: The SQL statement to set either as a JDatabaseQuery object or a string.
- integer $offset: The affected row offset to set.
- integer $limit: The maximum affected rows to set.
Set the connection to use UTF-8 character encoding.
- JDatabaseSQLSrv::setUTF() : Set the connection to use UTF-8 character encoding.
- JDatabaseMySQL::setUTF() : Set the connection to use UTF-8 character encoding.
- JDatabaseMySQLi::setUTF() : Set the connection to use UTF-8 character encoding.
Splits a string of multiple queries into an array of individual queries.
- string $sql: Input SQL string with which to split into individual queries.
Return the most recent error message for the database connector.
- boolean $showSQL: True to display the SQL statement sent to the database as well as the error.
Method to commit a transaction.
- JDatabaseSQLSrv::transactionCommit() : Method to commit a transaction.
- JDatabaseMySQL::transactionCommit() : Method to commit a transaction.
Method to roll back a transaction.
- JDatabaseSQLSrv::transactionRollback() : Method to roll back a transaction.
- JDatabaseMySQL::transactionRollback() : Method to roll back a transaction.
Method to initialize a transaction.
- JDatabaseSQLSrv::transactionStart() : Method to initialize a transaction.
- JDatabaseMySQL::transactionStart() : Method to initialize a transaction.
Method to truncate a table.
- string $table: The table to truncate
Unlocks tables in the database.
- JDatabaseSQLSrv::unlockTables() : Unlocks tables in the database.
- JDatabaseMySQL::unlockTables() : Unlocks tables in the database.
Updates a row in a table based on an object's properties.
- string $table: The name of the database table to update.
- object &$object: A reference to an object whose public properties match the table fields.
- string $key: The name of the primary key.
- boolean $nulls: True to update null fields or false to ignore them.
Magic method to provide method alias support for quote() and quoteName().
- string $method: The called method.
- array $args: The array of arguments passed to the method.
JDatabase (Subpackage Database)
static
static