[Libpqxx-general] Liskov Substitution and Transactions
Maurice Gittens
mainmanmauricio at gmail.com
Sun Apr 26 22:35:21 UTC 2009
Jeroen,
On Sun, Apr 26, 2009 at 6:05 PM, Jeroen Vermeulen <jtv at xs4all.nl> wrote:
> 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. :-)
>
Ok, just gave it a try and it seems to compile.
When substituting a pqxx::subtransation* for a pqxx::basic_transaction* I
need to cast them to pqxx::basic_transactions*.
This is probably due to the fact that the subtransaction class has two base
classes.
This would seem to violate the premise that a pqxx::subtransaction ISA
pqxx::basic_transaction.
Is this intensional?
Thanks.
Kind regards,
Maurice
PS: http://www.pqxx.org/development/libpqxx/ seems to be down.
>
> Jeroen
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://pgfoundry.org/pipermail/libpqxx-general/attachments/20090427/a903acf8/attachment.html
More information about the Libpqxx-general
mailing list