Subject InterBase, Dephi, BDE and Transactions
Author gstv_m
Hello to everybody!

I´m trying to use InterBase (really it´s FireBird) with Delphi
5 and BDE but I have a problem with Transactions.

I want to manage my DataBase editing with explicit transactions
(using DataBase.StartTransaction, Commit and RollBack) but I have
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".

I tried to change the settings of BDE with the BDE
Administrator but I couldn´t make it work. I tried with SQLPASSTHRU
MODE = SHARED NOAUTOCOMMIT or SHARED AUTOCOMMIT or NOT SHARED, I
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!!!

Does anybody knows what can I do with this?

Gustavo
gusm@...


Example code in Delphi 5:


unit Unit1;

interface

uses
DB,
DBTables,

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs;

implementation

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.