Le
[...] 25/08/2014 12:13, Richard Mace a écrit :
Hi Antonia,

    This sequence does not protect against the server disconnection
    between two consecutive database calls.


Would you mind giving me an example of this?
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:

   MySql.Database := MyDatabase;
   [...]
   MyDatabase.Connect;
   (1)
   Mysql.Sql.text := 'select any from thedatabase';
   MyTransaction.StartTransaction;
   (2)
   Mysql.Open:
   (3)
   while Mysql.EOF = False do begin
        // do whatever to do with database records
        Mysql.Next
   (4)
   end;
   (5)
   Mysql.close;
   (6)
   MyTransaction.Commit;
   (7)
   MyDatabase.Connected := False;

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: telnet host_name(or IP address) 3050 (or whatever firebird port is used in host) issued in in a command line. 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. 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 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

Antonio.

Thanks

Richard



--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus



---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce 
que la protection avast! Antivirus est active.
http://www.avast.com
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to