Subject Re: [IBO] FieldByName, ParamByName, Performance ???
Author Luiz Alves
Lets upon that:

"tn" is the transaction to ibDSQL
var ib_col1,ib_col2, ... ib_coln:Tib_Column;

tn.BeginBusy(False);
ib_col1:= ibDSQL.ParamByName('col1');
ib_col2:= ibDSQL.ParamByName('col2');
....
....
ib_coln:= ibDSQL.ParamByName('coln');

ibDSQL.Prepare;
while not MemTable.EOF do
begin
ib_col1.AsString := MemTableCol1.AsString;
...
ib_col10.AsFloat:= MemTableCol1.AsFloat;
{Execute}
ibDSQL.Execute;
MemTable.Next;
end;
tn.EndBusy;
try
tn.Commit;
except
RollBack;
end;

Luiz


----- Original Message -----
From: <rj@...>
To: <IBObjects@yahoogroups.com>
Sent: Monday, March 05, 2001 3:53 PM
Subject: [IBO] FieldByName, ParamByName, Performance ???


> Hi,
>
> i am new to IBO and porting an existing
> and i have got slight performance problems
> using TIB_DSQL and ParamByName and
> TIB_Cursor FieldByName
>
> using ParamByName my application is about five times
> slower as if i use Params[idx].
>
> the (pseudo) code i am using:
>
> ibDSQL := TIB_DSQL.Create(self);
> ibDSQL.IB_Connection := Connection;
> ibDSQL.BeginBusy(true);
> MemTable.DisableControls;
> MemTable.First;
> ibDSQL.SQL.Add('insert into tablename ( col1, col2, col3, ...,
> col10)');
> ibDSQL.SQL.Add('values (:col1, :col2, ..., :col10)');
> ibDSQL.Prepare;
> while not MemTable.EOF do
> begin
> ibDSQL.ParamByName('col1').AsString := MemTableCol1.AsString;
> ...
> ibDSQL.ParamByName('col10').AsFloat:= MemTableCol1.AsFloat;
> MemTable.Next;
> end;
> ibDSQL.BeginBusy(true);
> MemTable.GotoBookmark(bm);
> MemTable.EnableControls;
>
> the alternative would be:
>
> ibDSQL.Params[0].AsString := MemTableCol1.AsString;
> ...
> ibDSQL.Params[9].AsFloat := MemTableCol1.AsFloat;
>
>
> i observe a similar behaviour with TIB_Cursor, TIB_Query and
> FieldByName. I am a bit suspicious, that I misuse the IBO-Library
> since the corresponding Method (TIB_Row.GetByName) does not look
> slow and there is nearly no difference in Runtime between
> ParamByName and Params[idx] in IBX. By the way: IBO and Params[idx]
> is faster :)
>
> any tips ?
>
> Thanks a lot ...
>
> Ralph
>
>
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>