unit uRODataSnap_Intf; interface uses Classes, TypInfo, uROClient, uROTypes, uROClientIntf; const LibraryUID = '{9EC7C50C-DAC2-48A9-9A0F-CBAA29A11EF7}'; IAppServer_IID : TGUID = '{1AEFCC20-7A24-11D2-98B0-C69BEB4B5B6D}'; type { Forward declarations } IAppServer = interface; TProviderNames = class; { TProviderNames } TProviderNames = class(TROArray) private fItems : array of string; protected function GetItems(Index : integer) : string; procedure SetItems(Index : integer; const Value : string); function GetCount : integer; override; public class function GetItemType : PTypeInfo; override; class function GetItemSize : integer; override; function GetItemRef(Index : integer) : pointer; override; procedure Clear; override; procedure Delete(Index : integer); override; procedure Resize(ElementCount : integer); override; procedure Assign(iSource:TPersistent); override; function Add(const Value:string):integer; property Count : integer read GetCount; property Items[Index : integer] : string read GetItems write SetItems; default; end; { IAppServer } IAppServer = interface ['{1AEFCC20-7A24-11D2-98B0-C69BEB4B5B6D}'] function AS_ApplyUpdates(const ProviderName: WideString; const Delta: Binary; const MaxErrors: Integer; out ErrorCount: Integer; var OwnerData: String): binary; function AS_GetRecords(const ProviderName: WideString; const Count: Integer; out RecsOut: Integer; const Options: Integer; const CommandText: WideString; var Params: Binary; var OwnerData: String): binary; function AS_DataRequest(const ProviderName: WideString; const Data: Binary): binary; function AS_GetProviderNames: TProviderNames; function AS_GetParams(const ProviderName: WideString; var OwnerData: String): binary; function AS_RowRequest(const ProviderName: WideString; const Row: Binary; const RequestType: Integer; var OwnerData: String): binary; procedure AS_Execute(const ProviderName: WideString; const CommandText: WideString; var Params: Binary; var OwnerData: String); end; { CoIAppServer } CoAppServer = class class function Create(const iAppServerName:string; const aMessage : IROMessage; aTransportChannel : IROTransportChannel) : IAppServer; end; TAppServer_Proxy = class(TROProxy, IAppServer) private fIAppServerName:string; protected constructor Create(const iAppServerName:string; const aMessage : IROMessage; const aTransportChannel : IROTransportChannel); reintroduce; overload; constructor Create(const aMessage : IROMessage; const aTransportChannel : IROTransportChannel); reintroduce; overload; // Internal function __GetInterfaceName:string; override; // IAppServer function AS_ApplyUpdates(const ProviderName: WideString; const Delta: Binary; const MaxErrors: Integer; out ErrorCount: Integer; var OwnerData: String): binary; virtual; function AS_GetRecords(const ProviderName: WideString; const Count: Integer; out RecsOut: Integer; const Options: Integer; const CommandText: WideString; var Params: Binary; var OwnerData: String): binary; virtual; function AS_DataRequest(const ProviderName: WideString; const Data: Binary): binary; virtual; function AS_GetProviderNames: TProviderNames; virtual; function AS_GetParams(const ProviderName: WideString; var OwnerData: String): binary; virtual; function AS_RowRequest(const ProviderName: WideString; const Row: Binary; const RequestType: Integer; var OwnerData: String): binary; virtual; procedure AS_Execute(const ProviderName: WideString; const CommandText: WideString; var Params: Binary; var OwnerData: String); virtual; end; implementation uses {vcl:} SysUtils, {RemObjects:} uRORes, uROClasses; { TProviderNames } procedure TProviderNames.Assign(iSource:TPersistent); var lSource:TProviderNames; i:integer; begin if (iSource is TProviderNames) then begin lSource := TProviderNames(iSource); Clear(); Resize(lSource.Count); for i := 0 to Count-1 do begin Items[i] := lSource.Items[i]; end; end else begin inherited Assign(iSource); end; end; class function TProviderNames.GetItemType : PTypeInfo; begin result := TypeInfo(string); end; class function TProviderNames.GetItemSize : integer; begin result := SizeOf(string); end; function TProviderNames.GetItems(Index : integer) : string; begin if (Index < 0) or (Index >= Count) then RaiseError(err_ArrayIndexOutOfBounds,[Index]); result := fItems[Index]; end; function TProviderNames.GetItemRef(Index : integer) : pointer; begin result := @fItems[Index]; end; procedure TProviderNames.Clear; begin SetLength(fItems, 0); end; procedure TProviderNames.Delete(Index : integer); var i : integer; begin if (Index>=Count) then RaiseError(err_InvalidIndex, [Index]); if (Index