On Tue, Oct 7, 2008 at 9:32 AM, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > On Tue, 2008-10-07 at 09:02 -0700, Douglas Wilson wrote: > > BTW, don't use "SELECT *". If your DBA rebuilds the tables with a > different column order, your code will fail. Specifically name the > columns (or if you really have to, use the _hashref methods to fetch; > that way you can select the correct column via the hash).
Don't worry, I only use select * when I don't care about order, and I usually use bind_columns..e.g.: my $sth = $dbh->prepare("select * from my_table"); $sth->execute(); my @names = @{$sth->{NAME_lc}}; my %row; $sth->bind_columns([EMAIL PROTECTED]@names}); while ( $sth->fetch() ) { ... } Cheers, Doug