List of usage examples for java.sql ResultSet last
boolean last() throws SQLException;
ResultSet
object. From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWISOCountryTable.java
public void deleteISOCountryByISOCodeIdx(CFAccAuthorization Authorization, String argISOCode) { final String S_ProcName = "deleteISOCountryByISOCodeIdx"; ResultSet resultSet = null; try {//w w w. java2s . c o m Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_iso_cntry_by_isocodeidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByISOCodeIdx == null) { stmtDeleteByISOCodeIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByISOCodeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByISOCodeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByISOCodeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByISOCodeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByISOCodeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByISOCodeIdx.setString(argIdx++, argISOCode); resultSet = stmtDeleteByISOCodeIdx.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 deleteISOCountryByISOCodeIdx(CFAstAuthorization Authorization, String argISOCode) { final String S_ProcName = "deleteISOCountryByISOCodeIdx"; ResultSet resultSet = null; try {//from www . j av a 2 s . c o m Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_iso_cntry_by_isocodeidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByISOCodeIdx == null) { stmtDeleteByISOCodeIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByISOCodeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByISOCodeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByISOCodeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByISOCodeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByISOCodeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByISOCodeIdx.setString(argIdx++, argISOCode); resultSet = stmtDeleteByISOCodeIdx.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.CFAstOracle.CFAstOracleTenantTable.java
public long nextTLDIdGen(CFAstAuthorization Authorization, CFAstTenantPKey PKey) { final String S_ProcName = "nextTLDIdGen"; String sqlSelectNext = "SELECT " + schema.getLowerSchemaDbName() + ".nxt_tldidgen(" + "?" + " ) as NextTLDIdGen from dual"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*from w w w. j a v a 2 s . c o m*/ ResultSet rsSelect = null; try { Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); if (stmtSelectNextTLDIdGen == null) { stmtSelectNextTLDIdGen = cnx.prepareStatement(sqlSelectNext); } long nextId; int argIdx = 1; stmtSelectNextTLDIdGen.setLong(argIdx++, Id); rsSelect = stmtSelectNextTLDIdGen.executeQuery(); if (rsSelect.next()) { nextId = rsSelect.getLong(1); if (rsSelect.wasNull()) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "NextTLDIdGen 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_tldidgen(), 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.CFAstOracle.CFAstOracleTenantTable.java
public long nextTldIdGen(CFAstAuthorization Authorization, CFAstTenantPKey PKey) { final String S_ProcName = "nextTldIdGen"; String sqlSelectNext = "SELECT " + schema.getLowerDbSchemaName() + ".nxt_tldidgen(" + "?" + " ) as NextTldIdGen from dual"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*from w ww. ja v a2 s. c o m*/ ResultSet rsSelect = null; try { Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); if (stmtSelectNextTldIdGen == null) { stmtSelectNextTldIdGen = cnx.prepareStatement(sqlSelectNext); } long nextId; int argIdx = 1; stmtSelectNextTldIdGen.setLong(argIdx++, Id); rsSelect = stmtSelectNextTldIdGen.executeQuery(); if (rsSelect.next()) { nextId = rsSelect.getLong(1); if (rsSelect.wasNull()) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "NextTldIdGen 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_tldidgen(), 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_4.CFAsteriskDb2LUW.CFAsteriskDb2LUWSecGroupTable.java
public void deleteSecGroupByClusterIdx(CFSecurityAuthorization Authorization, long argClusterId) { final String S_ProcName = "deleteSecGroupByClusterIdx"; ResultSet resultSet = null; try {/*from w ww . j av a2s . c om*/ Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_secgrp_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.cfcrm.v2_1.CFCrmDb2LUW.CFCrmDb2LUWTagTable.java
public void deleteTagByTenantIdx(CFCrmAuthorization Authorization, long argTenantId) { final String S_ProcName = "deleteTagByTenantIdx"; ResultSet resultSet = null; try {//from ww w. j a v a 2s.c o m Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_tag_by_tenantidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByTenantIdx == null) { stmtDeleteByTenantIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByTenantIdx.setLong(argIdx++, argTenantId); resultSet = stmtDeleteByTenantIdx.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.CFAccDb2LUWTSecGroupTable.java
public void deleteTSecGroupByTenantIdx(CFAccAuthorization Authorization, long argTenantId) { final String S_ProcName = "deleteTSecGroupByTenantIdx"; ResultSet resultSet = null; try {//from w w w . ja v a2 s .c o m Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_tsecgrp_by_tenantidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByTenantIdx == null) { stmtDeleteByTenantIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByTenantIdx.setLong(argIdx++, argTenantId); resultSet = stmtDeleteByTenantIdx.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.CFAstDb2LUWClusterTable.java
public int nextSecFormIdGen(CFAstAuthorization Authorization, CFAstClusterPKey PKey) { final String S_ProcName = "nextSecFormIdGen"; final String sqlSelectNext = "call sf_next_secformidgen(" + "?" + " )"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }//from w w w . j a va 2 s . co m ResultSet rsSelect = null; try { Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); if (stmtSelectNextSecFormIdGen == null) { stmtSelectNextSecFormIdGen = cnx.prepareStatement(sqlSelectNext); } int nextId; int argIdx = 1; stmtSelectNextSecFormIdGen.setLong(argIdx++, Id); rsSelect = stmtSelectNextSecFormIdGen.executeQuery(); if (rsSelect.next()) { nextId = rsSelect.getInt(1); if (rsSelect.wasNull()) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "NextSecFormIdGen 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_secformidgen(), 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_0.CFAstDb2LUW.CFAstDb2LUWTSecGroupTable.java
public void deleteTSecGroupByTenantIdx(CFAstAuthorization Authorization, long argTenantId) { final String S_ProcName = "deleteTSecGroupByTenantIdx"; ResultSet resultSet = null; try {//ww w.j a v a 2s . c o m Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_tsecgrp_by_tenantidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByTenantIdx == null) { stmtDeleteByTenantIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByTenantIdx.setLong(argIdx++, argTenantId); resultSet = stmtDeleteByTenantIdx.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 long nextDomainIdGen(CFSecurityAuthorization Authorization, CFSecurityTenantPKey PKey) { final String S_ProcName = "nextDomainIdGen"; String sqlSelectNext = "SELECT " + schema.getLowerDbSchemaName() + ".nxt_domainidgen(" + "?" + " ) as NextDomainIdGen from dual"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }//from www .j av a 2 s . com ResultSet rsSelect = null; try { Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); if (stmtSelectNextDomainIdGen == null) { stmtSelectNextDomainIdGen = cnx.prepareStatement(sqlSelectNext); } long nextId; int argIdx = 1; stmtSelectNextDomainIdGen.setLong(argIdx++, Id); rsSelect = stmtSelectNextDomainIdGen.executeQuery(); if (rsSelect.next()) { nextId = rsSelect.getLong(1); if (rsSelect.wasNull()) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "NextDomainIdGen 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_domainidgen(), 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; } } }