freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "James K. Lowden" <jklowden AT freetds.org>
- To: freetds AT lists.ibiblio.org
- Subject: Re: [freetds] Memory problems with dbcmd
- Date: Sat, 8 Dec 2012 12:24:01 -0500
On Tue, 4 Dec 2012 10:45:40 +0100
Alberto Pulvirenti <alberto.pulvirenti AT crowdengineering.com> wrote:
> Can it happen that a sudden and momentary communication failure
> causes dbcmd() to fail?
No.
> Or its failure are only due to memory allocation problems?
Also no! :-)
Have a look at the dbcmd() code in dblib.c. You'll note it can fail
for memory allocation reasons, but also checks the parameters it was
called with and the state of the connection first. The state of the
connection is *not* affected by transient network problems, though.
A connection's state is a function of how the most recent communication
with the server fared: as long as tcp doesn't report that the server
disconnected, and the client received a response (of any kind) from the
server for the previous query, the connection is considered OK. OTOH
if the server closed the connection, it is marked DEAD because no
further use can be made of it. A db-lib function invoked with a DEAD
dbproc fails immediately on seeing the DEAD status, saving pointless
lost time trying to use a connection that has no peer listening on the
other end.
dbcmd() invokes the error handler before it returns FAIL. Your
handler should display that message somewhere.
HTH.
--jkl
-
[freetds] Memory problems with dbcmd,
Alberto Pulvirenti, 12/04/2012
-
Re: [freetds] Memory problems with dbcmd,
Frediano Ziglio, 12/04/2012
- Re: [freetds] Memory problems with dbcmd, Alberto Pulvirenti, 12/05/2012
- Re: [freetds] Memory problems with dbcmd, James K. Lowden, 12/08/2012
-
Re: [freetds] Memory problems with dbcmd,
Frediano Ziglio, 12/04/2012
Archive powered by MHonArc 2.6.24.