Permalink
Browse files

Fix missing check for COUNT(DISTINCT in DboMSSQL

Fixes #2470
  • Loading branch information...
1 parent 340a9fd commit f867f0c97fff319aae63a8a96a39d1f28c47c5e7 @markstory markstory committed Jan 13, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 cake/libs/model/datasources/dbo/dbo_mssql.php
View
6 cake/libs/model/datasources/dbo/dbo_mssql.php
@@ -325,7 +325,11 @@ function fields(&$model, $alias = null, $fields = array(), $quote = true) {
$fields = parent::fields($model, $alias, $fields, false);
$count = count($fields);
- if ($count >= 1 && strpos($fields[0], 'COUNT(*)') === false) {
+ if (
+ $count >= 1 &&
+ strpos($fields[0], 'COUNT(*)') === false &&
+ strpos($fields[0], 'COUNT(DISTINCT') === false
+ ) {
$result = array();
for ($i = 0; $i < $count; $i++) {
$prepend = '';

0 comments on commit f867f0c

Please sign in to comment.