Print Thread
Page 1 of 2 1 2
InTransaction implementation
#5833 12/19/03 04:57 PM
Joined: Jul 2002
Posts: 8
Bolzano, Italy
Member
OP Offline
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
#5834 12/19/03 06:09 PM
Joined: Nov 2003
Posts: 89
Germany
A
al0 Offline
Member
Offline
Member
A
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
#5835 12/19/03 06:47 PM
Joined: Jul 2002
Posts: 8
Bolzano, Italy
Member
OP Offline
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
#5836 12/19/03 08:32 PM
Joined: Aug 1999
Posts: 22,208
Member
Offline
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
#5837 12/19/03 08:41 PM
Joined: Jul 2002
Posts: 8
Bolzano, Italy
Member
OP Offline
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
#5838 12/19/03 08:46 PM
Joined: Oct 1999
Posts: 138
Eschborn, Germany
Member
Offline
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
#5839 12/22/03 01:16 AM
Joined: Nov 2003
Posts: 89
Germany
A
al0 Offline
Member
Offline
Member
A
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 confused
What would you do with programms using ExternalXXX (ExternalEnv etc.) properties? And with Share method?

Yours,

Oleksandr

Re: InTransaction implementation
#5840 12/22/03 08:45 PM
Joined: Aug 1999
Posts: 22,208
Member
Offline
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
#5841 12/22/03 09:18 PM
Joined: Oct 1999
Posts: 138
Eschborn, Germany
Member
Offline
Member
Joined: Oct 1999
Posts: 138
Eschborn, Germany
I think this is the best solution.

Go for it :-)

Greetings
Jens

Re: InTransaction implementation
#5842 12/23/03 12:54 AM
Joined: Nov 2003
Posts: 89
Germany
A
al0 Offline
Member
Offline
Member
A
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.

Page 1 of 2 1 2

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.034s Queries: 15 (0.009s) Memory: 2.5596 MB (Peak: 3.0393 MB) Data Comp: Off Server Time: 2024-05-03 21:09:31 UTC
Valid HTML 5 and Valid CSS