Changeset 138 for trunk/Packages/CoolWeb/Persistence
- Timestamp:
- Sep 9, 2022, 8:20:25 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CoolWeb/Persistence/USqlDatabase.pas
r137 r138 6 6 7 7 uses 8 SysUtils, Classes, Dialogs, mysql50, TypInfo, SpecializedDictionary, 9 SpecializedList; 8 SysUtils, Classes, Dialogs, mysql50, TypInfo, UGenerics, Generics.Collections; 10 9 11 10 type … … 21 20 TLogEvent = procedure(Sender: TObject; Text: string) of object; 22 21 23 TDbRows = class(TList Object)22 TDbRows = class(TList<TDictionaryStringString>) 24 23 private 25 24 function GetData(Index: Integer): TDictionaryStringString; … … 155 154 TimeParts := TListString.Create; 156 155 157 Parts.Explode( Value, ' ', StrToStr);158 DateParts.Explode( Parts[0], '-', StrToStr);156 Parts.Explode(' ', Value); 157 DateParts.Explode('-', Parts[0]); 159 158 Result := EncodeDate(StrToInt(DateParts[0]), StrToInt(DateParts[1]), 160 159 StrToInt(DateParts[2])); 161 160 if Parts.Count > 1 then begin 162 TimeParts.Explode( Parts[1], ':', StrToStr);161 TimeParts.Explode(':', Parts[1]); 163 162 Result := Result + EncodeTime(StrToInt(TimeParts[0]), StrToInt(TimeParts[1]), 164 163 StrToInt(TimeParts[2]), 0); … … 210 209 Value: string; 211 210 DbResult: TDbRows; 211 Item: TPair<string, string>; 212 212 begin 213 213 LastUsedTable := ATable; 214 214 DbNames := ''; 215 215 DbValues := ''; 216 for I := 0 to Data.Count - 1do begin217 Value := Data.Items[I].Value;216 for Item in Data do begin 217 Value := Item.Value; 218 218 StringReplace(Value, '"', '\"', [rfReplaceAll]); 219 219 if Value = 'NOW()' then DbValues := DbValues + ',' + Value 220 220 else DbValues := DbValues + ',"' + Value + '"'; 221 DbNames := DbNames + ',`' + Data.Keys[I]+ '`';221 DbNames := DbNames + ',`' + Item.Key + '`'; 222 222 end; 223 223 System.Delete(DbNames, 1, 1); … … 274 274 I: Integer; 275 275 DbResult: TDbRows; 276 Item: TPair<string, string>; 276 277 begin 277 278 LastUsedTable := ATable; 278 279 DbNames := ''; 279 280 DbValues := ''; 280 for I := 0 to Data.Count - 1do begin281 Value := Data.Items[I].Value;281 for Item in Data do begin 282 Value := Item.Value; 282 283 StringReplace(Value, '"', '\"', [rfReplaceAll]); 283 284 if Value = 'NOW()' then DbValues := DbValues + ',' + Value 284 285 else DbValues := DbValues + ',"' + Value + '"'; 285 DbNames := DbNames + ',`' + Data.Keys[I]+ '`';286 DbNames := DbNames + ',`' + Item.Key + '`'; 286 287 end; 287 288 System.Delete(DbNames, 1, 1); … … 314 315 I: Integer; 315 316 DbResult: TDbRows; 317 Item: TPair<string, string>; 316 318 begin 317 319 LastUsedTable := ATable; 318 320 DbValues := ''; 319 for I := 0 to Data.Count - 1do begin320 Value := Data.Items[I].Value;321 for Item in Data do begin 322 Value := Item.Value; 321 323 StringReplace(Value, '"', '\"', [rfReplaceAll]); 322 324 if Value = 'NOW()' then DbValues := DbValues + ',' + Value 323 else DbValues := DbValues + ',`' + Data.Keys[I]+ '` =' + '"' + Value + '"';325 else DbValues := DbValues + ',`' + Item.Key + '` =' + '"' + Value + '"'; 324 326 end; 325 327 System.Delete(DbValues, 1, 1);
Note:
See TracChangeset
for help on using the changeset viewer.