phpcr-utils/src/PHPCR/Util/QOM/Sql2Generator.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\Sql2Generator

Package: Default
Generate SQL2 statements
Parent(s)
\PHPCR\Util\QOM\BaseSqlGenerator

Methods

methodprivateaddBracketsIfNeeded(string $selector) : string

Add square brackets around a selector if needed

Parameters
NameTypeDescription
$selectorstring
Returns
TypeDescription
string$selector guaranteed to have [] around it if needed
methodpublicevalAnd(string $constraint1, string $constraint2) : void
inherited

And ::= constraint1 'AND' constraint2

Inherited from: \PHPCR\Util\QOM\BaseSqlGenerator::evalAnd()
Parameters
NameTypeDescription
$constraint1string
$constraint2string
methodpublicevalBindVariable( $var) : string
inherited

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

Inherited from: \PHPCR\Util\QOM\BaseSqlGenerator::evalBindVariable()
Parameters
NameTypeDescription
$var
Returns
TypeDescription
string
methodpublicevalCastLiteral(string $literal, string $type) : string

Cast a literal.

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

Parameters
NameTypeDescription
$literalstring
$typestring
Returns
TypeDescription
string
methodpublicevalChildNode(string $path, string $selectorName = null) : void

SameNode ::= 'ISCHILDNODE(' [selectorName ','] Path ')'

Parameters
NameTypeDescription
$pathstring
$selectorNamestring
methodpublicevalChildNodeJoinCondition(string $childSelectorName, string $parentSelectorName) : string

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

Parameters
NameTypeDescription
$childSelectorNamestring
$parentSelectorNamestring
Returns
TypeDescription
string
methodpublicevalColumn(string $selectorName, string $propertyName = null, string $colname = null) : string

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

Parameters
NameTypeDescription
$selectorNamestring
$propertyNamestring
$colnamestring
Returns
TypeDescription
string
methodpublicevalColumns( $columns) : string

columns ::= (Column ',' {Column}) | '*'

Parameters
NameTypeDescription
$columns
Returns
TypeDescription
string
methodpublicevalComparison(string $operand1, string $operator, string $operand2) : void
inherited

Comparison ::= DynamicOperand Operator StaticOperand

Inherited from: \PHPCR\Util\QOM\BaseSqlGenerator::evalComparison()
Parameters
NameTypeDescription
$operand1string
$operatorstring
$operand2string
methodpublicevalDescendantNode(string $path, string $selectorName = null) : void

SameNode ::= 'ISDESCENDANTNODE(' [selectorName ','] Path ')'

Parameters
NameTypeDescription
$pathstring
$selectorNamestring
methodpublicevalDescendantNodeJoinCondition(string $descendantSelectorName, string $ancestorselectorName) : string

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

Parameters
NameTypeDescription
$descendantSelectorNamestring
$ancestorselectorNamestring
Returns
TypeDescription
string
methodpublicevalEquiJoinCondition(string $sel1Name, string $prop1Name, string $sel2Name, string $prop2Name) : string

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

Parameters
NameTypeDescription
$sel1Namestring
$prop1Namestring
$sel2Namestring
$prop2Namestring
Returns
TypeDescription
string
methodpublicevalFullTextSearch(string $selectorName, string $searchExpression, string $propertyName = null) : string

FullTextSearch ::= 'CONTAINS(' ([selectorName'.']propertyName | selectorName'.*') ',' FullTextSearchExpression ')' FullTextSearchExpression ::= BindVariable | ''' FullTextSearchLiteral '''

Parameters
NameTypeDescription
$selectorNamestring

unusued

$searchExpressionstring
$propertyNamestring
Returns
TypeDescription
string
methodpublicevalFullTextSearchScore(string $selectorValue = null) : void

FullTextSearchScore ::= 'SCORE(' [selectorName] ')'

Parameters
NameTypeDescription
$selectorValuestring
methodpublicevalJoin(string $left, string $right, string $joinCondition, string $joinType = '') : string

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

left ::= Source right ::= Source

Parameters
NameTypeDescription
$leftstring
$rightstring
$joinConditionstring
$joinTypestring
Returns
TypeDescription
string
methodpublicevalJoinType(string $joinType) : string

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

Parameters
NameTypeDescription
$joinTypestring
Returns
TypeDescription
string
methodpublicevalLength(string $propertyValue) : string

Length ::= 'LENGTH(' PropertyValue ')'

Parameters
NameTypeDescription
$propertyValuestring
Returns
TypeDescription
string
methodpublicevalLiteral(mixed $literal) : string
inherited

Literal ::= CastLiteral | UncastLiteral

Inherited from: \PHPCR\Util\QOM\BaseSqlGenerator::evalLiteral()
Parameters
NameTypeDescription
$literalmixed
Returns
TypeDescription
string
methodpublicevalLower(string $operand) : void
inherited

LowerCase ::= 'LOWER(' DynamicOperand ')'

Inherited from: \PHPCR\Util\QOM\BaseSqlGenerator::evalLower()
Parameters
NameTypeDescription
$operandstring
methodpublicevalNodeLocalName(string $selectorValue = null) : void

NodeLocalName ::= 'LOCALNAME(' [selectorName] ')'

Parameters
NameTypeDescription
$selectorValuestring
methodpublicevalNodeName(string $selectorValue = null) : void

NodeName ::= 'NAME(' [selectorName] ')'

Parameters
NameTypeDescription
$selectorValuestring
methodpublicevalNot(string $constraint) : void
inherited

Not ::= 'NOT' Constraint

Inherited from: \PHPCR\Util\QOM\BaseSqlGenerator::evalNot()
Parameters
NameTypeDescription
$constraintstring
methodpublicevalOperator(string $operator) : void
inherited

Operator ::= EqualTo | NotEqualTo | LessThan | LessThanOrEqualTo | GreaterThan | GreaterThanOrEqualTo | Like

Inherited from: \PHPCR\Util\QOM\BaseSqlGenerator::evalOperator()
Parameters
NameTypeDescription
$operatorstring
methodpublicevalOr(string $constraint1, string $constraint2) : void
inherited

Or ::= constraint1 'OR' constraint2

Inherited from: \PHPCR\Util\QOM\BaseSqlGenerator::evalOr()
Parameters
NameTypeDescription
$constraint1string
$constraint2string
methodpublicevalOrder( $order) : string
inherited

Order ::= Ascending | Descending Ascending ::= 'ASC' Descending ::= 'DESC'

Inherited from: \PHPCR\Util\QOM\BaseSqlGenerator::evalOrder()
Parameters
NameTypeDescription
$order
Returns
TypeDescription
string
methodpublicevalOrdering( $operand,  $order) : string
inherited

Ordering ::= DynamicOperand [Order]

Inherited from: \PHPCR\Util\QOM\BaseSqlGenerator::evalOrdering()
Parameters
NameTypeDescription
$operand
$order
Returns
TypeDescription
string
methodpublicevalOrderings( $orderings) : string
inherited

orderings ::= Ordering {',' Ordering}

Inherited from: \PHPCR\Util\QOM\BaseSqlGenerator::evalOrderings()
Parameters
NameTypeDescription
$orderings
Returns
TypeDescription
string
methodpublicevalPath(string $path) : string

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

This is different between SQL1 and SQL2.

Parameters
NameTypeDescription
$pathstring
Returns
TypeDescription
string
methodpublicevalPropertyExistence( $selectorName,  $propertyName) : string

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

Parameters
NameTypeDescription
$selectorName
$propertyName
Returns
TypeDescription
string
methodpublicevalPropertyValue(string $propertyName, string $selectorName = null) : void

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

Parameters
NameTypeDescription
$propertyNamestring
$selectorNamestring
methodpublicevalQuery(string $source, string $columns, string $constraint = '', string $orderings = '') : string
inherited

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

Inherited from: \PHPCR\Util\QOM\BaseSqlGenerator::evalQuery()
Parameters
NameTypeDescription
$sourcestring
$columnsstring
$constraintstring
$orderingsstring
Returns
TypeDescription
string
methodpublicevalSameNode(string $path, string $selectorName = null) : void

SameNode ::= 'ISSAMENODE(' [selectorName ','] Path ')'

Parameters
NameTypeDescription
$pathstring
$selectorNamestring
methodpublicevalSameNodeJoinCondition(string $sel1Name, string $sel2Name, string $sel2Path = null) : string

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

Parameters
NameTypeDescription
$sel1Namestring
$sel2Namestring
$sel2Pathstring
Returns
TypeDescription
string
methodpublicevalSelector(string $nodeTypeName, string $selectorName = null) : string

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

Parameters
NameTypeDescription
$nodeTypeNamestring

The node type of the selector. If it does not contain starting and ending brackets ([]) they will be added automatically

$selectorNamestring
Returns
TypeDescription
string
methodpublicevalUpper(string $operand) : void
inherited

LowerCase ::= 'UPPER(' DynamicOperand ')'

Inherited from: \PHPCR\Util\QOM\BaseSqlGenerator::evalUpper()
Parameters
NameTypeDescription
$operandstring
Documentation was generated by phpDocumentor 2.0.0a12.