DBConnector
abstract class DBConnector (View source)
Represents an object responsible for wrapping DB connector api
Traits
Provides extensions to this object to integrate it with standard config API methods.
Properties
static private array | $write_operations | List of operations to treat as write Implicitly includes all ddl_operations |
|
static private array | $ddl_operations | List of operations to treat as DDL |
Methods
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
Gets the uninherited value for the given config option
Determine if this SQL statement is a destructive operation (write or ddl)
Determine if this SQL statement is a DDL operation
Determine if this SQL statement is a write operation (alters content but not structure)
Link this connector to the database given the specified parameters Will throw an exception rather than return a success state.
Query for the version of the currently connected database
Given a value escape this for use in a query for the current database connector. Note that this does not quote the value.
Given a value escape and quote this appropriately for the current database connector.
Executes the following query with the specified error level.
Execute the given SQL parameterised query with the specified arguments
Select a database by name
Retrieves the name of the currently selected database
De-selects the currently selected database
Retrieves the last error generated from the database connection
Determines the last ID generated from the specified table.
Determines the number of affected rows from the last SQL query
Determines if we are connected to a server AND have a valid database selected.
Details
static Config_ForClass
config()
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
mixed
stat(string $name)
deprecated
deprecated
Get inherited config value
mixed
uninherited(string $name)
Gets the uninherited value for the given config option
$this
set_stat(string $name, mixed $value)
deprecated
deprecated
Update the config value for a given property
bool
isQueryMutable(string $sql)
Determine if this SQL statement is a destructive operation (write or ddl)
bool
isQueryDDL(string $sql)
Determine if this SQL statement is a DDL operation
bool
isQueryWrite(string $sql)
Determine if this SQL statement is a write operation (alters content but not structure)
abstract
connect(array $parameters, bool $selectDB = false)
Link this connector to the database given the specified parameters Will throw an exception rather than return a success state.
The connector should not select the database once connected until explicitly called by selectDatabase()
abstract string
getVersion()
Query for the version of the currently connected database
abstract string
escapeString(string $value)
Given a value escape this for use in a query for the current database connector. Note that this does not quote the value.
abstract string
quoteString(string $value)
Given a value escape and quote this appropriately for the current database connector.
abstract
query(string $sql, int $errorLevel = E_USER_ERROR)
Executes the following query with the specified error level.
Implementations of this function should respect previewWrite and benchmarkQuery
abstract Query
preparedQuery(string $sql, array $parameters, int $errorLevel = E_USER_ERROR)
Execute the given SQL parameterised query with the specified arguments
abstract bool
selectDatabase(string $name)
Select a database by name
abstract string
getSelectedDatabase()
Retrieves the name of the currently selected database
abstract
unloadDatabase()
De-selects the currently selected database
abstract string
getLastError()
Retrieves the last error generated from the database connection
abstract int
getGeneratedID(string $table)
Determines the last ID generated from the specified table.
Note that some connectors may not be able to return $table specific responses, and this parameter may be ignored.
abstract int
affectedRows()
Determines the number of affected rows from the last SQL query
abstract bool
isActive()
Determines if we are connected to a server AND have a valid database selected.