<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Le<br>
[...] 25/08/2014 12:13, Richard Mace a écrit :<br>
</div>
<blockquote
cite="mid:CAK+KT3-Xvfv3EUSbQxFneVW4NRt0EnAeAsEsHxLkRBursr1-vg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div>
<div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">Hi
Antonia,</div>
</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">This sequence does
not protect against the server disconnection between two
consecutive database calls.</div>
</blockquote>
<div><br>
</div>
<div>
<div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">Would
you mind giving me an example of this?</div>
</div>
</div>
</div>
</div>
</blockquote>
What I mean is that the physical TCP/IP connection between the
aplication (the client) and the firebird server is not
systematically tested on every function call to the library
accessing the firebirs server. If you assume the following sequence
of operations:<br>
<br>
<blockquote>MySql.Database := MyDatabase;<br>
[...]<br>
MyDatabase.Connect;<br>
(1)<br>
Mysql.Sql.text := 'select any from thedatabase';<br>
MyTransaction.StartTransaction;<br>
(2)<br>
Mysql.Open:<br>
(3)<br>
while Mysql.EOF = False do begin<br>
// do whatever to do with database records<br>
Mysql.Next<br>
(4)<br>
end;<br>
(5)<br>
Mysql.close;<br>
(6)<br>
MyTransaction.Commit;<br>
(7)<br>
MyDatabase.Connected := False;<br>
</blockquote>
After each statement noted (1) thru (7) the TCP/IP link initiated by
the MyDatabase.Connect can be broken anywhere betwenn (1) and (7)
unless you code something to test it. This can be any function
looking something like a:<br>
telnet host_name(or IP address) 3050 (or whatever firebird port is
used in host) issued in in a command line. <br>
In a Lazarus program you would need something like Indy ping
component (any other is also OK) wich will test the firebird server
awakeness. Its is really a heavy workloa anyway.<br>
I usually keep going with my former exemple. When the server
connection is critical I fill in the except part some code to figure
out witch is the failing part using either the exception code or the
exception text itself. I can also specialize the different exception
sources using the On MyException:Exception do<br>
In the top example of code I'll insert try..except's (or finally's
if I don't care about exceptions) around the critical places I can't
miss. But this depends on the application as well<br>
<br>
Antonio.<br>
<br>
<blockquote
cite="mid:CAK+KT3-Xvfv3EUSbQxFneVW4NRt0EnAeAsEsHxLkRBursr1-vg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div>
<div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">Thanks</div>
<div class="gmail_default"
style="font-family:arial,helvetica,sans-serif"><br>
</div>
<div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">
Richard</div>
<br>
</div>
<div class="gmail_default"
style="font-family:arial,helvetica,sans-serif"></div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">--
_______________________________________________
Lazarus mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Lazarus@lists.lazarus.freepascal.org">Lazarus@lists.lazarus.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a>
</pre>
</blockquote>
<br>
<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
<tr>
<td style='border:none;padding:0px 15px 0px 8px'>
<a href="http://www.avast.com/">
<img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" />
</a>
</td>
<td>
<p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection <a href="http://www.avast.com/">Antivirus avast!</a> est active.
</p>
</td>
</tr>
</table>
<br />
</body>
</html>