phpcr-utils/src/PHPCR/Util/QOM/Sql2Generator.php
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: DefaultGenerate SQL2 statements
- Parent(s)
- \PHPCR\Util\QOM\BaseSqlGenerator
Methods



addBracketsIfNeeded(string $selector) : stringAdd square brackets around a selector if needed
Parameters| Name | Type | Description |
|---|
| $selector | string | |
|---|
Returns| Type | Description |
|---|
| string | $selector guaranteed to have [] around it if needed |



evalChildNode(string $path, string $selectorName = null) : voidSameNode ::= 'ISCHILDNODE(' [selectorName ','] Path ')'
Parameters| Name | Type | Description |
|---|
| $path | string | |
|---|
| $selectorName | string | |
|---|



evalChildNodeJoinCondition(string $childSelectorName, string $parentSelectorName) : stringChildNodeJoinCondition ::=
'ISCHILDNODE(' childSelectorName ','
parentSelectorName ')'
childSelectorName ::= selectorName
parentSelectorName ::= selectorName
Parameters| Name | Type | Description |
|---|
| $childSelectorName | string | |
|---|
| $parentSelectorName | string | |
|---|
Returns 


evalColumn(string $selectorName, string $propertyName = null, string $colname = null) : stringColumn ::= ([selectorName'.']propertyName
['AS' columnName]) |
(selectorName'.*') // If only one selector exists
selectorName ::= Name
propertyName ::= Name
columnName ::= Name
Parameters| Name | Type | Description |
|---|
| $selectorName | string | |
|---|
| $propertyName | string | |
|---|
| $colname | string | |
|---|
Returns 


evalColumns( $columns) : stringcolumns ::= (Column ',' {Column}) | '*'
Parameters| Name | Type | Description |
|---|
| $columns | | |
|---|
Returns 


evalDescendantNode(string $path, string $selectorName = null) : voidSameNode ::= 'ISDESCENDANTNODE(' [selectorName ','] Path ')'
Parameters| Name | Type | Description |
|---|
| $path | string | |
|---|
| $selectorName | string | |
|---|



evalDescendantNodeJoinCondition(string $descendantSelectorName, string $ancestorselectorName) : stringDescendantNodeJoinCondition ::=
'ISDESCENDANTNODE(' descendantSelectorName ','
ancestorSelectorName ')'
descendantSelectorName ::= selectorName
ancestorSelectorName ::= selectorName
Parameters| Name | Type | Description |
|---|
| $descendantSelectorName | string | |
|---|
| $ancestorselectorName | string | |
|---|
Returns 


evalEquiJoinCondition(string $sel1Name, string $prop1Name, string $sel2Name, string $prop2Name) : stringEquiJoinCondition ::= selector1Name'.'property1Name '='
selector2Name'.'property2Name
selector1Name ::= selectorName
selector2Name ::= selectorName
property1Name ::= propertyName
property2Name ::= propertyName
Parameters| Name | Type | Description |
|---|
| $sel1Name | string | |
|---|
| $prop1Name | string | |
|---|
| $sel2Name | string | |
|---|
| $prop2Name | string | |
|---|
Returns 


evalFullTextSearch(string $selectorName, string $searchExpression, string $propertyName = null) : stringFullTextSearch ::=
'CONTAINS(' ([selectorName'.']propertyName |
selectorName'.*') ','
FullTextSearchExpression ')'
FullTextSearchExpression ::= BindVariable | ''' FullTextSearchLiteral '''
Parameters| Name | Type | Description |
|---|
| $selectorName | string | unusued |
|---|
| $searchExpression | string | |
|---|
| $propertyName | string | |
|---|
Returns 


evalFullTextSearchScore(string $selectorValue = null) : voidFullTextSearchScore ::= 'SCORE(' [selectorName] ')'
Parameters| Name | Type | Description |
|---|
| $selectorValue | string | |
|---|



evalJoin(string $left, string $right, string $joinCondition, string $joinType = '') : stringJoin ::= left [JoinType] 'JOIN' right 'ON' JoinCondition
// If JoinType is omitted INNER is assumed.
left ::= Source
right ::= Source
Parameters| Name | Type | Description |
|---|
| $left | string | |
|---|
| $right | string | |
|---|
| $joinCondition | string | |
|---|
| $joinType | string | |
|---|
Returns


evalJoinType(string $joinType) : stringJoinType ::= Inner | LeftOuter | RightOuter
Inner ::= 'INNER'
LeftOuter ::= 'LEFT OUTER'
RightOuter ::= 'RIGHT OUTER'
Parameters| Name | Type | Description |
|---|
| $joinType | string | |
|---|
Returns 


evalLength(string $propertyValue) : stringLength ::= 'LENGTH(' PropertyValue ')'
Parameters| Name | Type | Description |
|---|
| $propertyValue | string | |
|---|
Returns 


evalNodeLocalName(string $selectorValue = null) : voidNodeLocalName ::= 'LOCALNAME(' [selectorName] ')'
Parameters| Name | Type | Description |
|---|
| $selectorValue | string | |
|---|



evalNodeName(string $selectorValue = null) : voidNodeName ::= 'NAME(' [selectorName] ')'
Parameters| Name | Type | Description |
|---|
| $selectorValue | string | |
|---|



evalPath(string $path) : stringPath ::= '[' 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| Name | Type | Description |
|---|
| $path | string | |
|---|
Returns


evalPropertyExistence( $selectorName, $propertyName) : stringPropertyExistence ::=
selectorName'.'propertyName 'IS NOT NULL' |
propertyName 'IS NOT NULL' If only one
selector exists in
this query
Parameters| Name | Type | Description |
|---|
| $selectorName | | |
|---|
| $propertyName | | |
|---|
Returns 


evalPropertyValue(string $propertyName, string $selectorName = null) : voidPropertyValue ::= [selectorName'.'] propertyName // If only one selector exists
Parameters| Name | Type | Description |
|---|
| $propertyName | string | |
|---|
| $selectorName | string | |
|---|



evalSameNode(string $path, string $selectorName = null) : voidSameNode ::= 'ISSAMENODE(' [selectorName ','] Path ')'
Parameters| Name | Type | Description |
|---|
| $path | string | |
|---|
| $selectorName | string | |
|---|



evalSameNodeJoinCondition(string $sel1Name, string $sel2Name, string $sel2Path = null) : stringSameNodeJoinCondition ::=
'ISSAMENODE(' selector1Name ','
selector2Name
[',' selector2Path] ')'
selector2Path ::= Path
Parameters| Name | Type | Description |
|---|
| $sel1Name | string | |
|---|
| $sel2Name | string | |
|---|
| $sel2Path | string | |
|---|
Returns 


evalSelector(string $nodeTypeName, string $selectorName = null) : stringSelector ::= nodeTypeName ['AS' selectorName]
nodeTypeName ::= Name
Parameters| Name | Type | Description |
|---|
| $nodeTypeName | string | The node type of the selector. If it does not contain starting and ending brackets ([]) they will be added automatically
|
|---|
| $selectorName | string | |
|---|
Returns