chiark / gitweb /
New dumpqueryresults component for handy debugging etc.
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 22 Aug 2009 12:35:28 +0000 (13:35 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 22 Aug 2009 12:35:28 +0000 (13:35 +0100)
yarrg/web/dumpqueryresults [new file with mode: 0644]
yarrg/web/profitable_trades

diff --git a/yarrg/web/dumpqueryresults b/yarrg/web/dumpqueryresults
new file mode 100644 (file)
index 0000000..c653d81
--- /dev/null
@@ -0,0 +1,20 @@
+<%args>
+$sth
+</%args>
+<table frame=box rules=all>
+<tr>
+% foreach my $field (@{ $sth->{NAME} }) {
+<th><% $field |h %>
+% }
+</tr>
+% my @row;
+% while (@row=$sth->fetchrow_array) {
+<tr>
+% foreach my $cell (@row) {
+<td>
+<% $cell |h %>
+</td>
+% }
+</tr>
+% }
+</table>
index 6aab676..1566baf 100755 (executable)
@@ -23,19 +23,7 @@ my $sth=$dbh->prepare(
 
 $sth->execute();
 </%perl>
-<table frame=box rules=all>
-<tr><td>commod</td><td>buy island</td><td>buy stall</td><td>buy price</td><td>buy quantity</td><td>sell island</td><td>sell stall</td><td>sell price</td><td>sell qty</td></tr>
-% my @row;
-% while (@row=$sth->fetchrow_array) {
-<tr>
-% foreach my $cell (@row) {
-<td>
-<% $cell %>
-</td>
-% }
-</tr>
-% }
-</table>
+<& dumpqueryresults, sth => $sth &>
 
 </BODY>
 </HTML>