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.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnDeterminerTable.java
public void deleteEnDeterminer(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnDeterminerBuff Buff) { final String S_ProcName = "deleteEnDeterminer"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try {// w w w.j av a 2 s . c om long Id = Buff.getRequiredId(); stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".dl_endeter( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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++, 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.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnIntensifierTable.java
public CFEnSyntaxEnIntensifierBuff readBuffByUNameIdx(CFEnSyntaxAuthorization Authorization, Long ScopeId, String Name) {/* ww w . j a va 2 s . com*/ final String S_ProcName = "readBuffByUNameIdx"; ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByUNameIdx = null; try { stmtReadBuffByUNameIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".rd_enintensbyunameidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByUNameIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); 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()); if (ScopeId != null) { stmtReadBuffByUNameIdx.setLong(argIdx++, ScopeId.longValue()); } else { stmtReadBuffByUNameIdx.setNull(argIdx++, java.sql.Types.BIGINT); } stmtReadBuffByUNameIdx.setString(argIdx++, Name); stmtReadBuffByUNameIdx.execute(); resultSet = (ResultSet) stmtReadBuffByUNameIdx.getObject(1); if (resultSet == null) { return (null); } try { if (resultSet.next()) { CFEnSyntaxEnIntensifierBuff buff = unpackEnIntensifierResultSetToBuff(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 (stmtReadBuffByUNameIdx != null) { try { stmtReadBuffByUNameIdx.close(); } catch (SQLException e) { } stmtReadBuffByUNameIdx = null; } } }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnPrepositionTable.java
public CFEnSyntaxEnPrepositionBuff readBuffByUNameIdx(CFEnSyntaxAuthorization Authorization, Long ScopeId, String Name) {/*from w ww.j a va 2s . c o m*/ final String S_ProcName = "readBuffByUNameIdx"; ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByUNameIdx = null; try { stmtReadBuffByUNameIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".rd_enprepbyunameidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByUNameIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); 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()); if (ScopeId != null) { stmtReadBuffByUNameIdx.setLong(argIdx++, ScopeId.longValue()); } else { stmtReadBuffByUNameIdx.setNull(argIdx++, java.sql.Types.BIGINT); } stmtReadBuffByUNameIdx.setString(argIdx++, Name); stmtReadBuffByUNameIdx.execute(); resultSet = (ResultSet) stmtReadBuffByUNameIdx.getObject(1); if (resultSet == null) { return (null); } try { if (resultSet.next()) { CFEnSyntaxEnPrepositionBuff buff = unpackEnPrepositionResultSetToBuff(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 (stmtReadBuffByUNameIdx != null) { try { stmtReadBuffByUNameIdx.close(); } catch (SQLException e) { } stmtReadBuffByUNameIdx = null; } } }
From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswOracle.CFFswOracleISOCurrencyTable.java
public void createISOCurrency(CFFswAuthorization Authorization, CFFswISOCurrencyBuff Buff) { final String S_ProcName = "createISOCurrency"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }//from ww w. j a v a 2 s. co m ResultSet resultSet = null; CallableStatement stmtCreateByPKey = null; try { short Id = Buff.getRequiredId(); String ISOCode = Buff.getRequiredISOCode(); String Name = Buff.getRequiredName(); String UnitSymbol = Buff.getOptionalUnitSymbol(); String FracSymbol = Buff.getOptionalFracSymbol(); short Precis = Buff.getRequiredPrecis(); Connection cnx = schema.getCnx(); stmtCreateByPKey = cnx.prepareCall( "begin " + schema.getLowerDbSchemaName() + ".crt_iso_ccy( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); 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++, "ISCY"); stmtCreateByPKey.setShort(argIdx++, Id); stmtCreateByPKey.setString(argIdx++, ISOCode); stmtCreateByPKey.setString(argIdx++, Name); if (UnitSymbol != null) { stmtCreateByPKey.setString(argIdx++, UnitSymbol); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (FracSymbol != null) { stmtCreateByPKey.setString(argIdx++, FracSymbol); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } stmtCreateByPKey.setShort(argIdx++, Precis); stmtCreateByPKey.execute(); resultSet = (ResultSet) stmtCreateByPKey.getObject(1); if (resultSet == null) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "crt_iso_ccy() did not return a result set"); } try { if (resultSet.next()) { CFFswISOCurrencyBuff createdBuff = unpackISOCurrencyResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredId(createdBuff.getRequiredId()); Buff.setRequiredISOCode(createdBuff.getRequiredISOCode()); Buff.setRequiredName(createdBuff.getRequiredName()); Buff.setOptionalUnitSymbol(createdBuff.getOptionalUnitSymbol()); Buff.setOptionalFracSymbol(createdBuff.getOptionalFracSymbol()); Buff.setRequiredPrecis(createdBuff.getRequiredPrecis()); 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_iso_ccy() 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.CFEnSyntaxOracleEnIntensifierTable.java
public void deleteEnIntensifier(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnIntensifierBuff Buff) { final String S_ProcName = "deleteEnIntensifier"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try {// www . j a v a 2s . c o m long Id = Buff.getRequiredId(); stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".dl_enintens( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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++, 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.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnPrepositionTable.java
public void deleteEnPreposition(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnPrepositionBuff Buff) { final String S_ProcName = "deleteEnPreposition"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try {/*from w w w . ja v a 2 s . c om*/ long Id = Buff.getRequiredId(); stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".dl_enprep( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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++, 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; } } }