Skip to Content.
Sympa Menu

freetds - Re: [freetds] Return error proposal

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Return error proposal
  • Date: Wed, 17 Dec 2008 11:01:55 -0500

Frediano Ziglio wrote:
> I personally never liked things
> like errno and returning a true/false for errors. Why not using a bit
> to distinguish error from success??

Hi Freddy,

Plauger comments on this in his book on the standard C library. He says
error processing is hard and that errno, while it looks messy, has
survived despite many suggested (even obvious) alternatives because it
works.

> For instance >= 0 for success and
> < 0 for error.

It requires bit-twiddling to get at the real error.

> But now even
> tds_connect_and_login return the error. Personally also I don't like
> an oserr in TDSSOCKET, errno usually don't have problems with thread
> on multi-threaded safe environment (that is major ones) but this errno
> have threads problems.

I'm unconvinced. The db-lib error handler passes oserr. Surely we can
copy a value to a tread-safe location for later inspection. You can't
pass an "errno is valid" flag because subsequent libc calls change errno.


Happy to discuss. :-)

Regards,

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page