10 * @var \pq\Gateway\Row
25 * @param \pq\Gateway\Row $row
29 function __construct(Row
$row, $name, $data) {
39 function __toString() {
40 return (string) $this->data
;
44 * Test whether the value is an unevaluated expression
48 return $this->data
instanceof Expr
;
60 * Modify the value in this cell
62 * @param string $op a specific operator
63 * @return \pq\Gateway\Cell
65 function mod($data, $op = null) {
66 if (!($this->data
instanceof Expr
)) {
67 if (!isset($this->data
)) {
68 $this->data
= new Expr($this->name
);
69 } elseif (is_numeric($this->data
)) {
70 $this->data
= new Expr($this->data
);
72 $this->data
= new Expr("%s", $this->row
->getTable()->getConnection()->quote($this->data
));
76 if ($data instanceof Expr
) {
77 $this->data
->add($data);
78 } elseif (!isset($op) && is_numeric($data)) {
79 $this->data
->add(new Expr("+ $data"));
81 $data = $this->row
->getTable()->getConnection()->quote($data);
82 $this->data
->add(new Expr("%s %s"), isset($op) ?
$op : "||", $data);
88 * Set the value in this cell
90 * @return \pq\Gateway\Cell