Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: Getting MSSQL message return on DBI

by JamesNC (Chaplain)
on Oct 30, 2005 at 15:40 UTC ( #504006=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Getting MSSQL message return on DBI
in thread Getting MSSQL message return on DBI

I am not sure I understand your question. But if you are wondering how to get the results of a statement handle with multiple result sets you should have code like:

my @rs; #result set do { while( my $hr = $sth->fetchrow_hashref ){ push @rs, $hr; } #process @rs (array of hashrefs in order the server returned them ) } while ( $sth->{odbc_more_results} );
If your question is about the error still, then you need to read perldoc DBI and DBD::ODBC for more specifics on how errors are handled an some suggestions on methods to do that. There are some additional flags you can set in both the db handle such as { RaiseError=> 1 } and in the statement handle. In general a common error handle method is to wrap your calls in eval {}; and check $@.


Comment on Re^3: Getting MSSQL message return on DBI
Download Code
Re^4: Getting MSSQL message return on DBI
by shonorio (Hermit) on Oct 30, 2005 at 18:49 UTC
    This query do not return a 'selected table result' like, they output DBCC print message like bellow, and because this I cant not get values by fetch* DBI method.
    DBCC SHOWCONTIG scanning 'Orders' table... Table: 'Orders' (21575115); index ID: 1, database ID: 6 TABLE level scan performed. - Pages Scanned................................: 20 - Extents Scanned..............................: 5 - Extent Switches..............................: 4 - Avg. Pages per Extent........................: 4.0 - Scan Density [Best Count:Actual Count].......: 60.00% [3:5] - Logical Scan Fragmentation ..................: 0.00% - Extent Scan Fragmentation ...................: 40.00% - Avg. Bytes Free per Page.....................: 146.5 - Avg. Page Density (full).....................: 98.19% DBCC execution completed. If DBCC printed error messages, contact your + system administrator.
    Talking about Win32::OLE, I can do this with a code like bellow. I need to translate the Win32::OLE code to DBI, but I can't see a way to get theses messages.
    Solli Moreira Honorio
    Sao Paulo - Brazil

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://504006]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2014-12-20 14:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls