Icon View Incident Report

Serious Serious
Reported By: Omer Uzuner
Reported On: 12/28/2013
For: Version 2.14 Build 5
# 3960 Cached Updates Not Applying Properly When First Index is not Primary Key System Index

I'm getting "Dublicate Error" on ApplyCachedUpdates because of unique field but there is no duplicate data before ApplyCachedUpdates and I'm clearing table datas before append records.

Before running this code; there is one record in table which has have 1A6F-AFEF-48EF-AEED but I delete this record in code and after I re append and error become.

RouterStrList.Text := 'Main Router ¨ 318C-954F-FF6F-B295 ¨ 78.46.163.220 ¨ 443 ¨ 1' + #13#10
                      'Test Router ¨ 1A6F-AFEF-48EF-AEED ¨ 192.168.2.54 ¨ 443 ¨ 2';
 Try
 
   if (tbRouters.Active = False) then tbRouters.Active := True else tbRouters.Refresh;
   tbRouters.BeginCachedUpdates;
   tbRouters.First;
   while not tbRouters.Eof do Table.Delete;
   for I := 0 to RouterStrList.Count - 1 do begin
     TempStr := RouterStrList.Strings[I];
     tbRouters.Append;
     tbRouters.FieldByName('RouterName'  ).AsString := Copy(TempStr,      1, X1      - 1);
     tbRouters.FieldByName('SecurityCode').AsString := Copy(TempStr, X1 + 3, X2 - X1 - 3);
     tbRouters.FieldByName('RouterIP'    ).AsString := Copy(TempStr, X2 + 3, X3 - X2 - 3);
     tbRouters.FieldByName('RouterPort'  ).AsString := Copy(TempStr, X3 + 3, X4 - X3 - 3);
     tbRouters.FieldByName('Index'       ).AsString := Copy(TempStr, X4 + 3, 10);
     tbRouters.Post;
   end;
   tbRouters.ApplyCachedUpdates;
 Except
   On E : Exception do begin
   Application.MessageBox(PChar(E.Message), '');
   if tbRouters.CachingUpdates then tbRouters.CancelCachedUpdates;
   end;
 End;

Error Message
-------------------------------------------
 ElevateDB Error #1305 Error loading the updates for the database ClientDB
(Unknown error occurred with the table Routers (ElevateDB Error #1004 The unique constraint
"idxSecurityCode" for the table Routers has been violated (Duplicate key 1A6F-AFEF-48EF-AEED found)))



Comments Comments
The issue was with ElevateDB not setting the proper index prior to applying the cached updates. Therefore, if the first, or default, index in the table was not the primary key, then the application would experience odd errors.


Resolution Resolution
Fixed Problem on 12/30/2013 in version 2.15 build 1


Products Affected Products Affected
ElevateDB LCL Standard with Source
ElevateDB VCL Client-Server
ElevateDB VCL Client-Server with Source
ElevateDB VCL Standard
ElevateDB VCL Standard with Source
ElevateDB VCL Trial

Image