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: Brad Morrison <brad at neosoft dot com>
Subject: Re: Transactions
Date: Aug 27 1999 2:05AM

At 04:00 PM 8/25/1999 +0000, you asked a question way over my head; I just 
hack at Sybase with Sybperl on a program I inherited, plus some supporting 
stuff I invented.  Anyway:

I can *almost* read your code example, but--would you mind helping me to 
understand it?  If not, I understand, but I also know that the dumb 
questions are the ones you don't ask.

>use strict;
>use Syb;

I still don't understand the difference between use'ing strict and using 
the -w flag to Perl, but this is a low-priority question, I feel.  See below.

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

So far, so good...

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

MOTHER, MARY and JOSEPH.  *w*h*a*a*a*a*a*a*t* is this, and why do you do 
it?  W-OW.

What is with the number of '@'s threatening to exceed the rest of the 
letters by a simple majority?  ... I hope I don't seem too naive to bother 
with, but I'm mostly not sure of the difference between "@@@" and "@@@ --" .

Any help, clue, even criticism is welcomed in reply.


Many happy returns of the day ...




>$dbh->ct_sql($sql);

--
"Nothing succeeds like success."
Brad Morrison, brad@neosoft.com
"Press to test."
(click)
"Release to detonate."