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: gregory j pryzby <pryzby at tux dot org>
Subject: Can I lock at row level?
Date: Aug 24 1998 7:49PM

Here is the problem I have...

I have a few processes that need to interface with the database. Because
of constraints placed on me, each process will directly access the
database. Using a daemon/traffic cop to access the database that the
other processes talk to is not possible (design restriction).

One process will be doing inserts. The table has a primary key and
details. Only the primary key is entered on the insert. They can be
multiple versions on this running. This process is responsible for only
sending a key once.

The other process is more interesting. It will ask the database for a
key that does not have details. It will get details (after some time)
and update the row. There are multiple versions on this process running
and of course, duplicating effort is undesirable.

The initial thought is add a flag field that is set when a row is
returned to be processed. Can I do a select and update at the same time?
If so, and I can ask for a single row at a time this might work. The
select criteria is if details is NULL. I know nothing about the keys in
the table.

I think if I can set the number of rows returned to 1, that should help.
I have poured over the Sybperl and looking for
information on setting DBROWCOUNT. I can not figure out the exact
syntax... Please help!

Does anyone else have a suggestion?


gregory j pryzby                      |
Founded Linux Users Group of Manassas |
Check out the Home Pages              |
Love animals-- don't eat them!        |