Skip to Content.
Sympa Menu

freetds - RE: [freetds] possible bug: bcp_bind seems to be broken when usin g variables assignment

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Thompson, Bill D (London)" <ThompBil AT exchange.uk.ml.com>
  • To: "'freetds AT lists.ibiblio.org'" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] possible bug: bcp_bind seems to be broken when usin g variables assignment
  • Date: Thu, 30 Jan 2003 06:49:11 -0000

Anwar,

I'll be pleased to help you sort your problem out.

bcp_init() DOES set dbproc.host_colcount, at least in my version....

if (hfile == (char *) NULL) {

dbproc->host_colcount = dbproc->bcp_colcount;
dbproc->host_columns = (BCP_HOSTCOLINFO **) malloc(dbproc->host_colcount
* sizeof(BCP_HOSTCOLINFO *));

for (i = 0; i < dbproc->host_colcount; i++) {
dbproc->host_columns[i] = (BCP_HOSTCOLINFO *)
malloc(sizeof(BCP_HOSTCOLINFO));
memset(dbproc->host_columns[i], '\0', sizeof(BCP_HOSTCOLINFO));
}
}

I think I'd need a TDSDUMP log file to dig in further, can you send me one ?

thanks,

Bill
> -----Original Message-----
> From: Anwar, Mohammed [SMTP:mohammed.anwar AT intel.com]
> Sent: Thursday, January 30, 2003 6:13 AM
> To: freetds AT lists.ibiblio.org
> Subject: [freetds] possible bug: bcp_bind seems to be broken when
> using variables assignment
>
> 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__Bo
> okTextView/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
>
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds





Archive powered by MHonArc 2.6.24.

Top of Page