Skip to Content.
Sympa Menu

freetds - Re: [freetds] FreeTDS, C++, and Exceptions

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] FreeTDS, C++, and Exceptions
  • Date: Sat, 17 Jun 2006 17:34:49 +0200

Il giorno sab, 17/06/2006 alle 03.55 -0400, Lenon Kitchens ha scritto:
> Hi folks,
>
> I have a problem with FreeTDS that I was hoping someone could help me
> solve. I'm a developer for a company that deals in network management
> software. Since basically all of our applications need to have the
> ability to talk to one or more of SQLServer, Oracle, SQLite, Sybase, I
> have written a C++ library to provide a common interface to all of these
> APIs.
>
> It wasn't until recently that I noticed a problem with the FreeTDS part
> of my implementation. I have installed error and message handlers using
> dberrhandle() and dbmsghandle(). At the end of each of these functions,
> I throw an exception like so:
>
> throw DBLibException(EGENERAL_EXCEPTION, err.str());
>

:( this is bad C++... a C callback implemented in C++ should not throw
exceptions... C do not support unwinding so you are doing something
wrong. You could recompile all FreeTDS using a C++ compiled but code is
not exception safe (cause C do not support exception) so you would
convert a core in leaks... you should save error in a place, and outside
FreeTDS detect this error and throw exception.

bye
freddy77






Archive powered by MHonArc 2.6.24.

Top of Page