Skip to Content.
Sympa Menu

freetds - [freetds] freebcp -h support

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "'TDS Development Group'" <freetds AT lists.ibiblio.org>
  • Subject: [freetds] freebcp -h support
  • Date: Wed, 27 Nov 2002 15:12:16 -0500

Well, almost.

I added bcp_options() to db-lib, allowing you to pass an option type of
BCPHINTS. This will allow us to support "freebcp -h" in the manner of
Microsoft's utility. The most useful hint is "CHECK_CONSTRAINTS", forcing
the data to meet the table-defined constraints. (Normally bcp operations
bypass constraint checks.)

This is meant to work similarly to the way Microsoft's ODBC bcp_control()
function does, except typesafely. Its signature is identical to Sybase's
bcp_options.

This feature is a first: an extension of the db-lib API that does something
neither vendor's offering does. Sybase has bcp_options() for db-lib, but
its server doesn't accept hints. Microsoft doesn't have bcp_options() in
its db-lib; you have to use ODBC to get that feature.

I did not change freebcp.c, so no one uses this feature yet.

+++

Along the way, I found a bug I didn't fix.

If you try this:

$ freebcp tempdb..##a in a -S nts0090 -c -U u -P p

you'll see these messages:

Msg 2701, Level 0, State 99
Server 'NTS0090', Line 1
Database name 'tempdb' ignored, referencing object in tempdb.
Msg 2701, Level 0, State 99
Server 'NTS0090', Line 1
Database name 'tempdb' ignored, referencing object in tempdb.

Starting copy...

Msg 2701, Level 0, State 99
Server 'NTS0090', Line 1
Database name 'tempdb' ignored, referencing object in tempdb.
bcp copy in failed

I don't know the whole reason, but part it is:

_bcp_start_copy_in (dbproc=0x8054000)
at
/usr/home/jklowden/projects/freetds/build/src/dblib/../../../src/dblib/bcp.c
:1598
1598 if (!is_end_token(marker)) {
(gdb)
1555 return FAIL;
(gdb) p marker
$3 = 171
[2]+ Stopped gdb .libs/freebcp
$ grep 171 ~/projects/freetds/include/*
[...]/include/tds.h:#define TDS_MSG_TOKEN 171 /* 0xAB */

IOW, we get a message token instead of a done, and fail. That's as far as I
got.

Tomorrow's a holiday here in the States. I'm taking the day off. Happy
Thanksgiving, everyone.

--jkl



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.





  • [freetds] freebcp -h support, Lowden, James K, 11/27/2002

Archive powered by MHonArc 2.6.24.

Top of Page