Hello again,
I tried this example with Oracle:
Tables CDS -> Tracks
#1. Package:
#############
package Schema::CD;
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/ PK::Auto Core /);
__PACKAGE__->table('cds');
__PACKAGE__->add_columns(
id => {
data_type => "varchar2",
size => "64",
prec => "0",
scale => "0",
is_nullable => "n",
}
);
__PACKAGE__->set_primary_key(qw/ id / );
__PACKAGE__->has_many('tracks' => 'Schema::Track', 'cd_id');
1;
#2. Package:
#############
package Schema::Track;
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/ PK::Auto Core /);
__PACKAGE__->table('tracks');
__PACKAGE__->add_columns(
id => {
data_type => "varchar2",
size => "64",
prec => "0",
scale => "0",
is_nullable => "n",
},
cd_id => {
data_type => "varchar2",
size => "64",
}
);
__PACKAGE__->set_primary_key(qw/ id / );
__PACKAGE__->belongs_to('cd' => 'Schema::CD', 'cd_id');
1;
#test.pl
#########
....
$rs = $schema->resultset('CD')->search( { id => "test" },
{prefetch => "tracks"}
);
$i=1;
while($rs->next){
print "$i ...\n";
$i++;
}
If there is 1 recordset in table CDS and 2 related recordsets in
TRACKS I would expect:
1 ...
but i got:
1 ...
2 ...
3 ...
Is this the expected behavior?
The same effect I got with join.
Greetz
Dieter
--
FastJack
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
_______________________________________________
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]/