[freetds] freebcp adding escaping

Andrew Punch andrew.punch at smart-associates.biz
Tue Feb 2 23:40:09 EST 2016


I had a requirement to have properly formatted CSV output from freebcp. 
Unfortunately freebcp (and the original bcp) do not escape characters 
correctly. For example in a comma delimited file commas will not be 
escaped. Also the way NULLs are indicated can be inconvenient.

I hacked together a patch which I have attached. I would like to do a 
pull after a clean up but I have a few questions:

 1. is dblib the best place to make the change?
 2. what is the best structure to pass parameters and flags? Namely:
     1. Flag for delimiter escaping
     2. The actual delimiter (I notice that the column delimiter changes
        to EOL for the last column)
     3. Flag for NULL string replacement (instead of ASCII NUL)
     4. NULL string replacement

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smart.patch
Type: text/x-patch
Size: 4452 bytes
Desc: not available
URL: <http://lists.ibiblio.org/pipermail/freetds/attachments/20160203/f7541350/attachment.bin>

More information about the FreeTDS mailing list