@Test public void executeSql_empty_result() { List<Map<String, String>> rows = db.executeSql("select * from metrics where kee='xxx'"); assertThat(rows.size()).isEqualTo(0); }
@Override public List<Map<String, String>> executeSql(String sql) { Connection connection = openConnection(); try { return executeSql(connection, sql); } catch (Exception e) { throw new IllegalArgumentException("Fail to execute SQL request: " + sql, e); } finally { closeQuietly(connection); } }
DefaultDatabase implements Database { @Override public List<Map<String, String>> executeSql(String sql) { Connection connection = openConnection(); try { return executeSql(connection, sql); } catch (Exception e) { throw new IllegalArgumentException("Fail to execute SQL request: " + sql, e); } finally { closeQuietly(connection); } } }
DefaultDatabase implements Database { @Override public List<Map<String, String>> executeSql(String sql) { Connection connection = openConnection(); try { return executeSql(connection, sql); } catch (Exception e) { throw new IllegalArgumentException("Fail to execute SQL request: " + sql, e); } finally { closeQuietly(connection); } } DefaultDatabase(Configuration config);  DefaultDatabase(DatabaseClient client); }
DefaultDatabase implements Database { @Override public List<Map<String, String>> executeSql(String sql) { Connection connection = openConnection(); try { return executeSql(connection, sql); } catch (Exception e) { throw new IllegalArgumentException("Fail to execute SQL request: " + sql, e); } finally { closeQuietly(connection); } } DefaultDatabase(Configuration config);  DefaultDatabase(DatabaseClient client); void start(); void stop(); @Override Map<String, String> getSonarProperties(); @Override DatabaseClient getClient(); @Override Database truncate(String tableName); @Override int countSql(String sql); @Override List<Map<String, String>> executeSql(String sql); @Override Connection openConnection(); @Override DefaultDatabase closeQuietly(@Nullable Connection connection); @Override void killOtherConnections(); }
DefaultDatabase implements Database { @Override public List<Map<String, String>> executeSql(String sql) { Connection connection = openConnection(); try { return executeSql(connection, sql); } catch (Exception e) { throw new IllegalArgumentException("Fail to execute SQL request: " + sql, e); } finally { closeQuietly(connection); } } DefaultDatabase(Configuration config);  DefaultDatabase(DatabaseClient client); void start(); void stop(); @Override Map<String, String> getSonarProperties(); @Override DatabaseClient getClient(); @Override Database truncate(String tableName); @Override int countSql(String sql); @Override List<Map<String, String>> executeSql(String sql); @Override Connection openConnection(); @Override DefaultDatabase closeQuietly(@Nullable Connection connection); @Override void killOtherConnections();  }