InTransaction implementation

I need to create a "Save button" in a toolbar that is enabled only if a transaction is open.

In the OnUpdate event of an Action i call the InTransaction method to Enable/Disable the button.

This works fine but using the monitor i've noted the InTransaction instead to be a simple flag, ask to the database if the transaction is open.

This is problematic because the OnUpdate events fires every time the application is idle. This means a great amount of network traffic is generated.

Is there a workaround ?
Why cannot the InTransaction be a simple flag handled by the session component ?

Regards

sergio sette
 
Originally posted by sergiosette:

Why cannot the InTransaction be a simple flag handled by the session component ?

For very obvious reason - session component can't be awareabout transaction state of database session. Imagine, for example, a call to stored procedure that performs commit (or rollback) inside procedure code or perform dynamic DDL (and each DDL statement commit twice).

So if you know which activity your application perform, you may monitor flag himself. If know, then you shall ask the database (that session component do for you).
 
Originally posted by al0:
Originally posted by sergiosette:

Why cannot the InTransaction be a simple flag handled by the session component ?

For very obvious reason - session component can't be awareabout transaction state of database session. Imagine, for example, a call to stored procedure that performs commit (or rollback) inside procedure code or perform dynamic DDL (and each DDL statement commit twice).

So if you know which activity your application perform, you may monitor flag himself. If know, then you shall ask the database (that session component do for you).
If the session component cannot monitor the application activity, how can i monitor the same activity ?
This can be simply done requering the transaction state after every statement executet via the session.
I cannot easily monitor the activity because there is not a session event like AfterExecute.

Do you have any idea on how to solve my problem ?

Regards

sergio sette
 
I suppose we could optimize this. If there has been no database activity for a session since the last InTransaction call, the previous value could be returned. I have added this to the list of enhancement requests.

Until then you could use a timer event to reduce network traffic.
 
Originally posted by Marco Kalter:
I suppose we could optimize this. If there has been no database activity for a session since the last InTransaction call, the previous value could be returned. I have added this to the list of enhancement requests.
Thank you Marco. This can be very helpfull.

Sergio Sette
 
Hi all together,

an other good idea may be an "AfterExecute"-Event in the session. And then also a "BeforeExecute"Event.

Greetings
Jens
 
Originally posted by Sergio Sette:
Originally posted by Marco Kalter:
I suppose we could optimize this. If there has been no database activity for a session since the last InTransaction call, the previous value could be returned. I have added this to the list of enhancement requests.
Thank you Marco. This can be very helpfull.

Sergio Sette
It may not be so easy :confused:
What would you do with programms using ExternalXXX (ExternalEnv etc.) properties? And with Share method?

Yours,

Oleksandr
 
Hmm, good point. When using ExternalXXX this optimization will not work. Maybe we can introduce an option for this, and document its limitations. I'm sure that it would work for 99.9% of all applications, so it may be useful.
 
Originally posted by Marco Kalter:
Hmm, good point. When using ExternalXXX this optimization will not work. Maybe we can introduce an option for this, and document its limitations. I'm sure that it would work for 99.9% of all applications, so it may be useful.
Or just automatically disable optimization if Share is called or ExternalXXX is accessed.
 
Originally posted by Marco Kalter:
I suppose we could optimize this. If there has been no database activity for a session since the last InTransaction call, the previous value could be returned. I have added this to the list of enhancement requests.

Until then you could use a timer event to reduce network traffic.
Hi Marco,

any news about this enhancement ?
Regards
---
 
Back
Top