Skip to Content.
Sympa Menu

freetds - Re: [freetds] 0.64 status and coverage

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] 0.64 status and coverage
  • Date: Thu, 14 Jul 2005 17:10:22 +0200

Il giorno ven, 08/07/2005 alle 13.52 -0400, Lowden, James K ha scritto:
> > From: Frediano Ziglio
> > Sent: Friday, July 08, 2005 12:43 PM
> >
> > liam AT inodes.org ha scritto:
> > > Looking at freetds/freetds/src/dblib/unittests/thread.c shouldn't
> > > dbinit() and dbexit() be called only once at the appropriate spot
> > > in main() and not in test()?
> >
> > Yes, it should however thinking at complicate dependency in libraries
> > is a good thing if you can nest dbinit/dbexit.
>
> The application is obliged to call dbinit() once and dbexit() once.
> Calling dbinit() twice -- with no intervening dbexit() -- is an error,
> according to both vendors' documentation.
>
> If the application calls dbinit() a second time, our only job is to
> return FAIL without causing further harm.
>

I know however it's a nice feature to have and easy to implement.

In early days there where an executable linked to some few libraries
(like libc) but nowadays in context like

<- PHP <- php_mssql.so <-
httpd (Apache) <- Python <- ???.so <- libdblib.so
<- mod_perl <- DBD::DBLib <-

is difficult to define who should call dbexit... you end up in
situations where the better way is to call only dbinit... I got the same
problem with socket and windows. Under windows you have to initialize
socket library with WSAStartup, use sockets and then you should call
WSACleanup. However after WSACleanup you cannot call any socket API. In
3 cases (OCX used in an ASP page, ISAPI and an extended store procedure
in mssql) I decided to NOT call WSACleanup to prevent main program
(respectively IIS, IIS and mssql) to stop working correctly (in IIS case
I decided to not call WSAStartup too...). Now in FreeTDS you can call
safety dbinit/dbexit, just call dbinit and dbexit once.

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page