Print Thread
How to correctly break execution of TOracleDataSet or TOracleQuery?
#55205 01/03/17 07:00 PM
Joined: Jan 2017
Posts: 2
P
Plm Offline OP
Member
OP Offline
Member
P
Joined: Jan 2017
Posts: 2
Hi!
I'm writting a multithread application.
I have a control thread, which creates and starts several threads. These threads create OracleSessions, OracleDataSets and query data. The control thread should wait all threads, until they finished or timeout.

How to properly break execution, if query is running longer when timeout value?



Re: How to correctly break execution of TOracleDataSet or TOracleQuery?
Plm #55211 01/04/17 10:57 AM
Joined: Aug 1999
Posts: 22,212
Member
Offline
Member
Joined: Aug 1999
Posts: 22,212
You can call TOracleSession.BreakExecution:
[quote]TOracleSession.BreakExecution

Declaration
procedure BreakExecution;

Description
Breaks the execution of the currently running query in this session, resulting in error "ORA-01013, user requested cancel of current operation". It can be used in multi-threaded applications to abort long running queries on the server.[/quote]


Marco Kalter
Allround Automations
Re: How to correctly break execution of TOracleDataSet or TOracleQuery?
Marco Kalter #55215 01/04/17 01:37 PM
Joined: Jan 2017
Posts: 2
P
Plm Offline OP
Member
OP Offline
Member
P
Joined: Jan 2017
Posts: 2
Thanks for your reply, Marco!

1. Does it break execution immediatly or I need wait for some time?
2. How I can get information that I have running queries at the current moment?

Re: How to correctly break execution of TOracleDataSet or TOracleQuery?
Plm #55219 01/05/17 10:16 AM
Joined: Aug 1999
Posts: 22,212
Member
Offline
Member
Joined: Aug 1999
Posts: 22,212
1. It sends a break signal to the Oracle Server for the given session. The query that is executing will then terminate with an "ORA-01013, user requested cancel of current operation" exception. Because the break call and the query are running in different threads, this will be asynchronous and there will be some delay due to Oracle Server processing.

2. This information is not available as a TOracleSession property. You would need to inspect your applications TThread status.


Marco Kalter
Allround Automations

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.038s Queries: 14 (0.010s) Memory: 2.5064 MB (Peak: 3.0393 MB) Data Comp: Off Server Time: 2024-05-09 05:59:55 UTC
Valid HTML 5 and Valid CSS