in your History you write that Thread behavior is improved.
So I used Verson 3.04 til yesterday, now I have installed v4.01.
In a Thread I create a LiteSQL:
Code: Select all
ProtInsertSQL := TLiteSQL.Create(nil);
ProtInsertSQL.Connection := DBM.SQLKasse;
ProtInsertSQL.SQL.Clear;
ProtInsertSQL.SQL.Add('INSERT INTO KaArtikelProtokoll');
ProtInsertSQL.SQL.Add('(Zeit,Barcode,PreisVKAlt,PreisVKNeu,Kennzeichen)');
ProtInsertSQL.SQL.Add('VALUES');
ProtInsertSQL.SQL.Add('(:Zeit,:Barcode,:PreisVKAlt,:PreisVKNeu,:Kennzeichen)');
ProtInsertSQL.Params[0].DataType := ftDateTime;
ProtInsertSQL.Params[1].DataType := ftString;
ProtInsertSQL.Params[2].DataType := ftCurrency;
ProtInsertSQL.Params[3].DataType := ftCurrency;
ProtInsertSQL.Params[4].DataType := ftString;
ProtInsertSQL.Params.ValueCount := 1;
I Fill the Values of the LiteSQL:
Code: Select all
i := ProtInsertSQL.Params.ValueCount - 1;
ProtInsertSQL.Params[0][i].AsDateTime := Zeit;
ProtInsertSQL.Params[1][i].AsString := Barcode;
ProtInsertSQL.Params[2][i].AsCurrency := oldPreis;
ProtInsertSQL.Params[3][i].AsCurrency := newPreis;
ProtInsertSQL.Params[4][i].AsString := Kennzeichen;
ProtInsertSQL.Params.ValueCount := ProtInsertSQL.Params.ValueCount + 1;
Code: Select all
ProtInsertSQL.Execute(ProtInsertSQL.Params.ValueCount - 1);
Because you changed the bahavior in threads can you tell me what I have to Change now to get this work again.
Because the Connection is in exclusive mode (see below), I think I can not create a seperate Connection within the thread.
Also I thought about a synchronize for execute.
The Connection is set like this:
Code: Select all
procedure TDBM.SQLKasseBeforeConnect(Sender: TObject);
begin
SQLKasse.LoginPrompt := False;
SQLKasse.Database := 'xy.db3';
SQLKasse.EncryptionKey := '***';
SQLKasse.Options.EncryptionAlgorithm := TLiteEncryptionAlgorithm.leBlowfish;
SQLKasse.Options.Direct := True;
SQLKasse.Options.UseUnicode := True;
end;
Code: Select all
procedure TDBM.SQLKasseAfterConnect(Sender: TObject);
begin
SQLKasse.ExecSQL('PRAGMA page_size=4096');
SQLKasse.ExecSQL('vacuum');
SQLKasse.ExecSQL('PRAGMA journal_mode=WAL');
SQLKasse.ExecSQL('PRAGMA locking_mode = EXCLUSIVE');
SQLKasse.ExecSQL('BEGIN EXCLUSIVE');
SQLKasse.ExecSQL('COMMIT');
SQLKasse.ExecSQL('PRAGMA cell_size_check = TRUE');