List of usage examples for java.sql Connection prepareCall
CallableStatement prepareCall(String sql) throws SQLException;
CallableStatement
object for calling database stored procedures. From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleAuditActionTable.java
public CFSecurityAuditActionBuff readBuff(CFSecurityAuthorization Authorization, CFSecurityAuditActionPKey PKey) { final String S_ProcName = "readBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/* ww w .j a va 2 s . c o m*/ ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByPKey = null; try { short AuditActionId = PKey.getRequiredAuditActionId(); stmtReadBuffByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".rd_auditaction( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR); 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++, AuditActionId); stmtReadBuffByPKey.execute(); resultSet = (ResultSet) stmtReadBuffByPKey.getObject(1); if (resultSet == null) { return (null); } try { if (resultSet.next()) { CFSecurityAuditActionBuff buff = unpackAuditActionResultSetToBuff(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) { 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; } if (stmtReadBuffByPKey != null) { try { stmtReadBuffByPKey.close(); } catch (SQLException e) { } stmtReadBuffByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleAuditActionTable.java
public CFSecurityAuditActionBuff lockBuff(CFSecurityAuthorization Authorization, CFSecurityAuditActionPKey PKey) { final String S_ProcName = "lockBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*from w w w . jav a 2s . c om*/ ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtLockBuffByPKey = null; try { short AuditActionId = PKey.getRequiredAuditActionId(); stmtLockBuffByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".lck_auditaction( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtLockBuffByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR); 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++, AuditActionId); stmtLockBuffByPKey.execute(); resultSet = (ResultSet) stmtLockBuffByPKey.getObject(1); if (resultSet == null) { return (null); } try { if (resultSet.next()) { CFSecurityAuditActionBuff buff = unpackAuditActionResultSetToBuff(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) { 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; } if (stmtLockBuffByPKey != null) { try { stmtLockBuffByPKey.close(); } catch (SQLException e) { } stmtLockBuffByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleServiceTypeTable.java
public void deleteServiceType(CFSecurityAuthorization Authorization, CFSecurityServiceTypeBuff Buff) { final String S_ProcName = "deleteServiceType"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try {//ww w. j a v a 2s .co m int ServiceTypeId = Buff.getRequiredServiceTypeId(); stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".dl_svctype( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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.setInt(argIdx++, ServiceTypeId); 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.CFAsteriskOracleSysClusterTable.java
public CFSecuritySysClusterBuff readBuff(CFSecurityAuthorization Authorization, CFSecuritySysClusterPKey PKey) { final String S_ProcName = "readBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*from w ww .j a v a 2s . c o m*/ ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByPKey = null; try { int SingletonId = PKey.getRequiredSingletonId(); stmtReadBuffByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".rd_sysclus( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR); 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++, SingletonId); stmtReadBuffByPKey.execute(); resultSet = (ResultSet) stmtReadBuffByPKey.getObject(1); if (resultSet == null) { return (null); } try { if (resultSet.next()) { CFSecuritySysClusterBuff buff = unpackSysClusterResultSetToBuff(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) { 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; } if (stmtReadBuffByPKey != null) { try { stmtReadBuffByPKey.close(); } catch (SQLException e) { } stmtReadBuffByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleSysClusterTable.java
public CFSecuritySysClusterBuff lockBuff(CFSecurityAuthorization Authorization, CFSecuritySysClusterPKey PKey) { final String S_ProcName = "lockBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }//w ww . j a v a 2s . c om ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtLockBuffByPKey = null; try { int SingletonId = PKey.getRequiredSingletonId(); stmtLockBuffByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".lck_sysclus( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtLockBuffByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR); 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++, SingletonId); stmtLockBuffByPKey.execute(); resultSet = (ResultSet) stmtLockBuffByPKey.getObject(1); if (resultSet == null) { return (null); } try { if (resultSet.next()) { CFSecuritySysClusterBuff buff = unpackSysClusterResultSetToBuff(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) { 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; } if (stmtLockBuffByPKey != null) { try { stmtLockBuffByPKey.close(); } catch (SQLException e) { } stmtLockBuffByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleSecUserTable.java
public void deleteSecUser(CFAccAuthorization Authorization, CFAccSecUserBuff Buff) { final String S_ProcName = "deleteSecUser"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try {/*from w w w .j a v a2 s .c om*/ UUID SecUserId = Buff.getRequiredSecUserId(); stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName() + ".dl_secuser( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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++, SecUserId.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_0.CFAstOracle.CFAstOracleSecUserTable.java
public void deleteSecUser(CFAstAuthorization Authorization, CFAstSecUserBuff Buff) { final String S_ProcName = "deleteSecUser"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try {// w ww . jav a 2s. c o m UUID SecUserId = Buff.getRequiredSecUserId(); stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName() + ".dl_secuser( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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++, SecUserId.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.cfacc.v2_0.CFAccOracle.CFAccOracleAuditActionTable.java
public CFAccAuditActionBuff readBuff(CFAccAuthorization Authorization, CFAccAuditActionPKey PKey) { final String S_ProcName = "readBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }// w ww. j av a 2 s .c o m ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByPKey = null; try { short AuditActionId = PKey.getRequiredAuditActionId(); stmtReadBuffByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName() + ".rd_auditaction( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR); 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++, AuditActionId); stmtReadBuffByPKey.execute(); resultSet = (ResultSet) stmtReadBuffByPKey.getObject(1); if (resultSet == null) { return (null); } try { if (resultSet.next()) { CFAccAuditActionBuff buff = unpackAuditActionResultSetToBuff(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) { 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; } if (stmtReadBuffByPKey != null) { try { stmtReadBuffByPKey.close(); } catch (SQLException e) { } stmtReadBuffByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleAuditActionTable.java
public CFAccAuditActionBuff lockBuff(CFAccAuthorization Authorization, CFAccAuditActionPKey PKey) { final String S_ProcName = "lockBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*w w w. j ava 2 s . c om*/ ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtLockBuffByPKey = null; try { short AuditActionId = PKey.getRequiredAuditActionId(); stmtLockBuffByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName() + ".lck_auditaction( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtLockBuffByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR); 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++, AuditActionId); stmtLockBuffByPKey.execute(); resultSet = (ResultSet) stmtLockBuffByPKey.getObject(1); if (resultSet == null) { return (null); } try { if (resultSet.next()) { CFAccAuditActionBuff buff = unpackAuditActionResultSetToBuff(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) { 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; } if (stmtLockBuffByPKey != null) { try { stmtLockBuffByPKey.close(); } catch (SQLException e) { } stmtLockBuffByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstOracle.CFAstOracleAuditActionTable.java
public CFAstAuditActionBuff readBuff(CFAstAuthorization Authorization, CFAstAuditActionPKey PKey) { final String S_ProcName = "readBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*from w w w.ja v a 2s.c o m*/ ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByPKey = null; try { short AuditActionId = PKey.getRequiredAuditActionId(); stmtReadBuffByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName() + ".rd_auditaction( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR); 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++, AuditActionId); stmtReadBuffByPKey.execute(); resultSet = (ResultSet) stmtReadBuffByPKey.getObject(1); if (resultSet == null) { return (null); } try { if (resultSet.next()) { CFAstAuditActionBuff buff = unpackAuditActionResultSetToBuff(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) { 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; } if (stmtReadBuffByPKey != null) { try { stmtReadBuffByPKey.close(); } catch (SQLException e) { } stmtReadBuffByPKey = null; } } }