From 66161f86dcf5e88b187ad0a40bdacb9b184583ea Mon Sep 17 00:00:00 2001 From: Jamie Furness Date: Sun, 20 Mar 2011 23:39:19 +0000 Subject: [PATCH] Adding condition support using simple strings. --- dialect.php | 6 +++--- query.php | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dialect.php b/dialect.php index 8fb6bc0..6b2be2b 100644 --- a/dialect.php +++ b/dialect.php @@ -98,7 +98,7 @@ protected function update(UpdateQuery $query) if (!empty($query->order)) $sql .= $this->order($query->order); - if ($limit > 0 || $offset > 0) + if ($query->limit > 0 || $query->offset > 0) $sql .= $this->limit_offset($query->limit, $query->offset); return $sql; @@ -117,7 +117,7 @@ protected function delete(DeleteQuery $query) if (!empty($query->order)) $sql .= $this->order($query->order); - if ($limit > 0 || $offset > 0) + if ($query->limit > 0 || $query->offset > 0) $sql .= $this->limit_offset($query->limit, $query->offset); return $sql; @@ -178,7 +178,7 @@ protected function having($having) protected function conditions($conditions) { - return '(???)'; // TODO + return '('.$conditions.')'; } protected function order($order) diff --git a/query.php b/query.php index 1dd7bf8..dc126ba 100644 --- a/query.php +++ b/query.php @@ -50,8 +50,8 @@ public function __construct($fields, $table = null) $this->group = array(); $this->order = array(); $this->joins = array(); - $this->where = array(); - $this->having = array(); + $this->where = ''; + $this->having = ''; $this->limit = 0; $this->offset = 0; } @@ -68,7 +68,7 @@ public function __construct($type, $table) $this->type = $type; $this->table = $table; - $this->on = array(); + $this->on = ''; } } @@ -114,7 +114,7 @@ public function __construct($values, $table) $this->table = $table; $this->order = array(); - $this->where = array(); + $this->where = ''; $this->limit = 0; $this->offset = 0; } @@ -134,7 +134,7 @@ public function __construct($table) $this->table = $table; $this->order = array(); - $this->where = array(); + $this->where = ''; $this->limit = 0; $this->offset = 0; }