Re: [Warning: Retiring Address: [email protected]] bcp problems

Frediano Ziglio <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
2011/6/15 Thompson, William <[email protected]>:
> 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
_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.