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 

How can other user see the changes right after one user upda

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (dbExpress)
View previous topic :: View next topic  
Author Message
PC Leung
Guest





PostPosted: Fri Nov 14, 2003 3:42 pm    Post subject: How can other user see the changes right after one user upda Reply with quote



I make use of the following stored procedure to insert two values from a form.
I do not see the changes in ISQL when I type the select statement.
If I quit ISQL, and re-enter I can find the inserted record is in the table.

Likewise, I have tried clientdataset with applyupdate(0) with DBEdit.
The result is similar. After clientdataset.applyupdate,
I cannot see the changes until I quit ISQL and re-enter ISQL.
Then I can see the changes by typing select statement.

With dbExpress and Firebird, how can I see the changes right after executing stored procedures or
clientdataset.applyupdates(0)?
Otherwise, in a multi-user environment, changes in database cannot be seen
by other user when one user updates the database.


set term !! ;
create procedure sp_insert_test
(p1 varchar(20), p2 varchar(20))
returns (o1 integer)
as
begin
insert into test (f1, f2)
values (:p1, :p2);
o1 = 1;
end !!
set term ; !!


procedure TForm1.FormCreate(Sender: TObject);
begin
sqlconnection1.Open;
clientdataset1.Open;
end;

procedure TForm1.btn_InsertClick(Sender: TObject);
begin
sqlstoredproc1.Params[0].AsString := 'aaa';
sqlstoredproc1.Params[1].AsString := 'bbb';
sqlstoredproc1.ExecProc;
clientdataset1.Refresh;
end;

procedure TForm1.btn_refreshClick(Sender: TObject);
begin
clientdataset1.Close;
sqlconnection1.close;
sqlconnection1.Open;
clientdataset1.Open;
end;
Back to top
Bill Todd
Guest





PostPosted: Fri Nov 14, 2003 9:58 pm    Post subject: Re: How can other user see the changes right after one user Reply with quote



On 14 Nov 2003 08:42:59 -0700, "PC Leung" <itpcl (AT) msn (DOT) com> wrote:

Quote:
With dbExpress and Firebird, how can I see the changes right after executing stored procedures or
clientdataset.applyupdates(0)?
Otherwise, in a multi-user environment, changes in database cannot be seen
by other user when one user updates the database.

What you have to do to see changes made and committed by another user
depends on your transaction isolation level. If your transaction
isolation level is read committed then just rerun your SELECT and you
will see the changes. If your transaction isolation level is snapshot
then you must commit your transaction, start a new transaction and
then run your SELECT statement.


--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

Back to top
PC Leung
Guest





PostPosted: Sat Nov 15, 2003 12:19 am    Post subject: Re: How can other user see the changes right after one user Reply with quote




I have set the isolation level as read committed in SQLConnection component,
it is still the same situation.

What else do I have to set?

Thanks



Back to top
PC Leung
Guest





PostPosted: Sat Nov 15, 2003 1:16 am    Post subject: Re: How can other user see the changes right after one user Reply with quote


I make a little testing app. I call it up. then I invoke it again. Two same applications are running.

I have tried refresh and close and re-open the clientdataset,
it does not work.

Until I drop a button on a form, close and re-open the connection inside the button, I can see the changes.
Back to top
Bill Todd
Guest





PostPosted: Sat Nov 15, 2003 1:54 am    Post subject: Re: How can other user see the changes right after one user Reply with quote

Is the other user committing the transaction that made the changes
before you try to see the changes? When you want to see the changes to
you call the ClientDataSet's Refresh method or do you close and reopen
the ClientDataSet?


--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
Back to top
Bill Todd
Guest





PostPosted: Sat Nov 15, 2003 2:26 am    Post subject: Re: How can other user see the changes right after one user Reply with quote

Can you create a test application that uses the sample EMPLOYEE.GDB
database and upload it to the attachments group?


--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (dbExpress) 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.