Class JDatabase

Description

Implements interfaces:

Database connector class.

  • abstract:
  • since: 11.1

Located in /libraries/joomla/database/database.php (line 40)


	
			
Direct descendents
Class Description
JDatabaseMySQL MySQL database driver
JDatabaseSQLSrv SQL Server database driver
Variable Summary
static array $instances
resource $connection
integer $count
resource $cursor
string $dbMinimum
boolean $debug
string $errorMsg
integer $errorNum
boolean $hasQuoted
integer $limit
array $log
string $name
string $nameQuote
string $nullDate
integer $offset
array $quoted
mixed $sql
string $tablePrefix
boolean $utf
string $_database
Method Summary
static array getConnectors ()
static JDatabase getInstance ([array $options = array()])
static array splitSql (string $sql)
JDatabase __construct (array $options)
void addQuoted (mixed $quoted)
boolean connected ()
void debug (integer $level)
JDatabase dropTable (string $table, [boolean $ifExists = true])
string escape (string $text, [boolean $extra = false])
mixed execute ()
string explain ()
mixed fetchArray ([mixed $cursor = null])
mixed fetchAssoc ([mixed $cursor = null])
mixed fetchObject ([mixed $cursor = null], [string $class = 'stdClass'])
void freeResult ([mixed $cursor = null])
integer getAffectedRows ()
mixed getCollation ()
resource getConnection ()
integer getCount ()
string getDatabase ()
string getDateFormat ()
string getErrorMsg ([boolean $escaped = false])
integer getErrorNum ()
string getEscaped (string $text, [boolean $extra = false])
array getLog ()
string getMinimum ()
string getNullDate ()
integer getNumRows ([resource $cursor = null])
string getPrefix ()
JDatabaseQuery getQuery ([boolean $new = false])
array getTableColumns (string $table, [boolean $typeOnly = true])
array getTableCreate (mixed $tables)
array getTableFields (mixed $tables, [boolean $typeOnly = true])
array getTableKeys (mixed $tables)
array getTableList ()
integer getTicker ()
boolean getUTFSupport ()
string getVersion ()
boolean hasUTF ()
integer insertid ()
boolean insertObject (string $table, object &$object, [string $key = null])
boolean isMinimumVersion ()
bool isQuoted (string $field)
mixed loadAssoc ()
mixed loadAssocList ([string $key = null], [string $column = null])
mixed loadColumn ([integer $offset = 0])
mixed loadNextObject ([string $class = 'stdClass'])
mixed loadNextRow ()
mixed loadObject ([string $class = 'stdClass'])
mixed loadObjectList ([string $key = ''], [string $class = 'stdClass'])
mixed loadResult ()
mixed loadResultArray ([integer $offset = 0])
mixed loadRow ()
mixed loadRowList ([string $key = null])
JDatabase lockTable (string $tableName)
string nameQuote (string $name)
mixed query ()
mixed queryBatch ([boolean $abortOnError = true], [boolean $transactionSafe = false])
string quote (string $text, [boolean $escape = true])
mixed quoteName (mixed $name, [mixed $as = null])
string quoteNameStr (array $strArr)
JDatabase renameTable (string $oldTable, string $newTable, [string $backup = null], [string $prefix = null])
string replacePrefix (string $sql, [string $prefix = '#__'])
boolean select (string $database)
boolean setDebug (boolean $level)
JDatabase setQuery (mixed $query, [integer $offset = 0], [integer $limit = 0])
boolean setUTF ()
string stderr ([boolean $showSQL = false])
void truncateTable (string $table)
boolean updateObject (string $table, object &$object, string $key, [boolean $nulls = false])
string __call (string $method, array $args)
Variables
static array $instances = array() (line 166)
  • var: JDatabase instances container.
  • since: 11.1
  • access: protected
resource $connection (line 62)
  • var: The database connection resource.
  • since: 11.1
  • access: protected
integer $count = 0 (line 68)
  • var: The number of SQL statements executed by the database driver.
  • since: 11.1
  • access: protected
resource $cursor (line 74)
  • var: The database connection cursor from the last query.
  • since: 11.1
  • access: protected
string $dbMinimum (line 172)
  • var: The minimum supported database version.
  • since: 12.1
  • access: protected

Redefined in descendants as:
boolean $debug = false (line 80)
  • var: The database driver debugging state.
  • since: 11.1
  • access: protected
string $errorMsg (line 146)
  • var: The database error message
  • deprecated: 12.1
  • since: 11.1
  • access: protected
integer $errorNum = 0 (line 139)
  • var: The database error number
  • deprecated: 12.1
  • since: 11.1
  • access: protected
boolean $hasQuoted = false (line 153)
  • var: If true then there are fields to be quoted for the query.
  • deprecated: 12.1
  • since: 11.1
  • access: protected
integer $limit = 0 (line 86)
  • var: The affected row limit for the current SQL statement.
  • since: 11.1
  • access: protected
array $log = array() (line 92)
  • var: The log of executed SQL statements by the database driver.
  • since: 11.1
  • access: protected
string $name (line 56)

The name of the database driver.

  • since: 11.1
  • access: public

Redefined in descendants as:
string $nameQuote (line 101)
  • var: 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.
  • since: 11.1
  • access: protected

Redefined in descendants as:
  • 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.
  • 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.
string $nullDate (line 108)
  • var: 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.
  • since: 11.1
  • access: protected

Redefined in descendants as:
  • 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.
  • 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.
integer $offset = 0 (line 114)
  • var: The affected row offset to apply for the current SQL statement.
  • since: 11.1
  • access: protected
array $quoted = array() (line 160)
  • var: The fields that are to be quoted.
  • deprecated: 12.1
  • since: 11.1
  • access: protected
mixed $sql (line 120)
  • var: The current SQL statement to execute.
  • since: 11.1
  • access: protected
string $tablePrefix (line 126)
  • var: The common database table prefix.
  • since: 11.1
  • access: protected
boolean $utf = true (line 132)
  • var: True if the database engine supports UTF-8 character encoding.
  • since: 11.1
  • access: protected
string $_database (line 48)

The name of the database.

  • since: 11.4
  • access: private
Methods
static method getConnectors (line 183)

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.

  • return: An array of available database connectors.
  • since: 11.1
  • access: public
static array getConnectors ()
static method getInstance (line 254)

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.

  • return: A database object.
  • since: 11.1
  • access: public
static JDatabase getInstance ([array $options = array()])
  • array $options: Parameters to be passed to the database driver.
static method splitSql (line 366)

Splits a string of multiple queries into an array of individual queries.

  • return: The queries from the input string separated into an array.
  • since: 11.1
  • access: public
static array splitSql (string $sql)
  • string $sql: Input SQL string with which to split into individual queries.
Constructor __construct (line 450)

Constructor.

  • since: 11.1
  • access: protected
JDatabase __construct (array $options)
  • array $options: List of options used to configure the connection

Redefined in descendants as:
addQuoted (line 476)

Adds a field or array of field names to the list that are to be quoted.

  • deprecated: 12.1
  • since: 11.1
  • access: public
void addQuoted (mixed $quoted)
  • mixed $quoted: Field name or array of names.
connected (line 500)

Determines if the connection to the server is active.

  • return: True if connected to the database engine.
  • abstract:
  • since: 11.1
  • access: public
boolean connected ()

Redefined in descendants as:
debug (line 1677)

Sets the debug level on or off

  • deprecated: 12.1
  • since: 11.1
  • access: public
void debug (integer $level)
  • integer $level:
    1. to disable debugging and 1 to enable it.
dropTable (line 513)

Drops a table from the database.

  • return: Returns this object to support chaining.
  • abstract:
  • throws: JDatabaseException
  • since: 11.4
  • access: public
JDatabase dropTable (string $table, [boolean $ifExists = true])
  • string $table: The name of the database table to drop.
  • boolean $ifExists: Optionally specify that the table must exist before it is dropped.

Redefined in descendants as:
escape (line 525)

Method to escape a string for usage in an SQL statement.

  • return: The escaped string.
  • abstract:
  • since: 11.1
  • access: public
string escape (string $text, [boolean $extra = false])
  • string $text: The string to be escaped.
  • boolean $extra: Optional parameter to provide extra escaping.

Redefined in descendants as:
execute (line 1264)

Execute the SQL statement.

  • return: A database cursor resource on success, boolean false on failure.
  • abstract:
  • throws: JDatabaseException
  • since: 12.1
  • access: public
mixed execute ()

Redefined in descendants as:
explain (line 1693)

Diagnostic method to return explain information for a query.

  • return: The explain output.
  • deprecated: 12.1
  • abstract:
  • since: 11.1
  • access: public
string explain ()

Redefined in descendants as:
fetchArray (line 536)

Method to fetch a row from the result set cursor as an array.

  • return: Either the next row from the result set or false if there are no more rows.
  • abstract:
  • since: 11.1
  • access: protected
mixed fetchArray ([mixed $cursor = null])
  • mixed $cursor: The optional result set cursor from which to fetch the row.

Redefined in descendants as:
fetchAssoc (line 547)

Method to fetch a row from the result set cursor as an associative array.

  • return: Either the next row from the result set or false if there are no more rows.
  • abstract:
  • since: 11.1
  • access: protected
mixed fetchAssoc ([mixed $cursor = null])
  • mixed $cursor: The optional result set cursor from which to fetch the row.

Redefined in descendants as:
fetchObject (line 559)

Method to fetch a row from the result set cursor as an object.

  • return: Either the next row from the result set or false if there are no more rows.
  • abstract:
  • since: 11.1
  • access: protected
mixed fetchObject ([mixed $cursor = null], [string $class = 'stdClass'])
  • 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.

Redefined in descendants as:
freeResult (line 570)

Method to free up the memory used for the result set.

  • abstract:
  • since: 11.1
  • access: protected
void freeResult ([mixed $cursor = null])
  • mixed $cursor: The optional result set cursor from which to fetch the row.

Redefined in descendants as:
getAffectedRows (line 579)

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

  • return: The number of affected rows.
  • abstract:
  • since: 11.1
  • access: public
integer getAffectedRows ()

Redefined in descendants as:
getCollation (line 588)

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

  • return: The collation in use by the database or boolean false if not supported.
  • abstract:
  • since: 11.1
  • access: public
mixed getCollation ()

Redefined in descendants as:
getConnection (line 598)

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.

  • return: The underlying database connection resource.
  • since: 11.1
  • access: public
resource getConnection ()
getCount (line 610)

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

  • since: 11.1
  • access: public
integer getCount ()
getDatabase (line 622)

Gets the name of the database used by this conneciton.

  • since: 11.4
  • access: protected
string getDatabase ()
getDateFormat (line 634)

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

  • return: The format string.
  • since: 11.1
  • access: public
string getDateFormat ()
getErrorMsg (line 1705)

Gets the error message from the database connection.

  • return: The error message for the most recent query.
  • deprecated: 12.1
  • since: 11.1
  • access: public
string getErrorMsg ([boolean $escaped = false])
  • boolean $escaped: True to escape the message string for use in JavaScript.
getErrorNum (line 1728)

Gets the error number from the database connection.

  • return: The error number for the most recent query.
  • deprecated: 12.1
  • since: 11.1
  • access: public
integer getErrorNum ()
getEscaped (line 1747)

Method to escape a string for usage in an SQL statement.

  • return: The escaped string.
  • deprecated: 12.1
  • since: 11.1
  • access: public
string getEscaped (string $text, [boolean $extra = false])
  • string $text: The string to be escaped.
  • boolean $extra: Optional parameter to provide extra escaping.
getLog (line 646)

Get the database driver SQL statement log.

  • return: SQL statements executed by the database driver.
  • since: 11.1
  • access: public
array getLog ()
getMinimum (line 658)

Get the minimum supported database version.

  • return: The minimum version number for the database driver.
  • since: 12.1
  • access: public
string getMinimum ()
getNullDate (line 670)

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

  • return: Null or zero representation of a timestamp.
  • since: 11.1
  • access: public
string getNullDate ()
getNumRows (line 684)

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

  • return: The number of returned rows.
  • abstract:
  • since: 11.1
  • access: public
integer getNumRows ([resource $cursor = null])
  • resource $cursor: An optional database cursor resource to extract the row count from.

Redefined in descendants as:
getPrefix (line 693)

Get the common table prefix for the database driver.

  • return: The common database table prefix.
  • since: 11.1
  • access: public
string getPrefix ()
getQuery (line 708)

Get the current query object or a new JDatabaseQuery object.

  • return: The current query object or a new object extending the JDatabaseQuery class.
  • abstract:
  • throws: JDatabaseException
  • since: 11.1
  • access: public
JDatabaseQuery getQuery ([boolean $new = false])
  • boolean $new: False to return the current query object, True to return a new JDatabaseQuery object.

Redefined in descendants as:
getTableColumns (line 721)

Retrieves field information about the given tables.

  • return: An array of fields by table.
  • abstract:
  • throws: JDatabaseException
  • since: 11.1
  • access: public
array getTableColumns (string $table, [boolean $typeOnly = true])
  • string $table: The name of the database table.
  • boolean $typeOnly: True (default) to only return field types.

Redefined in descendants as:
getTableCreate (line 733)

Shows the table CREATE statement that creates the given tables.

  • return: A list of the create SQL for the tables.
  • abstract:
  • throws: JDatabaseException
  • since: 11.1
  • access: public
array getTableCreate (mixed $tables)
  • mixed $tables: A table name or a list of table names.

Redefined in descendants as:
getTableFields (line 1767)

Retrieves field information about the given tables.

  • return: An array of fields by table.
  • deprecated: 12.1
  • throws: JDatabaseException
  • since: 11.1
  • access: public
array getTableFields (mixed $tables, [boolean $typeOnly = true])
  • mixed $tables: A table name or a list of table names.
  • boolean $typeOnly: True to only return field types.
getTableKeys (line 745)

Retrieves field information about the given tables.

  • return: An array of keys for the table(s).
  • abstract:
  • throws: JDatabaseException
  • since: 11.1
  • access: public
array getTableKeys (mixed $tables)
  • mixed $tables: A table name or a list of table names.

Redefined in descendants as:
getTableList (line 755)

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

  • return: An array of all the tables in the database.
  • abstract:
  • throws: JDatabaseException
  • since: 11.1
  • access: public
array getTableList ()

Redefined in descendants as:
getTicker (line 1792)

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

  • deprecated: 12.1
  • since: 11.1
  • access: public
integer getTicker ()
getUTFSupport (line 764)

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

  • return: True if the database engine supports UTF-8 character encoding.
  • since: 11.1
  • access: public
boolean getUTFSupport ()
getVersion (line 776)

Get the version of the database connector

  • return: The database connector version.
  • abstract:
  • since: 11.1
  • access: public
string getVersion ()

Redefined in descendants as:
hasUTF (line 787)

Determines if the database engine supports UTF-8 character encoding.

  • return: True if supported.
  • deprecated: 12.1
  • abstract:
  • since: 11.1
  • access: public
boolean hasUTF ()

Redefined in descendants as:
insertid (line 796)

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

  • return: The value of the auto-increment field from the last inserted row.
  • abstract:
  • since: 11.1
  • access: public
integer insertid ()

Redefined in descendants as:
insertObject (line 810)

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

  • return: True on success.
  • since: 11.1
  • throws: JDatabaseException
  • access: public
boolean insertObject (string $table, object &$object, [string $key = null])
  • 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.

Redefined in descendants as:
isMinimumVersion (line 863)

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

  • return: True if the database version is supported
  • since: 12.1
  • access: public
boolean isMinimumVersion ()
isQuoted (line 1810)

Checks if field name needs to be quoted.

  • deprecated: 12.1
  • since: 11.1
  • access: public
bool isQuoted (string $field)
  • string $field: The field name to be checked.
loadAssoc (line 877)

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

  • return: The return value or null if the query failed.
  • since: 11.1
  • throws: JDatabaseException
  • access: public
mixed loadAssoc ()
loadAssocList (line 917)

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.

  • return: The return value or null if the query failed.
  • since: 11.1
  • throws: JDatabaseException
  • access: public
mixed loadAssocList ([string $key = null], [string $column = null])
  • 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.
loadColumn (line 959)

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

  • return: The return value or null if the query failed.
  • since: 11.1
  • throws: JDatabaseException
  • access: public
mixed loadColumn ([integer $offset = 0])
  • integer $offset: The row offset to use to build the result array.
loadNextObject (line 992)

Method to get the next row in the result set from the database query as an object.

  • return: The result of the query as an array, false if there are no more rows.
  • since: 11.1
  • throws: JDatabaseException
  • access: public
mixed loadNextObject ([string $class = 'stdClass'])
  • string $class: The class name to use for the returned row object.
loadNextRow (line 1023)

Method to get the next row in the result set from the database query as an array.

  • return: The result of the query as an array, false if there are no more rows.
  • since: 11.1
  • throws: JDatabaseException
  • access: public
mixed loadNextRow ()
loadObject (line 1056)

Method to get the first row of the result set from the database query as an object.

  • return: The return value or null if the query failed.
  • since: 11.1
  • throws: JDatabaseException
  • access: public
mixed loadObject ([string $class = 'stdClass'])
  • string $class: The class name to use for the returned row object.
loadObjectList (line 1094)

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.

  • return: The return value or null if the query failed.
  • since: 11.1
  • throws: JDatabaseException
  • access: public
mixed loadObjectList ([string $key = ''], [string $class = 'stdClass'])
  • 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.
loadResult (line 1132)

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

  • return: The return value or null if the query failed.
  • since: 11.1
  • throws: JDatabaseException
  • access: public
mixed loadResult ()

Redefined in descendants as:
loadResultArray (line 1837)

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

  • return: The return value or null if the query failed.
  • deprecated: 12.1
  • throws: JDatabaseException
  • since: 11.1
  • access: public
mixed loadResultArray ([integer $offset = 0])
  • integer $offset: The row offset to use to build the result array.
loadRow (line 1164)

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.

  • return: The return value or null if the query failed.
  • since: 11.1
  • throws: JDatabaseException
  • access: public
mixed loadRow ()
loadRowList (line 1201)

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.

  • return: The return value or null if the query failed.
  • since: 11.1
  • throws: JDatabaseException
  • access: public
mixed loadRowList ([string $key = null])
  • string $key: The name of a field on which to key the result array.
lockTable (line 1241)

Locks a table in the database.

  • return: Returns this object to support chaining.
  • abstract:
  • throws: JDatabaseException
  • since: 11.4
  • access: public
JDatabase lockTable (string $tableName)
  • string $tableName: The name of the table to unlock.

Redefined in descendants as:
nameQuote (line 1856)

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

  • return: The quote wrapped name.
  • deprecated: 12.1
  • since: 11.1
  • access: public
string nameQuote (string $name)
  • string $name: The identifier name to wrap in quotes.
query (line 1251)

Execute the SQL statement.

  • return: A database cursor resource on success, boolean false on failure.
  • since: 11.1
  • throws: JDatabaseException
  • access: public
mixed query ()
queryBatch (line 1875)

Execute a query batch.

  • return: A database resource if successful, false if not.
  • deprecated: 12.1
  • abstract:
  • since: 11.1
  • access: public
mixed queryBatch ([boolean $abortOnError = true], [boolean $transactionSafe = false])
  • boolean $abortOnError: Abort on error.
  • boolean $transactionSafe: Transaction safe queries.

Redefined in descendants as:
quote (line 1276)

Method to quote and optionally escape a string to database requirements for insertion into the database.

  • return: The quoted input string.
  • since: 11.1
  • access: public
string quote (string $text, [boolean $escape = true])
  • string $text: The string to quote.
  • boolean $escape: True (default) to escape the string, false to leave it unchanged.

Redefined in descendants as:
  • JDatabaseSQLSrv::quote() : Method to quote and optionally escape a string to database requirements for insertion into the database.
quoteName (line 1294)

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

  • return: The quote wrapped name, same type of $name.
  • since: 11.1
  • access: public
mixed quoteName (mixed $name, [mixed $as = null])
  • 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.
quoteNameStr (line 1341)

Quote strings coming from quoteName call.

  • return: Dot-imploded string of quoted parts.
  • since: 11.3
  • access: protected
string quoteNameStr (array $strArr)
  • array $strArr: Array of strings coming from quoteName dot-explosion.
renameTable (line 1474)

Renames a table in the database.

  • return: Returns this object to support chaining.
  • abstract:
  • throws: JDatabaseException
  • since: 11.4
  • access: public
JDatabase renameTable (string $oldTable, string $newTable, [string $backup = null], [string $prefix = null])
  • 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

Redefined in descendants as:
replacePrefix (line 1377)

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

  • return: The processed SQL statement.
  • since: 11.1
  • access: public
string replacePrefix (string $sql, [string $prefix = '#__'])
  • string $sql: The SQL statement to prepare.
  • string $prefix: The common table prefix.

Redefined in descendants as:
select (line 1486)

Select a database for use.

  • return: True if the database was successfully selected.
  • abstract:
  • throws: JDatabaseException
  • since: 11.1
  • access: public
boolean select (string $database)
  • string $database: The name of the database to select for use.

Redefined in descendants as:
setDebug (line 1497)

Sets the database debugging state for the driver.

  • return: The old debugging level.
  • since: 11.1
  • access: public
boolean setDebug (boolean $level)
  • boolean $level: True to enable debugging.
setQuery (line 1516)

Sets the SQL statement string for later execution.

  • return: This object to support method chaining.
  • since: 11.1
  • access: public
JDatabase setQuery (mixed $query, [integer $offset = 0], [integer $limit = 0])
  • 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.
setUTF (line 1532)

Set the connection to use UTF-8 character encoding.

  • return: True on success.
  • abstract:
  • since: 11.1
  • access: public
boolean setUTF ()

Redefined in descendants as:
stderr (line 1887)

Return the most recent error message for the database connector.

  • return: The error message for the most recent query.
  • deprecated: 12.1
  • since: 11.1
  • access: public
string stderr ([boolean $showSQL = false])
  • boolean $showSQL: True to display the SQL statement sent to the database as well as the error.
transactionCommit (line 1542)

Method to commit a transaction.

  • abstract:
  • throws: JDatabaseException
  • since: 11.1
  • access: public
void transactionCommit ()

Redefined in descendants as:
transactionRollback (line 1552)

Method to roll back a transaction.

  • abstract:
  • throws: JDatabaseException
  • since: 11.1
  • access: public
void transactionRollback ()

Redefined in descendants as:
transactionStart (line 1562)

Method to initialize a transaction.

  • abstract:
  • throws: JDatabaseException
  • since: 11.1
  • access: public
void transactionStart ()

Redefined in descendants as:
truncateTable (line 1574)

Method to truncate a table.

  • since: 11.3
  • throws: JDatabaseException
  • access: public
void truncateTable (string $table)
  • string $table: The table to truncate
unlockTables (line 1661)

Unlocks tables in the database.

  • return: Returns this object to support chaining.
  • abstract:
  • throws: JDatabaseException
  • since: 11.4
  • access: public
JDatabase unlockTables ()

Redefined in descendants as:
updateObject (line 1593)

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

  • return: True on success.
  • since: 11.1
  • throws: JDatabaseException
  • access: public
boolean updateObject (string $table, object &$object, string $key, [boolean $nulls = false])
  • 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.
__call (line 424)

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

  • return: The aliased method's return value or null.
  • since: 11.1
  • access: public
string __call (string $method, array $args)
  • string $method: The called method.
  • array $args: The array of arguments passed to the method.

Documentation generated on Mon, 25 Jun 2012 13:53:59 -0500 by phpDocumentor 1.4.4