Browse files

BUGFIX Ensure end bracket for HAVING clause is put in the right place

  • Loading branch information...
1 parent 5f5197b commit e50f90bf8e0bac44bb8431dc18c29029e22f432b @halkyon halkyon committed May 7, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 model/Database.php
View
4 model/Database.php
@@ -783,7 +783,7 @@ public function sqlGroupByToString($groupby) {
* @return string
*/
public function sqlHavingToString($having) {
- return ' HAVING ( ' . implode(' ) AND ( ', $having);
+ return ' HAVING ( ' . implode(' ) AND ( ', $having) . ')';
}
/**
@@ -829,7 +829,7 @@ public function sqlQueryToString(SQLQuery $query) {
// these clauses only make sense in SELECT queries, not DELETE
if(!$query->getDelete()) {
if($query->getGroupBy()) $text .= $this->sqlGroupByToString($query->getGroupBy());
- if($query->getHaving()) $text .= $this->sqlHavingToString($query->getHaving()) . ' )';
+ if($query->getHaving()) $text .= $this->sqlHavingToString($query->getHaving());
if($query->getOrderBy()) $text .= $this->sqlOrderByToString($query->getOrderBy());
if($query->getLimit()) $text .= $this->sqlLimitToString($query->getLimit());
}

0 comments on commit e50f90b

Please sign in to comment.