List of usage examples for java.sql CallableStatement setInt
void setInt(String parameterName, int x) throws SQLException;
int
value. From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleSecGroupMemberTable.java
public CFSecuritySecGroupMemberBuff[] readBuffByGroupIdx(CFSecurityAuthorization Authorization, long ClusterId, int SecGroupId) { final String S_ProcName = "readBuffByGroupIdx"; ResultSet resultSet = null;//from ww w .ja va 2s. c om Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByGroupIdx = null; List<CFSecuritySecGroupMemberBuff> buffList = new LinkedList<CFSecuritySecGroupMemberBuff>(); try { stmtReadBuffByGroupIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".rd_secmembbygroupidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByGroupIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByGroupIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByGroupIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByGroupIdx.setLong(argIdx++, ClusterId); stmtReadBuffByGroupIdx.setInt(argIdx++, SecGroupId); stmtReadBuffByGroupIdx.execute(); resultSet = (ResultSet) stmtReadBuffByGroupIdx.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { CFSecuritySecGroupMemberBuff buff = unpackSecGroupMemberResultSetToBuff(resultSet); buffList.add(buff); } try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } catch (SQLException e) { } } int idx = 0; CFSecuritySecGroupMemberBuff[] retBuff = new CFSecuritySecGroupMemberBuff[buffList.size()]; Iterator<CFSecuritySecGroupMemberBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } if (stmtReadBuffByGroupIdx != null) { try { stmtReadBuffByGroupIdx.close(); } catch (SQLException e) { } stmtReadBuffByGroupIdx = null; } } }
From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswOracle.CFFswOracleDomainBaseTable.java
public void deleteDomainBase(CFFswAuthorization Authorization, CFFswDomainBaseBuff Buff) { final String S_ProcName = "deleteDomainBase"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try {//w w w . j a v a 2 s .c o m long TenantId = Buff.getRequiredTenantId(); long Id = Buff.getRequiredId(); stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".dl_bdomdef( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); end;"); 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.setLong(argIdx++, TenantId); stmtDeleteByPKey.setLong(argIdx++, Id); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; stmtDeleteByPKey.execute(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtDeleteByPKey != null) { try { stmtDeleteByPKey.close(); } catch (SQLException e) { } stmtDeleteByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstOracle.CFAstOracleSecSessionTable.java
public void deleteSecSession(CFAstAuthorization Authorization, CFAstSecSessionBuff Buff) { final String S_ProcName = "deleteSecSession"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try {/* w w w . java 2 s .c o m*/ UUID SecSessionId = Buff.getRequiredSecSessionId(); stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".dl_secsess( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); 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.setString(argIdx++, SecSessionId.toString()); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; stmtDeleteByPKey.execute(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtDeleteByPKey != null) { try { stmtDeleteByPKey.close(); } catch (SQLException e) { } stmtDeleteByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleTSecGroupMemberTable.java
public CFSecurityTSecGroupMemberBuff[] readBuffByGroupIdx(CFSecurityAuthorization Authorization, long TenantId, int TSecGroupId) { final String S_ProcName = "readBuffByGroupIdx"; ResultSet resultSet = null;//from w w w. j av a 2s . c om Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByGroupIdx = null; List<CFSecurityTSecGroupMemberBuff> buffList = new LinkedList<CFSecurityTSecGroupMemberBuff>(); try { stmtReadBuffByGroupIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".rd_tsecmembbygroupidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByGroupIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByGroupIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByGroupIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByGroupIdx.setLong(argIdx++, TenantId); stmtReadBuffByGroupIdx.setInt(argIdx++, TSecGroupId); stmtReadBuffByGroupIdx.execute(); resultSet = (ResultSet) stmtReadBuffByGroupIdx.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { CFSecurityTSecGroupMemberBuff buff = unpackTSecGroupMemberResultSetToBuff(resultSet); buffList.add(buff); } try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } catch (SQLException e) { } } int idx = 0; CFSecurityTSecGroupMemberBuff[] retBuff = new CFSecurityTSecGroupMemberBuff[buffList.size()]; Iterator<CFSecurityTSecGroupMemberBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } if (stmtReadBuffByGroupIdx != null) { try { stmtReadBuffByGroupIdx.close(); } catch (SQLException e) { } stmtReadBuffByGroupIdx = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleSecFormTable.java
public void createSecForm(CFSecurityAuthorization Authorization, CFSecuritySecFormBuff Buff) { final String S_ProcName = "createSecForm"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }//from ww w. java 2 s . c o m ResultSet resultSet = null; CallableStatement stmtCreateByPKey = null; try { long ClusterId = Buff.getRequiredClusterId(); int SecAppId = Buff.getRequiredSecAppId(); String JEEServletMapName = Buff.getRequiredJEEServletMapName(); Connection cnx = schema.getCnx(); stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".crt_secform( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtCreateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtCreateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtCreateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtCreateByPKey.setString(argIdx++, "SFRM"); stmtCreateByPKey.setLong(argIdx++, ClusterId); stmtCreateByPKey.setInt(argIdx++, SecAppId); stmtCreateByPKey.setString(argIdx++, JEEServletMapName); stmtCreateByPKey.execute(); resultSet = (ResultSet) stmtCreateByPKey.getObject(1); if (resultSet == null) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "crt_secform() did not return a result set"); } try { if (resultSet.next()) { CFSecuritySecFormBuff createdBuff = unpackSecFormResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredClusterId(createdBuff.getRequiredClusterId()); Buff.setRequiredSecFormId(createdBuff.getRequiredSecFormId()); Buff.setRequiredSecAppId(createdBuff.getRequiredSecAppId()); Buff.setRequiredJEEServletMapName(createdBuff.getRequiredJEEServletMapName()); Buff.setRequiredRevision(createdBuff.getRequiredRevision()); Buff.setCreatedByUserId(createdBuff.getCreatedByUserId()); Buff.setCreatedAt(createdBuff.getCreatedAt()); Buff.setUpdatedByUserId(createdBuff.getUpdatedByUserId()); Buff.setUpdatedAt(createdBuff.getUpdatedAt()); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "crt_secform() did not return a valid result set"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } if (stmtCreateByPKey != null) { try { stmtCreateByPKey.close(); } catch (SQLException e) { } stmtCreateByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleISOCountryCurrencyTable.java
public void updateISOCountryCurrency(CFEnSyntaxAuthorization Authorization, CFEnSyntaxISOCountryCurrencyBuff Buff) { final String S_ProcName = "updateISOCountryCurrency"; ResultSet resultSet = null;//from w w w . ja v a 2 s. c o m Connection cnx = schema.getCnx(); CallableStatement stmtUpdateByPKey = null; List<CFEnSyntaxISOCountryCurrencyBuff> buffList = new LinkedList<CFEnSyntaxISOCountryCurrencyBuff>(); try { short ISOCountryId = Buff.getRequiredISOCountryId(); short ISOCurrencyId = Buff.getRequiredISOCurrencyId(); int Revision = Buff.getRequiredRevision(); stmtUpdateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".upd_iso_cntryccy( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "? ); end;"); int argIdx = 1; stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtUpdateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtUpdateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtUpdateByPKey.setString(argIdx++, "ICCY"); stmtUpdateByPKey.setShort(argIdx++, ISOCountryId); stmtUpdateByPKey.setShort(argIdx++, ISOCurrencyId); stmtUpdateByPKey.setInt(argIdx++, Revision); stmtUpdateByPKey.execute(); resultSet = (ResultSet) stmtUpdateByPKey.getObject(1); if (resultSet != null) { try { if (resultSet.next()) { CFEnSyntaxISOCountryCurrencyBuff updatedBuff = unpackISOCountryCurrencyResultSetToBuff( resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredRevision(updatedBuff.getRequiredRevision()); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "upd_iso_cntryccy() did not return a valid result cursor"); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "upd_iso_cntryccy() did not return a result cursor"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } if (stmtUpdateByPKey != null) { try { stmtUpdateByPKey.close(); } catch (SQLException e) { } stmtUpdateByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleISOCountryLanguageTable.java
public void updateISOCountryLanguage(CFEnSyntaxAuthorization Authorization, CFEnSyntaxISOCountryLanguageBuff Buff) { final String S_ProcName = "updateISOCountryLanguage"; ResultSet resultSet = null;/*from w w w. j a va 2 s . c o m*/ Connection cnx = schema.getCnx(); CallableStatement stmtUpdateByPKey = null; List<CFEnSyntaxISOCountryLanguageBuff> buffList = new LinkedList<CFEnSyntaxISOCountryLanguageBuff>(); try { short ISOCountryId = Buff.getRequiredISOCountryId(); short ISOLanguageId = Buff.getRequiredISOLanguageId(); int Revision = Buff.getRequiredRevision(); stmtUpdateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".upd_iso_cntrylng( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "? ); end;"); int argIdx = 1; stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtUpdateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtUpdateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtUpdateByPKey.setString(argIdx++, "ISCL"); stmtUpdateByPKey.setShort(argIdx++, ISOCountryId); stmtUpdateByPKey.setShort(argIdx++, ISOLanguageId); stmtUpdateByPKey.setInt(argIdx++, Revision); stmtUpdateByPKey.execute(); resultSet = (ResultSet) stmtUpdateByPKey.getObject(1); if (resultSet != null) { try { if (resultSet.next()) { CFEnSyntaxISOCountryLanguageBuff updatedBuff = unpackISOCountryLanguageResultSetToBuff( resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredRevision(updatedBuff.getRequiredRevision()); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "upd_iso_cntrylng() did not return a valid result cursor"); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "upd_iso_cntrylng() did not return a result cursor"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } if (stmtUpdateByPKey != null) { try { stmtUpdateByPKey.close(); } catch (SQLException e) { } stmtUpdateByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleSecGroupIncludeTable.java
public CFAccSecGroupIncludeBuff[] readBuffByGroupIdx(CFAccAuthorization Authorization, long ClusterId, int SecGroupId) { final String S_ProcName = "readBuffByGroupIdx"; ResultSet resultSet = null;/* ww w. j a va 2 s . co m*/ Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByGroupIdx = null; List<CFAccSecGroupIncludeBuff> buffList = new LinkedList<CFAccSecGroupIncludeBuff>(); try { stmtReadBuffByGroupIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName() + ".rd_secincbygroupidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByGroupIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByGroupIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByGroupIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByGroupIdx.setLong(argIdx++, ClusterId); stmtReadBuffByGroupIdx.setInt(argIdx++, SecGroupId); stmtReadBuffByGroupIdx.execute(); resultSet = (ResultSet) stmtReadBuffByGroupIdx.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { CFAccSecGroupIncludeBuff buff = unpackSecGroupIncludeResultSetToBuff(resultSet); buffList.add(buff); } try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } catch (SQLException e) { } } int idx = 0; CFAccSecGroupIncludeBuff[] retBuff = new CFAccSecGroupIncludeBuff[buffList.size()]; Iterator<CFAccSecGroupIncludeBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } if (stmtReadBuffByGroupIdx != null) { try { stmtReadBuffByGroupIdx.close(); } catch (SQLException e) { } stmtReadBuffByGroupIdx = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstOracle.CFAstOracleSecGroupIncludeTable.java
public CFAstSecGroupIncludeBuff[] readBuffByGroupIdx(CFAstAuthorization Authorization, long ClusterId, int SecGroupId) { final String S_ProcName = "readBuffByGroupIdx"; ResultSet resultSet = null;/*from w w w .ja v a2 s . c om*/ Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByGroupIdx = null; List<CFAstSecGroupIncludeBuff> buffList = new LinkedList<CFAstSecGroupIncludeBuff>(); try { stmtReadBuffByGroupIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName() + ".rd_secincbygroupidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByGroupIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByGroupIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByGroupIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByGroupIdx.setLong(argIdx++, ClusterId); stmtReadBuffByGroupIdx.setInt(argIdx++, SecGroupId); stmtReadBuffByGroupIdx.execute(); resultSet = (ResultSet) stmtReadBuffByGroupIdx.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { CFAstSecGroupIncludeBuff buff = unpackSecGroupIncludeResultSetToBuff(resultSet); buffList.add(buff); } try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } catch (SQLException e) { } } int idx = 0; CFAstSecGroupIncludeBuff[] retBuff = new CFAstSecGroupIncludeBuff[buffList.size()]; Iterator<CFAstSecGroupIncludeBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } if (stmtReadBuffByGroupIdx != null) { try { stmtReadBuffByGroupIdx.close(); } catch (SQLException e) { } stmtReadBuffByGroupIdx = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstOracle.CFAstOracleSecGroupIncludeTable.java
public CFAstSecGroupIncludeBuff[] readBuffByGroupIdx(CFAstAuthorization Authorization, long ClusterId, int SecGroupId) { final String S_ProcName = "readBuffByGroupIdx"; ResultSet resultSet = null;//from ww w . jav a2s . com Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByGroupIdx = null; List<CFAstSecGroupIncludeBuff> buffList = new LinkedList<CFAstSecGroupIncludeBuff>(); try { stmtReadBuffByGroupIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".rd_secincbygroupidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByGroupIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByGroupIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByGroupIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByGroupIdx.setLong(argIdx++, ClusterId); stmtReadBuffByGroupIdx.setInt(argIdx++, SecGroupId); stmtReadBuffByGroupIdx.execute(); resultSet = (ResultSet) stmtReadBuffByGroupIdx.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { CFAstSecGroupIncludeBuff buff = unpackSecGroupIncludeResultSetToBuff(resultSet); buffList.add(buff); } try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } catch (SQLException e) { } } int idx = 0; CFAstSecGroupIncludeBuff[] retBuff = new CFAstSecGroupIncludeBuff[buffList.size()]; Iterator<CFAstSecGroupIncludeBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } if (stmtReadBuffByGroupIdx != null) { try { stmtReadBuffByGroupIdx.close(); } catch (SQLException e) { } stmtReadBuffByGroupIdx = null; } } }