|
InTransaction implementation
|
Joined: Jul 2002
Posts: 8 Bolzano, Italy
Member
|
OP
Member
Joined: Jul 2002
Posts: 8 Bolzano, Italy |
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
|
|
|
Re: InTransaction implementation
|
Joined: Nov 2003
Posts: 89 Germany
Member
|
Member
Joined: Nov 2003
Posts: 89 Germany |
[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).
|
|
|
Re: InTransaction implementation
|
Joined: Jul 2002
Posts: 8 Bolzano, Italy
Member
|
OP
Member
Joined: Jul 2002
Posts: 8 Bolzano, Italy |
[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
|
|
|
Re: InTransaction implementation
|
Joined: Aug 1999
Posts: 22,208
Member
|
Member
Joined: Aug 1999
Posts: 22,208 |
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.
Marco Kalter Allround Automations
|
|
|
Re: InTransaction implementation
|
Joined: Jul 2002
Posts: 8 Bolzano, Italy
Member
|
OP
Member
Joined: Jul 2002
Posts: 8 Bolzano, Italy |
[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
|
|
|
Re: InTransaction implementation
|
Joined: Oct 1999
Posts: 138 Eschborn, Germany
Member
|
Member
Joined: Oct 1999
Posts: 138 Eschborn, Germany |
Hi all together,
an other good idea may be an "AfterExecute"-Event in the session. And then also a "BeforeExecute"Event.
Greetings Jens
|
|
|
Re: InTransaction implementation
|
Joined: Nov 2003
Posts: 89 Germany
Member
|
Member
Joined: Nov 2003
Posts: 89 Germany |
[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 What would you do with programms using ExternalXXX (ExternalEnv etc.) properties? And with Share method? Yours, Oleksandr
|
|
|
Re: InTransaction implementation
|
Joined: Aug 1999
Posts: 22,208
Member
|
Member
Joined: Aug 1999
Posts: 22,208 |
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.
Marco Kalter Allround Automations
|
|
|
Re: InTransaction implementation
|
Joined: Oct 1999
Posts: 138 Eschborn, Germany
Member
|
Member
Joined: Oct 1999
Posts: 138 Eschborn, Germany |
I think this is the best solution.
Go for it :-)
Greetings Jens
|
|
|
Re: InTransaction implementation
|
Joined: Nov 2003
Posts: 89 Germany
Member
|
Member
Joined: Nov 2003
Posts: 89 Germany |
[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.
|
|
|
Re: InTransaction implementation
|
Joined: Jul 2002
Posts: 8 Bolzano, Italy
Member
|
OP
Member
Joined: Jul 2002
Posts: 8 Bolzano, Italy |
[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 ---
|
|
|
Re: InTransaction implementation
|
Joined: Aug 1999
Posts: 22,208
Member
|
Member
Joined: Aug 1999
Posts: 22,208 |
Not yet. If you need it urgently, I can send you a pre-release when it's implemented.
Marco Kalter Allround Automations
|
|
|
|
|
|