Changeset 345
- Timestamp:
- Apr 3, 2012, 8:30:29 AM (13 years ago)
- Location:
- PersistentData
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
PersistentData/Backend/UPDClientINI.pas
r340 r345 6 6 7 7 uses 8 Classes, SysUtils, UPDClient ;8 Classes, SysUtils, UPDClient, IniFiles; 9 9 10 10 type … … 13 13 14 14 TPDClientINI = class(TPDClient) 15 IniFile: TIniFile; 15 16 //procedure GetItemList(Condition: TCondition; ItemList: TItemList); override; 16 17 //procedure SetItemList(Condition: TCondition; ItemList: TItemList); override; 18 FileName: string; 17 19 constructor Create; override; 18 20 destructor Destroy; override; 21 procedure Connect; override; 22 procedure Disconnect; override; 19 23 end; 20 24 … … 42 46 destructor TPDClientINI.Destroy; 43 47 begin 48 Disconnect; 44 49 inherited Destroy; 50 end; 51 52 procedure TPDClientINI.Connect; 53 begin 54 IniFile := TIniFile.Create(FileName); 55 end; 56 57 procedure TPDClientINI.Disconnect; 58 begin 59 FreeAndNil(IniFile); 45 60 end; 46 61 -
PersistentData/Backend/UPDClientMySQL.pas
r340 r345 75 75 DbRows := TDbRows.Create; 76 76 Table := '`' + AObject.ObjectName + '`'; 77 if AObject. SchemaName <> '' then Table := '`' + AObject.SchemaName+ '`.' + Table;77 if AObject.Path <> '' then Table := '`' + AObject.Path + '`.' + Table; 78 78 Database.Query(DbRows, 'SELECT * FROM ' + Table + 79 79 ' WHERE `Id`=' + IntToStr(AObject.Id)); … … 92 92 try 93 93 DbRows := TDbRows.Create; 94 Database.Replace(AObject.ObjectName, AObject.Properties, AObject.SchemaName); 95 if AObject.Id = 0 then AObject.Id := Database.LastInsertId; 94 if AObject.Id = 0 then begin 95 Database.Insert(AObject.ObjectName, AObject.Properties, AObject.Path); 96 AObject.Id := Database.LastInsertId; 97 end else Database.Update(AObject.ObjectName, AObject.Properties, 98 'Id=' + IntToStr(AObject.Id), AObject.Path); 96 99 finally 97 100 DbRows.Free; … … 102 105 begin 103 106 Database.Delete(AObject.ObjectName, 'Id=' + IntToStr(AObject.Id), 104 AObject. SchemaName);107 AObject.Path); 105 108 end; 106 109 … … 125 128 else DbCondition := ''; 126 129 Table := '`' + AList.ObjectName + '`'; 127 if AList. SchemaName <> '' then Table := '`' + AList.SchemaName+ '`.' + Table;130 if AList.Path <> '' then Table := '`' + AList.Path + '`.' + Table; 128 131 Database.Query(DbRows, 'SELECT ' + Filter + ' FROM ' + Table + DbCondition); 129 132 AList.Objects.Clear; … … 132 135 NewObject.Client := AList.Client; 133 136 NewObject.ObjectName := AList.ObjectName; 134 NewObject. SchemaName := AList.SchemaName;137 NewObject.Path := AList.Path; 135 138 NewObject.Properties.Assign(TDictionaryStringString(DbRows[I])); 136 139 AList.Objects.Add(NewObject); … … 198 201 NewProxy := TListProxy.Create; 199 202 NewProxy.Client := Self; 200 NewProxy. SchemaName:= 'information_schema';203 NewProxy.Path := 'information_schema'; 201 204 NewProxy.ObjectName := 'TABLES'; 202 205 NewProxy.Condition := '(TABLE_SCHEMA = "' + Schema + -
PersistentData/Backend/UPDClientRegistry.pas
r340 r345 6 6 7 7 uses 8 Classes, SysUtils, UPDClient ;8 Classes, SysUtils, UPDClient, Registry; 9 9 10 10 type … … 13 13 14 14 TPDClientRegistry = class(TPDClient) 15 Reg: TRegistry; 15 16 //procedure GetItemList(Condition: TCondition; ItemList: TItemList); override; 16 17 //procedure SetItemList(Condition: TCondition; ItemList: TItemList); override; … … 37 38 constructor TPDClientRegistry.Create; 38 39 begin 40 Reg := TRegistry.Create; 39 41 inherited Create; 40 42 end; … … 42 44 destructor TPDClientRegistry.Destroy; 43 45 begin 46 Reg.Free; 44 47 inherited Destroy; 45 48 end; -
PersistentData/UPDClient.pas
r340 r345 25 25 Client: TPDClient; 26 26 ObjectName: string; 27 SchemaName: string;27 Path: string; 28 28 procedure Load; 29 29 procedure Save; … … 47 47 Condition: string; 48 48 ObjectName: string; 49 SchemaName: string;49 Path: string; 50 50 Objects: TListObject; // TListObject<TObjectProxy> 51 51 procedure Clear; … … 252 252 NewProxy := TListProxy.Create; 253 253 NewProxy.Client := Self; 254 NewProxy. SchemaName:= 'information_schema';254 NewProxy.Path := 'information_schema'; 255 255 NewProxy.ObjectName := 'TABLES'; 256 256 NewProxy.Condition := '(TABLE_SCHEMA = "' + Schema + … … 260 260 NewObject := TObjectProxy.Create; 261 261 NewObject.Client := Self; 262 NewObject. SchemaName:= Schema;262 NewObject.Path := Schema; 263 263 NewObject.ObjectName := SystemVersionObject; 264 264 NewObject.Id := 1; … … 278 278 NewObject := TObjectProxy.Create; 279 279 NewObject.Client := Self; 280 NewObject. SchemaName:= Schema;280 NewObject.Path := Schema; 281 281 NewObject.ObjectName := SystemVersionObject; 282 282 NewObject.Properties.Add('Version', Version); … … 308 308 NewProxy := TListProxy.Create; 309 309 NewProxy.Client := Self; 310 NewProxy. SchemaName:= 'information_schema';310 NewProxy.Path := 'information_schema'; 311 311 NewProxy.ObjectName := 'TABLES'; 312 312 NewProxy.Condition := 'TABLE_SCHEMA = "' + Schema + '"';
Note:
See TracChangeset
for help on using the changeset viewer.