Skip to Content.
Sympa Menu

freetds - [freetds] defncopy patch

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: TDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: [freetds] defncopy patch
  • Date: Fri, 30 Nov 2007 17:39:23 -0500

Hi Frediano,

I see you're doing a bit of Win32 and mingw hacking. I have a patch for
defncopy you might like to use?

I use our defncopy at work -- as patched -- but I haven't committed it to
CVS because it was a quick hack, much too nasty for general consumption.
I don't have time to putz with Win32 FreeTDS stuff at work, and at home I
don't have a Win32 machine (or much energy for that side of things). But
if you or someone else would like to make defncopy work out of the box on
Win32, I think that would make a fine Christmas present.

One thing that isn't obvious about the problem domain: the stored
procedure text in syscomments holds some surprises. Some utilities -- I
think Microsoft's Query Analyzer, but I haven't looked into it carefully
-- use 0xOD as the line terminator. Not 0D0A, not just 0A, but a plain
0D. When you write that via fopen "w", you get ODODOA. Load that back
into the server, and the next time it's extracted in Query Analyzer,
everything appears double-spaced. Oh, the joys!

Solve this locally, I put the SQL text though Perl (what else?):

| perl -pe"s/\r+\n/\n/g; s/\r+/ /g;"

which works for me but it would be nice to solve correctly in defncopy.

BTW, I think I solved the bcp thing once and for all. The offset table
wasn't just hard to read, it was wrong in the presence NULLs. More soon.


Happy Hacking.

--jkl

Attachment: defncopy.mshack.diff
Description: Binary data



  • [freetds] defncopy patch, James K. Lowden, 11/30/2007

Archive powered by MHonArc 2.6.24.

Top of Page