Skip to content
Snippets Groups Projects
Commit 5f244b45 authored by Jared Hancock's avatar Jared Hancock
Browse files

orm: Ensure numeric results from select count()

parent 2fbe7f80
Branches
Tags
No related merge requests found
...@@ -2603,7 +2603,7 @@ class MySqlCompiler extends SqlCompiler { ...@@ -2603,7 +2603,7 @@ class MySqlCompiler extends SqlCompiler {
$exec = $q->getQuery(array('nosort' => true)); $exec = $q->getQuery(array('nosort' => true));
$exec->sql = 'SELECT COUNT(*) FROM ('.$exec->sql.') __'; $exec->sql = 'SELECT COUNT(*) FROM ('.$exec->sql.') __';
$row = $exec->getRow(); $row = $exec->getRow();
return $row ? $row[0] : null; return is_array($row) ? (int) $row[0] : null;
} }
function compileSelect($queryset) { function compileSelect($queryset) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment