Changeset 88 for trunk


Ignore:
Timestamp:
Aug 8, 2016, 2:38:37 PM (8 years ago)
Author:
chronos
Message:
  • Fixed: Merge categories to new items also for MS Access source import.
  • Fixed: Trim name and meaning imported from MS Access.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/AcronymDecoder.lpi

    r86 r88  
    338338        <IsPartOfProject Value="True"/>
    339339        <ComponentName Value="Core"/>
     340        <HasResources Value="True"/>
    340341        <ResourceBaseClass Value="DataModule"/>
    341342      </Unit15>
  • trunk/UAcronym.pas

    r73 r88  
    298298  SQLQuery1: TSQLQuery;
    299299  NewAcronym: TAcronymEntry;
     300  J: Integer;
     301  AddedAcronym: TAcronymMeaning;
    300302begin
    301303  ItemCount := 0;
     
    323325    NewAcronym := TAcronymEntry.Create;
    324326    while not SQLQuery1.EOF do begin
    325       NewAcronym.Name := SQLQuery1.FieldByName('Acronym').AsString;
    326       NewAcronym.Meaning := SQLQuery1.FieldByName('Meaning').AsString;
    327       if (NewAcronym.Name <> '') and (NewAcronym.Meaning <> '') then
    328         Sources.AcronymDb.AddAcronym(NewAcronym.Name, NewAcronym.Meaning);
     327      NewAcronym.Name := Trim(SQLQuery1.FieldByName('Acronym').AsString);
     328      NewAcronym.Meaning := Trim(SQLQuery1.FieldByName('Meaning').AsString);
     329      if (NewAcronym.Name <> '') and (NewAcronym.Meaning <> '') then begin
     330        AddedAcronym := Sources.AcronymDb.AddAcronym(NewAcronym.Name, NewAcronym.Meaning);
     331
     332        // Merge categories
     333        for J := 0 to Categories.Count - 1 do
     334          if AddedAcronym.Categories.IndexOf(Categories[J]) = -1 then begin
     335            AddedAcronym.Categories.Add(Categories[J]);
     336            TAcronymCategory(Categories[J]).AcronymMeanings.Add(AddedAcronym);
     337          end;
     338      end;
    329339      SQLQuery1.Next;
    330340      Inc(ItemCount);
Note: See TracChangeset for help on using the changeset viewer.