/** * Return the batch writing mode. */ protected boolean isInBatchWritingMode(AbstractSession session) { return getPlatform().usesBatchWriting() && this.isInTransaction; }
/** * Return the batch writing mode. */ protected boolean isInBatchWritingMode(AbstractSession session) { return getPlatform().usesBatchWriting() && this.isInTransaction; }
/** * Return the batch writing mode. */ protected boolean isInBatchWritingMode(AbstractSession session) { return getPlatform().usesBatchWriting() && this.isInTransaction; }
public void populateRow(DatabaseField[] fieldsArray, Object[] values, ResultSet resultSet, ResultSetMetaData metaData, AbstractSession session, int startIndex, int endIndex) throws DatabaseException { // PERF: Pass platform and optimize data flag. DatabasePlatform platform = getPlatform(); boolean optimizeData = platform.shouldOptimizeDataConversion(); for (int index = startIndex; index < endIndex; index++) { DatabaseField field = fieldsArray[index]; // Field can be null for fetch groups. if (field != null) { values[index] = getObject(resultSet, field, metaData, index + 1, platform, optimizeData, session); } } }
/** * This is the default constructor for the class. * * Bug 2804663 - Each DatabaseAccessor will now hold on to its own instance * of this class, hence a singleton pattern is not applicable. */ public LOBValueWriter(Accessor accessor) { this.accessor = accessor; DatabasePlatform platform = ((DatabaseAccessor)accessor).getPlatform(); this.isNativeConnectionRequired = platform.isOracle() && ((OraclePlatform)platform).isNativeConnectionRequiredForLobLocator(); }
/** * This is the default constructor for the class. * * Bug 2804663 - Each DatabaseAccessor will now hold on to its own instance * of this class, hence a singleton pattern is not applicable. */ public LOBValueWriter(Accessor accessor) { this.accessor = accessor; DatabasePlatform platform = ((DatabaseAccessor)accessor).getPlatform(); this.isNativeConnectionRequired = platform.isOracle() && ((OraclePlatform)platform).isNativeConnectionRequiredForLobLocator(); }
public void populateRow(DatabaseField[] fieldsArray, Object[] values, ResultSet resultSet, ResultSetMetaData metaData, AbstractSession session, int startIndex, int endIndex) throws DatabaseException { // PERF: Pass platform and optimize data flag. DatabasePlatform platform = getPlatform(); boolean optimizeData = platform.shouldOptimizeDataConversion(); for (int index = startIndex; index < endIndex; index++) { DatabaseField field = fieldsArray[index]; // Field can be null for fetch groups. if (field != null) { values[index] = getObject(resultSet, field, metaData, index + 1, platform, optimizeData, session); } } }
/** * This is the default constructor for the class. * * Bug 2804663 - Each DatabaseAccessor will now hold on to its own instance * of this class, hence a singleton pattern is not applicable. */ public LOBValueWriter(Accessor accessor) { this.accessor = accessor; DatabasePlatform platform = ((DatabaseAccessor)accessor).getPlatform(); this.isNativeConnectionRequired = platform.isOracle() && ((OraclePlatform)platform).isNativeConnectionRequiredForLobLocator(); }
/** * Return the column names from a result sets meta data as a vector of DatabaseFields. * This is required for custom SQL execution only, * as generated SQL already knows the fields returned. */ protected Vector getColumnNames(ResultSet resultSet, AbstractSession session) throws SQLException { ResultSetMetaData metaData = resultSet.getMetaData(); Vector columnNames = new Vector(metaData.getColumnCount()); for (int index = 0; index < metaData.getColumnCount(); index++) { // Changed the following code to use metaData#getColumnLabel() instead of metaData.getColumnName() // This is as required by JDBC spec to access metadata for queries using column aliases. // Reconsider whether to migrate this change to other versions of Eclipselink with older native query support String columnName = metaData.getColumnLabel(index + 1); if ((columnName == null) || columnName.equals("")) { columnName = "C" + (index + 1);// Some column may be unnamed. } DatabaseField column = new DatabaseField(columnName); // Force field names to upper case is set. if (getPlatform().shouldForceFieldNamesToUpperCase()) { column.useUpperCaseForComparisons(true); } columnNames.addElement(column); } return columnNames; }
/** * Begin a transaction on the database. This means toggling the auto-commit option. */ public void basicBeginTransaction(AbstractSession session) throws DatabaseException { try { if (getPlatform().supportsAutoCommit()) { getConnection().setAutoCommit(false); } else { getPlatform().beginTransaction(this); } } catch (SQLException exception) { DatabaseException commException = processExceptionForCommError(session, exception, null); if (commException != null) throw commException; throw DatabaseException.sqlException(exception, this, session, false); } }
/** * Begin a transaction on the database. This means toggling the auto-commit option. */ @Override public void basicBeginTransaction(AbstractSession session) throws DatabaseException { try { if (getPlatform().supportsAutoCommit()) { getConnection().setAutoCommit(false); } else { getPlatform().beginTransaction(this); } } catch (SQLException exception) { DatabaseException commException = processExceptionForCommError(session, exception, null); if (commException != null) throw commException; throw DatabaseException.sqlException(exception, this, session, false); } }
/** * Commit a transaction on the database. This means toggling the auto-commit option. */ public void basicCommitTransaction(AbstractSession session) throws DatabaseException { try { if (getPlatform().supportsAutoCommit()) { getConnection().commit(); getConnection().setAutoCommit(true); } else { getPlatform().commitTransaction(this); } } catch (SQLException exception) { DatabaseException commException = processExceptionForCommError(session, exception, null); if (commException != null) throw commException; throw DatabaseException.sqlException(exception, this, session, false); } }
/** * Begin a transaction on the database. This means toggling the auto-commit option. */ @Override public void basicBeginTransaction(AbstractSession session) throws DatabaseException { try { if (getPlatform().supportsAutoCommit()) { getConnection().setAutoCommit(false); } else { getPlatform().beginTransaction(this); } } catch (SQLException exception) { DatabaseException commException = processExceptionForCommError(session, exception, null); if (commException != null) throw commException; throw DatabaseException.sqlException(exception, this, session, false); } }
/** * Rollback a transaction on the database. This means toggling the auto-commit option. */ public void basicRollbackTransaction(AbstractSession session) throws DatabaseException { try { if (getPlatform().supportsAutoCommit()) { getConnection().rollback(); getConnection().setAutoCommit(true); } else { getPlatform().rollbackTransaction(this); } } catch (SQLException exception) { DatabaseException commException = processExceptionForCommError(session, exception, null); if (commException != null) throw commException; throw DatabaseException.sqlException(exception, this, session, false); } }
/** * Commit a transaction on the database. This means toggling the auto-commit option. */ @Override public void basicCommitTransaction(AbstractSession session) throws DatabaseException { try { if (getPlatform().supportsAutoCommit()) { getConnection().commit(); getConnection().setAutoCommit(true); } else { getPlatform().commitTransaction(this); } } catch (SQLException exception) { DatabaseException commException = processExceptionForCommError(session, exception, null); if (commException != null) throw commException; throw DatabaseException.sqlException(exception, this, session, false); } }
/** * Rollback a transaction on the database. This means toggling the auto-commit option. */ public void basicRollbackTransaction(AbstractSession session) throws DatabaseException { try { if (getPlatform().supportsAutoCommit()) { getConnection().rollback(); getConnection().setAutoCommit(true); } else { getPlatform().rollbackTransaction(this); } } catch (SQLException exception) { DatabaseException commException = processExceptionForCommError(session, exception, null); if (commException != null) throw commException; throw DatabaseException.sqlException(exception, this, session, false); } }
/** * Rollback a transaction on the database. This means toggling the auto-commit option. */ @Override public void basicRollbackTransaction(AbstractSession session) throws DatabaseException { try { if (getPlatform().supportsAutoCommit()) { getConnection().rollback(); getConnection().setAutoCommit(true); } else { getPlatform().rollbackTransaction(this); } } catch (SQLException exception) { DatabaseException commException = processExceptionForCommError(session, exception, null); if (commException != null) throw commException; throw DatabaseException.sqlException(exception, this, session, false); } }
/** * Commit a transaction on the database. This means toggling the auto-commit option. */ @Override public void basicCommitTransaction(AbstractSession session) throws DatabaseException { try { if (getPlatform().supportsAutoCommit()) { getConnection().commit(); getConnection().setAutoCommit(true); } else { getPlatform().commitTransaction(this); } } catch (SQLException exception) { DatabaseException commException = processExceptionForCommError(session, exception, null); if (commException != null) throw commException; throw DatabaseException.sqlException(exception, this, session, false); } }
/** * Execute the statement. */ public ResultSet executeSelect(DatabaseCall call, Statement statement, AbstractSession session) throws SQLException { ResultSet resultSet; session.startOperationProfile(SessionProfiler.StatementExecute, call.getQuery(), SessionProfiler.ALL); try { if (call.isDynamicCall(session)) { resultSet = statement.executeQuery(call.getSQLString()); } else { resultSet = ((PreparedStatement)statement).executeQuery(); } } finally { session.endOperationProfile(SessionProfiler.StatementExecute, call.getQuery(), SessionProfiler.ALL); } // Allow for procs with outputs to be raised as events for error handling. if (call.shouldBuildOutputRow() && getPlatform().isOutputAllowWithResultSet()) { AbstractRecord outputRow = buildOutputRow((CallableStatement)statement, call, session); call.getQuery().setProperty("output", outputRow); if (session.hasEventManager()) { session.getEventManager().outputParametersDetected(outputRow, call); } } return resultSet; }
/** * Execute the statement. */ public ResultSet executeSelect(DatabaseCall call, Statement statement, AbstractSession session) throws SQLException { ResultSet resultSet; session.startOperationProfile(SessionProfiler.StatementExecute, call.getQuery(), SessionProfiler.ALL); try { if (call.isDynamicCall(session)) { resultSet = statement.executeQuery(call.getSQLString()); } else { resultSet = ((PreparedStatement)statement).executeQuery(); } } finally { session.endOperationProfile(SessionProfiler.StatementExecute, call.getQuery(), SessionProfiler.ALL); } // Allow for procs with outputs to be raised as events for error handling. if (call.shouldBuildOutputRow() && getPlatform().isOutputAllowWithResultSet()) { AbstractRecord outputRow = buildOutputRow((CallableStatement)statement, call, session); call.getQuery().setProperty("output", outputRow); if (session.hasEventManager()) { session.getEventManager().outputParametersDetected(outputRow, call); } } return resultSet; }