[Dbix-class] Excluding columns from a query

Rob Kinyon rob.kinyon at gmail.com
Fri Feb 12 13:40:08 GMT 2010


>> my $rs2 = $rs->search(
>>     undef,
>>     {
>>         columns => [ grep { $_ ne 'exclude_me' } $rs->resultsource->columns ]
>>     }
>> );
>
> Thanks for the tip. I keep forgetting about the usefulness of the grep
> function. But that doesn't work with prefetch. I think something like
> this would be handy:
>
> $rs->search(
>    undef,
>    {
>        prefetch => 'related',
>        exclude  => [ 'me.exclude_me', 'related.exclude_me_too' ],
>    }
> );

It -shouldn't- work with prefetch as prefetch is just an optimization.

You also still haven't mentioned -WHY- you want this.

Rob



More information about the DBIx-Class mailing list