[resent as the original bounced (eventually) due to some configuration changes]


On Mon, Nov 05, 2007 at 07:51:19PM +0000, Martin J. Evans wrote:
> 
>        /* This was taken from DBD::Sybase 0.21 */
>        if(valuesv == &sv_undef) {
>           imp_dbh->odbc_err_handler = NULL;
>           } else if(imp_dbh->odbc_err_handler == (SV*)NULL) {
>           imp_dbh->odbc_err_handler = newSVsv(valuesv);
>        } else {
>           sv_setsv(imp_dbh->odbc_err_handler, valuesv);
>        }
> 
>  which works when I add:
> 
>        if(!SvOK(valuesv)) {
>           imp_dbh->odbc_err_handler = NULL;
>           }
> 
>  to the start of the if tests. It appears the "else" is always being hit even 
>  when setting odbc_err_handler to undef and then when DBD::ODBC tests 
>  dbh->odbc_err_handler it is not null and it attempts to run it. Anyone have 
>  any idea what is wrong with the original if test. Shouldn't that be 
>  &PL_sv_undef for a start? (not that that helps)

I'm sure the original code was wrong and using !SvOK(valuesv) is right.
(It's very hard to pass the internal read-only &sv_undef as a parameter.)

> Apparently this code is copied from DBD::Sybase.

At first sight it looks like DBD::Sybase may have the same issue for its
syb_err_handler and syb_row_callback attributes.

Tim.

Reply via email to