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

Contents of /trunk/share/web/templates/sql.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 21 - (show annotations)
Sun Dec 3 19:47:39 2006 UTC (17 years, 5 months ago) by dpavlin
File MIME type: text/html
File size: 1435 byte(s)
saving of queries now work
1 <%args>
2 $sth => undef
3
4 $sql_query => undef
5 $name => undef
6 $database => undef
7
8 </%args>
9 <%init>
10
11 my $action = Jifty->web->new_action(
12 class => 'DoSQL',
13 moniker => 'execute_sql',
14 );
15
16 my $result = Jifty->web->response->result('execute_sql');
17 $sth = $result->content('sth') if $result and !defined $sth;
18
19 </%init>
20
21 <&| /_elements/wrapper, title => "Try out SQL query" &>
22 <% Jifty->web->form->start() %>
23 <% $action->form_field('sql_query',
24 default_value => $sql_query,
25 ) %>
26 <% $action->form_field('database',
27 default_value => $database,
28 ) %>
29 <div class="submit_button">
30 <% $action->button( label => 'Try it!' ) %>
31
32
33 % if ( defined($sth) ) {
34
35 <% Jifty->web->link(
36 label => 'Save',
37 onclick => {
38 region => 'save_query',
39 prepend => '/save',
40 args => {
41 sql_query => $action->argument_value('sql_query'),
42 database => $action->argument_value('database'),
43 },
44 refresh_self => 1,
45 toggle => 1,
46 },
47 # as_button => 1,
48 ) %>
49
50 </div>
51 <% Jifty->web->form->end() %>
52
53 <% Jifty->web->region(
54 name => 'save_query',
55 ) %>
56
57 </div>
58
59 <table cellpadding="3" cellspacing="0" border="1">
60
61 <tr>
62 % foreach my $col ( @{ $sth->{'NAME'} } ) {
63 <th><% $col %></th>
64 % }
65 </tr>
66
67 % while ( my @row = $sth->fetchrow_array() ) {
68 <tr>
69 % foreach my $v ( @row ) {
70 <td><% defined($v) ? $v : 'NULL' %></td>
71 % }
72 </tr>
73 % }
74
75 </table>
76
77 % } else {
78
79 </div><!-- submit_button -->
80 <% Jifty->web->form->end() %>
81
82 % }
83
84 <% Jifty->web->return( label => "Go back" ) %>
85
86 </&>
87

  ViewVC Help
Powered by ViewVC 1.1.26