Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: newbie : transaction levels
Date: Sep 18 2000 2:21PM

Matthew E Studley writes:
 > Hi all
 > just found the list - pls forgive breaches of whatever etiquette is
 > current.
 > Having to migrate from Oracle 8 (NT) to Sybase 11.9.2 (Debian Linux) -
 > we will be writing apps in C and Perl.  Initial overview of Sybase docs
 > (first time I've seen Sybase was last week) worries me; default
 > transaction and isolation behaviour not similar to Oracle.
 > Q1.  Can I reset transaction / isolation behaviour globally for a user
 > so that all requests / own procs executed by user have desired
 > behaviour.  Alternately, do I just reset them with each new db
 > connection?

I *think* that you need to set them for each connection. The default,
as you have seen, is for transactions to be "unchained" (ie all DML is 
committed by default, unless an explicit BEGIN TRAN is issued).

 > Q2.  Has anybody got any suggestions for writing Sybase stored procs
 > that return the equivalent of tables / varrays... so that an output
 > parameter in my proc call can return a list of rows through which I can
 > iterate.  I'd rather encapsulate all db access than give the developers
 > any native SQL to embed in their code.

You don't do it quite like that.

In Sybase you'll write something like this:

create proc getUserData
( @name		varchar(32) )
select ... 
  from userTable
 where name = @name


In the perl code you execute the proc, and fetch the rows, just as if
you had executed the SELECT from perl directly.

Michael Peppler         -||-  Data Migrations Inc.    -||-
Int. Sybase User Group  -||-
Sybase on Linux mailing list: