Re: SQL errors not making it back to Perl

[email protected] ("Martin J. Evans")
Newsgroups perl.dbi.users
Organization Easysoft Limited
Message-ID <[email protected]>
On 10/09/10 17:10, Roode, Eric wrote:
> Oho!  Here is a clue.  I removed
> 
>     odbc_cursortype => 2
> 
> from the DBI->connect attributes.  Now the error is trapped!
> The output was:
> 
>     handle_error: $state  is "42000".
>     handle_error: $msg    is "[Microsoft][ODBC SQL Server Driver][SQL
> Server]An error was raised. Input was "Some input parameter".".
>     handle_error: $native is "50000".
>     After execute: $retval is "55".
>     After execute: $p1     is "Some input parameter".
>     After execute: $p2     is "75".
>     Done.
> 
> Now I wonder a) why I put odbc_cursortype=>2 in there in the first place
> (I've been doing that for years), and b) why that breaks things.
> 
> -- Eric
> 
> 

Cursor type 2 is a dynamic cursor - I imagine it can make loads of difference. You should not use it unless you really are using multiple active statements (i.e. selecting from 2 or more stmts at the same time) and in any case there are better ways of doing that with modern SQL Servers with Mars_Connection.

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.