Unverified Commit de982303 authored by 张亮's avatar 张亮 Committed by GitHub
Browse files

Merge pull request #2216 from codefairy08/dev_bug_fixs_2211

#2211 bug fixs and add test case
parents d26e3c3e 75e71edb
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -69,6 +69,14 @@ public final class NumberUtil {
     * @return exactly number value and type
     */
    public static Number getExactlyNumber(final String value, final int radix) {
        try {
            return getBigInteger(value, radix);
        } catch (final NumberFormatException ex) {
            return new BigDecimal(value);
        }
    }
    
    private static Number getBigInteger(final String value, final int radix) {
        BigInteger result = new BigInteger(value, radix);
        if (result.compareTo(new BigInteger(String.valueOf(Integer.MIN_VALUE))) >= 0 && result.compareTo(new BigInteger(String.valueOf(Integer.MAX_VALUE))) <= 0) {
            return result.intValue();
+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>
+1 −0
Original line number Diff line number Diff line
@@ -43,4 +43,5 @@
    <!--<sql-case id="insert_on_duplicate_key_update_with_table_identifier" value="INSERT INTO t_order (t_order.order_id, t_order.user_id, t_order.status) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE t_order.status = VALUES(t_order.status)" db-types="MySQL" />-->
    <sql-case id="insert_with_geography" value="INSERT INTO t_place(user_new_id, guid, start_point,rule) VALUES (?, ?, ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')'), ?::jsonb)" db-types="PostgreSQL" />
    <sql-case id="insert_with_one_auto_increment_column" value="INSERT INTO t_auto_increment_table values()" db-types="MySQL" />
    <sql-case id="insert_with_double_value" value="INSERT INTO t_double_test(test_value) values(1.22)" db-types="MySQL" />
</sql-cases>