Class SqlSimpleParser


  • public class SqlSimpleParser
    extends java.lang.Object
    A simple parser that takes an incomplete and turn it into a syntactically correct statement. It is used in the SQL editor user-interface.
    • Field Detail

      • hintToken

        private final java.lang.String hintToken
    • Constructor Detail

      • SqlSimpleParser

        @Deprecated
        public SqlSimpleParser​(java.lang.String hintToken)
        Deprecated.
        Creates a SqlSimpleParser
        Parameters:
        hintToken - Hint token
      • SqlSimpleParser

        public SqlSimpleParser​(java.lang.String hintToken,
                               SqlParser.Config parserConfig)
        Creates a SqlSimpleParser
        Parameters:
        hintToken - Hint token
        parserConfig - parser configuration
    • Method Detail

      • simplifySql

        public java.lang.String simplifySql​(java.lang.String sql,
                                            int cursor)
        Turns a partially completed or syntactically incorrect sql statement into a simplified, valid one that can be passed into getCompletionHints().
        Parameters:
        sql - A partial or syntactically incorrect sql statement
        cursor - to indicate column position in the query at which completion hints need to be retrieved.
        Returns:
        a completed, valid (and possibly simplified SQL statement
      • simplifySql

        public java.lang.String simplifySql​(java.lang.String sql)
        Turns a partially completed or syntactically incorrect sql statement into a simplified, valid one that can be validated
        Parameters:
        sql - A partial or syntactically incorrect sql statement
        Returns:
        a completed, valid (and possibly simplified) SQL statement