Skip to Content.
Sympa Menu

freetds - big changes, conversion fixes, and tds_willconvert

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Bruns <camber AT ais.org>
  • To: <freetds AT franklin.metalab.unc.edu>
  • Subject: big changes, conversion fixes, and tds_willconvert
  • Date: Mon, 15 Jul 2002 00:09:24 -0400 (EDT)


Hi all,

I've just checked in some fairly substantial changes to CVS, based
largely off of Frediano's patch, but reworked a bit by moi. As discussed
in the thread with Bill about conversions, each API now has a TDSCONTEXT
pointer which maintains a few important items. This should allow us to
modify the handler routines to deal with the lack of a socket structure
(dbproc, cs_conn, hdbc).

The locale structure is now pointed to by the TDSCONTEXT structure and is
automatically allocated and read during tds_alloc_context(). tds_connect
now needs a valid context passed to it instead of a TDSLOCINFO.

I haven't made all the handler changes yet that I need to, specifically
API handlers should do some logic that is a bit like this:

if (tds_socket) {
...
call the per socket handler if any with tds->msg_info,
else call the context wide handler with tds->msg_info
} else {
call the context wide handler with context->msg_info
}

this will allow tds_client_msg() to be called during conversion without a
socket structure, in accordance with dblib/ctlib specs. My big question
is that the two threads calling dbconvert simultaneously encounter errors
context->msg_info may be overwritten, and the application may receive the
same error twice on different threads. Not exactly sure how to deal with
that one yet.

Anyway, beware of CVS over the next couple of days, as this is a big
reconoitering and I've still got some work to do yet. All the unittests
programs do pass though (with the exception of most of the dblib ones for
reasons stated below) so we hopefully didn't mung things up too badly.
Note, this is a libtds api change for those working directly with libtds!
Stay tuned.

The other problem is with the implementation of dbwillconvert. Jim, you
got to convert those dblib types to server types before sending them to
tds_willconvert. dbbind also calls dbwillconvert() directly and instead
should be calling tds_willconvert because it shouldn't be making the trip
from servertype -> dblib type -> servertype. I just stumbled on this one
and haven't had a chance to fix it, and it doesn't look good for tonight.
So, the dblib unittests mostly fail on dbbind until further notice.

Bill, you should be able to call tds_client_message from your conversion
code using g_dblib_context->tds_ctx. The behaviour of the errors won't be
handled quite correctly yet (you may in fact core dump), but the api is
set, and I'll attempt to fix the API handlers as noted above as soon as I
get a chance.

Jim, I'd say we give 0.60 a couple more weeks to solidify, having the
conversion/binding stuff rock solid would be worth the wait, IMO.

Brian






Archive powered by MHonArc 2.6.24.

Top of Page