Changeset 23 for trunk/UDatabase.pas


Ignore:
Timestamp:
Mar 26, 2018, 12:40:10 AM (7 years ago)
Author:
chronos
Message:
  • Modified: More changes to implement SQL over XML file.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UDatabase.pas

    r22 r23  
    7777    function SearchByName(Name: string): TField;
    7878    procedure Assign(Source: TFields);
     79    function AddNew(Name: string; DataType: TDataType): TField;
    7980  end;
    8081
     
    9697    procedure Assign(Source: TRecords);
    9798    function SearchByValue(Name, Value: string): TRecord;
     99    function AddNew: TRecord;
    98100  end;
    99101
     
    120122    DbClient: TDbClient;
    121123    function SearchByName(Name: string): TTable;
     124    function AddNew(Name: string): TTable;
    122125  end;
    123126
     
    145148    Name: string;
    146149    Params: TDbConnectParams;
     150    DbManager: TDbManager;
    147151    destructor Destroy; override;
    148152    function GetClient: TDbClient;
     
    189193    procedure SetConnectProfile(AValue: TDbConnectProfile); virtual;
    190194  public
     195    DbManager: TDbManager;
    191196    procedure Query(Text: string; DbRows: TDbRows = nil); virtual;
    192     procedure LoadTables(Tables: TTables); virtual;
    193197    constructor Create; virtual;
    194198    procedure Load; virtual;
     
    350354
    351355      ConnectProfile := TDbConnectProfile.Create;
     356      ConnectProfile.DbManager := DbManager;
    352357      ConnectProfile.ClientType := ClientType;
    353358      ConnectProfile.Name := GetValue('Name', '');
     
    414419  Result := ClientType.DatabaseClientClass.Create;
    415420  Result.ConnectProfile := Self;
     421  Result.DbManager := DbManager;
    416422end;
    417423
     
    428434end;
    429435
     436function TTables.AddNew(Name: string): TTable;
     437begin
     438  Result := TTable.Create;
     439  Result.DbClient := DbClient;
     440  Result.Name := Name;
     441  Add(Result);
     442end;
     443
    430444{ TDbClient }
    431445
     
    443457procedure TDbClient.Query(Text: string; DbRows: TDbRows = nil);
    444458begin
    445 end;
    446 
    447 procedure TDbClient.LoadTables(Tables: TTables);
    448 begin
    449   Tables.Clear;
    450459end;
    451460
     
    598607end;
    599608
     609function TRecords.AddNew: TRecord;
     610begin
     611  Result := TRecord.Create;
     612  Result.Parent := Parent;
     613  Result.InitValues;
     614  Add(Result);
     615end;
     616
    600617{ TFields }
    601618
     
    622639    TField(Items[I]).Assign(TField(Source.Items[I]));
    623640  end;
     641end;
     642
     643function TFields.AddNew(Name: string; DataType: TDataType): TField;
     644begin
     645  Result := TField.Create;
     646  Result.Table := Table;
     647  Result.Name := Name;
     648  Result.DataType := DataType;
     649  Add(Result);
    624650end;
    625651
Note: See TracChangeset for help on using the changeset viewer.