List of usage examples for java.sql ResultSet getRow
int getRow() throws SQLException;
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskDb2LUW.CFAsteriskDb2LUWISOCountryTable.java
public CFSecurityISOCountryBuff readBuff(CFSecurityAuthorization Authorization, CFSecurityISOCountryPKey PKey) { final String S_ProcName = "readBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }//from www .j a v a 2 s .co m ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); short Id = PKey.getRequiredId(); final String sql = "CALL sp_read_iso_cntry( ?, ?, ?, ?, ?" + ", " + "?" + " )"; 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.setShort(argIdx++, Id); resultSet = stmtReadBuffByPKey.executeQuery(); if (resultSet.next()) { CFSecurityISOCountryBuff 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.cfasterisk.v2_4.CFAsteriskDb2LUW.CFAsteriskDb2LUWISOCountryTable.java
public CFSecurityISOCountryBuff lockBuff(CFSecurityAuthorization Authorization, CFSecurityISOCountryPKey PKey) { final String S_ProcName = "lockBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*from w w w . j a v a 2s. c o m*/ ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); short Id = PKey.getRequiredId(); final String sql = "CALL sp_lock_iso_cntry( ?, ?, ?, ?, ?" + ", " + "?" + " )"; 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.setShort(argIdx++, Id); resultSet = stmtLockBuffByPKey.executeQuery(); if (resultSet.next()) { CFSecurityISOCountryBuff 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.cfcrm.v2_1.CFCrmDb2LUW.CFCrmDb2LUWTldTable.java
public void deleteTldByIdIdx(CFCrmAuthorization Authorization, long argTenantId, long argTldId) { final String S_ProcName = "deleteTldByIdIdx"; ResultSet resultSet = null; try {//from ww w.j av a2s .c o m Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_tlddef_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.setLong(argIdx++, argTenantId); stmtDeleteByIdIdx.setLong(argIdx++, argTldId); 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.CFAstDb2LUWClusterTable.java
public long nextHostNodeIdGen(CFAstAuthorization Authorization, CFAstClusterPKey PKey) { final String S_ProcName = "nextHostNodeIdGen"; final String sqlSelectNext = "call sf_next_hostnodeidgen(" + "?" + " )"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/* ww w . j av a 2 s . c om*/ ResultSet rsSelect = null; try { Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); if (stmtSelectNextHostNodeIdGen == null) { stmtSelectNextHostNodeIdGen = cnx.prepareStatement(sqlSelectNext); } long nextId; int argIdx = 1; stmtSelectNextHostNodeIdGen.setLong(argIdx++, Id); rsSelect = stmtSelectNextHostNodeIdGen.executeQuery(); if (rsSelect.next()) { nextId = rsSelect.getLong(1); if (rsSelect.wasNull()) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "NextHostNodeIdGen 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_hostnodeidgen(), 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.CFAstPgSqlClusterTable.java
public int nextSecFormIdGen(CFAstAuthorization Authorization, CFAstClusterPKey PKey) { final String S_ProcName = "nextSecFormIdGen"; String sqlSelectNext = "SELECT " + schema.getLowerSchemaDbName() + ".sp_next_secformidgen(" + "?" + " ) as NextSecFormIdGen"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }// w w w.j av a2 s . com 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 sp_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_1.CFAstSybase.CFAstSybaseISOCountryTable.java
public CFAstISOCountryBuff readBuffByIdIdx(CFAstAuthorization Authorization, short Id) { final String S_ProcName = "readBuffByIdIdx"; ResultSet resultSet = null; try {/* ww w. j a va 2 s . co m*/ Connection cnx = schema.getCnx(); String sql = "exec 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()) { CFAstISOCountryBuff 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.cfasterisk.v2_4.CFAsteriskDb2LUW.CFAsteriskDb2LUWISOCurrencyTable.java
public void deleteISOCurrencyByCcyNmIdx(CFSecurityAuthorization Authorization, String argName) { final String S_ProcName = "deleteISOCurrencyByCcyNmIdx"; ResultSet resultSet = null; try {/*from w w w. j a va2s . c o m*/ Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_iso_ccy_by_ccynmidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByCcyNmIdx == null) { stmtDeleteByCcyNmIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByCcyNmIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByCcyNmIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByCcyNmIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByCcyNmIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByCcyNmIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByCcyNmIdx.setString(argIdx++, argName); resultSet = stmtDeleteByCcyNmIdx.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.CFAsteriskDb2LUWTldTable.java
public void deleteTldByIdIdx(CFSecurityAuthorization Authorization, long argTenantId, long argTldId) { final String S_ProcName = "deleteTldByIdIdx"; 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_tlddef_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.setLong(argIdx++, argTenantId); stmtDeleteByIdIdx.setLong(argIdx++, argTldId); 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.CFCrmDb2LUWContactListTable.java
public void deleteContactListByTenantIdx(CFCrmAuthorization Authorization, long argTenantId) { final String S_ProcName = "deleteContactListByTenantIdx"; ResultSet resultSet = null; try {// ww w . j a v a2 s. c om Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_ctclst_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.CFAstPgSql.CFAstPgSqlClusterTable.java
public long nextServiceIdGen(CFAstAuthorization Authorization, CFAstClusterPKey PKey) { final String S_ProcName = "nextServiceIdGen"; String sqlSelectNext = "SELECT " + schema.getLowerSchemaDbName() + ".sp_next_serviceidgen(" + "?" + " ) as NextServiceIdGen"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }//from www . ja va 2 s . c om ResultSet rsSelect = null; try { Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); if (stmtSelectNextServiceIdGen == null) { stmtSelectNextServiceIdGen = cnx.prepareStatement(sqlSelectNext); } long nextId; int argIdx = 1; stmtSelectNextServiceIdGen.setLong(argIdx++, Id); rsSelect = stmtSelectNextServiceIdGen.executeQuery(); if (rsSelect.next()) { nextId = rsSelect.getLong(1); if (rsSelect.wasNull()) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "NextServiceIdGen 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_serviceidgen(), 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; } } }