Re: [Dbix-class] Static / reference data

2018-08-23 Thread David Cantrell

On 2018-08-22 20:22, Andy Armstrong wrote:


I should perhaps have mentioned that services may also do a self join to
find a parent service - services are either one or two levels deep. I
can make prefetch work for a single level service and I can make it work
for two level services but not, as far as I can see, for both.

If I do prefetch => ['service', { service => 'parent' }] I only get
results for the cases where the service hierarchy is two levels deep.


Sounds like you want a LEFT JOIN for the 'parent' relationship. IIRC for
`has_many` and `might_have` relationships that is the default, for
others you need to explicitly set the join type.

See https://metacpan.org/pod/DBIx::Class::Relationship for gory details.

--
David Cantrell
David Cantrell
System Architect
The Hut Group

Tel:
Email: david.cantr...@uk2group.com

For the purposes of this email, the "company" means The Hut Group Limited, a 
company registered in England and Wales (company number 6539496) whose registered office 
is at Fifth Floor, Voyager House, Chicago Avenue, Manchester Airport, M90 3DQ and/or any 
of its respective subsidiaries.

Confidentiality Notice
This e-mail is confidential and intended for the use of the named recipient 
only. If you are not the intended recipient please notify us by telephone 
immediately on +44(0)1606 811888 or return it to us by e-mail. Please then 
delete it from your system and note that any use, dissemination, forwarding, 
printing or copying is strictly prohibited. Any views or opinions are solely 
those of the author and do not necessarily represent those of the company.

Encryptions and Viruses
Please note that this e-mail and any attachments have not been encrypted. They 
may therefore be liable to be compromised. Please also note that it is your 
responsibility to scan this e-mail and any attachments for viruses. We do not, 
to the extent permitted by law, accept any liability (whether in contract, 
negligence or otherwise) for any virus infection and/or external compromise of 
security and/or confidentiality in relation to transmissions sent by e-mail.

Monitoring
Activity and use of the company's systems is monitored to secure its effective 
use and operation and for other lawful business purposes. Communications using 
these systems will also be monitored and may be recorded to secure effective 
use and operation and for other lawful business purposes.

hgvyjuv


___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] Static / reference data

2018-08-23 Thread Darren Duncan

On 2018-08-22 11:14 AM, Andy Armstrong wrote:

I've got a database of TV and Radio programmes [1] which currently uses DBI and 
ad-hoc queries. I'm considering migrating it to use DBIC.


What is your reason for considering the migration?  Are you finding the DBI+SQL 
version hard to maintain?  Leaving it as is might be the best solution. -- 
Darren Duncan


___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk