aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authoricewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-05-28 12:08:46 +0000
committericewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-05-28 12:08:46 +0000
commit866193490529d2ca2283839eb4b22b4cca09911e (patch)
tree3cb594a1faa111adf99414e76155dfa445995c82 /engine/lib
parent098700aa6c409b844fd38299156927e4cd12a3b2 (diff)
downloadelgg-866193490529d2ca2283839eb4b22b4cca09911e.tar.gz
elgg-866193490529d2ca2283839eb4b22b4cca09911e.tar.bz2
Marcus Povey <marcus@dushka.co.uk>
* Fixed Where, WhereStatic and WhereSet git-svn-id: https://code.elgg.org/elgg/trunk@739 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/database.php24
1 files changed, 15 insertions, 9 deletions
diff --git a/engine/lib/database.php b/engine/lib/database.php
index f18603d8c..13cd3053a 100644
--- a/engine/lib/database.php
+++ b/engine/lib/database.php
@@ -236,9 +236,14 @@
$this->right_field = sanitise_string($right_field);
}
+ public function toStringNoLink()
+ {
+ return "{$this->left_table }.{$this->left_field} {$this->operator} {$this->right_table}.{$this->right_field}";
+ }
+
function __toString()
{
- return "{$this->link_operator} {$this->left_table }.{$this->left_field} {$this->operator} {$this->right_table}.{$this->right_field}";
+ return "{$this->link_operator} " . $this->toStringNoLink();
}
}
@@ -269,12 +274,12 @@
if (is_numeric($value))
$this->value = (int)$value;
else
- $this->value = sanitise_string($value);
+ $this->value = "'".sanitise_string($value)."'";
}
- function __toString()
+ public function toStringNoLink()
{
- return "{$this->link_operator} {$this->left_table }.{$this->left_field} {$this->operator} {$this->right_table}.{$this->right_field}";
+ return "{$this->left_table }.{$this->left_field} {$this->operator} {$this->value}";
}
}
@@ -292,18 +297,19 @@
$this->wheres = $wheres;
}
- function __toString()
+ public function toStringNoLink()
{
$cnt = 0;
- $string = "{$this->link_operator} (";
+ $string = " (";
foreach ($this->wheres as $where) {
if (!($where instanceof WhereQueryComponent))
throw new DatabaseException("Where set contains non WhereQueryComponent");
if (!$cnt)
- $string .= "{$where->link_operator} ";
-
- $string .= " {$where->left_table }.{$where->left_field} {$where->operator} {$where->right_table}.{$where->right_field}";
+ $string.= $where->toStringNoLink();
+ else
+ $string.=" $where ";
+
$cnt ++;
}
$string .= ")";