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 |
|
our $limit = 1000; |
16 |
|
|
17 |
require 'config.pl' if -e 'config.pl'; |
require 'config.pl' if -e 'config.pl'; |
18 |
|
|
19 |
my $table = param('table') || 'log'; |
$table = param('table') || $table; |
20 |
my @columns = param('columns'); |
my @columns = param('columns'); |
21 |
@columns = ('*') unless @columns; |
@columns = ('*') unless @columns; |
22 |
my $limit = param('limit') || 1000; |
$limit = param('limit') || $limit; |
23 |
my $offset = param('offset') || 0; |
my $offset = param('offset') || 0; |
24 |
|
|
25 |
my @where_parts = param('where_parts'); |
my @where_parts = param('where_parts'); |
39 |
while ( my @row = $sth->fetchrow_array ) { |
while ( my @row = $sth->fetchrow_array ) { |
40 |
my ( $n, $c ) = @row; |
my ( $n, $c ) = @row; |
41 |
$n = 'NULL' unless defined $n; |
$n = 'NULL' unless defined $n; |
42 |
print qq|<tr><td>$c</td><td>$n</td></tr>|; |
print qq|<tr><td>$c</td><td><a href="#">$n</a></td></tr>|; |
43 |
} |
} |
44 |
print qq|</table>|; |
print qq|</table>|; |
45 |
exit; |
exit; |
108 |
|
|
109 |
print $sth->rows, qq| rows in $t s</code>|; |
print $sth->rows, qq| rows in $t s</code>|; |
110 |
|
|
111 |
|
#my @types = map { scalar $dbh->type_info($_)->{TYPE_NAME} } @{ $sth->{TYPE} }; |
112 |
|
my $types = dump( $sth->{TYPE} ); |
113 |
|
print qq{ |
114 |
|
<script type="text/javascript"> |
115 |
|
var column_type = $types ; |
116 |
|
</script> |
117 |
|
}; |
118 |
|
|
119 |
@columns = @{ $sth->{NAME} } if $#columns == 0 && $columns[0] eq '*'; |
@columns = @{ $sth->{NAME} } if $#columns == 0 && $columns[0] eq '*'; |
120 |
|
|
121 |
print qq|<table id="results">|; |
print qq|<table id="results">|; |