Class JCRSQLQueryBuilder
- java.lang.Object
-
- org.apache.jackrabbit.spi.commons.query.sql.JCRSQLQueryBuilder
-
- All Implemented Interfaces:
JCRSQLParserVisitor
public class JCRSQLQueryBuilder extends Object implements JCRSQLParserVisitor
Implements the query builder for the JCR SQL syntax.
-
-
Method Summary
-
-
-
Method Detail
-
createQuery
public static QueryRootNode createQuery(String statement, NameResolver resolver, QueryNodeFactory factory) throws InvalidQueryException
Creates aQueryNode
tree from a SQLstatement
using the passed query nodefactory
.- Parameters:
statement
- the SQL statement.resolver
- the namespace resolver to use.- Returns:
- the
QueryNode
tree. - Throws:
InvalidQueryException
- ifstatement
is malformed.
-
toString
public static String toString(QueryRootNode root, NameResolver resolver) throws InvalidQueryException
Creates a String representation of the query node tree in SQL syntax.- Parameters:
root
- the root of the query node tree.resolver
- to resolve QNames.- Returns:
- a String representation of the query node tree.
- Throws:
InvalidQueryException
- if the query node tree cannot be converted into a String representation due to restrictions in SQL.
-
visit
public Object visit(SimpleNode node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTQuery node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTSelectList node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTFromClause node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTWhereClause node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTPredicate node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTOrExpression node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTAndExpression node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTNotExpression node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTBracketExpression node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTLiteral node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTIdentifier node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTOrderByClause node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTOrderSpec node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTAscendingOrderSpec node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTDescendingOrderSpec node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTContainsExpression node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTLowerFunction node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTUpperFunction node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public Object visit(ASTExcerptFunction node, Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
-