private static void convertType()

in rm-datasource/src/main/java/org/apache/seata/rm/datasource/DataCompareUtils.java [93:132]


    private static void convertType(Field f0, Field f1) {
        int f0Type = f0.getType();
        int f1Type = f1.getType();
        if (f0Type == Types.DATE && f0.getValue().getClass().equals(String.class)) {
            String[] strings = f0.getValue().toString().split(" ");
            f0.setValue(Date.valueOf(strings[0]));
        }
        if (f1Type == Types.DATE && f1.getValue().getClass().equals(String.class)) {
            String[] strings = f1.getValue().toString().split(" ");
            f1.setValue(Date.valueOf(strings[0]));
        }
        if (f0Type == Types.TIME && f0.getValue().getClass().equals(String.class)) {
            f0.setValue(Time.valueOf(f0.getValue().toString()));
        }
        if (f1Type == Types.TIME && f1.getValue().getClass().equals(String.class)) {
            f1.setValue(Time.valueOf(f1.getValue().toString()));
        }
        if (f0Type == Types.TIMESTAMP && f0.getValue().getClass().equals(String.class)) {
            if (f1.getValue().getClass().equals(LocalDateTime.class)) {
                f0.setValue(LocalDateTime.parse(f0.getValue().toString()));
            } else {
                f0.setValue(Timestamp.valueOf(f0.getValue().toString()));
            }
        }
        if (f1Type == Types.TIMESTAMP && f1.getValue().getClass().equals(String.class)) {
            f1.setValue(Timestamp.valueOf(f1.getValue().toString()));
        }
        if (f0Type == Types.DECIMAL && f0.getValue().getClass().equals(Integer.class)) {
            f0.setValue(new BigDecimal(f0.getValue().toString()));
        }
        if (f1Type == Types.DECIMAL && f1.getValue().getClass().equals(Integer.class)) {
            f1.setValue(new BigDecimal(f1.getValue().toString()));
        }
        if (f0Type == Types.BIGINT && f0.getValue().getClass().equals(Integer.class)) {
            f0.setValue(Long.parseLong(f0.getValue().toString()));
        }
        if (f1Type == Types.BIGINT && f1.getValue().getClass().equals(Integer.class)) {
            f1.setValue(Long.parseLong(f1.getValue().toString()));
        }
    }