Odd behaviour in Transactions->Limit()

This may also be SearchBuilder oddness.

I have an Action which is trying to generate a count of how many
transactions between given timestamps were made by a given user.

Setting up the search like:

my $Transactions = new RT::Transactions( $RT::SystemUser );
$Transactions->Limit( FIELD => 'Creator', VALUE => $id_val,

OPERATOR = ‘=’ );

$Transactions->Limit( FIELD => 'Created', VALUE =>

$begindate->ISO, OPERATOR = ‘>=’ );
$Transactions->Limit( FIELD => ‘Created’, VALUE =>
$enddate->ISO, OPERATOR = ‘<=’ );

$Transactions->Count();

produces one number (for instance, 277 where $begindate and $enddate are
one hour apart), whilst SQL select count(*) from Transactions where
Created >= ‘2002-02-01 21:00:00’ and Created <= ‘2002-02-01 22:00:00’ and
Creator = ‘1234’; produces a lower number (40).

Huh?

It nearly looks like that only the Limits on the Creator is being
followed, and the Limits on ‘Created’ have gone walkies. Am I missing
something obvious in generating a set of Limits? I’m not quite willing to
re-enable query logging on the SQL server just yet.

For those interested in a more concrete example,
http://www.amsterdamned.org/~bc/rt/devel/UpdateSquelch.pm in the
CountTransactions() function. perldoc on that is somewhat over the top.

Time to be heading home methinks, sleep-in and watch the Royal Wedding™
from the comfort of my own armchair.

                         Bruce Campbell                            RIPE
               Systems/Network Engineer                             NCC
             www.ripe.net - PGP562C8B1B                      Operations

This may also be SearchBuilder oddness.

Nope, it was my failing to include an ENTRYAGGREGATOR, ie:

$Transactions->Limit( FIELD => ‘Created’, VALUE =>
$begindate->ISO, OPERATOR = ‘>=’ );
$Transactions->Limit( FIELD => ‘Created’, VALUE =>
$enddate->ISO, OPERATOR = ‘<=’ );

also needs ‘ENTRYAGGREGATOR => “AND”’ to avoid using the default ‘or’.

Very definitely my bad. Thanks to Jesse for bugging me to turn on query
logging ( must remember to turn it off before the weekend finishes ).

                         Bruce Campbell                            RIPE
               Systems/Network Engineer                             NCC
             www.ripe.net - PGP562C8B1B                      Operations