- if ($column) {
- foreach (sort keys %columns) {
- my (@more_exe_args) = @exe_args; # execute(@exe_args,$_) would fail when the array is empty.
- push @more_exe_args, $_; # but @more_exe_args will work
- $dbcalc->execute(@more_exe_args) or die "Query execute(@more_exe_args) failed: $query";
- while (my $data = $dbcalc->fetchrow_hashref) {
- my $col = $data->{col} || 'NULL';
- $tables{$col} or $tables{$col} = [];
- push @{$tables{$col}}, $data;
- }
- }
- } else {
- (scalar @exe_args) ? $dbcalc->execute(@exe_args) : $dbcalc->execute;
- while (my $data = $dbcalc->fetchrow_hashref) {
- my $col = $data->{col} || 'NULL';
- $tables{$col} or $tables{$col} = [];
- push @{$tables{$col}}, $data;
- }
- }
-
- foreach my $tablename (sort keys %tables) {
- my (@temptable);
- my $i=0;
- foreach my $cell (@{$tables{$tablename}}) {
- if (0 == $i++ and $debug) {
- my $dump = Dumper($cell);
- $dump =~ s/\n/ /gs;
- $dump =~ s/\s+/ /gs;
- print STDERR "first cell for $tablename: $dump";
- }
- push @temptable, $cell;
- }
- my $count = scalar(@temptable);
- my $allitems = $columns{$tablename};
- $globalline{total_looptable_count} += $count;
- $globalline{total_coltitle_count} += $allitems;
- push @{$globalline{looptables}}, {
- looprow => \@temptable,
- coltitle => $tablename,
- coltitle_count => $allitems,
- looptable_count => $count,
- looptable_first => ($count) ? $temptable[ 0]->{itemcallnumber} : '',
- looptable_last => ($count) ? $temptable[-1]->{itemcallnumber} : '',
- };
- }
+ if ($column) {
+ foreach ( sort keys %columns ) {
+ # execute(@exe_args,$_) would fail when the array is empty
+ # but @more_exe_args will work
+ my (@more_exe_args) = @exe_args;
+ push @more_exe_args, $_;
+ $dbcalc->execute(@more_exe_args)
+ or die "Query execute(@more_exe_args) failed: $query";
+ while ( my $data = $dbcalc->fetchrow_hashref ) {
+ my $col = $data->{col} || 'NULL';
+ $tables{$col} or $tables{$col} = [];
+ push @{ $tables{$col} }, $data;
+ }
+ }
+ }
+ else {
+ ( scalar @exe_args ) ? $dbcalc->execute(@exe_args) : $dbcalc->execute;
+ while ( my $data = $dbcalc->fetchrow_hashref ) {
+ my $col = $data->{col} || 'NULL';
+ $tables{$col} or $tables{$col} = [];
+ push @{ $tables{$col} }, $data;
+ }
+ }
+
+ foreach my $tablename ( sort keys %tables ) {
+ my (@temptable);
+ my $i = 0;
+ foreach my $cell ( @{ $tables{$tablename} } ) {
+ if ( 0 == $i++ and $debug ) {
+ my $dump = Dumper($cell);
+ $dump =~ s/\n/ /gs;
+ $dump =~ s/\s+/ /gs;
+ print STDERR "first cell for $tablename: $dump";
+ }
+ push @temptable, $cell;
+ }
+ my $count = scalar(@temptable);
+ my $allitems = $columns{$tablename};
+ $globalline{total_looptable_count} += $count;
+ $globalline{total_coltitle_count} += $allitems;
+ push @{ $globalline{looptables} },
+ {
+ looprow => \@temptable,
+ coltitle => $tablename,
+ coltitle_count => $allitems,
+ looptable_count => $count,
+ looptable_first => ($count) ? $temptable[0]->{itemcallnumber} : '',
+ looptable_last => ($count) ? $temptable[-1]->{itemcallnumber} : '',
+ };
+ }