Example usage for java.sql ResultSet last

List of usage examples for java.sql ResultSet last

Introduction

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

Prototype

boolean last() throws SQLException;

Source Link

Document

Moves the cursor to the last row in this ResultSet object.

Usage

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSybase.CFAsteriskSybaseAuditActionTable.java

public CFSecurityAuditActionBuff readBuffByIdIdx(CFSecurityAuthorization Authorization, short AuditActionId) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;
    try {/*from ww  w  .  j a v  a  2s.  c o m*/
        Connection cnx = schema.getCnx();
        String sql = "exec sp_read_auditaction_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++, AuditActionId);
        resultSet = stmtReadBuffByIdIdx.executeQuery();
        if (resultSet.next()) {
            CFSecurityAuditActionBuff buff = unpackAuditActionResultSetToBuff(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_4.CFAsteriskDb2LUW.CFAsteriskDb2LUWAuditActionTable.java

public CFSecurityAuditActionBuff readBuffByIdIdx(CFSecurityAuthorization Authorization, short AuditActionId) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;
    try {/*from  w ww .  j  av  a 2 s  .  c  o  m*/
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_read_auditaction_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++, AuditActionId);
        resultSet = stmtReadBuffByIdIdx.executeQuery();
        if (resultSet.next()) {
            CFSecurityAuditActionBuff buff = unpackAuditActionResultSetToBuff(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_1.CFAstSybase.CFAstSybaseAuditActionTable.java

public CFAstAuditActionBuff readBuffByIdIdx(CFAstAuthorization Authorization, short AuditActionId) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;
    try {//  w w  w .j  av a 2s .c  om
        Connection cnx = schema.getCnx();
        String sql = "exec sp_read_auditaction_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++, AuditActionId);
        resultSet = stmtReadBuffByIdIdx.executeQuery();
        if (resultSet.next()) {
            CFAstAuditActionBuff buff = unpackAuditActionResultSetToBuff(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.CFAccDb2LUWAuditActionTable.java

public CFAccAuditActionBuff readBuffByIdIdx(CFAccAuthorization Authorization, short AuditActionId) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;
    try {/*from  w ww  . j a va2  s .c  o m*/
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_read_auditaction_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++, AuditActionId);
        resultSet = stmtReadBuffByIdIdx.executeQuery();
        if (resultSet.next()) {
            CFAccAuditActionBuff buff = unpackAuditActionResultSetToBuff(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.CFAccDb2LUWSecUserTable.java

public void deleteSecUserByIdIdx(CFAccAuthorization Authorization, UUID argSecUserId) {
    final String S_ProcName = "deleteSecUserByIdIdx";
    ResultSet resultSet = null;
    try {// w  ww .  j  a v a  2s. co m
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_secuser_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.setString(argIdx++, argSecUserId.toString());
        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_0.CFAstDb2LUW.CFAstDb2LUWAuditActionTable.java

public CFAstAuditActionBuff readBuffByIdIdx(CFAstAuthorization Authorization, short AuditActionId) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;
    try {/*from   w  ww  .ja  v a 2  s .c om*/
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_read_auditaction_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++, AuditActionId);
        resultSet = stmtReadBuffByIdIdx.executeQuery();
        if (resultSet.next()) {
            CFAstAuditActionBuff buff = unpackAuditActionResultSetToBuff(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.CFAstDb2LUWSecUserTable.java

public void deleteSecUserByIdIdx(CFAstAuthorization Authorization, UUID argSecUserId) {
    final String S_ProcName = "deleteSecUserByIdIdx";
    ResultSet resultSet = null;
    try {//from  ww  w.  j  a  va2 s .c o m
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_secuser_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.setString(argIdx++, argSecUserId.toString());
        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.CFCrmDb2LUWMimeTypeTable.java

public void deleteMimeTypeByUNameIdx(CFCrmAuthorization Authorization, String argName) {
    final String S_ProcName = "deleteMimeTypeByUNameIdx";
    ResultSet resultSet = null;
    try {//  w  w  w  .j a  v a2s.  c  om
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_mimetype_by_unameidx( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        if (stmtDeleteByUNameIdx == null) {
            stmtDeleteByUNameIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByUNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByUNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByUNameIdx.setString(argIdx++, argName);
        resultSet = stmtDeleteByUNameIdx.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.CFAsteriskDb2LUWMimeTypeTable.java

public void deleteMimeTypeByUNameIdx(CFSecurityAuthorization Authorization, String argName) {
    final String S_ProcName = "deleteMimeTypeByUNameIdx";
    ResultSet resultSet = null;
    try {//from w  ww .  j  av  a 2 s.com
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_mimetype_by_unameidx( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        if (stmtDeleteByUNameIdx == null) {
            stmtDeleteByUNameIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByUNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByUNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByUNameIdx.setString(argIdx++, argName);
        resultSet = stmtDeleteByUNameIdx.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.CFCrmDb2LUWServiceTypeTable.java

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