diff --git a/CHANGELOG.md b/CHANGELOG.md index 1eaf425..a896004 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ ### Changelog +##### v1.9.8 ++ Updated `SelectStatement` class with: + - Fixed `getColumns()` method ++ Updated `WhereClause` class with: + - Reverted `__toString()` method ++ Updated `HavingClause` class with: + - Reverted `__toString()` method + ##### v1.9.7 + Updated `WhereClause` class with: - Fixed some weird bug in `__toString()` method diff --git a/composer.json b/composer.json index 80b6888..dca7888 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "slim/pdo", "description": "PDO database library for Slim Framework", - "version": "1.9.7", + "version": "1.9.8", "type": "library", "keywords": ["pdo", "database", "slim", "framework"], "homepage": "https://github.com/FaaPz/Slim-PDO", diff --git a/src/PDO/Clause/HavingClause.php b/src/PDO/Clause/HavingClause.php index 1a9c1ba..26e9dbb 100644 --- a/src/PDO/Clause/HavingClause.php +++ b/src/PDO/Clause/HavingClause.php @@ -102,6 +102,6 @@ public function __toString() $args[] = $having; } - return ' HAVING '.ltrim(preg_replace('/AND/', '', implode('', $args))); + return ' HAVING '.ltrim(implode('', $args), ' AND'); } } diff --git a/src/PDO/Clause/WhereClause.php b/src/PDO/Clause/WhereClause.php index 60e1759..4992ced 100644 --- a/src/PDO/Clause/WhereClause.php +++ b/src/PDO/Clause/WhereClause.php @@ -227,6 +227,6 @@ public function __toString() $args[] = $where; } - return ' WHERE '.ltrim(preg_replace('/AND/', '', implode('', $args))); + return ' WHERE '.ltrim(implode('', $args), ' AND'); } } diff --git a/src/PDO/Statement/SelectStatement.php b/src/PDO/Statement/SelectStatement.php index 731450f..43f732e 100644 --- a/src/PDO/Statement/SelectStatement.php +++ b/src/PDO/Statement/SelectStatement.php @@ -427,10 +427,6 @@ protected function getSelect() */ protected function getColumns() { - if ($this->aggregate) { - array_splice($this->columns, 0, -1); - } - return implode(' , ', $this->columns); }