[Dbix-class] Custom SQL
Gordon Irving
goraxe at goraxe.me.uk
Mon Dec 14 16:09:42 GMT 2009
Where I have done this in the past
I have used DBIx::Class::ResultSource::View as the parent, and then load core
via load_components (in many cases it seems you need to load core last), then
set the __PACKAGE__->table_class, set a __PACKAGE->table to use as the
source name. I think you also need to set a __PACKAGE__->result_class to set how the
returned results should be blessed.
HTH
Gordon
On Mon, Dec 14, 2009 at 04:04:41PM +0100, Bernhard Graf wrote:
> I'm trying to execute verbatim SQL as described in
> http://search.cpan.org/~frew/DBIx-Class-0.08115/lib/DBIx/Class/Manual/Cookbook.pod#Arbitrary_SQL_through_a_custom_ResultSource
> but it doesn't work.
>
> Actually if I reduce the Cookbook example to the absolute minimum ...
>
>
> package My::Schema::Result::MyRequest;
>
> use parent 'DBIx::Class::Core';
>
> __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
>
> __PACKAGE__->result_source_instance->is_virtual(1);
>
> 1;
>
>
> ... I get the following error:
>
> Can't locate object method "result_source_instance" via package
> "My::Schema::Result::MyRequest" at My/Schema/Result/MyRequest.pm line 7.
>
> Ideas?
>
> Bernhard Graf
>
> _______________________________________________
> 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
More information about the DBIx-Class
mailing list