/[SQLSession]/trunk/share/web/templates/fragments/results
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/share/web/templates/fragments/results

Parent Directory Parent Directory | Revision Log Revision Log


Revision 112 - (hide annotations)
Wed Apr 11 20:07:55 2007 UTC (17 years, 1 month ago) by dpavlin
File size: 895 byte(s)
cleanup
1 dpavlin 78 <%args>
2     $sth => undef
3     $q => undef
4     $max_rows => 100
5     </%args>
6     <%init>
7    
8     my $query = Jifty->web->new_action(
9     class => 'DoSQL',
10     moniker => 'query',
11     );
12    
13     my $result = Jifty->web->response->result('query');
14     $sth = $result->content('sth') if $result and !defined $sth;
15    
16 dpavlin 80 #use Data::Dump qw/dump/;
17     #warn "q = ", dump( $q );
18 dpavlin 78
19     </%init>
20    
21     % if ($sth) {
22    
23     <table class="sql-result-table" cellpadding="3" cellspacing="0" border="1">
24    
25     <tr>
26     % foreach my $col ( @{ $sth->{'NAME'} } ) {
27     <th><% $col %></th>
28     % }
29     </tr>
30    
31     % my $rows = 0;
32     % while ( my @row = $sth->fetchrow_array() ) {
33     % last if (++$rows > $max_rows);
34     <tr>
35     % foreach my $v ( @row ) {
36     <td><% defined($v) ? $v : 'NULL' %></td>
37     % }
38     </tr>
39     % }
40    
41     </table>
42    
43     % if ($sth->rows > $max_rows) {
44     <div class="note">
45     Query produced more than <% $max_rows %> rows, try adding <tt>LIMIT</tt> and
46     <tt>OFFSET</tt> to see another part of results.
47     </div>
48     % }
49    
50    
51     % } # if $sth

  ViewVC Help
Powered by ViewVC 1.1.26