[Rt-devel] DBIx::SearchBuilder - Limit by multiple fields using OR clause

Miroslav Laus laus at karneval.cz
Thu Sep 23 02:53:41 EDT 2004


I found DBIx::Searchbuilder is using the ENTRYAGGREGATOR 'OR' only when
limiting to the same field multiple times. Let's say if I want to Limit the
Users table by Name or RealName a can't make it to use OR clause. It still uses
AND and it seems to me it cannot be changed without changing the

For example this code:

  my $UsersObj = new RT::Users($self->CurrentUser);
  	FIELD => 'Name',
  	VALUE => 'something',
  	FIELD => 'RealName',
  	VALUE => 'something',

produces this query:

SELECT * FROM Users main WHERE ( ((main.Disabled = 0)) AND ((main.Name LIKE
'%something%')) AND ((main.RealName LIKE '%SOMETHING%')) )

but I want it this way:

SELECT * FROM Users main WHERE ( ((main.Disabled = 0)) AND ((main.Name LIKE
'%something%') OR (main.RealName LIKE '%SOMETHING%')) )

Can this be achieved via some documented way?


Miroslav Laus, DiS
Senior technician, Operations Management Center
Karneval Media s.r.o.
U svobodarny 5/1500
190 00 Praha 9
Czech republic
tel: +420 2 8408 5354
fax: +420 2 8408 5817
mob: +420 724 608 011
e-mail: laus at karneval.cz

More information about the Rt-devel mailing list