Subject | Re: InterBase, Dephi, BDE and Transactions |
---|---|
Author | gstv_m |
Post date | 2004-11-16T05:18:10Z |
Helen (and the others who answered this question):
You say in my code I´m doing this:
start transaction
prepare query if not prepared
run query (i.e. call Open)
start another transaction
do some stuff
post changes
.....
I see your
"start another transaction"
is my
"DataBaseGeneral.StartTransaction;"
(after the Open)
But I don´t see where is your first
"start transaction"
in my code.
If I debug and see DataBaseGeneral.InTransaction before the
DataBaseGeneral.StartTransaction, it is False. So, there is no
Transaction started before the "DataBaseGeneral.StartTransaction;"
instruction.
Even in the Help of Delphi, it is explained that I have to do things
the way I´m doing. That´s why I don´t understand the mistake.
¿When does the first transaction you mention starts?
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
You say in my code I´m doing this:
start transaction
prepare query if not prepared
run query (i.e. call Open)
start another transaction
do some stuff
post changes
.....
I see your
"start another transaction"
is my
"DataBaseGeneral.StartTransaction;"
(after the Open)
But I don´t see where is your first
"start transaction"
in my code.
If I debug and see DataBaseGeneral.InTransaction before the
DataBaseGeneral.StartTransaction, it is False. So, there is no
Transaction started before the "DataBaseGeneral.StartTransaction;"
instruction.
Even in the Help of Delphi, it is explained that I have to do things
the way I´m doing. That´s why I don´t understand the mistake.
¿When does the first transaction you mention starts?
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
> At 07:11 PM 15/11/2004 +0000, you wrote:Delphi
>
> >Hello to everybody!
> >
> > I´m trying to use InterBase (really it´s FireBird) with
> >5 and BDE but I have a problem with Transactions.transactions
> >
> > I want to manage my DataBase editing with explicit
> >(using DataBase.StartTransaction, Commit and RollBack) but I havewrapped
> >conflicts with what I think is an implicit transaction that BDE
> >makes each time I make a Table.Post. In the example code below, I
> >connect to a DataBase, I open a Table, start a transaction, edit a
> >Field, and when I try to Post the record, I get the error "Nested
> >transactions not supported".
>
> Your code:
>
> >var
> > DataBaseGeneral : TDataBase;
> > TablaDeProvincias: TTable;
> >begin
> > DataBaseGeneral:=TDataBase.Create(nil);
> > with DataBaseGeneral do
> > begin
> > DataBaseName:='General';
> > DriverName:='INTRBASE';
> > Params.Values['SERVER NAME']:='General.GDB';
> > Params.Values['USER NAME']:='SYSDBA';
> > Params.Values['PASSWORD']:='masterkey';
> > LoginPrompt:=False;
> > Connected:=True;
> > end;
> >
> > TablaDeProvincias:=TTable.Create(nil);
> > with TablaDeProvincias do
> > begin
> > TableName:='Provinc';
> > IndexFieldNames:='NOMBRE';
> > DataBaseName:=DataBaseGeneral.DataBaseName;
> > Open;
> >
> > DataBaseGeneral.StartTransaction;
> > Edit;
> > TStringField(FieldByName('NOMBRE')).Text:='1'+TStringField
> >(FieldByName('NOMBRE')).Text;
> > Post;
> > DataBaseGeneral.Commit;
> >
> > Close;
> > DataBaseGeneral.Connected:=False;
> > end;
> >end.
>
>
> OK, the cause of this is not understanding that the transaction is
> around the entire operation. The sequence of events is this:SQLPASSTHRU
>
> start transaction
> prepare query if not prepared
> run query (i.e. call Open)
> do some stuff
> post changes
> run query (i.e. call Refresh)
> do some stuff
> post changes
> ...
> ...
> commit or rollback transaction
>
> What you are trying to do is this:
>
> start transaction
> prepare query if not prepared
> run query (i.e. call Open)
> start another transaction
> do some stuff
> post changes
> .....
>
> Hence, the "nested transaction" error.
>
>
> > I tried to change the settings of BDE with the BDE
> >Administrator but I couldn´t make it work. I tried with
> >MODE = SHARED NOAUTOCOMMIT or SHARED AUTOCOMMIT or NOT SHARED, Ican't
> >connected to the DataBase using an Alias or not using an Alias, I
> >tried with SQLQRYMODE null or SERVER, with COMMIT RETAIN FALSE or
> >TRUE, etc. None of this worked!!!
>
> Nothing like this will work to make the database do something it
> do. In Firebird and InterBase, you can't start anothertransaction inside
> a transaction.are using:
>
>
> > Does anybody knows what can I do with this?
>
> Well, here are some more problems you have with the BDE that you
>higher
> 1. Delphi 5's BDE driver for InterBase doesn't support ODS 10 or
> databases. It is for InterBase 5 (ODS 9) and below.ODS 10
>
> 2. Delphi 6 shipped with BDE v.5.2, which does have a driver for
> databases. However, the driver is buggy and crags on some of thedata
> types it is meant to support. (At Delphi 6, Borland replaced theBDE with
> its new DB Express driver layers for client/server databases). Youhave to
> buy Delphi 6 to get your hands on the driver -- for a while, youcould buy
> BDE 5.2 from the Borland shop, but it has been off the listingsnow for
> about three years.problem). To
>
> 3. In the BDE, you can't have multiple concurrent transactions per
> connection in any form (though this isn't the cause of your
> get some form of explicit control over transaction aging, you canset
> COMMIT RETAIN to false in the driver settings. However, the onlyupdates.
> workaround to the default autocommit behaviour is to use cached
>for
> In short, as David said, the BDE is dead. To write Delphi apps
> Firebird, you need to use something else for connectivity - IBX(if you
> want to take the risk of incompatibility), IB Objects, FIBPlus,UIB. Your
> choices will be somewhat limited by using such an old Delphi. IBObjects
> supports Delphi 5 but I don't know with any certainty about therest...you
> can explore some of the possibilities by going to this link page:
>
> http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_dev_comps
>
> ./heLen