Re: A couple of bugs in 0.91 with dblib bcp library

Frediano Ziglio <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
2011/5/23 Thompson, William <[email protected]>:
> Hi,
>
> I've sorted why the code passes this if statement:
>
>       if (!data_is_null && bindcol->column_bindlen >= 0) {
>
> even when bindcol->column_bindlen = -1
>
> it's because...
>
> tds.h:  TDS_UINT column_bindlen;
>
> I'm not mad after all...
>
> I just need to decide what to do.
> I think that if you can validly pass -1 to bcp_bind (in the varlen parameter), then column_bindlen shouldn't be unsigned...
>
> Now I understand what's happened, I'll see waht's the best thing to do.
> The code works at the moment, but is it more by luck than judgement?
>
> Bill
>

Looking at places where column_bindlen is assigned it seems it should
be signed, not unsigned as you spot.

We should check however when this values should not be used when it's
negative. For instance is used to index fields in structures. For
instance dbbind and dbaltbind specify that this parameter is ignored
if fixed length, IMO we should correct the value to the size of the
fixed-type.

freddy77
_______________________________________________
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.