Class SQL2Parser


  • public class SQL2Parser
    extends Object
    The SQL2 parser can convert a JCR-SQL2 query to a query. The 'old' SQL query language (here named SQL-1) is also supported.
    • Method Detail

      • parse

        public Query parse​(String query,
                           boolean initialise)
                    throws ParseException
        Parse the statement and return the query.
        Parameters:
        query - the query string
        initialise - if performing the query init (true) or not (false)
        Returns:
        the query
        Throws:
        ParseException - if parsing fails
      • setSupportSQL1

        public void setSupportSQL1​(boolean sql1)
        Enable or disable support for SQL-1 queries.
        Parameters:
        sql1 - the new value
      • getPropertyTypeFromName

        public static int getPropertyTypeFromName​(String name)
        Get the property type from the given case insensitive name.
        Parameters:
        name - the property type name (case insensitive)
        Returns:
        the type, or PropertyType.UNDEFINED if unknown
      • escapeStringLiteral

        public static String escapeStringLiteral​(String value)
      • setAllowTextLiterals

        public void setAllowTextLiterals​(boolean allowTextLiterals)
        Enable or disable support for text literals in queries. The default is enabled.
        Parameters:
        allowTextLiterals -
      • setAllowNumberLiterals

        public void setAllowNumberLiterals​(boolean allowNumberLiterals)
      • setIncludeSelectorNameInWildcardColumns

        public void setIncludeSelectorNameInWildcardColumns​(boolean value)
      • isInternal

        public static boolean isInternal​(String statement)
        Whether the given statement is an internal query.
        Parameters:
        statement - the statement
        Returns:
        true for an internal query