Halcyon Hangs if Duplicate Field Names

Posted by Alexander Buzaev on  2003-02-28 10:30:00

If there are duplicate field names in the DBF, Halcyon will hang in an infinite loop when opening the file. Although this duplicate name condition should not occur, Microsoft Excel will make this mistake when creating a DBF file from a spreadsheet.


status: CLOSED    Urgency: MEDIUM    As Of: 2003-02-28 10:30:00

Comment:

You can make the following change in gs6_sql.pas in the TgsFieldVarReg.RegisterFieldVar method.  It requires moving the order of two lines:

function TgsFieldVarReg.RegisterFieldVar(AFieldVar: TgsUserDefFieldVar): boolean;
var
   i: integer;
   s: gsUTFString;
   s1: gsUTFString;
begin
   Result := true;
   s := AnsiUpperCase(AFieldVar.FieldVarList);
   while Length(s) > 0 do
   begin
      i := pos(';',s);
      if i = 0 then i := Length(s)+1;
      try
         s1 := copy(s,1,i-1);
-->         system.delete(s,1,i);
-->         AddObject(s1,AFieldVar);
         AFieldVar.Reference := AFieldVar.Reference+1;
      except
         Result := false;
      end;
   end;
end;