Java Code Examples for java.sql.Statement#setPoolable()
The following examples show how to use
java.sql.Statement#setPoolable() .
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: AbstractStatementAdapter.java From sharding-jdbc-1.5.1 with Apache License 2.0 | 5 votes |
@Override public final void setPoolable(final boolean poolable) throws SQLException { this.poolable = poolable; if (getRoutedStatements().isEmpty()) { recordMethodInvocation(recordTargetClass, "setPoolable", new Class[] {boolean.class}, new Object[] {poolable}); return; } for (Statement each : getRoutedStatements()) { each.setPoolable(poolable); } }
Example 2
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"); }