class AbstractDatabaseDriver implements DatabaseDriverInterface (View source)

Class DatabaseDriver

Methods

__construct(null $connection = null, array $options = array())

Constructor.

resource|object
getConnection()

getConnection

setConnection(resource $connection)

setConnection

resource|false
execute()

Execute the SQL statement.

disconnect()

Disconnects the database.

boolean
select(string $database)

Select a database for use.

string
getVersion()

Get the version of the database connector

freeResult(mixed $cursor = null)

Method to free up the memory used for the result set.

mixed
listDatabases()

getDatabaseList

resource
getCursor()

getCursor

getQuery(boolean $new = false)

Get the current query object or a new Query object.

getTable(string $name, bool $new = false)

getTable

getDatabase(string $name = null, bool $new = false)

getTable

getReader(Query $query = null, bool $new = true)

getReader

getWriter(bool $new = true)

getWriter

getTransaction(boolean $nested = true, bool $new = false)

getWriter

getIterator(string $class = 'stdClass')

getIterator

string
getCurrentDatabase()

Gets the name of the database used by this conneciton.

string
getPrefix()

Get the common table prefix for the database driver.

string
replacePrefix(string $sql, string $prefix = '#__')

This function replaces a string identifier $prefix with the string held is the tablePrefix class variable.

static array
splitSql(string $sql)

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

setDebug(boolean $level)

Sets the database debugging state for the driver.

setQuery(mixed $query)

Sets the SQL statement string for later execution.

mixed
loadAll(string $key = null, string $class = '\\stdClass')

loadAll

mixed
loadOne(string $class = '\\stdClass')

loadOne

mixed
loadResult()

loadResult

mixed
loadColumn()

loadColumn

mixed
quoteName(string $text)

quoteName

mixed
qn(string $text)

qn

string
quote(string $text, bool $escape = true)

quote

string
q(string $text, bool $escape = true)

q

string
escape(string $text, bool $extra = true)

escape

string
e(string $text, bool $extra = true)

e

string
getName()

Method to get property Name

array
getOptions()

Method to get property Options

setOptions(array $options)

Method to set property options

setDatabaseName(string $database)

Method to set property database

addMiddleware(MiddlewareInterface|callable $middleware)

addMiddleware

getMiddlewares()

Method to get property Middlewares

resetMiddlewares()

Method to set property middlewares

string
getLastQuery()

Method to get property LastQuery

Details

at line line 167
__construct(null $connection = null, array $options = array())

Constructor.

Parameters

null $connection The database connection instance.
array $options List of options used to configure the connection

at line line 189
resource|object getConnection()

getConnection

Return Value

resource|object

at line line 201
AbstractDatabaseDriver setConnection(resource $connection)

setConnection

Parameters

resource $connection

Return Value

AbstractDatabaseDriver Return self to support chaining.

at line line 216
resource|false execute()

Execute the SQL statement.

Return Value

resource|false Return Resource to do more or false if query failure.

Exceptions

RuntimeException

at line line 253
abstract AbstractDatabaseDriver connect()

connect

Return Value

AbstractDatabaseDriver

at line line 262
abstract AbstractDatabaseDriver disconnect()

Disconnects the database.

Return Value

AbstractDatabaseDriver

at line line 284
abstract boolean select(string $database)

Select a database for use.

Parameters

string $database The name of the database to select for use.

Return Value

boolean True if the database was successfully selected.

Exceptions

RuntimeException

at line line 293
abstract string getVersion()

Get the version of the database connector

Return Value

string The database connector version.

at line line 304
abstract AbstractDatabaseDriver freeResult(mixed $cursor = null)

Method to free up the memory used for the result set.

Parameters

mixed $cursor The optional result set cursor from which to fetch the row.

Return Value

AbstractDatabaseDriver

at line line 311
abstract mixed listDatabases()

getDatabaseList

Return Value

mixed

at line line 318
resource getCursor()

getCursor

Return Value

resource

at line line 333
Query getQuery(boolean $new = false)

Get the current query object or a new Query object.

Parameters

boolean $new False to return the current query object, True to return a new Query object.

Return Value

Query The current query object or a new object extending the Query class.

Exceptions

RuntimeException

at line line 363
AbstractTable getTable(string $name, bool $new = false)

getTable

Parameters

string $name
bool $new

Return Value

AbstractTable

at line line 383
AbstractDatabase getDatabase(string $name = null, bool $new = false)

getTable

Parameters

string $name
bool $new

Return Value

AbstractDatabase

at line line 410
AbstractReader getReader(Query $query = null, bool $new = true)

getReader

Parameters

Query $query
bool $new

Return Value

AbstractReader

at line line 434
AbstractWriter getWriter(bool $new = true)

getWriter

Parameters

bool $new

Return Value

AbstractWriter

at line line 454
AbstractTransaction getTransaction(boolean $nested = true, bool $new = false)

getWriter

Parameters

boolean $nested
bool $new

Return Value

AbstractTransaction

at line line 473
DataIterator getIterator(string $class = 'stdClass')

getIterator

Parameters

string $class

Return Value

DataIterator

at line line 485
string getCurrentDatabase()

Gets the name of the database used by this conneciton.

Return Value

string

at line line 497
string getPrefix()

Get the common table prefix for the database driver.

Return Value

string The common database table prefix.

at line line 513
string replacePrefix(string $sql, string $prefix = '#__')

This function replaces a string identifier $prefix with the string held is the tablePrefix class variable.

Parameters

string $sql The SQL statement to prepare.
string $prefix The common table prefix.

Return Value

string The processed SQL statement.

at line line 613
static array splitSql(string $sql)

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

Parameters

string $sql Input SQL string with which to split into individual queries.

Return Value

array The queries from the input string separated into an array.

at line line 671
AbstractDatabaseDriver setDebug(boolean $level)

Sets the database debugging state for the driver.

Parameters

boolean $level True to enable debugging.

Return Value

AbstractDatabaseDriver

at line line 687
AbstractDatabaseDriver setQuery(mixed $query)

Sets the SQL statement string for later execution.

Parameters

mixed $query The SQL statement to set either as a Query object or a string.

Return Value

AbstractDatabaseDriver This object to support method chaining.

at line line 702
mixed loadAll(string $key = null, string $class = '\\stdClass')

loadAll

Parameters

string $key
string $class

Return Value

mixed

at line line 724
mixed loadOne(string $class = '\\stdClass')

loadOne

Parameters

string $class

Return Value

mixed

at line line 744
mixed loadResult()

loadResult

Return Value

mixed

at line line 754
mixed loadColumn()

loadColumn

Return Value

mixed

at line line 781
mixed quoteName(string $text)

quoteName

Parameters

string $text

Return Value

mixed

at line line 793
mixed qn(string $text)

qn

Parameters

string $text

Return Value

mixed

at line line 806
string quote(string $text, bool $escape = true)

quote

Parameters

string $text
bool $escape

Return Value

string

at line line 819
string q(string $text, bool $escape = true)

q

Parameters

string $text
bool $escape

Return Value

string

at line line 832
string escape(string $text, bool $extra = true)

escape

Parameters

string $text
bool $extra

Return Value

string

at line line 845
string e(string $text, bool $extra = true)

e

Parameters

string $text
bool $extra

Return Value

string

at line line 855
string getName()

Method to get property Name

Return Value

string

at line line 865
array getOptions()

Method to get property Options

Return Value

array

at line line 877
AbstractDatabaseDriver setOptions(array $options)

Method to set property options

Parameters

array $options

Return Value

AbstractDatabaseDriver Return self to support chaining.

at line line 891
AbstractDatabaseDriver setDatabaseName(string $database)

Method to set property database

Parameters

string $database

Return Value

AbstractDatabaseDriver Return self to support chaining.

at line line 909
AbstractDatabaseDriver addMiddleware(MiddlewareInterface|callable $middleware)

addMiddleware

Parameters

MiddlewareInterface|callable $middleware

Return Value

AbstractDatabaseDriver

at line line 923
ChainBuilder getMiddlewares()

Method to get property Middlewares

Return Value

ChainBuilder

at line line 935
AbstractDatabaseDriver resetMiddlewares()

Method to set property middlewares

Return Value

AbstractDatabaseDriver Return self to support chaining.

at line line 948
string getLastQuery()

Method to get property LastQuery

Return Value

string