Skip to Content.
Sympa Menu

freetds - Re: [freetds] A couple of bugs in 0.91 with dblib bcp library

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: freetds AT lists.ibiblio.org
  • Subject: Re: [freetds] A couple of bugs in 0.91 with dblib bcp library
  • Date: Sat, 21 May 2011 14:32:15 -0400

On Sat, 21 May 2011 08:35:29 +0100
"Thompson, William" <bill.d.thompson AT baml.com> wrote:

Hi Bill,

> - assert(bufpos > 0);
> + assert(bufpos >= 0);

Committed.

> - CHECK_PARAMETER(dbproc->bcpinfo, SYBEBCPI, FAIL);
> + if (!(dbproc->bcpinfo))
> + return 0;

Committed, except IMO the return code should be -1. My reasoning is
the application should be able to detect a logical error, and the
function is misused if called twice without an intervening (and
successful) bcp_init().

If the application is cavalier:

bcp_done(dbproc);
bcp_done(dbproc);

will now succeed and fail silently, in that order. If it's careful:

if( bcp_done(dbproc) == -1 ) {
/* do error stuff */
}
if( bcp_done(dbproc) == -1 ) {
/* do error stuff */
}

it will break, as well it should, as the programmer should prefer.

If that doesn't suit you, I'll #ifdef it for you.

Regards,

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page