TOracleEvent and MDI Children.

Arvid

Member²
Hi,

I have a problem with using TOracleEvent in a MDI Child - With a normal "VCL forms application" it works ok.

I have a trigger:

CREATE OR REPLACE TRIGGER xxx
BEFORE
INSERT OR UPDATE
ON KUNDE.EKDAGTEST
REFERENCING OLD AS GAMMEL NEW AS NY
FOR EACH ROW
BEGIN
DBMS_ALERT.SIGNAL('PROGRESS', 'POSITION='||:NY.VERDI);
END;

The package called look like this:

PROCEDURE P_EVENT_TEST IS
BEGIN

for j in 1..100 loop
for i in 1.. 2500000 loop
null;
end loop;

update kunde.ekdagtest
set verdi = J;

commit;
end loop;
end;

The thing is that I get the first event (1) and the last event (100) - in between I get nothing. And I get these two events after the execution of P_EVENT_TEST is done. When I put the same code in a normal VCL form I get the events as expected.

Any idea what the problem is and how this can be solved???

I use: Direct Oracle Access 4.0.7.1
Oracle: 9.2.0.6
 
Due to the nature of the dbms_alert system, you can miss events when they occur quickly after each other. In such a case it is better to use a dbms_pipe message or a dbms_aq message.
 
I know that Marco, it is not important to get all messages. But here we get only 2 out of 100 messages. I would expect to get at least 9 out of 10...

We only get this problem with MDI applications. Try it out!

The execution of the query takes about 10 seconds, we get both messages (the 2 out of 100) AFTER the query have finished. Why don't I get the first message when it occure but 10 seconds delayed?

Something must be blocking - but what? This happens 100% of the time.
 
The solution for TOracleQuery was quite simple... The TOracleQuery where the original query is run must have "Threaded" property set to true.

Why this works differently between "MDI application" and "VCL forms application" - I do not understand (in a VCL forms application I do not need to set "Threaded" to true).

HOWEVER: What do I do when data is fetched in a TOracleDataset - I want to update a "progressbar" indicating how far along the execution have come. There is no "threaded" property on the TOracleDataset... Is it possible to get TOracleDataset and TOracleEvent to work together???
 
For a TOracleDataSet you would need to do the processing in your own TThread descendant. The canceldataset demo project provides an example.

However, if this is a thread blocking issue, you may also be able to solve the problem by setting TOracleEvent.Synchronized to False.
 
Back
Top