PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: collardp at rabo-bank dot com
Subject: RE: Transactions
Date: Aug 26 1999 7:15AM

Permission errors terminate the transaction. I think the logic is that they
are coding errors rather than data errors.


___________________________________________________________________
Regards
Peter Collard (x3863)
Senior Sybase DBA
Rabobank UK

The views expressed in this correspondence are those of the author and
do not necessarily represent those of Rabobank International
_______________________________________________________________


Hi,

I was wondering if anyone could explain the following, or point me at
an example or document that explains what I'm doing wrong. The following
code runs fine. I run it as a normal user and so the select gives me
a couple of permission denied errors and then my error saying 'OUCH'.
If I un-comment the two transaction lines, I still get the two permission
errors, but my 'OUCH' error no longer gets output.

Thanks,

Roger.



use strict;
use Syb;

my($srv) = 'SERVER';
my($dbn) = 'DATABASE';
my($uid) = 'USER';
my($pwd) = 'PASSWORD';

my $dbh = Syb->new($srv, $uid, $pwd, $dbn)
    || die "\nFailed to create a database handle for '$srv.$dbn'.\nStopped";

my $sql;

($sql = <<"SQL") =~ s/^\s+@@@ ?//gm;
    @@@ -- begin transaction
    @@@ select * from master..syslogins
    @@@ if \@\@error != 0
    @@@ begin
    @@@     raiserror 30000, 'OUCH'
    @@@ end
    @@@ -- commit
SQL

$dbh->ct_sql($sql);