Page 1 of 1

UniDac 4.5.10 Sqlite Update statement is slowly

Posted: Thu 06 Dec 2012 15:13
by hq200306
//set UniConnection.options
direct=true
Encryptionkey=abc
EncryptionAlgorithm=leAES128

//create Test table
create table if not exists t1(
f1 number(9) not null,
f2 varchar2(20),
f3 varchar2(20),
f4 varchar2(20),
f5 varchar2(20),
f6 varchar2(20),
primary key(f1)
);

//insert some rows
try
UniConnection1.StartTransaction;
UniQuery2.sql.Clear;
UniQuery2.sql.Add('delete from t1');
UniQuery2.ExecSQL;

UniQuery2.sql.Clear;
UniQuery2.sql.Add('insert into t1');
UniQuery2.sql.Add('(f1,f2,f3)');
UniQuery2.sql.Add('values(:f1,:f2,:f3)');

d1 := now;
for i := 0 to 10000 do
begin
UniQuery2.ParamByName('f1').AsInteger := i;
UniQuery2.ParamByName('f2').AsString := 'f' + IntToStr(i);
UniQuery2.ParamByName('f3').AsString := 'v' + IntToStr(i);
UniQuery2.Execute;
end;
UniConnection1.Commit;
//
d2 := now;
Caption := FormatDateTime('ss.zzz', d2 - d1);
except
UniConnection1.Rollback;
end;

//Test SQL update time
d1 := now;
UniSQL1.sql.Clear;
UniSQL1.sql.Add('update t1');
UniSQL1.sql.Add('set f2=:f2');
UniSQL1.sql.Add(',f3=:f3');
UniSQL1.sql.Add('where f1=:f1');

try
UniConnection1.StartTransaction;
for i := 0 to 10000 do
begin
UniSQL1.ParamByName('f1').AsInteger := i;
UniSQL1.ParamByName('f2').AsString := 'f_' + IntToStr(i);
UniSQL1.ParamByName('f3').AsString := 'f_' + IntToStr(i);
UniSQL1.Execute;
end;
UniConnection1.Commit;
except
on e: Exception do
begin
UniConnection1.Rollback;
end;
end;
d2 := now;
Caption := FormatDateTime('ss.zzz', d2 - d1);


//
In My Pc
When direct=true, It takes 6.1 seconds
When direct=true,EncryptionAlgorithm=leDefault, It takes 0.85 seconds
When direct=false,It takes 0.86 seconds

Re: UniDac 4.5.10 Sqlite Update statement is slowly

Posted: Fri 07 Dec 2012 11:22
by AlexP
Hello,

Thank you for the information.
We've reproduced the problem.
We will notify you as soon as we have any results.