Changeset 28 for trunk/UDatabase.pas


Ignore:
Timestamp:
Sep 10, 2022, 10:21:48 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Do not create all application forms at initialization phase but dynamically.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UDatabase.pas

    r26 r28  
    44
    55uses
    6   Classes, SysUtils, ExtCtrls, StdCtrls, EditBtn, dialogs, USqlDatabase,
    7   URegistry, UGenerics, Generics.Collections;
     6  Classes, SysUtils, ExtCtrls, dialogs, USqlDatabase, URegistry, UGenerics,
     7  Generics.Collections;
    88
    99type
     
    561561  Count := Source.Count;
    562562  for I := OldCount to Count - 1 do
    563     //ShowMessage(TValue(Source.Items[I]).ClassName);
    564563    Items[I] := TValueClass(Source.Items[I].ClassType).Create;
    565564  for I := 0 to Count - 1 do
     
    631630begin
    632631  I := 0;
    633   while (I < Count) and (TField(Items[I]).Name <> Name) do Inc(I);
    634   if I < Count then Result := TField(Items[I])
     632  while (I < Count) and (Items[I].Name <> Name) do Inc(I);
     633  if I < Count then Result := Items[I]
    635634    else Result := nil;
    636635end;
     
    672671    FieldIndex := Parent.Fields.IndexOf(Field);
    673672    if Assigned(Field) then begin
    674       if TValue(Values[FieldIndex]).GetString <> AValues.ValueFromIndex[I] then begin
     673      if Values[FieldIndex].GetString <> AValues.ValueFromIndex[I] then begin
    675674        Result := False;
    676675        Break;
     
    686685  Values.Clear;
    687686  for I := 0 to Parent.Fields.Count - 1 do
    688     Values.Add(TField(Parent.Fields[I]).GetValueClass.Create);
     687    Values.Add(Parent.Fields[I].GetValueClass.Create);
    689688end;
    690689
     
    823822  DbRows := TDbRows.Create;
    824823  try
    825     DbClient.Query('SELECT COUNT(*) AS `Count` FROM ' + Name, DbRows);
     824    DbClient.Query('SELECT COUNT(*) FROM ' + Name, DbRows);
    826825    if DbRows.Count = 1 then begin
    827       RecordsCount := StrToInt(DbRows[0].Items['Count']);
     826      RecordsCount := StrToInt(DbRows[0].Items['COUNT(*)']);
    828827    end else RecordsCount := 0;
    829828  finally
     
    852851  FreeAndNil(Fields);
    853852  FreeAndNil(Records);
    854   inherited Destroy;
     853  inherited;
    855854end;
    856855
Note: See TracChangeset for help on using the changeset viewer.