Hello

I had a problem following the instructions in "Arbitrary SQL through a custom ResultSource" [1] since it gave me an error of `Can't locate object method "result_source_instance"`

I found a solution in this perlmonk answer [2]. Indeed this works:

<code>---------------------------

package Dir::Dir::ComplexQuery;

use strict;
use base 'DBIx::Class::Core';

__PACKAGE__->table( 'dummy_table_name' );
__PACKAGE__->add_columns( qw/col1 col2 col3/ );
__PACKAGE__->result_source_instance->name( \q!(complex SQL ... )! );

</code>---------------------------

and  I can normally do:
...->resultset('ComplexQuery')->search();

My questions are the following:

1. The function "table" is the one from DBIx::Class::ResultSourceProxy::Table as described in [3], right? I am using `DBIx::Class::Schema::Loader` so I never had created a DBIx "class table" myself.

2. The "__PACKAGE__->table('table_name')" will NOT trigger a creation of this table (in this case it's a view) to the actual DB, correct? Or is there a scenario where the creation of a view hac be triggered and I can end up with a view named 'dummy_table_name' in my DB?

3. In which DBIx package is "result_source_instance" defined? I did searched but I couldn't find it - maybe I am not searching the right way.


[1] http://search.cpan.org/~arodland/DBIx-Class-0.08196/lib/DBIx/Class/Manual/Cookbook.pod#Arbitrary_SQL_through_a_custom_ResultSource
[2] http://www.perlmonks.org/?node_id=658193
[3] http://search.cpan.org/~arodland/DBIx-Class-0.08196/lib/DBIx/Class/ResultSource.pm#DESCRIPTION

_______________________________________________
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]

Reply via email to