Josef Karthauser wrote:
> Hi there,
>
> I'm getting up to speed on DBIx::Class, in the context of Catalyst.
> Can someone help me with this query?
>
> I need to validate whether a particular column exists in the schema
> before calling a search, as I get an SQL error if it doesn't exist.
>
> I'm doing something like this:
>
> my $order_by = $c->request->params->{order_by} || $default_order;
> my $rs = $c->model('Domain')->
> search(undef,
> { page => $page, rows => 10,
> order_by => $order_by,
> prefetch => ['registrant', 'owner']
> });
>
> So, the value of order_by can be something like 'domainname' or
> 'owner.username'.
>
> How do I check with D::C whether the column exists before feeding it to
> search, which expects it to exist? I've scanned loads of manual pages,
> but can't find anything relevant.
>
> Thanks for you help :),
> Joehttp://search.cpan.org/~blblack/DBIx-Class-0.07999_01/lib/DBIx/Class/ResultSource.pm#has_column model('Domain')->result_source->has_column('foo'); -=Chris
signature.asc
Description: OpenPGP digital signature
_______________________________________________ List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class Wiki: http://dbix-class.shadowcatsystems.co.uk/ IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/ Searchable Archive: http://www.mail-archive.com/[email protected]/
