class vB_dB_QueryBuilder

This class is a base intended to contain the backend specific details for converting assertor conditions to query code. The logic is contained in the base class for the time being to allow additional sql backends to override specific functions as much of it will be applicable. We'll most likely need to heavily refactor this when we add a second backend, but that will be more efficiently done when we know what the requirements of that backend really are.

Note that this class is intended to be cached and reused therefore anything that is specific to a particular query needs to be passed as parameter to methods rather than being stored in the class itself. Only items specific to the db backend should be class members.

This is internal to the assertor interface and should not be called from the Application code directly.

Traits

Properties

protected $operators Mapping of operators to text.
protected $bitOperators
protected $quote_char
protected $db
protected $debug_sql
protected $quotechar The character used for quoting in an sql string- usually '.

Methods

__sleep()

No description

__wakeup()

No description

__construct($db, $debug_sql)

Construct the query builder

matchValues($queryid, $querystring, $values, $forcetext = array())

This matches a series of values against a query string

mixed
conditionsToFilter(char $conditions, array $forcetext = array())

This function generates the query text against a table.

primaryKeyToFilter($primarykey, $values, $forcetext = array())

No description

valueArrayToFilter($values, $forcetext = array())

No description

valueArrayToSetLine($values, $forcetext = array())

No description

makeSelectQuery($table, $filter, $sortorder, $structure, $params = array())

No description

makeCountQuery($table, $filter, $structure)

No description

makeDeleteQuery($table, $filter, $params = array())

No description

makeUpdateQuery($table, $filter, $setline, $params = array())

No description

makeInsertQuery($table, $ignore, $values, $forcetext = array())

No description

makeReplaceQuery($table, $values, $forcetext = array())

No description

makeInsertMultipleQuery($table, $values, $forcetext = array())

No description

setDebugSQL($debug_sql)

No description

quoteValue($key, $value, $forcetext = array())

No description

escaped
escapeField(string $field)

Handle situations were the field name might be a reserved word. Also allow for qualified names.

escapeFields(array $fields)

No description

logQuery($sql)

No description

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

at line 79
__construct($db, $debug_sql)

Construct the query builder

Parameters

$db
$debug_sql

at line 94
matchValues($queryid, $querystring, $values, $forcetext = array())

This matches a series of values against a query string

Parameters

$queryid
$querystring
$values
$forcetext

at line 149
mixed conditionsToFilter(char $conditions, array $forcetext = array())

This function generates the query text against a table.

Parameters

char $conditions
array $forcetext

Return Value

mixed

at line 349
primaryKeyToFilter($primarykey, $values, $forcetext = array())

Parameters

$primarykey
$values
$forcetext

at line 382
valueArrayToFilter($values, $forcetext = array())

Parameters

$values
$forcetext

at line 468
valueArrayToSetLine($values, $forcetext = array())

Parameters

$values
$forcetext

at line 516
makeSelectQuery($table, $filter, $sortorder, $structure, $params = array())

Parameters

$table
$filter
$sortorder
$structure
$params

at line 640
makeCountQuery($table, $filter, $structure)

Parameters

$table
$filter
$structure

at line 654
makeDeleteQuery($table, $filter, $params = array())

Parameters

$table
$filter
$params

at line 673
makeUpdateQuery($table, $filter, $setline, $params = array())

Parameters

$table
$filter
$setline
$params

at line 689
makeInsertQuery($table, $ignore, $values, $forcetext = array())

Parameters

$table
$ignore
$values
$forcetext

at line 727
makeReplaceQuery($table, $values, $forcetext = array())

Parameters

$table
$values
$forcetext

at line 759
makeInsertMultipleQuery($table, $values, $forcetext = array())

Parameters

$table
$values
$forcetext

at line 799
setDebugSQL($debug_sql)

Parameters

$debug_sql

at line 805
protected quoteValue($key, $value, $forcetext = array())

Parameters

$key
$value
$forcetext

at line 854
protected escaped escapeField(string $field)

Handle situations were the field name might be a reserved word. Also allow for qualified names.

Parameters

string $field -- the field name

Return Value

escaped version of the field name

at line 859
protected escapeFields(array $fields)

Parameters

array $fields

at line 868
protected logQuery($sql)

Parameters

$sql