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:com.mtgi.analytics.JdbcBehaviorEventPersisterImpl.java
public void persist(final Queue<BehaviorEvent> events) { getJdbcTemplate().execute(new ConnectionCallback() { public Object doInConnection(Connection con) throws SQLException, DataAccessException { //if this connection is behavior tracking, suspend tracking. //we don't generate more events while persisting. BehaviorTrackingConnectionProxy bt = null; for (Connection c = con; bt == null && c instanceof ConnectionProxy; c = ((ConnectionProxy) c).getTargetConnection()) { if (c instanceof BehaviorTrackingConnectionProxy) { bt = (BehaviorTrackingConnectionProxy) c; bt.suspendTracking(); }//from w w w.j a va 2s . c om } try { boolean doBatch = supportsBatchUpdates(con); EventDataElementSerializer dataSerializer = new EventDataElementSerializer(xmlFactory); PreparedStatement[] idStmt = { null }; PreparedStatement insert = con.prepareStatement(insertSql); try { //keep track of statements added to the batch so that we can time our //flushes. int batchCount = 0; for (BehaviorEvent next : events) { //event may already have an ID assigned if any //of its child events has been persisted. assignIds(next, con, idStmt); //populate identifying information for the event into the insert statement. insert.setLong(1, (Long) next.getId()); BehaviorEvent parent = next.getParent(); nullSafeSet(insert, 2, parent == null ? null : parent.getId(), Types.BIGINT); insert.setString(3, next.getApplication()); insert.setString(4, next.getType()); insert.setString(5, next.getName()); insert.setTimestamp(6, new java.sql.Timestamp(next.getStart().getTime())); insert.setLong(7, next.getDurationNs()); //set optional context information on the event. nullSafeSet(insert, 8, next.getUserId(), Types.VARCHAR); nullSafeSet(insert, 9, next.getSessionId(), Types.VARCHAR); nullSafeSet(insert, 10, next.getError(), Types.VARCHAR); //convert event data to XML String data = dataSerializer.serialize(next.getData(), true); nullSafeSet(insert, 11, data, Types.VARCHAR); if (doBatch) { insert.addBatch(); if (++batchCount >= batchSize) { insert.executeBatch(); batchCount = 0; } } else { insert.executeUpdate(); } } //flush any lingering batch inserts through to the server. if (batchCount > 0) insert.executeBatch(); } finally { closeStatement(insert); closeStatement(idStmt[0]); } return null; } finally { if (bt != null) bt.resumeTracking(); } } }); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseTenantTable.java
public long nextTSecGroupMemberIdGen(CFAstAuthorization Authorization, CFAstTenantPKey PKey) { final String S_ProcName = "nextTSecGroupMemberIdGen"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Not in a transaction"); }// w w w. j ava 2s . co m Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); CallableStatement stmtSelectNextTSecGroupMemberIdGen = null; try { String sql = "{ call sp_next_tsecgroupmemberidgen( ?" + ", " + "?" + " ) }"; stmtSelectNextTSecGroupMemberIdGen = cnx.prepareCall(sql); int argIdx = 1; stmtSelectNextTSecGroupMemberIdGen.registerOutParameter(argIdx++, java.sql.Types.BIGINT); stmtSelectNextTSecGroupMemberIdGen.setLong(argIdx++, Id); stmtSelectNextTSecGroupMemberIdGen.execute(); long nextId = stmtSelectNextTSecGroupMemberIdGen.getLong(1); return (nextId); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtSelectNextTSecGroupMemberIdGen != null) { try { stmtSelectNextTSecGroupMemberIdGen.close(); } catch (SQLException e) { } stmtSelectNextTSecGroupMemberIdGen = null; } } }
From source file:net.riezebos.thoth.configuration.persistence.dbs.DDLExecuter.java
private void initDialect(DatabaseIdiom idiom) { databaseIdiom = idiom;/*from w w w . java2 s. c o m*/ try { addTranslation("bigint", idiom.getTypeName(Types.BIGINT)); addTranslation("binary", idiom.getTypeName(Types.BINARY)); addTranslation("bit", idiom.getTypeName(Types.BIT)); addTranslation("blob", idiom.getTypeName(Types.BLOB)); addTranslation("boolean", idiom.getTypeName(Types.BOOLEAN)); addTranslation("char", idiom.getTypeName(Types.CHAR)); addTranslation("clob", idiom.getTypeName(Types.CLOB)); addTranslation("date", idiom.getTypeName(Types.DATE)); addTranslation("decimal", idiom.getTypeName(Types.DECIMAL)); addTranslation("double", idiom.getTypeName(Types.DOUBLE)); addTranslation("float", idiom.getTypeName(Types.FLOAT)); addTranslation("integer", idiom.getTypeName(Types.INTEGER)); addTranslation("longnvarchar", idiom.getTypeName(Types.LONGNVARCHAR)); addTranslation("longvarbinary", idiom.getTypeName(Types.LONGVARBINARY)); addTranslation("longvarchar", idiom.getTypeName(Types.LONGVARCHAR)); addTranslation("nchar", idiom.getTypeName(Types.NCHAR)); addTranslation("nclob", idiom.getTypeName(Types.NCLOB)); addTranslation("numeric", idiom.getTypeName(Types.NUMERIC)); addTranslation("nvarchar", idiom.getTypeName(Types.NVARCHAR)); addTranslation("real", idiom.getTypeName(Types.REAL)); addTranslation("smallint", idiom.getTypeName(Types.SMALLINT)); addTranslation("time", idiom.getTypeName(Types.TIME)); addTranslation("timestamp", idiom.getTypeName(Types.TIMESTAMP)); addTranslation("tinyint", idiom.getTypeName(Types.TINYINT)); addTranslation("varbinary", idiom.getTypeName(Types.VARBINARY)); databaseIdiom.initDialect(translations, workarounds); // Ignore autogenerated ID's addWorkaround("generated always as identity", ""); } catch (Exception e) { throw new IllegalArgumentException(e); } }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnglishParseTable.java
public void createEnglishParse(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnglishParseBuff Buff) { final String S_ProcName = "createEnglishParse"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/* w w w .j a v a 2 s .c o m*/ ResultSet resultSet = null; try { String ClassCode = Buff.getClassCode(); Long ScopeId = Buff.getOptionalScopeId(); String Name = Buff.getRequiredName(); Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_create_enparse( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )"; if (stmtCreateByPKey == null) { stmtCreateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); 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++, ClassCode); if (ScopeId != null) { stmtCreateByPKey.setLong(argIdx++, ScopeId.longValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } stmtCreateByPKey.setString(argIdx++, Name); try { resultSet = stmtCreateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFEnSyntaxEnglishParseBuff createdBuff = unpackEnglishParseResultSetToBuff(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.setRequiredId(createdBuff.getRequiredId()); Buff.setOptionalScopeId(createdBuff.getOptionalScopeId()); Buff.setRequiredName(createdBuff.getRequiredName()); Buff.setRequiredRevision(createdBuff.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:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWAccountTable.java
public void createAccount(CFAccAuthorization Authorization, CFAccAccountBuff Buff) { final String S_ProcName = "createAccount"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/* www .ja v a 2 s. c om*/ ResultSet resultSet = null; try { long TenantId = Buff.getRequiredTenantId(); String AccountCode = Buff.getRequiredAccountCode(); String Description = Buff.getRequiredDescription(); short CurrencyId = Buff.getRequiredCurrencyId(); BigDecimal Balance = Buff.getRequiredBalance(); Long RollupTenantId = Buff.getOptionalRollupTenantId(); Long RollupAccountId = Buff.getOptionalRollupAccountId(); Connection cnx = schema.getCnx(); final String sql = "CALL sp_create_acct( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtCreateByPKey == null) { stmtCreateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; 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++, "ACCT"); stmtCreateByPKey.setLong(argIdx++, TenantId); stmtCreateByPKey.setString(argIdx++, AccountCode); stmtCreateByPKey.setString(argIdx++, Description); stmtCreateByPKey.setShort(argIdx++, CurrencyId); stmtCreateByPKey.setBigDecimal(argIdx++, Balance); if (RollupTenantId != null) { stmtCreateByPKey.setLong(argIdx++, RollupTenantId.longValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } if (RollupAccountId != null) { stmtCreateByPKey.setLong(argIdx++, RollupAccountId.longValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } resultSet = stmtCreateByPKey.executeQuery(); if (resultSet.next()) { CFAccAccountBuff createdBuff = unpackAccountResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredTenantId(createdBuff.getRequiredTenantId()); Buff.setRequiredId(createdBuff.getRequiredId()); Buff.setRequiredAccountCode(createdBuff.getRequiredAccountCode()); Buff.setRequiredDescription(createdBuff.getRequiredDescription()); Buff.setRequiredCurrencyId(createdBuff.getRequiredCurrencyId()); Buff.setRequiredBalance(createdBuff.getRequiredBalance()); Buff.setOptionalRollupTenantId(createdBuff.getOptionalRollupTenantId()); Buff.setOptionalRollupAccountId(createdBuff.getOptionalRollupAccountId()); 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().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.CFAccMySql.CFAccMySqlAccountTable.java
public void createAccount(CFAccAuthorization Authorization, CFAccAccountBuff Buff) { final String S_ProcName = "createAccount"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*ww w .j ava 2s. c o m*/ ResultSet resultSet = null; try { long TenantId = Buff.getRequiredTenantId(); String AccountCode = Buff.getRequiredAccountCode(); String Description = Buff.getRequiredDescription(); short CurrencyId = Buff.getRequiredCurrencyId(); BigDecimal Balance = Buff.getRequiredBalance(); Long RollupTenantId = Buff.getOptionalRollupTenantId(); Long RollupAccountId = Buff.getOptionalRollupAccountId(); Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerSchemaDbName() + ".sp_create_acct( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtCreateByPKey == null) { stmtCreateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); 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++, "ACCT"); stmtCreateByPKey.setLong(argIdx++, TenantId); stmtCreateByPKey.setString(argIdx++, AccountCode); stmtCreateByPKey.setString(argIdx++, Description); stmtCreateByPKey.setShort(argIdx++, CurrencyId); stmtCreateByPKey.setBigDecimal(argIdx++, Balance); if (RollupTenantId != null) { stmtCreateByPKey.setLong(argIdx++, RollupTenantId.longValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } if (RollupAccountId != null) { stmtCreateByPKey.setLong(argIdx++, RollupAccountId.longValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } try { resultSet = stmtCreateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFAccAccountBuff createdBuff = unpackAccountResultSetToBuff(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.setRequiredTenantId(createdBuff.getRequiredTenantId()); Buff.setRequiredId(createdBuff.getRequiredId()); Buff.setRequiredAccountCode(createdBuff.getRequiredAccountCode()); Buff.setRequiredDescription(createdBuff.getRequiredDescription()); Buff.setRequiredCurrencyId(createdBuff.getRequiredCurrencyId()); Buff.setRequiredBalance(createdBuff.getRequiredBalance()); Buff.setOptionalRollupTenantId(createdBuff.getOptionalRollupTenantId()); Buff.setOptionalRollupAccountId(createdBuff.getOptionalRollupAccountId()); 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().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.CFAccMSSql.CFAccMSSqlAccountTable.java
public void createAccount(CFAccAuthorization Authorization, CFAccAccountBuff Buff) { final String S_ProcName = "createAccount"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }// w ww . j av a 2s .co m ResultSet resultSet = null; try { long TenantId = Buff.getRequiredTenantId(); String AccountCode = Buff.getRequiredAccountCode(); String Description = Buff.getRequiredDescription(); short CurrencyId = Buff.getRequiredCurrencyId(); BigDecimal Balance = Buff.getRequiredBalance(); Long RollupTenantId = Buff.getOptionalRollupTenantId(); Long RollupAccountId = Buff.getOptionalRollupAccountId(); Connection cnx = schema.getCnx(); String sql = "exec sp_create_acct ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"; if (stmtCreateByPKey == null) { stmtCreateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; 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++, "ACCT"); stmtCreateByPKey.setLong(argIdx++, TenantId); stmtCreateByPKey.setString(argIdx++, AccountCode); stmtCreateByPKey.setString(argIdx++, Description); stmtCreateByPKey.setShort(argIdx++, CurrencyId); stmtCreateByPKey.setBigDecimal(argIdx++, Balance); if (RollupTenantId != null) { stmtCreateByPKey.setLong(argIdx++, RollupTenantId.longValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } if (RollupAccountId != null) { stmtCreateByPKey.setLong(argIdx++, RollupAccountId.longValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } stmtCreateByPKey.execute(); boolean moreResults = true; resultSet = null; while (resultSet == null) { try { moreResults = stmtCreateByPKey.getMoreResults(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } if (moreResults) { try { resultSet = stmtCreateByPKey.getResultSet(); } catch (SQLException e) { } } else if (-1 == stmtCreateByPKey.getUpdateCount()) { break; } } if (resultSet == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "resultSet"); } if (resultSet.next()) { CFAccAccountBuff createdBuff = unpackAccountResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredTenantId(createdBuff.getRequiredTenantId()); Buff.setRequiredId(createdBuff.getRequiredId()); Buff.setRequiredAccountCode(createdBuff.getRequiredAccountCode()); Buff.setRequiredDescription(createdBuff.getRequiredDescription()); Buff.setRequiredCurrencyId(createdBuff.getRequiredCurrencyId()); Buff.setRequiredBalance(createdBuff.getRequiredBalance()); Buff.setOptionalRollupTenantId(createdBuff.getOptionalRollupTenantId()); Buff.setOptionalRollupAccountId(createdBuff.getOptionalRollupAccountId()); 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().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.CFAccPgSql.CFAccPgSqlAccountTable.java
public void createAccount(CFAccAuthorization Authorization, CFAccAccountBuff Buff) { final String S_ProcName = "createAccount"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/* w w w. j a v a 2 s.com*/ ResultSet resultSet = null; try { long TenantId = Buff.getRequiredTenantId(); String AccountCode = Buff.getRequiredAccountCode(); String Description = Buff.getRequiredDescription(); short CurrencyId = Buff.getRequiredCurrencyId(); BigDecimal Balance = Buff.getRequiredBalance(); Long RollupTenantId = Buff.getOptionalRollupTenantId(); Long RollupAccountId = Buff.getOptionalRollupAccountId(); Connection cnx = schema.getCnx(); String sql = "select * from " + schema.getLowerSchemaDbName() + ".sp_create_acct( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtCreateByPKey == null) { stmtCreateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; 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++, "ACCT"); stmtCreateByPKey.setLong(argIdx++, TenantId); stmtCreateByPKey.setString(argIdx++, AccountCode); stmtCreateByPKey.setString(argIdx++, Description); stmtCreateByPKey.setShort(argIdx++, CurrencyId); stmtCreateByPKey.setBigDecimal(argIdx++, Balance); if (RollupTenantId != null) { stmtCreateByPKey.setLong(argIdx++, RollupTenantId.longValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } if (RollupAccountId != null) { stmtCreateByPKey.setLong(argIdx++, RollupAccountId.longValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } resultSet = stmtCreateByPKey.executeQuery(); if (resultSet.next()) { CFAccAccountBuff createdBuff = unpackAccountResultSetToBuff(resultSet); if (resultSet.next()) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response"); } Buff.setRequiredTenantId(createdBuff.getRequiredTenantId()); Buff.setRequiredId(createdBuff.getRequiredId()); Buff.setRequiredAccountCode(createdBuff.getRequiredAccountCode()); Buff.setRequiredDescription(createdBuff.getRequiredDescription()); Buff.setRequiredCurrencyId(createdBuff.getRequiredCurrencyId()); Buff.setRequiredBalance(createdBuff.getRequiredBalance()); Buff.setOptionalRollupTenantId(createdBuff.getOptionalRollupTenantId()); Buff.setOptionalRollupAccountId(createdBuff.getOptionalRollupAccountId()); 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().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:com.squid.core.domain.operators.ExtendedType.java
@JsonIgnore public boolean isInteger() { switch (this.dataType) { case Types.BIGINT: case Types.INTEGER: case Types.SMALLINT: case Types.TINYINT: return true; case Types.NUMERIC: case Types.DECIMAL: return scale == 0; default://w w w.jav a 2 s . co m return false; } }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnglishParseTable.java
public void createEnglishParse(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnglishParseBuff Buff) { final String S_ProcName = "createEnglishParse"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*w ww.j av a 2 s .co m*/ ResultSet resultSet = null; CallableStatement stmtCreateByPKey = null; try { String ClassCode = Buff.getClassCode(); Long ScopeId = Buff.getOptionalScopeId(); String Name = Buff.getRequiredName(); Connection cnx = schema.getCnx(); stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".crt_enparse( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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++, ClassCode); if (ScopeId != null) { stmtCreateByPKey.setLong(argIdx++, ScopeId.longValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } stmtCreateByPKey.setString(argIdx++, Name); stmtCreateByPKey.execute(); resultSet = (ResultSet) stmtCreateByPKey.getObject(1); if (resultSet == null) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "crt_enparse() did not return a result set"); } try { if (resultSet.next()) { CFEnSyntaxEnglishParseBuff createdBuff = 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.setRequiredId(createdBuff.getRequiredId()); Buff.setOptionalScopeId(createdBuff.getOptionalScopeId()); Buff.setRequiredName(createdBuff.getRequiredName()); Buff.setRequiredRevision(createdBuff.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, "crt_enparse() 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; } } }