Obviously sorting the hash keys wont give you the columns
in the select statement order.

After doing something like:
  my $sth = $dbh->execute(@params) or die...

You can get back the lower case column names in the select 
statement order using:
  my @names = @{$sth->{NAME_lc}};

Note that $sth->{NAME_lc} is not always populated, depending 
upon your SQL.

Regards

Jeff


-----Original Message-----
From: Ged Haywood [mailto:[EMAIL PROTECTED]] 
Sent: 13 March 2002 10:30
To: Marcus Claesson
Cc: [EMAIL PROTECTED]
Subject: Re: Tie hashes in DBIx::Recordset [OT]


Hi there,

On Wed, 13 Mar 2002, Marcus Claesson wrote:

> How do I succesfully preserve the column order (''$fields'=>
> $joined_col') in my array-of-hashes generated using DBIx::Recordset?

Check out a Perl tutorial or the Camel book.  Perl's hashes do their own
thing with ordering, so unless you do something like (sort keys %hash)
you will get what you get.  Arrays can preserve sequences but involve
you in more coding much of the time.

73,
Ged.


Reply via email to