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.CFAccDb2LUWServiceTypeTable.java
public CFAccServiceTypeBuff lockBuff(CFAccAuthorization Authorization, CFAccServiceTypePKey PKey) { final String S_ProcName = "lockBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*www. jav a 2s . c o m*/ ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); int ServiceTypeId = PKey.getRequiredServiceTypeId(); final String sql = "CALL sp_lock_svctype( ?, ?, ?, ?, ?" + ", " + "?" + " )"; 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++, ServiceTypeId); resultSet = stmtLockBuffByPKey.executeQuery(); if (resultSet.next()) { CFAccServiceTypeBuff 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.CFAstDb2LUW.CFAstDb2LUWServiceTypeTable.java
public CFAstServiceTypeBuff readBuff(CFAstAuthorization Authorization, CFAstServiceTypePKey PKey) { final String S_ProcName = "readBuff"; 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 ServiceTypeId = PKey.getRequiredServiceTypeId(); final 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.next()) { CFAstServiceTypeBuff 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.CFAstDb2LUW.CFAstDb2LUWServiceTypeTable.java
public CFAstServiceTypeBuff lockBuff(CFAstAuthorization Authorization, CFAstServiceTypePKey PKey) { final String S_ProcName = "lockBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/* w w w. ja v a 2s.c o m*/ ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); int ServiceTypeId = PKey.getRequiredServiceTypeId(); final String sql = "CALL sp_lock_svctype( ?, ?, ?, ?, ?" + ", " + "?" + " )"; 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++, ServiceTypeId); resultSet = stmtLockBuffByPKey.executeQuery(); if (resultSet.next()) { CFAstServiceTypeBuff 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_4.CFAsteriskDb2LUW.CFAsteriskDb2LUWSysClusterTable.java
public void deleteSysCluster(CFSecurityAuthorization Authorization, CFSecuritySysClusterBuff Buff) { final String S_ProcName = "deleteSysCluster"; ResultSet resultSet = null; try {//from w ww . ja v a 2 s.c o m Connection cnx = schema.getCnx(); int SingletonId = Buff.getRequiredSingletonId(); final String sql = "CALL sp_delete_sysclus( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )"; 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++, SingletonId); 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.CFAstDb2LUWTenantTable.java
public long nextTSecGroupIncludeIdGen(CFAstAuthorization Authorization, CFAstTenantPKey PKey) { final String S_ProcName = "nextTSecGroupIncludeIdGen"; final String sqlSelectNext = "call sf_next_tsecgroupincludeidgen(" + "?" + " )"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }//from www .j a v a 2 s .c o m ResultSet rsSelect = null; try { Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); if (stmtSelectNextTSecGroupIncludeIdGen == null) { stmtSelectNextTSecGroupIncludeIdGen = cnx.prepareStatement(sqlSelectNext); } long nextId; int argIdx = 1; stmtSelectNextTSecGroupIncludeIdGen.setLong(argIdx++, Id); rsSelect = stmtSelectNextTSecGroupIncludeIdGen.executeQuery(); if (rsSelect.next()) { nextId = rsSelect.getLong(1); if (rsSelect.wasNull()) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "NextTSecGroupIncludeIdGen 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_tsecgroupincludeidgen(), 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.CFAstPgSql.CFAstPgSqlTenantTable.java
public long nextTSecGroupMemberIdGen(CFAstAuthorization Authorization, CFAstTenantPKey PKey) { final String S_ProcName = "nextTSecGroupMemberIdGen"; String sqlSelectNext = "SELECT " + schema.getLowerSchemaDbName() + ".sp_next_tsecgroupmemberidgen(" + "?" + " ) as NextTSecGroupMemberIdGen"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }//from www . j a v a 2 s . c o m ResultSet rsSelect = null; try { Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); if (stmtSelectNextTSecGroupMemberIdGen == null) { stmtSelectNextTSecGroupMemberIdGen = cnx.prepareStatement(sqlSelectNext); } long nextId; int argIdx = 1; stmtSelectNextTSecGroupMemberIdGen.setLong(argIdx++, Id); rsSelect = stmtSelectNextTSecGroupMemberIdGen.executeQuery(); if (rsSelect.next()) { nextId = rsSelect.getLong(1); if (rsSelect.wasNull()) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "NextTSecGroupMemberIdGen 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_tsecgroupmemberidgen(), 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 long nextTSecGroupMemberIdGen(CFAstAuthorization Authorization, CFAstTenantPKey PKey) { final String S_ProcName = "nextTSecGroupMemberIdGen"; String sqlSelectNext = "SELECT " + schema.getLowerDbSchemaName() + ".sp_next_tsecgroupmemberidgen(" + "?" + " ) as NextTSecGroupMemberIdGen"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }//from w ww . j av a 2 s . co m ResultSet rsSelect = null; try { Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); if (stmtSelectNextTSecGroupMemberIdGen == null) { stmtSelectNextTSecGroupMemberIdGen = cnx.prepareStatement(sqlSelectNext); } long nextId; int argIdx = 1; stmtSelectNextTSecGroupMemberIdGen.setLong(argIdx++, Id); rsSelect = stmtSelectNextTSecGroupMemberIdGen.executeQuery(); if (rsSelect.next()) { nextId = rsSelect.getLong(1); if (rsSelect.wasNull()) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "NextTSecGroupMemberIdGen 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_tsecgroupmemberidgen(), 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.CFCrmDb2LUWISOCountryTable.java
public void deleteISOCountryByIdIdx(CFCrmAuthorization Authorization, short argId) { final String S_ProcName = "deleteISOCountryByIdIdx"; ResultSet resultSet = null; try {//from www . j av a2 s .c om Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_iso_cntry_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.setShort(argIdx++, argId); 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.cfacc.v2_0.CFAccMSSql.CFAccMSSqlMimeTypeTable.java
public CFAccMimeTypeBuff readBuffByUNameIdx(CFAccAuthorization Authorization, String Name) { final String S_ProcName = "readBuffByUNameIdx"; ResultSet resultSet = null; try {//from w w w.j a v a 2 s . c o m Connection cnx = schema.getCnx(); String sql = "{ call sp_read_mimetype_by_unameidx( ?, ?, ?, ?, ?" + ", " + "?" + " ) }"; if (stmtReadBuffByUNameIdx == null) { stmtReadBuffByUNameIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByUNameIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByUNameIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByUNameIdx.setString(argIdx++, Name); resultSet = stmtReadBuffByUNameIdx.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 readBuffByUNameIdx(CFAstAuthorization Authorization, String Name) { final String S_ProcName = "readBuffByUNameIdx"; ResultSet resultSet = null; try {/*w ww .j a v a 2 s .c o m*/ Connection cnx = schema.getCnx(); String sql = "{ call sp_read_mimetype_by_unameidx( ?, ?, ?, ?, ?" + ", " + "?" + " ) }"; if (stmtReadBuffByUNameIdx == null) { stmtReadBuffByUNameIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByUNameIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByUNameIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByUNameIdx.setString(argIdx++, Name); resultSet = stmtReadBuffByUNameIdx.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; } } }