From: Dobrica Pavlinusic Date: Sat, 13 Dec 2014 16:08:58 +0000 (+0100) Subject: break down register by boiler model X-Git-Url: http://git.rot13.org/?p=vrDialog;a=commitdiff_plain;h=2424a155921267182fbf17acdd135f0a93fcf36a break down register by boiler model --- diff --git a/db3-dump.pl b/db3-dump.pl index c6ec14e..fdaa541 100755 --- a/db3-dump.pl +++ b/db3-dump.pl @@ -18,7 +18,9 @@ sub lookup { $sth->execute; while( my $row = $sth->fetchrow_arrayref ) { - $data->{ $row->[0] } = $row->[1]; + my @r = @$row; + my $id = shift @r; + $data->{ $row->[0] } = $#$row == 1 ? $row->[1] : join('', @r); } return $data; @@ -42,20 +44,27 @@ my $units = lookup( qq{ select Id, TexteEN from "UnitNames" }); +my $diags = lookup( qq{ +select Id,x0136,x0142,x0144,x0147,x0151,x0152,x0153,x0158,x0160,x0161 from "DiagnoseDaten" +}); +warn "# diags = ",dump($diags); + my $sth = $dbh->prepare( qq{ select * from "ComuInfos" order by adresse }); + $sth->execute; while( my $row = $sth->fetchrow_hashref ) { my $hint = $hints->{ $row->{texteid} }; $hint =~ s/[\r\n]+/ | /gs; - printf "%-3d %02x %-27s %-15s %s %s [ %s ]\n", + printf "%-3d %02x %-27s %-15s |%s| %s %s [ %s ]\n", $row->{adresse}, $row->{adresse}, $types->{ $row->{typid} }, $units->{ $row->{id} }, + $diags->{ $row->{id} } || ' ', $row->{symbolname}, $names->{ $row->{texteid} } || $row->{symbolname}, $hint,