Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Bruno Cardoso
RE: Oracle Number type [ reply ]  
2010-07-16 13:36
I think the problem is in this method of RubyJdbcConnection:

private String typeFromResultSet(ResultSet resultSet, boolean numberAsBoolean) throws SQLException {
int precision = intFromResultSet(resultSet, COLUMN_SIZE);
int scale = intFromResultSet(resultSet, DECIMAL_DIGITS);

// Assume db's which use decimal for boolean will not also specify a
// valid precision 1 decimal also. Seems sketchy to me...
if (numberAsBoolean && precision != 1 &&
resultSet.getInt(DATA_TYPE) == java.sql.Types.DECIMAL) precision = -1;

String type = resultSet.getString(TYPE_NAME);
if (precision > 0) {
type += "(" + precision;
if(scale > 0) type += "," + scale;
type += ")";
}

return type;
}

By: Bruno Cardoso
Oracle Number type [ reply ]  
2010-07-16 11:42
Hi,

I'm having a problem with oracle bd and jdbc adapter for ruby. All my number field with the exception of "id" are being treated as BigDecimals even if they don't have a scale.

I did a little of debugging and this seam to be cause by the fact that simplified_type() receives only 'NUMBER' as the field_type, it gets no information about precision or scale so he assumes it is always decimal.

I'm trying to understand where this information comes from so I can do a monkeypatch, any idea on how to resolve this?

Thanks