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

The following examples show how to use io.vertx.sqlclient.Row#get() . 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: PgClientExamples.java    From vertx-sql-client with Apache License 2.0 5 votes vote down vote up
public void numericExample(Row row) {
  Numeric numeric = row.get(Numeric.class, 0);
  if (numeric.isNaN()) {
    // Handle NaN
  } else {
    BigDecimal value = numeric.bigDecimalValue();
  }
}
 
Example 2
Source File: DB2DataTypeTest.java    From vertx-sql-client with Apache License 2.0 5 votes vote down vote up
private RowId verifyRowId(TestContext ctx, RowSet<Row> rows, String msg) {
  ctx.assertEquals(1, rows.size());
  Row row = rows.iterator().next();
  ctx.assertEquals(msg, row.getString(1));
  RowId rowid = row.get(RowId.class, 0);
  ctx.assertNotNull(rowid);
  ctx.assertEquals(22, rowid.getBytes().length);
  return rowid;
}
 
Example 3
Source File: MySQLClientExamples.java    From vertx-sql-client with Apache License 2.0 5 votes vote down vote up
public void numericExample(Row row) {
  Numeric numeric = row.get(Numeric.class, 0);
  if (numeric.isNaN()) {
    // Handle NaN
  } else {
    BigDecimal value = numeric.bigDecimalValue();
  }
}
 
Example 4
Source File: RowTest.java    From vertx-sql-client with Apache License 2.0 4 votes vote down vote up
private static <T> Function<String, T> accessor(Row row, Class<T> type) {
  return name -> {
    int idx = row.getColumnIndex(name);
    return idx == -1 ? null : row.get(type, idx);
  };
}
 
Example 5
Source File: RowTest.java    From vertx-sql-client with Apache License 2.0 4 votes vote down vote up
private static <T> Function<String, T[]> arrayAccessor(Row row, Class<T> type) {
  return name -> {
    int idx = row.getColumnIndex(name);
    return idx == -1 ? null : (T[]) row.get(Array.newInstance(type, 0).getClass(), idx);
  };
}
 
Example 6
Source File: JsonAccessor.java    From vertx-jooq with MIT License 4 votes vote down vote up
public static JsonObject getJsonObject(Row row, String field){
    return row.get(JsonObject.class,row.getColumnIndex(field));
}
 
Example 7
Source File: JsonAccessor.java    From vertx-jooq with MIT License 4 votes vote down vote up
public static JsonArray getJsonArray(Row row, String field){
    return row.get(JsonArray.class,row.getColumnIndex(field));
}