Subject Re: [IBO] Insert problem...
Author Luiz Alves
Fabio,

> I am initiating to use interbase and ibobjects, and necessary of aid with
problems with inserts, I have a routine that reads the records, treats and
save in another archive using paradox, with paradox the performance is very
bigger greater than interbase, I already tried to use cache updates in
query, start transaction, but the performance continues slow, and this
process has that to be twirled daily with more than 100.000 registers...
please they help me...

Try use a tib_cursor to loop into records, use static references to fields,
use BeginBusy/EndBusy and don't use bound controls to datasource of dataset.

Sample:

procedure update_file;
var nc,np,id,k,MAXCLI:Integer;
s:string;
totrep,totcli:Longint;
tb_ativ,tb_nome,tb_ender,tb_bairro,
tb_cidade,tb_est,tb_cep,tb_nasc,tb_sexo,
tb_cor,tb_ecivil,tb_matr,tb_alt,tb_peso,tb_nac,
tb_cargo,tb_telres,tb_teltra,tb_ramtra,
tb_admi,tb_titular,tb_natu,tb_ident,tb_oemis,
tb_nconv,tb_nplano,tb_ident_cp,tb_empresa,
tb_QUEM_ALT,tb_NINDICA,tb_CPF,tb_DATAVAL,tb_OBS,
tb_PRODUTO,tb_DEPENDENTE,tb_DATAPAG,tb_DATACAD:Tib_column;
begin
with cu_clif do begin
if not prepared then prepare;
tb_ativ:=parambyname('ATIVO');
tb_nome:=parambyname('NOME');
tb_ender:= parambyname('ENDER');
tb_bairro:= parambyname('BAIRRO');
tb_cidade:= parambyname('CIDADE');
tb_est:=parambyname('ESTADO');
tb_cep:=parambyname('CEP');
tb_nasc:= parambyname('NASC');
tb_sexo:=parambyname('sexo');
tb_cor:=parambyname('cor');
tb_ecivil:= parambyname('ecivil');
tb_matr:= parambyname('matr');
tb_alt:= parambyname('ALTURA');
tb_peso:= parambyname('PESO');
tb_nac:= parambyname('NAC');
tb_cargo:= parambyname('CARGO');
tb_telres:= parambyname('TELRES');
tb_teltra:= parambyname('TELTRA');
tb_ramtra:= parambyname('RAMTRA');
tb_admi:= parambyname('ADMI');
tb_titular:= parambyname('TITULAR');
tb_natu:= parambyname('NATU');
tb_ident:= parambyname('IDENT');
tb_oemis:= parambyname('OEMIS');
tb_nconv:= parambyname('NCONV');
tb_nplano:= parambyname('NPLANO');
tb_ident_cp:= parambyname('IDENT_CP');
tb_empresa:= parambyname('EMPRESA');
tb_QUEM_ALT:= parambyname('QUEM_ALT');
tb_NINDICA:= parambyname('NINDICA');
tb_CPF:= parambyname('CPF');
tb_DATAVAL:= parambyname('DATAVAL');
tb_PRODUTO:= parambyname('PRODUTO');
tb_DEPENDENTE:= parambyname('DEPENDENTE');
tb_DATAPAG:= parambyname('DATAPAG');
tb_DATACAD:= parambyname('DATACAD');
tb_OBS:=parambyname('OBS');
end;

k:=0;
tcli.open;
clirep.open;
tcli.first;
tn.BeginBusy(True);
while not tcli.eof do begin
with cu_clif do begin
tb_ativ.asString:='T';
tb_nome.asString:=tcliNOME.asString;
tb_ender.asString:=tcliEndereo.asString;
tb_bairro.asString:=tclibairro.asString;
tb_cidade.asString:=tcliCIDADE.asString;
if checa_estado(tcliESTADO.asString) then
tb_est.asString:=tcliESTADO.asString
else tb_est.clear;
tb_cep.asString:=tcliCEP.asString;
tb_nasc.asDatetime:=tcliANIVERSRI.asDatetime;
s:='F';
tb_sexo.asString:=s;
tb_cor.asString:='B';
tb_ecivil.asString:='S';
tb_matr.Clear;
tb_alt.asfloat:=0;
tb_PESO.asfloat:=0;
tb_NAC.asString:='Brasileira';
tb_CARGO.Clear;
tb_TELRES.Clear;
tb_TELTRA.Clear;
tb_RAMTRA.Clear;
tb_ADMI.Clear;
tb_TITULAR.Clear;
tb_NATU.asString:=tcliCIDADE.asString;
tb_IDENT.Clear;
tb_OEMIS.asString:='I.F.P';
{tb_NCONV.asInteger:=1;
tb_NPLANO.asInteger:=0;
tb_IDENT_CP.asInteger:=13;}
tb_NCONV.Clear;
tb_NPLANO.Clear;
tb_IDENT_CP.Clear;
tb_EMPRESA.clear;
tb_QUEM_ALT.Clear;
tb_NINDICA.Clear;
tb_CPF.Clear;
tb_DATAVAL.Clear;
tb_PRODUTO.Clear;
tb_DEPENDENTE.Clear;
tb_DATAPAG.Clear;
tb_DATACAD.asDatetime:=trunc(now);
tb_OBS.Clear;
ExecSql; //I am using a tib_dsql to insert
end;
tcli.next;
inc(k);
if ((k>1000) and ((k mod 1000)=0)) then
tn.commitretaining; //commit each 1000 records
application.processmessages;
end;
try
if tn.started then
tn.commit;
except
raise;
tn.rollback;
end;
tn.EndBusy;
end;


Luiz.