Hello -
When using DBD::Pg through DBI, can somebody tell me if it is necessary
to be calling the $sth->finish routine? The DBI.pm documentation states
that there is no need to call it if you call $sth->fetchrow_xxxref until
the rows are exhausted - finish should get called automatically, and
$sth->{'Active'} should change to false.
However, if I don't call $sth->finish after reading all rows, then
$sth->{'Active'} is still true - which makes it useless to test. Also,
it seems that if I call $sth->fetchrow_hashref (or
$sth->fetchrow_arrayref) until I exhaust the rows and get an undef, I
can actually then call it again and it will start over from the first
row in the result set (is this supposed to happen?). Which, if for some
reason you do this, can send you into an endless loop of rereading the
result set.
By all appearances in my code, it does not seem necessary to call
finish, and I get no errors even if I intentionally try to force one by
starting a new query before I have read all the rows from the first
(similar to the example in DBI.pm). However, the interaction with the
Active attribute, and who knows what else, does not seem to work as
implied in the docs.
Anybody have any experience with this, with postgres or otherwise? I am
hoping that my resulting code will be portable, but I have not yet used
DBI with another database system, so it is rather important that
whatever works with DBD::Pg will also work with others!
--d