Skip to Content.
Sympa Menu

freetds - Re: [freetds] [Warning: Retiring Address: thompbil@exchange.uk.ml.com] bcp problems

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] [Warning: Retiring Address: thompbil AT exchange.uk.ml.com] bcp problems
  • Date: Thu, 16 Jun 2011 16:18:16 +0200

2011/6/15 Thompson, William <bill.d.thompson AT baml.com>:
> Hi Panos,
>
> I got to it anyway....
>
> Well it's clearly in the same area as we have touched previously, i.e. an
> "empty" terminated field.
> The fact that your debug (in bcp_get_term_var) has not appeared suggests
> that that function found a field terminator right at the start of the data.
>
> what's interesting then is that we go on to call dbconvert, with a srclen
> of -1 ...
>
> dblib.c:2144:dbconvert(46eb0, SYBCHAR, fd2a5d05, -1, SYBCHAR, 325b0, 20)
> dblib.c:2177:dbconvert() srctype == desttype
>
> well the way I read _bcp_get_col_data is as follows (see my comments marked
> BILL):
>
>    /* read the data, finally */
>
>    if (bindcol->bcp_term_len > 0) {    /* terminated field */
>        bytes_read = _bcp_get_term_var(dataptr, (BYTE
> *)bindcol->bcp_terminator, bindcol->bcp_term_len);
>        /* BILL - bytes read should be zero */
>
>        if (collen)
>            collen = (bytes_read < collen) ? bytes_read : collen;
>        else
>            collen = bytes_read;
>        /* BILL - collen should now be zero */
>

no if collen was < 0. In this case collen remains < 0.

>        if (collen == 0)
>            data_is_null = 1;
>        /* data-is_null should be set */
>    }
>
>    if (data_is_null) {
>        bindcol->bcp_column_data->datalen = 0;
>        bindcol->bcp_column_data->is_null = 1;
>    } else {
>        /* BILL - ergo we shouldn't be coming in here at all */
>        desttype = tds_get_conversion_type(bindcol->column_type,
> bindcol->column_size);
>
>        if ((converted_data_size =
>             dbconvert(dbproc, bindcol->column_bindtype,
>                   (BYTE *) dataptr, collen,
>                   desttype, bindcol->bcp_column_data->data,
> bindcol->column_size)) == FAIL) {
>            return (FAIL);
>            /* BILL - this is where _bcp_get_col_data fails */
>        }
>
> Some more debug in this area of the code is required I think, to see what's
> happening here...
> particularly how collen gets set to -1 and then that is passed to
> dbconvert()....
>
>
> HTH,
>
> Bill

Frediano




Archive powered by MHonArc 2.6.24.

Top of Page