Hi,
I have a web page for deleting so-called OWNER's
with the help of this stored procedure:
create procedure delete_owner @owner char(7)
as
delete HOURS where BTA in (select BTA from BTAS where OWNER = @owner)
delete BTAS where OWNER = @owner
delete OWNERS where OWNER = @owner
if @@error != 0 or @@rowcount = 0
return -1
And I call it like this from my Perl script:
$DELETE = 'delete_owner %s';
my $dbh = DBI -> connect ('dbi:Sybase:server=xxx', 'xxx', 'xxx',
{ RaiseError => 1,
AutoCommit => 1,
ChopBlanks => 1,
syb_do_proc_status => 1 });
sub delete_owner ($$)
{
my $query = shift;
my $dbh = shift;
my $sth = $dbh -> prepare (sprintf $DELETE,
$dbh -> quote ($query -> param ('OWNER')));
$sth -> execute;
print &abstract ('The owner <B>', $query -> param ('OWNER'),
'</B> and the related order names have been ',
'deleted from the database.');
}
However the subroutine above never fails. Even if I go
back in my browser and click the button again (which should
give me @@rowcount = 0 because that OWNER has been already
deleted) the script doesn't fail.
And I was actually expecting, that because of RaiseError
and syb_do_proc_status the $sth -> execute; would "die".
What am I doing wrong or is it a bug? Thanks
Regards
Alex
PS: DBI 1.14, DBD::Sybase 0.90, Perl 5.6.0 on Solaris 2.6