mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix COUNT(DISTINCT x) queries from getting corrupted in Sqlserver.
Add into the tower of hacks that is the SQL generation and stop breaking COUNT(DISTINCT foo) style queries. Previously these would be converted into DISTINCT COUNT(foo) which will give the non-distinct results.
This commit is contained in:
parent
0f8dae55c9
commit
16be5722ba
1 changed files with 1 additions and 1 deletions
|
@ -278,7 +278,7 @@ class Sqlserver extends DboSource {
|
||||||
for ($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
$prepend = '';
|
$prepend = '';
|
||||||
|
|
||||||
if (strpos($fields[$i], 'DISTINCT') !== false) {
|
if (strpos($fields[$i], 'DISTINCT') !== false && strpos($fields[$i], 'COUNT') === false) {
|
||||||
$prepend = 'DISTINCT ';
|
$prepend = 'DISTINCT ';
|
||||||
$fields[$i] = trim(str_replace('DISTINCT', '', $fields[$i]));
|
$fields[$i] = trim(str_replace('DISTINCT', '', $fields[$i]));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue