Skip to Content.
Sympa Menu

freetds - Re: [freetds] bcp is really busted

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT schemamania.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] bcp is really busted
  • Date: Mon, 29 Dec 2003 17:56:15 -0500

On Mon, 29 Dec 2003 11:58:20 -0500, christos AT zoulas.com (Christos Zoulas)
wrote:
> | By encoding the NULL specially. Microsoft's bcp works fine. I will
> | check how it encodes it and report back. (Same for native format).
>
> It encodes the NULL by outputting a length of \xff\xff. We should be
> doing the same.

Right, thanks for checking that out, Christos. That's a 2-byte -1, as you
know. Precisely what the TDS protocol uses.

For native bcp files, I bet all we need is tds_put_packet_to_file().
Don't interpret the row image; just grab the buffer and go.

Sending is a little more work, because we have to allow for the
possibility that the table definition has changed meanwhile. It's valid
to bcp out a table, alter its datatypes (say, float -> real) and reload
it. It's db-lib's job to bind and convert the data accordingly.

Assuming I'm right -- that the bcp native file image mimics the wire image
-- sending may be just a matter of reading rows from a native bcp file in
much the same way we read rows from a socket. That's not how things are
architected now, but, you know ... live and learn.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page