Class DatabaseType

  • All Implemented Interfaces:
    Expression

    public final class DatabaseType
    extends AbstractDoubleEncapsulatedExpression
    This expression represents the database specific data type, which may include size and scale.
    BNF: database_type ::= data_type_literal [( [numeric_literal [, numeric_literal]] )]
    BNF: data_type_literal ::= [CHAR, VARCHAR, NUMERIC, INTEGER, DATE, TIME, TIMESTAMP, etc]

    Example: CASE(e.name AS VARCHAR(20))

    Version:
    2.5
    Author:
    Pascal Filion
    Since:
    2.4
    • Constructor Detail

      • DatabaseType

        public DatabaseType​(AbstractExpression parent,
                            java.lang.String databaseType)
        Creates a new DatabaseType.
        Parameters:
        parent - The parent of this expression
        databaseType - The database type
    • Method Detail

      • parameterExpressionBNF

        public java.lang.String parameterExpressionBNF​(int index)
        Returns the BNF to be used to parse one of the encapsulated expression.
        Specified by:
        parameterExpressionBNF in class AbstractDoubleEncapsulatedExpression
        Parameters:
        index - The position of the encapsulated Expression that needs to be parsed within the parenthesis, which starts at position 0
        Returns:
        The BNF to be used to parse one of the encapsulated expression
      • shouldParseRightParenthesis

        protected boolean shouldParseRightParenthesis​(WordParser wordParser,
                                                      boolean tolerant)
        Determines whether the right parenthesis should be parsed or not by this expression. There is a possible case where this expression should have optional left and right parenthesis. If there is no left parenthesis, then it would most likely mean the right parenthesis does not belong to this expression.
        Overrides:
        shouldParseRightParenthesis in class AbstractEncapsulatedExpression
        Parameters:
        wordParser - The text to parse based on the current position of the cursor
        tolerant - Determines whether the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queries
        Returns:
        true if the right parenthesis should be owned by this expression if it is the next character to scan; false otherwise