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.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWISOCountryTable.java

public void deleteISOCountryByNameIdx(CFAccAuthorization Authorization, String argName) {
    final String S_ProcName = "deleteISOCountryByNameIdx";
    ResultSet resultSet = null;
    try {/* w  w w .  ja va  2 s  . co  m*/
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_iso_cntry_by_nameidx( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        if (stmtDeleteByNameIdx == null) {
            stmtDeleteByNameIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByNameIdx.setString(argIdx++, argName);
        resultSet = stmtDeleteByNameIdx.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.CFAstDb2LUWISOCountryTable.java

public void deleteISOCountryByNameIdx(CFAstAuthorization Authorization, String argName) {
    final String S_ProcName = "deleteISOCountryByNameIdx";
    ResultSet resultSet = null;
    try {/*from w ww.  j a v a 2 s  . c o m*/
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_iso_cntry_by_nameidx( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        if (stmtDeleteByNameIdx == null) {
            stmtDeleteByNameIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByNameIdx.setString(argIdx++, argName);
        resultSet = stmtDeleteByNameIdx.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.CFEnSyntaxMSSqlServiceTypeTable.java

public CFEnSyntaxServiceTypeBuff readBuff(CFEnSyntaxAuthorization Authorization,
        CFEnSyntaxServiceTypePKey PKey) {
    final String S_ProcName = "readBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*  w ww. j  av  a  2  s. c  om*/
    ResultSet resultSet = null;
    try {
        Connection cnx = schema.getCnx();
        int ServiceTypeId = PKey.getRequiredServiceTypeId();
        String sql = "{ call sp_read_svctype( ?, ?, ?, ?, ?" + ", " + "?" + " ) }";
        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.setInt(argIdx++, ServiceTypeId);
        resultSet = stmtReadBuffByPKey.executeQuery();
        if ((resultSet != null) && resultSet.next()) {
            CFEnSyntaxServiceTypeBuff buff = unpackServiceTypeResultSetToBuff(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.CFCrmMSSql.CFCrmMSSqlServiceTypeTable.java

public CFCrmServiceTypeBuff readBuffByUDescrIdx(CFCrmAuthorization Authorization, String Description) {
    final String S_ProcName = "readBuffByUDescrIdx";
    ResultSet resultSet = null;
    try {/*from w w w  . j  a v  a 2 s  . co m*/
        Connection cnx = schema.getCnx();
        String sql = "{ call sp_read_svctype_by_udescridx( ?, ?, ?, ?, ?" + ", " + "?" + " ) }";
        if (stmtReadBuffByUDescrIdx == null) {
            stmtReadBuffByUDescrIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtReadBuffByUDescrIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUDescrIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByUDescrIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByUDescrIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUDescrIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByUDescrIdx.setString(argIdx++, Description);
        resultSet = stmtReadBuffByUDescrIdx.executeQuery();
        if ((resultSet != null) && resultSet.next()) {
            CFCrmServiceTypeBuff buff = unpackServiceTypeResultSetToBuff(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.CFAccDb2LUWMimeTypeTable.java

public void deleteMimeType(CFAccAuthorization Authorization, CFAccMimeTypeBuff Buff) {
    final String S_ProcName = "deleteMimeType";
    ResultSet resultSet = null;
    try {/* w w  w  .  ja v a  2s  . co  m*/
        Connection cnx = schema.getCnx();
        int MimeTypeId = Buff.getRequiredMimeTypeId();

        final String sql = "CALL sp_delete_mimetype( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )";
        if (stmtDeleteByPKey == null) {
            stmtDeleteByPKey = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByPKey.setInt(argIdx++, MimeTypeId);
        stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision());
        ;
        resultSet = stmtDeleteByPKey.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.CFAstDb2LUWMimeTypeTable.java

public void deleteMimeType(CFAstAuthorization Authorization, CFAstMimeTypeBuff Buff) {
    final String S_ProcName = "deleteMimeType";
    ResultSet resultSet = null;
    try {//from   ww w .  j a  v  a2 s.c  o m
        Connection cnx = schema.getCnx();
        int MimeTypeId = Buff.getRequiredMimeTypeId();

        final String sql = "CALL sp_delete_mimetype( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )";
        if (stmtDeleteByPKey == null) {
            stmtDeleteByPKey = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByPKey.setInt(argIdx++, MimeTypeId);
        stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision());
        ;
        resultSet = stmtDeleteByPKey.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.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWClusterTable.java

public long nextSecGroupFormIdGen(CFAccAuthorization Authorization, CFAccClusterPKey PKey) {
    final String S_ProcName = "nextSecGroupFormIdGen";
    final String sqlSelectNext = "call sf_next_secgroupformidgen(" + "?" + " )";

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

        if (stmtSelectNextSecGroupFormIdGen == null) {
            stmtSelectNextSecGroupFormIdGen = cnx.prepareStatement(sqlSelectNext);
        }
        long nextId;
        int argIdx = 1;
        stmtSelectNextSecGroupFormIdGen.setLong(argIdx++, Id);
        rsSelect = stmtSelectNextSecGroupFormIdGen.executeQuery();
        if (rsSelect.next()) {
            nextId = rsSelect.getLong(1);
            if (rsSelect.wasNull()) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "NextSecGroupFormIdGen 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 sf_next_secgroupformidgen(), 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.CFCrmDb2LUWSecDeviceTable.java

public CFCrmSecDeviceBuff readBuffByIdIdx(CFCrmAuthorization Authorization, UUID SecUserId, String DevName) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;
    try {//from   www  . ja va2  s . c  om
        Connection cnx = schema.getCnx();
        final 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.next()) {
            CFCrmSecDeviceBuff 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.CFCrmDb2LUWISOCountryTable.java

public CFCrmISOCountryBuff readBuffByIdIdx(CFCrmAuthorization Authorization, short Id) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;
    try {/*from  ww  w.  j a v  a  2 s . c o m*/
        Connection cnx = schema.getCnx();
        final 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.next()) {
            CFCrmISOCountryBuff 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.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWServiceTypeTable.java

public void deleteServiceType(CFAccAuthorization Authorization, CFAccServiceTypeBuff Buff) {
    final String S_ProcName = "deleteServiceType";
    ResultSet resultSet = null;
    try {//ww  w.j ava 2  s . c  om
        Connection cnx = schema.getCnx();
        int ServiceTypeId = Buff.getRequiredServiceTypeId();

        final String sql = "CALL sp_delete_svctype( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )";
        if (stmtDeleteByPKey == null) {
            stmtDeleteByPKey = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByPKey.setInt(argIdx++, ServiceTypeId);
        stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision());
        ;
        resultSet = stmtDeleteByPKey.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;
        }
    }
}