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!
In reply to fetchrow_hashref Not returning Dates by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |