in reply to Re: DBI returning mysql columns in strange order.
in thread DBI returning mysql columns in strange order.
Will get things EXACTLY where you want them, so wouldmy $select = qq~SELECT field1 field2 field3 FROM $ref;~; my $sth = $dbh->prepare( $select ); $sth->execute(); my ($field1, $field2, $field3) = $sth->fetchrow_array;
Or the alternative of having DBI return and arrayref.my @inarray = $sth->fetchrow_array();
But is the idea fo specifying the specific fields extensible and maintainable? My logic would be that if the table structure changes then wildcard of fields does not need to be changed. If you use the HASHREF methods of collecting the data from DBI then you only need be concerned about the actual fields when you look into the HASH for the values.
Of course I stand to be corrected on this, but I would think that having to change the code as well as the SQL is less maintainable than just having to change the code.
Just like him: All opinions are purely mine and all code is untested, unless otherwise specified
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: DBI returning mysql columns in strange order.
by dragonchild (Archbishop) on Oct 10, 2003 at 14:53 UTC | |
by mpeppler (Vicar) on Oct 10, 2003 at 17:36 UTC |