CRM_Utils_SQL_BaseParamQuery
class CRM_Utils_SQL_BaseParamQuery implements ArrayAccess
Class CRM_Utils_SQL_BaseParamQuery
Base class for query-building which handles parameter interpolation.
Constants
INTERPOLATE_INPUT |
Interpolate values as soon as they are passed in (where(), join(), etc). Default. Pro: Every clause has its own unique namespace for parameters. Con: Probably slower. Advice: Use this when aggregating SQL fragments from agents who maintained by different parties. |
INTERPOLATE_OUTPUT |
Interpolate values when rendering SQL output (toSQL()). Pro: Probably faster. Con: Must maintain an aggregated list of all parameters. Advice: Use this when you have control over the entire query. |
INTERPOLATE_AUTO |
Determine mode automatically. When the first attempt is made to use input-interpolation (eg `where(. .., array(...)) |
Properties
protected mixed | $mode | ||
protected array | $params | ||
bool | $strict | Public to work-around PHP 5.3 limit. |
Methods
Enable (or disable) strict mode.
Given a string like "field_name = @value", replace "@value" with an escaped SQL string
No description
Set one (or multiple) parameters to interpolate into the query.
Has an offset been set.
Get the value of a SQL parameter.
Set the value of a SQL parameter.
Unset the value of a SQL parameter.
Details
at line 63
CRM_Utils_SQL_BaseParamQuery
strict(bool $strict = TRUE)
Enable (or disable) strict mode.
In strict mode, unknown variables will generate exceptions.
at line 84
string
interpolate(string $expr, null|array $args, string $activeMode = self::INTERPOLATE_INPUT)
Given a string like "field_name = @value", replace "@value" with an escaped SQL string
at line 146
string
escapeString(string|NULL $value)
at line 161
$this
param(array|string $keys, null|mixed $value = NULL)
Set one (or multiple) parameters to interpolate into the query.
at line 187
bool
offsetExists(string $offset)
Has an offset been set.
at line 205
mixed
offsetGet(string $offset)
Get the value of a SQL parameter.
at line 226
offsetSet(string $offset, mixed $value)
Set the value of a SQL parameter.
at line 237
offsetUnset(string $offset)
Unset the value of a SQL parameter.