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.CFAstDb2LUWISOCurrencyTable.java

public void deleteISOCurrencyByCcyNmIdx(CFAstAuthorization Authorization, String argName) {
    final String S_ProcName = "deleteISOCurrencyByCcyNmIdx";
    ResultSet resultSet = null;
    try {//ww w.j a  v  a  2s  .co  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;
        }
    }
}

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

public void deleteSecGroupByIdIdx(CFSecurityAuthorization Authorization, long argClusterId, int argSecGroupId) {
    final String S_ProcName = "deleteSecGroupByIdIdx";
    ResultSet resultSet = null;
    try {//from w w w  .  ja  v a  2s. co m
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_secgrp_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++, argClusterId);
        stmtDeleteByIdIdx.setInt(argIdx++, argSecGroupId);
        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.cfasterisk.v2_4.CFAsteriskMSSql.CFAsteriskMSSqlISOCountryTable.java

public CFSecurityISOCountryBuff readBuffByIdIdx(CFSecurityAuthorization Authorization, short Id) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;
    try {/*from  w  w  w  . jav  a  2 s. c  om*/
        Connection cnx = schema.getCnx();
        String sql = "{ call sp_read_iso_cntry_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 != null) && resultSet.next()) {
            CFSecurityISOCountryBuff 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.cfcrm.v2_1.CFCrmDb2LUW.CFCrmDb2LUWSecAppTable.java

public void deleteSecAppByIdIdx(CFCrmAuthorization Authorization, long argClusterId, int argSecAppId) {
    final String S_ProcName = "deleteSecAppByIdIdx";
    ResultSet resultSet = null;
    try {/*  w w  w. ja  v a 2s  . c o m*/
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_secapp_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++, argClusterId);
        stmtDeleteByIdIdx.setInt(argIdx++, argSecAppId);
        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.cfensyntax.v2_2.CFEnSyntaxMSSql.CFEnSyntaxMSSqlSecDeviceTable.java

public CFEnSyntaxSecDeviceBuff readBuffByIdIdx(CFEnSyntaxAuthorization Authorization, UUID SecUserId,
        String DevName) {//from ww  w.  ja va2 s  . c o  m
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;
    try {
        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()) {
            CFEnSyntaxSecDeviceBuff 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.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWISOCurrencyTable.java

public void deleteISOCurrencyByCcyCdIdx(CFAccAuthorization Authorization, String argISOCode) {
    final String S_ProcName = "deleteISOCurrencyByCcyCdIdx";
    ResultSet resultSet = null;
    try {// w w w  .  j a  va  2s.  c om
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_iso_ccy_by_ccycdidx( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        if (stmtDeleteByCcyCdIdx == null) {
            stmtDeleteByCcyCdIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByCcyCdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCcyCdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByCcyCdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByCcyCdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCcyCdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByCcyCdIdx.setString(argIdx++, argISOCode);
        resultSet = stmtDeleteByCcyCdIdx.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_0.CFAstDb2LUW.CFAstDb2LUWISOCurrencyTable.java

public void deleteISOCurrencyByCcyCdIdx(CFAstAuthorization Authorization, String argISOCode) {
    final String S_ProcName = "deleteISOCurrencyByCcyCdIdx";
    ResultSet resultSet = null;
    try {//  ww w. j  av  a 2s.  co  m
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_iso_ccy_by_ccycdidx( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        if (stmtDeleteByCcyCdIdx == null) {
            stmtDeleteByCcyCdIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByCcyCdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCcyCdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByCcyCdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByCcyCdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCcyCdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByCcyCdIdx.setString(argIdx++, argISOCode);
        resultSet = stmtDeleteByCcyCdIdx.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.CFAsteriskSybase.CFAsteriskSybaseISOCountryTable.java

public CFSecurityISOCountryBuff readBuffByNameIdx(CFSecurityAuthorization Authorization, String Name) {
    final String S_ProcName = "readBuffByNameIdx";
    ResultSet resultSet = null;
    try {//from  www  .java2 s  . co m
        Connection cnx = schema.getCnx();
        String sql = "exec sp_read_iso_cntry_by_nameidx ?, ?, ?, ?, ?" + ", " + "?";
        if (stmtReadBuffByNameIdx == null) {
            stmtReadBuffByNameIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByNameIdx.setString(argIdx++, Name);
        resultSet = stmtReadBuffByNameIdx.executeQuery();
        if (resultSet.next()) {
            CFSecurityISOCountryBuff 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.cfcrm.v2_1.CFCrmDb2LUW.CFCrmDb2LUWISOCountryCurrencyTable.java

public void deleteISOCountryCurrencyByCountryIdx(CFCrmAuthorization Authorization, short argISOCountryId) {
    final String S_ProcName = "deleteISOCountryCurrencyByCountryIdx";
    ResultSet resultSet = null;
    try {//from   w  w w .  j  av a2s.co  m
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_iso_cntryccy_by_countryidx( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        if (stmtDeleteByCountryIdx == null) {
            stmtDeleteByCountryIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCountryIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByCountryIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByCountryIdx.setShort(argIdx++, argISOCountryId);
        resultSet = stmtDeleteByCountryIdx.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.CFCrmDb2LUWISOCountryLanguageTable.java

public void deleteISOCountryLanguageByCountryIdx(CFCrmAuthorization Authorization, short argISOCountryId) {
    final String S_ProcName = "deleteISOCountryLanguageByCountryIdx";
    ResultSet resultSet = null;
    try {/*  w ww  .  j a  v  a  2 s .  c  om*/
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_iso_cntrylng_by_countryidx( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        if (stmtDeleteByCountryIdx == null) {
            stmtDeleteByCountryIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCountryIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByCountryIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByCountryIdx.setShort(argIdx++, argISOCountryId);
        resultSet = stmtDeleteByCountryIdx.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;
        }
    }
}