diff options
| author | Abigail <abigail@abigail.be> | 2020-11-30 14:21:41 +0100 |
|---|---|---|
| committer | Abigail <abigail@abigail.be> | 2020-11-30 14:22:54 +0100 |
| commit | f57745d7d001edf53bbbe4cd7996a8d7891dba3b (patch) | |
| tree | 393a0664ce1f5336dc81f6858eb112ba47f53b2a /challenge-089/abigail | |
| parent | ac8d5ef269002a40b6e1dfa931bc73b601a438a3 (diff) | |
| download | perlweeklychallenge-club-f57745d7d001edf53bbbe4cd7996a8d7891dba3b.tar.gz perlweeklychallenge-club-f57745d7d001edf53bbbe4cd7996a8d7891dba3b.tar.bz2 perlweeklychallenge-club-f57745d7d001edf53bbbe4cd7996a8d7891dba3b.zip | |
Deal with compound SQL statements.
Diffstat (limited to 'challenge-089/abigail')
| -rwxr-xr-x | challenge-089/abigail/test.pl | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/challenge-089/abigail/test.pl b/challenge-089/abigail/test.pl index 5f6950ed3c..5b9279313a 100755 --- a/challenge-089/abigail/test.pl +++ b/challenge-089/abigail/test.pl @@ -273,10 +273,12 @@ sub test_sql ($dbh, $query, $tables_info, $input) { # Run the query. If we have multiple results, join columns # by spaces, and rows by newlines. # - my $result = $dbh -> selectall_arrayref ($real_query); + foreach my $query (split /^\s*;\s*$/m => $real_query) { + my $result = $dbh -> selectall_arrayref ($query); + $output .= join "\n" => map {join " " => @$_} @$result; + $output .= "\n"; + } - $output .= join "\n" => map {join " " => @$_} @$result; - $output .= "\n"; last unless @input; } |
