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

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
On Sun, 22 May 2011 11:02:46 +0200
Frediano Ziglio <[email protected]> wrote:

> I did commit just some hour before :)
> You add a relaxation to term_len, not to bufpos.

I reverted that just now.  Thanks for getting it right.  

> I think that the idea behind Bill relaxation is really return: I have
> inserted 0 row (that is 0 return), not returning an error.
> For some reason Bill code issue an additional bcp_done without rows
> and Sybase code used to return 0 while FreeTDS returns error.

For now, until I hear from Bill, if bcp_done is called twice, it just
returns an error (-1).  It used to invoke the error handler.  

The programmer deserves to be told the function was called in
error.  It is analogous to EBADF for close(2).  

> Have you noted that this function is returning FAIL (0) instead of -1?

Er, no, bcp_done() returns DBINT, number of rows returned.  Similar to
ffush(3).  Maybe it *should* be a boolean, like fclose(3), but that's
another story.  

> How I miss C++ and its type safety, I would use an enum and compiler
> gave me at least a warning :)

tds.h    144 #define TDS_SUCCESS 1

Your enum awaits, sire.  ;-)

Regards, 

--jkl
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.