Subject Re: [IBO] Callback problem with TIB_Dataset
Author Helen Borrie
Don,

At 11:39 PM 29/11/2006, you wrote:
>Hi guys,

Not guilty. :-)

>I believe I may have discovered a rare issue within TIB_Dataset which may
>translate to other IBO components too. I'm using an old version of IBO
>(v4.3.Aa) so there is a possibility that this may have been fixed already.
>
>I've developed a multi-threaded server with one of the threads accessing a
>Firebird server via IBO. It's been running very well for a while now but
>I've recently discovered a problem. TIB_Dataset has a method called
>DefaultProcessCallback() which is called when no OnCallback event handler
>has been assigned to a TIB_Dataset derived component.
>
>The DefaultProcessCallback method creates an instance of the TdlgCancelQuery
>form which displays the current progress as well as a Cancel button:
>
>dlgCancelQuery := TdlgCancelQuery.Create( Application );
>
>This form is created with the TApplication instance as owner. However,
>accessing the Application instance is a big no-no in multi-threaded apps.
>This sometimes causes my database thread to die a horrible death. I've
>managed to easily get around the problem by assigning a dummy OnCallback
>event handler to my TIB_Query components. This causes the TIB_Dataset
>component not to create its own handler.
>
>I suggest that in order to fix this problem (if it's not fixed yet) is to
>add an additional property to the TIB_Dataset class which allows one to
>Disable the callback functionality alltogether, perhaps something like
>CallbackDisable. When set to true it should skip any Callback functionality.
>This might make more sense than having to assign a dummy callback routine.

Use the CallBackInc property for precisely that purpose:

From the help:

Declaration
property CallbackInc: integer;
Description


If it is set to -1 then there will be no process callback at all.

If it is set to 0 then calls will be made only to
Application.ProcessMessages (which of course you don't want!!)

If it is set to 1 or higher, the callback timing increment settings
will be checked to see if a callback should be triggered.

This check is performed every nth fetch processed.
--------------
It defaults to 5 in later IBO versions...can't recall if this differs
from that old version.

Helen