in reply to Re: Problems Using Join in DBIx::Class
in thread Problems Using Join in DBIx::Class
Thanks for your help. However, I tried using 'prefetch', and I get the same results as if I were using 'join'.
I get the following error:
Can't locate object method "LName" via package "myDBPackage::Result::T +blRequests" at test_processed_requests.pl line 15, <DATA> line 751.
As you can see in my previous post, TblPerson does contain the column, 'LName'. That is the column name in the database, as well.
I made a slight change to the -or and -and to produce the correct where clause statement. In addition, I included the
following snippet of code, to the Calling Method:
$schema->storage->debug(1);
to produce the SQL Statement, below:
SELECT me.RID, me.PID, me.original_post_date, me.last_update, me.submit_date, me.status, me.sent_email, p.PID, p.FName, p.MI, p.LName, FROM tblRequests me JOIN tblPerson p ON p.PID = me.PID WHERE ( sent_email IS NOT NULL OR sent_email != '0000-00-00' ) AND ( status = ‘Offered’ OR status = ‘Denied’ OR status = ‘Cancelled’ OR status = ‘Conditional Offer’ )
So, the DBIx::Class call
my @proc_requests = $schema->resultset( 'TblRequests' )->search({ -or => [ status => 'Offered', status => 'Denied', status => 'Cancelled', status => 'Conditional Offer', ], -and => [ -or => [ sent_email => {'!=', undef }, sent_email => {'!=', '0000-00-00'}, ], ], }, { prefetch => 'p' } );
is correct. It produces the correct SQL Statement (above).
Yet, it can't find object method from the other table. Again, I get the same error whether
I use 'join' or 'prefetch'.
And when I run debug, it displays the where clause of the DBIx::Class call, but it bypasses
'prefetch' or 'join'.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Problems Using Join in DBIx::Class
by soonix (Chancellor) on Dec 28, 2017 at 08:48 UTC | |
by phildeman (Scribe) on Dec 29, 2017 at 03:11 UTC | |
by poj (Abbot) on Dec 29, 2017 at 08:50 UTC | |
by 1nickt (Canon) on Dec 29, 2017 at 04:26 UTC | |
|
Re^3: Problems Using Join in DBIx::Class
by poj (Abbot) on Dec 28, 2017 at 19:04 UTC | |
by phildeman (Scribe) on Dec 29, 2017 at 02:19 UTC |