*/
protected $data;
+ /**
+ * @var bool
+ */
+ protected $dirty;
+
/**
* @param \pq\Gateway\Row $row
* @param string $name
* @param mixed $data
+ * @param bool $dirty
*/
- function __construct(Row $row, $name, $data) {
+ function __construct(Row $row, $name, $data, $dirty = false) {
$this->row = $row;
$this->name = $name;
$this->data = $data;
+ $this->dirty = $dirty;
}
/**
return $this->data instanceof Expr;
}
+ /**
+ * Check whether the cell has been modified
+ * @return bool
+ */
+ function isDirty() {
+ return $this->dirty;
+ }
+
/**
* Get value
* @return mixed
function mod($data, $op = null) {
if (!($this->data instanceof Expr)) {
$this->data = new Expr($this->name);
- /*
- if (!isset($this->data)) {
- $this->data = new Expr($this->name);
- } elseif (is_numeric($this->data)) {
- $this->data = new Expr($this->data);
- } else {
- $this->data = new Expr("%s", $this->row->getTable()->getConnection()->quote($this->data));
- }
- */
}
if ($data instanceof Expr) {
$data = $this->row->getTable()->getConnection()->quote($data);
$this->data->add(new Expr("%s %s"), isset($op) ? $op : "||", $data);
}
+
+ $this->dirty = true;
+
return $this;
}
*/
function set($data) {
$this->data = $data;
+ $this->dirty = true;
return $this;
}
}