Example usage for java.sql Types TINYINT

List of usage examples for java.sql Types TINYINT

Introduction

In this page you can find the example usage for java.sql Types TINYINT.

Prototype

int TINYINT

To view the source code for java.sql Types TINYINT.

Click Source Link

Document

The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type TINYINT.

Usage

From source file:org.latticesoft.util.resource.dao.Param.java

private Object readValue(ResultSet rs) throws SQLException {
    Object retVal = null;//from w w  w . j av a  2  s.co  m
    switch (this.sqlType) {
    case Types.VARCHAR:
    case Types.CHAR:
        String s = null;
        if (this.getSqlIndex() == 0) {
            s = rs.getString(this.getSqlName());
        } else {
            s = rs.getString(this.getSqlIndex());
        }
        retVal = s;
        break;
    case Types.BOOLEAN:
        boolean b = false;
        if (this.getSqlIndex() == 0) {
            b = rs.getBoolean(this.getSqlName());
        } else {
            b = rs.getBoolean(this.getSqlIndex());
        }
        retVal = new Boolean(b);
        break;
    case Types.INTEGER:
        int i = 0;
        if (this.getSqlIndex() == 0) {
            i = rs.getInt(this.getSqlName());
        } else {
            i = rs.getInt(this.getSqlIndex());
        }
        retVal = new Integer(i);
        break;
    case Types.SMALLINT:
        short ss = 0;
        if (this.getSqlIndex() == 0) {
            ss = rs.getShort(this.getSqlName());
        } else {
            ss = rs.getShort(this.getSqlIndex());
        }
        retVal = new Short(ss);
        break;
    case Types.TINYINT:
        byte bb = 0;
        if (this.getSqlIndex() == 0) {
            bb = rs.getByte(this.getSqlName());
        } else {
            bb = rs.getByte(this.getSqlIndex());
        }
        retVal = new Byte(bb);
        break;
    case Types.BIGINT:
        long l = 0;
        if (this.getSqlIndex() == 0) {
            l = rs.getLong(this.getSqlName());
        } else {
            l = rs.getLong(this.getSqlIndex());
        }
        retVal = new Long(l);
        break;
    case Types.DOUBLE:
        double dd = 0;
        if (this.getSqlIndex() == 0) {
            dd = rs.getDouble(this.getSqlName());
        } else {
            dd = rs.getDouble(this.getSqlIndex());
        }
        retVal = new Double(dd);
        break;
    case Types.FLOAT:
        float f = 0;
        if (this.getSqlIndex() == 0) {
            f = rs.getFloat(this.getSqlName());
        } else {
            f = rs.getFloat(this.getSqlIndex());
        }
        retVal = new Float(f);
        break;
    case Types.NUMERIC:
        BigDecimal bd = null;
        if (this.getSqlIndex() == 0) {
            bd = rs.getBigDecimal(this.getSqlName());
        } else {
            bd = rs.getBigDecimal(this.getSqlIndex());
        }
        retVal = bd;
        break;
    case Types.TIMESTAMP:
        Timestamp ts = null;
        if (this.getSqlIndex() == 0) {
            ts = rs.getTimestamp(this.getSqlName());
        } else {
            ts = rs.getTimestamp(this.getSqlIndex());
        }
        retVal = ts;
        break;
    default:
        if (this.getSqlIndex() == 0) {
            retVal = rs.getObject(this.getSqlName());
        } else {
            retVal = rs.getObject(this.getSqlIndex());
        }
        break;
    }
    if (log.isDebugEnabled()) {
        log.debug(this.getAttribute() + "=" + retVal);
    }
    return retVal;
}

From source file:org.apache.cayenne.migration.MigrationGenerator.java

protected String nameForJdbcType(int type) {
    switch (type) {
    case Types.ARRAY:
        return "array";
    case Types.BIGINT:
        return "bigInt";
    case Types.BINARY:
        return "binary";
    case Types.BIT:
        return "bit";
    case Types.BLOB:
        return "blob";
    case Types.BOOLEAN:
        return "boolean";
    case Types.CHAR:
        return "char";
    case Types.CLOB:
        return "clob";
    case Types.DATE:
        return "date";
    case Types.DECIMAL:
        return "decimal";
    case Types.DOUBLE:
        return "double";
    case Types.FLOAT:
        return "float";
    case Types.INTEGER:
        return "integer";
    case Types.LONGVARBINARY:
        return "longVarBinary";
    case Types.LONGVARCHAR:
        return "longVarChar";
    case Types.NUMERIC:
        return "numeric";
    case Types.REAL:
        return "real";
    case Types.SMALLINT:
        return "smallInt";
    case Types.TIME:
        return "time";
    case Types.TIMESTAMP:
        return "timestamp";
    case Types.TINYINT:
        return "tinyInt";
    case Types.VARBINARY:
        return "varBinary";
    case Types.VARCHAR:
        return "varchar";
    default:/*from w ww . j  a v  a2 s. c om*/
        return null;
    }
}

From source file:org.castor.jdo.engine.SQLTypeInfos.java

/**
 * Get value from given ResultSet at given index with given SQL type.
 * /*from w  w  w .  j  a v  a  2  s  . com*/
 * @param rs The ResultSet to get the value from.
 * @param index The index of the value in the ResultSet.
 * @param sqlType The SQL type of the value.
 * @return The value.
 * @throws SQLException If a database access error occurs.
 */
public static Object getValue(final ResultSet rs, final int index, final int sqlType) throws SQLException {
    switch (sqlType) {
    case Types.CHAR:
    case Types.VARCHAR:
    case Types.LONGVARCHAR:
        return rs.getString(index);
    case Types.DECIMAL:
    case Types.NUMERIC:
        return rs.getBigDecimal(index);
    case Types.INTEGER:
        int intVal = rs.getInt(index);
        return (rs.wasNull() ? null : new Integer(intVal));
    case Types.TIME:
        return rs.getTime(index, getCalendar());
    case Types.DATE:
        return rs.getDate(index);
    case Types.TIMESTAMP:
        return rs.getTimestamp(index, getCalendar());
    case Types.FLOAT:
    case Types.DOUBLE:
        double doubleVal = rs.getDouble(index);
        return (rs.wasNull() ? null : new Double(doubleVal));
    case Types.REAL:
        float floatVal = rs.getFloat(index);
        return (rs.wasNull() ? null : new Float(floatVal));
    case Types.SMALLINT:
        short shortVal = rs.getShort(index);
        return (rs.wasNull() ? null : new Short(shortVal));
    case Types.TINYINT:
        byte byteVal = rs.getByte(index);
        return (rs.wasNull() ? null : new Byte(byteVal));
    case Types.LONGVARBINARY:
    case Types.VARBINARY:
    case Types.BINARY:
        return rs.getBytes(index);
    case Types.BLOB:
        Blob blob = rs.getBlob(index);
        return (blob == null ? null : blob.getBinaryStream());
    case Types.CLOB:
        return rs.getClob(index);
    case Types.BIGINT:
        long longVal = rs.getLong(index);
        return (rs.wasNull() ? null : new Long(longVal));
    case Types.BIT:
        boolean boolVal = rs.getBoolean(index);
        return (rs.wasNull() ? null : new Boolean(boolVal));
    default:
        Object value = rs.getObject(index);
        return (rs.wasNull() ? null : value);
    }
}

From source file:org.jumpmind.vaadin.ui.common.CommonUiUtils.java

public static Table putResultsInTable(final ResultSet rs, int maxResultSize, final boolean showRowNumbers,
        String... excludeValues) throws SQLException {

    final Table table = createTable();
    table.setImmediate(true);//from  ww  w . jav a 2  s .c o  m
    table.setSortEnabled(true);
    table.setSelectable(true);
    table.setMultiSelect(true);
    table.setColumnReorderingAllowed(true);
    table.setColumnReorderingAllowed(true);
    table.setColumnCollapsingAllowed(true);

    final ResultSetMetaData meta = rs.getMetaData();
    int columnCount = meta.getColumnCount();
    table.addContainerProperty("#", Integer.class, null);
    Set<String> columnNames = new HashSet<String>();
    Set<Integer> skipColumnIndexes = new HashSet<Integer>();
    int[] types = new int[columnCount];
    for (int i = 1; i <= columnCount; i++) {
        String realColumnName = meta.getColumnName(i);
        String columnName = realColumnName;
        if (!Arrays.asList(excludeValues).contains(columnName)) {

            int index = 1;
            while (columnNames.contains(columnName)) {
                columnName = realColumnName + "_" + index++;
            }
            columnNames.add(columnName);

            Class<?> typeClass = Object.class;
            int type = meta.getColumnType(i);
            types[i - 1] = type;
            switch (type) {
            case Types.FLOAT:
            case Types.DOUBLE:
            case Types.NUMERIC:
            case Types.REAL:
            case Types.DECIMAL:
                typeClass = BigDecimal.class;
                break;
            case Types.TINYINT:
            case Types.SMALLINT:
            case Types.BIGINT:
            case Types.INTEGER:
                typeClass = Long.class;
                break;
            case Types.VARCHAR:
            case Types.CHAR:
            case Types.NVARCHAR:
            case Types.NCHAR:
            case Types.CLOB:
                typeClass = String.class;
            default:
                break;
            }
            table.addContainerProperty(i, typeClass, null);
            table.setColumnHeader(i, columnName);
        } else {
            skipColumnIndexes.add(i - 1);
        }

    }
    int rowNumber = 1;
    while (rs.next() && rowNumber <= maxResultSize) {
        Object[] row = new Object[columnNames.size() + 1];
        row[0] = new Integer(rowNumber);
        int rowIndex = 1;
        for (int i = 0; i < columnCount; i++) {
            if (!skipColumnIndexes.contains(i)) {
                Object o = getObject(rs, i + 1);
                int type = types[i];
                switch (type) {
                case Types.FLOAT:
                case Types.DOUBLE:
                case Types.REAL:
                case Types.NUMERIC:
                case Types.DECIMAL:
                    if (o == null) {
                        o = new BigDecimal(-1);
                    }
                    if (!(o instanceof BigDecimal)) {
                        o = new BigDecimal(castToNumber(o.toString()));
                    }
                    break;
                case Types.TINYINT:
                case Types.SMALLINT:
                case Types.BIGINT:
                case Types.INTEGER:
                    if (o == null) {
                        o = new Long(-1);
                    }

                    if (!(o instanceof Long)) {
                        o = new Long(castToNumber(o.toString()));
                    }
                    break;
                default:
                    break;
                }
                row[rowIndex] = o == null ? NULL_TEXT : o;
                rowIndex++;
            }
        }
        table.addItem(row, rowNumber);
        rowNumber++;
    }

    if (rowNumber < 100) {
        table.setColumnWidth("#", 18);
    } else if (rowNumber < 1000) {
        table.setColumnWidth("#", 25);
    } else {
        table.setColumnWidth("#", 30);
    }

    if (!showRowNumbers) {
        table.setColumnCollapsed("#", true);
    }

    return table;
}

From source file:org.apache.hadoop.sqoop.manager.SqlManager.java

public String toJavaType(int sqlType) {
    // mappings from http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/mapping.html
    if (sqlType == Types.INTEGER) {
        return "Integer";
    } else if (sqlType == Types.VARCHAR) {
        return "String";
    } else if (sqlType == Types.CHAR) {
        return "String";
    } else if (sqlType == Types.LONGVARCHAR) {
        return "String";
    } else if (sqlType == Types.NUMERIC) {
        return "java.math.BigDecimal";
    } else if (sqlType == Types.DECIMAL) {
        return "java.math.BigDecimal";
    } else if (sqlType == Types.BIT) {
        return "Boolean";
    } else if (sqlType == Types.BOOLEAN) {
        return "Boolean";
    } else if (sqlType == Types.TINYINT) {
        return "Integer";
    } else if (sqlType == Types.SMALLINT) {
        return "Integer";
    } else if (sqlType == Types.BIGINT) {
        return "Long";
    } else if (sqlType == Types.REAL) {
        return "Float";
    } else if (sqlType == Types.FLOAT) {
        return "Double";
    } else if (sqlType == Types.DOUBLE) {
        return "Double";
    } else if (sqlType == Types.DATE) {
        return "java.sql.Date";
    } else if (sqlType == Types.TIME) {
        return "java.sql.Time";
    } else if (sqlType == Types.TIMESTAMP) {
        return "java.sql.Timestamp";
    } else {//from w  w  w  .  ja v a2  s  .c om
        // TODO(aaron): Support BINARY, VARBINARY, LONGVARBINARY, DISTINCT, CLOB, BLOB, ARRAY,
        // STRUCT, REF, JAVA_OBJECT.
        return null;
    }
}

From source file:org.waarp.common.database.data.AbstractDbData.java

/**
 * Set Value into PreparedStatement//w w  w.  j  a  va2s.  c o m
 * 
 * @param ps
 * @param value
 * @param rank
 *            >= 1
 * @throws WaarpDatabaseSqlException
 */
static public void setTrueValue(PreparedStatement ps, DbValue value, int rank)
        throws WaarpDatabaseSqlException {
    try {
        switch (value.type) {
        case Types.VARCHAR:
            if (value.value == null) {
                ps.setNull(rank, Types.VARCHAR);
                break;
            }
            ps.setString(rank, (String) value.value);
            break;
        case Types.LONGVARCHAR:
            if (value.value == null) {
                ps.setNull(rank, Types.LONGVARCHAR);
                break;
            }
            ps.setString(rank, (String) value.value);
            break;
        case Types.BIT:
            if (value.value == null) {
                ps.setNull(rank, Types.BIT);
                break;
            }
            ps.setBoolean(rank, (Boolean) value.value);
            break;
        case Types.TINYINT:
            if (value.value == null) {
                ps.setNull(rank, Types.TINYINT);
                break;
            }
            ps.setByte(rank, (Byte) value.value);
            break;
        case Types.SMALLINT:
            if (value.value == null) {
                ps.setNull(rank, Types.SMALLINT);
                break;
            }
            ps.setShort(rank, (Short) value.value);
            break;
        case Types.INTEGER:
            if (value.value == null) {
                ps.setNull(rank, Types.INTEGER);
                break;
            }
            ps.setInt(rank, (Integer) value.value);
            break;
        case Types.BIGINT:
            if (value.value == null) {
                ps.setNull(rank, Types.BIGINT);
                break;
            }
            ps.setLong(rank, (Long) value.value);
            break;
        case Types.REAL:
            if (value.value == null) {
                ps.setNull(rank, Types.REAL);
                break;
            }
            ps.setFloat(rank, (Float) value.value);
            break;
        case Types.DOUBLE:
            if (value.value == null) {
                ps.setNull(rank, Types.DOUBLE);
                break;
            }
            ps.setDouble(rank, (Double) value.value);
            break;
        case Types.VARBINARY:
            if (value.value == null) {
                ps.setNull(rank, Types.VARBINARY);
                break;
            }
            ps.setBytes(rank, (byte[]) value.value);
            break;
        case Types.DATE:
            if (value.value == null) {
                ps.setNull(rank, Types.DATE);
                break;
            }
            ps.setDate(rank, (Date) value.value);
            break;
        case Types.TIMESTAMP:
            if (value.value == null) {
                ps.setNull(rank, Types.TIMESTAMP);
                break;
            }
            ps.setTimestamp(rank, (Timestamp) value.value);
            break;
        case Types.CLOB:
            if (value.value == null) {
                ps.setNull(rank, Types.CLOB);
                break;
            }
            ps.setClob(rank, (Reader) value.value);
            break;
        case Types.BLOB:
            if (value.value == null) {
                ps.setNull(rank, Types.BLOB);
                break;
            }
            ps.setBlob(rank, (InputStream) value.value);
            break;
        default:
            throw new WaarpDatabaseSqlException("Type not supported: " + value.type + " at " + rank);
        }
    } catch (ClassCastException e) {
        throw new WaarpDatabaseSqlException("Setting values casting error: " + value.type + " at " + rank, e);
    } catch (SQLException e) {
        DbSession.error(e);
        throw new WaarpDatabaseSqlException("Setting values in error: " + value.type + " at " + rank, e);
    }
}

From source file:org.sakaiproject.webservices.SakaiReport.java

protected String toCsvString(ResultSet rs, boolean includeHeaderRow) throws IOException, SQLException {
    StringWriter stringWriter = new StringWriter();
    CsvWriter writer = new CsvWriter(stringWriter, ',');
    writer.setRecordDelimiter('\n');
    writer.setForceQualifier(true);/* w  ww. j  a v a2s. c o m*/
    ResultSetMetaData rsmd = rs.getMetaData();
    int numColumns = rsmd.getColumnCount();

    if (includeHeaderRow) {
        String[] row = new String[numColumns];
        for (int i = 1; i < numColumns + 1; i++) {
            row[i - 1] = rsmd.getColumnLabel(i);
        }
        writer.writeRecord(row);
    }

    while (rs.next()) {
        String[] row = new String[numColumns];
        for (int i = 1; i < numColumns + 1; i++) {

            String column_name = rsmd.getColumnName(i);

            LOG.debug("Column Name=" + column_name + ",type=" + rsmd.getColumnType(i));

            switch (rsmd.getColumnType(i)) {
            case Types.BIGINT:
                row[i - 1] = String.valueOf(rs.getInt(i));
                break;
            case Types.BOOLEAN:
                row[i - 1] = String.valueOf(rs.getBoolean(i));
                break;
            case Types.BLOB:
                row[i - 1] = rs.getBlob(i).toString();
                break;
            case Types.DOUBLE:
                row[i - 1] = String.valueOf(rs.getDouble(i));
                break;
            case Types.FLOAT:
                row[i - 1] = String.valueOf(rs.getFloat(i));
                break;
            case Types.INTEGER:
                row[i - 1] = String.valueOf(rs.getInt(i));
                break;
            case Types.LONGVARCHAR:
                row[i - 1] = rs.getString(i);
                break;
            case Types.NVARCHAR:
                row[i - 1] = rs.getNString(i);
                break;
            case Types.VARCHAR:
                row[i - 1] = rs.getString(i);
                break;
            case Types.TINYINT:
                row[i - 1] = String.valueOf(rs.getInt(i));
                break;
            case Types.SMALLINT:
                row[i - 1] = String.valueOf(rs.getInt(i));
                break;
            case Types.DATE:
                row[i - 1] = rs.getDate(i).toString();
                break;
            case Types.TIMESTAMP:
                row[i - 1] = rs.getTimestamp(i).toString();
                break;
            default:
                row[i - 1] = rs.getString(i);
                break;

            }
            LOG.debug("value: " + row[i - 1]);
        }
        writer.writeRecord(row);
        //writer.endRecord();

    }

    LOG.debug("csv output:" + stringWriter.toString());

    return stringWriter.toString();
}

From source file:org.apache.ddlutils.io.RoundtripTestBase.java

/**
 * Returns the original model adjusted for type changes because of the native type mappings
 * which when read back from the database will map to different types.
 * /*from  w  ww.ja  v  a 2 s .  c  o  m*/
 * @return The adjusted model
 */
protected Database getAdjustedModel() {
    try {
        Database model = (Database) getModel().clone();

        for (int tableIdx = 0; tableIdx < model.getTableCount(); tableIdx++) {
            Table table = model.getTable(tableIdx);

            for (int columnIdx = 0; columnIdx < table.getColumnCount(); columnIdx++) {
                Column column = table.getColumn(columnIdx);
                int origType = column.getTypeCode();
                int targetType = getPlatformInfo().getTargetJdbcType(origType);

                // we adjust the column types if the native type would back-map to a
                // different jdbc type
                if (targetType != origType) {
                    column.setTypeCode(targetType);
                    // we should also adapt the default value
                    if (column.getDefaultValue() != null) {
                        DefaultValueHelper helper = getPlatform().getSqlBuilder().getDefaultValueHelper();

                        column.setDefaultValue(helper.convert(column.getDefaultValue(), origType, targetType));
                    }
                }
                // we also promote the default size if the column has no size
                // spec of its own
                if ((column.getSize() == null) && getPlatformInfo().hasSize(targetType)) {
                    Integer defaultSize = getPlatformInfo().getDefaultSize(targetType);

                    if (defaultSize != null) {
                        column.setSize(defaultSize.toString());
                    }
                }
                // finally the platform might return a synthetic default value if the column
                // is a primary key column
                if (getPlatformInfo().isSyntheticDefaultValueForRequiredReturned()
                        && (column.getDefaultValue() == null) && column.isRequired()
                        && !column.isAutoIncrement()) {
                    switch (column.getTypeCode()) {
                    case Types.TINYINT:
                    case Types.SMALLINT:
                    case Types.INTEGER:
                    case Types.BIGINT:
                        column.setDefaultValue("0");
                        break;
                    case Types.REAL:
                    case Types.FLOAT:
                    case Types.DOUBLE:
                        column.setDefaultValue("0.0");
                        break;
                    case Types.BIT:
                        column.setDefaultValue("false");
                        break;
                    default:
                        column.setDefaultValue("");
                        break;
                    }
                }
            }
            // we also add the default names to foreign keys that are initially unnamed
            for (int fkIdx = 0; fkIdx < table.getForeignKeyCount(); fkIdx++) {
                ForeignKey fk = table.getForeignKey(fkIdx);

                if (fk.getName() == null) {
                    fk.setName(getPlatform().getSqlBuilder().getForeignKeyName(table, fk));
                }
            }
        }
        return model;
    } catch (CloneNotSupportedException ex) {
        throw new RuntimeException(ex);
    }
}

From source file:br.bookmark.db.util.ResultSetUtils.java

/**
 * Map JDBC objects to Java equivalents.
 * Used by getBean() and getBeans()./*from   w  ww .  j  a  v a 2s.co m*/
 * <p>
 * Some types not supported.
 * Many not work with all drivers.
 * <p>
 * Makes binary conversions of BIGINT, DATE, DECIMAL, DOUBLE, FLOAT, INTEGER,
 * REAL, SMALLINT, TIME, TIMESTAMP, TINYINT.
 * Makes Sting conversions of CHAR, CLOB, VARCHAR, LONGVARCHAR, BLOB, LONGVARBINARY,
 * VARBINARY.
 * <p>
 * DECIMAL, INTEGER, SMALLINT, TIMESTAMP, CHAR, VARCHAR tested with MySQL and Poolman.
 * Others not guaranteed.
 * @param classeDestino 
 * @throws NoSuchFieldException 
 * @throws SecurityException 
 */
private static void putEntry(Map properties, ResultSetMetaData metaData, ResultSet resultSet, int i,
        Class classeDestino) throws Exception {

    /*
    In a perfect universe, this would be enough
    properties.put(
        metaData.getColumnName(i),
        resultSet.getObject(i));
    But only String, Timestamp, and Integer seem to get through that way.
    */

    String columnName = metaData.getColumnName(i);

    // Testa se  uma FK
    /*Field[] fields = classeDestino.getDeclaredFields();
    for (int j = 0; j < fields.length; j++) {
    if (fields[j].getAnnotation(DBFK.class) != null) {
        properties.put(columnName, resultSet.getString(i));
    }
    }*/
    //System.out.println(i+"-"+metaData.getColumnType(i));
    switch (metaData.getColumnType(i)) {

    // http://java.sun.com/j2se/1.3.0/docs/api/java/sql/Types.html

    case Types.BIGINT:
        properties.put(columnName, new Long(resultSet.getLong(i)));
        break;

    case Types.DATE:
        properties.put(columnName, resultSet.getDate(i));
        break;

    case Types.DECIMAL:
    case Types.DOUBLE:
        properties.put(columnName, new Double(resultSet.getDouble(i)));
        break;

    case Types.FLOAT:
        properties.put(columnName, new Float(resultSet.getFloat(i)));
        break;

    case Types.INTEGER:
        int valor = 0;
        try { // Se o campo esta vazio d erro
            valor = resultSet.getInt(i);
        } catch (SQLException e) {
        }
        properties.put(columnName, new Integer(valor));
        break;

    case Types.REAL:
        properties.put(columnName, new Double(resultSet.getString(i)));
        break;

    case Types.SMALLINT:
        properties.put(columnName, new Short(resultSet.getShort(i)));
        break;

    case Types.TIME:
        properties.put(columnName, resultSet.getTime(i));
        break;

    case Types.TIMESTAMP:
        properties.put(columnName, resultSet.getTimestamp(i));
        break;

    // :FIXME: Throws java.lang.ClassCastException: java.lang.Integer
    // :FIXME: with Poolman and MySQL unless use getString.
    case Types.TINYINT:
        properties.put(columnName, new Byte(resultSet.getString(i)));
        break;

    case Types.CHAR:
    case Types.CLOB:
    case Types.VARCHAR:
    case Types.LONGVARCHAR:
        // :FIXME: Handle binaries differently?
    case Types.BLOB:
    case Types.LONGVARBINARY:
    case Types.VARBINARY:
        properties.put(columnName, resultSet.getString(i));
        break;

    /*
        :FIXME: Add handlers for
        ARRAY
        BINARY
        BIT
        DISTINCT
        JAVA_OBJECT
        NULL
        NUMERIC
        OTHER
        REF
        STRUCT
    */

    // Otherwise, pass as *String property to be converted
    default:
        properties.put(columnName + "String", resultSet.getString(i));
        break;
    } // end switch

}

From source file:org.nuxeo.ecm.core.storage.sql.jdbc.dialect.DialectOracle.java

@Override
public JDBCInfo getJDBCTypeAndString(ColumnType type) {
    switch (type.spec) {
    case STRING:/*from w  w  w . ja  v  a  2s.  c  o m*/
        if (type.isUnconstrained()) {
            return jdbcInfo("NVARCHAR2(2000)", Types.VARCHAR);
        } else if (type.isClob() || type.length > 2000) {
            return jdbcInfo("NCLOB", Types.CLOB);
        } else {
            return jdbcInfo("NVARCHAR2(%d)", type.length, Types.VARCHAR);
        }
    case BOOLEAN:
        return jdbcInfo("NUMBER(1,0)", Types.BIT);
    case LONG:
        return jdbcInfo("NUMBER(19,0)", Types.BIGINT);
    case DOUBLE:
        return jdbcInfo("DOUBLE PRECISION", Types.DOUBLE);
    case TIMESTAMP:
        return jdbcInfo("TIMESTAMP", Types.TIMESTAMP);
    case BLOBID:
        return jdbcInfo("VARCHAR2(40)", Types.VARCHAR);
    // -----
    case NODEID:
    case NODEIDFK:
    case NODEIDFKNP:
    case NODEIDFKMUL:
    case NODEIDFKNULL:
    case NODEIDPK:
    case NODEVAL:
        switch (idType) {
        case VARCHAR:
            return jdbcInfo("VARCHAR2(36)", Types.VARCHAR);
        case SEQUENCE:
            return jdbcInfo("NUMBER(10,0)", Types.INTEGER);
        default:
            throw new AssertionError("Unknown id type: " + idType);
        }
    case SYSNAME:
    case SYSNAMEARRAY:
        return jdbcInfo("VARCHAR2(250)", Types.VARCHAR);
    case TINYINT:
        return jdbcInfo("NUMBER(3,0)", Types.TINYINT);
    case INTEGER:
        return jdbcInfo("NUMBER(10,0)", Types.INTEGER);
    case AUTOINC:
        return jdbcInfo("NUMBER(10,0)", Types.INTEGER);
    case FTINDEXED:
        return jdbcInfo("CLOB", Types.CLOB);
    case FTSTORED:
        return jdbcInfo("NCLOB", Types.CLOB);
    case CLUSTERNODE:
        return jdbcInfo("VARCHAR(25)", Types.VARCHAR);
    case CLUSTERFRAGS:
        return jdbcInfo("VARCHAR2(4000)", Types.VARCHAR);
    }
    throw new AssertionError(type);
}