Skip to Content.
Sympa Menu

freetds - Re: Error Reporting

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Mark Schaal <mark AT champ.tstonramp.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: Error Reporting
  • Date: Wed, 31 May 2000 18:50:36 -0700 (PDT)


>
> All,
>
> In attempting to write a binding from a previously written database layer to
> TDS i've run into a few issues.
>
> The first issue I have is with error reporting, currently error reporting is
> being passed to an "upper layer library" via a calling the global function
> pointers:
>
> int (*g_tds_msg_handler)();
> int (*g_tds_err_handler)();
>
> This dosen't lead well to using TDS in a multithreaded/multiple path of
> execution programming environment because all errors must be handled
> through one
> function. My solution is to keep the existing global error function
> pointers and yet
> add a set of pointers to the TDSSOCKET structure to allow custom functions
> to be
> called per TDS connection.
>
> By adding the individual function pointers to each socket connection it will
> allow the customized handling of errors much easier then the global function
> pointers. Does anybody have any thoughts about this?

The message handles has always been one of the confusion parts of freetds
for me.

The ctlib spec has a function ct_diag() that allows message handling on
a per-connection basis, so we would something like your suggestion if
someone needed to implement that. I'm not sure that you need multiple
function pointers. ct_diag() is defined to replace both callbacks.

Mind you, no one is promising that freetds is thread-safe to being
with. I don't have expertise to even make a guess on that.

>
> Also currently the prototype of tds_free_login() is not included in tds.h,
> but
> since it is only calling free on the pointer to the login structure
> shouldn't it
> be implemented as a macro?
>
> Also couldn't the macros such as tds_is_error, tds_is_message be
> implemented as
> macros in the form of:
>
> #define TDS_TYPE_TEST(type, socket)
> (tds_peek(socket) == type) ? 1 : 0
>
> #define TDS_IS_ERROR(socket) \
> TDS_TYPE_TEST(TDS_ERR_TOKEN, socket)
>
> Implementing these as macros would reduce the function call overhead since
> they
> are used quite frequently.
>
> So in closing, I'm looking for feedback on any of these proposed changes.
> I'll
> wait a little while for some then start working up a patch against the
> current
> sources.
>
> Thanks,
>
> Rusty


I don't think most of the tds_is_* functions are used very frequently.


Mark
--
Mark J. Schaal Phone: (909) 620-7724
TST On Ramp Fax: (909) 620-8174
System Administrator E-Mail: mark AT tstonramp.com



  • Error Reporting, Rusty Conover, 05/31/2000
    • <Possible follow-up(s)>
    • Re: Error Reporting, Mark Schaal, 05/31/2000

Archive powered by MHonArc 2.6.24.

Top of Page