[freetds] possible bug: bcp_bind seems to be broken when using variables assignment

Anwar, Mohammed mohammed.anwar at intel.com
Thu Jan 30 01:54:35 EST 2003


Thanks for the replies.

I checked out the latest CVS and the fix is there.

I had the release version which didn't have the updated code.

My code is virtually the same as the example in the link in my message, this can be used as a test.

http://manuals.sybase.com/onlinebooks/group-cn/cng1250e/dblib/@Generic__BookTextView/47490;hf=0#X

Thanks again.
Anwar


-----Original Message-----
From: James K. Lowden [mailto:jklowden at schemamania.org]
Sent: Wednesday, January 29, 2003 11:31 PM
To: freetds at lists.ibiblio.org
Subject: Re: [freetds] possible bug: bcp_bind seems to be broken when
using variables assignment


On Wed, 29 Jan 2003 22:12:55 -0800, "Anwar, Mohammed"
<mohammed.anwar at intel.com> wrote:
> Hi,
> 	When using bcp_init followed by bcp_bind the bcp_bind will always
> 	fail (for me anyway, and I have tried a number of variations on
> 	the parameters to bcp_bind).
> 	
> 	Once I looked at the code I realized why the bind was failing.
> 
> 	I looked at the source in bcp.c and it seems bcp_bind has a check
> 	for :
> 		if (table_column > dbproc->host_colcount)
> 			return FAIL;
> 	
> 
> 	which will always be return FAIL as the dbproc->host_colcount
> 	variable is set to 0 in the bcp_init when calling :
> 		_bcp_clear_storage(dbproc);
> 
> 	it seems this variable is only updated when the input file is
> 	provided and a call is made to 
> 		bcp_columns
> 
> 	the bcp_init function only updates the dbproc->bcp_colcount
> 	variable.

And my bcp_bind documentation says:

	"It is an error to call bcp_columns when using bcp_bind."

Funny, there's no unit test for bcp_bind.  Hmph. 

Mohammed, a quick check of the CVS code confirms what Bill says, that
bcp_init() sets things up correctly.  Rather than a log, could you just
send a little test case that demonstrates the problem?  I'd like to add it
to our unit tests once the problem is solved, one way or the other.  

Regards, 

--jkl






More information about the FreeTDS mailing list