[rt-devel] Odd behaviour in Transactions->Limit()

Bruce Campbell bruce_campbell at ripe.net
Fri Feb 1 18:20:55 EST 2002


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(tm)
from the comfort of my own armchair.

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








More information about the Rt-devel mailing list