freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "James K. Lowden" <jklowden AT freetds.org>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] Bug in bcp.c
- Date: Mon, 13 Sep 2010 21:02:25 -0400
Libin Qi wrote:
>
> When I call bcp_sendrow()
> If I pass a non-numeric string e.g. "xx" to an integer field in
> database, the conversion would fail, but instead of returning a -1, the
> library core-dumped.
>
> Line 3485 in bcp.c, the assertion failed.
>
> After modifying code like this, it started working:
> 3483: bindcol->bcp_column_data->datalen = converted_data_size;
> 3484: if(bindcol->bcp_column_data->datalen < 0)
> 3485: return (FAIL) ;
> 3486: bindcol->bcp_column_data->is_null = 0;
> 3487: assert(converted_data_size > 0);
>
Thanks for pointing this out. I committed a simpler change.
Sybase says dbconvert may return FAIL or -1 in case of error; Microsoft
says -1. bcp.c assumed only FAIL was possible. It now tests for both.
Memo to file: dbconvert currently implements Microsoft semantics, which is
wrong because FreeTDS promises Sybase semantics. Possibly it should
follow --with-msdblib, but at least it should return FAIL according to
Sybase's specifications. (The value of Sybase's distinction between -1
and FAIL is lost on me, though.)
--jkl
- Re: [freetds] Bug in bcp.c, James K. Lowden, 09/13/2010
Archive powered by MHonArc 2.6.24.