Class XPathToSQL2Converter

java.lang.Object
org.apache.jackrabbit.oak.query.xpath.XPathToSQL2Converter

public class XPathToSQL2Converter extends Object
This class can can convert a XPATH query to a SQL2 query.
  • Field Details

    • NODETYPE_OPTIMIZATION

      public static final boolean NODETYPE_OPTIMIZATION
      Optimize queries of the form "from [nt:base] where [jcr:primaryType] = 'x'" to "from [x] where [jcr:primaryType] = 'x'". Enabled by default.
    • NODETYPE_UNION

      public static final boolean NODETYPE_UNION
      Convert queries of the form "where [jcr:primaryType] = 'x' or [jcr:primaryType] = 'y'" to "select ... where [jcr:primaryType] = 'x' union select ... where [jcr:primaryType] = 'y'". If disabled, only one query with "where [jcr:primaryType] in ('x', 'y') is used. Enabled by default.
  • Constructor Details

    • XPathToSQL2Converter

      public XPathToSQL2Converter()
    • XPathToSQL2Converter

      public XPathToSQL2Converter(QueryEngineSettings settings)
  • Method Details

    • convert

      public String convert(String query) throws ParseException
      Convert the query to SQL2.
      Parameters:
      query - the query string
      Returns:
      the SQL2 query
      Throws:
      ParseException - if parsing fails