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: rhall at CORPNY dot FBC dot COM (Roger Hall)
Subject: Transactions
Date: Aug 25 1999 8:00PM

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);