Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

List of values for DBstatus?

1 view
Skip to first unread message

ja...@cadence.com

unread,
Apr 29, 1998, 3:00:00 AM4/29/98
to

I'm have a SybPerl script that very infrequently runs into problems where its
query is chosen as a deadlock victim by the SQL Server. I want to check the
status of each SQL statement, and if an error like that happens, I can then
have the script re-run the query. It seems like I should be able to determine
if an error occurred using $dbh->{'Dbstatus'}, but I don't know what any of
the returned values mean. Can somebody point me to a reference which lists
the valid status values and their meanings?

FYI, here's the subroutine I use to submit an SQL statement. (Note that it's
intended to only return the last row of results, if there are any. $dbh is a
global variable, and the argument to &sql is the SQL query text.)

sub sql {
my ($text) = @_;
my @row = ();
my $lastresult = "";
@dbresult = ();
$dbh->dbcmd("$text\n");
$dbh->dbsqlexec;
$dbh->dbresults;
while (@row = $dbh->dbnextrow) {
push(@dbresult, join("\t", @row));
$lastresult = $row[0];
}
$dbh->dbcancel; ## clear out the buffer
return $lastresult;
# should there be a check for SQL Server errors somewhere in here?
}

Thanks in advance!

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading

Rich Miller

unread,
Apr 30, 1998, 3:00:00 AM4/30/98
to

In article <6i7re9$dhp$1...@nnrp1.dejanews.com>, ja...@cadence.com says:
>
>I'm have a SybPerl script that very infrequently runs into problems where its
>query is chosen as a deadlock victim by the SQL Server. I want to check the
>status of each SQL statement, and if an error like that happens, I can then
>have the script re-run the query. It seems like I should be able to determine
>if an error occurred using $dbh->{'Dbstatus'}, but I don't know what any of
>the returned values mean. Can somebody point me to a reference which lists
>the valid status values and their meanings?

Status values are documented in the sybdb.h header file in the OpenClient
include directory. A better approach to what you're trying to do, however,
would be to add a message handler which watches for a 1205 message, which is
sent by the server to any process which is killed as a result of deadlock
resolution.

Rich Miller
richard....@norwest.com
Norwest Mortgage

0 new messages