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

[email protected] ("Roode, Eric")
Newsgroups perl.dbi.users
Message-ID <[email protected]>
On Monday, October 18, 2010 10:21 AM, Eric Roode wrote:
[...]

> I spoke to a database guy I know at Microsoft; he was of the opinion
> that since the sproc was *called* successfully, it was not an error
> condition, and that I need to parse the return info (error message).
> He wasn't speaking authoritatively though, and I don't know if this is
> true in general.  Do you happen to know what counts as an "error
condition"
> for SQL Server / ODBC?  And what counts as SQL_SUCCESS_WITH_INFO?

This page:
http://msdn.microsoft.com/en-us/library/ms714687%28v=VS.85%29.aspx
has some interesting info about the STATE that gets returned.  In
particular,
it shows that the state code 23000 (which is what I got) means
"Integrity
constraint violation".  So I suppose if $sth->execute() returns -1, I
should
also look at $sth->state().

That page also says that if the first two characters of the state are
"01", then it's a warning, and the driver should return
SQL_SUCCESS_WITH_INFO;
and if the first two characters are anything else, it's an error, and
the driver should return SQL_ERROR.  So that does point to it being a
driver bug.

Thanks,
-- Eric
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.