/[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 84 - (hide annotations)
Tue Jan 30 14:08:47 2007 UTC (17 years, 4 months ago) by dpavlin
File size: 998 byte(s)
use on_database parameter for database id throughout all code,
implement save query using tangents and continuations
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     my $edit = Jifty->web->current_user->role('edit');
17     warn $edit ? 'edit mode for SQL' : 'student mode';
18    
19 dpavlin 80 #use Data::Dump qw/dump/;
20     #warn "q = ", dump( $q );
21 dpavlin 78
22     </%init>
23    
24     % if ($sth) {
25    
26     <table class="sql-result-table" cellpadding="3" cellspacing="0" border="1">
27    
28     <tr>
29     % foreach my $col ( @{ $sth->{'NAME'} } ) {
30     <th><% $col %></th>
31     % }
32     </tr>
33    
34     % my $rows = 0;
35     % while ( my @row = $sth->fetchrow_array() ) {
36     % last if (++$rows > $max_rows);
37     <tr>
38     % foreach my $v ( @row ) {
39     <td><% defined($v) ? $v : 'NULL' %></td>
40     % }
41     </tr>
42     % }
43    
44     </table>
45    
46     % if ($sth->rows > $max_rows) {
47     <div class="note">
48     Query produced more than <% $max_rows %> rows, try adding <tt>LIMIT</tt> and
49     <tt>OFFSET</tt> to see another part of results.
50     </div>
51     % }
52    
53    
54     % } # if $sth

  ViewVC Help
Powered by ViewVC 1.1.26