Index: /branches/release-41/lib/MT/ObjectDriver/Driver/DBI.pm
===================================================================
--- /branches/release-41/lib/MT/ObjectDriver/Driver/DBI.pm (revision 2629)
+++ /branches/release-41/lib/MT/ObjectDriver/Driver/DBI.pm (revision 2664)
@@ -222,4 +222,6 @@
         my @returnvals = map { $$_ } @bindvars;
         $i++;
+        $class->call_trigger('post_group_by', \$count, \@returnvals)
+            unless $args->{no_triggers};
         return($count, @returnvals);
     };
@@ -261,5 +263,8 @@
     $stmt->add_select($select => $select);
     my $sql = $stmt->as_sql;
-    $driver->select_one($sql, $stmt->bind);
+    my $value = $driver->select_one($sql, $stmt->bind);
+    $class->call_trigger('post_select_aggregate', \$value)
+        unless $orig_args->{no_triggers};
+    return $value;
 }
 
@@ -559,4 +564,29 @@
 TODO
 
+=head1 Callbacks
+
+MT::ObjectDriver::Driver::DBI fires the following callbacks,
+or "triggers" when it loads data from the database.
+
+=over 4
+
+=item * post_select_aggregate
+
+    callback($class, \$value)
+
+Callback issued prior to returning the value that is retrieved
+as the result of select_one method.
+
+=item * post_group_by
+
+    callback($class, \$value, \@retrunvals)
+
+Callback issued prior to returning the number and additional return
+values that are retrieved as the result of grouping query.  The value
+in the $value parameter is what was calculated from the database.
+For example, in count_group_by method, $value holds the count for each
+group, while in sum_group_by method, $value holds the sum for each group.
+@returnvals parameter holds the additional data that wiil be retured.
+
 =head1 AUTHOR & COPYRIGHT
 
