[freetds] dblib bcp & freebcp

Lowden, James K LowdenJK at bernstein.com
Wed Jun 2 12:52:22 EDT 2004

> From: freetds-bounces at lists.ibiblio.org
> [mailto:freetds-bounces at lists.ibiblio.org]On Behalf Of 
> Thompson, Bill D
> (London)
> Sent: June 2, 2004 12:05 PM
> I'm just finishing up my reworking of the dblibrary bcp api, 
> retro-fitting
> the improvements to the processing that I put into the ct-lib 
> blk library.


Loading some files recently, we noticed that Microsoft's and Sybase's bcp libraries both trim trailing blanks from char & varchar character data.   You can stuff 16 characters into a char(8) if the last 8 characters are consistently blanks.  

I had fixed bcp.c to handle the varchar case some time back; I added char last week.    

> the -E flag (as supported by Microsoft's version) which allows you to
> control the behaviour with respect to identity columns.
> the handling of timestamp columns, as documented in 
> Microsoft's version

These will both be welcome, especially timestamp.  

> the "queryout" method, as supported by Microsoft's version, 
> which allows you
> to specify a query (or I guess the exec of a stored 
> procedure) as the source
> of a "bcp out" operation

Very nice.  (Yes, "exec <proc>" should work.)

> the specification of "stdout" or "stdin" as the output/input 
> file (that's an enhancement on both Sybase & MS's version)

Yay!  How did you work around the fseek() in "measuring" delimited character files?  

> before I submit my patch, is there anything else anyone is 
> desperate for ?

bcp_moretext()?  ;-)  Of course, it's the only missing bcp function.  I don't know what the protocol implications are; I don't know if this out-of-order data handling is only a db-lib feature, or if the server can somehow accept text data after the rest of the row data.  

Looking forward to you patch, Bill.  Thanks for working on this.  


The information contained in this transmission may contain privileged and confidential information and is intended only for the use of the person(s) named above. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender immediately by reply e-mail and destroy all copies of the original message. Please note that we do not accept account orders and/or instructions by e-mail, and therefore will not be responsible for carrying out such orders and/or instructions.
If you, as the intended recipient of this message, the purpose of which is to inform and update our clients, prospects and consultants of developments relating to our services and products, would not like to receive further e-mail correspondence from the sender, please "reply" to the sender indicating your wishes.  In the U.S.: 1345 Avenue of the Americas, New York, NY 10105.

More information about the FreeTDS mailing list