Detect Session is in use in multi threaded environment

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jfudickar
Posts: 202
Joined: Fri 10 Mar 2006 13:03
Location: Oberursel / Germany

Detect Session is in use in multi threaded environment

Post by jfudickar » Sat 17 Nov 2007 21:11

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

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Mon 19 Nov 2007 08:39

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.

jfudickar
Posts: 202
Joined: Fri 10 Mar 2006 13:03
Location: Oberursel / Germany

Post by jfudickar » Mon 19 Nov 2007 09:46

My Idea was to add this as a new feature to the session.

The point is to add the following functions
  • BeginSessionUsage
    EndSessionUsage
    IsInUse
Begin and End increments /decrements a counter, they should be thread-save.
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

jfudickar
Posts: 202
Joined: Fri 10 Mar 2006 13:03
Location: Oberursel / Germany

Post by jfudickar » Tue 27 Nov 2007 09:38

Hi Oleg,

any further comment on this?

Please see it as an feature request.

Greetings
Jens

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 27 Nov 2007 10:23

We'll consider possibility to add this feature.

jfudickar
Posts: 202
Joined: Fri 10 Mar 2006 13:03
Location: Oberursel / Germany

Post by jfudickar » Fri 01 Feb 2008 09:37

Any news on this??

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Thu 07 Feb 2008 13:22

There is a lot of work required to implement this feature. Currently we have some more priority tasks. We'll consider possibility to add this feature in one of the future ODAC versions.

jfudickar
Posts: 202
Joined: Fri 10 Mar 2006 13:03
Location: Oberursel / Germany

Post by jfudickar » Thu 07 Feb 2008 14:23

I agree and i understand.

That's realy sad for multi threaded environments.

Does future odac version meant release 7 :-(

Greetings
Jens

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Fri 08 Feb 2008 09:43

It is possible that we'll add this feature in ODAC 7.

Post Reply