JDatabase

From Joomla! Documentation
(Difference between revisions)
Jump to: navigation, search
(Extended by)
m (bad link repair)
 
(4 intermediate revisions by one user not shown)
Line 1: Line 1:
'''JDatabase''' is an abstract class which is extended by specific database drivers.  It provides database connections for Joomla!
+
This class is available in the following Joomla versions:-
 
+
<splist showpath=notparent />
===Availability===
+
<noinclude>[[Category:Platform JClasses]][[Category:JDatabase]]</noinclude>
{{JVer|1.5}} {{JVer|1.6}}
+
 
+
===Defined in===
+
/libraries/joomla/database/database.php
+
 
+
===Extends===
+
* [[JObject]]
+
 
+
===Extended by===
+
* [[JDatabaseMySQL]]
+
* [[JDatabaseMySQLi]]
+
* [[JDatabaseSQLSrv]]
+
 
+
===Methods===
+
Properties which do not have specific get or set methods listed here can be retrieved or set using the inherited [[JObject/get|JObject->get]] method.
+
{| class="wikitable"
+
|-
+
!Method name
+
!Description
+
|-
+
|[[JDatabase/addQuoted|addQuoted]]
+
|Adds a field or array of field names to the list that are to be quoted.
+
|-
+
|[[JDatabase/BeginTrans|BeginTrans]]
+
|ADODB compatibility function.
+
|-
+
|[[JDatabase/CommitTrans|CommitTrans]]
+
|ADODB compatibility function.
+
|-
+
|[[JDatabase/connected|connected]]
+
|Determines if the connection to the server is active.
+
|-
+
|[[JDatabase/debug|debug]]
+
|Sets the debug level on or off.
+
|-
+
|[[JDatabase/ErrorMsg|ErrorMsg]]
+
|ADODB compatibility function.
+
|-
+
|[[JDatabase/ErrorNo|ErrorNo]]
+
|ADODB compatibility function.
+
|-
+
|[[JDatabase/Execute|Execute]]
+
|ADODB compatibility function.
+
|-
+
|[[JDatabase/explain|explain]]
+
|Diagnostic function.
+
|-
+
|[[JDatabase/GenID|GenID]]
+
|ADODB compatibility function.
+
|-
+
|[[JDatabase/getAffectedRows|getAffectedRows]]
+
|Get the number of rows affected by the most recent query.
+
|-
+
|[[JDatabase/GetCol|GetCol]]
+
|ADODB compatibility function.
+
|-
+
|[[JDatabase/getCollation|getCollation]]
+
|Get the database collation.
+
|-
+
|[[JDatabase/getConnectors|getConnectors]]
+
|Get the database connectors.
+
|-
+
|[[JDatabase/getErrorMsg|getErrorMsg]]
+
| Get the error message.
+
|-
+
|[[JDatabase/getErrorNum|getErrorNum]]
+
|Get the error number.
+
|-
+
|[[JDatabase/getEscaped|getEscaped]]
+
|Get a database escaped string.
+
|-
+
|[[JDatabase/getInstance|getInstance]]
+
|Returns a reference to the global database object, only creating it if it doesn't already exist.
+
|-
+
|[[JDatabase/getLog|getLog]]
+
|Get a database error log.
+
|-
+
|[[JDatabase/getNullDate|getNullDate]]
+
|Get the database null date.
+
|-
+
|[[JDatabase/getNumRows|getNumRows]]
+
|Get the number of rows returned by the most recent query.
+
|-
+
|[[JDatabase/GetOne|GetOne]]
+
|ADODB compatibility function.
+
|-
+
|[[JDatabase/getPrefix|getPrefix]]
+
|Get the database table prefix.
+
|-
+
|[[JDatabase/getQuery|getQuery]]
+
|Get the active query.
+
|-
+
|[[JDatabase/GetRow|GetRow]]
+
|ADODB compatibility function.
+
|-
+
|[[JDatabase/getTableCreate|getTableCreate]]
+
|Shows the CREATE TABLE statement that creates the given tables.
+
|-
+
|[[JDatabase/getTableFields|getTableFields]]
+
|Retrieves information about the given tables.
+
|-
+
|[[JDatabase/getTableList|getTableList]]
+
|Lists tables in a database.
+
|-
+
|[[JDatabase/getTicker|getTicker]]
+
|Get the total number of queries made.
+
|-
+
|[[JDatabase/getUTFSupport|getUTFSupport]]
+
|Get the database UTF-8 support.
+
|-
+
|[[JDatabase/getVersion|getVersion]]
+
|Get the version of the database connector.
+
|-
+
|[[JDatabase/hasUTF|hasUTF]]
+
|Determines UTF support.
+
|-
+
|[[JDatabase/insertid|insertid]]
+
|Gets the ID generated from the previous INSERT operation.
+
|-
+
|[[JDatabase/insertObject|insertObject]]
+
|Inserts a row into a table based on an objects properties.
+
|-
+
|[[JDatabase/isQuoted|isQuoted]]
+
|Checks if field name needs to be quoted.
+
|-
+
|[[JDatabase/loadAssoc|loadAssoc]]
+
|Fetch a result row as an associative array.
+
|-
+
|[[JDatabase/loadAssocList|loadAssocList]]
+
|Loads an associative list of database rows.
+
|-
+
|[[JDatabase/loadObject|loadObject]]
+
|Loads the first row of a query into an object.
+
|-
+
|[[JDatabase/loadObjectList|loadObjectList]]
+
|Loads a list of database objects.
+
|-
+
|[[JDatabase/loadResult|loadResult]]
+
|Loads the first field of the first row returned by the query.
+
|-
+
|[[JDatabase/loadResultArray|loadResultArray]]
+
|Loads an array of single field results into an array.
+
|-
+
|[[JDatabase/loadRow|loadRow]]
+
|Loads the first row returned by the query.
+
|-
+
|[[JDatabase/loadRowList|loadRowList]]
+
|Loads a list of database rows (numeric column indexing).
+
|-
+
|[[JDatabase/nameQuote|nameQuote]]
+
|Quote an identifier name (field, table, etc.).
+
|-
+
|[[JDatabase/PageExecute|PageExecute]]
+
|ADODB compatibility function.
+
|-
+
|[[JDatabase/query|query]]
+
|Execute the query.
+
|-
+
|[[JDatabase/queryBatch|queryBatch]]
+
|Execute a batch query.
+
|-
+
|[[JDatabase/Quote|Quote]]
+
|Get a quoted database escaped string.
+
|-
+
|[[JDatabase/replacePrefix|replacePrefix]]
+
|Replaces a string identifier ''$prefix'' with the string held is the ''_table_prefix'' class variable.
+
|-
+
|[[JDatabase/RollbackTrans|RollbackTrans]]
+
|ADODB compatibility function.
+
|-
+
|[[JDatabase/SelectLimit|SelectLimit]]
+
|ADODB compatibility function.
+
|-
+
|[[JDatabase/setQuery|setQuery]]
+
|Sets the SQL query string for later execution.
+
|-
+
|[[JDatabase/setUTF|setUTF]]
+
|Custom settings for UTF support.
+
|-
+
|[[JDatabase/splitSql|splitSql]]
+
|Splits a string of queries into an array of individual queries.
+
|-
+
|[[JDatabase/stderr|stderr]]
+
|Prints out an error statement.
+
|-
+
|[[JDatabase/test|test]]
+
|Tests to see if the connector is available.
+
|-
+
|[[JDatabase/updateObject|updateObject]]
+
|Updates an object in the database.
+
|}
+
 
+
===Importing===
+
<source lang="php">jimport( 'joomla.database.database' );</source>
+
 
+
===See also===
+
* [[How to use the database classes in your script]]
+
* [http://api.joomla.org/Joomla-Framework/Database/JDatabase.html JDatabase on api.joomla.org]
+
* [[JDatabaseMySQL]]
+
* [[JDatabaseMySQLi]]
+
<noinclude>[[Category:Development]][[Category:Framework]][[Category:JDatabase]]</noinclude>
+

Latest revision as of 13:33, 29 August 2012

This class is available in the following Joomla versions:-

Personal tools
Namespaces

Variants
Actions
Navigation
Joomla! Sites
Toolbox