| View previous topic :: View next topic |
| Author |
Message |
PC Leung Guest
|
Posted: Fri Nov 14, 2003 3:42 pm Post subject: How can other user see the changes right after one user upda |
|
|
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
|
Posted: Fri Nov 14, 2003 9:58 pm Post subject: Re: How can other user see the changes right after one user |
|
|
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
|
Posted: Sat Nov 15, 2003 12:19 am Post subject: Re: How can other user see the changes right after one user |
|
|
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
|
Posted: Sat Nov 15, 2003 1:16 am Post subject: Re: How can other user see the changes right after one user |
|
|
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
|
Posted: Sat Nov 15, 2003 1:54 am Post subject: Re: How can other user see the changes right after one user |
|
|
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
|
Posted: Sat Nov 15, 2003 2:26 am Post subject: Re: How can other user see the changes right after one user |
|
|
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 |
|
 |
|