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

Diff of /trunk/share/web/templates/sql

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/share/web/templates/sql.html revision 12 by dpavlin, Sun Dec 3 00:12:25 2006 UTC trunk/share/web/templates/sql revision 26 by dpavlin, Mon Dec 4 19:24:25 2006 UTC
# Line 1  Line 1 
1  <%args>  <%args>
 $page => 1  
2  $sth => undef  $sth => undef
3    
4    $sql_query => undef
5    $name => undef
6    $database => undef
7    
8    $max_rows => 100
9    
10  </%args>  </%args>
11  <%init>  <%init>
12    
# Line 16  $sth = $result->content('sth') if $resul Line 22  $sth = $result->content('sth') if $resul
22    
23  <&| /_elements/wrapper, title => "Try out SQL query" &>  <&| /_elements/wrapper, title => "Try out SQL query" &>
24  <% Jifty->web->form->start() %>  <% Jifty->web->form->start() %>
25  <% $action->form_field('sql_query') %>  <% $action->form_field('sql_query',
26  <% $action->form_field('database') %>          default_value => $sql_query,
27  <% Jifty->web->form->submit( label => 'Try it!' ) %>  ) %>
28  <% Jifty->web->form->end() %>  <% $action->form_field('database',
29  </&>          default_value => $database,
30    ) %>
31    <div class="submit_button">
32    <% $action->button( label => 'Try it!' ) %>
33    
34    
35  % if ( defined($sth) ) {  % if ( defined($sth) ) {
36    
37    <% Jifty->web->link(
38            label => 'Save',
39            onclick => {
40                    region => 'save_query',
41                    replace_with => '/save',
42                    args => {
43                            sql_query => $action->argument_value('sql_query'),
44                            database => $action->argument_value('database'),
45                    },
46                    refresh_self => 1,
47                    toggle => 1,
48            },
49            as_button => 1,
50    ) %>
51    
52    </div>
53    <% Jifty->web->form->end() %>
54    
55    <% Jifty->web->region(
56            name => 'save_query',
57    ) %>
58    
59    </div>
60    
61  <table cellpadding="3" cellspacing="0" border="1">  <table cellpadding="3" cellspacing="0" border="1">
62    
63  <tr>  <tr>
# Line 32  $sth = $result->content('sth') if $resul Line 66  $sth = $result->content('sth') if $resul
66  % }  % }
67  </tr>  </tr>
68    
69    % my $rows = 0;
70  % while ( my @row = $sth->fetchrow_array() ) {  % while ( my @row = $sth->fetchrow_array() ) {
71    %       last if (++$rows > $max_rows);
72  <tr>  <tr>
73  %       foreach my $v ( @row ) {  %       foreach my $v ( @row ) {
74  <td><% defined($v) ? $v : 'NULL' %></td>  <td><% defined($v) ? $v : 'NULL' %></td>
# Line 42  $sth = $result->content('sth') if $resul Line 78  $sth = $result->content('sth') if $resul
78    
79  </table>  </table>
80    
81    % if ($sth->rows > $max_rows) {
82    <div class="note">
83    Query produced more than <% $max_rows %> rows, try adding <tt>LIMIT</tt> and
84    <tt>OFFSET</tt> to see another part of results.
85    </div>
86    % }
87    
88    % } else {
89    
90    </div><!-- submit_button -->
91    <% Jifty->web->form->end() %>
92    
93  % }  % }
94    
95    <% Jifty->web->return( label => "Go back" ) %>
96    
97    </&>
98    

Legend:
Removed from v.12  
changed lines
  Added in v.26

  ViewVC Help
Powered by ViewVC 1.1.26