Java Code Examples for io.vertx.sqlclient.Row#getValue()

The following examples show how to use io.vertx.sqlclient.Row#getValue() . 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: TenantStorePostgres.java    From okapi with Apache License 2.0 6 votes vote down vote up
private void updateModuleR(PostgresQuery q, String id,
                           SortedMap<String, Boolean> enabled,
                           Iterator<Row> it, Handler<ExtendedAsyncResult<Void>> fut) {

  if (!it.hasNext()) {
    fut.handle(new Success<>());
    q.close();
    return;
  }
  Row r = it.next();
  String sql = "UPDATE " + TABLE + " SET " + JSON_COLUMN + " = $2 WHERE " + ID_SELECT;
  JsonObject o = (JsonObject) r.getValue(0);
  Tenant t = o.mapTo(Tenant.class);
  t.setEnabled(enabled);
  JsonObject doc = JsonObject.mapFrom(t);
  q.query(sql, Tuple.of(id, doc), res -> {
    if (res.failed()) {
      fut.handle(new Failure<>(ErrorType.INTERNAL, res.cause()));
    } else {
      updateModuleR(q, id, enabled, it, fut);
    }
  });
}
 
Example 2
Source File: AbstractReactiveVertxDAO.java    From vertx-jooq with MIT License 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
protected Function<Object,T> keyConverter(){
    return o -> {
        Row row = (Row) o;
        TableField<R, ?>[] fields = getTable().getPrimaryKey().getFieldsArray();
        if(fields.length == 1){
            return (T)row.getValue(fields[0].getName());
        }
        Object[] values = new Object[row.size()];
        for(int i=0;i<row.size();i++){
            values[i] = row.getValue(i);
        }
        return compositeKeyRecord(values);
    };
}
 
Example 3
Source File: SqlClientConnection.java    From hibernate-reactive with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Object[] next() {
	Row row = it.next();
	Object[] result = new Object[ row.size() ];
	for (int i=0; i<result.length; i++) {
		result[i] = row.getValue(i);
	}
	return result;
}