Detect Session is in use in multi threaded environment
Detect Session is in use in multi threaded environment
Hi,
in a multithreaded environment, is there a way to detect, that on any other thread a sql statement is executed for the current session.
For example session.IsInUse
I want to check the application state against the database any time the application is activated. But when in a detail thread something is running, the main thread waits until the detail thread is finished.
Greetings
Jens
in a multithreaded environment, is there a way to detect, that on any other thread a sql statement is executed for the current session.
For example session.IsInUse
I want to check the application state against the database any time the application is activated. But when in a detail thread something is running, the main thread waits until the detail thread is finished.
Greetings
Jens
There is no way to detect that a statement is executing on a session. If you use one TOraQuery component in your thread, you can check result of the Executing and Fetching methods of TOraQuery.
You also can add a counter variable to your thread, increment this variable before openning a query, and decrement after openning.
You also can add a counter variable to your thread, increment this variable before openning a query, and decrement after openning.
My Idea was to add this as a new feature to the session.
The point is to add the following functions
InUse returns true if the counter is greater 0.
The Begin/EndeSessionUsage must be included before/after the call's to the oci call's of each component.
This should be included inside the component. It's the only way to be shure to have it in every time.
Greetings
Jens
The point is to add the following functions
- BeginSessionUsage
EndSessionUsage
IsInUse
InUse returns true if the counter is greater 0.
The Begin/EndeSessionUsage must be included before/after the call's to the oci call's of each component.
This should be included inside the component. It's the only way to be shure to have it in every time.
Greetings
Jens