vB_dB_QueryBuilder
in package
uses
vB_Trait_NoSerialize
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.
Table of Contents
Methods
- __construct() : mixed
- Construct the query builder
- __serialize() : array<string|int, mixed>
- __sleep() : array<string|int, mixed>
- __unserialize() : void
- __wakeup() : void
- conditionsToFilter() : string
- This function generates the query text against a table.
- escapeField() : string
- Handle situations were the field name might be a reserved word. Also allow for qualified names.
- escapeFields() : array<string|int, mixed>
- Handle situations were the field name might be a reserved word. Also allow for qualified names.
- escapeTable() : mixed
- Escapes a table name -- also qualifies it with the table prefix automatically.
- makeCountQuery() : mixed
- makeDeleteQuery() : mixed
- makeInsertMultipleQuery() : mixed
- makeInsertQuery() : mixed
- makeLimitClause() : mixed
- makeReplaceQuery() : mixed
- makeSelectQuery() : mixed
- makeSummaryQuery() : mixed
- makeUpdateQuery() : mixed
- matchValues() : mixed
- This matches a series of values against a query string
- primaryKeyToFilter() : mixed
- setDebugSQL() : mixed
- valueArrayToFilter() : mixed
- valueArrayToSetLine() : mixed
Methods
__construct()
Construct the query builder
public
__construct(mixed $db, mixed $debug_sql) : mixed
Parameters
- $db : mixed
-
The db backend specific interface object.
- $debug_sql : mixed
__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__sleep()
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>__unserialize()
public
__unserialize(array<string|int, mixed> $serialized) : void
Parameters
- $serialized : array<string|int, mixed>
__wakeup()
public
__wakeup() : void
conditionsToFilter()
This function generates the query text against a table.
public
conditionsToFilter(array<string|int, mixed> $conditions[, array<string|int, mixed> $forcetext = [] ]) : string
Parameters
- $conditions : array<string|int, mixed>
- $forcetext : array<string|int, mixed> = []
Return values
stringescapeField()
Handle situations were the field name might be a reserved word. Also allow for qualified names.
public
escapeField(string $field) : string
Parameters
- $field : string
-
-- the field name
Return values
string —escaped version of the field name
escapeFields()
Handle situations were the field name might be a reserved word. Also allow for qualified names.
public
escapeFields(array<string|int, mixed> $fields) : array<string|int, mixed>
Handles an array of fieldnames
Parameters
- $fields : array<string|int, mixed>
-
-- the field names
Return values
array<string|int, mixed> —escaped version of the field names
escapeTable()
Escapes a table name -- also qualifies it with the table prefix automatically.
public
escapeTable(string $table) : mixed
Parameters
- $table : string
-
-- the name of the table
Tags
makeCountQuery()
public
makeCountQuery(mixed $table, mixed $filter, mixed $structure) : mixed
Parameters
- $table : mixed
- $filter : mixed
- $structure : mixed
makeDeleteQuery()
public
makeDeleteQuery(mixed $table, mixed $filter, mixed $sortorder, mixed $structure, mixed $params) : mixed
Parameters
- $table : mixed
- $filter : mixed
- $sortorder : mixed
- $structure : mixed
- $params : mixed
makeInsertMultipleQuery()
public
makeInsertMultipleQuery(mixed $table, mixed $values[, mixed $forcetext = [] ]) : mixed
Parameters
- $table : mixed
- $values : mixed
- $forcetext : mixed = []
makeInsertQuery()
public
makeInsertQuery(mixed $table, mixed $ignore, mixed $values[, mixed $forcetext = [] ]) : mixed
Parameters
- $table : mixed
- $ignore : mixed
- $values : mixed
- $forcetext : mixed = []
makeLimitClause()
public
makeLimitClause(mixed $params) : mixed
Parameters
- $params : mixed
makeReplaceQuery()
public
makeReplaceQuery(mixed $table, mixed $values[, mixed $forcetext = [] ]) : mixed
Parameters
- $table : mixed
- $values : mixed
- $forcetext : mixed = []
makeSelectQuery()
public
makeSelectQuery(mixed $table, mixed $filter, mixed $sortorder, mixed $structure[, mixed $params = [] ]) : mixed
Parameters
- $table : mixed
- $filter : mixed
- $sortorder : mixed
- $structure : mixed
- $params : mixed = []
makeSummaryQuery()
public
makeSummaryQuery(string $table, string $filter, array<string|int, mixed> $structure, array<string|int, mixed> $params) : mixed
Parameters
- $table : string
- $filter : string
- $structure : array<string|int, mixed>
- $params : array<string|int, mixed>
makeUpdateQuery()
public
makeUpdateQuery(mixed $table, mixed $filter, mixed $setline, mixed $params) : mixed
Parameters
- $table : mixed
- $filter : mixed
- $setline : mixed
- $params : mixed
matchValues()
This matches a series of values against a query string
public
matchValues(mixed $queryid, mixed $querystring, mixed $values[, mixed $forcetext = [] ]) : mixed
Parameters
- $queryid : mixed
- $querystring : mixed
- $values : mixed
- $forcetext : mixed = []
primaryKeyToFilter()
public
primaryKeyToFilter(mixed $primarykey, mixed &$values[, mixed $forcetext = [] ]) : mixed
Parameters
- $primarykey : mixed
- $values : mixed
- $forcetext : mixed = []
setDebugSQL()
public
setDebugSQL(mixed $debug_sql) : mixed
Parameters
- $debug_sql : mixed
valueArrayToFilter()
public
valueArrayToFilter(mixed $values[, mixed $forcetext = [] ]) : mixed
Parameters
- $values : mixed
- $forcetext : mixed = []
valueArrayToSetLine()
public
valueArrayToSetLine(mixed $values[, mixed $forcetext = [] ]) : mixed
Parameters
- $values : mixed
- $forcetext : mixed = []