Permalink
Browse files

Database: fixed mysql auto select cols in grouped queries

  • Loading branch information...
hrach authored and dg committed Oct 1, 2012
1 parent cf32801 commit 01c82545210fe5f0dc875bd435a216e744b8dc6e
@@ -227,7 +227,7 @@ public function getForeignKeys($table)
*/
public function isSupported($item)
{
- return $item === self::SUPPORT_COLUMNS_META;
+ return $item === self::SUPPORT_COLUMNS_META || $item == self::SUPPORT_SELECT_UNGROUPED_COLUMNS;
}
}
@@ -23,7 +23,8 @@
interface ISupplementalDriver
{
const SUPPORT_COLUMNS_META = 'meta',
- SUPPORT_SEQUENCE = 'sequence';
+ SUPPORT_SEQUENCE = 'sequence',
+ SUPPORT_SELECT_UNGROUPED_COLUMNS = 'ungrouped_cols';
/**
* Delimites identifier for use in a SQL statement.
@@ -12,6 +12,7 @@
namespace Nette\Database\Table;
use Nette,
+ Nette\Database\ISupplementalDriver,
PDO;
@@ -272,7 +273,7 @@ public function buildSelectQuery()
$cols = array_map(array($this->connection->getSupplementalDriver(), 'delimite'), array_keys(array_filter($prevAccessed)));
$cols = $prefix . implode(', ' . $prefix, $cols);
- } elseif ($this->group) {
+ } elseif ($this->group && !$this->connection->getSupplementalDriver()->isSupported(ISupplementalDriver::SUPPORT_SELECT_UNGROUPED_COLUMNS)) {
$cols = $this->tryDelimite($this->removeExtraTables($this->group));
} else {

0 comments on commit 01c8254

Please sign in to comment.