Preventing false positive in queries returning fields but havinf Count(*) inside them in DboPostgres

This commit is contained in:
José Lorenzo Rodríguez 2010-10-20 23:29:07 -04:30
parent d0fc2fd171
commit 09487f830c

View file

@ -361,7 +361,7 @@ class DboPostgres extends DboSource {
} }
$count = count($fields); $count = count($fields);
if ($count >= 1 && strpos($fields[0], 'COUNT(*)') === false) { if ($count >= 1 && !preg_match('/^\s*COUNT\(/', $fields[0])) {
$result = array(); $result = array();
for ($i = 0; $i < $count; $i++) { for ($i = 0; $i < $count; $i++) {
if (!preg_match('/^.+\\(.*\\)/', $fields[$i]) && !preg_match('/\s+AS\s+/', $fields[$i])) { if (!preg_match('/^.+\\(.*\\)/', $fields[$i]) && !preg_match('/\s+AS\s+/', $fields[$i])) {