phpcr-utils/src/PHPCR/Util/QOM/QomToSql2QueryConverter.php

Show: PublicProtectedPrivateinherited
Table of Contents
This file is part of the PHPCR Utils

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

License
Apache Software License 2.0  
Link
http://phpcr.github.com/  

\PHPCR\Util\QOM\QomToSql2QueryConverter

Package: Default
Convert a QOM query into an SQL2 statement
Parent(s)
\PHPCR\Util\QOM\BaseQomToSqlQueryConverter

Properties

>VPropertyprotected\PHPCR\Util\QOM\BaseSqlGenerator $generator
inherited
The generator to use
Inherited from: \PHPCR\Util\QOM\BaseQomToSqlQueryConverter::$$generator

Methods

methodpublic__construct(\PHPCR\Util\QOM\BaseSqlGenerator $generator) : void
inherited

Instantiate the converter

Inherited from: \PHPCR\Util\QOM\BaseQomToSqlQueryConverter::__construct()
Parameters
NameTypeDescription
$generator\PHPCR\Util\QOM\BaseSqlGenerator
methodpublicconvert(\PHPCR\Query\QOM\QueryObjectModelInterface $query) : string
inherited

Query ::= 'SELECT' columns 'FROM' Source ['WHERE' Constraint] ['ORDER BY' orderings]

Inherited from: \PHPCR\Util\QOM\BaseQomToSqlQueryConverter::convert()
Parameters
NameTypeDescription
$query\PHPCR\Query\QOM\QueryObjectModelInterface
Returns
TypeDescription
string
methodprotectedconvertBindVariable(string $var) : string
inherited

BindVariableValue ::= '$'bindVariableName bindVariableName ::= Prefix

Inherited from: \PHPCR\Util\QOM\BaseQomToSqlQueryConverter::convertBindVariable()
Parameters
NameTypeDescription
$varstring
Returns
TypeDescription
string
methodprotectedconvertChildNodeJoinCondition(\PHPCR\Query\QOM\ChildNodeJoinConditionInterface $condition) : string

ChildNodeJoinCondition ::= 'ISCHILDNODE(' childSelectorName ',' parentSelectorName ')' childSelectorName ::= selectorName parentSelectorName ::= selectorName

Parameters
NameTypeDescription
$condition\PHPCR\Query\QOM\ChildNodeJoinConditionInterface
Returns
TypeDescription
string
methodprotectedconvertColumns(\PHPCR\Query\QOM\ColumnInterface[] $columns) : string
inherited

columns ::= (Column ',' {Column}) | '*' Column ::= ([selectorName'.']propertyName ['AS' columnName]) | (selectorName'.*') // If only one selector exists selectorName ::= Name propertyName ::= Name columnName ::= Name

Inherited from: \PHPCR\Util\QOM\BaseQomToSqlQueryConverter::convertColumns()
Parameters
NameTypeDescription
$columns\PHPCR\Query\QOM\ColumnInterface[]
Returns
TypeDescription
string
methodprotectedconvertComparison(\PHPCR\Query\QOM\ComparisonInterface $comparison) : string
inherited

Comparison ::= DynamicOperand Operator StaticOperand

Inherited from: \PHPCR\Util\QOM\BaseQomToSqlQueryConverter::convertComparison()

Operator ::= EqualTo | NotEqualTo | LessThan | LessThanOrEqualTo | GreaterThan | GreaterThanOrEqualTo | Like EqualTo ::= '=' NotEqualTo ::= '<>' LessThan ::= '<' LessThanOrEqualTo ::= '<=' GreaterThan ::= '>' GreaterThanOrEqualTo ::= '>=' Like ::= 'LIKE'

Parameters
NameTypeDescription
$comparison\PHPCR\Query\QOM\ComparisonInterface
Returns
TypeDescription
string
methodprotectedconvertConstraint(\PHPCR\Query\QOM\ConstraintInterface $constraint) : string

Constraint ::= And | Or | Not | Comparison | PropertyExistence | FullTextSearch | SameNode | ChildNode | DescendantNode

And ::= constraint1 'AND' constraint2 Or ::= constraint1 'OR' constraint2 Not ::= 'NOT' Constraint

SameNode ::= 'ISSAMENODE(' [selectorName ','] Path ')' // If only one selector exists in this query, explicit specification of the selectorName is optional

ChildNode ::= 'ISCHILDNODE(' [selectorName ','] Path ')' // If only one selector exists in this query, explicit specification of the selectorName is optional

DescendantNode ::= 'ISDESCENDANTNODE(' [selectorName ','] Path ')' // If only one selector exists in this query, explicit specification of the selectorName is optional

Parameters
NameTypeDescription
$constraint\PHPCR\Query\QOM\ConstraintInterface
Returns
TypeDescription
string
methodprotectedconvertDescendantNodeJoinCondition(\PHPCR\Query\QOM\DescendantNodeJoinConditionInterface $condition) : string

DescendantNodeJoinCondition ::= 'ISDESCENDANTNODE(' descendantSelectorName ',' ancestorSelectorName ')' descendantSelectorName ::= selectorName ancestorSelectorName ::= selectorName

Parameters
NameTypeDescription
$condition\PHPCR\Query\QOM\DescendantNodeJoinConditionInterface
Returns
TypeDescription
string
methodprotectedconvertDynamicOperand(\PHPCR\Query\QOM\DynamicOperandInterface $operand) : string

DynamicOperand ::= PropertyValue | Length | NodeName | NodeLocalName | FullTextSearchScore | LowerCase | UpperCase

Length ::= 'LENGTH(' PropertyValue ')' NodeName ::= 'NAME(' [selectorName] ')' // If only one selector exists NodeLocalName ::= 'LOCALNAME(' [selectorName] ')' // If only one selector exists FullTextSearchScore ::= 'SCORE(' [selectorName] ')' // If only one selector exists LowerCase ::= 'LOWER(' DynamicOperand ')' UpperCase ::= 'UPPER(' DynamicOperand ')'

Parameters
NameTypeDescription
$operand\PHPCR\Query\QOM\DynamicOperandInterface
Returns
TypeDescription
string
methodprotectedconvertEquiJoinCondition(\PHPCR\Query\QOM\EquiJoinConditionInterface $condition) : string

EquiJoinCondition ::= selector1Name'.'property1Name '=' selector2Name'.'property2Name selector1Name ::= selectorName selector2Name ::= selectorName property1Name ::= propertyName property2Name ::= propertyName

Parameters
NameTypeDescription
$condition\PHPCR\Query\QOM\EquiJoinConditionInterface
Returns
TypeDescription
string
methodprotectedconvertFullTextSearch(\PHPCR\Query\QOM\FullTextSearchInterface $constraint) : string
inherited

FullTextSearch ::= 'CONTAINS(' ([selectorName'.']propertyName | selectorName'.*') ',' FullTextSearchExpression ')' // If only one selector exists in this query, explicit specification of the selectorName preceding the propertyName is optional

Inherited from: \PHPCR\Util\QOM\BaseQomToSqlQueryConverter::convertFullTextSearch()
Parameters
NameTypeDescription
$constraint\PHPCR\Query\QOM\FullTextSearchInterface
Returns
TypeDescription
string
methodprotectedconvertFullTextSearchExpression(string $expr) : string
inherited

FullTextSearchExpression ::= BindVariable | ''' FullTextSearchLiteral '''

Inherited from: \PHPCR\Util\QOM\BaseQomToSqlQueryConverter::convertFullTextSearchExpression()
Parameters
NameTypeDescription
$exprstring
Returns
TypeDescription
string
methodprotectedconvertJoin(\PHPCR\Query\QOM\JoinInterface $join) : string

Join ::= left [JoinType] 'JOIN' right 'ON' JoinCondition // If JoinType is omitted INNER is assumed.

left ::= Source right ::= Source

JoinType ::= Inner | LeftOuter | RightOuter Inner ::= 'INNER' LeftOuter ::= 'LEFT OUTER' RightOuter ::= 'RIGHT OUTER'

Parameters
NameTypeDescription
$join\PHPCR\Query\QOM\JoinInterface
Returns
TypeDescription
string
methodprotectedconvertJoinCondition(\PHPCR\Query\QOM\JoinConditionInterface $condition) : string

JoinCondition ::= EquiJoinCondition | SameNodeJoinCondition | ChildNodeJoinCondition | DescendantNodeJoinCondition

Parameters
NameTypeDescription
$condition\PHPCR\Query\QOM\JoinConditionInterface
Returns
TypeDescription
string
methodprotectedconvertLiteral(mixed $literal) : string
inherited

Literal ::= CastLiteral | UncastLiteral

Inherited from: \PHPCR\Util\QOM\BaseQomToSqlQueryConverter::convertLiteral()
Parameters
NameTypeDescription
$literalmixed
Returns
TypeDescription
string
methodprotectedconvertOrderings(\PHPCR\Query\QOM\OrderingInterface[] $orderings) : string
inherited

orderings ::= Ordering {',' Ordering} Ordering ::= DynamicOperand [Order] Order ::= Ascending | Descending Ascending ::= 'ASC' Descending ::= 'DESC'

Inherited from: \PHPCR\Util\QOM\BaseQomToSqlQueryConverter::convertOrderings()
Parameters
NameTypeDescription
$orderings\PHPCR\Query\QOM\OrderingInterface[]
Returns
TypeDescription
string
methodprotectedconvertPath(string $path) : string
inherited

Path ::= '[' quotedPath ']' | '[' simplePath ']' | simplePath quotedPath ::= A JCR Path that contains non-SQL-legal characters simplePath ::= A JCR Name that contains only SQL-legal characters

Inherited from: \PHPCR\Util\QOM\BaseQomToSqlQueryConverter::convertPath()
Parameters
NameTypeDescription
$pathstring
Returns
TypeDescription
string
methodprotectedconvertPropertyExistence(\PHPCR\Query\QOM\PropertyExistenceInterface $constraint) : string
inherited

PropertyExistence ::= selectorName'.'propertyName 'IS NOT NULL' | propertyName 'IS NOT NULL' If only one selector exists in this query

Inherited from: \PHPCR\Util\QOM\BaseQomToSqlQueryConverter::convertPropertyExistence()

Note: The negation, 'NOT x IS NOT NULL' can be written 'x IS NULL'

Parameters
NameTypeDescription
$constraint\PHPCR\Query\QOM\PropertyExistenceInterface
Returns
TypeDescription
string
methodprotectedconvertPropertyValue(\PHPCR\Query\QOM\PropertyValueInterface $value) : string
inherited

PropertyValue ::= [selectorName'.'] propertyName // If only one selector exists

Inherited from: \PHPCR\Util\QOM\BaseQomToSqlQueryConverter::convertPropertyValue()
Parameters
NameTypeDescription
$value\PHPCR\Query\QOM\PropertyValueInterface
Returns
TypeDescription
string
methodprotectedconvertSameNodeJoinCondition(\PHPCR\Query\QOM\SameNodeJoinConditionInterface $condition) : string

SameNodeJoinCondition ::= 'ISSAMENODE(' selector1Name ',' selector2Name [',' selector2Path] ')' selector2Path ::= Path

Parameters
NameTypeDescription
$condition\PHPCR\Query\QOM\SameNodeJoinConditionInterface
Returns
TypeDescription
string
methodprotectedconvertSelector(\PHPCR\Query\QOM\SelectorInterface $selector) : string
inherited

Selector ::= nodeTypeName ['AS' selectorName] nodeTypeName ::= Name

Inherited from: \PHPCR\Util\QOM\BaseQomToSqlQueryConverter::convertSelector()
Parameters
NameTypeDescription
$selector\PHPCR\Query\QOM\SelectorInterface
Returns
TypeDescription
string
methodprotectedconvertSource(\PHPCR\Query\QOM\SourceInterface $source) : string

Source ::= Selector | Join

This is different between SQL1 and SQL2

Parameters
NameTypeDescription
$source\PHPCR\Query\QOM\SourceInterface
Returns
TypeDescription
string
methodprotectedconvertStaticOperand(\PHPCR\Query\QOM\StaticOperandInterface $operand) : string
inherited

StaticOperand ::= Literal | BindVariableValue

Inherited from: \PHPCR\Util\QOM\BaseQomToSqlQueryConverter::convertStaticOperand()

Literal ::= CastLiteral | UncastLiteral CastLiteral ::= 'CAST(' UncastLiteral ' AS ' PropertyType ')'

PropertyType ::= 'STRING' | 'BINARY' | 'DATE' | 'LONG' | 'DOUBLE' | 'DECIMAL' | 'BOOLEAN' | 'NAME' | 'PATH' | 'REFERENCE' | 'WEAKREFERENCE' | 'URI' UncastLiteral ::= UnquotedLiteral | ''' UnquotedLiteral ''' | '“' UnquotedLiteral '“' UnquotedLiteral ::= // String form of a JCR Value

BindVariableValue ::= '$'bindVariableName bindVariableName ::= Prefix

Parameters
NameTypeDescription
$operand\PHPCR\Query\QOM\StaticOperandInterface
Returns
TypeDescription
string
Documentation was generated by phpDocumentor 2.0.0a12.