Skip to Content.
Sympa Menu

freetds - RE: DBLIB Unit Tests failing again

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "'TDS Development Group'" <freetds AT franklin.metalab.unc.edu>
  • Subject: RE: DBLIB Unit Tests failing again
  • Date: Mon, 16 Sep 2002 11:30:13 -0400


> From: Bill Thompson [mailto:thompbil AT exchange.uk.ml.com]
> Sent: September 16, 2002 8:34 AM
>
> > 3) The date formats are different - the output format
> > excludes the seconds
> > and milliseconds, which is not acceptable.
>
> I'm in two minds about how to do this. I think the neatest
> way would be to
> temporarily override the date output format while in function
> _bcp_exec_out().
> I can see how to do this from the code in dbinit(), but the trouble is
> that the context is declared static in dblib.c :
>
> static DBLIBCONTEXT *g_dblib_ctx = NULL;
>
> and I need to reference it from bcp.c ....
>
> Would it be safe to increase the scope of this declaration ?

Bill,

If you "temporarily" override the date conversion string in g_dblib_ctx
during bcp, won't other connections be affected?

dbopen() passes that pointer to tds_connect(), which embeds it in the
process's TDSSOCKET. That is how context is passed to tds_convert().
Instead of touching the global context, I think bcp_init() should modify its
dbprocess:

1. copy the global structure pointed to by g_dblib_ctx.
2. replace TDSLOCINFO.date_fmt in the copy with the right one for bcp.
3. overwrite DBPROCESS.tds_socket->tds_ctx with a pointer to the modified
copy. (Perhaps a function like "tds_setcontext()" would be handy, taking a
new pointer and returning the old one.)
4. (proceed as usual)
5. bcp_done() should free the local copy and restore the global context.
6. dbclose() should free the context pointer if it does not equal the global
pointer.

Manipulation of TDSLOCINFO is made more complicated by its design: it
consists of three char* pointers. I'd be tempted to make them char[64], and
use assert() when reading freetds.conf to make sure the language, char_set,
and date_fmt all fit. Valid specifications of these fields would never be
anywhere close to 64 bytes. ("Char 64, where are you?"?) Does anyone see a
problem with that?

Regards,

--jkl


The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the
original message. Please note that for certain accounts we do not accept
orders and/or instructions by e-mail, and for those accounts we will not be
responsible for carrying out such orders and/or instructions. Kindly refrain
from sending orders or instructions by e-mail unless you have confirmed that
we accept such communications for your account. Please also note that to
satisfy regulatory requirements we review the outgoing and incoming e-mail
correspondence of staff members serving certain functions.






Archive powered by MHonArc 2.6.24.

Top of Page