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

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

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

Record.changed介绍

[英]Check if this record has been changed from its original as fetched from the database.

If this returns false, then it can be said that record.equals(record.original()) is true.
[中]检查此记录是否已从数据库中获取的原始记录更改。
如果返回false,那么可以说record.equals(record.original())是真的。

代码示例

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

@Override
public final boolean changed(Record record) {
  return record.changed(this);
}

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

/**
 * This method was implemented with [#799]. It may be useful to make it
 * public for broader use...?
 */
protected final void from(Record source) {
  for (Field<?> field : fields.fields.fields) {
    Field<?> sourceField = source.field(field);
    if (sourceField != null && source.changed(sourceField))
      Tools.setValue(this, field, source, sourceField);
  }
}

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

/**
 * Turn a {@link Record} into a {@link Map}
 */
static final Map<Field<?>, Object> mapOfChangedValues(Record record) {
  Map<Field<?>, Object> result = new LinkedHashMap<Field<?>, Object>();
  int size = record.size();
  for (int i = 0; i < size; i++)
    if (record.changed(i))
      result.put(record.field(i), record.get(i));
  return result;
}

代码示例来源:origin: rancher/cattle

Record resultRecord = classes.get(i).newInstance();
  resultRecord.fromMap(map);
  resultRecord.changed(false);
  result.add(resultRecord);
} else {

代码示例来源: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: com.ning.billing/killbill-osgi-bundles-analytics

@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.getValue(i));
    }
  }
}

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

/**
 * [#2700] [#3582] If a POJO attribute is NULL, but the column is NOT NULL
 * then we should let the database apply DEFAULT values
 */
static final void resetChangedOnNotNull(Record record) {
  int size = record.size();
  for (int i = 0; i < size; i++)
    if (record.get(i) == null)
      if (!record.field(i).getDataType().nullable())
        record.changed(i, false);
}

代码示例来源:origin: StubbornJava/StubbornJava

/**
   * [#2700] [#3582] If a POJO attribute is NULL, but the column is NOT NULL
   * then we should let the database apply DEFAULT values
   */
  private static final void resetChangedOnNotNull(Record record) {
    int size = record.size();

    for (int i = 0; i < size; i++)
      if (record.get(i) == null)
        if (!record.field(i).getDataType().nullable())
          record.changed(i, false);
  }
}

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

@SuppressWarnings({ "rawtypes", "unchecked" })
private Record record(Configuration configuration, Routine<?> routine) {
  Record result = null;
  List<Field<?>> fields = new ArrayList<Field<?>>(1 + routine.getOutParameters().size());
  Parameter<?> returnParam = routine.getReturnParameter();
  if (returnParam != null)
    fields.add(field(name(returnParam.getName()), returnParam.getDataType()));
  for (Parameter<?> param : routine.getOutParameters())
    fields.add(field(name(param.getName()), param.getDataType()));
  if (fields.size() > 0) {
    result = DSL.using(configuration).newRecord(fields.toArray(new Field[0]));
    int i = 0;
    if (returnParam != null)
      result.setValue((Field) fields.get(i++), routine.getValue(returnParam));
    for (Parameter<?> param : routine.getOutParameters())
      result.setValue((Field) fields.get(i++), routine.getValue(param));
    result.changed(false);
  }
  return result;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

value = format0(getValue(i, index), get(i).changed(index));
  decimalPlacesList.add(getDecimalPlaces(value));
value = format0(getValue(i, index), get(i).changed(index));
String value = format0(getValue(i, index), get(i).changed(index)).replace("\n", "{lf}").replace("\r", "{cr}");

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

/**
 * [#2591] Type-safely copy a value from one record to another, preserving flags.
 */
static final <T> void copyValue(AbstractRecord target, Field<T> targetField, Record source, Field<?> sourceField) {
  DataType<T> targetType = targetField.getDataType();
  int targetIndex = indexOrFail(target.fieldsRow(), targetField);
  int sourceIndex = indexOrFail(source.fieldsRow(), sourceField);
  target.values[targetIndex] = targetType.convert(source.get(sourceIndex));
  target.originals[targetIndex] = targetType.convert(source.original(sourceIndex));
  target.changed.set(targetIndex, source.changed(sourceIndex));
}

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

decimalPlacesList.add(decimalPlaces(format0(record.get(index), record.changed(index), true)));
String value = format0(record.get(index), record.changed(index), true);
    StringUtils.replace(
      StringUtils.replace(
        format0(record.get(index), record.changed(index), true), "\n", "{lf}"
      ), "\r", "{cr}"
    ), "\t", "{tab}"

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

/**
 * [#2591] Type-safely copy a value from one record to another, preserving flags.
 */
static final <T> void copyValue(AbstractRecord target, Field<T> targetField, Record source, Field<?> sourceField) {
  Value<T> value = new Value<T>(
    targetField.getDataType().convert(source.getValue(sourceField)),
    targetField.getDataType().convert(source.original(sourceField)),
    source.changed(sourceField)
  );
  target.setValue(targetField, value);
}

相关文章