List of usage examples for java.sql ResultSet getRow
int getRow() throws SQLException;
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWISOCurrencyTable.java
public void deleteISOCurrencyByIdIdx(CFAccAuthorization Authorization, short argId) { final String S_ProcName = "deleteISOCurrencyByIdIdx"; ResultSet resultSet = null; try {// w w w . j av a 2s. c om Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_iso_ccy_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.cfasterisk.v2_0.CFAstDb2LUW.CFAstDb2LUWISOCurrencyTable.java
public void deleteISOCurrencyByIdIdx(CFAstAuthorization Authorization, short argId) { final String S_ProcName = "deleteISOCurrencyByIdIdx"; ResultSet resultSet = null; try {// www. j a v a 2 s .c o m Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_iso_ccy_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.cfasterisk.v2_4.CFAsteriskDb2LUW.CFAsteriskDb2LUWTSecGroupTable.java
public void deleteTSecGroupByTenantIdx(CFSecurityAuthorization Authorization, long argTenantId) { final String S_ProcName = "deleteTSecGroupByTenantIdx"; ResultSet resultSet = null; try {//from w ww.ja 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.cfcrm.v2_1.CFCrmDb2LUW.CFCrmDb2LUWISOCountryTable.java
public CFCrmISOCountryBuff readBuffByNameIdx(CFCrmAuthorization Authorization, String Name) { final String S_ProcName = "readBuffByNameIdx"; ResultSet resultSet = null; try {/*ww w.ja v a 2s .c om*/ Connection cnx = schema.getCnx(); final String sql = "CALL sp_read_iso_cntry_by_nameidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffByNameIdx == null) { stmtReadBuffByNameIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByNameIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByNameIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByNameIdx.setString(argIdx++, Name); resultSet = stmtReadBuffByNameIdx.executeQuery(); if (resultSet.next()) { CFCrmISOCountryBuff 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.CFCrmDb2LUWURLProtocolTable.java
public void deleteURLProtocolByUNameIdx(CFCrmAuthorization Authorization, String argName) { final String S_ProcName = "deleteURLProtocolByUNameIdx"; ResultSet resultSet = null; try {//from w w w .j a v a 2 s .c o m Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_urlproto_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.cfensyntax.v2_2.CFEnSyntaxMSSql.CFEnSyntaxMSSqlServiceTypeTable.java
public CFEnSyntaxServiceTypeBuff readBuffByUDescrIdx(CFEnSyntaxAuthorization Authorization, String Description) {//from w w w. j a v a2 s . co m final String S_ProcName = "readBuffByUDescrIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); String sql = "{ call sp_read_svctype_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 != null) && resultSet.next()) { CFEnSyntaxServiceTypeBuff 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:mom.trd.opentheso.bdd.helper.ThesaurusHelper.java
/** * retourne la liste des thsaurus d'un utilisateur * @param ds/*from www .java 2 s . c om*/ * @param idUser * @param idLang * @return */ public Map getListThesaurusOfUser(HikariDataSource ds, int idUser, String idLang) { Connection conn; Statement stmt; ResultSet resultSet; Map map = new HashMap(); ArrayList tabIdThesaurus = new ArrayList(); try { // Get connection from pool conn = ds.getConnection(); try { stmt = conn.createStatement(); try { String query = "SELECT DISTINCT user_role.id_thesaurus FROM" + " user_role WHERE" + " id_user = " + idUser; stmt.executeQuery(query); resultSet = stmt.getResultSet(); if (resultSet != null) { while (resultSet.next()) { if (!resultSet.getString("id_thesaurus").isEmpty()) tabIdThesaurus.add(resultSet.getString("id_thesaurus")); } for (Object tabIdThesauru : tabIdThesaurus) { query = "select title from thesaurus_label where" + " id_thesaurus = '" + tabIdThesauru + "'" + " and lang = '" + idLang + "'"; stmt.executeQuery(query); resultSet = stmt.getResultSet(); if (resultSet != null) { resultSet.next(); if (resultSet.getRow() == 0) { map.put("(" + tabIdThesauru + ")", tabIdThesauru); } else { map.put(resultSet.getString("title") + "(" + tabIdThesauru + ")", tabIdThesauru); } } else { } } } } finally { stmt.close(); } } finally { conn.close(); } } catch (SQLException sqle) { // Log exception log.error("Error while getting Map of thesaurus : " + map.toString(), sqle); } return map; }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWTldTable.java
public void deleteTldByTenantIdx(CFAccAuthorization Authorization, long argTenantId) { final String S_ProcName = "deleteTldByTenantIdx"; ResultSet resultSet = null; try {//from w ww . j a v a 2 s .c o m Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_tlddef_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.CFAstDb2LUWTldTable.java
public void deleteTldByTenantIdx(CFAstAuthorization Authorization, long argTenantId) { final String S_ProcName = "deleteTldByTenantIdx"; ResultSet resultSet = null; try {//ww w .j a va2s. c o m Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_tlddef_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.CFAccDb2LUWISOCountryTable.java
public void deleteISOCountryByISOCodeIdx(CFAccAuthorization Authorization, String argISOCode) { final String S_ProcName = "deleteISOCountryByISOCodeIdx"; ResultSet resultSet = null; try {//from www . java2 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; } } }