[Libpqxx-general] transactor select results?
Remco Post
remco at pipsworld.nl
Tue Dec 29 15:15:35 UTC 2009
HI,
On 29 dec 2009, at 15:20, Robert Backhaus-pqxx wrote:
>
> When you write your transactor, include private attributes to store the data that your queries will return. In your perform() function, store the information in those attributes. In on_commit(), you can move the data out of the transactor.
> As the pqxx::result is part of the transactor, you should not reference it outside of the transactor.
>
I see no difference between your use of public member variables to expose your query results or having a member function return a reference to private variables. I'm more or less tempted to hide all variables, allowing me to change implementation without changing my interface. Admitted, directly exposing the caller to a pqxx::result might not be a good idea either. My idea was to build a generic transactor that would work for about 90% of all of my database queries, and only build specific transactors for more complex matters.
> I guess that the answer is: outside of your transactor, you should be done with anything databasey. When the transactor is finshed, you should be left with the objects of your program, manipulated as requred by the information extracted from the database.
>
That is one way of handling things, and I might actually go that way.
> Here is one of my uses of the transactor framework.
Thanks, it does give me some insight into how you handle things.
--
Met vriendelijke groeten,
Remco Post
remco at pipsworld.nl
More information about the Libpqxx-general
mailing list