Example usage for java.sql ResultSet getRow

List of usage examples for java.sql ResultSet getRow

Introduction

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

Prototype

int getRow() throws SQLException;

Source Link

Document

Retrieves the current row number.

Usage

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

public CFAstISOCountryBuff readBuff(CFAstAuthorization Authorization, CFAstISOCountryPKey PKey) {
    final String S_ProcName = "readBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from w w  w .j  av  a 2 s  .  co  m*/
    ResultSet resultSet = null;
    try {
        Connection cnx = schema.getCnx();
        short Id = PKey.getRequiredId();
        final String sql = "CALL sp_read_iso_cntry( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        if (stmtReadBuffByPKey == null) {
            stmtReadBuffByPKey = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByPKey.setShort(argIdx++, Id);
        resultSet = stmtReadBuffByPKey.executeQuery();
        if (resultSet.next()) {
            CFAstISOCountryBuff buff = unpackISOCountryResultSetToBuff(resultSet);
            if (resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
            return (buff);
        } else {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

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

public CFAstISOCountryBuff lockBuff(CFAstAuthorization Authorization, CFAstISOCountryPKey PKey) {
    final String S_ProcName = "lockBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//  w  ww  .ja  v a 2  s.c  o m
    ResultSet resultSet = null;
    try {
        Connection cnx = schema.getCnx();
        short Id = PKey.getRequiredId();
        final String sql = "CALL sp_lock_iso_cntry( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        if (stmtLockBuffByPKey == null) {
            stmtLockBuffByPKey = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtLockBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtLockBuffByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtLockBuffByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtLockBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtLockBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtLockBuffByPKey.setShort(argIdx++, Id);
        resultSet = stmtLockBuffByPKey.executeQuery();
        if (resultSet.next()) {
            CFAstISOCountryBuff buff = unpackISOCountryResultSetToBuff(resultSet);
            if (resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
            return (buff);
        } else {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

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

public void deleteSecAppByClusterIdx(CFAstAuthorization Authorization, long argClusterId) {
    final String S_ProcName = "deleteSecAppByClusterIdx";
    ResultSet resultSet = null;
    try {// w w w. j a  v a  2 s.  c  om
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_secapp_by_clusteridx( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        if (stmtDeleteByClusterIdx == null) {
            stmtDeleteByClusterIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByClusterIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByClusterIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByClusterIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByClusterIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByClusterIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByClusterIdx.setLong(argIdx++, argClusterId);
        resultSet = stmtDeleteByClusterIdx.executeQuery();
        if (resultSet.next()) {
            int deleteFlag = resultSet.getInt(1);
            if (resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "Expected 1 record result set to be returned by delete, not 0 rows");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleTenantTable.java

public int nextTSecGroupIdGen(CFSecurityAuthorization Authorization, CFSecurityTenantPKey PKey) {
    final String S_ProcName = "nextTSecGroupIdGen";
    String sqlSelectNext = "SELECT " + schema.getLowerDbSchemaName() + ".nxt_tsecgroupidgen(" + "?"
            + " ) as NextTSecGroupIdGen from dual";

    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from   w  w w  .  ja va2 s.  c  o m*/
    ResultSet rsSelect = null;
    try {
        Connection cnx = schema.getCnx();
        long Id = PKey.getRequiredId();

        if (stmtSelectNextTSecGroupIdGen == null) {
            stmtSelectNextTSecGroupIdGen = cnx.prepareStatement(sqlSelectNext);
        }
        int nextId;
        int argIdx = 1;
        stmtSelectNextTSecGroupIdGen.setLong(argIdx++, Id);
        rsSelect = stmtSelectNextTSecGroupIdGen.executeQuery();
        if (rsSelect.next()) {
            nextId = rsSelect.getInt(1);
            if (rsSelect.wasNull()) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "NextTSecGroupIdGen cannot be null!");
            }
            if (rsSelect.next()) {
                rsSelect.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record select response, " + rsSelect.getRow() + " rows selected");
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "Expected 1 result row to be returned by nxt_tsecgroupidgen(), not 0");
        }
        return (nextId);
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (rsSelect != null) {
            try {
                rsSelect.close();
            } catch (SQLException e) {
            }
            rsSelect = null;
        }
    }
}

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

public void deleteTSecGroupByIdIdx(CFCrmAuthorization Authorization, long argTenantId, int argTSecGroupId) {
    final String S_ProcName = "deleteTSecGroupByIdIdx";
    ResultSet resultSet = null;
    try {/*from  w  ww  .j  a v a2s.c  o m*/
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_tsecgrp_by_ididx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )";
        if (stmtDeleteByIdIdx == null) {
            stmtDeleteByIdIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByIdIdx.setLong(argIdx++, argTenantId);
        stmtDeleteByIdIdx.setInt(argIdx++, argTSecGroupId);
        resultSet = stmtDeleteByIdIdx.executeQuery();
        if (resultSet.next()) {
            int deleteFlag = resultSet.getInt(1);
            if (resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "Expected 1 record result set to be returned by delete, not 0 rows");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

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

public CFCrmURLProtocolBuff readBuffByIdIdx(CFCrmAuthorization Authorization, short URLProtocolId) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;
    try {/*ww  w .  j  a v  a 2s  . c om*/
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_read_urlproto_by_ididx( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        if (stmtReadBuffByIdIdx == null) {
            stmtReadBuffByIdIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByIdIdx.setShort(argIdx++, URLProtocolId);
        resultSet = stmtReadBuffByIdIdx.executeQuery();
        if (resultSet.next()) {
            CFCrmURLProtocolBuff buff = unpackURLProtocolResultSetToBuff(resultSet);
            if (resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
            return (buff);
        } else {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstPgSql.CFAstPgSqlClusterTable.java

public long nextHostNodeIdGen(CFAstAuthorization Authorization, CFAstClusterPKey PKey) {
    final String S_ProcName = "nextHostNodeIdGen";
    String sqlSelectNext = "SELECT " + schema.getLowerSchemaDbName() + ".sp_next_hostnodeidgen(" + "?"
            + " ) as NextHostNodeIdGen";

    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/* w  w w. jav a 2s  .c  o m*/
    ResultSet rsSelect = null;
    try {
        Connection cnx = schema.getCnx();
        long Id = PKey.getRequiredId();

        if (stmtSelectNextHostNodeIdGen == null) {
            stmtSelectNextHostNodeIdGen = cnx.prepareStatement(sqlSelectNext);
        }
        long nextId;
        int argIdx = 1;
        stmtSelectNextHostNodeIdGen.setLong(argIdx++, Id);
        rsSelect = stmtSelectNextHostNodeIdGen.executeQuery();
        if (rsSelect.next()) {
            nextId = rsSelect.getLong(1);
            if (rsSelect.wasNull()) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "NextHostNodeIdGen cannot be null!");
            }
            if (rsSelect.next()) {
                rsSelect.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record select response, " + rsSelect.getRow() + " rows selected");
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "Expected 1 result row to be returned by sp_next_hostnodeidgen(), not 0");
        }
        return (nextId);
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (rsSelect != null) {
            try {
                rsSelect.close();
            } catch (SQLException e) {
            }
            rsSelect = null;
        }
    }
}

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

public CFAstSecDeviceBuff readBuffByIdIdx(CFAstAuthorization Authorization, UUID SecUserId, String DevName) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;
    try {// ww  w  .  j  av a  2s  . c om
        Connection cnx = schema.getCnx();
        String sql = "{ call sp_read_secdev_by_ididx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ) }";
        if (stmtReadBuffByIdIdx == null) {
            stmtReadBuffByIdIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByIdIdx.setString(argIdx++, SecUserId.toString());
        stmtReadBuffByIdIdx.setString(argIdx++, DevName);
        resultSet = stmtReadBuffByIdIdx.executeQuery();
        if ((resultSet != null) && resultSet.next()) {
            CFAstSecDeviceBuff buff = unpackSecDeviceResultSetToBuff(resultSet);
            if (resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
            return (buff);
        } else {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

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

public CFCrmISOCurrencyBuff readBuffByIdIdx(CFCrmAuthorization Authorization, short Id) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;
    try {//from w w w . j av  a  2s . c  o  m
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_read_iso_ccy_by_ididx( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        if (stmtReadBuffByIdIdx == null) {
            stmtReadBuffByIdIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByIdIdx.setShort(argIdx++, Id);
        resultSet = stmtReadBuffByIdIdx.executeQuery();
        if (resultSet.next()) {
            CFCrmISOCurrencyBuff buff = unpackISOCurrencyResultSetToBuff(resultSet);
            if (resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
            return (buff);
        } else {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

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

public void deleteISOCurrencyByCcyNmIdx(CFAccAuthorization Authorization, String argName) {
    final String S_ProcName = "deleteISOCurrencyByCcyNmIdx";
    ResultSet resultSet = null;
    try {/*from   ww  w  .j  av  a2  s  . c o  m*/
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_iso_ccy_by_ccynmidx( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        if (stmtDeleteByCcyNmIdx == null) {
            stmtDeleteByCcyNmIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByCcyNmIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCcyNmIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByCcyNmIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByCcyNmIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCcyNmIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByCcyNmIdx.setString(argIdx++, argName);
        resultSet = stmtDeleteByCcyNmIdx.executeQuery();
        if (resultSet.next()) {
            int deleteFlag = resultSet.getInt(1);
            if (resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "Expected 1 record result set to be returned by delete, not 0 rows");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}