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.CFAccMySql.CFAccMySqlSchema.java

public static Short getNullableInt16(ResultSet reader, int colidx) {
    try {//  w  w w.  j ava  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(CFAccMySqlSchema.class, "getNullableInt64", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmMSSql.CFCrmMSSqlAuditActionTable.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++;/*from w w w . j av  a  2  s .  co m*/
    buff.setRequiredDescription(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskDb2LUW.CFAsteriskDb2LUWAuditActionTable.java

protected CFSecurityAuditActionBuff unpackAuditActionResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackAuditActionResultSetToBuff";
    int idxcol = 1;
    CFSecurityAuditActionBuff buff = schema.getFactoryAuditAction().newBuff();
    buff.setRequiredAuditActionId(resultSet.getShort(idxcol));
    idxcol++;/*from www.  j a  v  a2s .c  om*/
    buff.setRequiredDescription(resultSet.getString(idxcol));
    idxcol++;

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

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

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

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

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstDb2LUW.CFAstDb2LUWAuditActionTable.java

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

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

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

protected CFSecurityAuditActionBuff unpackAuditActionResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackAuditActionResultSetToBuff";
    int idxcol = 1;
    CFSecurityAuditActionBuff buff = schema.getFactoryAuditAction().newBuff();
    buff.setRequiredAuditActionId(resultSet.getShort(idxcol));
    idxcol++;/*ww w  .ja v  a 2 s . c  om*/
    buff.setRequiredDescription(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMSSql.CFAccMSSqlAuditActionTable.java

protected CFAccAuditActionBuff unpackAuditActionResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackAuditActionResultSetToBuff";
    int idxcol = 1;
    CFAccAuditActionBuff buff = schema.getFactoryAuditAction().newBuff();
    buff.setRequiredAuditActionId(resultSet.getShort(idxcol));
    idxcol++;/* w w  w .  jav  a 2  s. c  o  m*/
    buff.setRequiredDescription(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstMSSql.CFAstMSSqlAuditActionTable.java

protected CFAstAuditActionBuff unpackAuditActionResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackAuditActionResultSetToBuff";
    int idxcol = 1;
    CFAstAuditActionBuff buff = schema.getFactoryAuditAction().newBuff();
    buff.setRequiredAuditActionId(resultSet.getShort(idxcol));
    idxcol++;//from  www . j a  v  a  2s  . c  o  m
    buff.setRequiredDescription(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
}

From source file:com.netspective.axiom.sql.StoredProcedure.java

/**
 * Gets the stored procedure's metadata information from the database. This will search
 * all available catalogs and schemas. This method will ONLY return the metadata of the
 * stored procedure only when the <i>procedure-name</i> attribute is set in the XML declaration.
 *//*w w w .ja  v a  2  s  .  co m*/
public String getMetaData(ConnectionContext cc) throws NamingException, SQLException {
    // TODO : Using this metadata, we can determine what variables are in and out so that the developer doesn't even have to set it in XML
    // but currently the procedure-name attribute isn't required but the 'type' attribute is required. If we go the
    // metadata route we need to change some handling to accept setting the 'type' and if it's not set, we can use
    // the metadata to get the param type
    StringBuffer sb = new StringBuffer();
    if (procedureName != null && procedureName.length() > 0) {
        // Get DatabaseMetaData
        Connection connection = cc.getConnection();
        DatabaseMetaData dbmd = connection.getMetaData();
        ResultSet rs = dbmd.getProcedureColumns(null, null, procedureName, "%");
        // Printout table data
        while (rs.next()) {
            // Get procedure metadata
            String dbProcedureCatalog = rs.getString(1);
            String dbProcedureSchema = rs.getString(2);
            String dbProcedureName = rs.getString(3);
            String dbColumnName = rs.getString(4);
            short dbColumnReturn = rs.getShort(5);
            String dbColumnReturnTypeName = rs.getString(7);
            int dbColumnPrecision = rs.getInt(8);
            int dbColumnByteLength = rs.getInt(9);
            short dbColumnScale = rs.getShort(10);
            short dbColumnRadix = rs.getShort(11);
            String dbColumnRemarks = rs.getString(13);
            // Interpret the return type (readable for humans)
            String procReturn;
            switch (dbColumnReturn) {
            case DatabaseMetaData.procedureColumnIn:
                procReturn = "In";
                break;
            case DatabaseMetaData.procedureColumnOut:
                procReturn = "Out";
                break;
            case DatabaseMetaData.procedureColumnInOut:
                procReturn = "In/Out";
                break;
            case DatabaseMetaData.procedureColumnReturn:
                procReturn = "return value";
                break;
            case DatabaseMetaData.procedureColumnResult:
                procReturn = "return ResultSet";
            default:
                procReturn = "Unknown";
            }
            // Printout
            sb.append("Procedure: " + dbProcedureCatalog + "." + dbProcedureSchema + "." + dbProcedureName);
            sb.append("   ColumnName [ColumnType(ColumnPrecision)]: " + dbColumnName + " ["
                    + dbColumnReturnTypeName + "(" + dbColumnPrecision + ")]");
            sb.append("   ColumnReturns: " + procReturn + "(" + dbColumnReturnTypeName + ")");
            sb.append("   Radix: " + dbColumnRadix + ", Scale: " + dbColumnScale);
            sb.append("   Remarks: " + dbColumnRemarks);
        }
        rs.close();
        connection.close();
    }
    return sb.toString();
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlAuditActionTable.java

protected CFEnSyntaxAuditActionBuff unpackAuditActionResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackAuditActionResultSetToBuff";
    int idxcol = 1;
    CFEnSyntaxAuditActionBuff buff = schema.getFactoryAuditAction().newBuff();
    buff.setRequiredAuditActionId(resultSet.getShort(idxcol));
    idxcol++;/*from   www .ja  v  a2 s  .c o  m*/
    buff.setRequiredDescription(resultSet.getString(idxcol));
    idxcol++;

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