Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
DALQueryParser Class Reference
Inheritance diagram for DALQueryParser:
DALAlterParser DALDeleteParser DALDropParser DALFromParser DALGroupByParser DALInsertParser DALOrderByParser DALSchemaParser DALSelectParser DALTruncateParser DALUnionParser DALUpdateParser DALWhereParser DALWithParser

Static Public Member Functions

static parse (DomElement $query)
 
static parseCallQuery (DomElement $call)
 
static validateField (DomElement $field, $allowAlias=FALSE)
 
static validateValuesTag (DomElement $valuesTag)
 
static validateFunctionTag (DomElement $function)
 
static validateHook (DomElement $hook)
 

Static Protected Member Functions

static parseLimitClause (DomElement $select)
 
static parseInClause (DomElement $inCond, $level=0)
 
static parseExistsClause (DomElement $existsCond, $level=0)
 
static parseChildFields (DomElement $parent)
 
static parseSingleField (DomElement $fieldXML)
 
static parseMathOperation (DomElement $parent, $op='MATH-OP')
 
static parseSqlFunction (DomElement $function)
 
static validateFieldsTag (DomElement $fields)
 
static validateValueTag (DomElement $value)
 
static getUnionTag (DomElement $parentNode)
 
static addHookIds (DomElement $xmlQuery)
 

Detailed Description

DALQueryParser.

Base query parser. Contains common parsing functions like field parser etc.

Since
4.0.0

Definition at line 38 of file DALQueryParser.inc.

Member Function Documentation

static addHookIds ( DomElement  $xmlQuery)
staticprotected

Gets all the hooks in this query.

Parameters
DomElement$xmlQueryDomElement that represents a single query.
Since
4.0.0
Returns
array

Definition at line 675 of file DALQueryParser.inc.

static getUnionTag ( DomElement  $parentNode)
staticprotected

Returns the union or union-all tag if there is one else returns NULL.

Parameters
DomElement$parentNodeParent node.
Since
4.0.0
Returns
object

Definition at line 655 of file DALQueryParser.inc.

static parse ( DomElement  $query)
static

Constructs an SQL query from DomElement.

This is the main function where the SQL array is constructed from XML. It will combine queries from different parts of the system.

Parameters
DomElement$queryDomElement that represents a single query.
Since
4.0.0
Returns
array
Exceptions
DALParserExceptionIf the element passed is not a query or is of an invalid type.

Definition at line 69 of file DALQueryParser.inc.

static parseCallQuery ( DomElement  $call)
static

Parses the calling of a method within a query.

Parameters
DomElement$callThe tag defining the call.
Since
4.0.0
Returns
array

Definition at line 330 of file DALQueryParser.inc.

static parseChildFields ( DomElement  $parent)
staticprotected

Returns list of fields separated with commas.

Function will look for field tag under parent tag.

Parameters
DomElement$parentFields Node of the XML.
Since
4.0.0
Returns
array

Definition at line 354 of file DALQueryParser.inc.

static parseExistsClause ( DomElement  $existsCond,
  $level = 0 
)
staticprotected

Constructs the EXISTS condition from XML node.

array( 'EXISTS' => array( 'CONDITIONS' => array( 'SELECT' => array(), ), ), )

Parameters
DomElement$existsCondSelect Node of the XML.
integer$levelIndentation level.
Since
4.0.0
Returns
array

Definition at line 302 of file DALQueryParser.inc.

static parseInClause ( DomElement  $inCond,
  $level = 0 
)
staticprotected

Constructs the IN condition from XML node.

array( 'IN' => array( 'table' => string, 'column' => string, 'CONDITIONS' => array( 0 => string, -— or -— 'SELECT' => array(), ), ), )

Parameters
DomElement$inCondSelect Node of the XML.
integer$levelIndentation level.
Since
4.0.0
Returns
array

Definition at line 247 of file DALQueryParser.inc.

static parseLimitClause ( DomElement  $select)
staticprotected

Constructs the SQL's LIMIT clause from XML node.

Returns the array for the LIMIT clause. array( 'LIMIT' = array( 'rows' => int, 'offset' => int, ), );

Parameters
DomElement$selectSelect Node of the XML.
Since
4.0.0
Returns
array

Definition at line 211 of file DALQueryParser.inc.

static parseMathOperation ( DomElement  $parent,
  $op = 'MATH-OP' 
)
staticprotected

Returns the array for a math operation block.

Parameters
DomElement$parentThe math-op element.
string$opMath operator description (i.e. ADD).
Since
4.0.0
Returns
array

Definition at line 437 of file DALQueryParser.inc.

static parseSingleField ( DomElement  $fieldXML)
staticprotected

Returns field array.

This function will first determine which type of field is given. If non found then it will return FALSE.

Parameters
DomElement$fieldXMLSingel field element.
Since
4.0.0
Returns
(array|boolean)

Definition at line 384 of file DALQueryParser.inc.

static parseSqlFunction ( DomElement  $function)
staticprotected

Converts XML function element to PHP array.

array( 'FUNCTION' => array( 'function' => string, 'ARGS' => array( 0 => mixed, ), ), )

Parameters
DomElement$functionFunction XML node.
Since
4.0.0
Returns
array

Definition at line 486 of file DALQueryParser.inc.

static validateField ( DomElement  $field,
  $allowAlias = FALSE 
)
static

Validate Field tag.

Field tag must have column and table attribute, and tag node value is only allowed in SELECT clause (for field alias).

Parameters
DomElement$fieldSingle field tag.
boolean$allowAliasAllow field alias.
Since
4.0.0
Returns
void
Exceptions
DALParserExceptionIf a field doesn't have a table or a column specified, or if an alias is used incorrectly.

Definition at line 538 of file DALQueryParser.inc.

static validateFieldsTag ( DomElement  $fields)
staticprotected

Validates INSERT and UDPATE Fields tag.

Throws DALParserException.

Parameters
DomElement$fieldsThe query element.
Since
4.0.0
Returns
void
Exceptions
DALParserExceptionIf the fields tag is invalid for any reason.

Definition at line 564 of file DALQueryParser.inc.

static validateFunctionTag ( DomElement  $function)
static

Validates a single function tag.

Parameters
DomElement$functionSingle function tag.
Since
4.0.0
Returns
void
Exceptions
DALParserExceptionIf a function tag doesn't have a function specified.

Definition at line 703 of file DALQueryParser.inc.

static validateHook ( DomElement  $hook)
static

Validate Hook tag.

Hook tag must have id attribute.

Parameters
DomElement$hookSingle hook tag.
Since
4.0.0
Returns
void
Exceptions
DALParserExceptionIf a hook doesn't have an ID specified.

Definition at line 724 of file DALQueryParser.inc.

static validateValuesTag ( DomElement  $valuesTag)
static

Validates the values tag.

Values tag must have one or more value tags.

Parameters
DomElement$valuesTagThe values tag.
Since
4.0.0
Returns
void
Exceptions
DALParserExceptionIf the values tag contains no value or select tags.

Definition at line 602 of file DALQueryParser.inc.

static validateValueTag ( DomElement  $value)
staticprotected

Validates a single value tag for update statement.

Value tag must have a column attribute and may contain a math-op tag.

Parameters
DomElement$valueThe value tag.
Since
4.0.0
Returns
void
Exceptions
DALParserExceptionIf a value tag doesn't have a column specified.

Definition at line 637 of file DALQueryParser.inc.


The documentation for this class was generated from the following file: