phpcr/src/PHPCR/Query/QueryInterface.php
Copyright 2008-2011 Karsten Dambekalns karsten@typo3.org
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.
\PHPCR\Query\QueryInterface
PHPCR Note: Instead of the dropped ValueInterface, bindValue uses native php variables
- Children
- \PHPCR\Query\QOM\QueryObjectModelInterface
- Api
Constants
Methods
bindValue(string $varName, mixed $value) : void
Binds the given value to the variable named $varName.
Name | Type | Description |
---|---|---|
$varName | string | name of variable in query |
$value | mixed | value to bind |
Exception | Description |
---|---|
\InvalidArgumentException | if $varName is not a valid variable in this query. |
\PHPCR\RepositoryException | if an error occurs. |
- Api
execute() : \PHPCR\Query\QueryResultInterface
Executes this query and returns a QueryResult object.
Type | Description |
---|---|
\PHPCR\Query\QueryResultInterface | a QueryResult object |
Exception | Description |
---|---|
\PHPCR\Query\InvalidQueryException | if the query contains an unbound variable. |
\PHPCR\RepositoryException | if an error occurs |
- Api
getBindVariableNames() : array
Returns the names of the bind variables in this query.
If this query does not contains any bind variables then an empty array is returned.
Type | Description |
---|---|
array | the names of the bind variables in this query. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
getLanguage() : string
Returns the language set for this query.
This will be one of the query language constants returned by QueryManagerInterface::getSupportedQueryLanguages().
Type | Description |
---|---|
string | The query language. |
- Api
getStatement() : string
Returns the statement defined for this query.
If the language of this query is string-based (like JCR-SQL2), this method will return the statement that was used to create this query.
If the language of this query is JCR-JQOM, this method will return the JCR-SQL2 equivalent of the JCR-JQOM object tree.
This is the standard serialization of JCR-JQOM and is also the string stored in the jcr:statement property if the query is persisted. See storeAsNode($absPath).
Type | Description |
---|---|
string | The query statement. |
- Api
getStoredQueryPath() : string
Fetches the path of the node representing this query.
If this is a Query object that has been stored using QueryInterface::storeAsNode() (regardless of whether it has been saved yet) or retrieved using QueryManagerInterface::getQuery()), then this method returns the path of the nt:query node that stores the query.
Type | Description |
---|---|
string | Path of the node representing this query. |
Exception | Description |
---|---|
\PHPCR\ItemNotFoundException | if this query is not a stored query. |
\PHPCR\RepositoryException | if another error occurs. |
- Api
setLimit(integer $limit) : void
Sets the maximum size of the result set to limit.
Name | Type | Description |
---|---|---|
$limit | integer | The amount of result items to be fetched. |
- Api
setOffset(integer $offset) : void
Sets the start offset of the result set to offset.
Name | Type | Description |
---|---|---|
$offset | integer | The start point of the result set from when the item shall be fetched. |
- Api
storeAsNode(string $absPath) : \PHPCR\NodeInterface
Creates a node of type nt:query holding this query at $absPath and returns that node.
This is a session-write method and therefore requires a SessionInterface::save() to dispatch the change.
The $absPath provided must not have an index on its final element. If ordering is supported by the node type of the parent node then the new node is appended to the end of the child node list.
Name | Type | Description |
---|---|---|
$absPath | string | absolute path the query should be stored at |
Type | Description |
---|---|
\PHPCR\NodeInterface | the newly created node. |
Exception | Description |
---|---|
\PHPCR\ItemExistsException | if an item at the specified path already exists, same-name siblings are not allowed and this implementation performs this validation immediately. |
\PHPCR\PathNotFoundException | if the specified path implies intermediary Nodes that do not exist or the last element of relPath has an index, and this implementation performs this validation immediately. |
\PHPCR\NodeType\ConstraintViolationException | if a node type or implementation-specific constraint is violated or if an attempt is made to add a node as the child of a property and this implementation performs this validation immediately. |
\PHPCR\Version\VersionException | if the node to which the new child is being added is read-only due to a checked-in node and this implementation performs this validation immediately. |
\PHPCR\Lock\LockException | if a lock prevents the addition of the node and this implementation performs this validation immediately instead of waiting until save. |
\PHPCR\UnsupportedRepositoryOperationException | in a level 1 implementation. |
\PHPCR\RepositoryException | if another error occurs or if the absPath provided has an index on its final element. |
- Api