@Override public SQLWarning getWarnings() throws SQLException { return rawStatement.getWarnings(); }
@Override public SQLWarning getWarnings() throws SQLException { return rawStatement.getWarnings(); }
/** {@inheritDoc} */ @Override public SQLWarning getWarnings() throws SQLException { return delegate.getWarnings(); }
public void run() { try { // TODO cross-check result against actual // number // of rows sent. ps.executeUpdate(); // Pump out any warnings and save them. SQLWarning warning = ps.getWarnings(); while ( warning != null ) { warnings.add( warning.getMessage() ); warning = warning.getNextWarning(); } } catch ( SQLException ex ) { this.ex = ex; } finally { try { data.db.closePreparedStatement( ps ); } catch ( KettleException ke ) { // not much we can do with this } finally { ps = null; } } }
@Test public void testIgnoredWarning() throws Exception { String sql = "SELECT forename from custmr"; SQLWarning warnings = new SQLWarning("My warning"); given(this.resultSet.next()).willReturn(false); given(this.connection.createStatement()).willReturn(this.preparedStatement); given(this.preparedStatement.getWarnings()).willReturn(warnings); // Too long: truncation this.template.setIgnoreWarnings(true); this.template.query(sql, rs -> { rs.getByte(1); }); verify(this.resultSet).close(); verify(this.preparedStatement).close(); verify(this.connection).close(); }
/** * Mock objects allow us to produce warnings at will */ @Test public void testFatalWarning() throws Exception { String sql = "SELECT forename from custmr"; SQLWarning warnings = new SQLWarning("My warning"); given(this.resultSet.next()).willReturn(false); given(this.preparedStatement.getWarnings()).willReturn(warnings); given(this.connection.createStatement()).willReturn(this.preparedStatement); JdbcTemplate t = new JdbcTemplate(this.dataSource); t.setIgnoreWarnings(false); this.thrown.expect(SQLWarningException.class); this.thrown.expect(exceptionCause(sameInstance(warnings))); try { t.query(sql, rs -> { rs.getByte(1); }); } finally { verify(this.resultSet).close(); verify(this.preparedStatement).close(); verify(this.connection).close(); } }
@Override public SQLWarning getWarnings() throws SQLException { return ps.getWarnings(); }
@Override public SQLWarning getWarnings() throws SQLException { return ps.getWarnings(); }
public SQLWarning getWarnings() throws SQLException { return delegate.getWarnings(); }
/** * Facade for PreparedStatement */ public SQLWarning getWarnings() throws SQLException { return ps.getWarnings(); }
/** * Standard Statement method call. */ public SQLWarning getWarnings() throws SQLException { return pstmt.getWarnings(); }
/** * Standard Statement method call. */ public SQLWarning getWarnings() throws SQLException { return pstmt.getWarnings(); }
@Override public SQLWarning getWarnings() throws SQLException { return ps.getWarnings(); }
@Override public SQLWarning getWarnings() throws SQLException { checkState(); return realPreparedStatement.getWarnings(); }
public SQLWarning getWarnings() throws SQLException { try { return original.getWarnings(); } catch (final SQLException e) { throw wrapException(e); } }
public SQLWarning getWarnings() throws SQLException { try { return original.getWarnings(); } catch (final SQLException e) { throw wrapException(e); } }
public SQLWarning getWarnings() throws SQLException { //preInvoke(); try { return ps.getWarnings(); } catch (SQLException e) { catchInvoke(e); } return null; }
@Override public SQLWarning getWarnings() throws SQLException { checkClosed(); return delegate.getWarnings(); }
@Override public SQLWarning getWarnings() throws SQLException { checkState(); return realPreparedStatement.getWarnings(); }
public SQLWarning getWarnings() throws SQLException { Profiler profiler = _profilerPoint.start(); try { return _preparedStatement.getWarnings(); } finally { profiler.finish(); } }