Java Code Examples for java.sql.ResultSet#setFetchDirection()
The following examples show how to use
java.sql.ResultSet#setFetchDirection() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FirebirdSpecific.java From CloverETL-Engine with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void optimizeResultSet(ResultSet resultSet, OperationType operationType) { switch (operationType){ case READ: try { resultSet.setFetchDirection(ResultSet.FETCH_FORWARD); // SQLite driver MUST HAVE fetch size set to 0 - otherwise it limits number of results returned resultSet.setFetchSize(0); } catch(SQLException ex) { //TODO: for now, do nothing } } }
Example 2
Source File: SQLiteSpecific.java From CloverETL-Engine with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void optimizeResultSet(ResultSet resultSet, OperationType operationType) { switch (operationType){ case READ: try { resultSet.setFetchDirection(ResultSet.FETCH_FORWARD); // SQLite driver MUST HAVE fetch size set to 0 - otherwise it limits number of results returned resultSet.setFetchSize(0); } catch(SQLException ex) { //TODO: for now, do nothing } } }
Example 3
Source File: AbstractResultSetAdapter.java From sharding-jdbc-1.5.1 with Apache License 2.0 | 5 votes |
@Override public final void setFetchDirection(final int direction) throws SQLException { Collection<SQLException> exceptions = new LinkedList<>(); for (ResultSet each : resultSets) { try { each.setFetchDirection(direction); } catch (final SQLException ex) { exceptions.add(ex); } } throwSQLExceptionIfNecessary(exceptions); }
Example 4
Source File: DbConnectionManager.java From Openfire with Apache License 2.0 | 5 votes |
/** * Scrolls forward in a result set the specified number of rows. If the JDBC driver * supports the feature, the cursor will be moved directly. Otherwise, we scroll * through results one by one manually by calling {@code rs.next()}. * * @param rs the ResultSet object to scroll. * @param rowNumber the row number to scroll forward to. * @throws SQLException if an error occurs. */ public static void scrollResultSet(ResultSet rs, int rowNumber) throws SQLException { // If the driver supports scrollable result sets, use that feature. if (isScrollResultsSupported()) { if (rowNumber > 0) { // We will attempt to do a relative fetch. This may fail in SQL Server if // <resultset-navigation-strategy> is set to absolute. It would need to be // set to looping to work correctly. // If so, manually scroll to the correct row. try { rs.setFetchDirection(ResultSet.FETCH_FORWARD); rs.relative(rowNumber); } catch (SQLException e) { // TODO change "Error ..." to "Disabling ..." Log.error("Error in JDBC method rs.relative(rowNumber).", e); //Log.error("Disabling JDBC method rs.relative(rowNumber).", e); //scrollResultsSupported = false; for (int i = 0; i < rowNumber; i++) { rs.next(); } } } } // Otherwise, manually scroll to the correct row. else { for (int i = 0; i < rowNumber; i++) { rs.next(); } } }
Example 5
Source File: AbstractJdbcSpecific.java From CloverETL-Engine with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void optimizeResultSet(ResultSet resultSet, OperationType operationType) { switch (operationType){ case READ: try { resultSet.setFetchDirection(ResultSet.FETCH_FORWARD); resultSet.setFetchSize(DEFAULT_FETCH_SIZE); } catch(SQLException ex) { //TODO: for now, do nothing } } }
Example 6
Source File: MySQLSpecific.java From CloverETL-Engine with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void optimizeResultSet(ResultSet res,OperationType operType){ if (operType == OperationType.READ) { try { res.setFetchDirection(ResultSet.FETCH_FORWARD); }catch(SQLException ex){ //TODO: for now, do nothing } } }
Example 7
Source File: SQL_BAD_RESULTSET_ACCESS.java From spotbugs with GNU Lesser General Public License v2.1 | 4 votes |
@NoWarning("SQL_BAD_RESULTSET_ACCESS") void notBug2(ResultSet any) throws SQLException { any.setFetchDirection(0); }