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.cfcrm.v2_1.CFCrmDb2LUW.CFCrmDb2LUWMimeTypeTable.java

public CFCrmMimeTypeBuff lockBuff(CFCrmAuthorization Authorization, CFCrmMimeTypePKey PKey) {
    final String S_ProcName = "lockBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from w ww.jav  a 2 s  .c  o m*/
    ResultSet resultSet = null;
    try {
        Connection cnx = schema.getCnx();
        int MimeTypeId = PKey.getRequiredMimeTypeId();
        final String sql = "CALL sp_lock_mimetype( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        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.setInt(argIdx++, MimeTypeId);
        resultSet = stmtLockBuffByPKey.executeQuery();
        if (resultSet.next()) {
            CFCrmMimeTypeBuff buff = unpackMimeTypeResultSetToBuff(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.CFCrmDb2LUWAuditActionTable.java

public CFCrmAuditActionBuff readBuffByUDescrIdx(CFCrmAuthorization Authorization, String Description) {
    final String S_ProcName = "readBuffByUDescrIdx";
    ResultSet resultSet = null;
    try {//w ww. ja va  2s .c om
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_read_auditaction_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.next()) {
            CFCrmAuditActionBuff 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.CFAsteriskMSSql.CFAsteriskMSSqlServiceTypeTable.java

public CFSecurityServiceTypeBuff readBuffByIdIdx(CFSecurityAuthorization Authorization, int ServiceTypeId) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;
    try {//from w w  w . ja v  a2  s  .  com
        Connection cnx = schema.getCnx();
        String sql = "{ call sp_read_svctype_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.setInt(argIdx++, ServiceTypeId);
        resultSet = stmtReadBuffByIdIdx.executeQuery();
        if ((resultSet != null) && resultSet.next()) {
            CFSecurityServiceTypeBuff 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.cfasterisk.v2_0.CFAstPgSql.CFAstPgSqlTenantTable.java

public int nextTSecGroupIdGen(CFAstAuthorization Authorization, CFAstTenantPKey PKey) {
    final String S_ProcName = "nextTSecGroupIdGen";
    String sqlSelectNext = "SELECT " + schema.getLowerSchemaDbName() + ".sp_next_tsecgroupidgen(" + "?"
            + " ) as NextTSecGroupIdGen";

    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from  w w  w.  ja  va 2  s  . co  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 sp_next_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.cfasterisk.v2_1.CFAstPgSql.CFAstPgSqlTenantTable.java

public int nextTSecGroupIdGen(CFAstAuthorization Authorization, CFAstTenantPKey PKey) {
    final String S_ProcName = "nextTSecGroupIdGen";
    String sqlSelectNext = "SELECT " + schema.getLowerDbSchemaName() + ".sp_next_tsecgroupidgen(" + "?"
            + " ) as NextTSecGroupIdGen";

    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*  w  ww. ja  v a 2  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 sp_next_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.cfasterisk.v2_2.CFAstSybase.CFAstSybaseSysClusterTable.java

public CFAstSysClusterBuff readBuff(CFAstAuthorization Authorization, CFAstSysClusterPKey PKey) {
    final String S_ProcName = "readBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from w w  w.j  a v  a 2s .  com*/
    ResultSet resultSet = null;
    try {
        Connection cnx = schema.getCnx();
        int SingletonId = PKey.getRequiredSingletonId();
        String sql = "exec sp_read_sysclus ?, ?, ?, ?, ?" + ", " + "?";
        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++, SingletonId);
        resultSet = stmtReadBuffByPKey.executeQuery();
        if (resultSet.next()) {
            CFAstSysClusterBuff buff = unpackSysClusterResultSetToBuff(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_2.CFAstSybase.CFAstSybaseSysClusterTable.java

public CFAstSysClusterBuff lockBuff(CFAstAuthorization Authorization, CFAstSysClusterPKey PKey) {
    final String S_ProcName = "lockBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//ww  w . j a v  a  2 s.co  m
    ResultSet resultSet = null;
    try {
        Connection cnx = schema.getCnx();
        int SingletonId = PKey.getRequiredSingletonId();
        String sql = "exec sp_lock_sysclus ?, ?, ?, ?, ?" + ", " + "?";
        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.setInt(argIdx++, SingletonId);
        resultSet = stmtLockBuffByPKey.executeQuery();
        if (resultSet.next()) {
            CFAstSysClusterBuff buff = unpackSysClusterResultSetToBuff(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.CFAccMSSql.CFAccMSSqlMimeTypeTable.java

public CFAccMimeTypeBuff readBuffByIdIdx(CFAccAuthorization Authorization, int MimeTypeId) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;
    try {//from  www .  j av a2  s  .c  om
        Connection cnx = schema.getCnx();
        String sql = "{ call sp_read_mimetype_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.setInt(argIdx++, MimeTypeId);
        resultSet = stmtReadBuffByIdIdx.executeQuery();
        if ((resultSet != null) && resultSet.next()) {
            CFAccMimeTypeBuff buff = unpackMimeTypeResultSetToBuff(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.CFAstMSSql.CFAstMSSqlMimeTypeTable.java

public CFAstMimeTypeBuff readBuffByIdIdx(CFAstAuthorization Authorization, int MimeTypeId) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;
    try {/*  w  w w. ja va 2s  .  com*/
        Connection cnx = schema.getCnx();
        String sql = "{ call sp_read_mimetype_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.setInt(argIdx++, MimeTypeId);
        resultSet = stmtReadBuffByIdIdx.executeQuery();
        if ((resultSet != null) && resultSet.next()) {
            CFAstMimeTypeBuff buff = unpackMimeTypeResultSetToBuff(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_2.CFAstDb2LUW.CFAstDb2LUWSysClusterTable.java

public CFAstSysClusterBuff readBuff(CFAstAuthorization Authorization, CFAstSysClusterPKey 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  . c om*/
    ResultSet resultSet = null;
    try {
        Connection cnx = schema.getCnx();
        int SingletonId = PKey.getRequiredSingletonId();
        final String sql = "CALL sp_read_sysclus( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        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++, SingletonId);
        resultSet = stmtReadBuffByPKey.executeQuery();
        if (resultSet.next()) {
            CFAstSysClusterBuff buff = unpackSysClusterResultSetToBuff(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;
        }
    }
}