[fpc-devel] Death of TSQLConnection instance after connection interrupt

Michael Van Canneyt michael at freepascal.org
Fri Apr 17 12:37:04 CEST 2015

On Fri, 17 Apr 2015, Чернов Дмитрий wrote:

> 17.04.2015, 18:41, "Michael Van Canneyt" <michael at freepascal.org>:
>        We are aware of this problem, and we are working on a solution to be able to reconnect (so, point 4 in your list (actually, the second 3) :))
>        See for example: http://bugs.freepascal.org/view.php?id=26505
>        There is a beginning of a patch in TCustomConnection
>           procedure Close(ForceClose: Boolean=False);
>        if you set Force to True then the connection will be closed and errors will be ignored.
>        Michael.
>        ,
>        _______________________________________________
>        fpc-devel maillist  -  fpc-devel at lists.freepascal.org
>        http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
> thanks for answer. it's really nice to report known bugs ;)
> but I tried forced connection closedown, and it doesn't work. at least for me. or it's I'm just sad sack?
> for example, I have this code on my (re)connect button:
> http://pastebin.com/9PPyaby9
> and after connection interrupt it throws "connection lost" exception on IBConnection.Close( True ), and doesn't set Connected to False

That is because this form of close requires implementation details per descendent of TCustomconnection

It has been implemented for MySQL (where 'Server has gone away' is a frequent problem), but not yet for Firebird. 
I will look into it.

> also one small question. will it be possibly to determine whether connection was closed by user or interrupted? and what about events calling on interrupts?

We can think about this. The problem with an interrupt is that you don't know when it happens.
You only see it when you try to do something new.


More information about the fpc-devel mailing list