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

[email protected] ("Roode, Eric")
Newsgroups perl.dbi.users
Message-ID <[email protected]>
On Saturday, October 16, 2010 10:08 AM, Martin J. Evans wrote:

> When I run your code with a different driver to MS SQL Server it works

> as I'd expect:
[...]

> print "Execute() returned $exec_retval.\n";
> print 'errstr is"', $sth->errstr, '"', "\n";
> 

> martin@bragi:~/svn/dbd-odbc/trunk/rt_data$ perl success_with_info.pl
> DBD::ODBC::st execute failed: [unixODBC][Easysoft][SQL Server
> Driver][SQL Server ]Cannot insert the value NULL into column
> 'enabled', table 'master.dbo.feeds'; column does not allow
> nulls. INSERT fails. (SQL-23000) [state was 23000 now 01000]
> [unixODBC][Easysoft][SQL Server Driver][SQL Server]The statement has
> been terminated. (SQL-01000) at success_with_info.pl line 103.
> Use of uninitialized value $exec_retval in concatenation (.) or string

> at success_with_info.pl line 110.
> Execute() returned .
> errstr is"[unixODBC][Easysoft][SQL Server Driver][SQL Server]Cannot
> insert the value NULL into column 'enabled', table
> 'master.dbo.feeds'; column does not allow nulls. INSERT
> fails. (SQL-23000) [state was 23000 now 01000]
> [unixODBC][Easysoft][SQL Server Driver][SQL Server]The statement has
> been terminated. (SQL-01000)"
> martin@bragi:~/svn/dbd-odbc/trunk/rt_data$
> 
> Which as far as I'm concerned is more evidence that your driver is 
> broken. Please send me the driver name, version etc you are using. At 
> the very least I may add a note that it is broken as there is little I

> might be able to do to work around this.

That's interesting -- what driver were you using for that test?
(as mentioned elsewhere in this thread, I am using SQLSRV32.DLL,
version 6.01.7600.16385, of 2009/07/13).

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?

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.