[Dbix-class] resultset_attributes, where, undef - wotz up?

Jason Galea lists at eightdegrees.com.au
Fri Jul 16 12:54:54 GMT 2010


On Fri, Jul 16, 2010 at 6:12 PM, Benjamin Martin <benjamin at opusvl.com> wrote:

>  __PACKAGE__->resultset_attributes({ where => { deleted => undef } });
>
> In one part of the system I would like to access these restricted records
> but I can't seem to get it to work!
>
>  $schema->resultset('TableA')->search( {}, { where => undef } );
>
> Does that look OK?.. should it work?
>
> I have seen a post suggesting I need to create another ResultSet without the
> 'resultset_attributes' .. which I guess would work, but it would be much
> nicer if I could just get the '{ where => undef }' going.
>

AFAIK.. you will need to create the other ResultSet to get it to work.
The issue is in the way the "chaining" of searches works, which is
basically adding new conditions with an 'and' so { where => undef }
doesn't change the default query set up by your resultset_attributes.

calling { where => { deleted => { '!=' => undef } } } will just get you..

... where deleted is null and deleted is not null

cheers,

J

-- 
Jason Galea



More information about the DBIx-Class mailing list