Changeset 35 for trunk/USystem.pas


Ignore:
Timestamp:
Nov 25, 2011, 9:17:21 AM (13 years ago)
Author:
chronos
Message:
  • Modified: More direct SQL queries replaced by TChronisClient execution.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/USystem.pas

    r34 r35  
    147147implementation
    148148
     149uses
     150  UCore;
     151
    149152resourcestring
    150153  SUnsupportedType = 'Unsupported property type "%s"';
     
    709712procedure TChronisObject.Load(ObjectId: Integer);
    710713var
    711   DbRows: TDbRows;
    712 begin
    713   try
    714     DbRows := TDbRows.Create;
    715     Base.Database.Query(DbRows, 'SELECT * FROM `' + ObjectTable +
    716       '` WHERE `Id`=' + IntToStr(ObjectId));
    717     if DbRows.Count = 1 then begin
     714  List: TListProxy;
     715begin
     716  try
     717    List := TListProxy.Create;
     718    List.Client := Core.System.Client;
     719    List.ObjectName := ObjectTable;
     720    List.SchemaName := Core.System.Database.Database;
     721    List.SetCondition('Id', IntToStr(ObjectId));
     722    List.Load;
     723    if List.Objects.Count = 1 then begin
    718724      Id := ObjectId;
    719       with DbRows[0] do begin
    720         Name := Values['Name'];
    721         Schema := Values['Schema'];
    722         GroupId := StrToInt(Values['Group']);
    723         Table := Values['Table'];
    724         PrimaryKey := Values['PrimaryKey'];
     725      with TObjectProxy(List.Objects[0]) do begin
     726        Name := Properties.Values['Name'];
     727        Schema := Properties.Values['Schema'];
     728        GroupId := StrToInt(Properties.Values['Group']);
     729        Table := Properties.Values['Table'];
     730        PrimaryKey := Properties.Values['PrimaryKey'];
    725731      end;
    726732    end;
    727733  finally
    728     DbRows.Free;
     734    List.Free;
    729735  end;
    730736end;
Note: See TracChangeset for help on using the changeset viewer.