/[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 20 - (show annotations)
Sun Dec 3 18:03:30 2006 UTC (17 years, 5 months ago) by dpavlin
File MIME type: text/html
File size: 1297 byte(s)
loading of records from Model::Query now works
1 <%args>
2 $sth => undef
3
4 $sql_query
5 $name
6 $database
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->id,
28 ) %>
29 <div class="submit_button">
30 <% $action->button( label => 'Try it!' ) %>
31 </div>
32
33 % if ( defined($sth) ) {
34
35 <%perl>
36 my $save = Jifty->web->new_action(
37 class => 'CreateQuery',
38 arguments => {
39 sql_query => $action->form_field('sql_query'),
40 on_database => $action->form_field('database'),
41 }
42 );
43
44 </%perl>
45
46 <% $save->form_field('name') %>
47 <div class="submit_button">
48 <% $save->button( label => 'Save' ) %>
49 </div>
50
51 <table cellpadding="3" cellspacing="0" border="1">
52
53 <tr>
54 % foreach my $col ( @{ $sth->{'NAME'} } ) {
55 <th><% $col %></th>
56 % }
57 </tr>
58
59 % while ( my @row = $sth->fetchrow_array() ) {
60 <tr>
61 % foreach my $v ( @row ) {
62 <td><% defined($v) ? $v : 'NULL' %></td>
63 % }
64 </tr>
65 % }
66
67 </table>
68
69 % }
70
71 <% Jifty->web->return( label => "Go back" ) %>
72
73 <% Jifty->web->form->end() %>
74 </&>
75

  ViewVC Help
Powered by ViewVC 1.1.26