Example usage for java.sql ResultSet wasNull

List of usage examples for java.sql ResultSet wasNull

Introduction

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

Prototype

boolean wasNull() throws SQLException;

Source Link

Document

Reports whether the last column read had a value of SQL NULL.

Usage

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstMSSql.CFAstMSSqlSecDeviceTable.java

protected CFAstSecDeviceBuff unpackSecDeviceResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackSecDeviceResultSetToBuff";
    int idxcol = 1;
    CFAstSecDeviceBuff buff = schema.getFactorySecDevice().newBuff();
    {/* w w w.jav  a  2s . com*/
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedByUserId(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedByUserId(null);
        } else {
            buff.setCreatedByUserId(UUID.fromString(colString));
        }
        idxcol++;

        colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedAt(null);
        } else {
            buff.setCreatedAt(CFAstMSSqlSchema.convertTimestampString(colString));
        }
        idxcol++;
        colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setUpdatedByUserId(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setUpdatedByUserId(null);
        } else {
            buff.setUpdatedByUserId(UUID.fromString(colString));
        }
        idxcol++;

        colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setUpdatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setUpdatedAt(null);
        } else {
            buff.setUpdatedAt(CFAstMSSqlSchema.convertTimestampString(colString));
        }
        idxcol++;
    }
    buff.setRequiredSecUserId(CFAstMSSqlSchema.convertUuidString(resultSet.getString(idxcol)));
    idxcol++;
    buff.setRequiredDevName(resultSet.getString(idxcol));
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalPubKey(null);
        } else {
            buff.setOptionalPubKey(colVal);
        }
    }
    idxcol++;
    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskMySql.CFAsteriskMySqlSecDeviceTable.java

protected CFSecuritySecDeviceBuff unpackSecDeviceResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackSecDeviceResultSetToBuff";
    int idxcol = 1;
    CFSecuritySecDeviceBuff buff = schema.getFactorySecDevice().newBuff();
    {/*from  ww  w  .  ja  v a2 s.c o m*/
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedAt(null);
        } else {
            buff.setCreatedAt(CFAsteriskMySqlSchema.convertTimestampString(colString));
        }
    }
    idxcol++;
    {
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedByUserId(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedByUserId(null);
        } else {
            buff.setCreatedByUserId(UUID.fromString(colString));
        }
    }
    idxcol++;
    {
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setUpdatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setUpdatedAt(null);
        } else {
            buff.setUpdatedAt(CFAsteriskMySqlSchema.convertTimestampString(colString));
        }
    }
    idxcol++;
    {
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setUpdatedByUserId(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setUpdatedByUserId(null);
        } else {
            buff.setUpdatedByUserId(UUID.fromString(colString));
        }
    }
    idxcol++;
    buff.setRequiredSecUserId(CFAsteriskMySqlSchema.convertUuidString(resultSet.getString(idxcol)));
    idxcol++;
    buff.setRequiredDevName(resultSet.getString(idxcol));
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalPubKey(null);
        } else {
            buff.setOptionalPubKey(colVal);
        }
    }
    idxcol++;

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

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

protected CFEnSyntaxSecDeviceBuff unpackSecDeviceResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackSecDeviceResultSetToBuff";
    int idxcol = 1;
    CFEnSyntaxSecDeviceBuff buff = schema.getFactorySecDevice().newBuff();
    {/*w  ww . j av  a 2 s  . c  om*/
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedByUserId(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedByUserId(null);
        } else {
            buff.setCreatedByUserId(UUID.fromString(colString));
        }
        idxcol++;

        colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedAt(null);
        } else {
            buff.setCreatedAt(CFEnSyntaxMSSqlSchema.convertTimestampString(colString));
        }
        idxcol++;
        colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setUpdatedByUserId(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setUpdatedByUserId(null);
        } else {
            buff.setUpdatedByUserId(UUID.fromString(colString));
        }
        idxcol++;

        colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setUpdatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setUpdatedAt(null);
        } else {
            buff.setUpdatedAt(CFEnSyntaxMSSqlSchema.convertTimestampString(colString));
        }
        idxcol++;
    }
    buff.setRequiredSecUserId(CFEnSyntaxMSSqlSchema.convertUuidString(resultSet.getString(idxcol)));
    idxcol++;
    buff.setRequiredDevName(resultSet.getString(idxcol));
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalPubKey(null);
        } else {
            buff.setOptionalPubKey(colVal);
        }
    }
    idxcol++;
    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstMySql.CFAstMySqlSecDeviceTable.java

protected CFAstSecDeviceBuff unpackSecDeviceResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackSecDeviceResultSetToBuff";
    int idxcol = 1;
    CFAstSecDeviceBuff buff = schema.getFactorySecDevice().newBuff();
    {/*from   w  ww  .  j  a va2 s .c  o  m*/
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedAt(null);
        } else {
            buff.setCreatedAt(CFAstMySqlSchema.convertTimestampString(colString));
        }
    }
    idxcol++;
    {
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedByUserId(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedByUserId(null);
        } else {
            buff.setCreatedByUserId(UUID.fromString(colString));
        }
    }
    idxcol++;
    {
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setUpdatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setUpdatedAt(null);
        } else {
            buff.setUpdatedAt(CFAstMySqlSchema.convertTimestampString(colString));
        }
    }
    idxcol++;
    {
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setUpdatedByUserId(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setUpdatedByUserId(null);
        } else {
            buff.setUpdatedByUserId(UUID.fromString(colString));
        }
    }
    idxcol++;
    buff.setRequiredSecUserId(CFAstMySqlSchema.convertUuidString(resultSet.getString(idxcol)));
    idxcol++;
    buff.setRequiredDevName(resultSet.getString(idxcol));
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalPubKey(null);
        } else {
            buff.setOptionalPubKey(colVal);
        }
    }
    idxcol++;

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

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

protected CFFswSecDeviceBuff unpackSecDeviceResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackSecDeviceResultSetToBuff";
    int idxcol = 1;
    CFFswSecDeviceBuff buff = schema.getFactorySecDevice().newBuff();
    {//from ww  w  .  ja  v a 2s.  co  m
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedAt(null);
        } else {
            buff.setCreatedAt(CFFswMySqlSchema.convertTimestampString(colString));
        }
    }
    idxcol++;
    {
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedByUserId(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedByUserId(null);
        } else {
            buff.setCreatedByUserId(UUID.fromString(colString));
        }
    }
    idxcol++;
    {
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setUpdatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setUpdatedAt(null);
        } else {
            buff.setUpdatedAt(CFFswMySqlSchema.convertTimestampString(colString));
        }
    }
    idxcol++;
    {
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setUpdatedByUserId(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setUpdatedByUserId(null);
        } else {
            buff.setUpdatedByUserId(UUID.fromString(colString));
        }
    }
    idxcol++;
    buff.setRequiredSecUserId(CFFswMySqlSchema.convertUuidString(resultSet.getString(idxcol)));
    idxcol++;
    buff.setRequiredDevName(resultSet.getString(idxcol));
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalPubKey(null);
        } else {
            buff.setOptionalPubKey(colVal);
        }
    }
    idxcol++;

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

From source file:com.flexive.core.storage.genericSQL.GenericEnvironmentLoader.java

/**
 * {@inheritDoc}/*from w w w. java  2 s .c  om*/
 * @since 3.1.2
 */
@Override
public List<FxScriptSchedule> loadScriptSchedules(Connection con, FxEnvironmentImpl environment)
        throws FxLoadException {
    PreparedStatement ps = null;
    String sql;
    List<FxScriptSchedule> schedules = new ArrayList<FxScriptSchedule>(10);
    try {
        //             1   2     3      4       5         6         7             8            9
        sql = "SELECT ID,SCRIPT,SNAME,ACTIVE,STARTTIME,ENDTIME,REPEATINTERVAL,REPEATTIMES,CRONSTRING FROM "
                + TBL_SCRIPT_SCHEDULES + " ORDER BY SCRIPT";
        ps = con.prepareStatement(sql);
        ResultSet rs = ps.executeQuery();
        while (rs != null && rs.next()) {
            long id = rs.getLong(1);
            long scriptId = rs.getLong(2);
            String name = rs.getString(3);
            if (rs.wasNull())
                name = "";
            boolean active = rs.getBoolean(4);
            java.util.Date startTime = new java.util.Date(rs.getTimestamp(5).getTime());
            Timestamp endts = rs.getTimestamp(6);
            final java.util.Date endTime;
            if (rs.wasNull())
                endTime = null;
            else
                endTime = new java.util.Date(endts.getTime());
            long repeatInterval = rs.getLong(7);
            int repeatTimes = rs.getInt(8);
            String cronString = rs.getString(9);
            if (rs.wasNull())
                cronString = "";
            schedules.add(new FxScriptSchedule(id, scriptId, name, active, startTime, endTime, repeatInterval,
                    repeatTimes, cronString));
        }
    } catch (SQLException exc) {
        throw new FxLoadException(LOG, exc, "ex.scripting.schedule.load.failed", -1, exc.getMessage());
    } finally {
        Database.closeObjects(GenericEnvironmentLoader.class, null, ps);
    }
    return schedules;
}

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

protected CFFswFSSofiaBuff unpackFSSofiaResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackFSSofiaResultSetToBuff";
    int idxcol = 1;
    CFFswFSSofiaBuff buff = schema.getFactoryFSSofia().newBuff();
    {// w w  w . j  a  v  a 2  s  .co m
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedAt(null);
        } else {
            buff.setCreatedAt(CFFswMySqlSchema.convertTimestampString(colString));
        }
    }
    idxcol++;
    {
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedByUserId(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedByUserId(null);
        } else {
            buff.setCreatedByUserId(UUID.fromString(colString));
        }
    }
    idxcol++;
    {
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setUpdatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setUpdatedAt(null);
        } else {
            buff.setUpdatedAt(CFFswMySqlSchema.convertTimestampString(colString));
        }
    }
    idxcol++;
    {
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setUpdatedByUserId(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setUpdatedByUserId(null);
        } else {
            buff.setUpdatedByUserId(UUID.fromString(colString));
        }
    }
    idxcol++;
    buff.setRequiredTenantId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredFSSofiaId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredName(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredLogLevel(resultSet.getShort(idxcol));
    idxcol++;
    buff.setRequiredAutoRestart(resultSet.getBoolean(idxcol));
    idxcol++;
    buff.setRequiredDebugPresence(resultSet.getInt(idxcol));
    idxcol++;

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

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_4.CFFreeSwitchMySql.CFFreeSwitchMySqlFSSofiaTable.java

protected CFFreeSwitchFSSofiaBuff unpackFSSofiaResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackFSSofiaResultSetToBuff";
    int idxcol = 1;
    CFFreeSwitchFSSofiaBuff buff = schema.getFactoryFSSofia().newBuff();
    {/*  w w w  .  j  a v a  2 s. c  om*/
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedAt(null);
        } else {
            buff.setCreatedAt(CFFreeSwitchMySqlSchema.convertTimestampString(colString));
        }
    }
    idxcol++;
    {
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedByUserId(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedByUserId(null);
        } else {
            buff.setCreatedByUserId(UUID.fromString(colString));
        }
    }
    idxcol++;
    {
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setUpdatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setUpdatedAt(null);
        } else {
            buff.setUpdatedAt(CFFreeSwitchMySqlSchema.convertTimestampString(colString));
        }
    }
    idxcol++;
    {
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setUpdatedByUserId(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setUpdatedByUserId(null);
        } else {
            buff.setUpdatedByUserId(UUID.fromString(colString));
        }
    }
    idxcol++;
    buff.setRequiredTenantId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredFSSofiaId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredName(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredLogLevel(resultSet.getShort(idxcol));
    idxcol++;
    buff.setRequiredAutoRestart(resultSet.getBoolean(idxcol));
    idxcol++;
    buff.setRequiredDebugPresence(resultSet.getInt(idxcol));
    idxcol++;

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

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

protected CFEnSyntaxSecDeviceBuff unpackSecDeviceResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackSecDeviceResultSetToBuff";
    int idxcol = 1;
    CFEnSyntaxSecDeviceBuff buff = schema.getFactorySecDevice().newBuff();
    {/*from   w w  w . jav  a 2s  . c  om*/
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedAt(null);
        } else {
            buff.setCreatedAt(CFEnSyntaxMySqlSchema.convertTimestampString(colString));
        }
    }
    idxcol++;
    {
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedByUserId(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedByUserId(null);
        } else {
            buff.setCreatedByUserId(UUID.fromString(colString));
        }
    }
    idxcol++;
    {
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setUpdatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setUpdatedAt(null);
        } else {
            buff.setUpdatedAt(CFEnSyntaxMySqlSchema.convertTimestampString(colString));
        }
    }
    idxcol++;
    {
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setUpdatedByUserId(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setUpdatedByUserId(null);
        } else {
            buff.setUpdatedByUserId(UUID.fromString(colString));
        }
    }
    idxcol++;
    buff.setRequiredSecUserId(CFEnSyntaxMySqlSchema.convertUuidString(resultSet.getString(idxcol)));
    idxcol++;
    buff.setRequiredDevName(resultSet.getString(idxcol));
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalPubKey(null);
        } else {
            buff.setOptionalPubKey(colVal);
        }
    }
    idxcol++;

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

From source file:com.act.lcms.db.model.FeedingLCMSWell.java

@Override
protected List<FeedingLCMSWell> fromResultSet(ResultSet resultSet) throws SQLException {
    List<FeedingLCMSWell> results = new ArrayList<>();
    while (resultSet.next()) {
        Integer id = resultSet.getInt(DB_FIELD.ID.getOffset());
        Integer plateId = resultSet.getInt(DB_FIELD.PLATE_ID.getOffset());
        Integer plateRow = resultSet.getInt(DB_FIELD.PLATE_ROW.getOffset());
        Integer plateColumn = resultSet.getInt(DB_FIELD.PLATE_COLUMN.getOffset());
        String msid = resultSet.getString(DB_FIELD.MSID.getOffset());
        String composition = resultSet.getString(DB_FIELD.COMPOSITION.getOffset());
        String extract = resultSet.getString(DB_FIELD.EXTRACT.getOffset());
        String chemical = resultSet.getString(DB_FIELD.CHEMICAL.getOffset());
        Double concentration = resultSet.getDouble(DB_FIELD.CONCENTRATION.getOffset());
        if (resultSet.wasNull()) {
            concentration = null;/* w w  w .  java  2 s. c om*/
        }
        String note = resultSet.getString(DB_FIELD.NOTE.getOffset());

        results.add(new FeedingLCMSWell(id, plateId, plateRow, plateColumn, msid, composition, extract,
                chemical, concentration, note));
    }
    return results;
}