Skip to Content.
Sympa Menu

freetds - Re: [freetds] FreeTDS API basic/newbe question

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] FreeTDS API basic/newbe question
  • Date: Fri, 20 Apr 2007 00:13:43 -0400

Medi Montaseri wrote:
> What does FreeTDS API do...what are they good for...can someone give me
> a two paragraph use case and/or scenario...

libtds is a collection of low-level functions more than an API. The
closest thing you'll find to a packet parser is in src/tds/token.c.
You'll find it's highly specialized to reading a TDS stream and populating
TDSSOCKET structures. It recognizes tokens, parses packets, and converts
incoming wire-encoded data to something understandable by the host.

The TDS protocol requires the client to maintain state information and to
stay synchronized with the server. For the most part, excepting bcp,
clients don't send much; the work lies in reading the stream. The client
doesn't know exactly what to expect -- it's not like reading back a record
from a file -- and isn't supposed to care very much about the shared state
information. So there's no function similar to fread(3), where the client
specifies a structure to be filled. Instead, there's a
structure-about-a-structure, a structure of metadata and another of data,
that libtds populates as the information is received.

If you're interested in more detail, I suggest you have a look at the
source code. Some of the comments and ancillary files might be helpful.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page