Subject: | fetchall_arrayref for DBD::File says "Attempt to fetch row from a Non-SELECT statement" |
Using DBD::File via DBD::CSV, I think I found the following error. In
my program, CSV database is queried using a select:
my $sth = $dbh->prepare( <<__QUERY_GLUE );
SELECT NAMESERVERNAAM, IP_ADRES
FROM DRS_V_NS_IP_ADRES
ORDER BY NAMESERVERNAAM
__QUERY_GLUE
while(1)
{ my $rows = $sth->fetchall_arrayref(undef, ROW_CACHE_SIZE);
defined $rows && @$rows or return;
foreach (@$rows) ...
}
An error is produced:
DBD::CSV::st fetchall_arrayref failed: Attempt to fetch row from a
Non-SELECT statement
Print statements in the DBD::File and DBI show me the following.
The loop is found in DBI line 7675. The first call to fetch_arrayref
returns less than ROW_CACHE_SIZE elements. Then DBD::File line 465
finishes the statement. DBD::File line 453 then deletes the data record
from the sth. Now, the second call to fetchall_arrayref cannot find the
data-record anymore, and produces the error.
Probably, the error message is not ok... it should only be produced when
there is no data and !$stmt->{'NUM_OF_FIELDS'}.