Skip to Content.
Sympa Menu

freetds - Re: [freetds] what's wrong with this freebcp statement?

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] what's wrong with this freebcp statement?
  • Date: Fri, 17 Mar 2006 01:59:03 -0500

blackwater dev wrote:
> If I use bcp for everything else, is there another way via freetds to
> somehow move the blob data from the sql server to a local MySQL db
> without using bcp?
>
> I just installed sqsh and am not trying to go through the docs on it but
> it would be really nice just to be able to use freetds.

I spent the evening looking at the code, and I'm sorry to say you may be
SOL. sqsh *might* work, if it tackles the problem more intelligently.

The problem is that freebcp treats all data alike: it allocates a buffer
for the column, reads the data into the buffer, converts it if necessary,
and writes it out. Even if nothing's converted (as in the case of IMAGE
data), a copy is made to bring the data out of libtds's memory.

The copying isn't technically necessary, but neither is it a problem (for
normal-size data), and eliminating it would take quite a bit of work.

If sqsh doesn't work, the shortest route, for someone who knows how, would
be to use Perl or adapt one of the db-lib unit tests:

$ grep -l readtext src/dblib/unittests/*.c
src/dblib/unittests/t0013.c
src/dblib/unittests/t0014.c

These programs use the readtext() function, which is what one needs (and
what freebcp doesn't use) when reading blob data.

That's the best we've got at this stage of the project, I'm afraid.

Regards,

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page