Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » RPC_METHOD how to "define"
Re: RPC_METHOD how to "define" [message #47603 is a reply to message #47601] Sun, 05 February 2017 14:03 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14261
Registered: November 2005
Ultimate Member
NilaT wrote on Sun, 05 February 2017 11:02
Thanks guys for your help.
Mirek, my intention why I want it as member functions is, because my RPC Methods all need a database connection, so in one class function I open the connection and keep it open. And because I don't want to pass this PostgreSqlSession to all RPC Functions, I want to use a member.
Furthermore I need an Instance of a very big class and don't want to pass this either, so a member seems to be the best solution in my opinion.


The basically you need single global connection, that is all. Situation would not change with introduction of class.

There are some further consideration (like will be your application multithreaded?), but you will either end with one connection per server thread or one connection per server call...

Quote:

PS: Maybe you can explain this code? I mean... it compiles, but I really don't know what this does:
[](RpcData& rpc){Single<MyRpcClass>().Status(rpc);});


Single<MyRpcClass> actually pretty much does the same thing - there will be single global instance of MyRpcClass.

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Requirement Printing in a batch -> new Feature for PrinterJob
Next Topic: C2280
Goto Forum:
  


Current Time: Fri Jun 06 15:15:24 CEST 2025

Total time taken to generate the page: 0.03884 seconds