org.jooq.Record.get()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中org.jooq.Record.get方法的一些代码示例,展示了Record.get的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Record.get方法的具体详情如下:
包路径:org.jooq.Record
类名称:Record
方法名:get

Record.get介绍

[英]Get a value from this record, providing a field index.
[中]从这个记录中获取一个值,提供一个字段索引。

代码示例

代码示例来源:origin: org.jooq/jooq

/**
 * Extract a list of values from a set of records given some fields
 */
private static <R extends Record> List<Object> extractValues(Collection<? extends R> records, TableField<R, ?> field2) {
  List<Object> result = new ArrayList<Object>(records.size());
  for (R record : records)
    result.add(record.get(field2));
  return result;
}

代码示例来源:origin: org.jooq/jooq

@Override
public final Object fetchOne(Name fieldName) {
  R record = fetchOne();
  return record == null ? null : record.get(fieldName);
}

代码示例来源:origin: org.jooq/jooq

private final <K, E> Map<K, E> intoMap0(int kIndex, RecordMapper<? super R, E> mapper) {
  Map<K, E> map = new LinkedHashMap<K, E>();
  for (R record : this)
    if (map.put((K) record.get(kIndex), mapper.map(record)) != null)
      throw new InvalidResultException("Key " + record.get(kIndex) + " is not unique in Result for " + this);
  return map;
}

代码示例来源:origin: org.jooq/jooq

/**
 * Type-safely copy a value from one record to another
 */
static final <T> void setValue(Record target, Field<T> targetField, Record source, Field<?> sourceField) {
  setValue(target, targetField, source.get(sourceField));
}

代码示例来源:origin: org.jooq/jooq

@Override
public final Object fetchOne(int fieldIndex) {
  R record = fetchOne();
  return record == null ? null : record.get(fieldIndex);
}

代码示例来源:origin: org.jooq/jooq

@Override
public final Object fetchAny(Name fieldName) {
  R record = fetchAny();
  return record == null ? null : record.get(fieldName);
}

代码示例来源:origin: org.jooq/jooq

private final <K> Map<K, Result<R>> intoGroups0(int keyFieldIndex) {
  Map<K, Result<R>> map = new LinkedHashMap<K, Result<R>>();
  for (R record : this) {
    K val = (K) record.get(keyFieldIndex);
    Result<R> result = map.get(val);
    if (result == null)
      map.put(val, result = new ResultImpl<R>(configuration, fields));
    result.add(record);
  }
  return map;
}

代码示例来源:origin: org.jooq/jooq

@Override
public String getString(int parameterIndex) throws SQLException {
  String value = outParameters().get(translate(parameterIndex), String.class);
  resultWasNull = value == null;
  return value;
}

代码示例来源:origin: org.jooq/jooq

@Override
public boolean getBoolean(int parameterIndex) throws SQLException {
  Boolean value = outParameters().get(translate(parameterIndex), Boolean.class);
  resultWasNull = value == null;
  return value == null ? false : value;
}

代码示例来源:origin: org.jooq/jooq

@Override
public byte getByte(int parameterIndex) throws SQLException {
  Byte value = outParameters().get(translate(parameterIndex), Byte.class);
  resultWasNull = value == null;
  return value == null ? (byte) 0 : value;
}

代码示例来源:origin: org.jooq/jooq

@Override
public int getInt(int parameterIndex) throws SQLException {
  Integer value = outParameters().get(translate(parameterIndex), Integer.class);
  resultWasNull = value == null;
  return value == null ? 0 : value;
}

代码示例来源:origin: org.jooq/jooq

@Override
public BigDecimal getBigDecimal(int parameterIndex) throws SQLException {
  BigDecimal value = outParameters().get(translate(parameterIndex), BigDecimal.class);
  resultWasNull = value == null;
  return value;
}
@Override

代码示例来源:origin: org.jooq/jooq

@Override
public byte[] getBytes(int parameterIndex) throws SQLException {
  byte[] value = outParameters().get(translate(parameterIndex), byte[].class);
  resultWasNull = value == null;
  return value;
}

代码示例来源:origin: org.jooq/jooq

@Override
public Date getDate(int parameterIndex, Calendar cal) throws SQLException {
  Date value = outParameters().get(translate(parameterIndex), Date.class);
  resultWasNull = value == null;
  return value;
}

代码示例来源:origin: org.jooq/jooq

@Override
public Object getObject(int parameterIndex) throws SQLException {
  Object value = outParameters().get(translate(parameterIndex));
  resultWasNull = value == null;
  return value;
}

代码示例来源:origin: org.jooq/jooq

@Override
public float getFloat(int parameterIndex) throws SQLException {
  Float value = outParameters().get(translate(parameterIndex), Float.class);
  resultWasNull = value == null;
  return value == null ? 0.0f : value;
}

代码示例来源:origin: org.jooq/jooq

@Override
public Date getDate(int parameterIndex) throws SQLException {
  Date value = outParameters().get(translate(parameterIndex), Date.class);
  resultWasNull = value == null;
  return value;
}

代码示例来源:origin: org.jooq/jooq

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final void setRecord(R record) {
  for (int i = 0; i < record.size(); i++)
    if (record.changed(i))
      addValue((Field) record.field(i), record.get(i));
}

代码示例来源:origin: org.jooq/jooq

private <T> T get(String columnLabel, Class<T> type) throws SQLException {
  checkInRange();
  Converter<?, ?> converter = Converters.inverse(field(columnLabel).getConverter());
  T value = Convert.convert(result.get(index - 1).get(columnLabel, converter), type);
  wasNull = (value == null);
  return value;
}

代码示例来源:origin: org.jooq/jooq

private <T> T get(int columnIndex, Class<T> type) throws SQLException {
  checkInRange();
  Converter<?, ?> converter = Converters.inverse(field(columnIndex).getConverter());
  T value = Convert.convert(result.get(index - 1).get(columnIndex - 1, converter), type);
  wasNull = (value == null);
  return value;
}

相关文章