The ResultSet that is returned by DatabaseMetadata#getTypeInfo has a column at index 2 with the name DATA_TYPE. This field should contain one of the java.sql.Types constants, or a vendor-specific type code. The JDBC specification states that this column should be a short (although the constants in java.sql.Types are of type int).
Cloud Spanner (at the time of writing) does not support any int16 fields. The type code is therefore returned as an int64. The codes that are used for vendor-specific types by Spanner exceed the max value of a short, and therefore resulted in an OUT_OF_RANGE exception if you tried to call ResultSet#getShort(int) on this column for any of the Spanner-specific types (e.g. JSON).
This change fixes that by adding an additional vendor type code for these types that does fit in a short. This value is returned when getShort(int) is called on the ResultSet.
The ResultSet that is returned by DatabaseMetadata#getTypeInfo has a column at index 2 with the name DATA_TYPE. This field should contain one of the java.sql.Types constants, or a vendor-specific type code. The JDBC specification states that this column should be a
short
(although the constants in java.sql.Types are of typeint
).Cloud Spanner (at the time of writing) does not support any int16 fields. The type code is therefore returned as an int64. The codes that are used for vendor-specific types by Spanner exceed the max value of a
short
, and therefore resulted in an OUT_OF_RANGE exception if you tried to callResultSet#getShort(int)
on this column for any of the Spanner-specific types (e.g. JSON).This change fixes that by adding an additional vendor type code for these types that does fit in a
short
. This value is returned whengetShort(int)
is called on the ResultSet.Fixes #1688