Posted By: Sergio Sette InTransaction implementation - 12/19/03 04:57 PM
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
Posted By: al0 Re: InTransaction implementation - 12/19/03 06:09 PM
[quote]Originally posted by sergiosette:

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

[/quote]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).
Posted By: Sergio Sette Re: InTransaction implementation - 12/19/03 06:47 PM
[quote]Originally posted by al0:
[quote]Originally posted by sergiosette:
[b]
Why cannot the InTransaction be a simple flag handled by the session component ?

[/quote]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). [/b][/quote]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
Posted By: Marco Kalter Re: InTransaction implementation - 12/19/03 08:32 PM
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.
Posted By: Sergio Sette Re: InTransaction implementation - 12/19/03 08:41 PM
[quote]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.
[/quote]Thank you Marco. This can be very helpfull.

Sergio Sette
Posted By: Jens Fudickar Re: InTransaction implementation - 12/19/03 08:46 PM
Hi all together,

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

Greetings
Jens
Posted By: al0 Re: InTransaction implementation - 12/22/03 01:16 AM
[quote]Originally posted by Sergio Sette:
[quote]Originally posted by Marco Kalter:
[b] 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.
[/quote]Thank you Marco. This can be very helpfull.

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

Yours,

Oleksandr
Posted By: Marco Kalter Re: InTransaction implementation - 12/22/03 08:45 PM
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.
Posted By: Jens Fudickar Re: InTransaction implementation - 12/22/03 09:18 PM
I think this is the best solution.

Go for it :-)

Greetings
Jens
Posted By: al0 Re: InTransaction implementation - 12/23/03 12:54 AM
[quote]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. [/quote]Or just automatically disable optimization if Share is called or ExternalXXX is accessed.
Posted By: Sergio Sette Re: InTransaction implementation - 03/23/04 02:54 PM
[quote]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.
[/quote]Hi Marco,

any news about this enhancement ?
Regards
---
Posted By: Marco Kalter Re: InTransaction implementation - 03/23/04 10:21 PM
Not yet. If you need it urgently, I can send you a pre-release when it's implemented.
© Allround Automations forums