Class XPathToSQL2Converter


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

      Fields 
      Modifier and Type Field Description
      static boolean NODETYPE_OPTIMIZATION
      Optimize queries of the form "from [nt:base] where [jcr:primaryType] = 'x'" to "from [x] where [jcr:primaryType] = 'x'".
      static boolean NODETYPE_UNION
      Convert queries of the form "where [jcr:primaryType] = 'x' or [jcr:primaryType] = 'y'" to "select ...
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String convert​(java.lang.String query)
      Convert the query to SQL2.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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 Detail

      • XPathToSQL2Converter

        public XPathToSQL2Converter()
    • Method Detail

      • convert

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