[Dbix-class] Fixing my relationships to get working queries

Peter Rabbitson rabbit+dbic at rabbit.us
Mon Jan 19 14:23:07 GMT 2015


On 01/13/2015 03:33 AM, John Stoffel wrote:
>    # search in Carey
>    my @r = $schema->resultset('Name')->search( { full_name =>
>                                                  { regexp => '[[:<:]]'.$query.'[[:>:]]' }
>                                                },
>                                                {
>                                                 order_by => { -asc => 'full_name' },
>                                                 prefetch => { 'account' => 'boxfolder' },
>                                                 rows => $limit,
>                                                });
>    return @r;
>
>
>
> And I don't get back consistent the info I expect.  Sometimes it works
> and I get what I think is the right info, but other times for other
> queries it doesn't give me back what I want.

You need to expand on what precisely isn't "as expected". That is - from 
your query above I can see DBIC generating the SQL to satisfy exactly 
what you asked for. So the disconnect is in you ot fully understanding 
the way you formulated the "query" to DBIC itself.

Please expand on this so I can answer your question in a manner that 
will help you generally in the future.



More information about the DBIx-Class mailing list