Actions

API17

Difference between revisions of "JDatabase"

From Joomla! Documentation

(Updated to r1448:247ba8d88526)
m (moving preparation)
 
(3 intermediate revisions by one user not shown)
Line 14: Line 14:
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::__call/11.1|__call]]
+
|[[API17:JDatabase::__call|__call]]
 
|Magic method to provide method alias support for  and .  
 
|Magic method to provide method alias support for  and .  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::addQuoted/11.1|addQuoted]]
+
|[[API17:JDatabase::addQuoted|addQuoted]]
 
|Adds a field or array of field names to the list that are to be quoted.  
 
|Adds a field or array of field names to the list that are to be quoted.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::connected/11.1|connected]]
+
|[[API17:JDatabase::connected|connected]]
 
|Determines if the connection to the server is active.  
 
|Determines if the connection to the server is active.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::dateToString/11.1|dateToString]]
+
|[[API17:JDatabase::dateToString|dateToString]]
 
|Method to get a  object represented as a datetime string in a format recognized by the database server.  
 
|Method to get a  object represented as a datetime string in a format recognized by the database server.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::debug/11.1|debug]]
+
|[[API17:JDatabase::debug|debug]]
 
|Sets the debug level on or off.  
 
|Sets the debug level on or off.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::explain/11.1|explain]]
+
|[[API17:JDatabase::explain|explain]]
 
|Diagnostic method to return explain information for a query.  
 
|Diagnostic method to return explain information for a query.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::getAffectedRows/11.1|getAffectedRows]]
+
|[[API17:JDatabase::getAffectedRows|getAffectedRows]]
 
|Get the number of affected rows for the previous executed SQL statement.  
 
|Get the number of affected rows for the previous executed SQL statement.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::getCollation/11.1|getCollation]]
+
|[[API17:JDatabase::getCollation|getCollation]]
 
|Method to get the database collation in use by sampling a text field of a table in the database.  
 
|Method to get the database collation in use by sampling a text field of a table in the database.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::getConnection/11.1|getConnection]]
+
|[[API17:JDatabase::getConnection|getConnection]]
 
|Method that provides access to the underlying database connection.  
 
|Method that provides access to the underlying database connection.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::getCount/11.1|getCount]]
+
|[[API17:JDatabase::getCount|getCount]]
 
|Get the total number of SQL statements executed by the database driver.  
 
|Get the total number of SQL statements executed by the database driver.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::getErrorMsg/11.1|getErrorMsg]]
+
|[[API17:JDatabase::getErrorMsg|getErrorMsg]]
 
|Gets the error message from the database connection.  
 
|Gets the error message from the database connection.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::getErrorNum/11.1|getErrorNum]]
+
|[[API17:JDatabase::getErrorNum|getErrorNum]]
 
|Gets the error number from the database connection.  
 
|Gets the error number from the database connection.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::getEscaped/11.1|getEscaped]]
+
|[[API17:JDatabase::getEscaped|getEscaped]]
 
|Method to escape a string for usage in an SQL statement.  
 
|Method to escape a string for usage in an SQL statement.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::getLog/11.1|getLog]]
+
|[[API17:JDatabase::getLog|getLog]]
 
|Get the database driver SQL statement log.  
 
|Get the database driver SQL statement log.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::getNullDate/11.1|getNullDate]]
+
|[[API17:JDatabase::getNullDate|getNullDate]]
 
|Get the null or zero representation of a timestamp for the database driver.  
 
|Get the null or zero representation of a timestamp for the database driver.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::getNumRows/11.1|getNumRows]]
+
|[[API17:JDatabase::getNumRows|getNumRows]]
 
|Get the number of returned rows for the previous executed SQL statement.  
 
|Get the number of returned rows for the previous executed SQL statement.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::getPrefix/11.1|getPrefix]]
+
|[[API17:JDatabase::getPrefix|getPrefix]]
 
|Get the common table prefix for the database driver.  
 
|Get the common table prefix for the database driver.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::getQuery/11.1|getQuery]]
+
|[[API17:JDatabase::getQuery|getQuery]]
 
|Get the current or query, or new  object.  
 
|Get the current or query, or new  object.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::getTableCreate/11.1|getTableCreate]]
+
|[[API17:JDatabase::getTableCreate|getTableCreate]]
 
|Shows the table CREATE statement that creates the given tables.  
 
|Shows the table CREATE statement that creates the given tables.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::getTableFields/11.1|getTableFields]]
+
|[[API17:JDatabase::getTableFields|getTableFields]]
 
|Retrieves field information about the given tables.  
 
|Retrieves field information about the given tables.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::getTableList/11.1|getTableList]]
+
|[[API17:JDatabase::getTableList|getTableList]]
 
|Method to get an array of all tables in the database.  
 
|Method to get an array of all tables in the database.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::getTicker/11.1|getTicker]]
+
|[[API17:JDatabase::getTicker|getTicker]]
 
|Get the total number of SQL statements executed by the database driver.  
 
|Get the total number of SQL statements executed by the database driver.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::getUTFSupport/11.1|getUTFSupport]]
+
|[[API17:JDatabase::getUTFSupport|getUTFSupport]]
 
|Determine whether or not the database engine supports UTF-8 character encoding.  
 
|Determine whether or not the database engine supports UTF-8 character encoding.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::getVersion/11.1|getVersion]]
+
|[[API17:JDatabase::getVersion|getVersion]]
 
|Get the version of the database connector.  
 
|Get the version of the database connector.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::hasUTF/11.1|hasUTF]]
+
|[[API17:JDatabase::hasUTF|hasUTF]]
 
|Determines if the database engine supports UTF-8 character encoding.  
 
|Determines if the database engine supports UTF-8 character encoding.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::insertid/11.1|insertid]]
+
|[[API17:JDatabase::insertid|insertid]]
 
|Method to get the auto-incremented value from the last INSERT statement.  
 
|Method to get the auto-incremented value from the last INSERT statement.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::insertObject/11.1|insertObject]]
+
|[[API17:JDatabase::insertObject|insertObject]]
 
|Inserts a row into a table based on an object's properties.  
 
|Inserts a row into a table based on an object's properties.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::isQuoted/11.1|isQuoted]]
+
|[[API17:JDatabase::isQuoted|isQuoted]]
 
|Checks if field name needs to be quoted.  
 
|Checks if field name needs to be quoted.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::loadAssoc/11.1|loadAssoc]]
+
|[[API17:JDatabase::loadAssoc|loadAssoc]]
 
|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 the first row of the result set from the database query as an associative array of ['field_name' => 'row_value'].  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::loadAssocList/11.1|loadAssocList]]
+
|[[API17:JDatabase::loadAssocList|loadAssocList]]
 
|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'].  
 
|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'].  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::loadNextObject/11.1|loadNextObject]]
+
|[[API17:JDatabase::loadNextObject|loadNextObject]]
 
|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 object.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::loadNextRow/11.1|loadNextRow]]
+
|[[API17:JDatabase::loadNextRow|loadNextRow]]
 
|Method to get the next row in the result set from the database query as an array.  
 
|Method to get the next row in the result set from the database query as an array.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::loadObject/11.1|loadObject]]
+
|[[API17:JDatabase::loadObject|loadObject]]
 
|Method to get the first row of the result set from the database query as an object.  
 
|Method to get the first row of the result set from the database query as an object.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::loadObjectList/11.1|loadObjectList]]
+
|[[API17:JDatabase::loadObjectList|loadObjectList]]
 
|Method to get an array of the result set rows from the database query where each row is an object.  
 
|Method to get an array of the result set rows from the database query where each row is an object.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::loadResult/11.1|loadResult]]
+
|[[API17:JDatabase::loadResult|loadResult]]
 
|Method to get the first field of the first row of the result set from the database query.  
 
|Method to get the first field of the first row of the result set from the database query.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::loadResultArray/11.1|loadResultArray]]
+
|[[API17:JDatabase::loadResultArray|loadResultArray]]
 
|Method to get an array of values from the  field in each row of the result set from the database query.  
 
|Method to get an array of values from the  field in each row of the result set from the database query.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::loadRow/11.1|loadRow]]
+
|[[API17:JDatabase::loadRow|loadRow]]
 
|Method to get the first row of 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 array.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::loadRowList/11.1|loadRowList]]
+
|[[API17:JDatabase::loadRowList|loadRowList]]
 
|Method to get an array of the result set rows from the database query where each row is an array.  
 
|Method to get an array of the result set rows from the database query where each row is an array.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::nameQuote/11.1|nameQuote]]
+
|[[API17:JDatabase::nameQuote|nameQuote]]
 
|Wrap an SQL statement identifier name such as field, table or database names in quotes to prevent injection risks and reserved word conflicts.  
 
|Wrap an SQL statement identifier name such as field, table or database names in quotes to prevent injection risks and reserved word conflicts.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::query/11.1|query]]
+
|[[API17:JDatabase::query|query]]
 
|Execute the SQL statement.  
 
|Execute the SQL statement.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::queryBatch/11.1|queryBatch]]
+
|[[API17:JDatabase::queryBatch|queryBatch]]
 
|Execute a query batch.  
 
|Execute a query batch.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::quote/11.1|quote]]
+
|[[API17:JDatabase::quote|quote]]
 
|Method to quote and optionally escape a string to database requirements for insertion into the database.  
 
|Method to quote and optionally escape a string to database requirements for insertion into the database.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::select/11.1|select]]
+
|[[API17:JDatabase::select|select]]
 
|Select a database for use.  
 
|Select a database for use.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::setDebug/11.1|setDebug]]
+
|[[API17:JDatabase::setDebug|setDebug]]
 
|Sets the database debugging state for the driver.  
 
|Sets the database debugging state for the driver.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::setQuery/11.1|setQuery]]
+
|[[API17:JDatabase::setQuery|setQuery]]
 
|Sets the SQL statement string for later execution.  
 
|Sets the SQL statement string for later execution.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::setUTF/11.1|setUTF]]
+
|[[API17:JDatabase::setUTF|setUTF]]
 
|Set the connection to use UTF-8 character encoding.  
 
|Set the connection to use UTF-8 character encoding.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::stderr/11.1|stderr]]
+
|[[API17:JDatabase::stderr|stderr]]
 
|Return the most recent error message for the database connector.  
 
|Return the most recent error message for the database connector.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::transactionCommit/11.1|transactionCommit]]
+
|[[API17:JDatabase::transactionCommit|transactionCommit]]
 
|Method to commit a transaction.  
 
|Method to commit a transaction.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::transactionRollback/11.1|transactionRollback]]
+
|[[API17:JDatabase::transactionRollback|transactionRollback]]
 
|Method to roll back a transaction.  
 
|Method to roll back a transaction.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::transactionStart/11.1|transactionStart]]
+
|[[API17:JDatabase::transactionStart|transactionStart]]
 
|Method to initialize a transaction.  
 
|Method to initialize a transaction.  
 
|-
 
|-
 
|public  
 
|public  
|[[JDatabase::updateObject/11.1|updateObject]]
+
|[[API17:JDatabase::updateObject|updateObject]]
 
|Updates a row in a table based on an object's properties.  
 
|Updates a row in a table based on an object's properties.  
 
|-
 
|-
 
|public static  
 
|public static  
|[[JDatabase::getConnectors/11.1|getConnectors]]
+
|[[API17:JDatabase::getConnectors|getConnectors]]
 
|Get a list of available database connectors.  
 
|Get a list of available database connectors.  
 
|-
 
|-
 
|public static  
 
|public static  
|[[JDatabase::getInstance/11.1|getInstance]]
+
|[[API17:JDatabase::getInstance|getInstance]]
 
|Method to return a  instance based on the given options.  
 
|Method to return a  instance based on the given options.  
 
|-
 
|-
 
|public static  
 
|public static  
|[[JDatabase::splitSql/11.1|splitSql]]
+
|[[API17:JDatabase::splitSql|splitSql]]
 
|Splits a string of multiple queries into an array of individual queries.  
 
|Splits a string of multiple queries into an array of individual queries.  
 
|-
 
|-
 
|public static  
 
|public static  
|[[JDatabase::test/11.1|test]]
+
|[[API17:JDatabase::test|test]]
 
|Test to see if the connector is available.  
 
|Test to see if the connector is available.  
 
|-
 
|-
 
|protected  
 
|protected  
|[[JDatabase::__construct/11.1|__construct]]
+
|[[API17:JDatabase::__construct|__construct]]
 
|Constructor.  
 
|Constructor.  
 
|-
 
|-
 
|protected  
 
|protected  
|[[JDatabase::fetchArray/11.1|fetchArray]]
+
|[[API17:JDatabase::fetchArray|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 array.  
 
|-
 
|-
 
|protected  
 
|protected  
|[[JDatabase::fetchAssoc/11.1|fetchAssoc]]
+
|[[API17:JDatabase::fetchAssoc|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 associative array.  
 
|-
 
|-
 
|protected  
 
|protected  
|[[JDatabase::fetchObject/11.1|fetchObject]]
+
|[[API17:JDatabase::fetchObject|fetchObject]]
 
|Method to fetch a row from the result set cursor as an object.  
 
|Method to fetch a row from the result set cursor as an object.  
 
|-
 
|-
 
|protected  
 
|protected  
|[[JDatabase::freeResult/11.1|freeResult]]
+
|[[API17:JDatabase::freeResult|freeResult]]
 
|Method to free up the memory used for the result set.  
 
|Method to free up the memory used for the result set.  
 
|-
 
|-
 
|protected  
 
|protected  
|[[JDatabase::replacePrefix/11.1|replacePrefix]]
+
|[[API17:JDatabase::replacePrefix|replacePrefix]]
 
|This function replaces a string identifier  with the string held is the  class variable.  
 
|This function replaces a string identifier  with the string held is the  class variable.  
 
|-
 
|-
Line 260: Line 260:
 
* '''Defined in''' libraries/joomla/database/database.php
 
* '''Defined in''' libraries/joomla/database/database.php
 
* '''Extended by'''
 
* '''Extended by'''
** [[JDatabaseMySQL/11.1|JDatabaseMySQL]]
+
** [[API17:JDatabaseMySQL|JDatabaseMySQL]]
** [[JDatabaseMySQLi/11.1|JDatabaseMySQLi]]
+
** [[API17:JDatabaseMySQLi|JDatabaseMySQLi]]
** [[JDatabaseSQLAzure/11.1|JDatabaseSQLAzure]]
+
** [[API17:JDatabaseSQLAzure|JDatabaseSQLAzure]]
** [[JDatabaseSQLSrv/11.1|JDatabaseSQLSrv]]
+
** [[API17:JDatabaseSQLSrv|JDatabaseSQLSrv]]
 
===Importing===
 
===Importing===
 
<source lang="php">jimport( 'joomla.database.database' );</source>
 
<source lang="php">jimport( 'joomla.database.database' );</source>
 
===See also===
 
===See also===
 
* {{JVer|11.1}} '''JDatabase source code''' on [[jplatform:database/database.php|BitBucket]]
 
* {{JVer|11.1}} '''JDatabase source code''' on [[jplatform:database/database.php|BitBucket]]
* {{JVer|11.1}} Subpackage [[Subpackage Database/11.1|Database]]
+
* {{JVer|11.1}} Subpackage [[API17:Subpackage Database|Database]]
* [[JDatabase|Other versions of JDatabase]]
+
* [[API17:JDatabase|Other versions of JDatabase]]
 
{{SeeAlso:JDatabase}}
 
{{SeeAlso:JDatabase}}
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
Line 285: Line 285:
 
format= ,,,
 
format= ,,,
 
</dpl>
 
</dpl>
<noinclude>[[Category:Platform]][[Category:Platform 11.1]][[Category:JDatabase]]</noinclude>
+
<noinclude>[[Category:Platform 11.1]][[Category:Archived pages API17]]</noinclude>

Latest revision as of 20:00, 11 May 2013

Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Joomla 11.1 JDatabase

Description

JDatabase is an abstract class which is extended by specific database drivers. It provides database connections for Joomla. [Edit Descripton]

Methods

Visibility Method name Description
public __call Magic method to provide method alias support for and .
public addQuoted Adds a field or array of field names to the list that are to be quoted.
public connected Determines if the connection to the server is active.
public dateToString Method to get a object represented as a datetime string in a format recognized by the database server.
public debug Sets the debug level on or off.
public explain Diagnostic method to return explain information for a query.
public getAffectedRows Get the number of affected rows for the previous executed SQL statement.
public getCollation Method to get the database collation in use by sampling a text field of a table in the database.
public getConnection Method that provides access to the underlying database connection.
public getCount Get the total number of SQL statements executed by the database driver.
public getErrorMsg Gets the error message from the database connection.
public getErrorNum Gets the error number from the database connection.
public getEscaped Method to escape a string for usage in an SQL statement.
public getLog Get the database driver SQL statement log.
public getNullDate Get the null or zero representation of a timestamp for the database driver.
public getNumRows Get the number of returned rows for the previous executed SQL statement.
public getPrefix Get the common table prefix for the database driver.
public getQuery Get the current or query, or new object.
public getTableCreate Shows the table CREATE statement that creates the given tables.
public getTableFields Retrieves field information about the given tables.
public getTableList Method to get an array of all tables in the database.
public getTicker Get the total number of SQL statements executed by the database driver.
public getUTFSupport Determine whether or not the database engine supports UTF-8 character encoding.
public getVersion Get the version of the database connector.
public hasUTF Determines if the database engine supports UTF-8 character encoding.
public insertid Method to get the auto-incremented value from the last INSERT statement.
public insertObject Inserts a row into a table based on an object's properties.
public isQuoted Checks if field name needs to be quoted.
public loadAssoc Method to get the first row of the result set from the database query as an associative array of ['field_name' => 'row_value'].
public loadAssocList 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'].
public loadNextObject Method to get the next row in the result set from the database query as an object.
public loadNextRow Method to get the next row in the result set from the database query as an array.
public loadObject Method to get the first row of the result set from the database query as an object.
public loadObjectList Method to get an array of the result set rows from the database query where each row is an object.
public loadResult Method to get the first field of the first row of the result set from the database query.
public loadResultArray Method to get an array of values from the field in each row of the result set from the database query.
public loadRow Method to get the first row of the result set from the database query as an array.
public loadRowList Method to get an array of the result set rows from the database query where each row is an array.
public nameQuote Wrap an SQL statement identifier name such as field, table or database names in quotes to prevent injection risks and reserved word conflicts.
public query Execute the SQL statement.
public queryBatch Execute a query batch.
public quote Method to quote and optionally escape a string to database requirements for insertion into the database.
public select Select a database for use.
public setDebug Sets the database debugging state for the driver.
public setQuery Sets the SQL statement string for later execution.
public setUTF Set the connection to use UTF-8 character encoding.
public stderr Return the most recent error message for the database connector.
public transactionCommit Method to commit a transaction.
public transactionRollback Method to roll back a transaction.
public transactionStart Method to initialize a transaction.
public updateObject Updates a row in a table based on an object's properties.
public static getConnectors Get a list of available database connectors.
public static getInstance Method to return a instance based on the given options.
public static splitSql Splits a string of multiple queries into an array of individual queries.
public static test Test to see if the connector is available.
protected __construct Constructor.
protected fetchArray Method to fetch a row from the result set cursor as an array.
protected fetchAssoc Method to fetch a row from the result set cursor as an associative array.
protected fetchObject Method to fetch a row from the result set cursor as an object.
protected freeResult Method to free up the memory used for the result set.
protected replacePrefix This function replaces a string identifier with the string held is the class variable.

Importing

jimport( 'joomla.database.database' );

See also

[Edit See Also]

User contributed notes

<CodeExamplesForm />