 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jochem Smeets Guest
|
Posted: Wed Apr 11, 2007 6:12 pm Post subject: Transaction problem ? |
|
|
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
|
Posted: Wed Apr 11, 2007 6:32 pm Post subject: Re: Transaction problem ? |
|
|
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
|
Posted: Wed Apr 11, 2007 7:09 pm Post subject: Re: Transaction problem ? |
|
|
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
|
Posted: Thu Apr 12, 2007 12:02 am Post subject: Re: Transaction problem ? |
|
|
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 |
|
 |
|
|
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
|
|