BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Transaction problem ?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (InterBase Express)
View previous topic :: View next topic  
Author Message
Jochem Smeets
Guest





PostPosted: Wed Apr 11, 2007 6:12 pm    Post subject: Transaction problem ? Reply with quote



Setup is as follows : Delphi 2006 & Interbase 7.5 develloper edition.

I have a TIBQuery (Query-A) wich is connected to a
TIBTransaction(Transaction-A) , TIBUpdateSQL (UpdateSQL-A) and a DataSource.
I use this DataSource to connect to the grid in the main form. Now this
part works as I want it to work.
Inserts, Updates , Deletes they all are commited through the AfterPost Event
of the TIBQuery (by calling the 'CommitRetaining' of the TIBTransaction
connected to the TIBQuery)
And the Grid nicely reflects any changes I make.

Now I have another TIBQuery & TIBTransaction. Lets call them Query-B &
Transaction-B.
I use Query-B (and Transaction-B) to execute an update statement on the
table which Query-A connects to as wel.
Now if I commit the changes I made using Query-B, I don't see them in my
grid , even after a refresh or close/open.
So Query-A refuses to read the new data that has been commited by Query-B
If I use an external tool I can clearly see the changes so I know the commit
by Query-B was succesfull only Query-A does not seem to notice it.

Any help is appreciated


Regards

Jochem
Back to top
Wayne Niddery [TeamB]
Guest





PostPosted: Wed Apr 11, 2007 6:32 pm    Post subject: Re: Transaction problem ? Reply with quote



Jochem Smeets wrote:
Quote:

Now I have another TIBQuery & TIBTransaction. Lets call them Query-B &
Transaction-B.
I use Query-B (and Transaction-B) to execute an update statement on
the table which Query-A connects to as wel.
Now if I commit the changes I made using Query-B, I don't see them in
my grid , even after a refresh or close/open.
So Query-A refuses to read the new data that has been commited by
Query-B If I use an external tool I can clearly see the changes so I
know the commit by Query-B was succesfull only Query-A does not seem
to notice it.


There are two points here, the first is that you cannot "refresh" a query -
refresh only acts on the single current record, not the entire result set.
To refresh the entire query it must be closed and reopened. However that is
not enough, the second thing is the transaction's isolation. By default this
is "snapshot" which means it will only see data as it was at the time the
transaction was first opened. Change transaction-A's isoaltion to
ReadCommitted.

--
Wayne Niddery - Winwright, Inc (www.winwright.ca)
"Bandwagons are like streetcars, there'll be another along in a few
minutes."
Back to top
Jochem Smeets
Guest





PostPosted: Wed Apr 11, 2007 7:09 pm    Post subject: Re: Transaction problem ? Reply with quote



Thank you.
Changing the Isolation level of the Transaction-A did work. Now if I
'refresh' the updated values are shown.

I did not have to reopen the Query-A or Transaction-A but I use a Dev
Express grid, if i press the refresh button of that grid it apparently makes
sure the Query-A is being re-executed. And so showing me every updated
record.

Jochem




"Wayne Niddery [TeamB]" <wniddery (AT) chaffaci (DOT) on.ca> schreef in bericht
news:461ce37d$1 (AT) newsgroups (DOT) borland.com...
Quote:
Jochem Smeets wrote:

Now I have another TIBQuery & TIBTransaction. Lets call them Query-B &
Transaction-B.
I use Query-B (and Transaction-B) to execute an update statement on
the table which Query-A connects to as wel.
Now if I commit the changes I made using Query-B, I don't see them in
my grid , even after a refresh or close/open.
So Query-A refuses to read the new data that has been commited by
Query-B If I use an external tool I can clearly see the changes so I
know the commit by Query-B was succesfull only Query-A does not seem
to notice it.


There are two points here, the first is that you cannot "refresh" a
query - refresh only acts on the single current record, not the entire
result set. To refresh the entire query it must be closed and reopened.
However that is not enough, the second thing is the transaction's
isolation. By default this is "snapshot" which means it will only see data
as it was at the time the transaction was first opened. Change
transaction-A's isoaltion to ReadCommitted.

--
Wayne Niddery - Winwright, Inc (www.winwright.ca)
"Bandwagons are like streetcars, there'll be another along in a few
minutes."
Back to top
Wayne Niddery [TeamB]
Guest





PostPosted: Thu Apr 12, 2007 12:02 am    Post subject: Re: Transaction problem ? Reply with quote

Jochem Smeets wrote:
Quote:
Thank you.
Changing the Isolation level of the Transaction-A did work. Now if I
'refresh' the updated values are shown.

I did not have to reopen the Query-A or Transaction-A but I use a Dev
Express grid, if i press the refresh button of that grid it
apparently makes sure the Query-A is being re-executed. And so
showing me every updated record.

Good. I assumed you meant the Refresh method of the dataset.

--
Wayne Niddery - Winwright, Inc (www.winwright.ca)
"Reality is that which, when you stop believing in it, doesn't go
away." — Philip K. Dick
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (InterBase Express) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.