Hello, forum.
I created an SQLite table which declared by "ON CONFLICT IGNORE".
When the table was conflicted, the row cannot be inserted.
From an Aurelius standpoint, the situation will raise an EIdNotSetException and the instance cannot regist to a manager. To avoid the other instance cannot be inserted, I wrapped try ~ except syntax like this:
for i := 0 to ABuf.Count -1 do
begin
LItem := TDBItem.Create;
try
// assign values for LItem
Mng.Save(LItem);
except on E: Exception do
if E is EIdNotSetException then
begin
if not Mng.IsAttached(LA1c) then
FreeAndNil(LA1c);
end
else
raise;
end;
end;
My question is, is there be a better solution or any recommendation for this situation?
Thank you.