Re: Questionable behaviour of fetchall_arrayref

"Greg Sabino Mullane" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


> Anyhow, I ran into an interesting new error message with simple queries that return no
> results and don't have any parameters -- like CREATE TABLE.
> On a laptop that didn't get updated yet I ran a little test script and found out that
> running $sth->fetchall_arrayref({}) after a CREATE TABLE would issue a (non-fatal) error:
...
> DBI bind_columns: invalid number of arguments: got handle + 0, expected handle + between 1 and -1
...
> Is this change intended, or is this the result of a missing sanity check or something? :)

Definitely not intended. It looks as if only {} does this. It calls db_st_fetch_attrib 
with an arg of NAME to get the column names. The number of fields is set to -1, so 
DBD::Pg returns an empty arrayref. bind_column tries to use that and barf. That's 
my quick peek at the problem: I'm not sure exactly where the breakdown is yet, 
but probably something should be doing some extra checking just before or after 
the hash key/column name lookup.

- -- 
Greg Sabino Mullane [email protected]
End Point Corporation http://www.endpoint.com/
PGP Key: 0x14964AC8 201211300107
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAlC4TSwACgkQvJuQZxSWSsgqMQCfbwuBfaVMQSqDXi1knvZ5rXb/
s24AoMFi+Oyk7ijx2pew1sr5qjS5XaWX
=nGe+
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.