Ejemplo n.º 1
0
  /**
   * 在更新数据库值时,可能需要的判断是否改变值相同 其内部不一定是对象相同的情况下,有可能相对于数据库值是相同的
   *
   * @param odr
   * @return
   */
  public boolean checkRowEquals4DB(DataRow odr) {
    if (odr == null) return false;

    for (DataColumn dc : this.belongToDT.getColumns()) {
      Object thisv = this.getValue(dc.getName());
      Object ov = odr.getValue(dc.getName());
      if (thisv == null) {
        if (ov != null) return false;
      } else {
        if (thisv.equals(ov)) continue;

        if (ov == null) return false;

        if (thisv instanceof java.util.Date && ov instanceof java.util.Date) {
          // ((java.util.Date)thisv).
          // 时间存入数据库之后,纳秒内容会被删除,所以只需要秒相同,就认为相同
          long t1 = ((java.util.Date) thisv).getTime() / 1000;
          long t2 = ((java.util.Date) ov).getTime() / 1000;
          if (t1 != t2) return false;
        }
      }
    }

    return true;
  }
Ejemplo n.º 2
0
 public Object getStoredValue(DataRow row) {
   return row.getValue(this);
 }
Ejemplo n.º 3
0
 public void calculateValue(DataRow row) {
   row.setValue(this, getSpecifier().getValue(row));
   // System.err.println("Set value for " + this + " (" + this.getClass() + "): " +
   // getSpecifier().getValue(row));
 }