Hi all.
Can you please help me with constructing query using native RT methods?
I need to override Email Gateway method with adding additional check. I
use following sql-query:
select
CC.customer_id from CustomerContacts CC
LEFT JOIN
ContactEmails CE ON (CC.id = CE.Contact_Id)
WHERE
CE.Email = “some@email.com”;
What object should I use as base - RT::CustomerContacts or
RT::ContactEmails? And what sequence of Join and Limit methods should I
use?
I’m new in DBIx::SearchBuilder and need a bit help to start
Agnislav Onufrijchuk
PortaOne, Inc., RT Developer
Tel: +1-866-SIP VOIP (+1 866 747 8647) ext. 7670
Meet us at Internet Telephony East
February 2-4, 2009 - Booth 826
Miami Beach Convention Center
my $ccs = RT::CCs->new($RT::SuperUser);
my $alias = $ccs->Join( FIELD1 => ‘id’, TABLE2 => ‘CE’, FIELD2 =>
‘Contact’, TYPE => ‘LEFT’ );
$ccs->Limit( ALIAS => $alias, FIELD => ‘Email’, VALUE => ‘some’ );
while ( my $cc = $ccs->Next ) {
}
something like that, a lot of examples are in RT::Tickets with some
exception that Tickets has some additional helpers for TicketSQL, but
with little changes you can still different constructions there.
I think you know that left join here is redundant and will be
downgraded to a regular join.On Wed, Dec 3, 2008 at 5:04 PM, Agnislav Onufrijchuk Agnislav.Onufrijchuk@portaone.com wrote:
Hi all.
Can you please help me with constructing query using native RT methods?
I need to override Email Gateway method with adding additional check. I
use following sql-query:
select
CC.customer_id from CustomerContacts CC
LEFT JOIN
ContactEmails CE ON (CC.id = CE.Contact_Id)
WHERE
CE.Email = “some@email.com”;
What object should I use as base - RT::CustomerContacts or
RT::ContactEmails? And what sequence of Join and Limit methods should I
use?
I’m new in DBIx::SearchBuilder and need a bit help to start
–
Agnislav Onufrijchuk
PortaOne, Inc., RT Developer
Tel: +1-866-SIP VOIP (+1 866 747 8647) ext. 7670
Meet us at Internet Telephony East
February 2-4, 2009 - Booth 826
Miami Beach Convention Center
List info: The rt-devel Archives
Best regards, Ruslan.
Ruslan Zakirov wrote:
my $ccs = RT::CCs->new($RT::SuperUser);
my $alias = $ccs->Join( FIELD1 => ‘id’, TABLE2 => ‘CE’, FIELD2 =>
‘Contact’, TYPE => ‘LEFT’ );
$ccs->Limit( ALIAS => $alias, FIELD => ‘Email’, VALUE => ‘some’ );
while ( my $cc = $ccs->Next ) {
}
Thanks a lot, Ruslan!
I think you know that left join here is redundant and will be
downgraded to a regular join.
Thanks for this point
Agnislav Onufrijchuk
PortaOne, Inc., RT Developer
Tel: +1-866-SIP VOIP (+1 866 747 8647) ext. 7670
Meet us at Internet Telephony East
February 2-4, 2009 - Booth 826
Miami Beach Convention Center