Ignore:
Timestamp:
Sep 9, 2022, 8:20:25 PM (21 months ago)
Author:
chronos
Message:
  • Modified: Removed TemplateGenerics package. Generics usage replaced by standard Generics.Collections.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/CoolWeb/Persistence/USqlDatabase.pas

    r137 r138  
    66
    77uses
    8   SysUtils, Classes, Dialogs, mysql50, TypInfo, SpecializedDictionary,
    9   SpecializedList;
     8  SysUtils, Classes, Dialogs, mysql50, TypInfo, UGenerics, Generics.Collections;
    109
    1110type
     
    2120  TLogEvent = procedure(Sender: TObject; Text: string) of object;
    2221
    23   TDbRows = class(TListObject)
     22  TDbRows = class(TList<TDictionaryStringString>)
    2423  private
    2524    function GetData(Index: Integer): TDictionaryStringString;
     
    155154    TimeParts := TListString.Create;
    156155
    157     Parts.Explode(Value, ' ', StrToStr);
    158     DateParts.Explode(Parts[0], '-', StrToStr);
     156    Parts.Explode(' ', Value);
     157    DateParts.Explode('-', Parts[0]);
    159158    Result := EncodeDate(StrToInt(DateParts[0]), StrToInt(DateParts[1]),
    160159      StrToInt(DateParts[2]));
    161160    if Parts.Count > 1 then begin
    162       TimeParts.Explode(Parts[1], ':', StrToStr);
     161      TimeParts.Explode(':', Parts[1]);
    163162      Result := Result + EncodeTime(StrToInt(TimeParts[0]), StrToInt(TimeParts[1]),
    164163        StrToInt(TimeParts[2]), 0);
     
    210209  Value: string;
    211210  DbResult: TDbRows;
     211  Item: TPair<string, string>;
    212212begin
    213213  LastUsedTable := ATable;
    214214  DbNames := '';
    215215  DbValues := '';
    216   for I := 0 to Data.Count - 1 do begin
    217     Value := Data.Items[I].Value;
     216  for Item in Data do begin
     217    Value := Item.Value;
    218218    StringReplace(Value, '"', '\"', [rfReplaceAll]);
    219219    if Value = 'NOW()' then DbValues := DbValues + ',' + Value
    220220    else DbValues := DbValues + ',"' + Value + '"';
    221     DbNames := DbNames + ',`' + Data.Keys[I] + '`';
     221    DbNames := DbNames + ',`' + Item.Key + '`';
    222222  end;
    223223  System.Delete(DbNames, 1, 1);
     
    274274  I: Integer;
    275275  DbResult: TDbRows;
     276  Item: TPair<string, string>;
    276277begin
    277278  LastUsedTable := ATable;
    278279  DbNames := '';
    279280  DbValues := '';
    280   for I := 0 to Data.Count - 1 do begin
    281     Value := Data.Items[I].Value;
     281  for Item in Data do begin
     282    Value := Item.Value;
    282283    StringReplace(Value, '"', '\"', [rfReplaceAll]);
    283284    if Value = 'NOW()' then DbValues := DbValues + ',' + Value
    284285    else DbValues := DbValues + ',"' + Value + '"';
    285     DbNames := DbNames + ',`' + Data.Keys[I] + '`';
     286    DbNames := DbNames + ',`' + Item.Key + '`';
    286287  end;
    287288  System.Delete(DbNames, 1, 1);
     
    314315  I: Integer;
    315316  DbResult: TDbRows;
     317  Item: TPair<string, string>;
    316318begin
    317319  LastUsedTable := ATable;
    318320  DbValues := '';
    319   for I := 0 to Data.Count - 1 do begin
    320     Value := Data.Items[I].Value;
     321  for Item in Data do begin
     322    Value := Item.Value;
    321323    StringReplace(Value, '"', '\"', [rfReplaceAll]);
    322324    if Value = 'NOW()' then DbValues := DbValues + ',' + Value
    323     else DbValues := DbValues + ',`' + Data.Keys[I] + '` =' + '"' + Value + '"';
     325    else DbValues := DbValues + ',`' + Item.Key + '` =' + '"' + Value + '"';
    324326  end;
    325327  System.Delete(DbValues, 1, 1);
Note: See TracChangeset for help on using the changeset viewer.