JDatabase

API Package Subpackage Class Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage Database Class JDatabase Reference JDatabase Never Work in Progress

Generic database connector class.

An instance of this class is created using the current Joomla! configuration variables when each page is loaded. Therefore you do not generally need to create new instance of this object. A reference to the JDatabase instance can be obtained using the JFactory::getDBO() method.

Joomla! 1.5 works primarily with the MySQL and MySQLi database. If it possible to write adapter classes for other databases that may provide some functionality.

This class is an abstract class and its methods are implemented in the adapter classes.

Methods

Method Description
__construct Constructor for the database class.
addQuoted Adds a field or array of field names to the list that are to be quoted.
BeginTrans ADODB compatability function.
CommitTrans ADODB compatability function.
debug Sets the debug level on or off.
ErrorMsg ADODB compatability function.
ErrorNo ADODB compatability function.
Execute ADODB compatability function.
explain Performs an SQL EXPLAIN on the current SQL query string.
GenID ADODB compatability function.
getAffectedRows Returns the number of rows affected by the most recent query.
GetCol ADODB compatability function.
getCollation Returnss the database collation.
getErrorMsg Returns the most recent database error message.
getErrorNum Returns the most recent database error code.
getEscaped Returns the string in database escaped form.
getInstance Returns a reference to the global Database object, only creating it if it doesn’t already exist.
getNullDate Returns the string to be used to represent a null date.
getNumRows Returns the number of rows returned by a database query.
GetOne ADODB compatability function.
getPrefix Returns the current database table prefix code.
getQuery Returns the current value of the internal SQL query string.
GetRow ADODB compatability function.
getTableCreate Creates one or more tables in the database.
getTableFields Returns a list of fields given a list of tables.
getTableList Returns a list of all the tables in the database.
getUTFSupport Determines if the database supports UTF.
getVersion Returns the version of the database connector.
hasUTF Determines if the database supports UTF.
insertid Returns the unique record number of the last record to be inserted into a database table.
insertObject Inserts an object into a database table.
isQuoted Checks if the field name needs to be quoted.
loadAssoc Fetches a result row as an associative array.
loadAssocList Loads an associative list of database rows.
loadObject Loads an object with fields from the first row returned by the current SQL query.
loadObjectList Returns an array of database objects using the current SQL query.
loadResult Returns the first field of the first row returned by the database query.
loadResultArray Returns an array containing a single field from all the rows returned by the database query.
loadRow Returns the first row of the current query as an array.
loadRowList Returns an array of database rows with numeric column indexing.
nameQuote Quotes an identifier such as a database table name, field name, etc., using database-specific quote marks.
PageExecute ADODB compatability function.
query Executes the current SQL query string.
queryBatch Executes the current SQL query string as a single transaction.
Quote Returns a quoted string with characters escaped.
replacePrefix This function replaces a string identifier $prefix with the string held in the _table_prefix class variable.
RollbackTrans ADODB compatability function.
SelectLimit ADODB compatability function.
setQuery Sets the SQL query string for later execution.
setUTF Sets resource as having UTF support. This method is database dependent.
stderr Returns the last database error message in a standard format.
updateObject Updates a database table row using data contained in an object.