JDatabase: Difference between revisions
From Joomla! Documentation
m clean up |
m preparing for archive only |
||
| Line 194: | Line 194: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=JDatabase | category=JDatabase | ||
namespace=CodeExample | |||
category=ClassExample | category=ClassExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
Latest revision as of 00:25, 25 March 2017
JDatabase is an abstract class which is extended by specific database drivers. It provides database connections for Joomla.
Defined in
libraries/joomla/database/database.php
Methods
| Method name | Description |
|---|---|
| __construct | Database object constructor |
| getInstance | Returns a reference to the global Database object, only creating it if it doesn't already exist. |
| __destruct | Database object destructor |
| getConnectors | Get the database connectors |
| connected | Determines if the connection to the server is active. |
| hasUTF | Determines UTF support |
| setUTF | Custom settings for UTF support |
| addQuoted | Adds a field or array of field names to the list that are to be quoted |
| splitSql | Splits a string of queries into an array of individual queries |
| isQuoted | Checks if field name needs to be quoted |
| debug | Sets the debug level on or off |
| getUTFSupport | Get the database UTF-8 support |
| getErrorNum | Get the error number |
| getErrorMsg | Get the error message |
| getEscaped | Get a database escaped string |
| getLog | Get a database error log |
| getTicker | Get the total number of queries made |
| nameQuote | Quote an identifier name (field, table, etc) |
| getPrefix | Get the database table prefix |
| getNullDate | Get the database null date |
| setQuery | Sets the SQL query string for later execution. |
| replacePrefix | This function replaces a string identifier $prefix with the string held is the _table_prefix class variable. |
| getQuery | Get the active query |
| query | Execute the query |
| getAffectedRows | Get the affected rows by the most recent query |
| queryBatch | Execute a batch query |
| explain | Diagnostic function |
| getNumRows | Get the number of rows returned by the most recent query |
| loadResult | This method loads the first field of the first row returned by the query. |
| loadResultArray | Load an array of single field results into an array |
| loadAssoc | Fetch a result row as an associative array |
| loadAssocList | Load a associactive list of database rows |
| loadObject | This global function loads the first row of a query into an object |
| loadObjectList | Load a list of database objects |
| loadRow | Load the first row returned by the query |
| loadRowList | Load a list of database rows (numeric column indexing) |
| insertObject | Inserts a row into a table based on an objects properties |
| updateObject | Update an object in the database |
| stderr | Print out an error statement |
| insertid | Get the ID generated from the previous INSERT operation |
| getCollation | Get the database collation |
| getVersion | Get the version of the database connector |
| getTableList | List tables in a database |
| getTableCreate | Shows the CREATE TABLE statement that creates the given tables |
| getTableFields | Retrieves information about the given tables |
| Quote | Get a quoted database escaped string |
| GetCol | ADODB compatability function |
| Execute | ADODB compatability function |
| SelectLimit | ADODB compatability function |
| PageExecute | ADODB compatability function |
| GetRow | ADODB compatability function |
| GetOne | ADODB compatability function |
| BeginTrans | ADODB compatability function |
| RollbackTrans | ADODB compatability function |
| CommitTrans | ADODB compatability function |
| ErrorMsg | ADODB compatability function |
| ErrorNo | ADODB compatability function |
| GenID | ADODB compatability function |
| test | Test to see if the MySQLi connector is available |
Importing
jimport( 'joomla.database.database' );
Examples
Code Examples