Call this method from descendent constructors to set global options.
You can't create an instance of this class (it's abstract).
Replace the query placeholders with matching parameter values or - if parameterized queries are enabled - the database specific placeholder.
Parameter values are converted, stripped, escaped, encoded and quoted according to the option values. The $stack returns an array of values for each placeholder to be used in parameterized queries.
string
bind
(string $query, array $param, [array &$stack = array()], [array $options = array()])
-
string
$query: A SQL query string.
-
array
$param: An associated array of values to replace the $query placeholders.
-
array
&$stack: Returns an array of values for use in parameterized queries.
-
array
$options: An associated array of options.
Cast a parameter to a valid SQL string or placeholder. The parameter is also pushed on the $stack - and if necessary converted - to be used in parameterized queries.
string
cast
(mixed $value, string $name, array &$stack, [array $options = array()])
-
mixed
$value: The parameter to replace the query placeholder.
-
string
$name: The name of the query placeholder.
-
array
&$stack: Push parameters on this array for use in parameterized queries.
-
array
$options: An associated array of options.
Arrays are converted to a comma separated list of values.
Strings are escaped and quoted. No placeholders are returend. Any arrays within the array are ignored. If the array is empty, the string "NULL" is returned.
string
castArray
(array $list, string $name, array &$stack, [array $options = array()])
-
array
$list: An array of parameter to replace the query placeholder.
-
string
$name: The name of the query placeholder.
-
array
&$stack: Parameters are pushed on this array for use in parameterized queries.
-
array
$options: An associated array of options.
Cast a boolean parameter to a valid SQL string or placeholder.
The parameter is also pushed on the $stack and converted to be used in parameterized queries.
string
castBool
(bool $value, string $name, array &$stack, [array $options = array()])
-
bool
$value: The parameter to replace the query placeholder.
-
string
$name: The name of the query placeholder.
-
array
&$stack: Parameters are pushed on this array for use in parameterized queries.
-
array
$options: An associated array of options.
Cast a DateTime parameter to a valid SQL string or placeholder.
The parameter is also pushed on the $stack to be used in parameterized queries.
string
castDate
(DateTime $value, string $name, array &$stack, [array $options = array()])
-
DateTime
$value: The parameter to replace the query placeholder.
-
string
$name: The name of the query placeholder.
-
array
&$stack: Parameters are pushed on this array for use in parameterized queries.
-
array
$options: An associated array of options.
Cast a float parameter to a valid SQL string or placeholder.
The parameter is also pushed on the $stack to be used in parameterized queries.
string
castFloat
(float $value, string $name, array &$stack, [array $options = array()])
-
float
$value: The parameter to replace the query placeholder.
-
string
$name: The name of the query placeholder.
-
array
&$stack: Parameters are pushed on this array for use in parameterized queries.
-
array
$options: An associated array of options.
Cast an integer parameter to a valid SQL string or placeholder.
The parameter is also pushed on the $stack to be used in parameterized queries.
string
castInt
(int $value, string $name, array &$stack, [array $options = array()])
-
int
$value: The parameter to replace the query placeholder.
-
string
$name: The name of the query placeholder.
-
array
&$stack: Parameters are pushed on this array for use in parameterized queries.
-
array
$options: An associated array of options.
Cast null to a valid SQL string.
string
castNull
(null $value, string $name, array &$stack, [array $options = array()])
-
null
$value: The parameter to replace the query placeholder.
-
string
$name: The name of the query placeholder.
-
array
&$stack: Push parameters on this array for use in parameterized queries.
-
array
$options: An associated array of options.
Cast a numeric string parameter to a valid SQL string or placeholder.
The parameter is also pushed on the $stack and converted to be used in parameterized queries.
string
castNumeric
(string $value, string $name, array &$stack, [array $options = array()])
-
string
$value: The parameter to replace the query placeholder.
-
string
$name: The name of the query placeholder.
-
array
&$stack: Parameters are pushed on this array for use in parameterized queries.
-
array
$options: An associated array of options.
With the exception of DataTime values, objects are not supported as parameters. Override this method to serialize your objects as SQL query strings.
string
castObject
(object $value, string $name, array &$stack, [array $options = array()])
-
object
$value: The parameter to replace the query placeholder.
-
string
$name: The name of the query placeholder.
-
array
&$stack: Parameters are pushed on this array for use in parameterized queries.
-
array
$options: An associated array of options.
Cast a string parameter to a valid SQL string or placeholder.
The parameter is also pushed on the $stack and modified to be used in parameterized queries.
String values are converted, stripped, escaped, encoded and quoted according to the option values.
string
castString
(string $value, string $name, array &$stack, [array $options = array()])
-
string
$value: The parameter to replace the query placeholder.
-
string
$name: The name of the query placeholder.
-
array
&$stack: Parameters are pushed on this array for use in parameterized queries.
-
array
$options: An associated array of options.
Redefined in descendants as:
Commits the current transaction on the current connection.
The current transaction includes all statements on the connection that were executed after the call to transaction() and before any calls to rollback() or commit().
bool
commit
([array $options = array()])
Implementation of:
- IConnector::commit()
- Commits the current transaction on the current connection.
Redefined in descendants as:
Check if a maching query result exists in the result cache.
If true, set the $table argument to the cached query result, otherwise $table is set to an empty array.
bool
getCache
(string $hash, array &$table, [array $options = array()])
-
string
$hash: A hash value of a query, see getHash().
-
array
&$table: If found, return the cached query result, otherwise an empty array.
-
array
$options: An associated array of options.
Calculate the md5 hash value of the query string and - if necessary - the parameters of a parameterized query.
string
getHash
(string $query, [array $stack = array()], [array $options = array()])
-
string
$query: The modified SQL query string after binding.
-
array
$stack: An array of parameters to be used in a parameterized query.
-
array
$options: An associated array of options.
Get the database link identifier used by the IConnector instance.
resource
getLink
()
Implementation of:
- IConnector::getLink()
- Get the database link identifier used by the IConnector instance.
Get an array of all global options or the value of the global option defined in the optional $element parameter.
mixed
getOptions
([string $element = null])
Implementation of:
- IConnector::getOptions()
- Get an array of all currently used options or the value of the option defined in the optional $element parameter.
Get an option value. Any options in the local $options array overrides the global options.
mixed
lookup
(string $element, [array $options = array()], [mixed $default = null])
-
string
$element: An option constant, see the Option elements.
-
array
$options: An associated array of options.
-
mixed
$default: The default value to return if no global or local options are set.
Push a parameter on the stack and return a query placeholder.
string
push
(mixed $value, string $name, array &$stack, [array $options = array()])
-
mixed
$value: The parameter to replace the query placeholder.
-
string
$name: The name of the query placeholder.
-
array
&$stack: Push parameters on this array for use in parameterized queries.
-
array
$options: An associated array of options.
Rolls back the current transaction on the current connection.
The current transaction includes all statements on the connection that were executed after the call to transaction() and before any calls to rollback() or commit().
bool
rollback
([array $options = array()])
Implementation of:
- IConnector::rollback()
- Rolls back the current transaction on the current connection.
Redefined in descendants as:
Add a new query result to the result cache.
int
setCache
(string $hash, array $table, [array $options = array()])
-
string
$hash: A hash value of a query, see getHash().
-
array
$table: The query result to cache.
-
array
$options: An associated array of options.
Set one or more global options.
Some options are only valid as constructor or function parameters.
mixed
setOptions
(mixed $options, [string $element = null])
-
mixed
$options: Multiple options as an associated array or the value of a single option.
-
string
$element: An option constant, see the Option elements.
Implementation of:
- IConnector::setOptions()
- Set one or more options for the IConnector instance.
Converts character encoding of from the character set of the database according to the current options.
string
strDecode
(string $value, [array $options = array()])
-
string
$value: The string that will be converted.
-
array
$options: An associated array of options.
Converts character encoding of string parameters to the character set of the database according to the current options.
string
strEncode
(string $value, [array $options = array()])
-
string
$value: The string that will be converted.
-
array
$options: An associated array of options.
Escape special characters in a string parameter.
string
strEscape
(string $value, [array $options = array()])
-
string
$value: The string to be escaped.
-
array
$options: An associated array of options.
Redefined in descendants as:
Add surrounding quotes to a string parameter.
string
strQuote
(string $value, [array $options = array()])
-
string
$value: The string to be quoted.
-
array
$options: An associated array of options.
Strip spare or insecure parts from a string parameter according to the current options.
string
strStrip
(string $value, [array $options = array()])
-
string
$value: The string that will be stripped.
-
array
$options: An associated array of options.
Begins a transaction on the current connection.
The current transaction includes all statements on the connection that were executed after the call to transaction() and before any calls to rollback() or commit().
bool
transaction
([array $options = array()])
Implementation of:
- IConnector::transaction()
- Begins a transaction on the current connection.
Redefined in descendants as: