Re: There's an error, but $sth->execute returns -1

[email protected] ("Martin J. Evans")
Newsgroups perl.dbi.users
Message-ID <[email protected]>
  On 18/10/2010 18:11, Roode, Eric wrote:
> On Monday, October 18, 2010 12:27 PM, Martin J. Evans wrote:
> [...]
>> I looked at this some more and I'm even more sure it is a bug.
>>
>> The TDS protocol for your situation returns:
>>
>> tds_error - failed to insert null
>> tds_info  - statement has been terminated
>> a load of done_procs
>> the return argument of your procedure containing error in add feed
>>
>> I think the driver is seeing the error but then its idea is
>> overidden by the tds_info packet. Later native client drivers (and
>> our driver) see exactly the same but they acknowledge the tds_error
>> as being the final state and don't override it with the tds_info.
>>
>> BTW, the state returned is 23000 so you might be able to look at
>> that (in $sth->state). I thought you might also be able to look at
>> the return of your procedure but that is not possible. You could
>> also perhaps do something with the odbc_err_handler.
> Thanks, Martin.
>
> What is this TDS and where can I learn more about it?
>
> -- Eric
>
>

TDS (Tabular Data Stream) is the protocol MS SQL Server and Sybase use.
It is a proprietary protocol and although I've seen snippets of it 
documented on the net I don't know where you can go to find it now. You 
could of course look at the freeTDS project which attempts to duplicate 
TDS but I imagine that would mean looking at the source.

I am however, pretty confident the ODBC driver you (and I) are using is 
broken. I back this up with:

o later MS drivers behave differently and correctly
o the state returned is 23000 which is not an informational state
o it is just obviously an error
o it contradicts MS's own documentation for ODBC

I don't see a reasonable workaround I would be happy to apply to 
DBD::ODBC so it is I'm afraid left to you to workaround it or upgrade to 
a working driver or get MS to fix your existing driver. Sorry.

Martin
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.