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: Marc Merlin <marcm at magic dot metawire dot com>
Subject: How to find out when you're killed because of a deadlock?
Date: Apr 9 1998 12:51AM

Hi,

I searched the archive and didn't find anything, so here's the question:

I have a script that does:

    #print "Running query \"$query\"\n";
    $self->dbcmd($query);
    ($self->dbsqlexec == &SUCCEED) or die "Died on query \"$query\": $!";
    $self->dbresults; 

It's been running beautifully for several weeks, but today the cron job
returned the following:

Msg 1205, Level 13, State 1
Line 2
        Your server command (process id #151) was deadlocked with another
process and has been chosen as deadlock victim.  Re-run your command.
DB-Library error:
        General SQL Server error: Check messages from the SQL Server. 


The funny thing is that when I get those kinds of errors (not deadlocks, but
typically  an incorrect  query), dbsqlexec  doesn't return  SUCCEED, and  my
script dies, showing the query that triggered the problem.

The  problem is  that  the  deadlock did  not  prevent  dbsqlexec to  return
&SUCCEED, and my script continued to run, with incomplete data, which messed
up our whole system.

My question is  how can I detect all query  failures, including deadlocks so
that my script can die instead of carying on with incomplete data?

Thanks,
Marc
-- 
Home page: http://magic.metawire.com/~merlin/ (browser friendly)
Finger merlin@magic.metawire.com for PGP key (key id 763BE901)
***** "God is real, unless declared integer." *****