Skip to Content.
Sympa Menu

freetds - Re: db-lib bcp interface

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Brian Bruns" <camber AT ais.org>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: db-lib bcp interface
  • Date: Mon, 26 Nov 2001 11:59:58 -0500


> thanks Brian,
>
> I'll start working on it then.
>
> From the sounds of it, I kind of have to make my mind up when building
> FreeTDS what I want to use it for - I can't build one version that will
> talk to Sybase 11 and SQL server 2000 for instance. Is that right ?

Nope, you can specify the TDS protocol version either by adding 'tds
version = 7.0' (or whichever version) to your servers entry in the
freetds.conf file, or you can use the TDSVER environment variable at
runtime to override it.

The --with-tdsver specifies a last resort fallback if it's not specified
elsewhere.

> Also, if I put some code into bcp.c to do some byte swapping for SQL
> server, how would you make it conditional ?

look in src/tds/write.c and you'll see much of this is done for you
already.
Basically just look at tds_put_int() to see how it is done, you may need
to add functions for swapping dates/money/floats/etc... but integer types
are done.

> I kind of want to say...
>
> if ( im_talking_to_sql_server ) {
> ...
> }
>
> whats the best way of saying this ?

It's best not to rely on it being sql server or sybase but instead what
protocol you are using. Sybase and MS SQL at version 4.2 of the protocol
should act and be treated identically. Is there a specific need to check
the server type? For instance, SQL 7.0 GA, SP1, and SP2 all act
differently with regards to big endian clients, so knowing that it is SQL
Server 7.0 is not that helpful. This is why emulation of little endian
order can be set in the .conf file and checked programatically, the
administrator can decide on a server by server basis whether byte swapping
is needed or not.

> Also, My download of Freetds 5.2 didn't include a doc directory or the
> file bcp.txt . could you mail me a copy (thompbil AT exchange.uk.ml.com ) ?

You can get it here:

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/freetds/freetds/doc/bcp.txt

> thanks,
>
> Bill

Cheers,

Brian




Archive powered by MHonArc 2.6.24.

Top of Page