Skip to Content.
Sympa Menu

freetds - Re: Starting to use FreeTDS

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: James K. Lowden <jklowden AT speakeasy.org>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: Starting to use FreeTDS
  • Date: Wed, 11 Sep 2002 14:53:33 -0400


On Wed, 11 Sep 2002 19:32:15 +0200, "Magnus Ahl" <Magnus.Ahl AT infogate.se>
wrote:

> Hello!

Hello, Magnus!

> Our company is about to embrace the use of FreeTDS in our software,
> mainly for communication with Microsoft SQL Server 2000. We use C++ as a
> coding standard for our CGI applications and up till today we have only
> used a MySQL database. Our intentions is to replace our own MySQL.cc
> base class with a wrapper which in turn decides if to use the MySQL or
> TDS library in runtime.

I have frequently thought about ways to make MySQL and SQL Server more
interchangeable. It's an interesting project you're working on.

> We have evaluated FreeTDS earlier in production but it was not until
> recently that we deemed the library stable enough to use in our product.
> Kudos to all developers, the release of version 0.60 really looks
> promising!

I sure hope so. :)

> Which API shall we use for programming?

I have a little write-up on that. It might help.

http://home.schemamania.org/projects/freetds/doc/which_api.html

> The lack of documentation in the lower-level routines is also a small
> problem for us. The source code and the doc/getting_started.txt text
> file got us on the road, and enabled us to connect, log in, do a query
> and close a connection to the database. But now is the time for all them
> questions start to pop up. Are we aiming "to low" and should we try the
> ctlib or dtlib instead?

I think you are aiming too low. I don't think ct-lib or db-lib add much
overhead, particularly in proportion to the database delay. I also would
expect changes in tdslib to support additional parts of the client
libraries.

If you use db-lib or ct-lib, OTOH, you can compare with Microsoft's or
Sybase's implementation (or documentation) and "force" us to bring FreeTDS
into conformance. Which is what we want to do anyway, naturally. :)

Because your target is Microsoft, I recommend db-lib (so you can compare
with their implementation) with one important caveat. db-lib connection
cannot be multiplexed. I mean: On any single connection, you must
completely read or cancel the results of one query before you can start
another. Most databases don't work that way, and IIRC MySQL doesn't work
that way. db-lib applications open a seperate connection to the server
for every concurrent query.

If multiplexed query handling is important to you, then I recommend
ct-lib. Also, I'd get a Linux box and install their (free as in beer)
server. That way, you'll have another ct-lib implementation (and local
docs) for comparison's sake.

> 2. The Windows library REALLY needed some tweaking, to even compile,
> according to my colleague. This is one area where we think we can
> contribute mostly to the development of FreeTDS.

This would be most welcome.

> 3. When doing an INSERT after doing one or more SELECT:s in instanced
> C++ objects, the database doesn't receive the update. If you use the
> command line tool or write the same SQL query in a single-instance C++
> program, the INSERT query gets through to the database?

Does this relate to the multiplexing issue?

> 4. Is there really no way of getting the affected rows from the server
> before traversing the results? Right now we are doing the same query two
> times to mimic the get_affected_rows() library call that exists in
> MySQL. All structures I have traced trough (TDSSOCKET->rows_affected and
> TDSRESULTINFO->row_count for example) always returns "1" or "0".

No, there is not. It's a "feature" of TDS: the server begins sending rows
as soon as they start to become available, before the last row is known
even to the server. It counts them "on the way out the door", so it can't
tell you how many there were until they all have left.
If you plant STL collections atop db-lib, you can do a lot of work without
worrying about rowcounts in advance. That's what I do.

Hoppas det hjälper er att tänka på FreeTDS. Har det så bra.

and regards,

--jkl

P.S. Any chance your class library could become part of FreeTDS? Just
asking...








Archive powered by MHonArc 2.6.24.

Top of Page