List of usage examples for java.sql Types BIGINT
int BIGINT
To view the source code for java.sql Types BIGINT.
Click Source Link
The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type BIGINT
.
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMySql.CFAccMySqlAccountEntryTable.java
public void updateAccountEntry(CFAccAuthorization Authorization, CFAccAccountEntryBuff Buff) { final String S_ProcName = "updateAccountEntry"; ResultSet resultSet = null;/* w w w. j a v a 2 s. com*/ try { long TenantId = Buff.getRequiredTenantId(); long AccountId = Buff.getRequiredAccountId(); UUID EntryId = Buff.getRequiredEntryId(); UUID SplitEntryId = Buff.getOptionalSplitEntryId(); Calendar EntryStamp = Buff.getRequiredEntryStamp(); String Description = Buff.getRequiredDescription(); Long TransferTenantId = Buff.getOptionalTransferTenantId(); Long TransferAccountId = Buff.getOptionalTransferAccountId(); Short DebitCurrencyId = Buff.getOptionalDebitCurrencyId(); BigDecimal Debit = Buff.getOptionalDebit(); Short CreditCurrencyId = Buff.getOptionalCreditCurrencyId(); BigDecimal Credit = Buff.getOptionalCredit(); short ConvertedCurrencyId = Buff.getRequiredConvertedCurrencyId(); BigDecimal ConvertedAmount = Buff.getRequiredConvertedAmount(); short BalanceCurrencyId = Buff.getRequiredBalanceCurrencyId(); BigDecimal Balance = Buff.getRequiredBalance(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerSchemaDbName() + ".sp_update_ac_entry( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "timestamp( ? )" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtUpdateByPKey == null) { stmtUpdateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; 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++, "ACNY"); stmtUpdateByPKey.setLong(argIdx++, TenantId); stmtUpdateByPKey.setLong(argIdx++, AccountId); stmtUpdateByPKey.setString(argIdx++, EntryId.toString()); if (SplitEntryId != null) { stmtUpdateByPKey.setString(argIdx++, SplitEntryId.toString()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } stmtUpdateByPKey.setString(argIdx++, CFAccMySqlSchema.getTimestampString(EntryStamp)); stmtUpdateByPKey.setString(argIdx++, Description); if (TransferTenantId != null) { stmtUpdateByPKey.setLong(argIdx++, TransferTenantId.longValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } if (TransferAccountId != null) { stmtUpdateByPKey.setLong(argIdx++, TransferAccountId.longValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } if (DebitCurrencyId != null) { stmtUpdateByPKey.setShort(argIdx++, DebitCurrencyId.shortValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } if (Debit != null) { stmtUpdateByPKey.setBigDecimal(argIdx++, Debit); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.NUMERIC); } if (CreditCurrencyId != null) { stmtUpdateByPKey.setShort(argIdx++, CreditCurrencyId.shortValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } if (Credit != null) { stmtUpdateByPKey.setBigDecimal(argIdx++, Credit); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.NUMERIC); } stmtUpdateByPKey.setShort(argIdx++, ConvertedCurrencyId); stmtUpdateByPKey.setBigDecimal(argIdx++, ConvertedAmount); stmtUpdateByPKey.setShort(argIdx++, BalanceCurrencyId); stmtUpdateByPKey.setBigDecimal(argIdx++, Balance); stmtUpdateByPKey.setInt(argIdx++, Revision); try { resultSet = stmtUpdateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFAccAccountEntryBuff updatedBuff = unpackAccountEntryResultSetToBuff(resultSet); if ((resultSet != null) && resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setOptionalSplitEntryId(updatedBuff.getOptionalSplitEntryId()); Buff.setRequiredEntryStamp(updatedBuff.getRequiredEntryStamp()); Buff.setRequiredDescription(updatedBuff.getRequiredDescription()); Buff.setOptionalTransferTenantId(updatedBuff.getOptionalTransferTenantId()); Buff.setOptionalTransferAccountId(updatedBuff.getOptionalTransferAccountId()); Buff.setOptionalDebitCurrencyId(updatedBuff.getOptionalDebitCurrencyId()); Buff.setOptionalDebit(updatedBuff.getOptionalDebit()); Buff.setOptionalCreditCurrencyId(updatedBuff.getOptionalCreditCurrencyId()); Buff.setOptionalCredit(updatedBuff.getOptionalCredit()); Buff.setRequiredConvertedCurrencyId(updatedBuff.getRequiredConvertedCurrencyId()); Buff.setRequiredConvertedAmount(updatedBuff.getRequiredConvertedAmount()); Buff.setRequiredBalanceCurrencyId(updatedBuff.getRequiredBalanceCurrencyId()); Buff.setRequiredBalance(updatedBuff.getRequiredBalance()); 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().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:edu.jhuapl.openessence.datasource.jdbc.entry.JdbcOeDataEntrySource.java
/** * Sets arguments of the proper type on a PreparedSatement * * @param pStmt prepared statement on which to set arguments * @param dimIds dimension ids that map to columns on the prepared statement * @param valueList values to set for the paramenters on the prepared statement * @param valueMap dimIds mapped to values to set for the paramenters on the prepared statement * @throws SQLException if error occurs while processing the prepared statement * @throws OeDataSourceException if error occurs converting value to it's sql type *//* ww w . j a v a 2 s . co m*/ protected void setArgumentsOnSqlType(PreparedStatement pStmt, List<String> dimIds, List<Object> valueList, Map<String, Object> valueMap) throws SQLException, OeDataSourceException { if ((valueList == null && valueMap == null) || (valueList != null && valueMap != null)) { throw new OeDataSourceException("Invalid value lists. Only one form of the list can be provided."); } int argCount = 0; Object val; boolean isValueList = (valueList != null); for (String dimId : dimIds) { Dimension dim = getEditDimension(dimId); FieldType sqlType = dim.getSqlType(); if (isValueList) { val = valueList.get(argCount); } else { val = valueMap.get(dimId); } try { argCount++; switch (sqlType) { case DATE_TIME: pStmt.setObject(argCount, DataTypeConversionHelper.convert2SqlTimestampType(val), Types.TIMESTAMP); continue; case DATE: pStmt.setObject(argCount, DataTypeConversionHelper.convert2SqlType(val), Types.DATE); continue; case BOOLEAN: pStmt.setObject(argCount, DataTypeConversionHelper.convert2SqlType(val), Types.BOOLEAN); continue; case FLOAT: pStmt.setObject(argCount, DataTypeConversionHelper.convert2SqlType(val), Types.FLOAT); continue; case DOUBLE: pStmt.setObject(argCount, DataTypeConversionHelper.convert2SqlType(val), Types.DOUBLE); continue; case INTEGER: pStmt.setObject(argCount, DataTypeConversionHelper.convert2SqlType(val), Types.INTEGER); continue; case LONG: pStmt.setObject(argCount, DataTypeConversionHelper.convert2SqlType(val), Types.BIGINT); continue; case TEXT: pStmt.setObject(argCount, DataTypeConversionHelper.convert2SqlType(val), Types.VARCHAR); continue; default: throw new AssertionError("Unexpected sqlType " + sqlType + "."); } } catch (OeDataSourceException e) { throw new SQLException("Error occured converting value \"" + val + "\" to its sql type.", e); } } }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnglishParseTable.java
public void updateEnglishParse(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnglishParseBuff Buff) { final String S_ProcName = "updateEnglishParse"; ResultSet resultSet = null;//w ww . j a va 2 s . c om Connection cnx = schema.getCnx(); CallableStatement stmtUpdateByPKey = null; List<CFEnSyntaxEnglishParseBuff> buffList = new LinkedList<CFEnSyntaxEnglishParseBuff>(); try { String ClassCode = Buff.getClassCode(); long Id = Buff.getRequiredId(); Long ScopeId = Buff.getOptionalScopeId(); String Name = Buff.getRequiredName(); int Revision = Buff.getRequiredRevision(); stmtUpdateByPKey = cnx .prepareCall("begin " + schema.getLowerDbSchemaName() + ".upd_enparse( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); 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++, ClassCode); stmtUpdateByPKey.setLong(argIdx++, Id); if (ScopeId != null) { stmtUpdateByPKey.setLong(argIdx++, ScopeId.longValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } stmtUpdateByPKey.setString(argIdx++, Name); stmtUpdateByPKey.setInt(argIdx++, Revision); stmtUpdateByPKey.execute(); resultSet = (ResultSet) stmtUpdateByPKey.getObject(1); if (resultSet != null) { try { if (resultSet.next()) { CFEnSyntaxEnglishParseBuff updatedBuff = unpackEnglishParseResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setOptionalScopeId(updatedBuff.getOptionalScopeId()); Buff.setRequiredName(updatedBuff.getRequiredName()); 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_enparse() 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_enparse() 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.CFEnSyntaxMySql.CFEnSyntaxMySqlEnglishParseTable.java
public void deleteEnglishParseByScopeIdx(CFEnSyntaxAuthorization Authorization, Long argScopeId) { final String S_ProcName = "deleteEnglishParseByScopeIdx"; ResultSet resultSet = null;/* www . ja v a2s.co m*/ try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_delete_enparse_by_scopeidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByScopeIdx == null) { stmtDeleteByScopeIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argScopeId != null) { stmtDeleteByScopeIdx.setLong(argIdx++, argScopeId.longValue()); } else { stmtDeleteByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT); } stmtDeleteByScopeIdx.executeUpdate(); } 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:axiom.objectmodel.db.NodeManager.java
/** * Create a new Node from a ResultSet.//from www . j a v a 2 s .com */ public Node createNode(DbMapping dbm, ResultSet rs, DbColumn[] columns, int offset) throws SQLException, IOException, ClassNotFoundException { HashMap propBuffer = new HashMap(); String id = null; String name = null; String protoName = dbm.getTypeName(); DbMapping dbmap = dbm; Node node = new Node(); for (int i = 0; i < columns.length; i++) { // set prototype? if (columns[i].isPrototypeField()) { protoName = rs.getString(i + 1 + offset); if (protoName != null) { dbmap = getDbMapping(protoName); if (dbmap == null) { // invalid prototype name! app.logError(ErrorReporter.errorMsg(this.getClass(), "createNode") + "Invalid prototype name: " + protoName + " - using default"); dbmap = dbm; protoName = dbmap.getTypeName(); } } } // set id? if (columns[i].isIdField()) { id = rs.getString(i + 1 + offset); // if id == null, the object doesn't actually exist - return null if (id == null) { return null; } } // set name? if (columns[i].isNameField()) { name = rs.getString(i + 1 + offset); } Property newprop = new Property(node); switch (columns[i].getType()) { case Types.BIT: newprop.setBooleanValue(rs.getBoolean(i + 1 + offset)); break; case Types.TINYINT: case Types.BIGINT: case Types.SMALLINT: case Types.INTEGER: newprop.setIntegerValue(rs.getLong(i + 1 + offset)); break; case Types.REAL: case Types.FLOAT: case Types.DOUBLE: newprop.setFloatValue(rs.getDouble(i + 1 + offset)); break; case Types.DECIMAL: case Types.NUMERIC: BigDecimal num = rs.getBigDecimal(i + 1 + offset); if (num == null) { break; } if (num.scale() > 0) { newprop.setFloatValue(num.doubleValue()); } else { newprop.setIntegerValue(num.longValue()); } break; case Types.VARBINARY: case Types.BINARY: // newprop.setStringValue(rs.getString(i+1+offset)); newprop.setJavaObjectValue(rs.getBytes(i + 1 + offset)); break; case Types.LONGVARBINARY: { InputStream in = rs.getBinaryStream(i + 1 + offset); if (in == null) { break; } ByteArrayOutputStream bout = new ByteArrayOutputStream(); byte[] buffer = new byte[2048]; int read; while ((read = in.read(buffer)) > -1) { bout.write(buffer, 0, read); } newprop.setJavaObjectValue(bout.toByteArray()); } break; case Types.LONGVARCHAR: try { newprop.setStringValue(rs.getString(i + 1 + offset)); } catch (SQLException x) { Reader in = rs.getCharacterStream(i + 1 + offset); char[] buffer = new char[2048]; int read = 0; int r; while ((r = in.read(buffer, read, buffer.length - read)) > -1) { read += r; if (read == buffer.length) { // grow input buffer char[] newBuffer = new char[buffer.length * 2]; System.arraycopy(buffer, 0, newBuffer, 0, buffer.length); buffer = newBuffer; } } newprop.setStringValue(new String(buffer, 0, read)); } break; case Types.CHAR: case Types.VARCHAR: case Types.OTHER: newprop.setStringValue(rs.getString(i + 1 + offset)); break; case Types.DATE: case Types.TIME: case Types.TIMESTAMP: newprop.setDateValue(rs.getTimestamp(i + 1 + offset)); break; case Types.NULL: newprop.setStringValue(null); break; case Types.CLOB: Clob cl = rs.getClob(i + 1 + offset); if (cl == null) { newprop.setStringValue(null); break; } char[] c = new char[(int) cl.length()]; Reader isr = cl.getCharacterStream(); isr.read(c); newprop.setStringValue(String.copyValueOf(c)); break; default: newprop.setStringValue(rs.getString(i + 1 + offset)); break; } if (rs.wasNull()) { newprop.setStringValue(null); } propBuffer.put(columns[i].getName(), newprop); // mark property as clean, since it's fresh from the db newprop.dirty = false; } if (id == null) { return null; } Hashtable propMap = new Hashtable(); DbColumn[] columns2 = dbmap.getColumns(); for (int i = 0; i < columns2.length; i++) { Relation rel = columns2[i].getRelation(); if (rel != null && (rel.reftype == Relation.PRIMITIVE || rel.reftype == Relation.REFERENCE)) { Property prop = (Property) propBuffer.get(columns2[i].getName()); if (prop == null) { continue; } prop.setName(rel.propName); // if the property is a pointer to another node, change the property type to NODE if ((rel.reftype == Relation.REFERENCE) && rel.usesPrimaryKey()) { // FIXME: References to anything other than the primary key are not supported prop.convertToNodeReference(rel.otherType, this.app.getCurrentRequestEvaluator().getLayer()); } propMap.put(rel.propName.toLowerCase(), prop); } } node.init(dbmap, id, name, protoName, propMap, safe); return node; }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnglishParseTable.java
public void deleteEnglishParseByUNameIdx(CFEnSyntaxAuthorization Authorization, Long argScopeId, String argName) {//from w w w .j ava 2 s . com final String S_ProcName = "deleteEnglishParseByUNameIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_delete_enparse_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()); if (argScopeId != null) { stmtDeleteByUNameIdx.setLong(argIdx++, argScopeId.longValue()); } else { stmtDeleteByUNameIdx.setNull(argIdx++, java.sql.Types.BIGINT); } stmtDeleteByUNameIdx.setString(argIdx++, argName); stmtDeleteByUNameIdx.executeUpdate(); } 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.CFAccOracle.CFAccOracleAccountEntryTable.java
public void updateAccountEntry(CFAccAuthorization Authorization, CFAccAccountEntryBuff Buff) { final String S_ProcName = "updateAccountEntry"; ResultSet resultSet = null;/* www . j av a 2 s. c o m*/ Connection cnx = schema.getCnx(); CallableStatement stmtUpdateByPKey = null; List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); try { long TenantId = Buff.getRequiredTenantId(); long AccountId = Buff.getRequiredAccountId(); UUID EntryId = Buff.getRequiredEntryId(); UUID SplitEntryId = Buff.getOptionalSplitEntryId(); Calendar EntryStamp = Buff.getRequiredEntryStamp(); String Description = Buff.getRequiredDescription(); Long TransferTenantId = Buff.getOptionalTransferTenantId(); Long TransferAccountId = Buff.getOptionalTransferAccountId(); Short DebitCurrencyId = Buff.getOptionalDebitCurrencyId(); BigDecimal Debit = Buff.getOptionalDebit(); Short CreditCurrencyId = Buff.getOptionalCreditCurrencyId(); BigDecimal Credit = Buff.getOptionalCredit(); short ConvertedCurrencyId = Buff.getRequiredConvertedCurrencyId(); BigDecimal ConvertedAmount = Buff.getRequiredConvertedAmount(); short BalanceCurrencyId = Buff.getRequiredBalanceCurrencyId(); BigDecimal Balance = Buff.getRequiredBalance(); int Revision = Buff.getRequiredRevision(); stmtUpdateByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName() + ".upd_ac_entry( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "to_timestamp( ?, 'YYYY-MM-DD HH24:MI:SS' )" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); 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++, "ACNY"); stmtUpdateByPKey.setLong(argIdx++, TenantId); stmtUpdateByPKey.setLong(argIdx++, AccountId); stmtUpdateByPKey.setString(argIdx++, EntryId.toString()); if (SplitEntryId != null) { stmtUpdateByPKey.setString(argIdx++, SplitEntryId.toString()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } stmtUpdateByPKey.setString(argIdx++, CFAccOracleSchema.getTimestampString(EntryStamp)); stmtUpdateByPKey.setString(argIdx++, Description); if (TransferTenantId != null) { stmtUpdateByPKey.setLong(argIdx++, TransferTenantId.longValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } if (TransferAccountId != null) { stmtUpdateByPKey.setLong(argIdx++, TransferAccountId.longValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } if (DebitCurrencyId != null) { stmtUpdateByPKey.setShort(argIdx++, DebitCurrencyId.shortValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } if (Debit != null) { stmtUpdateByPKey.setBigDecimal(argIdx++, Debit); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.NUMERIC); } if (CreditCurrencyId != null) { stmtUpdateByPKey.setShort(argIdx++, CreditCurrencyId.shortValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } if (Credit != null) { stmtUpdateByPKey.setBigDecimal(argIdx++, Credit); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.NUMERIC); } stmtUpdateByPKey.setShort(argIdx++, ConvertedCurrencyId); stmtUpdateByPKey.setBigDecimal(argIdx++, ConvertedAmount); stmtUpdateByPKey.setShort(argIdx++, BalanceCurrencyId); stmtUpdateByPKey.setBigDecimal(argIdx++, Balance); stmtUpdateByPKey.setInt(argIdx++, Revision); stmtUpdateByPKey.execute(); resultSet = (ResultSet) stmtUpdateByPKey.getObject(1); if (resultSet != null) { try { if (resultSet.next()) { CFAccAccountEntryBuff updatedBuff = unpackAccountEntryResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setOptionalSplitEntryId(updatedBuff.getOptionalSplitEntryId()); Buff.setRequiredEntryStamp(updatedBuff.getRequiredEntryStamp()); Buff.setRequiredDescription(updatedBuff.getRequiredDescription()); Buff.setOptionalTransferTenantId(updatedBuff.getOptionalTransferTenantId()); Buff.setOptionalTransferAccountId(updatedBuff.getOptionalTransferAccountId()); Buff.setOptionalDebitCurrencyId(updatedBuff.getOptionalDebitCurrencyId()); Buff.setOptionalDebit(updatedBuff.getOptionalDebit()); Buff.setOptionalCreditCurrencyId(updatedBuff.getOptionalCreditCurrencyId()); Buff.setOptionalCredit(updatedBuff.getOptionalCredit()); Buff.setRequiredConvertedCurrencyId(updatedBuff.getRequiredConvertedCurrencyId()); Buff.setRequiredConvertedAmount(updatedBuff.getRequiredConvertedAmount()); Buff.setRequiredBalanceCurrencyId(updatedBuff.getRequiredBalanceCurrencyId()); Buff.setRequiredBalance(updatedBuff.getRequiredBalance()); 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_ac_entry() 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_ac_entry() 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.CFEnSyntaxOracleEnglishParseTable.java
public void deleteEnglishParseByScopeIdx(CFEnSyntaxAuthorization Authorization, Long argScopeId) { final String S_ProcName = "deleteEnglishParseByScopeIdx"; ResultSet resultSet = null;/*w ww. j a v a 2 s . c o m*/ try { Connection cnx = schema.getCnx(); String sql = "begin call " + schema.getLowerDbSchemaName() + ".dl_enparsebyscopeidx( ?, ?, ?, ?, ?" + ", " + "?" + " ); end"; if (stmtDeleteByScopeIdx == null) { stmtDeleteByScopeIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argScopeId != null) { stmtDeleteByScopeIdx.setLong(argIdx++, argScopeId.longValue()); } else { stmtDeleteByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT); } int rowsUpdated = stmtDeleteByScopeIdx.executeUpdate(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }