[Dbix-class] Is populate borked in -current?

Christopher H. Laco claco at chrislaco.com
Fri Sep 29 01:30:47 CEST 2006


Christopher H. Laco wrote:
> Christopher H. Laco wrote:
> [snip]
> 
> I've committed failing tests to 100populate.t. These test pass under
> trunk, and on current prior to changeset 2793:
> 
> To summarize, under trunk, populate honors the field orders given, and
> allows one to only populate some fields out of the entire schema. This
> is useful if the data being populate is coming from an outside source
> that has no knowledge of the db column order, or the entire set of columns.
> 
>> ## make sure populate -> insert_bulk honors fields/orders
>> ## schema order
>> $schema->populate('Link', [
>> [ qw/id url title/ ],
>> [ qw/2 burl btitle/ ]
>> ]);
>> my $link2 >> is($link2->id, 2, 'Link 2 id');
>> is($link2->url, 'burl', 'Link 2 url');
>> is($link2->title, 'btitle', 'Link 2 title');
>>
>> ## non-schema order
>> $schema->populate('Link', [
>> [ qw/id title url/ ],
>> [ qw/3 ctitle curl/ ]
>> ]);
>> my $link3 >> is($link3->id, 3, 'Link 3 id');
>> is($link3->url, 'curl', 'Link 3 url');
>> is($link3->title, 'ctitle', 'Link 3 title');
>>
>> ## not all physical columns
>> $schema->populate('Link', [
>> [ qw/id title/ ],
>> [ qw/4 dtitle/ ]
>> ]);
>> my $link4 >> is($link4->id, 4, 'Link 4 id');
>> is($link4->url, undef, 'Link 4 url');
>> is($link4->title, 'dtitle', 'Link 4 title');
> 
> Under the latest current, that last two groups of tests fail. Column
> order is ignored, and one must populate by specifying all of the
> columns, no just some of them.
> 
> This problem only happens in a void context because insert_bulk in
> Storage::DBI does nothing with $cols passed into it in things like:
> 
>> my ($sql, @bind) > 
> In list context, populate create real objects that take care of the
> columns, orders, and the ability to not specify all of them.
> 
> Game on.
> -=Chris
> 

No really, this time I mean it. Anything worth testing is worth testing
verbosely.

I've updated the tests to test populate in list context, vs void context.

-=Chris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.rawmode.org/pipermail/dbix-class/attachments/20060928/9862d632/attachment-0001.pgp 


More information about the Dbix-class mailing list