Abstract Class JDatabase

Description

Database connector class.

  • deprecated: 13.3 (Platform) & 4.0 (CMS)
  • abstract:
  • since: 11.1

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


	
			
Direct descendents
Class Description
Abstract class JDatabaseDriver Joomla Platform Database Driver Class
Method Summary
 static array getConnectors ()
 static JDatabaseDriver getInstance ([array $options = array()])
 static array splitSql (string $query)
 static boolean test ()
 string getErrorMsg ([boolean $escaped = false])
 integer getErrorNum ()
 mixed query ()
 string stderr ([boolean $showSQL = false])
Methods
static getConnectors (line 48)

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.
  • deprecated: 13.1 (Platform) & 4.0 (CMS)
  • since: 11.1
  • access: public
static array getConnectors ()

Redefined in descendants as:
  • JDatabaseDriver::getConnectors() : 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.
static getInstance (line 111)

Method to return a JDatabaseDriver 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 'mysqli'. 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.
  • deprecated: 13.1 (Platform) & 4.0 (CMS)
  • since: 11.1
  • access: public
static JDatabaseDriver getInstance ([array $options = array()])
  • array $options: Parameters to be passed to the database driver.

Redefined in descendants as:
static splitSql (line 128)

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

  • return: The queries from the input string separated into an array.
  • deprecated: 13.1 (Platform) & 4.0 (CMS)
  • since: 11.1
  • access: public
static array splitSql (string $query)
  • string $query: Input SQL string with which to split into individual queries.

Redefined in descendants as:
static test (line 168)

Test to see if the connector is available.

  • return: True on success, false otherwise.
  • deprecated: 12.3 (Platform) & 4.0 (CMS) - Use JDatabaseDriver::isSupported() instead.
  • since: 11.1
  • access: public
static boolean test ()

Redefined in descendants as:
getErrorMsg (line 65)

Gets the error message from the database connection.

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

Gets the error number from the database connection.

  • return: The error number for the most recent query.
  • deprecated: 13.3 (Platform) & 4.0 (CMS)
  • since: 11.1
  • access: public
integer getErrorNum ()
query (line 31)

Execute the SQL statement.

  • return: A database cursor resource on success, boolean false on failure.
  • deprecated: 13.1 (Platform) & 4.0 (CMS)
  • throws: RuntimeException
  • since: 11.1
  • access: public
mixed query ()
stderr (line 145)

Return the most recent error message for the database connector.

  • return: The error message for the most recent query.
  • deprecated: 13.3 (Platform) & 4.0 (CMS)
  • 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.

Documentation generated on Tue, 19 Nov 2013 14:57:48 +0100 by phpDocumentor 1.4.3