75 lines
2.2 KiB
ObjectPascal
75 lines
2.2 KiB
ObjectPascal
unit FetchService_Impl;
|
|
|
|
{----------------------------------------------------------------------------}
|
|
{ This unit was automatically generated by the RemObjects SDK after reading }
|
|
{ the RODL file associated with this project . }
|
|
{ }
|
|
{ This is where you are supposed to code the implementation of your objects. }
|
|
{----------------------------------------------------------------------------}
|
|
|
|
{$I Remobjects.inc}
|
|
|
|
interface
|
|
|
|
uses
|
|
{vcl:} Classes, SysUtils,
|
|
{RemObjects:} uROXMLIntf, uROClientIntf, uROTypes, uROServer, uROServerIntf, uROSessions,
|
|
{Required:} uRORemoteDataModule,
|
|
{Ancestor Implementation:} DataAbstractService_Impl,
|
|
{Used RODLs:} DataAbstract4_Intf,
|
|
{Generated:} FetchLibrary_Intf, uDADataStreamer, uDABin2DataStreamer,
|
|
uDAClasses, FetchServerData, uDAInterfaces;
|
|
|
|
type
|
|
{ TFetchService }
|
|
TFetchService = class(TDataAbstractService, IFetchService)
|
|
DataStreamer: TDABin2DataStreamer;
|
|
Schema: TDASchema;
|
|
private
|
|
protected
|
|
{ IFetchService methods }
|
|
function GetOrdersAndDetails(const StartOrderID: Integer; const EndOrderID: Integer): Binary;
|
|
end;
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
uses
|
|
{Generated:} FetchLibrary_Invk;
|
|
|
|
procedure Create_FetchService(out anInstance : IUnknown);
|
|
begin
|
|
anInstance := TFetchService.Create(nil);
|
|
end;
|
|
|
|
{ FetchService }
|
|
function TFetchService.GetOrdersAndDetails(const StartOrderID: Integer; const EndOrderID: Integer): Binary;
|
|
|
|
procedure ProcessDataset(aDataset: IDADataset);
|
|
begin
|
|
aDataset.ParamByName('StartingOrderID').AsInteger := StartOrderID;
|
|
aDataset.ParamByName('EndingOrderID').AsInteger := EndOrderID;
|
|
aDataset.Open;
|
|
DataStreamer.WriteDataset(aDataset, [woRows], -1);
|
|
end;
|
|
|
|
begin
|
|
result := Binary.Create;
|
|
DataStreamer.Initialize(result, aiWrite);
|
|
try
|
|
// writing orders
|
|
ProcessDataset(Schema.NewDataset(Connection, 'Orders'));
|
|
// writing order details
|
|
ProcessDataset(Schema.NewDataset(Connection, 'OrderDetails'));
|
|
finally
|
|
DataStreamer.Finalize;
|
|
end;
|
|
end;
|
|
|
|
initialization
|
|
TROClassFactory.Create('FetchService', Create_FetchService, TFetchService_Invoker);
|
|
|
|
finalization
|
|
|
|
end.
|