@Test public void testValidQuery() throws Exception { final int res = this.dbOperator.query("select * from blah where ? = ?", this.handler, "id", 2); Assert.assertEquals(15, res); verify(this.queryRunner).query("select * from blah where ? = ?", this.handler, "id", 2); }
public <T> T query(final String baseQuery, final ResultSetHandler<T> resultHandler, final Object... params) throws SQLException { try { return this.queryRunner.query(baseQuery, resultHandler, params); } catch (final SQLException ex) { logger.error("query failed", ex); if (this.dbMetrics != null) { this.dbMetrics.markDBFailQuery(); } throw ex; } }
DatabaseOperator { public <T> T query(final String baseQuery, final ResultSetHandler<T> resultHandler, final Object... params) throws SQLException { try { return this.queryRunner.query(baseQuery, resultHandler, params); } catch (final SQLException ex) { logger.error("query failed", ex); if (this.dbMetrics != null) { this.dbMetrics.markDBFailQuery(); } throw ex; } } }
DatabaseOperator { public <T> T query(final String baseQuery, final ResultSetHandler<T> resultHandler, final Object... params) throws SQLException { try { return this.queryRunner.query(baseQuery, resultHandler, params); } catch (final SQLException ex) { logger.error("query failed", ex); if (this.dbMetrics != null) { this.dbMetrics.markDBFailQuery(); } throw ex; } } @Inject  DatabaseOperator(final QueryRunner queryRunner); }
DatabaseOperator { public <T> T query(final String baseQuery, final ResultSetHandler<T> resultHandler, final Object... params) throws SQLException { try { return this.queryRunner.query(baseQuery, resultHandler, params); } catch (final SQLException ex) { logger.error("query failed", ex); if (this.dbMetrics != null) { this.dbMetrics.markDBFailQuery(); } throw ex; } } @Inject  DatabaseOperator(final QueryRunner queryRunner); T query(final String baseQuery, final ResultSetHandler<T> resultHandler,
      final Object... params); T query(final String baseQuery, final ResultSetHandler<T> resultHandler); T transaction(final SQLTransaction<T> operations); int update(final String updateClause, final Object... params); AzkabanDataSource getDataSource(); }
DatabaseOperator { public <T> T query(final String baseQuery, final ResultSetHandler<T> resultHandler, final Object... params) throws SQLException { try { return this.queryRunner.query(baseQuery, resultHandler, params); } catch (final SQLException ex) { logger.error("query failed", ex); if (this.dbMetrics != null) { this.dbMetrics.markDBFailQuery(); } throw ex; } } @Inject  DatabaseOperator(final QueryRunner queryRunner); T query(final String baseQuery, final ResultSetHandler<T> resultHandler,
      final Object... params); T query(final String baseQuery, final ResultSetHandler<T> resultHandler); T transaction(final SQLTransaction<T> operations); int update(final String updateClause, final Object... params); AzkabanDataSource getDataSource();  }