mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-08-28 18:16:05 +00:00
Present SQL results in a more readable manner.
This commit is contained in:
parent
6047058865
commit
7994e8e011
@ -193,15 +193,15 @@ while( <RESULTS> ) {
|
||||
if ( defined(@{$queries}) && @{$queries} ) {
|
||||
print STDERR "Processing special queries\n" if ( $debug );
|
||||
foreach $sql_statement ( @$queries ) {
|
||||
# run SQL statement and dump results
|
||||
my $results = $dbh->selectall_arrayref($sql_statement);
|
||||
# run SQL statement and dump results, into array of hashes
|
||||
my $results = $dbh->selectall_arrayref($sql_statement, { Slice => {} } );
|
||||
foreach my $row ( @$results ) {
|
||||
print STDERR "Processing results row\n" if ( $debug );
|
||||
print "Query result ================================================\n" if ( $debug );
|
||||
my $sep = "";
|
||||
foreach my $column ( @$row ) {
|
||||
$column = 'NULL' unless ( defined($column) );
|
||||
print $sep, $column;
|
||||
$sep = " --- ";
|
||||
foreach my $name ( sort keys %$row ) {
|
||||
my $value = $row->{$name};
|
||||
$value = 'NULL' unless ( defined($value) );
|
||||
printf("%17.17s: >%s<\n", $name, $value );
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user