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

Christopher H. Laco claco at chrislaco.com
Thu Sep 28 17:02:59 CEST 2006


While banging my head against test failures after a conversion to using
deploy/populate for tests, finally realized that the data I was getting
back was completely borken. But borken, I mean the data added by
populate stuffed the data into the wrong fields.

When running Rev. 2792, I get this back from dump:

> _column_data       => {
> billtoaddress1     => "BillToAddress1",
> billtoaddress2     => "BillToAddress2",
> billtoaddress3     => "BillToAddress3",
> billtocity         => "BillToCity",
> billtocountry      => "BillToCountry",
> billtodayphone     => "1-111-111-1111",
> billtoemail        => "mendlefarg\@gmail.com",
> billtofax          => "3-333-333-3333",
> billtofirstname    => "Christopher",
> billtolastname     => "Laco",
> billtonightphone   => "2-222-222-2222",
> billtostate        => "BillToState",
> billtozip          => "BillToZip",
> comments           => "Comments",
> created            => "2005-07-15 20:12:34",
> handling           => "8.95",
> id                 => "11111111-1111-1111-1111-111111111111",
> number             => "O123456789",
> shipmethod         => "UPS Ground",
> shipping           => "23.95",
> shiptoaddress1     => "ShipToAddress1",
> shiptoaddress2     => "ShipToAddress2",
> shiptoaddress3     => "ShipToAddress3",
> shiptocity         => "ShipToCity",
> shiptocountry      => "ShipToCountry",
> shiptodayphone     => "4-444-444-4444",
> shiptoemail        => "chrislaco\@hotmail.com",
> shiptofax          => "6-666-666-6666",
> shiptofirstname    => "Christopher",
> shiptolastname     => "Laco",
> shiptonightphone   => "5-555-555-5555",
> shiptosameasbillto => 0,
> shiptostate        => "ShipToState",
> shiptozip          => "ShipToZip",
> shopper            => "11111111-1111-1111-1111-111111111111",
> subtotal           => "5.55",
> tax                => "6.66",
> total              => "37.95",
> type               => 0,
> updated            => "2005-07-16 20:12:34",

If I go fullon -current, past Rev 2793, after the 'create insert_bulk
and have populate use it in void" change:, I get this:


> _column_data       => {
> billtoaddress1     => "mendlefarg\@gmail.com",
> billtoaddress2     => "Comments",
> billtoaddress3     => "2005-07-15 20:12:34",
> billtocity         => "8.95",
> billtocountry      => "23.95",
> billtodayphone     => 0,
> billtoemail        => "ShipToAddress1",
> billtofax          => "Laco",
> billtofirstname    => "2-222-222-2222",
> billtolastname     => "3-333-333-3333",
> billtonightphone   => "Christopher",
> billtostate        => "O123456789",
> billtozip          => "UPS Ground",
> comments           => "BillToAddress2",
> created            => "Laco",
> handling           => "BillToState",
> id                 => "11111111-1111-1111-1111-111111111111",
> number             => "Christopher",
> shipmethod         => "BillToAddress3",
> shipping           => "BillToCity",
> shiptoaddress1     => "ShipToState",
> shiptoaddress2     => "ShipToZip",
> shiptoaddress3     => "ShipToCountry",
> shiptocity         => "4-444-444-4444",
> shiptocountry      => "chrislaco\@hotmail.com",
> shiptodayphone     => "5.55",
> shiptoemail        => "6.66",
> shiptofax          => "2005-07-16 20:12:34",
> shiptofirstname    => "ShipToAddress3",
> shiptolastname     => "ShipToCity",
> shiptonightphone   => "37.95",
> shiptosameasbillto => "ShipToAddress2",
> shiptostate        => "5-555-555-5555",
> shiptozip          => "6-666-666-6666",
> shopper            => "11111111-1111-1111-1111-111111111111",
> subtotal           => "BillToCountry",
> tax                => "BillToZip",
> total              => "1-111-111-1111",
> type               => 0,
> updated            => "BillToAddress1",

That's just not right. My populate call, mostly stolen out of DBIC::Test is:

> sub populate_schema {
>     my ($self, $schema, %options) > 
>     if ($options{'clear'}) {
>         $self->clear_schema($schema, %options);
>     };
> 
>     if (!$options{'no_cart'}) {
>         $schema->populate('Carts', [
>             [ qw/id shopper type name description custom/ ],
>             ['11111111-1111-1111-1111-111111111111','11111111-1111-1111-1111-111111111111',0,'Cart 1', 'Test Temp Cart 1', 'custom'],
>             ['22222222-2222-2222-2222-222222222222','11111111-1111-1111-1111-111111111111',0,'Cart 2', 'Test Temp Cart 2', 'custom'],
>             ['33333333-3333-3333-3333-333333333333','33333333-3333-3333-3333-333333333333',1,'Cart 3', 'Saved Cart 1', 'custom']
>         ]);
> 
>         $schema->populate('CartItems', [
>             [ qw/id cart sku quantity price description custom/ ],
>             ['11111111-1111-1111-1111-111111111111', '11111111-1111-1111-1111-111111111111','SKU1111',1,1.11,'Line Item SKU 1', 'custom'],
>             ['22222222-2222-2222-2222-222222222222', '11111111-1111-1111-1111-111111111111','SKU2222',2,2.22,'Line Item SKU 2', 'custom'],
>             ['33333333-3333-3333-3333-333333333333', '22222222-2222-2222-2222-222222222222','SKU3333',3,3.33,'Line Item SKU 3', 'custom'],
>             ['44444444-4444-4444-4444-444444444444', '33333333-3333-3333-3333-333333333333','SKU4444',4,4.44,'Line Item SKU 4', 'custom'],
>             ['55555555-5555-5555-5555-555555555555', '33333333-3333-3333-3333-333333333333','SKU1111',5,5.55,'Line Item SKU 5', 'custom']
>         ]);
>     };
> 
>     if (!$options{'no_order'}) {
>         $schema->populate('Orders', [
>             [ qw/id shopper type billtofirstname billtolastname billtoaddress1 billtoaddress2 billtoaddress3 billtocity billtostate billtozip billtocountry billtodayphone billtonightphone billtofax billtoemail comments created handling number shipmethod shipping shiptosameasbillto shiptofirstname shiptolastname shiptoaddress1 shiptoaddress2 shiptoaddress3 shiptocity shiptostate shiptozip shiptocountry shiptodayphone shiptonightphone shiptofax shiptoemail subtotal total updated tax custom/ ],
>             ['11111111-1111-1111-1111-111111111111','11111111-1111-1111-1111-111111111111',0,'Christopher','Laco','BillToAddress1','BillToAddress2','BillToAddress3','BillToCity','BillToState','BillToZip','BillToCountry','1-111-111-1111','2-222-222-2222','3-333-333-3333','mendlefarg at gmail.com','Comments','2005-07-15 20:12:34',8.95,'O123456789','UPS Ground',23.95,0,'Christopher','Laco','ShipToAddress1','ShipToAddress2','ShipToAddress3','ShipToCity','ShipToState','ShipToZip','ShipToCountry','4-444-444-4444','5-555-555-5555','6-666-666-6666','chrislaco at hotmail.com',5.55,37.95,'2005-07-16 20:12:34', 6.66, 'custom'],
>             ['22222222-2222-2222-2222-222222222222','11111111-1111-1111-1111-111111111111',1,'Christopher','Laco','BillToAddress1','BillToAddress2','BillToAddress3','BillToCity','BillToState','BillToZip','BillToCountry','1-111-111-1111','2-222-222-2222','3-333-333-3333','mendlefarg at gmail.com','Comments','2005-07-15 20:12:34',8.95,'O123456789','UPS Ground',23.95,0,'Christopher','Laco','ShipToAddress1','ShipToAddress2','ShipToAddress3','ShipToCity','ShipToState','ShipToZip','ShipToCountry','4-444-444-4444','5-555-555-5555','6-666-666-6666','chrislaco at hotmail.com',5.55,37.95,'2005-07-16 20:12:34', 6.66, 'custom'],
>             ['33333333-3333-3333-3333-333333333333','33333333-3333-3333-3333-333333333333',1,'Christopher','Laco','BillToAddress1','BillToAddress2','BillToAddress3','BillToCity','BillToState','BillToZip','BillToCountry','1-111-111-1111','2-222-222-2222','3-333-333-3333','mendlefarg at gmail.com','Comments','2005-07-15 20:12:34',8.95,'O123456789','UPS Ground',23.95,0,'Christopher','Laco','ShipToAddress1','ShipToAddress2','ShipToAddress3','ShipToCity','ShipToState','ShipToZip','ShipToCountry','4-444-444-4444','5-555-555-5555','6-666-666-6666','chrislaco at hotmail.com',5.55,37.95,'2005-07-16 20:12:34', 6.66, 'custom']
>         ]);
> 
>         $schema->populate('OrderItems', [
>             [ qw/id orderid sku quantity price total description custom/ ],
>             ['11111111-1111-1111-1111-111111111111', '11111111-1111-1111-1111-111111111111','SKU1111',1,1.11,0,'Line Item SKU 1', 'custom'],
>             ['22222222-2222-2222-2222-222222222222', '11111111-1111-1111-1111-111111111111','SKU2222',2,2.22,0,'Line Item SKU 2', 'custom'],
>             ['33333333-3333-3333-3333-333333333333', '22222222-2222-2222-2222-222222222222','SKU3333',3,3.33,0,'Line Item SKU 3', 'custom'],
>             ['44444444-4444-4444-4444-444444444444', '33333333-3333-3333-3333-333333333333','SKU4444',4,4.44,0,'Line Item SKU 4', 'custom'],
>             ['55555555-5555-5555-5555-555555555555', '33333333-3333-3333-3333-333333333333','SKU1111',5,5.55,0,'Line Item SKU 5', 'custom']
>         ]);
>     };
> };

Anyone?

-=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/2ee8637b/attachment.pgp 


More information about the Dbix-class mailing list