X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fpq-gateway;a=blobdiff_plain;f=lib%2Fpq%2FQuery%2FExpr.php;fp=lib%2Fpq%2FQuery%2FExpr.php;h=31e8c969b290f21a3653a6a20e3faae7fa465846;hp=0f3d86e52ba1db3ae3cfb99ca9391e7f3e2396e1;hb=81ec79d85ff8d9254a4bf0ffa534a11f4603d60b;hpb=5803d081bb5af5faeee20da91dd2c70d8686774b diff --git a/lib/pq/Query/Expr.php b/lib/pq/Query/Expr.php index 0f3d86e..31e8c96 100644 --- a/lib/pq/Query/Expr.php +++ b/lib/pq/Query/Expr.php @@ -18,7 +18,7 @@ class Expr * @param string $e the expression or a format string followed by arguments * @param string ... */ - function __construct($e, $arg = null) { + function __construct($e) { if (func_num_args() > 1) { $e = call_user_func_array("sprintf", func_get_args()); } @@ -52,11 +52,14 @@ class Expr * @throws \UnexpectedValueException if any expr is NULL */ function add(Expr $next) { - if ($this->isNull() || $next->isNull()) { + if ($this->isNull()) { throw new \UnexpectedValueException("Cannot add anything to NULL"); } - for ($that = $this; $that->next; $that = $that->next); - $that->next = $next; + if ($this->next) { + $this->next->add($next); + } else { + $this->next = $next; + } return $this; } }