[freetds] defncopy patch

James K. Lowden jklowden at freetds.org
Fri Nov 30 17:39:23 EST 2007


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: defncopy.mshack.diff
Type: application/octet-stream
Size: 14718 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20071130/6b60e9fd/attachment.obj 


More information about the FreeTDS mailing list