/[sql-web-session]/index.cgi
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 /index.cgi

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

revision 10 by dpavlin, Tue Apr 14 19:54:56 2009 UTC revision 17 by dpavlin, Sat Apr 18 12:08:07 2009 UTC
# Line 11  use Time::HiRes qw/time/; Line 11  use Time::HiRes qw/time/;
11    
12  our $dsn    = 'DBI:Pg:dbname=syslog';  our $dsn    = 'DBI:Pg:dbname=syslog';
13  our $user   = 'dpavlin';  our $user   = 'dpavlin';
14    our $table  = 'log';
15    
16  require 'config.pl' if -e 'config.pl';  require 'config.pl' if -e 'config.pl';
17    
18  my $table = param('table') || 'log';  $table  = param('table') || $table;
19  my @columns = param('columns');  my @columns = param('columns');
20  @columns = ('*') unless @columns;  @columns = ('*') unless @columns;
21  my $limit = param('limit') || 1000;  my $limit = param('limit') || 1000;
# Line 37  if ( my $group_by = param('add_group_by' Line 38  if ( my $group_by = param('add_group_by'
38          while ( my @row = $sth->fetchrow_array ) {          while ( my @row = $sth->fetchrow_array ) {
39                  my ( $n, $c ) = @row;                  my ( $n, $c ) = @row;
40                  $n = 'NULL' unless defined $n;                  $n = 'NULL' unless defined $n;
41                  print qq|<tr><td>$c</td><td>$n</td></tr>|;                  print qq|<tr><td>$c</td><td><a href="#">$n</a></td></tr>|;
42          }          }
43          print qq|</table>|;          print qq|</table>|;
44          exit;          exit;
# Line 52  print header, q| Line 53  print header, q|
53  <!-- http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js -->  <!-- http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js -->
54  <script type="text/javascript" src="jquery-1.3.2.min.js"></script>  <script type="text/javascript" src="jquery-1.3.2.min.js"></script>
55    
 <!-- insert firebug lite because we use console.* all over -->  
 <!-- http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js -->  
 <script type="text/javascript" src="firebug-lite-compressed.js"></script>  
 <script type="text/javascript">  
 firebug.env.height = 100;  
 </script>  
   
56  <script type="text/javascript" src="sql-editor.js"></script>  <script type="text/javascript" src="sql-editor.js"></script>
57    
58  </head>  </head>
# Line 113  $t = time() - $t; Line 107  $t = time() - $t;
107    
108  print $sth->rows, qq| rows in $t s</code>|;  print $sth->rows, qq| rows in $t s</code>|;
109    
110    #my @types = map { scalar $dbh->type_info($_)->{TYPE_NAME} } @{ $sth->{TYPE} };
111    my $types = dump( $sth->{TYPE} );
112    print qq{
113    <script type="text/javascript">
114    var column_type = $types ;
115    </script>
116    };
117    
118  @columns = @{ $sth->{NAME} } if $#columns == 0 && $columns[0] eq '*';  @columns = @{ $sth->{NAME} } if $#columns == 0 && $columns[0] eq '*';
119    
# Line 140  print Line 141  print
141          qq|</table>|          qq|</table>|
142          , start_form( -id => 'sql' )          , start_form( -id => 'sql' )
143    
144          , qq|<a href="#" onclick="\$('form#sql').toggleClass('visible'); return false;" class=close>close</a>|          , qq|<a href="#" onclick="\$('form#sql').toggleClass('visible'); return false;" class=close title="hide sql editor">[x]</a>|
145    
146          , qq|<label for=columns>select</label>|          , qq|<label for=columns>select</label>|
147          , checkbox_group( -name => 'columns', -values => [ @columns ], -defaults => [ @columns ] )          , checkbox_group( -name => 'columns', -values => [ @columns ], -defaults => [ @columns ] )
# Line 157  print Line 158  print
158                  <span>                  <span>
159                  <input type=button name=add_group_by>                  <input type=button name=add_group_by>
160                  <input type=button name=close_group_by value="[x]" disabled=1>                  <input type=button name=close_group_by value="[x]" disabled=1>
161                  <div id="lookup">...loading...</div>                  <div id="lookup"></div>
162                  <span>                  <span>
163          |          |
164    

Legend:
Removed from v.10  
changed lines
  Added in v.17

  ViewVC Help
Powered by ViewVC 1.1.26