On 21/01/2010, at 12:46, konstan...@tokar.ru wrote:
Hi, All!
How to use the schema description generated Schema::Loader, for the scheme
necessary to me?
For example, there is class DBIC::EMULATOR::Cruise, I write for the current
scheme
use DBIC::EMULATOR;
my $schema = DBIC::EMULATOR-connect(...);
my $record = $schema-resultset('ship')-search()-first ();
But if I need to address to tables of other scheme, for example EMULATOR2,
EMULATOR3, how it to make?
Something like
my $record = $schema-resultset(EMULATOR2.ship')-search ()-first();
my $record = $schema-resultset(EMULATOR3.ship')-search ()-first();
You can create separate namespace for each *db schema* you have under your
*DBIC schema* one, then
you use the qualified table name when you set up the result class:
if your DBIC schema is DBIC::EMULATOR,
code
package DBIC::EMULATOR::EMULATOR1::ship;
use parent 'DBIx::Class::Core';
__PACKAGE__-table('EMULATOR1.ship');
[...]
package DBIC::EMULATOR::EMULATOR2::ship;
use parent 'DBIx::Class::Core';
__PACKAGE__-table('EMULATOR2.ship');
[...]
/code
thus, when you need to get the resultset for this result class you do:
my $emulator1_ship_rs = $schema-resultset('EMULATOR1::ship');
my $emulator2_ship_rs = $schema-resultset('EMULATOR2::ship');
--
wallace reis/wreis Catalyst and DBIx::Class consultancy with a clue
Software Engineer and a commit bit: http://shadowcat.co.uk/catalyst/
Shadowcat Systems Limited
http://www.shadowcat.co.uk http://www.linkedin.com/in/wallacereis
___
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