@Override public SQLWarning getWarnings() throws SQLException { return targetStatement.getWarnings(); }
@Override public SQLWarning getWarnings() throws SQLException { return statement.getWarnings(); }
@Override public SQLWarning getWarnings() throws SQLException { return delegate.getWarnings(); }
public SQLWarning getWarnings() throws SQLException { return stmt.getWarnings(); }
@Override public final SQLWarning getWarnings() throws SQLException { checkOpen(); try { return stmt.getWarnings(); } catch (Throwable t) { throw checkException(t); } }
@Override public void run() throws Exception { stmt.getWarnings(); } });
public SQLWarning checkWarnings() { SQLWarning warn = null; if ( m_Statement != null ) { try { warn = m_Statement.getWarnings(); m_Statement.clearWarnings(); } catch (SQLException se) {} } return(warn); } }
@Override public void export(String string) throws Exception { statement.executeUpdate( string ); try { SQLWarning warnings = statement.getWarnings(); if ( warnings != null) { sqlExceptionHelper.logAndClearWarnings( connection ); } } catch( SQLException e ) { LOG.unableToLogSqlWarnings( e ); } }
/** * Throw an SQLWarningException if we're not ignoring warnings, * else log the warnings (at debug level). * @param stmt the current JDBC statement * @throws SQLWarningException if not ignoring warnings * @see org.springframework.jdbc.SQLWarningException */ protected void handleWarnings(Statement stmt) throws SQLException { if (isIgnoreWarnings()) { if (logger.isDebugEnabled()) { SQLWarning warningToLog = stmt.getWarnings(); while (warningToLog != null) { logger.debug("SQLWarning ignored: SQL state '" + warningToLog.getSQLState() + "', error code '" + warningToLog.getErrorCode() + "', message [" + warningToLog.getMessage() + "]"); warningToLog = warningToLog.getNextWarning(); } } } else { handleWarnings(stmt.getWarnings()); } }
@Override public SQLWarning statement_getWarnings(StatementProxy statement) throws SQLException { if (this.pos < filterSize) { return nextFilter().statement_getWarnings(this, statement); } return statement.getRawObject().getWarnings(); }
if (logger.isDebugEnabled()) { logger.debug(rowsAffected + " returned as update count for SQL: " + statement); SQLWarning warningToLog = stmt.getWarnings(); while (warningToLog != null) { logger.debug("SQLWarning ignored: SQL state '" + warningToLog.getSQLState() +
/** * Throw a SQLWarningException if we're not ignoring warnings, else log the * warnings (at debug level). * * @param statement the current statement to obtain the warnings from, if there are any. * @throws SQLException if interaction with provided statement fails. * * @see org.springframework.jdbc.SQLWarningException */ protected void handleWarnings(Statement statement) throws SQLWarningException, SQLException { if (ignoreWarnings) { if (log.isDebugEnabled()) { SQLWarning warningToLog = statement.getWarnings(); while (warningToLog != null) { log.debug("SQLWarning ignored: SQL state '" + warningToLog.getSQLState() + "', error code '" + warningToLog.getErrorCode() + "', message [" + warningToLog.getMessage() + "]"); warningToLog = warningToLog.getNextWarning(); } } } else { SQLWarning warnings = statement.getWarnings(); if (warnings != null) { throw new SQLWarningException("Warning not ignored", warnings); } } }
@Test public void testStatementWarnings() throws SQLException { assertFalse(statement.execute("CREATE SCHEMA blackhole.test_schema")); SQLWarning warning = statement.getWarnings(); assertNotNull(warning); TestingWarningCollectorConfig warningCollectorConfig = new TestingWarningCollectorConfig().setPreloadedWarnings(PRELOADED_WARNINGS); TestingWarningCollector warningCollector = new TestingWarningCollector(new WarningCollectorConfig(), warningCollectorConfig); List<PrestoWarning> expectedWarnings = warningCollector.getWarnings(); assertStartsWithExpectedWarnings(warning, fromPrestoWarnings(expectedWarnings)); statement.clearWarnings(); assertNull(statement.getWarnings()); }
while (statement.getWarnings() == null) { Thread.sleep(100); SQLWarning warning = statement.getWarnings(); Set<WarningEntry> currentWarnings = new HashSet<>(); assertTrue(currentWarnings.add(new WarningEntry(warning)));
walkWarnings( statement.getWarnings(), handler );
@Test public void testExecuteQueryWarnings() throws SQLException { try (ResultSet rs = statement.executeQuery("SELECT a FROM (VALUES 1, 2, 3) t(a)")) { assertNull(statement.getConnection().getWarnings()); assertNull(statement.getWarnings()); assertNull(rs.getWarnings()); Set<WarningEntry> currentWarnings = new HashSet<>(); while (rs.next()) { assertWarnings(rs.getWarnings(), currentWarnings); } TestingWarningCollectorConfig warningCollectorConfig = new TestingWarningCollectorConfig().setPreloadedWarnings(PRELOADED_WARNINGS).setAddWarnings(true); TestingWarningCollector warningCollector = new TestingWarningCollector(new WarningCollectorConfig(), warningCollectorConfig); List<PrestoWarning> expectedWarnings = warningCollector.getWarnings(); for (PrestoWarning prestoWarning : expectedWarnings) { assertTrue(currentWarnings.contains(new WarningEntry(new PrestoSqlWarning(prestoWarning)))); } } }
@Override public void accept(String command) { ddlTransactionIsolator.getJdbcContext().getSqlStatementLogger().logStatement( command, DDLFormatterImpl.INSTANCE ); try { final Statement jdbcStatement = jdbcStatement(); jdbcStatement.execute( command ); try { SQLWarning warnings = jdbcStatement.getWarnings(); if ( warnings != null) { ddlTransactionIsolator.getJdbcContext().getSqlExceptionHelper().logAndClearWarnings( jdbcStatement ); } } catch( SQLException e ) { log.unableToLogSqlWarnings( e ); } } catch (SQLException e) { throw new CommandAcceptanceException( "Error executing DDL \"" + command + "\" via JDBC Statement", e ); } }
} while (ret || updateCount != -1); printWarnings(getStatement().getWarnings(), false); getStatement().clearWarnings();
/** * @throws Exception If failed. */ @org.junit.Test public void testWarningsOnClosedStatement() throws Exception { stmt.clearWarnings(); assert stmt.getWarnings() == null; stmt.close(); checkStatementClosed(new RunnableX() { @Override public void run() throws Exception { stmt.getWarnings(); } }); checkStatementClosed(new RunnableX() { @Override public void run() throws Exception { stmt.clearWarnings(); } }); }
@Override public SQLWarning getWarnings() throws SQLException { checkClosed(); if (innerStatement != null) { return innerStatement.getWarnings(); } return null; }