Skip to content
This repository was archived by the owner on Aug 15, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -724,16 +724,15 @@ public static Object getSerialFromProto(Common.TypedValue protoValue) {
return Float.intBitsToFloat((int) protoValue.getNumberValue());
case INTEGER:
case PRIMITIVE_INT:
case JAVA_SQL_DATE:
case JAVA_SQL_TIME:
return Long.valueOf(protoValue.getNumberValue()).intValue();
case PRIMITIVE_SHORT:
case SHORT:
return Long.valueOf(protoValue.getNumberValue()).shortValue();
case LONG:
case PRIMITIVE_LONG:
return Long.valueOf(protoValue.getNumberValue());
case JAVA_SQL_DATE:
case JAVA_SQL_TIME:
return Long.valueOf(protoValue.getNumberValue()).intValue();
case NUMBER:
case JAVA_SQL_TIMESTAMP:
case JAVA_UTIL_DATE:
return protoValue.getNumberValue();
Expand All @@ -747,8 +746,6 @@ public static Object getSerialFromProto(Common.TypedValue protoValue) {
return new BigDecimal(bigInt, (int) protoValue.getNumberValue());
}
return new BigDecimal(protoValue.getStringValueBytes().toStringUtf8());
case NUMBER:
return Long.valueOf(protoValue.getNumberValue());
case NULL:
return null;
case ARRAY:
Expand Down Expand Up @@ -802,7 +799,7 @@ public static Common.Rep toProto(Common.TypedValue.Builder builder, Object o) {
writeToProtoWithType(builder, o, Common.Rep.DOUBLE);
return Common.Rep.DOUBLE;
} else if (o instanceof Float) {
writeToProtoWithType(builder, ((Float) o).longValue(), Common.Rep.FLOAT);
writeToProtoWithType(builder, o, Common.Rep.FLOAT);
return Common.Rep.FLOAT;
} else if (o instanceof BigDecimal) {
writeToProtoWithType(builder, o, Common.Rep.BIG_DECIMAL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1318,8 +1318,9 @@ private Object convertValue() throws SQLException {
return componentAccessor.getInt();
case Types.BIGINT:
return componentAccessor.getLong();
case Types.FLOAT:
case Types.REAL:
return componentAccessor.getFloat();
case Types.FLOAT:
case Types.DOUBLE:
return componentAccessor.getDouble();
case Types.ARRAY:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.sql.Struct;
import java.sql.Time;
import java.sql.Timestamp;
Expand Down Expand Up @@ -226,9 +225,9 @@ private static Object getValue(ResultSet resultSet, int type, int j,
try {
// Recursively extracts an Array using its ResultSet-representation
return extractUsingResultSet(array, calendar);
} catch (UnsupportedOperationException | SQLFeatureNotSupportedException e) {
// Not every database might implement Array.getResultSet(). This call
// assumes a non-nested array (depends on the db if that's a valid assumption)
} catch (Exception e) {
// Not every database might implement Array.getResultSet() using the expected structure.
// This call assumes a non-nested array (depends on the db if that's a valid assumption)
return extractUsingArray(array, calendar);
}
case Types.STRUCT:
Expand Down