Icon View Incident Report

Serious Serious
Reported By: David Martin
Reported On: 2/15/2001
For: Version 2.06 Build 1
# 719 Locate Method of TDBISAMTable Not Working Properly After Record is Just Added

Using 2.06 and D5. A field NAME is stored in upper case. If the table has a secondary index on NAME that is case-sensitive, then the following occurs:

Table.Locate('NAME','DUPLICATE',[]) incorrectly returns False whereas
Table.Locate('NAME','DUPLICATE',[loCaseInsensitive]) correctly returns True.

Similarly, if the secondary index on NAME is case-insentive then

Table.Locate('NAME','DUPLICATE',[]) correctly returns Trues whereas
Table.Locate('NAME','DUPLICATE',[loCaseInsensitive]) incorrectly returns False.

If case-sensitivity mattered, these results are opposite to what I would expect. Regardless, since NAME is in upper case, all the above should return True.

procedure TForm1.Button1Click(Sender: TObject);
var
   SDrugName: string;
begin
   DestTable.Open;
   DestTable.EmptyTable;

   SourceTable.Open;
   SourceTable.First;
   while not SourceTable.EOF do begin
      { Get drug name }
      SDrugName:=SourceTable.FieldByName('NAME').AsString;

      { Add drug to destination table; use Locate to prevent duplicate 
entries }
      if not DestTable.Locate('NAME',SDrugName,[]) then begin
         // If TestLocateDest.DAT has a secondary index (NameIdx) on the NAME 
field
         // that is case-sensitive, then Locate incorrectly returns False here.

         // If TestLocateDest.DAT has a secondary index (NameIdx) on the NAME 
field
         // that is case-insensitive, then Locate correctly returns True here.
         // (I used the dbsys restructure utility to toggle the 
case-sensitivity
         // of the NAME index.)
         DestTable.Append;
         DestTable.FieldByName('LISTING_SEQ_NO').AsString:=
            SourceTable.FieldByName('LISTING_SEQ_NO').AsString;
         DestTable.FieldByName('NAME').AsString:=SDrugName;
         DestTable.Post;
      end;

      SourceTable.Next;
   end;

   SourceTable.First;
   DestTable.First;
end;



Resolution Resolution
Fixed Problem on 2/16/2001 in version 2.07 build 1
Image