PetrHL,
i've commited the CAPI prepared statement for SQLite today. Rev 2012 /testing (SVN).
Actually this statement is not default but you can get access by using TZQuery.Options [doPreperePrepared] = True. Then Zeos switches to this statment.
Currently i had not the time for an own test case. Did you chage the TZConnection.TransactionIsolationLevel to tiReadCommited and then TZConnection.StartTransaction? IMHO this should work. ((:
Edit: I did my testcaase:
Code: Select all
NowTime := now;
ZQuery1.SQL.Text := 'INSERT INTO people(P_ID, P_NAME, P_BEGIN_WORK, P_END_WORK) values (:P_ID, :P_NAME, :P_BEGIN_WORK, :P_END_WORK)';
for i := 100 to 1000 do
begin
ZQuery1.Params[0].AsInteger := i;
ZQuery1.Params[1].AsString := 'human'+IntToStr(i);
ZQuery1.Params[2].AsDateTime := NowTime;
ZQuery1.Params[3].AsDateTime := now;
ZQuery1.ExecSQL;
end;
This one with TransactionIsolationLevel = tiNone needs over two miniutes for the 900 records.
Code: Select all
NowTime := now;
ZConUnicode.Connected := False;
ZConUnicode.TransactIsolationLevel := tiReadCommitted;
ZConUnicode.Connected := True;
ZConUnicode.StartTransaction;
ZQuery1.Options := ZQueryUnicode.Options + [doPreferPrepared];
ZQuery1.SQL.Text := 'INSERT INTO people(P_ID, P_NAME, P_BEGIN_WORK, P_END_WORK) values (:P_ID, :P_NAME, :P_BEGIN_WORK, :P_END_WORK)';
for i := 100001 to 200000 do
begin
ZQuery1.Params[0].AsInteger := i;
ZQuery1.Params[1].AsString := 'human'+IntToStr(i);
ZQuery1.Params[2].AsDateTime := NowTime;
ZQuery1.Params[3].AsDateTime := now;
ZQuery1.ExecSQL;
end;
ZConUnicode.Commit;
This one with TransactionIsolationLevel = tiReadCommited + CAPI statment needs 2 seconds for 99999 rows.
Code: Select all
NowTime := now;
ZConUnicode.StartTransaction;
ZQuery1.Options := [];
ZQuery1.SQL.Text := 'INSERT INTO people(P_ID, P_NAME, P_BEGIN_WORK, P_END_WORK) values (:P_ID, :P_NAME, :P_BEGIN_WORK, :P_END_WORK)';
for i := 200001 to 300000 do
begin
ZQuery1.Params[0].AsInteger := i;
ZQuery1.Params[1].AsString := 'human'+IntToStr(i);
ZQuery1.Params[2].AsDateTime := NowTime;
ZQuery1.Params[3].AsDateTime := now;
ZQuery1.ExecSQL;
end;
ZConUnicode.Commit;
This one with TransactionIsolationLevel = tiReadCommited without CAPI statment needs 4 seconds for 99999 rows.
So it's just a question how you use Zeos IMHO...