Java Code Examples for io.vertx.ext.sql.ResultSet#getResults()

The following examples show how to use io.vertx.ext.sql.ResultSet#getResults() . 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: JdbcStoredResponseResultMapper.java    From prebid-server-java with Apache License 2.0 6 votes vote down vote up
public static StoredResponseDataResult map(ResultSet resultSet, Set<String> responseIds) {
    final Map<String, String> storedIdToResponse = new HashMap<>(responseIds.size());
    final List<String> errors = new ArrayList<>();

    if (resultSet == null || CollectionUtils.isEmpty(resultSet.getResults())) {
        handleEmptyResultError(responseIds, errors);
    } else {
        try {
            for (JsonArray result : resultSet.getResults()) {
                storedIdToResponse.put(result.getString(0), result.getString(1));
            }
        } catch (IndexOutOfBoundsException e) {
            errors.add("Result set column number is less than expected");
            return StoredResponseDataResult.of(Collections.emptyMap(), errors);
        }
        errors.addAll(responseIds.stream().filter(id -> !storedIdToResponse.containsKey(id))
                .map(id -> String.format("No stored response found for id: %s", id))
                .collect(Collectors.toList()));
    }

    return StoredResponseDataResult.of(storedIdToResponse, errors);
}
 
Example 2
Source File: ResultSetMapper.java    From Summer with MIT License 5 votes vote down vote up
public  <T> T mapper(ResultSet resultSet,Class<T> t){
    if (resultSet==null||resultSet.getResults()==null||
            resultSet.getResults().size()==0||resultSet.getColumnNames()==null
            ){
        return null;
    }
    return mapperOne(resultSet.getColumnNames(),resultSet.getResults().get(0),t);
}
 
Example 3
Source File: ResultSetMapper.java    From Summer with MIT License 5 votes vote down vote up
public  <T> List<T> mapperList(ResultSet resultSet,Class<T> t){
    if (resultSet==null||resultSet.getResults()==null||
            resultSet.getResults().size()==0||resultSet.getColumnNames()==null
            ){
        return null;
    }
    List<T> list = new ArrayList<>();
    for (JsonArray ja:resultSet.getResults()) {
        T mt = mapperOne(resultSet.getColumnNames(),ja,t);
        list.add(mt);
    }

    return list;

}
 
Example 4
Source File: SQLExamples.java    From vertx-jdbc-client with Apache License 2.0 4 votes vote down vote up
public void example3(ResultSet resultSet) {

    List<String> columnNames = resultSet.getColumnNames();

    List<JsonArray> results = resultSet.getResults();

    for (JsonArray row : results) {

      String id = row.getString(0);
      String fName = row.getString(1);
      String lName = row.getString(2);
      int shoeSize = row.getInteger(3);

    }

  }
 
Example 5
Source File: VertxJdbcResultSet.java    From apiman with Apache License 2.0 4 votes vote down vote up
public VertxJdbcResultSet(ResultSet resultSet) {
    this.resultSet = resultSet;
    rows = resultSet.getResults();
}