Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I recently needed to modify a loop that was reading the results of a SELECT statement from fetchrow_array format to fetchrow_hashref for clarity and to accomodate new fields to be processed. The SELECT statement requests several character, number, and date fields. The two date fields have always been requested with "to_char" formatting.
Previously, my while statement looked like this...
while ( ($granule_name, $path, $start_date, $stop_date, $byte_size) = +$sth->fetchrow_array) { ... }
Now it looks like this...
while ( $lhref = $sth->fetchrow_hashref('NAME_lc') ) { ... }
In addition to the granule_name (char), path (char), start_date (date->to_char), stop_date (date->to_char), and byte_size (number) fields, I've added two more fields to the end of the SELECT statement i.e. num_passes (number) and browse_avail (char).
The problem is that now all of the values are returned except for the two date fields. Remember that I have applied "to_char" formatting to them, so they are being returned as character values. Can anyone tell me why the fields before and after the date->to_char fields are being returned in the hash but not the date->to_char fields themselves? Many thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: fetchrow_hashref Not returning Dates
by astroboy (Chaplain) on Sep 03, 2009 at 02:00 UTC | |
by Anonymous Monk on Sep 03, 2009 at 16:52 UTC | |
by Anonymous Monk on Nov 01, 2010 at 19:17 UTC | |
|
Re: fetchrow_hashref Not returning Dates
by roboticus (Chancellor) on Sep 03, 2009 at 01:53 UTC |