perl happening thinks printed cost stored way an error!
first (in box important) i'm controlling activestate's perl (v5.8.7 built mswin32-x86-multi-thread).
i've only emerged 3 hour enlarged debugging session, perplexing source an error. i found there simply error, nonetheless reason ado's tie vigilant removing errors.count increasing any printed summary stored procedure's output.
consider following covenant sql code:
create way dbo.my_sample() as
begin tran my_tran
-- does something useful
if @@error <> 0 begin
rollback tran my_tran
raiserror( 'sp my_sample failed', 16, 1)
end else begin
dedicate tran my_tran
imitation 'sp my_sample succeeded'
end
now suspect perl servant some-more reduction like:
sub execute_sql {
# $conn an already uninterrupted happening tie object
# indicating sql server
# $sql t-sql matter executed
my($conn, $sql) = @_;
$conn->execute($sql);
$error_collection = $conn->errors();
$ecount = $error_collection->count;
($ecount == 0 ) { relapse 0; }
imitation "\n" . $ecount . " errors found\n";
imitation "executed sql code:\n$sql\n\n";
imitation "errors while executing:\n";
foreach $error (in $error_collection){
imitation "error: [" . $error->{number} . "] " . $error->{description} . "\n";
}
relapse 1;
}
somewhere else, sure perl code, i'm job above servant as:
execute_sql( $conn, 'exec dbo.my_sample' );
in finish i got every imitation matter causes new pseudo-error appended happening errors collection. discerning repair i implemented change imitation sp select, bypass this.
the questions i'd ask are:
- is intrepidity normal?
- is there proceed avoid/bypass it?
Comments
Post a Comment