Kevin Esteb wrote:
I new to DBIx::Class, so please bear with me.
I am running RHEL4 and have a postgres database with a schema named
"analog". The DBIx::Class modules are the latest and greatest from CPAN,
so is the DBD and the DBI for postgres. When I run the below code, I get
this error:

DBIx::Class::Schema::resultset(): Can't find source for analog.master at
test9.pl line 28

What is the proper way to access another database schema within
postgres.

Thanks


package Test::Schema;
use base qw/ DBIx::Class::Schema /;

__PACKAGE__->load_classes();

1;

package Test::Schema::Master;
use base qw/ DBIx::Class /;

__PACKAGE__->load_components(qw/ PK::Auto Core /);
__PACKAGE__->table('analog.master');
__PACKAGE__->add_columns(qw/ hostname datetime did /);
__PACKAGE__->set_primary_key('hostname');

1;

package Test;

    my $dsn = 'dbi:Pg:dbname=monitor';
    my $username = 'postgres';
    my $password = '';
    my $params = {RaiseError => 1, AutoCommit => 0};

    eval {

        my $schema = Test::Schema->connect($dsn, $username, $password,
$params);
        my @masters = $schema->resultset('analog.master')->search();

        foreach my $master (@masters) {

           print "$master->hostname, $master->datetime, $master->did\n";

       }

   }; if ($@) { print "[EMAIL PROTECTED]"; }

1;


Wrong moniker - it should be ->resultset('Master')

Where did you get the idea that it should be table name?

Ash

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

Reply via email to