Logo Search packages:      
Sourcecode: mysql-connector-java version File versions

int com::mysql::jdbc::ResultSetMetaData::getPrecision ( int  column  )  throws SQLException [inline]

What is a column's number of decimal digits.

column the first column is 1, the second is 2...
the precision
SQLException if a database access error occurs

Definition at line 516 of file ResultSetMetaData.java.

References com::mysql::jdbc::Field::getDecimals(), getField(), com::mysql::jdbc::Field::getLength(), com::mysql::jdbc::Field::getMysqlType(), com::mysql::jdbc::Field::getPrecisionAdjustFactor(), com::mysql::jdbc::Field::getSQLType(), and isDecimalType().

        Field f = getField(column);

        if (isDecimalType(f.getSQLType())) {
            if (f.getDecimals() > 0) {
                return f.getLength() - 1 + f.getPrecisionAdjustFactor();

            return f.getLength() + f.getPrecisionAdjustFactor();

        switch (f.getMysqlType()) {
        case MysqlDefs.FIELD_TYPE_TINY_BLOB:
        case MysqlDefs.FIELD_TYPE_BLOB:
        case MysqlDefs.FIELD_TYPE_MEDIUM_BLOB:
        case MysqlDefs.FIELD_TYPE_LONG_BLOB:
            return f.getLength(); // this may change in the future
                                  // for now, the server only
                                  // returns FIELD_TYPE_BLOB for _all_
                                  // BLOB types, but varying lengths
                                  // indicating the _maximum_ size
                                  // for each BLOB type.
            return f.getLength();

Generated by  Doxygen 1.6.0   Back to index