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

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

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

Record.set介绍

[英]Set a value into this record.

This will always set the #changed(Field) flag for the given field, no matter if setting the value actually changes the value.

Changing Table#getPrimaryKey() values will set all #changed() flags to true, in order to produce complete INSERT statements on subsequent UpdatableRecord#store() operations.
[中]在该记录中设置一个值。
这将始终为给定的field设置#更改(字段)标志,无论设置值是否实际更改了值。
更改表#getPrimaryKey()值将把所有#changed()标志设置为true,以便在后续的UpdateableRecord#store()操作中生成完整的INSERT语句。

代码示例

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

/**
   * Extracted method to ensure generic type safety.
   */
  private final <T> void setValue(Record record, Field<T> field) {
    record.set(field, get(field));
  }
});

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

/**
 * Type-safely set a value to a record
 */
static final <T> void setValue(Record target, Field<T> targetField, Object value) {
  target.set(targetField, targetField.getDataType().convert(value));
}

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

private static final <T> void pgSetValue(Record record, Field<T> field, String value) {
  record.set(field, pgFromString(field.getConverter(), value));
}

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

@SuppressWarnings("unchecked")
protected /* non-final */ T compositeKeyRecord(Object... values) {
  UniqueKey<R> key = table.getPrimaryKey();
  if (key == null)
    return null;
  TableField<R, Object>[] fields = (TableField<R, Object>[]) key.getFieldsArray();
  Record result = DSL.using(configuration)
            .newRecord(fields);
  for (int i = 0; i < values.length; i++)
    result.set(fields[i], fields[i].getDataType().convert(values[i]));
  return (T) result;
}

代码示例来源:origin: jklingsporn/vertx-jooq

@SuppressWarnings("unchecked")
protected /* non-final */ T compositeKeyRecord(Object... values) {
  UniqueKey<R> key = table.getPrimaryKey();
  if (key == null)
    return null;
  TableField<R, Object>[] fields = (TableField<R, Object>[]) key.getFieldsArray();
  Record result = DSL.using(queryExecutor.configuration())
      .newRecord(fields);
  for (int i = 0; i < values.length; i++)
    result.set(fields[i], fields[i].getDataType().convert(values[i]));
  return (T) result;
}

代码示例来源:origin: io.github.jklingsporn/vertx-jooq-shared

@SuppressWarnings("unchecked")
protected /* non-final */ T compositeKeyRecord(Object... values) {
  UniqueKey<R> key = table.getPrimaryKey();
  if (key == null)
    return null;
  TableField<R, Object>[] fields = (TableField<R, Object>[]) key.getFieldsArray();
  Record result = DSL.using(queryExecutor.configuration())
      .newRecord(fields);
  for (int i = 0; i < values.length; i++)
    result.set(fields[i], fields[i].getDataType().convert(values[i]));
  return (T) result;
}

代码示例来源:origin: jklingsporn/vertx-jooq

/**
 * Defaults fields that have a default value and are nullable.
 * @param record the record
 * @return the record
 */
private Record setDefault(Record record) {
  int size = record.size();
  for (int i = 0; i < size; i++)
    if (record.get(i) == null) {
      @SuppressWarnings("unchecked")
      Field<Object> field = (Field<Object>) record.field(i);
      if (!field.getDataType().nullable() && !field.getDataType().identity())
        record.set(field, DSL.defaultValue());
    }
  return record;
}

代码示例来源:origin: io.github.jklingsporn/vertx-jooq-shared

/**
 * Defaults fields that have a default value and are nullable.
 * @param record the record
 * @return the record
 */
private Record setDefault(Record record) {
  int size = record.size();
  for (int i = 0; i < size; i++)
    if (record.get(i) == null) {
      @SuppressWarnings("unchecked")
      Field<Object> field = (Field<Object>) record.field(i);
      if (!field.getDataType().nullable() && !field.getDataType().identity())
        record.set(field, DSL.defaultValue());
    }
  return record;
}

相关文章