[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] Quiz: select *



 
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;
}