Hi,

I'm fairly new to using DBD::ADO, but I was wondering whether there is a way to 
return both an output parameter and a sql print statement from a stored 
procedure.  I've been trying to do it and have come across what seems like 
possibly an issue with the module (or my usage is incorrect or never intended 
or something).  For example, if I have a stored procedure set up which accepts 
10 parameters, the 10th also being an output parameter, and in the stored 
procedure there is also a print statement that prints either "inserted values" 
or "updated values" depending on which occurred in the stored procedure, then 
when I run:

use DBD::ADO;
my $dbh = DBI->connect("dbi:ADO:PROVIDER=SQLOLEDB;Data Source=X;INITIAL 
CATALOG=catalogname;", "", "", { 'PrintError' => 0, 'RaiseError' => 0, 
'PrintWarn' => 0 }) or die $DBI::errstr;
my $myID = 0;
my $sth = $dbh->prepare('InsertUpdateTestProgram', { CommandType => 
'adCmdStoredProc' } ) or die $dbh->errstr;
$sth->bind_param_inout(10, \$myID,10,4);
$sth->execute(1..9);

I can catch the print statement with something like:
if($sth->state =~ /01000/) {
if($sth->errstr =~ /Description : (.+)/) {print "\t$1\n";}
} else {
die "goodbye cruel world .  SQL Error: $DBI::errstr\n";
}

But $myID does not get set to the value of the output parameter which seems to 
be due to lines 1234 and 1235 in the execute subroutine of ADO.pm where the 
error code generated by the print statement causes execute to return through:

1234: return if DBD::ADO::Failed( $sth,"Can't Execute Command '$sql'");
1235: _retrieve_out_params( $sth );

So the output parameter never gets retrieved.  Is there some way of handling 
the print statement with the module that I am not using which would allow me to 
retrieve the output parameter?  Feedback is appreciated :)

-Grant
(resending this because I guess I wasn't actually subscribed to the list before 
so I don't think it accepted it)

Reply via email to