Example usage for java.sql DatabaseMetaData typeSearchable

List of usage examples for java.sql DatabaseMetaData typeSearchable

Introduction

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

Prototype

int typeSearchable

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

Click Source Link

Document

Indicates that all WHERE search clauses can be based on this type.

Usage

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;/*from  ww w  . j a v  a  2s .  co  m*/
    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);
}