Return error proposal

"Frediano Ziglio" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
Hi,
  this time James anticipated me a bit :) Look at this commit

--------------------
author	jklowden
	 Mon, 15 Dec 2008 05:31:13 +0000 (05:31 +0000)

Remove TDSSOCKET::last_packet, added tds_lastpacket().  Rename
tds_connect to tds_connect_and_login.  Change tds_connect_and_login to
return TDSERROR.  Remove tdserror calls from tds_open_socket.  Add
tds_connect as wrapper to tds_open_socket.  Connecting with TDSVER 0.0
works without producing spurious messages.
--------------------

just yesterday I though about removing TDS_FAIL and use proper error,
some sort of what Linux kernel does. I personally never liked things
like errno and returning a true/false for errors. Why not using a bit
to distinguish error from success?? For instance >= 0 for success and
< 0 for error. This is how tds_convert reply. But now even
tds_connect_and_login return the error. Personally also I don't like
an oserr in TDSSOCKET, errno usually don't have problems with thread
on multi-threaded safe environment (that is major ones) but this errno
have threads problems. Personally I suggests values <0 for errors and
>0 for success (TDS_SUCCEED, TDS_NO_MORE_RESULTS, possible truncation
on conversions and so on) with some possible flags (like errno valid).

A note about the commit. I found a change in dblib.c that change
dbsqlok but not any comment on ChangeLog, I think is just a mistake,
what is the intention of this patch?
--------------------
@@ -4612,6 +4615,10 @@ dbsqlok(DBPROCESS * dbproc)

                                tdsdump_log(TDS_DBG_FUNC, "dbsqlok:
returning %s with %s (%#x)\n",
                                                prdbretcode(retcode),
prdbresults_state(dbproc->dbresults_state), done_flags);
+
+                               if (retcode == SUCCEED && (done_flags
& TDS_DONE_MORE_RESULTS))
+                                       continue;
+
                                return retcode;
 #endif

                        default:
--------------------

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.