[freetds] 0.64 status and coverage
freddyz77 at tin.it
Thu Jul 14 11:10:22 EDT 2005
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.
More information about the FreeTDS