Skip to Content.
Sympa Menu

freetds - Error Reporting

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Rusty Conover <rconover AT zootweb.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Error Reporting
  • Date: Wed, 31 May 2000 17:16:03 -0600


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?

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
--
---------------------------------------------
Rusty Conover | rusty AT zootweb.com
Systems Programmer | 406-586-5050 x242
Zoot Enterprises | http://www.zootweb.com
---------------------------------------------

"Nullum magnum ingenium sine mixtura dementiae fuit." -- Seneca





  • Error Reporting, Rusty Conover, 05/31/2000

Archive powered by MHonArc 2.6.24.

Top of Page