Subject: | NUM_OF_FIELDS > 0 test is broken |
Date: | Mon, 8 Feb 2010 18:28:09 -0600 |
To: | <bug-DBD-Informix [...] rt.cpan.org> |
From: | Chris Salch <ChrisSalch [...] letu.edu> |
I have a small DAO module that attempts to use the following test as a
means of determining if a statement handle should be expected to return
results or not (Direct quote from the perldoc):
You can tell whether the statement is just executable or whether it is a
cursory (fetchable) statement by testing the Informix-specific attribute
ix_Fetchable. The approved, canonical DBI method of doing this check is
"$sth->{NUM_OF_FIELDS} > 0".
Unfortunately, this seems to return the a number greater than 0 on the
test system that I have available. A look at the code shows that there
are different checks for NUM_OF_FIELDS and ix_Fetchable which is
expectecd. What is not expected is that the suggested test fails.
The attached patch appears to fix this issue by doing the same check as
is used by ix_Fetchable and returning 0 if the statement is not
fetchable or the number of columns if it is. I'm not sure if there is a
better way to do this or not.
--
--------------------------------------------
Chris Salch
Programmer/Analyst
Message body is not shown because sender requested not to inline it.