home *** CD-ROM | disk | FTP | other *** search
/ Delphi 5 for Professionals / DELPHI5.iso / Runimage / Delphi50 / Demos / Midas / Pooler / server_tlb.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-08-11  |  15.6 KB  |  387 lines

  1. unit Server_TLB;
  2.  
  3. // ************************************************************************ //
  4. // WARNING                                                                    
  5. // -------                                                                    
  6. // The types declared in this file were generated from data read from a       
  7. // Type Library. If this type library is explicitly or indirectly (via        
  8. // another type library referring to this type library) re-imported, or the   
  9. // 'Refresh' command of the Type Library Editor activated while editing the   
  10. // Type Library, the contents of this file will be regenerated and all        
  11. // manual modifications will be lost.                                         
  12. // ************************************************************************ //
  13.  
  14. // PASTLWTR : $Revision:   1.55  $
  15. // File generated on 4/15/99 7:04:39 AM from Type Library described below.
  16.  
  17. // ************************************************************************ //
  18. // Type Lib: D:\Temp\demos\MIDAS\POOLER\Server.tlb (1)
  19. // IID\LCID: {0CE99800-9F28-11D1-8944-00A0248E5091}\0
  20. // Helpfile: 
  21. // DepndLst: 
  22. //   (1) v1.0 Midas, (D:\tp5\bin\midas.dll)
  23. //   (2) v2.0 stdole, (C:\WINNTS\system32\stdole2.tlb)
  24. //   (3) v4.0 StdVCL, (D:\TP\bin\stdvcl40.dll)
  25. // ************************************************************************ //
  26. interface
  27.  
  28. uses Windows, ActiveX, Classes, Graphics, OleServer, OleCtrls, StdVCL, 
  29.   MIDAS;
  30.  
  31. // *********************************************************************//
  32. // GUIDS declared in the TypeLibrary. Following prefixes are used:        
  33. //   Type Libraries     : LIBID_xxxx                                      
  34. //   CoClasses          : CLASS_xxxx                                      
  35. //   DISPInterfaces     : DIID_xxxx                                       
  36. //   Non-DISP interfaces: IID_xxxx                                        
  37. // *********************************************************************//
  38. const
  39.   LIBID_Server: TGUID = '{0CE99800-9F28-11D1-8944-00A0248E5091}';
  40.   IID_IPooledRDM: TGUID = '{0CE99801-9F28-11D1-8944-00A0248E5091}';
  41.   CLASS_PooledRDM: TGUID = '{0CE99802-9F28-11D1-8944-00A0248E5091}';
  42.   CLASS_Pooler: TGUID = '{0CE99804-9F28-11D1-8944-00A0248E5091}';
  43. type
  44.  
  45. // *********************************************************************//
  46. // Forward declaration of types defined in TypeLibrary                    
  47. // *********************************************************************//
  48.   IPooledRDM = interface;
  49.   IPooledRDMDisp = dispinterface;
  50.  
  51. // *********************************************************************//
  52. // Declaration of CoClasses defined in Type Library                       
  53. // (NOTE: Here we map each CoClass to its Default Interface)              
  54. // *********************************************************************//
  55.   PooledRDM = IPooledRDM;
  56.   Pooler = IPooledRDM;
  57.  
  58.  
  59. // *********************************************************************//
  60. // Interface: IPooledRDM
  61. // Flags:     (4432) Hidden Dual OleAutomation Dispatchable
  62. // GUID:      {0CE99801-9F28-11D1-8944-00A0248E5091}
  63. // *********************************************************************//
  64.   IPooledRDM = interface(IAppServer)
  65.     ['{0CE99801-9F28-11D1-8944-00A0248E5091}']
  66.   end;
  67.  
  68. // *********************************************************************//
  69. // DispIntf:  IPooledRDMDisp
  70. // Flags:     (4432) Hidden Dual OleAutomation Dispatchable
  71. // GUID:      {0CE99801-9F28-11D1-8944-00A0248E5091}
  72. // *********************************************************************//
  73.   IPooledRDMDisp = dispinterface
  74.     ['{0CE99801-9F28-11D1-8944-00A0248E5091}']
  75.     function  AS_ApplyUpdates(const ProviderName: WideString; Delta: OleVariant; 
  76.                               MaxErrors: Integer; out ErrorCount: Integer; var OwnerData: OleVariant): OleVariant; dispid 20000000;
  77.     function  AS_GetRecords(const ProviderName: WideString; Count: Integer; out RecsOut: Integer; 
  78.                             Options: Integer; const CommandText: WideString; 
  79.                             var Params: OleVariant; var OwnerData: OleVariant): OleVariant; dispid 20000001;
  80.     function  AS_DataRequest(const ProviderName: WideString; Data: OleVariant): OleVariant; dispid 20000002;
  81.     function  AS_GetProviderNames: OleVariant; dispid 20000003;
  82.     function  AS_GetParams(const ProviderName: WideString; var OwnerData: OleVariant): OleVariant; dispid 20000004;
  83.     function  AS_RowRequest(const ProviderName: WideString; Row: OleVariant; RequestType: Integer; 
  84.                             var OwnerData: OleVariant): OleVariant; dispid 20000005;
  85.     procedure AS_Execute(const ProviderName: WideString; const CommandText: WideString; 
  86.                          var Params: OleVariant; var OwnerData: OleVariant); dispid 20000006;
  87.   end;
  88.  
  89. // *********************************************************************//
  90. // The Class CoPooledRDM provides a Create and CreateRemote method to          
  91. // create instances of the default interface IPooledRDM exposed by              
  92. // the CoClass PooledRDM. The functions are intended to be used by             
  93. // clients wishing to automate the CoClass objects exposed by the         
  94. // server of this typelibrary.                                            
  95. // *********************************************************************//
  96.   CoPooledRDM = class
  97.     class function Create: IPooledRDM;
  98.     class function CreateRemote(const MachineName: string): IPooledRDM;
  99.   end;
  100.  
  101.  
  102. // *********************************************************************//
  103. // OLE Server Proxy class declaration
  104. // Server Object    : TPooledRDM
  105. // Help String      : CoClass for the RDM that is to be pooled.
  106. // Default Interface: IPooledRDM
  107. // Def. Intf. DISP? : No
  108. // Event   Interface: 
  109. // TypeFlags        : (2) CanCreate
  110. // *********************************************************************//
  111.   TPooledRDM = class(TOleServer)
  112.   private
  113.     FIntf:        IPooledRDM;
  114.     function      GetDefaultInterface: IPooledRDM;
  115.  
  116.   protected
  117.     procedure InitServerData; override;
  118.   public
  119.     procedure Connect; override;
  120.     procedure Disconnect; override;
  121.   // --------------
  122.   // --------------
  123.     function  AS_ApplyUpdates(const ProviderName: WideString; Delta: OleVariant; 
  124.                               MaxErrors: Integer; out ErrorCount: Integer; var OwnerData: OleVariant): OleVariant;
  125.     function  AS_GetRecords(const ProviderName: WideString; Count: Integer; out RecsOut: Integer; 
  126.                             Options: Integer; const CommandText: WideString; 
  127.                             var Params: OleVariant; var OwnerData: OleVariant): OleVariant;
  128.     function  AS_DataRequest(const ProviderName: WideString; Data: OleVariant): OleVariant;
  129.     function  AS_GetProviderNames: OleVariant;
  130.     function  AS_GetParams(const ProviderName: WideString; var OwnerData: OleVariant): OleVariant;
  131.     function  AS_RowRequest(const ProviderName: WideString; Row: OleVariant; RequestType: Integer; 
  132.                             var OwnerData: OleVariant): OleVariant;
  133.     procedure AS_Execute(const ProviderName: WideString; const CommandText: WideString; 
  134.                          var Params: OleVariant; var OwnerData: OleVariant);
  135.   // --------------
  136.     property  DefaultInterface: IPooledRDM read GetDefaultInterface;
  137.   // --------------
  138.   // --------------
  139.   // --------------
  140.   // --------------
  141.   published
  142.   end;
  143.  
  144. // *********************************************************************//
  145. // The Class CoPooler provides a Create and CreateRemote method to          
  146. // create instances of the default interface IPooledRDM exposed by              
  147. // the CoClass Pooler. The functions are intended to be used by             
  148. // clients wishing to automate the CoClass objects exposed by the         
  149. // server of this typelibrary.                                            
  150. // *********************************************************************//
  151.   CoPooler = class
  152.     class function Create: IPooledRDM;
  153.     class function CreateRemote(const MachineName: string): IPooledRDM;
  154.   end;
  155.  
  156.  
  157. // *********************************************************************//
  158. // OLE Server Proxy class declaration
  159. // Server Object    : TPooler
  160. // Help String      : CoClass for the pooler object.
  161. // Default Interface: IPooledRDM
  162. // Def. Intf. DISP? : No
  163. // Event   Interface: 
  164. // TypeFlags        : (2) CanCreate
  165. // *********************************************************************//
  166.   TPooler = class(TOleServer)
  167.   private
  168.     FIntf:        IPooledRDM;
  169.     function      GetDefaultInterface: IPooledRDM;
  170.  
  171.   protected
  172.     procedure InitServerData; override;
  173.   public
  174.     procedure Connect; override;
  175.     procedure Disconnect; override;
  176.   // --------------
  177.   // --------------
  178.     function  AS_ApplyUpdates(const ProviderName: WideString; Delta: OleVariant; 
  179.                               MaxErrors: Integer; out ErrorCount: Integer; var OwnerData: OleVariant): OleVariant;
  180.     function  AS_GetRecords(const ProviderName: WideString; Count: Integer; out RecsOut: Integer; 
  181.                             Options: Integer; const CommandText: WideString; 
  182.                             var Params: OleVariant; var OwnerData: OleVariant): OleVariant;
  183.     function  AS_DataRequest(const ProviderName: WideString; Data: OleVariant): OleVariant;
  184.     function  AS_GetProviderNames: OleVariant;
  185.     function  AS_GetParams(const ProviderName: WideString; var OwnerData: OleVariant): OleVariant;
  186.     function  AS_RowRequest(const ProviderName: WideString; Row: OleVariant; RequestType: Integer; 
  187.                             var OwnerData: OleVariant): OleVariant;
  188.     procedure AS_Execute(const ProviderName: WideString; const CommandText: WideString; 
  189.                          var Params: OleVariant; var OwnerData: OleVariant);
  190.   // --------------
  191.     property  DefaultInterface: IPooledRDM read GetDefaultInterface;
  192.   // --------------
  193.   // --------------
  194.   // --------------
  195.   // --------------
  196.   published
  197.   end;
  198.  
  199. procedure Register;
  200.  
  201. implementation
  202.  
  203. uses ComObj;
  204.  
  205. class function CoPooledRDM.Create: IPooledRDM;
  206. begin
  207.   Result := CreateComObject(CLASS_PooledRDM) as IPooledRDM;
  208. end;
  209.  
  210. class function CoPooledRDM.CreateRemote(const MachineName: string): IPooledRDM;
  211. begin
  212.   Result := CreateRemoteComObject(MachineName, CLASS_PooledRDM) as IPooledRDM;
  213. end;
  214.  
  215. procedure TPooledRDM.InitServerData;
  216. const
  217.   CServerData: TServerData = (
  218.     ClassID:   '{0CE99802-9F28-11D1-8944-00A0248E5091}';
  219.     IntfIID:   '{0CE99801-9F28-11D1-8944-00A0248E5091}';
  220.     EventIID:  '';
  221.     LicenseKey: nil;
  222.     Version: 500);
  223. begin
  224.   ServerData := @CServerData;
  225. end;
  226.  
  227. procedure TPooledRDM.Connect;
  228. var
  229.   punk: IUnknown;
  230. begin
  231.   if FIntf = nil then
  232.   begin
  233.     punk := GetServer;
  234.     Fintf:= punk as IPooledRDM;
  235.   end;
  236. end;
  237.  
  238. procedure TPooledRDM.DisConnect;
  239. begin
  240.   FIntf := nil;
  241. end;
  242.  
  243.  
  244. function TPooledRDM.GetDefaultInterface: IPooledRDM;
  245. begin
  246.   Connect;
  247.   Result := FIntf;
  248. end;
  249.  
  250. function  TPooledRDM.AS_ApplyUpdates(const ProviderName: WideString; Delta: OleVariant; 
  251.                                      MaxErrors: Integer; out ErrorCount: Integer; 
  252.                                      var OwnerData: OleVariant): OleVariant;
  253. begin
  254.   Result := DefaultInterface.AS_ApplyUpdates(ProviderName, Delta, MaxErrors, ErrorCount, OwnerData);
  255. end;
  256.  
  257. function  TPooledRDM.AS_GetRecords(const ProviderName: WideString; Count: Integer; 
  258.                                    out RecsOut: Integer; Options: Integer; 
  259.                                    const CommandText: WideString; var Params: OleVariant; 
  260.                                    var OwnerData: OleVariant): OleVariant;
  261. begin
  262.   Result := DefaultInterface.AS_GetRecords(ProviderName, Count, RecsOut, Options, CommandText, 
  263.                                            Params, OwnerData);
  264. end;
  265.  
  266. function  TPooledRDM.AS_DataRequest(const ProviderName: WideString; Data: OleVariant): OleVariant;
  267. begin
  268.   Result := DefaultInterface.AS_DataRequest(ProviderName, Data);
  269. end;
  270.  
  271. function  TPooledRDM.AS_GetProviderNames: OleVariant;
  272. begin
  273.   Result := DefaultInterface.AS_GetProviderNames;
  274. end;
  275.  
  276. function  TPooledRDM.AS_GetParams(const ProviderName: WideString; var OwnerData: OleVariant): OleVariant;
  277. begin
  278.   Result := DefaultInterface.AS_GetParams(ProviderName, OwnerData);
  279. end;
  280.  
  281. function  TPooledRDM.AS_RowRequest(const ProviderName: WideString; Row: OleVariant; 
  282.                                    RequestType: Integer; var OwnerData: OleVariant): OleVariant;
  283. begin
  284.   Result := DefaultInterface.AS_RowRequest(ProviderName, Row, RequestType, OwnerData);
  285. end;
  286.  
  287. procedure TPooledRDM.AS_Execute(const ProviderName: WideString; const CommandText: WideString; 
  288.                                 var Params: OleVariant; var OwnerData: OleVariant);
  289. begin
  290.   DefaultInterface.AS_Execute(ProviderName, CommandText, Params, OwnerData);
  291. end;
  292.  
  293. class function CoPooler.Create: IPooledRDM;
  294. begin
  295.   Result := CreateComObject(CLASS_Pooler) as IPooledRDM;
  296. end;
  297.  
  298. class function CoPooler.CreateRemote(const MachineName: string): IPooledRDM;
  299. begin
  300.   Result := CreateRemoteComObject(MachineName, CLASS_Pooler) as IPooledRDM;
  301. end;
  302.  
  303. procedure TPooler.InitServerData;
  304. const
  305.   CServerData: TServerData = (
  306.     ClassID:   '{0CE99804-9F28-11D1-8944-00A0248E5091}';
  307.     IntfIID:   '{0CE99801-9F28-11D1-8944-00A0248E5091}';
  308.     EventIID:  '';
  309.     LicenseKey: nil;
  310.     Version: 500);
  311. begin
  312.   ServerData := @CServerData;
  313. end;
  314.  
  315. procedure TPooler.Connect;
  316. var
  317.   punk: IUnknown;
  318. begin
  319.   if FIntf = nil then
  320.   begin
  321.     punk := GetServer;
  322.     Fintf:= punk as IPooledRDM;
  323.   end;
  324. end;
  325.  
  326. procedure TPooler.DisConnect;
  327. begin
  328.   FIntf := nil;
  329. end;
  330.  
  331.  
  332. function TPooler.GetDefaultInterface: IPooledRDM;
  333. begin
  334.   Connect;
  335.   Result := FIntf;
  336. end;
  337.  
  338. function  TPooler.AS_ApplyUpdates(const ProviderName: WideString; Delta: OleVariant; 
  339.                                   MaxErrors: Integer; out ErrorCount: Integer; 
  340.                                   var OwnerData: OleVariant): OleVariant;
  341. begin
  342.   Result := DefaultInterface.AS_ApplyUpdates(ProviderName, Delta, MaxErrors, ErrorCount, OwnerData);
  343. end;
  344.  
  345. function  TPooler.AS_GetRecords(const ProviderName: WideString; Count: Integer; 
  346.                                 out RecsOut: Integer; Options: Integer; 
  347.                                 const CommandText: WideString; var Params: OleVariant; 
  348.                                 var OwnerData: OleVariant): OleVariant;
  349. begin
  350.   Result := DefaultInterface.AS_GetRecords(ProviderName, Count, RecsOut, Options, CommandText, 
  351.                                            Params, OwnerData);
  352. end;
  353.  
  354. function  TPooler.AS_DataRequest(const ProviderName: WideString; Data: OleVariant): OleVariant;
  355. begin
  356.   Result := DefaultInterface.AS_DataRequest(ProviderName, Data);
  357. end;
  358.  
  359. function  TPooler.AS_GetProviderNames: OleVariant;
  360. begin
  361.   Result := DefaultInterface.AS_GetProviderNames;
  362. end;
  363.  
  364. function  TPooler.AS_GetParams(const ProviderName: WideString; var OwnerData: OleVariant): OleVariant;
  365. begin
  366.   Result := DefaultInterface.AS_GetParams(ProviderName, OwnerData);
  367. end;
  368.  
  369. function  TPooler.AS_RowRequest(const ProviderName: WideString; Row: OleVariant; 
  370.                                 RequestType: Integer; var OwnerData: OleVariant): OleVariant;
  371. begin
  372.   Result := DefaultInterface.AS_RowRequest(ProviderName, Row, RequestType, OwnerData);
  373. end;
  374.  
  375. procedure TPooler.AS_Execute(const ProviderName: WideString; const CommandText: WideString; 
  376.                              var Params: OleVariant; var OwnerData: OleVariant);
  377. begin
  378.   DefaultInterface.AS_Execute(ProviderName, CommandText, Params, OwnerData);
  379. end;
  380.  
  381. procedure Register;
  382. begin
  383.   RegisterComponents('Servers',[TPooledRDM, TPooler]);
  384. end;
  385.  
  386. end.
  387.