Example usage for java.sql ResultSet getShort

List of usage examples for java.sql ResultSet getShort

Introduction

In this page you can find the example usage for java.sql ResultSet getShort.

Prototype

short getShort(String columnLabel) throws SQLException;

Source Link

Document

Retrieves the value of the designated column in the current row of this ResultSet object as a short in the Java programming language.

Usage

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccPgSql.CFAccPgSqlSchema.java

public static Short getNullableInt16(ResultSet reader, int colidx) {
    try {/*from  ww w  .  j  a  v  a  2s  .c o m*/
        short val = reader.getShort(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Short(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFAccPgSqlSchema.class, "getNullableInt64", e);
    }
}

From source file:net.algem.security.UserDaoImpl.java

private ScheduleRangeElement getFollowUpDetail(ResultSet rs) throws SQLException {
    ScheduleRangeElement r = new ScheduleRangeElement();
    r.setId(rs.getInt(2));/*from w w w. ja v a2  s .c  o  m*/
    r.setStart(new Hour(rs.getString(5)));
    r.setEnd(new Hour(rs.getString(6)));
    FollowUp up = new FollowUp();
    up.setId(rs.getInt(14));
    up.setContent(rs.getString(15));
    up.setNote(rs.getString(16));
    up.setStatus(rs.getShort(17));

    r.setFollowUp(up);
    return r;
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswMySql.CFFswMySqlSchema.java

public static Short getNullableInt16(ResultSet reader, int colidx) {
    try {/*from w  w w.  j  a  va2s .c om*/
        short val = reader.getShort(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Short(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFFswMySqlSchema.class, "getNullableInt64", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMSSql.CFEnSyntaxMSSqlSchema.java

public static Short getNullableInt16(ResultSet reader, int colidx) {
    try {/*from  w ww .j  av  a  2  s .co  m*/
        short val = reader.getShort(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Short(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFEnSyntaxMSSqlSchema.class, "getNullableInt64",
                e);
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWSchema.java

public static Short getNullableInt16(ResultSet reader, int colidx) {
    try {//w w  w.  j  a v a  2  s.co m
        short val = reader.getShort(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Short(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFAccDb2LUWSchema.class, "getNullableInt64", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmMSSql.CFCrmMSSqlSchema.java

public static Short getNullableInt16(ResultSet reader, int colidx) {
    try {//w  ww.ja va 2s .c  o m
        short val = reader.getShort(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Short(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFCrmMSSqlSchema.class, "getNullableInt64", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleSchema.java

public static Short getNullableInt16(ResultSet reader, int colidx) {
    try {//from  w w w  .j  a  v  a 2 s .c o m
        short val = reader.getShort(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Short(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFAccOracleSchema.class, "getNullableInt64", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskMSSql.CFAsteriskMSSqlSchema.java

public static Short getNullableInt16(ResultSet reader, int colidx) {
    try {//from   ww  w.  ja  v a  2s .  c o  m
        short val = reader.getShort(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Short(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFAsteriskMSSqlSchema.class, "getNullableInt64",
                e);
    }
}

From source file:com.linkage.community.schedule.dbutils.CustomScalarHandler.java

/**
 * Returns one <code>ResultSet</code> column as an object via the
 * <code>ResultSet.getObject()</code> method that performs type
 * conversions.//from   w ww .  j  a  v a2 s.  c o  m
 * @param rs <code>ResultSet</code> to process.
 * @return The column or <code>null</code> if there are no rows in
 * the <code>ResultSet</code>.
 *
 * @throws SQLException if a database access error occurs
 * @throws ClassCastException if the class datatype does not match the column type
 *
 * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
 */
// We assume that the user has picked the correct type to match the column
// so getObject will return the appropriate type and the cast will succeed.

@SuppressWarnings("unchecked")
//@Override
public T handle(ResultSet rs) throws SQLException {
    Object obj = null;
    if (rs.next()) {
        if (this.columnName == null) {
            obj = rs.getObject(this.columnIndex);
            if (obj instanceof Integer)
                return (T) (obj = rs.getInt(columnIndex));
            else if (obj instanceof Long)
                return (T) (obj = (new Long(rs.getLong(columnIndex)).intValue()));
            else if (obj instanceof Boolean)
                return (T) (obj = rs.getBoolean(columnIndex));
            else if (obj instanceof Double)
                return (T) (obj = rs.getDouble(columnIndex));
            else if (obj instanceof Float)
                return (T) (obj = rs.getFloat(columnIndex));
            else if (obj instanceof Short)
                return (T) (obj = rs.getShort(columnIndex));
            else if (obj instanceof Byte)
                return (T) (obj = rs.getByte(columnIndex));
            else
                return (T) obj;
        } else {
            obj = rs.getObject(this.columnName);
            if (obj instanceof Integer)
                return (T) (obj = rs.getInt(columnName));
            else if (obj instanceof Long)
                return (T) (obj = rs.getLong(columnName));
            else if (obj instanceof Boolean)
                return (T) (obj = rs.getBoolean(columnName));
            else if (obj instanceof Double)
                return (T) (obj = rs.getDouble(columnName));
            else if (obj instanceof Float)
                return (T) (obj = rs.getFloat(columnName));
            else if (obj instanceof Short)
                return (T) (obj = rs.getShort(columnName));
            else if (obj instanceof Byte)
                return (T) (obj = rs.getByte(columnName));
            else
                return (T) obj;
        }
    }
    return null;
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmDb2LUW.CFCrmDb2LUWAuditActionTable.java

protected CFCrmAuditActionBuff unpackAuditActionResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackAuditActionResultSetToBuff";
    int idxcol = 1;
    CFCrmAuditActionBuff buff = schema.getFactoryAuditAction().newBuff();
    buff.setRequiredAuditActionId(resultSet.getShort(idxcol));
    idxcol++;// ww w  .ja  v  a  2s.  c  o m
    buff.setRequiredDescription(resultSet.getString(idxcol));
    idxcol++;

    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
}