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) : string
Add square brackets around a selector if needed
ParametersName | Type | Description |
---|
$selector | string | |
---|
ReturnsType | Description |
---|
string | $selector guaranteed to have [] around it if needed |
evalChildNode(string $path, string $selectorName = null) : void
SameNode ::= 'ISCHILDNODE(' [selectorName ','] Path ')'
ParametersName | Type | Description |
---|
$path | string | |
---|
$selectorName | string | |
---|
evalChildNodeJoinCondition(string $childSelectorName, string $parentSelectorName) : string
ChildNodeJoinCondition ::=
'ISCHILDNODE(' childSelectorName ','
parentSelectorName ')'
childSelectorName ::= selectorName
parentSelectorName ::= selectorName
ParametersName | Type | Description |
---|
$childSelectorName | string | |
---|
$parentSelectorName | string | |
---|
Returns evalColumn(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
ParametersName | Type | Description |
---|
$selectorName | string | |
---|
$propertyName | string | |
---|
$colname | string | |
---|
Returns evalColumns( $columns) : string
columns ::= (Column ',' {Column}) | '*'
ParametersName | Type | Description |
---|
$columns | | |
---|
Returns evalDescendantNode(string $path, string $selectorName = null) : void
SameNode ::= 'ISDESCENDANTNODE(' [selectorName ','] Path ')'
ParametersName | Type | Description |
---|
$path | string | |
---|
$selectorName | string | |
---|
evalDescendantNodeJoinCondition(string $descendantSelectorName, string $ancestorselectorName) : string
DescendantNodeJoinCondition ::=
'ISDESCENDANTNODE(' descendantSelectorName ','
ancestorSelectorName ')'
descendantSelectorName ::= selectorName
ancestorSelectorName ::= selectorName
ParametersName | Type | Description |
---|
$descendantSelectorName | string | |
---|
$ancestorselectorName | string | |
---|
Returns evalEquiJoinCondition(string $sel1Name, string $prop1Name, string $sel2Name, string $prop2Name) : string
EquiJoinCondition ::= selector1Name'.'property1Name '='
selector2Name'.'property2Name
selector1Name ::= selectorName
selector2Name ::= selectorName
property1Name ::= propertyName
property2Name ::= propertyName
ParametersName | Type | Description |
---|
$sel1Name | string | |
---|
$prop1Name | string | |
---|
$sel2Name | string | |
---|
$prop2Name | string | |
---|
Returns evalFullTextSearch(string $selectorName, string $searchExpression, string $propertyName = null) : string
FullTextSearch ::=
'CONTAINS(' ([selectorName'.']propertyName |
selectorName'.*') ','
FullTextSearchExpression ')'
FullTextSearchExpression ::= BindVariable | ''' FullTextSearchLiteral '''
ParametersName | Type | Description |
---|
$selectorName | string | unusued |
---|
$searchExpression | string | |
---|
$propertyName | string | |
---|
Returns evalFullTextSearchScore(string $selectorValue = null) : void
FullTextSearchScore ::= 'SCORE(' [selectorName] ')'
ParametersName | Type | Description |
---|
$selectorValue | string | |
---|
evalJoin(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
ParametersName | Type | Description |
---|
$left | string | |
---|
$right | string | |
---|
$joinCondition | string | |
---|
$joinType | string | |
---|
ReturnsevalJoinType(string $joinType) : string
JoinType ::= Inner | LeftOuter | RightOuter
Inner ::= 'INNER'
LeftOuter ::= 'LEFT OUTER'
RightOuter ::= 'RIGHT OUTER'
ParametersName | Type | Description |
---|
$joinType | string | |
---|
Returns evalLength(string $propertyValue) : string
Length ::= 'LENGTH(' PropertyValue ')'
ParametersName | Type | Description |
---|
$propertyValue | string | |
---|
Returns evalNodeLocalName(string $selectorValue = null) : void
NodeLocalName ::= 'LOCALNAME(' [selectorName] ')'
ParametersName | Type | Description |
---|
$selectorValue | string | |
---|
evalNodeName(string $selectorValue = null) : void
NodeName ::= 'NAME(' [selectorName] ')'
ParametersName | Type | Description |
---|
$selectorValue | string | |
---|
evalPath(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.
ParametersName | Type | Description |
---|
$path | string | |
---|
ReturnsevalPropertyExistence( $selectorName, $propertyName) : string
PropertyExistence ::=
selectorName'.'propertyName 'IS NOT NULL' |
propertyName 'IS NOT NULL' If only one
selector exists in
this query
ParametersName | Type | Description |
---|
$selectorName | | |
---|
$propertyName | | |
---|
Returns evalPropertyValue(string $propertyName, string $selectorName = null) : void
PropertyValue ::= [selectorName'.'] propertyName // If only one selector exists
ParametersName | Type | Description |
---|
$propertyName | string | |
---|
$selectorName | string | |
---|
evalSameNode(string $path, string $selectorName = null) : void
SameNode ::= 'ISSAMENODE(' [selectorName ','] Path ')'
ParametersName | Type | Description |
---|
$path | string | |
---|
$selectorName | string | |
---|
evalSameNodeJoinCondition(string $sel1Name, string $sel2Name, string $sel2Path = null) : string
SameNodeJoinCondition ::=
'ISSAMENODE(' selector1Name ','
selector2Name
[',' selector2Path] ')'
selector2Path ::= Path
ParametersName | Type | Description |
---|
$sel1Name | string | |
---|
$sel2Name | string | |
---|
$sel2Path | string | |
---|
Returns evalSelector(string $nodeTypeName, string $selectorName = null) : string
Selector ::= nodeTypeName ['AS' selectorName]
nodeTypeName ::= Name
ParametersName | 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