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.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnDeterminerTable.java
public CFEnSyntaxEnDeterminerBuff[] readBuffByScopeIdx(CFEnSyntaxAuthorization Authorization, Long ScopeId) { final String S_ProcName = "readBuffByScopeIdx"; ResultSet resultSet = null;/*from w w w .j a v a 2s .co m*/ try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_read_endeter_by_scopeidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffByScopeIdx == null) { stmtReadBuffByScopeIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (ScopeId != null) { stmtReadBuffByScopeIdx.setLong(argIdx++, ScopeId.longValue()); } else { stmtReadBuffByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT); } try { resultSet = stmtReadBuffByScopeIdx.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } List<CFEnSyntaxEnDeterminerBuff> buffList = new LinkedList<CFEnSyntaxEnDeterminerBuff>(); while ((resultSet != null) && resultSet.next()) { CFEnSyntaxEnDeterminerBuff buff = unpackEnDeterminerResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFEnSyntaxEnDeterminerBuff[] retBuff = new CFEnSyntaxEnDeterminerBuff[buffList.size()]; Iterator<CFEnSyntaxEnDeterminerBuff> 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; } } }
From source file:it.anyplace.sync.repository.repo.SqlRepository.java
@Override public void updateFileInfo(FileInfo newFileInfo, @Nullable FileBlocks newFileBlocks) { final FolderStats folderStats; Version version = Iterables.getLast(newFileInfo.getVersionList()); //TODO open transsaction, rollback try (Connection connection = getConnection()) { if (newFileBlocks != null) { checkBlocks(newFileInfo, newFileBlocks); try (PreparedStatement prepareStatement = connection.prepareStatement( "MERGE INTO file_blocks" + " (folder,path,hash,size,blocks)" + " VALUES (?,?,?,?,?)")) { prepareStatement.setString(1, newFileBlocks.getFolder()); prepareStatement.setString(2, newFileBlocks.getPath()); prepareStatement.setString(3, newFileBlocks.getHash()); prepareStatement.setLong(4, newFileBlocks.getSize()); prepareStatement.setBytes(5, IndexSerializationProtos.Blocks.newBuilder() .addAllBlocks(Iterables.transform(newFileBlocks.getBlocks(), new Function<BlockInfo, IndexSerializationProtos.BlockInfo>() { @Override public IndexSerializationProtos.BlockInfo apply(BlockInfo input) { return IndexSerializationProtos.BlockInfo.newBuilder() .setOffset(input.getOffset()).setSize(input.getSize()) .setHash(ByteString.copyFrom( BaseEncoding.base16().decode(input.getHash()))) .build(); } })) .build().toByteArray()); prepareStatement.executeUpdate(); }/*from w ww . j av a 2 s.co m*/ } FileInfo oldFileInfo = findFileInfo(newFileInfo.getFolder(), newFileInfo.getPath()); try (PreparedStatement prepareStatement = connection.prepareStatement("MERGE INTO file_info" + " (folder,path,file_name,parent,size,hash,last_modified,file_type,version_id,version_value,is_deleted)" + " VALUES (?,?,?,?,?,?,?,?,?,?,?)")) { prepareStatement.setString(1, newFileInfo.getFolder()); prepareStatement.setString(2, newFileInfo.getPath()); prepareStatement.setString(3, newFileInfo.getFileName()); prepareStatement.setString(4, newFileInfo.getParent()); prepareStatement.setLong(7, newFileInfo.getLastModified().getTime()); prepareStatement.setString(8, newFileInfo.getType().name()); prepareStatement.setLong(9, version.getId()); prepareStatement.setLong(10, version.getValue()); prepareStatement.setBoolean(11, newFileInfo.isDeleted()); if (newFileInfo.isDirectory()) { prepareStatement.setNull(5, Types.BIGINT); prepareStatement.setNull(6, Types.VARCHAR); } else { prepareStatement.setLong(5, newFileInfo.getSize()); prepareStatement.setString(6, newFileInfo.getHash()); } prepareStatement.executeUpdate(); } //update stats long deltaFileCount = 0, deltaDirCount = 0, deltaSize = 0; boolean oldMissing = oldFileInfo == null || oldFileInfo.isDeleted(); boolean newMissing = newFileInfo.isDeleted(); boolean oldSizeMissing = oldMissing || !oldFileInfo.isFile(); boolean newSizeMissing = newMissing || !newFileInfo.isFile(); if (!oldSizeMissing) { deltaSize -= oldFileInfo.getSize(); } if (!newSizeMissing) { deltaSize += newFileInfo.getSize(); } if (!oldMissing) { if (oldFileInfo.isFile()) { deltaFileCount--; } else if (oldFileInfo.isDirectory()) { deltaDirCount--; } } if (!newMissing) { if (newFileInfo.isFile()) { deltaFileCount++; } else if (newFileInfo.isDirectory()) { deltaDirCount++; } } folderStats = updateFolderStats(connection, newFileInfo.getFolder(), deltaFileCount, deltaDirCount, deltaSize, newFileInfo.getLastModified()); } catch (SQLException ex) { throw new RuntimeException(ex); } folderStatsByFolder.put(folderStats.getFolder(), Optional.of(folderStats)); eventBus.post(new FolderStatsUpdatedEvent() { @Override public List<FolderStats> getFolderStats() { return Collections.singletonList(folderStats); } }); }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnPrepositionTable.java
public CFEnSyntaxEnPrepositionBuff[] readBuffByScopeIdx(CFEnSyntaxAuthorization Authorization, Long ScopeId) { final String S_ProcName = "readBuffByScopeIdx"; ResultSet resultSet = null;// ww w . j a v a 2s . c o m try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_read_enprep_by_scopeidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffByScopeIdx == null) { stmtReadBuffByScopeIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (ScopeId != null) { stmtReadBuffByScopeIdx.setLong(argIdx++, ScopeId.longValue()); } else { stmtReadBuffByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT); } try { resultSet = stmtReadBuffByScopeIdx.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } List<CFEnSyntaxEnPrepositionBuff> buffList = new LinkedList<CFEnSyntaxEnPrepositionBuff>(); while ((resultSet != null) && resultSet.next()) { CFEnSyntaxEnPrepositionBuff buff = unpackEnPrepositionResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFEnSyntaxEnPrepositionBuff[] retBuff = new CFEnSyntaxEnPrepositionBuff[buffList.size()]; Iterator<CFEnSyntaxEnPrepositionBuff> 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; } } }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnIntensifierTable.java
public CFEnSyntaxEnIntensifierBuff[] readBuffByScopeIdx(CFEnSyntaxAuthorization Authorization, Long ScopeId) { final String S_ProcName = "readBuffByScopeIdx"; ResultSet resultSet = null;//from ww w . ja v a2 s.c o m try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_read_enintens_by_scopeidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffByScopeIdx == null) { stmtReadBuffByScopeIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (ScopeId != null) { stmtReadBuffByScopeIdx.setLong(argIdx++, ScopeId.longValue()); } else { stmtReadBuffByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT); } try { resultSet = stmtReadBuffByScopeIdx.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } List<CFEnSyntaxEnIntensifierBuff> buffList = new LinkedList<CFEnSyntaxEnIntensifierBuff>(); while ((resultSet != null) && resultSet.next()) { CFEnSyntaxEnIntensifierBuff buff = unpackEnIntensifierResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFEnSyntaxEnIntensifierBuff[] retBuff = new CFEnSyntaxEnIntensifierBuff[buffList.size()]; Iterator<CFEnSyntaxEnIntensifierBuff> 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; } } }
From source file:net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.java
protected void setStatementParameter(int parameterIndex, Class<?> parameterType, Object parameterValue, JRPropertiesHolder properties) throws SQLException { if (java.lang.Boolean.class.isAssignableFrom(parameterType)) { if (parameterValue == null) { statement.setNull(parameterIndex, Types.BIT); } else {/*from ww w. j a v a 2s .c o m*/ statement.setBoolean(parameterIndex, (Boolean) parameterValue); } } else if (java.lang.Byte.class.isAssignableFrom(parameterType)) { if (parameterValue == null) { statement.setNull(parameterIndex, Types.TINYINT); } else { statement.setByte(parameterIndex, (Byte) parameterValue); } } else if (java.lang.Double.class.isAssignableFrom(parameterType)) { if (parameterValue == null) { statement.setNull(parameterIndex, Types.DOUBLE); } else { statement.setDouble(parameterIndex, (Double) parameterValue); } } else if (java.lang.Float.class.isAssignableFrom(parameterType)) { if (parameterValue == null) { statement.setNull(parameterIndex, Types.FLOAT); } else { statement.setFloat(parameterIndex, (Float) parameterValue); } } else if (java.lang.Integer.class.isAssignableFrom(parameterType)) { if (parameterValue == null) { statement.setNull(parameterIndex, Types.INTEGER); } else { statement.setInt(parameterIndex, (Integer) parameterValue); } } else if (java.lang.Long.class.isAssignableFrom(parameterType)) { if (parameterValue == null) { statement.setNull(parameterIndex, Types.BIGINT); } else { statement.setLong(parameterIndex, (Long) parameterValue); } } else if (java.lang.Short.class.isAssignableFrom(parameterType)) { if (parameterValue == null) { statement.setNull(parameterIndex, Types.SMALLINT); } else { statement.setShort(parameterIndex, (Short) parameterValue); } } else if (java.math.BigDecimal.class.isAssignableFrom(parameterType)) { if (parameterValue == null) { statement.setNull(parameterIndex, Types.DECIMAL); } else { statement.setBigDecimal(parameterIndex, (BigDecimal) parameterValue); } } else if (java.lang.String.class.isAssignableFrom(parameterType)) { if (parameterValue == null) { statement.setNull(parameterIndex, Types.VARCHAR); } else { statement.setString(parameterIndex, parameterValue.toString()); } } else if (java.sql.Timestamp.class.isAssignableFrom(parameterType)) { setTimestamp(parameterIndex, parameterValue, properties); } else if (java.sql.Time.class.isAssignableFrom(parameterType)) { setTime(parameterIndex, parameterValue, properties); } else if (java.util.Date.class.isAssignableFrom(parameterType)) { setDate(parameterIndex, parameterValue, properties); } else { if (isProcedureCall) { boolean handled = procedureCallHandler.setParameterValue(parameterIndex, parameterType, parameterValue); if (handled) { return; } } if (parameterValue == null) { statement.setNull(parameterIndex, Types.JAVA_OBJECT); } else { statement.setObject(parameterIndex, parameterValue); } } }
From source file:com.nextep.designer.sqlclient.ui.services.impl.SQLClientService.java
private int getSqlTypeFor(Object o) { if (o instanceof String) { return Types.VARCHAR; } else if (o instanceof Date) { return Types.DATE; } else if (o instanceof Integer) { return Types.INTEGER; } else if (o instanceof Double) { return Types.DOUBLE; } else if (o instanceof Float) { return Types.FLOAT; } else if (o instanceof BigInteger) { return Types.BIGINT; } else if (o instanceof BigDecimal) { return Types.NUMERIC; } else {/* w ww . j a v a 2s .co m*/ return Types.OTHER; } }
From source file:com.flexive.ejb.beans.BriefcaseEngineBean.java
/** * {@inheritDoc}/*from www. j a v a 2 s . c o m*/ */ @Override @TransactionAttribute(TransactionAttributeType.REQUIRED) public void addItemData(long briefcaseId, BriefcaseItemData itemData) throws FxApplicationException { if (itemData == null) return; Briefcase br = load(briefcaseId); // check read permissions Connection con = null; PreparedStatement stmt = null; try { con = Database.getDbConnection(); // check if the item actually exists stmt = con.prepareStatement( "SELECT COUNT(*) FROM " + TBL_BRIEFCASE_DATA + " WHERE briefcase_id=? AND id=?"); stmt.setLong(1, briefcaseId); stmt.setLong(2, itemData.getId()); ResultSet rs = stmt.executeQuery(); if (rs == null || !rs.next() || rs.getLong(1) != 1) throw new FxNotFoundException(LOG, "ex.briefcase.notFound.item", itemData.getId(), br.getName()); stmt.close(); stmt = con.prepareStatement( "SELECT MAX(pos) FROM " + TBL_BRIEFCASE_DATA_ITEM + " WHERE briefcase_id=? AND id=?"); stmt.setLong(1, briefcaseId); stmt.setLong(2, itemData.getId()); rs = stmt.executeQuery(); int pos = rs.next() ? rs.getInt(1) : 0; stmt.close(); stmt = con.prepareStatement("INSERT INTO " + TBL_BRIEFCASE_DATA_ITEM + "(briefcase_id, id, pos, intflag1, intflag2, intflag3, longflag1, longflag2, metadata) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"); stmt.setLong(1, briefcaseId); stmt.setLong(2, itemData.getId()); stmt.setLong(3, ++pos); if (itemData.isIntFlagSet(1)) stmt.setInt(4, itemData.getIntFlag1()); else stmt.setNull(4, Types.INTEGER); if (itemData.isIntFlagSet(2)) stmt.setInt(5, itemData.getIntFlag2()); else stmt.setNull(5, Types.INTEGER); if (itemData.isIntFlagSet(3)) stmt.setInt(6, itemData.getIntFlag3()); else stmt.setNull(6, Types.INTEGER); if (itemData.isLongFlagSet(1)) stmt.setLong(7, itemData.getLongFlag1()); else stmt.setNull(7, Types.BIGINT); if (itemData.isLongFlagSet(2)) stmt.setLong(8, itemData.getLongFlag2()); else stmt.setNull(8, Types.BIGINT); stmt.setString(9, itemData.getMetaData()); stmt.executeUpdate(); } catch (Exception e) { EJBUtils.rollback(ctx); throw new FxUpdateException(LOG, e, "ex.briefcase.addItemData", br.getName(), itemData.getId(), e.getMessage()); } finally { Database.closeObjects(BriefcaseEngineBean.class, con, stmt); } }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnHeadTable.java
public CFEnSyntaxEnHeadBuff[] readBuffByScopeIdx(CFEnSyntaxAuthorization Authorization, Long ScopeId) { final String S_ProcName = "readBuffByScopeIdx"; ResultSet resultSet = null;/*from w w w.j a v a2 s . c o m*/ Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByScopeIdx = null; List<CFEnSyntaxEnHeadBuff> buffList = new LinkedList<CFEnSyntaxEnHeadBuff>(); try { stmtReadBuffByScopeIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".rd_enheadbyscopeidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByScopeIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (ScopeId != null) { stmtReadBuffByScopeIdx.setLong(argIdx++, ScopeId.longValue()); } else { stmtReadBuffByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT); } stmtReadBuffByScopeIdx.execute(); resultSet = (ResultSet) stmtReadBuffByScopeIdx.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { CFEnSyntaxEnHeadBuff buff = unpackEnHeadResultSetToBuff(resultSet); buffList.add(buff); } try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } catch (SQLException e) { } } int idx = 0; CFEnSyntaxEnHeadBuff[] retBuff = new CFEnSyntaxEnHeadBuff[buffList.size()]; Iterator<CFEnSyntaxEnHeadBuff> 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 (stmtReadBuffByScopeIdx != null) { try { stmtReadBuffByScopeIdx.close(); } catch (SQLException e) { } stmtReadBuffByScopeIdx = null; } } }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnWordTable.java
public CFEnSyntaxEnWordBuff[] readBuffByScopeIdx(CFEnSyntaxAuthorization Authorization, Long ScopeId) { final String S_ProcName = "readBuffByScopeIdx"; ResultSet resultSet = null;/*from w w w .j ava 2 s . co m*/ Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByScopeIdx = null; List<CFEnSyntaxEnWordBuff> buffList = new LinkedList<CFEnSyntaxEnWordBuff>(); try { stmtReadBuffByScopeIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".rd_enwordbyscopeidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByScopeIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (ScopeId != null) { stmtReadBuffByScopeIdx.setLong(argIdx++, ScopeId.longValue()); } else { stmtReadBuffByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT); } stmtReadBuffByScopeIdx.execute(); resultSet = (ResultSet) stmtReadBuffByScopeIdx.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { CFEnSyntaxEnWordBuff buff = unpackEnWordResultSetToBuff(resultSet); buffList.add(buff); } try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } catch (SQLException e) { } } int idx = 0; CFEnSyntaxEnWordBuff[] retBuff = new CFEnSyntaxEnWordBuff[buffList.size()]; Iterator<CFEnSyntaxEnWordBuff> 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 (stmtReadBuffByScopeIdx != null) { try { stmtReadBuffByScopeIdx.close(); } catch (SQLException e) { } stmtReadBuffByScopeIdx = null; } } }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnTenseTable.java
public CFEnSyntaxEnTenseBuff[] readBuffByScopeIdx(CFEnSyntaxAuthorization Authorization, Long ScopeId) { final String S_ProcName = "readBuffByScopeIdx"; ResultSet resultSet = null;// w w w . j a va 2s. co m Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByScopeIdx = null; List<CFEnSyntaxEnTenseBuff> buffList = new LinkedList<CFEnSyntaxEnTenseBuff>(); try { stmtReadBuffByScopeIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".rd_entensebyscopeidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByScopeIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByScopeIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (ScopeId != null) { stmtReadBuffByScopeIdx.setLong(argIdx++, ScopeId.longValue()); } else { stmtReadBuffByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT); } stmtReadBuffByScopeIdx.execute(); resultSet = (ResultSet) stmtReadBuffByScopeIdx.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { CFEnSyntaxEnTenseBuff buff = unpackEnTenseResultSetToBuff(resultSet); buffList.add(buff); } try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } catch (SQLException e) { } } int idx = 0; CFEnSyntaxEnTenseBuff[] retBuff = new CFEnSyntaxEnTenseBuff[buffList.size()]; Iterator<CFEnSyntaxEnTenseBuff> 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 (stmtReadBuffByScopeIdx != null) { try { stmtReadBuffByScopeIdx.close(); } catch (SQLException e) { } stmtReadBuffByScopeIdx = null; } } }