[Libpqxx-general] Liskov Substitution and Transactions

Jeroen Vermeulen jtv at xs4all.nl
Sun Apr 26 16:05:38 UTC 2009


Maurice Gittens wrote:
> Since you seem interested in API feedback I'll share an annoyance I
> encountered with the
> transaction API.
> 
> I'm writing A JIT Compiler that emits pqxx calls and it is inconvenient that
> the transaction API does not
> seem to adhere to the Liskov Substitution principle.

Use basic_transaction as the overall base type of transactions.  It 
should provide all the members you need.

It looks like I made the dbtransaction destructor protected in an 
experiment I never finished.  I'll make it public again, though of 
course not the constructors.

The LSP probably doesn't apply here since all the base classes in the 
transaction hierarchy are abstract.  There are no objects of base-class 
type to replace with derived-class objects.  :-)


Jeroen


More information about the Libpqxx-general mailing list