On Tue, Mar 23, 2010 at 4:35 AM, Jason Armstrong <[email protected]> wrote:
> I have a function in my database that I want to call without a table.
I use a virtual result source for this:
package MyApp::Schema::Result::Parent;
use strict;
use parent 'DBIx::Class::Core';
__PACKAGE__->table_class('DBIx::Class::ResultSource::View');
__PACKAGE__->table('null');
__PACKAGE__->add_columns(qw[ parent ]);
__PACKAGE__->result_source_instance->is_virtual(1);
__PACKAGE__->result_source_instance->view_definition(q[
SELECT uuid.get_parent(?)
]);
1;
and then
$schema->resultset('Parent')->search( {}, { bind => [$uuid] });
If memory serves (and it often does not), the ResultSource::View is a
relatively recent thing.
k.
--
kevin montuori
_______________________________________________
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/[email protected]