JDatabaseDriverOracle
class JDatabaseDriverOracle extends JDatabaseDriverPdo
Oracle database driver
Properties
string | $name | The name of the database driver. | |
string | $serverType | The type of the database server family supported by this driver. |
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.
Gets the error message from the database connection.
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.
Splits a string of multiple queries into an array of individual queries.
Return the most recent error message for the database connector.
Magic method to provide method alias support for quote() and quoteName().
Constructor.
Alter database's character set, obtaining query string from protected member.
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.
Connects to the database if needed.
Create a new database using information from $options object, obtaining query string from protected member.
Disconnects the database.
Adds a function callable just before disconnecting the database. Parameter of the callable is $this JDatabaseDriver
Drops a table from the database.
Method to escape a string for usage in an SQL statement.
Get the number of affected rows for the previous executed SQL statement.
Return the query string to alter the database character set.
Get the query strings to alter the character set and collation of a table.
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.
Method to get the database collation in use by sampling a text field of a table in the database.
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.
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 the total number of SQL statements executed by the database driver.
Returns the current date format This method should be useful in the case that somebody actually wants to use a different date format and needs to check what the current one is to see if it needs to be changed.
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.
Get the name of the database driver. If $this->name is not set it will try guessing the driver name from the class name.
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.
Get the current query object or a new JDatabaseQuery object.
Get a new iterator on the current query.
Retrieves field information about a given table.
Shows the table CREATE statement that creates the given tables.
Get the details list of keys for a table.
Method to get an array of all tables in the database (schema).
Determine whether or not the database engine supports UTF-8 character encoding.
Determine whether or not the database engine supports UTF-8 character encoding.
Determine whether the database engine support the UTF-8 Multibyte (utf8mb4) character encoding. This applies to MySQL databases.
Get the version of the database connector.
Method to get the auto-incremented value from the last INSERT statement.
Inserts a row into a table based on an object's properties.
Method to check whether the installed database version is supported by the database driver
Method to get the first row of the result set from the database query as an associative array of ['fieldname' => 'rowvalue'].
Method to get an array of the result set rows from the database query where each row is an associative array of ['fieldname' => 'rowvalue']. The array of rows can optionally be keyed by a field name, but defaults to a sequential numeric array.
Method to get an array of values from the $offset field in each row of the result set from the database query.
Method to get the next row in the result set from the database query as an 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.
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.
Method to get the first field of the first row of the result set from the database query.
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.
Locks a table in the database.
Quotes and optionally escapes a string to database requirements for use in database queries.
Wrap an SQL statement identifier name such as column, table or database names in quotes to prevent injection risks and reserved word conflicts.
This function replaces a string identifier $prefix with the string held is the tablePrefix class variable.
Renames a table in the database.
Select a database for use.
Sets the database debugging state for the driver.
Sets the SQL statement string for later execution.
Set the connection to use UTF-8 character encoding.
Method to commit a transaction.
Method to roll back a transaction.
Method to initialize a transaction.
Updates a row in a table based on an object's properties.
Unlocks tables in the database.
Get a query to run and verify the database is operational.
Sets an attribute on the PDO database handle.
Test to see if the PDO ODBC connector is available.
Method to get the next row in the result set from the database query as an array.
Sets the Oracle Date Format for the session Default date format for Oracle is = DD-MON-RR The default date format for this driver is: 'RRRR-MM-DD HH24:MI:SS' since it is the format that matches the MySQL one used within most Joomla tables.
Details
static
array
getConnectors()
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.
static
JDatabaseDriver
getInstance(
array $options = array())
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.
static
array
splitSql(
string $sql)
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.
string
stderr(
boolean $showSQL = false)
Return the most recent error message for the database connector.
mixed
__call(
string $method,
array $args)
Magic method to provide method alias support for quote() and quoteName().
string
alterDbCharacterSet(
string $dbName)
Alter database's character set, obtaining query string from protected member.
boolean
alterTableCharacterSet(
string $tableName,
boolean $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.
string
createDatabase(
stdClass $options,
boolean $utf = true)
Create a new database using information from $options object, obtaining query string from protected member.
void
addDisconnectHandler(
callable $callable)
Adds a function callable just before disconnecting the database. Parameter of the callable is $this JDatabaseDriver
JDatabaseDriver
dropTable(
string $tableName,
boolean $ifExists = true)
Drops a table from the database.
Note: The IF EXISTS flag is unused in the Oracle driver.
string
escape(
string $text,
boolean $extra = false)
Method to escape a string for usage in an SQL statement.
Oracle escaping reference: http://www.orafaq.com/wiki/SQLFAQ#HowdoesoneescapespecialcharacterswhenwritingSQLqueries.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.
integer
getAffectedRows()
Get the number of affected rows for the previous executed SQL statement.
Only applicable for DELETE, INSERT, or UPDATE statements.
string
getAlterDbCharacterSet(
string $dbName)
Return the query string to alter the database character set.
string[]
getAlterTableCharacterSet(
string $tableName)
Get the query strings to alter the character set and collation of a table.
string
convertUtf8mb4QueryToUtf8(
string $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.
mixed
getCollation()
Method to get the database collation in use by sampling a text field of a table in the database.
string
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.
resource
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.
string
getDateFormat()
Returns the current date format This method should be useful in the case that somebody actually wants to use a different date format and needs to check what the current one is to see if it needs to be changed.
integer
getNumRows(
resource $cursor = null)
Get the number of returned rows for the previous executed SQL statement.
Only applicable for DELETE, INSERT, or UPDATE statements.
string
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.
string
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.
JDatabaseQuery
getQuery(
boolean $new = false)
Get the current query object or a new JDatabaseQuery object.
JDatabaseIterator
getIterator(
string $column = null,
string $class = 'stdClass')
Get a new iterator on the current query.
array
getTableColumns(
string $table,
boolean $typeOnly = true)
Retrieves field information about a given table.
array
getTableCreate(
mixed $tables)
Shows the table CREATE statement that creates the given tables.
Note: You must have the correct privileges before this method will return usable results!
array
getTableList(
string $databaseName = null,
boolean $includeDatabaseName = false)
Method to get an array of all tables in the database (schema).
boolean
getUTFSupport()
Determine whether or not the database engine supports UTF-8 character encoding.
boolean
hasUTFSupport()
Determine whether or not the database engine supports UTF-8 character encoding.
boolean
hasUTF8mb4Support()
Determine whether the database engine support the UTF-8 Multibyte (utf8mb4) character encoding. This applies to MySQL databases.
boolean
insertObject(
string $table,
object $object,
string $key = null)
Inserts a row into a table based on an object's properties.
boolean
isMinimumVersion()
Method to check whether the installed database version is supported by the database driver
mixed
loadAssoc()
Method to get the first row of the result set from the database query as an associative array of ['fieldname' => 'rowvalue'].
mixed
loadAssocList(
string $key = null,
string $column = null)
Method to get an array of the result set rows from the database query where each row is an associative array of ['fieldname' => 'rowvalue']. 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.
mixed
loadColumn(
integer $offset)
Method to get an array of values from the $offset field in each row of the result set from the database query.
mixed
loadNextObject(
string $class = 'stdClass')
Method to get the next row in the result set from the database query as an object.
mixed
loadNextRow()
Method to get the next row in the result set from the database query as an array.
mixed
loadObject(
string $class = 'stdClass')
Method to get the first row of the result set from the database query as an object.
mixed
loadObjectList(
string $key = '',
string $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.
mixed
loadResult()
Method to get the first field of the first row of the result set from the database query.
mixed
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.
mixed
loadRowList(
integer $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.
string|array
quote(
mixed $text,
boolean $escape = true)
Quotes and optionally escapes a string to database requirements for use in database queries.
mixed
quoteName(
mixed $name,
mixed $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.
string
replacePrefix(
string $query,
string $prefix = '#__')
This function replaces a string identifier $prefix with the string held is the tablePrefix class variable.
JDatabaseDriver
renameTable(
string $oldTable,
string $newTable,
string $backup = null,
string $prefix = null)
Renames a table in the database.
JDatabaseDriver
setQuery(
mixed $query,
integer $offset = null,
integer $limit = null,
array $driverOptions = array())
Sets the SQL statement string for later execution.
boolean
setUtf()
Set the connection to use UTF-8 character encoding.
Returns false automatically for the Oracle driver since you can only set the character set when the connection is created.
boolean
updateObject(
string $table,
object $object,
array $key,
boolean $nulls = false)
Updates a row in a table based on an object's properties.
mixed
getOption(
mixed $key)
Retrieve a PDO database connection attribute
Usage: $db->getOption(PDO::ATTR_CASE);
boolean
setOption(
integer $key,
mixed $value)
Sets an attribute on the PDO database handle.
Usage: $db->setOption(PDO::ATTRCASE, PDO::CASEUPPER);