Skip to Content.
Sympa Menu

freetds - Re: [freetds] Bug: severity in handler called by dberrhandle()

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Michael Peppler <mpeppler AT peppler.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Bug: severity in handler called by dberrhandle()
  • Date: Tue, 24 Jun 2008 07:26:54 +0200

James K. Lowden wrote:
Norbert Sendetzky wrote:
If a SQL statement is executed which refers to a non-existing table, the

library (0.82) returns a severity of 16 inside the installed error
handler. According to the Sybase documentation and syberror.h, valid
severities are from 1 to 11. The severity of this particular error
should be more like EXUSER (2), EXNONFATAL (3) or EXSERVER (5).

1> select 8 from notable
2> go
Msg 208, Level 16, State 1
Server 'TITAN', Line 1
Invalid object name 'notable'.

That message and its severity comes from the server. FreeTDS merely
passes it on.

Actually (as I'm sure you already know) there are two types of messages in DBlib - the "message" (handled by dbmsghandle()) which process server side errors, and the "err" (handled by dberrhandle()) which process client-side errors.

The client-side errors should have severities like EXUSER, etc., and refers to client-side issues such as OS errors and the like. When a server side error occurs the Sybase DBlib errhandler is also called, with a generic error of the type "please check errors from the server", which is pretty useless, and which is usually suppressed.

For example, the default handlers in sybperl's Sybase::DBlib package do this:

sub error_handler {
my ($db, $severity, $error, $os_error, $error_msg, $os_error_msg)
= @_;
# Check the error code to see if we should report this.
if ($error != SYBESMSG) {
print STDERR ("Sybase error: ", $error_msg, "\n");
print STDERR ("OS Error: ", $os_error_msg, "\n") if defined ($os_error_msg);
}

INT_CANCEL;
}


Michael
--
Michael Peppler - Peppler Consulting SaRL
mpeppler AT peppler.org - http://www.peppler.org
Sybase DBA/Developer - TeamSybase: http://www.teamsybase.com
Sybase on Linux FAQ - http://www.peppler.org/FAQ/linux.html




Archive powered by MHonArc 2.6.24.

Top of Page