当我以这种方式获取数据时,是否可以访问列名和列类型,还是需要显式prepare
访问?
use DBI;
my $dbh = DBI->connect( ... );
my $select = "...";
my @arguments = ( ... );
my $ref = $dbh->selectall_arrayref( $select, {}, @arguments, );
更新:
我prepare
会这样做:
my $sth = $dbh->prepare( $select );
$sth->execute( @arguments );
my $col_names = $sth->{NAME};
my $col_types = $sth->{TYPE};
my $ref = $sth->fetchall_arrayref;
unshift @$ref, $col_names;