Skip Menu |

This queue is for tickets about the DBI CPAN distribution.

Report information
The Basics
Id: 122744
Status: open
Priority: 0/
Queue: DBI

People
Owner: Nobody in particular
Requestors: victor [...] vsespb.ru
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.634
Fixed in: (no value)



Subject: HandleError receives statement handle, despite the docs
Docs says HandleError receives DBI handle === The subroutine is called with three parameters: the error message string that RaiseError and PrintError would use, the DBI handle being used, and the first value being returned by the method that failed (typically undef). === but actually sometimes it receives a statement handle (DBI::st). need to either fix docs or code
Can you please provide a sample code that demonstrates this thesis? Including 'perl -v' output, DBI version etc.?
On Tue Aug 08 10:20:08 2017, vsespb wrote: Show quoted text
> Docs says HandleError receives DBI handle > === > The subroutine is called with three parameters: the error message > string that RaiseError and PrintError would use, the DBI handle being > used, and the first value being returned by the method that failed > (typically undef). > === > but actually sometimes it receives a statement handle (DBI::st).
"the DBI handle being used" means it'll be called with a database handle when the error occurred on a database handle, and called with a statement handle when the error occurred on a statement handle. Some methods might be called on a database handle but internally they create and use a statement handle, such as the select_* methods. I'd be delighted if you can find a case where the above isn't true. Or if you'd suggest a concise improvement to the docs that would have avoided the misunderstanding. Meanwhile I'll code the ticket. It'll reopen if you reply. Thanks.

Message body is not shown because it is too large.

Thanks for the test case, and sorry for the delay replying. I think your example demonstrates what I said earlier, "Some methods might be called on a database handle but internally they create and use a statement handle, such as the select_* methods."
On Sun Jan 28 19:30:33 2018, TIMB wrote: Show quoted text
> Thanks for the test case, and sorry for the delay replying. > I think your example demonstrates what I said earlier, "Some methods > might be called on a database handle but internally they create and > use a statement handle, such as the select_* methods."
Show quoted text
> "the DBI handle being used" means it'll be called with a database handle when the error occurred on a database handle, and called with a statement handle when the error occurred on a statement handle. Some methods might be called on a database handle but internally they create and use a statement handle, such as the select_* methods
Ok, I understand this. I think this really vague. 1) The package is named DBI. There is connect method, which returns database handle. So people may think that "DBI handle" referrs to handle of class DBI (under the hood that it's not blessed to 'DBI', but it's internals already) 2) If clever people don't think that way and understand that "DBI handle being used" means "any kind of object, which is used internally by DBI class and subclasses, which can be referred as "handle" in this documentation", then it still does not help, because to use that object (call method, ready properties etc) you should understand it's interface, i.e. you should have exhausive list of classes, that can be used here. I propose changing docs to: === The subroutine is called with three parameters: the error message string that RaiseError and PrintError would use, handle being used (database handle or statement handle, depending of internal implementation of the method that failed), and the first value being returned by the method that failed (typically undef). ===