@ Override public float getFloat ( int columnIndex ) throws SQLException { checkColumnBounds ( columnIndex ) ; try { final VoltType type = table . getColumnType ( columnIndex - 1 ) ; Double doubleValue = null ; switch ( type ) { case TINYINT : doubleValue = new Double ( table . getLong ( columnIndex - 1 ) ) ; break ; case SMALLINT : doubleValue = new Double ( table . getLong ( columnIndex - 1 ) ) ; break ; case INTEGER : doubleValue = new Double ( table . getLong ( columnIndex - 1 ) ) ; break ; case BIGINT : doubleValue = new Double ( table . getLong ( columnIndex - 1 ) ) ; break ; case FLOAT : doubleValue = new Double ( table . getDouble ( columnIndex - 1 ) ) ; break ; case DECIMAL : doubleValue = table . getDecimalAsBigDecimal ( columnIndex - 1 ) . doubleValue ( ) ; break ; default : throw new IllegalArgumentException ( "Cannot get float value for column type '" + type + "'" ) ; } if ( table . wasNull ( ) ) { doubleValue = new Double ( 0 ) ; } else if ( Math . abs ( doubleValue ) > new Double ( Float . MAX_VALUE ) ) { throw new SQLException ( "Value out of float range" ) ; } return doubleValue . floatValue ( ) ; } catch ( Exception x ) { throw SQLError . get ( x ) ; } }
ResultSet object as a float in the Java programming language .