Class JDatabase
Database connector class.
Indirect known subclasses
JDatabaseDriverMysql
,
JDatabaseDriverMysqli
,
JDatabaseMysqli
,
JDatabaseSqlazure
,
JDatabaseSqlsrv
,
JDatabaseDriverOracle
,
JDatabaseDriverPdo
,
JDatabaseDriverPdomysql
,
JDatabaseDriverPostgresql
,
JDatabaseDriverSqlazure
,
JDatabaseDriverSqlite
,
JDatabaseDriverSqlsrv
,
JDatabaseMysql
Methods summary
public
mixed
|
#
query( )
Execute the SQL statement.
Execute the SQL statement.
Returns
mixed - A database cursor resource on success, boolean false on failure.
Throws
Since
11.1
|
public static
array
|
#
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.
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.
Returns
array - An array of available database connectors.
Since
11.1
|
public
string
|
#
getErrorMsg( boolean $escaped = false )
Gets the error message from the database connection.
Gets the error message from the database connection.
Parameters
- $escaped
boolean - $escaped True to escape the message string for use in JavaScript.
Returns
string - The error message for the most recent query.
Since
11.1
|
public
integer
|
#
getErrorNum( )
Gets the error number from the database connection.
Gets the error number from the database connection.
Returns
integer - The error number for the most recent query.
Since
11.1
|
public static
JDatabaseDriver
|
#
getInstance( array $options = array() )
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.
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.
Parameters
- $options
array - $options Parameters to be passed to the database driver.
Returns
Since
11.1
|
public static
array
|
#
splitSql( string $query )
Splits a string of multiple queries into an array of individual queries.
Splits a string of multiple queries into an array of individual queries.
Parameters
- $query
string - $query Input SQL string with which to split into individual queries.
Returns
array - The queries from the input string separated into an array.
Since
11.1
|
public
string
|
#
stderr( boolean $showSQL = false )
Return the most recent error message for the database connector.
Return the most recent error message for the database connector.
Parameters
- $showSQL
boolean - $showSQL True to display the SQL statement sent to the database as well as the
error.
Returns
string - The error message for the most recent query.
Since
11.1
|
public static
boolean
|
#
test( )
Test to see if the connector is available.
Test to see if the connector is available.
Returns
boolean - True on success, false otherwise.
Since
11.1
|
Magic methods summary