Changeset 8 for trunk/UCore.pas
- Timestamp:
- Jan 23, 2015, 12:00:37 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r7 r8 24 24 Initialized: Boolean; 25 25 procedure InitEngines; 26 procedure InitDataTypes; 26 27 public 27 28 Databases: TDatabases; 28 29 Engines: TDatabaseEngines; 30 DataTypes: TDataTypes; 29 31 procedure LoadConfig; 30 32 procedure SaveConfig; … … 39 41 40 42 uses 41 UEngineXML, UEngineMySQL, UEngineSQLite, UFormTables, UFormConnect, UFormDatabases; 43 UEngineXML, UEngineMySQL, UEngineSQLite, UFormTables, UFormConnect, 44 UFormDatabases, UDataTypes; 42 45 43 46 {$R *.lfm} … … 49 52 Databases := TDatabases.Create; 50 53 Engines := TDatabaseEngines.Create; 54 DataTypes := TDataTypes.Create; 51 55 end; 52 56 … … 58 62 procedure TCore.DataModuleDestroy(Sender: TObject); 59 63 begin 64 DataTypes.Free; 60 65 Engines.Free; 61 66 Databases.Free; … … 67 72 begin 68 73 Engines.Clear; 69 70 74 NewEngine := Engines.RegisterEngine('XML file', TDatabaseXML); 71 with NewEngine.DataTypes do begin 72 RegisterType('String', ftString); 73 RegisterType('Integer', ftInteger); 74 RegisterType('Date and time', ftDateTime); 75 RegisterType('Boolean', ftBoolean); 76 RegisterType('Float', ftFloat); 77 end; 75 NewEngine.UseTypes(DataTypes, [ftString, ftInteger, ftDateTime, ftBoolean, ftFloat]); 78 76 79 77 NewEngine := Engines.RegisterEngine('MySQL', TDatabaseMySQL); 80 with NewEngine.DataTypes do begin 81 RegisterType('String', ftString); 82 RegisterType('Integer', ftInteger); 83 RegisterType('Date and time', ftDateTime); 84 RegisterType('Boolean', ftBoolean); 85 RegisterType('Float', ftFloat); 86 end; 78 NewEngine.UseTypes(DataTypes, [ftString, ftInteger, ftDateTime, ftBoolean, ftFloat]); 87 79 88 80 NewEngine := Engines.RegisterEngine('SQLite', TDatabaseSQLite); 89 with NewEngine.DataTypes do begin 90 RegisterType('String', ftString); 91 RegisterType('Integer', ftInteger); 92 RegisterType('Date and time', ftDateTime); 93 RegisterType('Boolean', ftBoolean); 94 RegisterType('Float', ftFloat); 81 NewEngine.UseTypes(DataTypes, [ftString, ftInteger, ftDateTime, ftBoolean, ftFloat]); 82 end; 83 84 procedure TCore.InitDataTypes; 85 begin 86 DataTypes.Clear; 87 with DataTypes do begin 88 RegisterType('String', ftString, TFieldString); 89 RegisterType('Integer', ftInteger, TFieldInteger); 90 RegisterType('Date and time', ftDateTime, TFieldDateTime); 91 RegisterType('Boolean', ftBoolean, TFieldBoolean); 92 RegisterType('Float', ftFloat, TFieldFloat); 93 RegisterType('MapPosition', ftMapPosition, TFieldMapPosition); 94 RegisterType('Date', ftDate, TFieldDate); 95 RegisterType('Time', ftTime, TFieldTime); 96 RegisterType('Image', ftImage, TFieldImage); 95 97 end; 96 98 end; … … 130 132 begin 131 133 if not Initialized then begin 134 InitDataTypes; 132 135 InitEngines; 133 136 FormConnect.Init;
Note:
See TracChangeset
for help on using the changeset viewer.