Example usage for java.sql DatabaseMetaData typeNullable

List of usage examples for java.sql DatabaseMetaData typeNullable

Introduction

In this page you can find the example usage for java.sql DatabaseMetaData typeNullable.

Prototype

int typeNullable

To view the source code for java.sql DatabaseMetaData typeNullable.

Click Source Link

Document

Indicates that a NULL value is allowed for this data type.

Usage

From source file:com.tesora.dve.db.NativeType.java

public boolean isNullable() {
    return (nullability == DatabaseMetaData.typeNullable ? true : false);
}

From source file:com.tesora.dve.db.NativeType.java

public NativeType isNullable(boolean nullable) {
    setNullability((short) (nullable ? DatabaseMetaData.typeNullable : DatabaseMetaData.typeNoNulls));
    return this;
}

From source file:com.manydesigns.portofino.model.database.ConnectionProvider.java

protected void readType(ResultSet typeRs) throws SQLException {
    String typeName = typeRs.getString("TYPE_NAME");
    int dataType = typeRs.getInt("DATA_TYPE");
    Integer maximumPrecision;/*w  w w  . j a  va 2s.  com*/
    Object maximumPrecisionObj = typeRs.getObject("PRECISION");
    if (maximumPrecisionObj instanceof Number) {
        maximumPrecision = ((Number) maximumPrecisionObj).intValue();
    } else {
        maximumPrecision = null;
        logger.warn("Cannot get maximum precision for type: {} value: {}", typeName, maximumPrecisionObj);
    }
    String literalPrefix = typeRs.getString("LITERAL_PREFIX");
    String literalSuffix = typeRs.getString("LITERAL_SUFFIX");
    boolean nullable = (typeRs.getShort("NULLABLE") == DatabaseMetaData.typeNullable);
    boolean caseSensitive = typeRs.getBoolean("CASE_SENSITIVE");
    boolean searchable = (typeRs.getShort("SEARCHABLE") == DatabaseMetaData.typeSearchable);
    boolean autoincrement = typeRs.getBoolean("AUTO_INCREMENT");
    short minimumScale = typeRs.getShort("MINIMUM_SCALE");
    short maximumScale = typeRs.getShort("MAXIMUM_SCALE");

    Type type = new Type(typeName, dataType, maximumPrecision, literalPrefix, literalSuffix, nullable,
            caseSensitive, searchable, autoincrement, minimumScale, maximumScale);
    types.add(type);
}