Subject RE: [IBO] [Jason] Fail to prepare sentence in all my queries after update to IBO 4.9.14
Author Support List
> I know why.
>
> I need to put a TIB_Transaction(FB_SERVER_TRANS) in my form and associate
> with this script and fb_server connection:
>
> MyScript.IB_Transaction:=FormMAIN.FB_SERVER.DefaultTransaction;
>
> and after execute include :
>
> FB_SERVER_TRANS.CommitRetaining;
>
> as :
> MyScript:=TIB_Script.Create(Self);
> MyScript.IB_Connection:=FB_SERVER.IB_Connection;
> MyScript.IB_Transaction:=FB_SERVER.DefaultTransaction; <---
> MyScript.SQL.Clear;
> MyScript.SQL.Add('CREATE USER DELMICE PASSWORD ''delmice'';');
> MyScript.SQL.Add('CREATE USER EDERSON PASSWORD ''ederson'';');
> MyScript.SQL.Add('CREATE USER EDNA PASSWORD ''edna'';');
> MyScript.SQL.Add('CREATE USER ELAINE PASSWORD ''elaine'';');
> MyScript.SQL.Add('CREATE USER ELIANA PASSWORD ''eliana'';');
> MyScript.SQL.Add('CREATE USER ERIKA PASSWORD ''erika'';');
> MyScript.SQL.Add('CREATE USER FABIO PASSWORD ''fabio'';');
> MyScript.SQL.Add('CREATE USER FERREIRA PASSWORD ''ferreira'';');
> try
> MyScript.Execute;
> FB_SERVER_TRANS.CommitRetaining; <---
> except
> on e:exception do
> begin
> ErrorLog('Erro ao criar/remover logins físicos
> :',e.message,MyScript.SQL.Text);
> end;
> end;
>
> Without this modification only fist line are executed.
>
> In previous version of IBO these modifications are do not necessary becase
> a
> default transaction will be created.
>
> 2011/9/1 hamacker <sirhamacker@...>
>
> > Unfortunately, as same problem with or without ';'.
> >
> > But I discover a new bug :
> >
> > MyScript:=TIB_Script.Create(Self);
> > MyScript.IB_Connection:=FB_SERVER.IB_Connection;
> > MyScript.SQL.Clear;
> > MyScript.SQL.Add('CREATE USER DELMICE PASSWORD ''delmice'';');
> > MyScript.SQL.Add('CREATE USER EDERSON PASSWORD ''ederson'';');
> > MyScript.SQL.Add('CREATE USER EDNA PASSWORD ''edna'';');
> > MyScript.SQL.Add('CREATE USER ELAINE PASSWORD ''elaine'';');
> > MyScript.SQL.Add('CREATE USER ELIANA PASSWORD ''eliana'';');
> > MyScript.SQL.Add('CREATE USER ERIKA PASSWORD ''erika'';');
> > MyScript.SQL.Add('CREATE USER FABIO PASSWORD ''fabio'';');
> > MyScript.SQL.Add('CREATE USER FERREIRA PASSWORD ''ferreira'';');
> > try
> > MyScript.Execute;
> > except
> > on e:exception do
> > begin
> > ErrorLog('Erro ao criar/remover logins físicos
> > :',e.message,MyScript.SQL.Text);
> > end;
> > end;
> >
> > No error, but only first user is created, ie. only first line are
> executed
> > and all others ignored.
> > I try copy/paste into IBExpert and run fine.
> > I test with GRANT with many lines and all lines are executed, very
> > strange, apparently when CREATE USER statment is used only first line
> will
> > be executed.
> > Why ?

This seems very odd to me. Will you send me a sample app demonstrating this
problem?

IBO should use the connections DefaultTransaction or provide an internal
transaction that does an auto commit if you do not assign a transaction
explicitly.

Thanks,
Jason LeRoy Wharton