Commit 7e1e7f54 authored by codefairy08's avatar codefairy08
Browse files

#2211 bug fixs and add test case

parent 37a92d86
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -100,6 +100,10 @@ public final class ExpressionExtractor {
        if (numberNode.isPresent()) {
            result.setLiterals(NumberUtil.getExactlyNumber(numberNode.get().getText(), 10));
        }
        Optional<ParserRuleContext> doubleNode = ExtractorUtils.findFirstChildNode(expressionNode, RuleName.DOUBLE_VALUE);
        if (doubleNode.isPresent()) {
            result.setLiterals(Double.parseDouble(doubleNode.get().getText()));
        }
        Optional<ParserRuleContext> stringNode = ExtractorUtils.findFirstChildNode(expressionNode, RuleName.STRING);
        if (stringNode.isPresent()) {
            String text = stringNode.get().getText();
+2 −0
Original line number Diff line number Diff line
@@ -117,6 +117,8 @@ public enum RuleName {
    
    NUMBER("Number"),
    
    DOUBLE_VALUE("DoubleValue"),
    
    STRING("String"),
    
    EXPR("Expr"),
+5 −0
Original line number Diff line number Diff line
@@ -191,6 +191,7 @@ variable
literal
    : question
    | number
    | doubleValue
    | TRUE
    | FALSE
    | NULL
@@ -210,6 +211,10 @@ number
   : NUMBER_
   ;

doubleValue
   : DOUBLE_VALUE_
   ;

string
    : STRING_
    ;
+5 −1
Original line number Diff line number Diff line
@@ -30,7 +30,11 @@ STRING_
    ;

NUMBER_
    : MINUS_? INT_? DOT_? INT_ (E [+\-]? INT_)?
    : MINUS_? INT_
    ;

DOUBLE_VALUE_
    : MINUS_? INT_? DOT_ INT_ (E [+\-]? INT_)?
    ;

HEX_DIGIT_
+12 −0
Original line number Diff line number Diff line
@@ -618,4 +618,16 @@
            <and-condition/>
        </or-condition>
    </parser-result>
    <parser-result sql-case-id="insert_with_double_value">
        <tables>
            <table name="t_double_test" />
        </tables>
        <tokens>
            <table-token start-index="12" table-name="t_double_test" length="13" />
            <insert-values-token begin-position="25" />
        </tokens>
        <or-condition>
            <and-condition/>
        </or-condition>
    </parser-result>
</parser-result-sets>
Loading