[freetds] 0.82 RC4 assert(0) on failed to connect

James K. Lowden jklowden at freetds.org
Mon Apr 21 14:17:57 EDT 2008


Dossy Shiobara wrote:
> > For the sake of a framework, let's say errors are of two kinds:
> > logical and runtime.  Runtime errors -- server not available, library
> > misuse -- cannot be handled at compile time.  They provoke error
> > messages that inform the user what went wrong.  Logical errors are
> > bugs embedded in the code that can be prevented by testing, etc.  They
> > are handled more simply: with a log message (maybe) and an assertion. 
> > (I'm excluding server messages -- bad SQL, etc. -- because they're not
> > errors insofar as the library is concerned.  They're just data.) 
> 
> It would be nice if in the TDSMESSAGE structure there was an "error
> code" passed along.  Having to parse the error message string (esp. once
> things get localized, yow!) to deduce "what went wrong" is going to be
> very ... painful.

I think what you're looking for is TDSMESSAGE::msgno.  tdserror writes its
third argument to that member.  See also the tds_error_messages on line
249 of src/tds/util.c.  

--jkl





More information about the FreeTDS mailing list