@Test public void testTransformAndParse() throws ParseException { p.parse(new XPathToSQL2Converter() .convert("/jcr:root/test*/nt:resource[@jcr:encoding]")); String xpath = "/jcr:root/etc/commerce/products/@size= 'M' or ***@size = 'M' or **/*/@size = 'M'))]"; p.parse(new XPathToSQL2Converter() .convert(xpath)); }
public Query parse(final String query, final boolean initialise) throws ParseException { initialize(query); selectors.clear(); expected = new ArrayList<String>(); bindVariables = new HashMap<String, BindVariableValueImpl>(); read(); boolean explain = false, measure = false; if (readIf("EXPLAIN")) { explain = true; } if (readIf("MEASURE")) { measure = true; } Query q = parseSelect(); while (true) { if (!readIf("UNION")) { break; } boolean unionAll = readIf("ALL"); QueryImpl q2 = parseSelect(); q = new UnionQueryImpl(unionAll, q, q2, settings); } OrderingImpl[] orderings = null; if (readIf("ORDER")) { read("BY"); orderings = parseOrder(); } QueryOptions options = new QueryOptions(); if (readIf("OPTION")) { read("("); while (true) { if (readIf("TRAVERSAL")) { String n = readName().toUpperCase(Locale.ENGLISH); options.traversal = Traversal.valueOf(n); } else if (readIf("INDEX")) { if (readIf("NAME")) { options.indexName = readName(); } else if (readIf("TAG")) { options.indexTag = readLabel(); } } else { break; } readIf(","); } read(")"); } if (!currentToken.isEmpty()) { throw getSyntaxError("<end>"); } q.setOrderings(orderings); q.setExplain(explain); q.setMeasure(measure); q.setInternal(isInternal(query)); q.setQueryOptions(options); if (initialise) { try { q.init(); } catch (Exception e) { ParseException e2 = new ParseException(statement + ": " + e.getMessage(), 0); e2.initCause(e); throw e2; } } return q; }
SQL2Parser { public Query parse(final String query, final boolean initialise) throws ParseException { initialize(query); selectors.clear(); expected = new ArrayList<String>(); bindVariables = new HashMap<String, BindVariableValueImpl>(); read(); boolean explain = false, measure = false; if (readIf("EXPLAIN")) { explain = true; } if (readIf("MEASURE")) { measure = true; } Query q = parseSelect(); while (true) { if (!readIf("UNION")) { break; } boolean unionAll = readIf("ALL"); QueryImpl q2 = parseSelect(); q = new UnionQueryImpl(unionAll, q, q2, settings); } OrderingImpl[] orderings = null; if (readIf("ORDER")) { read("BY"); orderings = parseOrder(); } QueryOptions options = new QueryOptions(); if (readIf("OPTION")) { read("("); while (true) { if (readIf("TRAVERSAL")) { String n = readName().toUpperCase(Locale.ENGLISH); options.traversal = Traversal.valueOf(n); } else if (readIf("INDEX")) { if (readIf("NAME")) { options.indexName = readName(); } else if (readIf("TAG")) { options.indexTag = readLabel(); } } else { break; } readIf(","); } read(")"); } if (!currentToken.isEmpty()) { throw getSyntaxError("<end>"); } q.setOrderings(orderings); q.setExplain(explain); q.setMeasure(measure); q.setInternal(isInternal(query)); q.setQueryOptions(options); if (initialise) { try { q.init(); } catch (Exception e) { ParseException e2 = new ParseException(statement + ": " + e.getMessage(), 0); e2.initCause(e); throw e2; } } return q; } }
SQL2Parser { public Query parse(final String query, final boolean initialise) throws ParseException { initialize(query); selectors.clear(); expected = new ArrayList<String>(); bindVariables = new HashMap<String, BindVariableValueImpl>(); read(); boolean explain = false, measure = false; if (readIf("EXPLAIN")) { explain = true; } if (readIf("MEASURE")) { measure = true; } Query q = parseSelect(); while (true) { if (!readIf("UNION")) { break; } boolean unionAll = readIf("ALL"); QueryImpl q2 = parseSelect(); q = new UnionQueryImpl(unionAll, q, q2, settings); } OrderingImpl[] orderings = null; if (readIf("ORDER")) { read("BY"); orderings = parseOrder(); } QueryOptions options = new QueryOptions(); if (readIf("OPTION")) { read("("); while (true) { if (readIf("TRAVERSAL")) { String n = readName().toUpperCase(Locale.ENGLISH); options.traversal = Traversal.valueOf(n); } else if (readIf("INDEX")) { if (readIf("NAME")) { options.indexName = readName(); } else if (readIf("TAG")) { options.indexTag = readLabel(); } } else { break; } readIf(","); } read(")"); } if (!currentToken.isEmpty()) { throw getSyntaxError("<end>"); } q.setOrderings(orderings); q.setExplain(explain); q.setMeasure(measure); q.setInternal(isInternal(query)); q.setQueryOptions(options); if (initialise) { try { q.init(); } catch (Exception e) { ParseException e2 = new ParseException(statement + ": " + e.getMessage(), 0); e2.initCause(e); throw e2; } } return q; } SQL2Parser(NamePathMapper namePathMapper, NodeTypeInfoProvider nodeTypes, QueryEngineSettings settings,
            QueryExecutionStats stats); }
SQL2Parser { public Query parse(final String query, final boolean initialise) throws ParseException { initialize(query); selectors.clear(); expected = new ArrayList<String>(); bindVariables = new HashMap<String, BindVariableValueImpl>(); read(); boolean explain = false, measure = false; if (readIf("EXPLAIN")) { explain = true; } if (readIf("MEASURE")) { measure = true; } Query q = parseSelect(); while (true) { if (!readIf("UNION")) { break; } boolean unionAll = readIf("ALL"); QueryImpl q2 = parseSelect(); q = new UnionQueryImpl(unionAll, q, q2, settings); } OrderingImpl[] orderings = null; if (readIf("ORDER")) { read("BY"); orderings = parseOrder(); } QueryOptions options = new QueryOptions(); if (readIf("OPTION")) { read("("); while (true) { if (readIf("TRAVERSAL")) { String n = readName().toUpperCase(Locale.ENGLISH); options.traversal = Traversal.valueOf(n); } else if (readIf("INDEX")) { if (readIf("NAME")) { options.indexName = readName(); } else if (readIf("TAG")) { options.indexTag = readLabel(); } } else { break; } readIf(","); } read(")"); } if (!currentToken.isEmpty()) { throw getSyntaxError("<end>"); } q.setOrderings(orderings); q.setExplain(explain); q.setMeasure(measure); q.setInternal(isInternal(query)); q.setQueryOptions(options); if (initialise) { try { q.init(); } catch (Exception e) { ParseException e2 = new ParseException(statement + ": " + e.getMessage(), 0); e2.initCause(e); throw e2; } } return q; } SQL2Parser(NamePathMapper namePathMapper, NodeTypeInfoProvider nodeTypes, QueryEngineSettings settings,
            QueryExecutionStats stats); Query parse(final String query, final boolean initialise); Query parse(final String query); void setSupportSQL1(boolean sql1); static int getPropertyTypeFromName(String name); static String escapeStringLiteral(String value); void setAllowTextLiterals(boolean allowTextLiterals); void setAllowNumberLiterals(boolean allowNumberLiterals); void setIncludeSelectorNameInWildcardColumns(boolean value); static boolean isInternal(String statement); }
SQL2Parser { public Query parse(final String query, final boolean initialise) throws ParseException { initialize(query); selectors.clear(); expected = new ArrayList<String>(); bindVariables = new HashMap<String, BindVariableValueImpl>(); read(); boolean explain = false, measure = false; if (readIf("EXPLAIN")) { explain = true; } if (readIf("MEASURE")) { measure = true; } Query q = parseSelect(); while (true) { if (!readIf("UNION")) { break; } boolean unionAll = readIf("ALL"); QueryImpl q2 = parseSelect(); q = new UnionQueryImpl(unionAll, q, q2, settings); } OrderingImpl[] orderings = null; if (readIf("ORDER")) { read("BY"); orderings = parseOrder(); } QueryOptions options = new QueryOptions(); if (readIf("OPTION")) { read("("); while (true) { if (readIf("TRAVERSAL")) { String n = readName().toUpperCase(Locale.ENGLISH); options.traversal = Traversal.valueOf(n); } else if (readIf("INDEX")) { if (readIf("NAME")) { options.indexName = readName(); } else if (readIf("TAG")) { options.indexTag = readLabel(); } } else { break; } readIf(","); } read(")"); } if (!currentToken.isEmpty()) { throw getSyntaxError("<end>"); } q.setOrderings(orderings); q.setExplain(explain); q.setMeasure(measure); q.setInternal(isInternal(query)); q.setQueryOptions(options); if (initialise) { try { q.init(); } catch (Exception e) { ParseException e2 = new ParseException(statement + ": " + e.getMessage(), 0); e2.initCause(e); throw e2; } } return q; } SQL2Parser(NamePathMapper namePathMapper, NodeTypeInfoProvider nodeTypes, QueryEngineSettings settings,
            QueryExecutionStats stats); Query parse(final String query, final boolean initialise); Query parse(final String query); void setSupportSQL1(boolean sql1); static int getPropertyTypeFromName(String name); static String escapeStringLiteral(String value); void setAllowTextLiterals(boolean allowTextLiterals); void setAllowNumberLiterals(boolean allowNumberLiterals); void setIncludeSelectorNameInWildcardColumns(boolean value); static boolean isInternal(String statement);  }