DBConnector
class DBConnector
Represents an object responsible for wrapping DB connector api
Config options
write_operations | array | List of operations to treat as write Implicitly includes all ddl_operations | |
ddl_operations | array | List of operations to treat as DDL |
Methods
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.
Escapes an identifier (table / database name). Typically the value is simply double quoted. Don't pass in already escaped identifiers in, as this will double escape the value!
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
at line 67
bool
isQueryMutable(string $sql)
Determine if this SQL statement is a destructive operation (write or ddl)
at line 81
bool
isQueryDDL(string $sql)
Determine if this SQL statement is a DDL operation
at line 93
bool
isQueryWrite(string $sql)
Determine if this SQL statement is a write operation (alters content but not structure)
at line 150
abstract
connect(array $parameters, boolean $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()
at line 157
abstract string
getVersion()
Query for the version of the currently connected database
at line 166
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.
at line 175
abstract string
quoteString(string $value)
Given a value escape and quote this appropriately for the current database connector.
at line 185
escapeIdentifier(string $value, string $separator = '.')
Escapes an identifier (table / database name). Typically the value is simply double quoted. Don't pass in already escaped identifiers in, as this will double escape the value!
at line 206
abstract
query(string $sql, integer $errorLevel = E_USER_ERROR)
Executes the following query with the specified error level.
Implementations of this function should respect previewWrite and benchmarkQuery
at line 216
abstract SS_Query
preparedQuery(string $sql, array $parameters, int $errorLevel = E_USER_ERROR)
Execute the given SQL parameterised query with the specified arguments
at line 224
abstract boolean
selectDatabase(string $name)
Select a database by name
at line 231
abstract string
getSelectedDatabase()
Retrieves the name of the currently selected database
at line 236
abstract
unloadDatabase()
De-selects the currently selected database
at line 243
abstract string
getLastError()
Retrieves the last error generated from the database connection
at line 253
abstract integer
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.
at line 260
abstract integer
affectedRows()
Determines the number of affected rows from the last SQL query
at line 268
abstract boolean
isActive()
Determines if we are connected to a server AND have a valid database selected.