cliffrubinmusic has asked for the wisdom of the Perl Monks concerning the following question:
foreach my $col(@Rcols){ push(@AllCols,$col); } my $table='foo'; my $fields=join(",",@Rcols); my($sth); my $sql = qq{SELECT $fields FROM $table Where workorder_id=?}; $sth = $dbhSt->prepare_cached($sql); foreach my $rec (sort(keys(%workOrder))){ @workOrders=''; @workOrders=@{$workOrder{$rec}}; @AllKeys=sort(keys(%patient)); @theseIDs=sort grep(/^$rec/,@AllKeys); foreach my $wo(sort @workOrders){ if($wo eq ''){next;} else{ $sth->execute($wo); my %row =(); $sth->bind_columns(map {\$row{$_}} @Rcols); while (@values=$sth->fetchrow_arrayref){ @values=''; foreach my $col(@Rcols){ my $val= $row{$col}; if($val eq ''){ $val='NULL'; } push(@values,$val); }} @AllValues=''; $k=shift(@theseIDs); @AllValues=@{$patient{$k}}; push(@AllValues,@values); $patient{"$k"}=[@AllValues]; } } } $sth->finish;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: stupid mistake in DBI code
by Fletch (Bishop) on Apr 26, 2011 at 16:22 UTC | |
by fidesachates (Monk) on Apr 26, 2011 at 16:24 UTC | |
by cliffrubinmusic (Novice) on Apr 26, 2011 at 17:01 UTC | |
by runrig (Abbot) on Apr 26, 2011 at 16:59 UTC | |
|
Re: stupid mistake in DBI code
by wind (Priest) on Apr 26, 2011 at 17:30 UTC | |
|
Re: stupid mistake in DBI code
by fidesachates (Monk) on Apr 26, 2011 at 16:13 UTC | |
|
Re: stupid mistake in DBI code
by runrig (Abbot) on Apr 26, 2011 at 19:09 UTC | |
by cliffrubinmusic (Novice) on Apr 26, 2011 at 22:35 UTC |