Subject Re: [firebird-support] Re: InterBase, Dephi, BDE and Transactions
Author Fernando Buitrago
Wel, I do not why you-r using the BDE.......don't you want to use the
direct connection using IBX?

In this case, all is so easy.

Regards

Fernando



On Wed, 17 Nov 2004 16:14:03 -0300, Gustavo <gusm@...> wrote:
>
> InterBase, Delphi5, BDE and Transactions
>
> Hello to everybody!
>
> I´m still trying to use InterBase (really it´s FireBird) with Delphi 5 and BDE but I still have a problem with Transactions.
>
> I really thanks to every one who suggested me things but unfortunately nothing worked.
>
> I tried starting a transaction with another Session 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).
>
> I tried using CachedUpdates but unfortunately, even in this case, the BDE makes an internal transaction and the problem is the same. I write here my code in case anybody knows I´m doing something wrong.
>
> unit Unit1;
>
> interface
>
> uses
> DB,
> DBTables,
>
> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
>
> type
> TForm1 = class(TForm)
> private
> { Private declarations }
> public
> { Public declarations }
> end;
>
> var
> Form1: TForm1;
>
> implementation
>
> {$R *.DFM}
>
> var
> DataBaseGeneral : TDataBase;
> TablaDeProvincias: TTable;
> begin
> DataBaseGeneral:=TDataBase.Create(nil);
> with DataBaseGeneral do
> begin
> DataBaseName:='General';
> { DriverName:='INTRBASE';}
> AliasName:='MMGeneral';
> { Params.Values['SERVER NAME']:='C:\EGMM\GesCom\General\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;
> CachedUpdates:=True;
> Open;
>
> { DataBaseGeneral.StartTransaction;}
> Edit;
> TStringField(FieldByName('NOMBRE')).Text:='1'+TStringField(FieldByName('NOMBRE')).Text;
> Post;
> { DataBaseGeneral.RollBack;}
>
> DataBaseGeneral.ApplyUpdates([TablaDeProvincias]);
> Close;
> DataBaseGeneral.Connected:=False;
> end;
> end.
>
> At the line "DataBaseGeneral.ApplyUpdates([TablaDeProvincias]);" I get the error message "Nested transactions not supported".
>
> I had another idea: starting a transaction directly with an SQL instruction. But I couldn´t do it. My code is:
>
> DataBaseGeneral:=TDataBase.Create(nil);
> with DataBaseGeneral do
> begin
> DataBaseName:='General';
> { DriverName:='INTRBASE';}
> AliasName:='MMGeneral';
> { Params.Values['SERVER NAME']:='C:\EGMM\GesCom\General\General.GDB';}
> Params.Values['USER NAME']:='SYSDBA';
> Params.Values['PASSWORD']:='masterkey';
> LoginPrompt:=False;
> Connected:=True;
> end;
>
> with TQuery.Create(nil) do
> begin
> DataBaseName:=DataBaseGeneral.DataBaseName;
> SQL.Clear;
> { SQL.Add('SET TRANSACTION TransactionMM'+SinEspacios(SinAcentos(NombreDelSistema))+SinEspacios(SinAcentos(NombreDeLaComputadora)));
> SQL.Add('NO WAIT ISOLATION LEVEL READ COMMITED NO RECORD_VERSION');}
> { SQL.Add('SET TRANSACTION NO WAIT ISOLATION LEVEL READ COMMITTED NO RECORD_VERSION');}
> SQL.Add('SET TRANSACTION');
> ExecSQL;
> Free;
> end;
>
> At the instruction "ExecSQL" I get an error message "General SQL Error. invalid transaction handle (expecting explicit transaction start)". Can anybody tell me what´s wrong in what I´m doing?
>
> Gustavo
> gusm@...
>
> [Non-text portions of this message have been removed]
>
>
>
> Yahoo! Groups Links
>
>
>
>
>