Permalink
Browse files

make sure all execute() calls use the defined database connection

  • Loading branch information...
1 parent 2b0beae commit a039ae5efc9909bab2e88f0e6d53d12f1dc23382 @WanWizard WanWizard committed Dec 1, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 classes/model/crud.php
@@ -244,7 +244,7 @@ public static function count($column = null, $distinct = true, $where = array(),
if ( ! empty($group_by))
{
- $result = $query->select($group_by)->group_by($group_by)->execute()->as_array();
+ $result = $query->select($group_by)->group_by($group_by)->execute(isset(static::$_connection) ? static::$_connection : null)->as_array();
$counts = array();
foreach ($result as $res)
{
@@ -254,7 +254,7 @@ public static function count($column = null, $distinct = true, $where = array(),
return $counts;
}
- $count = $query->execute()->get('count_result');
+ $count = $query->execute(isset(static::$_connection) ? static::$_connection : null)->get('count_result');
if ($count === null)
{

0 comments on commit a039ae5

Please sign in to comment.