90 |
if ( $group_by ) { |
if ( $group_by ) { |
91 |
@columns = ( "count($group_by)", $group_by ); |
@columns = ( "count($group_by)", $group_by ); |
92 |
my $g; |
my $g; |
93 |
foreach my $c ( @where_parts, param('order_by'), $group_by ) { |
foreach my $c ( @where_parts, $group_by ) { |
94 |
$c =~ s/\s.+$//; |
$c =~ s/\s.+$//; |
95 |
$g->{$c}++ if length($c) > 0; |
$g->{$c}++ if length($c) > 0; |
96 |
} |
} |
99 |
param('where_value',''); |
param('where_value',''); |
100 |
param('group_by', $group_by); |
param('group_by', $group_by); |
101 |
param('columns', [ @columns ], [ @columns ]); |
param('columns', [ @columns ], [ @columns ]); |
102 |
|
param('order_by', $columns[0] . ' desc'); |
103 |
} else { |
} else { |
104 |
$group_by = param('group_by'); |
$group_by = param('group_by'); |
105 |
} |
} |
178 |
qq|</table>| |
qq|</table>| |
179 |
, start_form( -id => 'sql' ) |
, start_form( -id => 'sql' ) |
180 |
|
|
181 |
|
, qq|<a href="#" onclick="\$('form#sql').toggleClass('visible'); return false;" class=close>close</a>| |
182 |
|
|
183 |
, qq|<label for=columns>select</label>| |
, qq|<label for=columns>select</label>| |
184 |
, checkbox_group( -name => 'columns', -values => [ @columns ], -defaults => [ @columns ] ) |
, checkbox_group( -name => 'columns', -values => [ @columns ], -defaults => [ @columns ] ) |
185 |
|
|