Java Code Examples for java.sql.Statement#setFetchDirection()
The following examples show how to use
java.sql.Statement#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: JdbcTest.java From lucene-solr with Apache License 2.0 | 6 votes |
private void checkStatement(Connection con, Statement statement) throws Exception { assertEquals(con, statement.getConnection()); assertNull(statement.getWarnings()); statement.clearWarnings(); assertNull(statement.getWarnings()); assertEquals(ResultSet.TYPE_FORWARD_ONLY, statement.getResultSetType()); assertEquals(ResultSet.CONCUR_READ_ONLY, statement.getResultSetConcurrency()); assertEquals(ResultSet.FETCH_FORWARD, statement.getFetchDirection()); statement.setFetchDirection(ResultSet.FETCH_FORWARD); assertEquals(ResultSet.FETCH_FORWARD, statement.getFetchDirection()); assertEquals(0, statement.getFetchSize()); statement.setFetchSize(0); assertEquals(0, statement.getFetchSize()); }
Example 2
Source File: StatementIT.java From snowflake-jdbc with Apache License 2.0 | 6 votes |
@Test public void testFetchDirection() throws SQLException { Connection connection = getConnection(); Statement statement = connection.createStatement(); assertEquals(ResultSet.FETCH_FORWARD, statement.getFetchDirection()); try { statement.setFetchDirection(ResultSet.FETCH_REVERSE); } catch (SQLFeatureNotSupportedException e) { assertTrue(true); } statement.close(); connection.close(); }
Example 3
Source File: J2EEDataSourceTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** Create a statement with modified State. */ private Statement createFloatStatementForStateChecking( int[] StatementExpectedValues, Connection conn) throws SQLException { Statement s = internalCreateFloatStatementForStateChecking(conn); s.setCursorName("StokeNewington"); s.setFetchDirection(ResultSet.FETCH_REVERSE); s.setFetchSize(444); s.setMaxFieldSize(713); s.setMaxRows(19); // Create assertStatementState(null, StatementExpectedValues, s); return s; }
Example 4
Source File: BrokeredStatement.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
void setStatementState(Statement oldStatement, Statement newStatement) throws SQLException { if (cursorName != null) newStatement.setCursorName(cursorName); if (escapeProcessing != null) newStatement.setEscapeProcessing(escapeProcessing.booleanValue()); newStatement.setFetchDirection(oldStatement.getFetchDirection()); newStatement.setFetchSize(oldStatement.getFetchSize()); newStatement.setMaxFieldSize(oldStatement.getMaxFieldSize()); newStatement.setMaxRows(oldStatement.getMaxRows()); newStatement.setQueryTimeout(oldStatement.getQueryTimeout()); }
Example 5
Source File: QueryExecuter.java From barleydb with GNU Lesser General Public License v3.0 | 5 votes |
private void setFetch(Statement stmt, RuntimeProperties runtimeProperties) throws SortJdbcException { if (runtimeProperties != null && runtimeProperties.getFetchSize() != null) { try { stmt.setFetchSize( runtimeProperties.getFetchSize() ); stmt.setFetchDirection(ResultSet.FETCH_FORWARD); } catch (SQLException x) { throw new SortJdbcException("SQLException setting fetch size and direction", x); } } }
Example 6
Source File: J2EEDataSourceTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** Create a statement with modified State. */ private Statement createFloatStatementForStateChecking( int[] StatementExpectedValues, Connection conn) throws SQLException { Statement s = internalCreateFloatStatementForStateChecking(conn); s.setCursorName("StokeNewington"); s.setFetchDirection(ResultSet.FETCH_REVERSE); s.setFetchSize(444); s.setMaxFieldSize(713); s.setMaxRows(19); // Create assertStatementState(null, StatementExpectedValues, s); return s; }
Example 7
Source File: BrokeredStatement.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
void setStatementState(Statement oldStatement, Statement newStatement) throws SQLException { if (cursorName != null) newStatement.setCursorName(cursorName); if (escapeProcessing != null) newStatement.setEscapeProcessing(escapeProcessing.booleanValue()); newStatement.setFetchDirection(oldStatement.getFetchDirection()); newStatement.setFetchSize(oldStatement.getFetchSize()); newStatement.setMaxFieldSize(oldStatement.getMaxFieldSize()); newStatement.setMaxRows(oldStatement.getMaxRows()); newStatement.setQueryTimeout(oldStatement.getQueryTimeout()); }
Example 8
Source File: BasicSqlConnection.java From CloverETL-Engine with GNU Lesser General Public License v2.1 | 5 votes |
/** * This method optimizes all java.sql.Statements returned by this interface (createStatement(?)). * @param statement * @return * @throws SQLException */ protected Statement optimizeStatement(Statement statement) throws SQLException { switch (operationType) { case READ: try{ statement.setFetchDirection(ResultSet.FETCH_FORWARD); }catch(SQLException ex){ //TODO: for now, do nothing; } break; } return statement; }
Example 9
Source File: AbstractJDBCAction.java From vertx-jdbc-client with Apache License 2.0 | 5 votes |
protected void applyStatementOptions(Statement statement) throws SQLException { if (options != null) { if (options.getQueryTimeout() > 0) { statement.setQueryTimeout(options.getQueryTimeout()); } if (options.getFetchDirection() != null) { statement.setFetchDirection(options.getFetchDirection().getType()); } if (options.getFetchSize() > 0) { statement.setFetchSize(options.getFetchSize()); } } }
Example 10
Source File: BrokeredStatement.java From spliceengine with GNU Affero General Public License v3.0 | 5 votes |
void setStatementState(Statement oldStatement, Statement newStatement) throws SQLException { if (cursorName != null) newStatement.setCursorName(cursorName); if (escapeProcessing != null) newStatement.setEscapeProcessing(escapeProcessing); newStatement.setFetchDirection(oldStatement.getFetchDirection()); newStatement.setFetchSize(oldStatement.getFetchSize()); newStatement.setMaxFieldSize(oldStatement.getMaxFieldSize()); newStatement.setMaxRows(oldStatement.getMaxRows()); newStatement.setQueryTimeout(oldStatement.getQueryTimeout()); }
Example 11
Source File: J2EEDataSourceTest.java From spliceengine with GNU Affero General Public License v3.0 | 5 votes |
/** Create a statement with modified State. */ private Statement createFloatStatementForStateChecking( int[] StatementExpectedValues, Connection conn) throws SQLException { Statement s = internalCreateFloatStatementForStateChecking(conn); s.setCursorName("StokeNewington"); s.setFetchDirection(ResultSet.FETCH_REVERSE); s.setFetchSize(444); s.setMaxFieldSize(713); s.setMaxRows(19); // Create assertStatementState(null, StatementExpectedValues, s); return s; }
Example 12
Source File: UnsupportedOperationStatementTest.java From sharding-jdbc-1.5.1 with Apache License 2.0 | 4 votes |
@Test(expected = SQLFeatureNotSupportedException.class) public void assertSetFetchDirection() throws SQLException { for (Statement each : statements) { each.setFetchDirection(ResultSet.FETCH_UNKNOWN); } }
Example 13
Source File: UnsupportedOperationStatementTest.java From shardingsphere with Apache License 2.0 | 4 votes |
@Test(expected = SQLFeatureNotSupportedException.class) public void assertSetFetchDirection() throws SQLException { for (Statement each : statements) { each.setFetchDirection(ResultSet.FETCH_UNKNOWN); } }
Example 14
Source File: SWStatementTest.java From skywalking with Apache License 2.0 | 4 votes |
@Test public void testPreparedStatementConfig() throws SQLException { Statement statement = swConnection.createStatement(); statement.cancel(); statement.getUpdateCount(); statement.setFetchDirection(1); statement.getFetchDirection(); statement.getResultSetConcurrency(); statement.getResultSetType(); statement.isClosed(); statement.setPoolable(false); statement.isPoolable(); statement.getWarnings(); statement.clearWarnings(); statement.setCursorName("test"); statement.setMaxFieldSize(11); statement.getMaxFieldSize(); statement.setMaxRows(10); statement.getMaxRows(); statement.setEscapeProcessing(true); statement.setFetchSize(1); statement.getFetchSize(); statement.setQueryTimeout(1); statement.getQueryTimeout(); Connection connection = statement.getConnection(); statement.execute("SELECT * FROM test"); statement.getMoreResults(); statement.getMoreResults(1); statement.getResultSetHoldability(); statement.getResultSet(); statement.close(); verify(mysqlStatement).getUpdateCount(); verify(mysqlStatement).getMoreResults(); verify(mysqlStatement).setFetchDirection(anyInt()); verify(mysqlStatement).getFetchDirection(); verify(mysqlStatement).getResultSetType(); verify(mysqlStatement).isClosed(); verify(mysqlStatement).setPoolable(anyBoolean()); verify(mysqlStatement).getWarnings(); verify(mysqlStatement).clearWarnings(); verify(mysqlStatement).setCursorName(anyString()); verify(mysqlStatement).setMaxFieldSize(anyInt()); verify(mysqlStatement).getMaxFieldSize(); verify(mysqlStatement).setMaxRows(anyInt()); verify(mysqlStatement).getMaxRows(); verify(mysqlStatement).setEscapeProcessing(anyBoolean()); verify(mysqlStatement).getResultSetConcurrency(); verify(mysqlStatement).getResultSetConcurrency(); verify(mysqlStatement).getResultSetType(); verify(mysqlStatement).getMoreResults(anyInt()); verify(mysqlStatement).setFetchSize(anyInt()); verify(mysqlStatement).getFetchSize(); verify(mysqlStatement).getQueryTimeout(); verify(mysqlStatement).setQueryTimeout(anyInt()); verify(mysqlStatement).getResultSet(); assertThat(connection, CoreMatchers.<Connection>is(swConnection)); TraceSegment traceSegment = segmentStorage.getTraceSegments().get(0); List<AbstractTracingSpan> spans = SegmentHelper.getSpans(traceSegment); assertThat(spans.size(), is(1)); assertDBSpan(spans.get(0), "Mysql/JDBI/Statement/execute", "SELECT * FROM test"); }