/[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 9 by dpavlin, Sat Dec 2 23:53:00 2006 UTC trunk/share/web/templates/sql revision 27 by dpavlin, Thu Dec 7 19:51:05 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    
13  my $action = Jifty->web->new_action(  my $execute_sql = Jifty->web->new_action(
14          class => 'DoSQL',          class => 'DoSQL',
15          moniker => 'execute_sql',          moniker => 'execute_sql',
16  );  );
# 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') %>  <% $execute_sql->form_field('sql_query',
26  <% $action->form_field('database') %>          default_value => $sql_query,
27  <% Jifty->web->form->submit( label => 'Try it!' ) %>  #       cols => 80,
28    #       rows => 5,
29    ) %>
30    <% $execute_sql->form_field('database',
31            default_value => $database,
32    ) %>
33    <div class="submit_button">
34    <% $execute_sql->button( label => 'Try it!' ) %>
35    
36    
37    % if ( defined($sth) ) {
38    
39    % warn "save SQL: ", $execute_sql->argument_value('sql_query');
40    
41    <% Jifty->web->link(
42            label => 'Save',
43            onclick => {
44                    region => 'save_query',
45                    replace_with => '/save',
46                    args => {
47                            sql_query => $execute_sql->argument_value('sql_query'),
48                            database => $execute_sql->argument_value('database'),
49                    },
50                    refresh_self => 1,
51                    toggle => 1,
52            },
53            as_button => 1,
54    ) %>
55    
56    </div>
57  <% Jifty->web->form->end() %>  <% Jifty->web->form->end() %>
58  </&>  
59    <% Jifty->web->region(
60            name => 'save_query',
61    ) %>
62    
63    </div>
64    
65  <table cellpadding="3" cellspacing="0" border="1">  <table cellpadding="3" cellspacing="0" border="1">
66    
# Line 30  $sth = $result->content('sth') if $resul Line 70  $sth = $result->content('sth') if $resul
70  % }  % }
71  </tr>  </tr>
72    
73    % my $rows = 0;
74  % while ( my @row = $sth->fetchrow_array() ) {  % while ( my @row = $sth->fetchrow_array() ) {
75    %       last if (++$rows > $max_rows);
76  <tr>  <tr>
77  %       foreach my $v ( @row ) {  %       foreach my $v ( @row ) {
78  <td><% $v %></td>  <td><% defined($v) ? $v : 'NULL' %></td>
79  %       }  %       }
80  </tr>  </tr>
81  % }  % }
82    
83  </table>  </table>
84    
85    % if ($sth->rows > $max_rows) {
86    <div class="note">
87    Query produced more than <% $max_rows %> rows, try adding <tt>LIMIT</tt> and
88    <tt>OFFSET</tt> to see another part of results.
89    </div>
90    % }
91    
92    % } else {
93    
94    </div><!-- submit_button -->
95    <% Jifty->web->form->end() %>
96    
97    % }
98    
99    <% Jifty->web->return( label => "Go back" ) %>
100    
101    </&>
102    

Legend:
Removed from v.9  
changed lines
  Added in v.27

  ViewVC Help
Powered by ViewVC 1.1.26