10 protected $expression;
18 * @param string $e the expression or a format string followed by arguments
21 function __construct($e, $arg = null) {
22 if (func_num_args() > 1) {
23 $e = call_user_func_array("sprintf", func_get_args());
25 $this->expression
= trim($e);
29 * Get the string expression
32 function __toString() {
33 $string = $this->expression
;
35 $string .= " " . $this->next
;
37 return (string) $string;
45 return !strcasecmp($this->expression
, "null");
49 * Append an expresssion
50 * @param \pq\Query\Expr $next
51 * @return \pq\Query\Expr $this
52 * @throws \UnexpectedValueException if any expr is NULL
54 function add(Expr
$next) {
55 if ($this->isNull() ||
$next->isNull()) {
56 throw new \
UnexpectedValueException("Cannot add anything to NULL");
58 for ($that = $this; $that->next
; $that = $that->next
);