Bugfix: Default SQLReport output columns randomly ordered

This commit is contained in:
Len Kranendonk 2004-10-12 07:48:06 +00:00
parent ba1525d091
commit d3a8d76aa5
3 changed files with 21 additions and 1 deletions

View file

@ -1,3 +1,7 @@
6.3.0
- bugfix [ 1045114 ] Columns randomly ordered in SQLReport (Len Kranendonk ,
tnx brother for reporting)
6.2.7 6.2.7
- Expanded upon the help for URL extensions. - Expanded upon the help for URL extensions.
- Added a workaround to a bug in Time::HiRes on windows. - Added a workaround to a bug in Time::HiRes on windows.

View file

@ -193,6 +193,21 @@ sub getBarTraditional {
} }
#-------------------------------------------------------------------
=head2 getColumnNames ( )
Returns an array containing the column names
=cut
sub getColumnNames {
if(ref $_[0]->{_columnNames} eq 'ARRAY') {
return @{$_[0]->{_columnNames}};
}
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 getFirstPageLink ( ) =head2 getFirstPageLink ( )
@ -493,6 +508,7 @@ sub setDataByQuery {
$sth = WebGUI::SQL->read($sql,$dbh); $sth = WebGUI::SQL->read($sql,$dbh);
} }
$self->{_totalRows} = $sth->rows; $self->{_totalRows} = $sth->rows;
$self->{_columnNames} = [ $sth->getColumnNames ];
my $pageCount = 1; my $pageCount = 1;
while (my $data = $sth->hashRef) { while (my $data = $sth->hashRef) {
$rowCount++; $rowCount++;

View file

@ -140,7 +140,7 @@ sub www_view {
my %row; my %row;
my $colnum = 1; my $colnum = 1;
my @fields; my @fields;
foreach my $name (keys %{$data}) { foreach my $name ($p->getColumnNames) {
if ($first) { if ($first) {
push(@columns,{ push(@columns,{
'column.number'=>$colnum, 'column.number'=>$colnum,