Is DBD::ODBC breaking the rules with this optimisation?

"Martin J. Evans" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Organization Easysoft Limited
Message-ID <[email protected]>
See RT http://rt.cpan.org/Public/Bug/Display.html?id=63550 which started this off.

DBD::ODBC optimises calls to the do method when no parameters are involved. Normally do is just a shortcut for prepare/execute except it should only be for non-result-set generating statements and hence does not return a statement handle. ODBC can optimise the do method to simply call SQLExecDirect instead of the normal SQLPrepare/SQLExecute (one round trip and other advantages). DBD::ODBC has been this way for years.

However, the person reporting this issue is attempting to use the handle passed to an error handler when do fails to obtain the Statement attribute. The handle DBD::ODBC passes in to the error handler is the connection handle as DBD::ODBC never created a DBI statement handle and hence there is no Statement attribute to access.

Is DBD::ODBC breaking the rules here with this optimisation?

Martin
-- 
Martin J. Evans
Easysoft Limited
http://www.easysoft.com
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.