Re: Fw: tds_write_packet returns FAIL

Frediano Ziglio <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
Il giorno 02/apr/2011, alle ore 13.58, "James K. Lowden" <[email protected] 
 > ha scritto:

> tds_write_packet() returns TDS_FAIL if zero bytes were written, but
> it's not an error to send a zero-length query.
>
> I think the return statement below should be
>
>    return sent < 0 ? TDS_FAIL : TDS_SUCCEED;
>
> but maybe I'm missing something?
>
> tds_write_packet(TDSSOCKET * tds, unsigned char final)
> ...
>    sent = tds_goodwrite(tds, tds->out_buf,
>                tds->out_pos, final);
> ...
>    return sent <= 0 ? TDS_FAIL : TDS_SUCCEED;
>

An empty query has an header so here  out_pos is always > 0 and  
tds_goodwrite has to return a value strictly greater than 0. I don't  
remember if 0 is a special value from tds_goodwrite.

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