Changeset 9 for trunk/UDatabase.pas


Ignore:
Timestamp:
Jan 25, 2015, 9:41:26 PM (10 years ago)
Author:
chronos
Message:
  • Added: Preferences dialog window.
  • Modified: Currently selected database is set in TCore class in field Database.
  • Added: Application remembers name of previous opened database and reopen it during startup.
  • Modified: FormDatabases is now used as modal form.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UDatabase.pas

    r8 r9  
    125125    procedure Load; virtual;
    126126    procedure Save; virtual;
     127    procedure Clear;
    127128    property Engine: TDatabaseEngine read FEngine write SetEngine;
    128129  end;
    129130
     131  { TDatabases }
     132
    130133  TDatabases = class(TObjectList)
    131 
     134    function FindByName(Name: string): TDatabase;
    132135  end;
    133136
     
    179182  end;
    180183
     184  TPreferences = class
     185    RememberDatabase: Boolean;
     186    LastDatabaseName: string;
     187  end;
     188
    181189
    182190implementation
     
    184192uses
    185193  UDataTypes;
     194
     195{ TDatabases }
     196
     197function TDatabases.FindByName(Name: string): TDatabase;
     198var
     199  I: Integer;
     200begin
     201  I := 0;
     202  while (I < Count) and (TDatabase(Items[I]).Name <> Name) do Inc(I);
     203  if (I < Count) then Result := TDatabase(Items[I])
     204    else Result := nil;
     205end;
    186206
    187207{ TDatabaseClient }
     
    465485end;
    466486
     487procedure TDatabase.Clear;
     488begin
     489  Tables.Clear;
     490end;
     491
    467492end.
    468493
Note: See TracChangeset for help on using the changeset viewer.