projects
/
m6w6
/
pq-gateway
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
tests
[m6w6/pq-gateway]
/
lib
/
pq
/
Query
/
Writer.php
diff --git
a/lib/pq/Query/Writer.php
b/lib/pq/Query/Writer.php
index e25a1fc7d15c71b991b05de81339771b4f531e36..55cb5a2089cfc1a5102b4465fe2b24205bd01dcd 100644
(file)
--- a/
lib/pq/Query/Writer.php
+++ b/
lib/pq/Query/Writer.php
@@
-94,6
+94,9
@@
class Writer
* @return string
*/
function param($param, $type = null) {
* @return string
*/
function param($param, $type = null) {
+ if ($param instanceof \pq\Gateway\Cell) {
+ $param = $param->get();
+ }
if ($param instanceof Expr) {
return (string) $param;
}
if ($param instanceof Expr) {
return (string) $param;
}
@@
-111,14
+114,13
@@
class Writer
*/
function criteria(array $criteria) {
if ((list($left, $right) = each($criteria))) {
*/
function criteria(array $criteria) {
if ((list($left, $right) = each($criteria))) {
- array_shift($criteria);
$this->write("(");
if (is_array($right)) {
$this->criteria($right);
} else {
$this->write("(", $left, $this->param($right), ")");
}
$this->write("(");
if (is_array($right)) {
$this->criteria($right);
} else {
$this->write("(", $left, $this->param($right), ")");
}
-
foreach ($criteria as $left => $right
) {
+
while ((list($left, $right) = each($criteria))
) {
$this->write(is_int($left) && is_array($right) ? "OR" : "AND");
if (is_array($right)) {
$this->criteria($right);
$this->write(is_int($left) && is_array($right) ? "OR" : "AND");
if (is_array($right)) {
$this->criteria($right);
@@
-137,8
+139,6
@@
class Writer
* @return \pq\Result
*/
function exec(\pq\Connection $c) {
* @return \pq\Result
*/
function exec(\pq\Connection $c) {
- fprintf(STDERR, "Q: %s\n", $this);
- fprintf(STDERR, "P: %s\n", implode(", ", $this->params));
return $c->execParams($this, $this->params, $this->types);
}
}
return $c->execParams($this, $this->params, $this->types);
}
}