Skip to content

Commit

Permalink
Preventing false positive in queries returning fields but havinf Coun…
Browse files Browse the repository at this point in the history
…t(*) inside them in DboPostgres
  • Loading branch information
lorenzo committed Oct 21, 2010
1 parent d0fc2fd commit 09487f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cake/libs/model/datasources/dbo/dbo_postgres.php
Expand Up @@ -361,7 +361,7 @@ function fields(&$model, $alias = null, $fields = array(), $quote = true) {
}
$count = count($fields);

if ($count >= 1 && strpos($fields[0], 'COUNT(*)') === false) {
if ($count >= 1 && !preg_match('/^\s*COUNT\(/', $fields[0])) {
$result = array();
for ($i = 0; $i < $count; $i++) {
if (!preg_match('/^.+\\(.*\\)/', $fields[$i]) && !preg_match('/\s+AS\s+/', $fields[$i])) {
Expand Down

0 comments on commit 09487f8

Please sign in to comment.