[Omaha.pm] Quiz: select *

Jay Hannah jhannah at omnihotels.com
Fri Jan 28 12:38:12 PST 2005


 
Quiz: What's wrong with doing "select *" followed by fetchrow_array?

j


---

sub fill_airline_codes() {
    my ($dbh,$typ)=@_;
    my %ret;
    my $sqlstr=<<EOT;
        SELECT * FROM fg_airline_codes WHERE airline_id = ?;
EOT
    my $sth=$dbh->prepare($sqlstr) or fatal_error_handler("[$sqlstr][$DBI::errstr]\n");
    $sth->execute($typ)or fatal_error_handler("Execute of [$sqlstr][[$DBI::errstr]\n");
    my @t;
    while (@t = $sth->fetchrow_array) {
        for (@t) {
            s/[^ -~]//g;
            s/\s+$//;
        }
        $ret{$t[1]} = $t[3];
    }
    return \%ret;
}




More information about the Omaha-pm mailing list