Skip Menu |
 

This queue is for tickets about the Class-DBI CPAN distribution.

Report information
The Basics
Id: 99395
Status: new
Priority: 0/
Queue: Class-DBI

People
Owner: Nobody in particular
Requestors: David.Newman [...] monro.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Iterator Method not iterating with
Date: Thu, 9 Oct 2014 14:51:39 +0000
To: "'bug-Class-DBI [...] rt.cpan.org'" <bug-Class-DBI [...] rt.cpan.org>
From: David Newman <David.Newman [...] monro.com>
Distribution Name and Version: Class-DBI 3.0.17 Perl Version(s): Perl 5.12.4 and Perl 6.16.3 Operating System: Windows 7 Professional Service Pack 1 Problem: Iterator method is not iterating through result set. It seems the correct number of records is known but it doesn't iterate (change the value) through each record. This seems to happen only with accessor_named fields. Or field renamed because it is some known reserved word. Dave Newman MAIN PROGRAM #!/usr/bin/perl use strict; use warnings; use Carp; use Monro::GiftCardLoad::VastDB; use Monro::GiftCardLoad::VastDB::Estmtehdr; use Monro::GiftCardLoad::VastDB::Lineitem; use Monro::GiftCardLoad::VastDB::Mechanic; use Data::Dumper; _build_lineitems(); sub _build_lineitems { my $self = shift; my $est_obj = Monro::GiftCardLoad::VastDB::Estmtehdr->retrieve(COMPANY => '0945', INVOICE_NUMBER => '139208'); print "est_obj: $est_obj\n"; my @line_rows = Monro::GiftCardLoad::VastDB::Lineitem->search(COMPANY => $est_obj->COMPANY, ESTIMATE_NUMBER => $est_obj->ESTIMATE_NUMBER); my $it = Monro::GiftCardLoad::VastDB::Lineitem->search(COMPANY => $est_obj->COMPANY, ESTIMATE_NUMBER => '139208'); print "DataDump: ".Dumper(@line_rows); while(my $line_item = $it->next) { print "line_item: $line_item\n"; print "item_number: ".$line_item->item_number."\n"; } my $index = 0; my @lineitems; my %listbox_seq_hash; foreach my $line (@line_rows) { print "line_rows[0]: $line_rows[0]\n"; print "line_rows[1]: $line_rows[1]\n"; print "line_rows[2]: $line_rows[2]\n"; print "item: " . $line->item_number . "\n"; print "estimate: " . $line->estimate_number . "\n"; } } RESULTS est_obj: 0945/177338 DataDump: $VAR1 = bless( { '__triggers' => {}, '_class_trigger_results' => [], 'estimate_number' => '177338', 'company' => '0945' }, 'Monro::GiftCardLoad::VastDB::Lineitem' ); $VAR2 = $VAR1; $VAR3 = $VAR1; line_rows[0]: 0945/177338 line_rows[1]: 0945/177338 line_rows[2]: 0945/177338 item: 10 estimate: 177338 line_rows[0]: 0945/177338 line_rows[1]: 0945/177338 line_rows[2]: 0945/177338 item: 10 estimate: 177338 line_rows[0]: 0945/177338 line_rows[1]: 0945/177338 line_rows[2]: 0945/177338 item: 10 estimate: 177338 LINEITEM MODULE package Monro::GiftCardLoad::VastDB::Lineitem; use strict; use warnings; use Class::DBI; use base 'Monro::GiftCardLoad::VastDB'; Monro::GiftCardLoad::VastDB::Lineitem->table(''); Monro::GiftCardLoad::VastDB::Lineitem->columns(Primary => qw/ COMPANY ESTIMATE_NUMBER /); Monro::GiftCardLoad::VastDB::Lineitem->columns(Others => qw/ CLASS FRONT_REAR INVOICE_POSITION ACCOUNT_CODE TAXABLE VENDOR_NUMBER ITEM_NUMBER DESCRIPTION QUANTITY UNIT_PRICE LABOR_AMOUNT REASON_CODE PART /); sub accessor_name_for { my ($class, $column) = @_; if ($column eq 'sequence') { $column = 'my_sequence'; } return $column; } 1;
Download (untitled) / with headers
text/html 10.4k


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.