Skip to Content.
Sympa Menu

freetds - RE: [freetds] Status: bcp

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: 'FreeTDS Development Group' <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] Status: bcp
  • Date: Thu, 18 Dec 2003 15:03:18 -0500

> From: Lowden, James K
> Sent: December 18, 2003 11:44 AM
> > From: Thompson, Bill D (London) [mailto:bill_d_thompson AT ml.com]
> > Sent: December 18, 2003 5:53 AM
> >
> > Well I've solved the issue that I was getting with bcp_sendrow() /
> > bcp_batch() / bcp_done()
> >
> > Hopefully this will be the cause of your woes as well.
> >
> > If not, at least I've proved there's nothing generically
> > wrong with this functionality.
>
> The difficulty atm is bcp_batch(). If I send 10 rows followed by
> bcp_done(), all is well. If I say "bcp_batch(dbproc);
> bcp_done(dbproc)", I
> get all kinds of trouble.

_bcp_start_new_batch(DBPROCESS * dbproc)
{
TDSSOCKET *tds = dbproc->tds_socket;

_bcp_err_handler(dbproc, SYBEBBCI);

tds_submit_query(tds, dbproc->bcp.insert_stmt);
...

When SYBEBBCI is passed to the error handler, it returns INT_CANCEL.
tds_client_msg() message has some (broken, I believe) code:

ret = tds_ctx->err_handler(tds_ctx, tds, &msg_info);
tds_free_msg(&msg_info);
/* message handler returned FAIL/CS_FAIL
* mark socket as dead */
if (ret && tds) {
/* TODO close socket too ?? */
tds->state = TDS_DEAD;
}

but the handler returned INT_CANCEL, not FAIL or CS_FAIL, and the code of
course isn't testing what was returned. And, by the way, there's nothing
wrong with the session. It's very much alive.

The above logic is ifdef'ed out for now; correct handling much more
complicated and API-dependent.

Another question: Is it right for _bcp_start_new_batch() to issue SYBEBBCI?


I've been working with db-lib bcp on Microsoft platforms for years, and my
error handlers never had to filter out such a message. Does Sybase's
library emit "Batch successfully bulk-copied to SQL Server" every time
bcp_batch() is called? Is there some option that controls it, such as a
severity threshold? FWIW, this is error #20068 in db-lib.

I can't find any indication in the documentation about this, so I guess we
need some empiricism.

--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.






Archive powered by MHonArc 2.6.24.

Top of Page