Re: records returned by DBI::selectall_hashref() are not ordered
- From: 2ge@xxxxxx (Ing. Branislav Gerzo)
- Date: Fri, 27 May 2005 08:46:53 +0200
Yu Wang [YW], on Friday, May 27, 2005 at 05:50 (+0000 (UTC)) wrote
these comments:
$ref_rsch = $dbh->>selectall_hashref('
YW> Any ideas and suggestions?
yes, as you maybe know, hashes in Perl aren't ordered for some
purposes (security & speed). If you have to use hashref, just order
them in program, as you order normal hashes. I use for example:
$hr->{categories} = get_categories($hr);
^^-- make hash in hashref (subquery)
$hr->{categories_index} = [ sort { $a <=> $b } keys %{$hr->{categories}} ]
^^-- get ordered list by categories (HoH)
$hr->{cattable_index} = [ reverse sort { $hr->{$a}{counter} <=>
$hr->{$b}{counter} } keys %{$hr} ];
^^- sort that by value
--
How do you protect mail on web? I use http://www.2pu.net
[He's a modest little person, with much to be modest about]
.
- References:
- Prev by Date: Re: records returned by DBI::selectall_hashref() are not ordered
- Next by Date: Re: Question about installation for DBI
- Previous by thread: Re: records returned by DBI::selectall_hashref() are not ordered
- Next by thread: Re: records returned by DBI::selectall_hashref() are not ordered
- Index(es):
Relevant Pages
|
|