Subject | RE: [firebird-support] Re: InterBase, Dephi, BDE and Transactions |
---|---|
Author | Simon Carter |
Post date | 2004-11-17T19:39:41Z |
Gustavo,
learnt early on was to make the change from BDE to native components as soon
as possible, however if this isn't practical yet then you could write a
couple of wrapper functions like (not tested):
procedure TDataModule.StartTran();
begin
if (not DatabaseGeneral.InTransaction) then
DatabaseGeneral.StartTransaction();
end;
procedure TDataModule.Commit();
begin
if (DatabaseGeneral.InTransaction) then
DatabaseGeneral.Commit();
end;
procedure TDataModule.Rollback();
begin
if (DatabaseGeneral.InTransaction) then
DatabaseGeneral.Rollback();
end;
Now whenever you want to start a transaction simple call the wrapper
functions above instead of on the db its self. BUT I would *strongly*
recommend you change to IBO or even use TIB* components that come with
Delphi if you don't want to purchase any third party controls, as you will
see a significant improvement in speed/reliability.
Rgds
Si Carter
TECT Software Ltd
http://www.tectsoft.net/
> I tried starting a transaction with another SessionI have completed several conversions from BDE to IB/FB and one thing I
> component but, as I supposed, it didnĀ“t worked because each
> transaction is independent of the other (the implicit one
> made by the BDE and the one I started in another Session).
learnt early on was to make the change from BDE to native components as soon
as possible, however if this isn't practical yet then you could write a
couple of wrapper functions like (not tested):
procedure TDataModule.StartTran();
begin
if (not DatabaseGeneral.InTransaction) then
DatabaseGeneral.StartTransaction();
end;
procedure TDataModule.Commit();
begin
if (DatabaseGeneral.InTransaction) then
DatabaseGeneral.Commit();
end;
procedure TDataModule.Rollback();
begin
if (DatabaseGeneral.InTransaction) then
DatabaseGeneral.Rollback();
end;
Now whenever you want to start a transaction simple call the wrapper
functions above instead of on the db its self. BUT I would *strongly*
recommend you change to IBO or even use TIB* components that come with
Delphi if you don't want to purchase any third party controls, as you will
see a significant improvement in speed/reliability.
Rgds
Si Carter
TECT Software Ltd
http://www.tectsoft.net/