[freetds] possible bug: bcp_bind seems to be broken when using variables assignment
Anwar, Mohammed
mohammed.anwar at intel.com
Wed Jan 29 22:12:55 EST 2003
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.
I am tried examples from varoius sites but they all seem to be the similar, here is the link for one of them
http://manuals.sybase.com/onlinebooks/group-cn/cng1250e/dblib/@Generic__BookTextView/47490;hf=0#X
I have tried the following to see if I could get it to work:
bcp_init(dbproc, "test_bcp..sig",NULL, NULL, DB_IN)
bcp_columns(dbproc, 1);
as it states bcp_columns can only be used if the input file is not NULL.
bcp_init(dbproc, "test_bcp..sig",NULL, NULL, DB_IN)
bcp_collen(dbproc, -1, 1);
this fails as the host_colcount variable is 0 and the the column id is 1.
I would really appreciate some help on this.
Thanks a lot for your help..
Anwar
More information about the FreeTDS
mailing list