[Rt-devel] Re: [rt-users] Where does QueryBuilder refer tables?

Ruslan Zakirov ruslan.zakirov at gmail.com
Wed Jul 27 17:02:04 EDT 2005


Nathan, please always add list address to Cc.

On 7/28/05, Ahalya_Nathan at mudnebr.com <Ahalya_Nathan at mudnebr.com> wrote:
>  
> That was a helpful tip. I will look more into this and get back to you if i
> have problems. Thank you. 
> 
>  
>  Regards,
>  Ahalya Nathan
>  Senior Programmer / Analyst
>  Information Technology, Metropolitan Utilities District 
>  (402) 449-8218 phone
>  (402) 449-8131 fax
>  ahalya_nathan at mudnebr.com 
>  
>  
>  
>  Ruslan Zakirov <ruslan.zakirov at gmail.com> 
> 
> 07/27/2005 12:48 PM 
>  
> Please respond to
>  Ruslan Zakirov <ruslan.zakirov at gmail.com> 
>  
>  
> To "Ahalya_Nathan at mudnebr.com" <Ahalya_Nathan at mudnebr.com> 
>  
> cc rt-devel at lists.bestpractical.com 
>  
> Subject Re: [rt-users] Where does QueryBuilder refer tables? 
>  
>  
>  
>  
>  
> On 7/27/05, Ahalya_Nathan at mudnebr.com <Ahalya_Nathan at mudnebr.com> wrote:
>  >  
>  > Hi Ruslan, 
>  > Your mail did clarify some doubt in my head about RT but i still have one
>  > more problem i.e., I have a query for selecting tickets with  id<2000 and
>  > Requestor.EmailAddress="Ahalya_Nathan at mudnebr.com" .I know that the code
>  > from the Tickets_Overlay_SQL.pm is being referred. What i am unable to
>  > figure out is how does the Users table get referred since the
>  > Requestor.EmailAddress is present in the Users table?  Also the Limit
>  > function in the DBIx::SearchBuilder accepts arguments such as TABLE =>
>  > $self->{'table'}, which i know is the Tickets table.How or where is the
>  > Users table being referred. I can see that the functions for Joining
> tables
>  > have been done in the _LinkFieldLimit function in the Tickets_Overlay.pm
>  > program. But this function is not being referred at all for selecting
>  > tickets. 
>  Yeah, Tickets*.pm is most hard thing to understand, because it's very
>  extended subclass of the DBIx::SB.
>  
>  There is  %FIELDS hash in Tickets_Overlay.pm which contain special
>  metadata for searches.
>  There is also %dispatch hash in the same file, that contains links to
>  functions associated with field type.
>  So if you have query - q{ id < 2000 and Requestor.EmailAddress =
>  'x at y.com' } then RT do next:
>  * RT splits it by AGGREGATORS: 'and', 'or' ...
>  * split parts to $field, $op, $value
>  * find $field metadata in %FIELDS hash
>  * fetch field type(ENUM, LINK, ...) from metadata
>  * fetch method link(dispatcher) from %dispatch hash
>  * run dispatcher method
>  
>  if $field has '.'(like in 'Requestor.EmailAddress') then it's
>  translated like 'field_name.field_extension' and RT parse
>  field_extension in dispatcher method.
>  
>  Huh, something like this.
>  
>  >  
>  > It will be real helpful if you could give me some pointers on this. 
>  May be you want write some "simple" script and you don't all this
>  internals, so you can show us small code and place where you don't
>  understand what to do.
>  
>  >  
>  > Regards,
>  >  Ahalya Nathan
>  >  Senior Programmer / Analyst
>  >  Information Technology, Metropolitan Utilities District 
>  >  (402) 449-8218 phone
>  >  (402) 449-8131 fax
>  >  ahalya_nathan at mudnebr.com 
>  >  
>  >  
>  >  
>  >  Ruslan Zakirov <ruslan.zakirov at gmail.com> 
>  > 
>  > 07/27/2005 11:09 AM 
>  >  
>  > Please respond to
>  >  Ruslan Zakirov <ruslan.zakirov at gmail.com> 
>  >  
>  >  
>  > To "Ahalya_Nathan at mudnebr.com" <Ahalya_Nathan at mudnebr.com> 
>  >  
>  > cc rt-users at lists.bestpractical.com 
>  >  
>  > Subject Re: [rt-users] Where does QueryBuilder refer tables? 
>  >  
>  >  
>  >  
>  >  
>  >  
>  > On 7/27/05, Ahalya_Nathan at mudnebr.com <Ahalya_Nathan at mudnebr.com> wrote:
>  >  >  
>  >  > Hi Ruslan, 
>  >  > The documentation that you gave was very helpful but i am kindoff
> trying
>  > to
>  >  > understand this piece of code in the Tickets_Overlay_SQL.pm program., 
>  >  >  
>  >  >   $self->SUPER::Limit( FIELD           => 'EffectiveId', 
>  >  >                      ENTRYAGGREGATOR => 'AND', 
>  >  >                      OPERATOR        => '=', 
>  >  >                      QUOTEVALUE      => 0, 
>  >  >                      VALUE           => 'main.id' 
>  >  >  
>  >  > Could you tell me how this works? What does "main" imply to be? Is the
>  > Limit
>  >  > function used for retrieving information from the database. 
>  >  Base class where Limit lives is DBIx::SearchBuilder, see its docs.
>  >  Limit method limits colection of records with some condition.
>  >  In code you quote RT adds condition to Tickets select and select would
>  >  be looking something like:
>  >  SELECT main.* FROM Tickets main, ... WHERE main.EffectiveId = main.id
> ...
>  >  
>  >  This is required step when you want select Ticket(s) by some condition
>  >  and also tickets that was merged.
>  >  
>  >  
>  >  >  
>  >  > Regards,
>  >  >  Ahalya Nathan
>  >  >  Senior Programmer / Analyst
>  >  >  Information Technology, Metropolitan Utilities District 
>  >  >  (402) 449-8218 phone
>  >  >  (402) 449-8131 fax
>  >  >  ahalya_nathan at mudnebr.com 
>  >  >  
>  >  >  
>  >  >  
>  >  >  Ruslan Zakirov <ruslan.zakirov at gmail.com> 
>  >  > 
>  >  > 07/26/2005 06:11 PM 
>  >  >  
>  >  > Please respond to
>  >  >  Ruslan Zakirov <ruslan.zakirov at gmail.com> 
>  >  >  
>  >  >  
>  >  > To "Ahalya_Nathan at mudnebr.com" <Ahalya_Nathan at mudnebr.com> 
>  >  >  
>  >  > cc rt-users at lists.bestpractical.com,
>  >  > rt-users-bounces at lists.bestpractical.com 
>  >  >  
>  >  > Subject Re: [rt-users] Where does QueryBuilder refer tables? 
>  >  >  
>  >  >  
>  >  >  
>  >  >  
>  >  >  
>  >  > On 7/27/05, Ahalya_Nathan at mudnebr.com <Ahalya_Nathan at mudnebr.com>
> wrote:
>  >  >  >  
>  >  >  > Hi all, 
>  >  >  >  
>  >  >  > Could anyone tell me how or which program refers tickets or other
>  > tables
>  >  > to
>  >  >  > display the resultset for Query Builder?. I have been trying to
> figure
>  >  > out
>  >  >  > how it refers the tables to display the resultset but no luck so
> far. 
>  >  >  >  
>  >  >  > It will be very helpful if anyone could give me a suggestion. 
>  >  >  http://wiki.bestpractical.com/index.cgi?ObjectModel
>  >  > 
> http://wiki.bestpractical.com/index.cgi?GlobalObjects
>  >  >  lib/RT/Tickets*.pm
>  >  >  
>  >  >  This is only I can say.
>  >  >  > 
>  >  >  >  
>  >  >  >  Regards,
>  >  >  >  Ahalya Nathan
>  >  >  >  Senior Programmer / Analyst
>  >  >  >  Information Technology, Metropolitan Utilities District 
>  >  >  >  (402) 449-8218 phone
>  >  >  >  (402) 449-8131 fax
>  >  >  >  ahalya_nathan at mudnebr.com 
>  >  >  > _______________________________________________
>  >  >  >
>  >  >
>  >
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>  >  >  > 
>  >  >  > Be sure to check out the RT Wiki at http://wiki.bestpractical.com
>  >  >  > 
>  >  >  > 
>  >  >  
>  >  >  
>  >  >  -- 
>  >  >  Best regards, Ruslan.
>  >  >  
>  >  >  
>  >  
>  >  
>  >  -- 
>  >  Best regards, Ruslan.
>  >  
>  >  
>  
>  
>  -- 
>  Best regards, Ruslan.
>  
>  


-- 
Best regards, Ruslan.


More information about the Rt-devel mailing list