Changeset 2664

Show
Ignore:
Timestamp:
07/01/08 01:50:42 (20 months ago)
Author:
fumiakiy
Message:

Added new trigger calls to group_by and select_aggregate methods. These are required for enterprise database drivers to function properly. Bug # 80386

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-41/lib/MT/ObjectDriver/Driver/DBI.pm

    r2629 r2664  
    222222        my @returnvals = map { $$_ } @bindvars; 
    223223        $i++; 
     224        $class->call_trigger('post_group_by', \$count, \@returnvals) 
     225            unless $args->{no_triggers}; 
    224226        return($count, @returnvals); 
    225227    }; 
     
    261263    $stmt->add_select($select => $select); 
    262264    my $sql = $stmt->as_sql; 
    263     $driver->select_one($sql, $stmt->bind); 
     265    my $value = $driver->select_one($sql, $stmt->bind); 
     266    $class->call_trigger('post_select_aggregate', \$value) 
     267        unless $orig_args->{no_triggers}; 
     268    return $value; 
    264269} 
    265270 
     
    559564TODO 
    560565 
     566=head1 Callbacks 
     567 
     568MT::ObjectDriver::Driver::DBI fires the following callbacks, 
     569or "triggers" when it loads data from the database. 
     570 
     571=over 4 
     572 
     573=item * post_select_aggregate 
     574 
     575    callback($class, \$value) 
     576 
     577Callback issued prior to returning the value that is retrieved 
     578as the result of select_one method. 
     579 
     580=item * post_group_by 
     581 
     582    callback($class, \$value, \@retrunvals) 
     583 
     584Callback issued prior to returning the number and additional return 
     585values that are retrieved as the result of grouping query.  The value 
     586in the $value parameter is what was calculated from the database. 
     587For example, in count_group_by method, $value holds the count for each 
     588group, while in sum_group_by method, $value holds the sum for each group. 
     589@returnvals parameter holds the additional data that wiil be retured. 
     590 
    561591=head1 AUTHOR & COPYRIGHT 
    562592