pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: jtv@xs4all.nl
To: Michiel Lange <michiel@minas.demon.nl>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: 'translate' libpq++ to libpqxx
Date: Sun, 20 Apr 2003 18:49:08 +0200 (CEST)
Message-ID: <16246.24.132.41.217.1050857348.squirrel@webmail.xs4all.nl> (raw)
In-Reply-To: <5.1.0.14.0.20030407233522.00b380a8@192.168.1.3>
References: <5.1.0.14.0.20030407233522.00b380a8@192.168.1.3>


> But the class 'PgConnection' seems to exist no more, and I hoped there
> would be an easy way to replace all occurrences of a function with another
> (it would have been even better if the syntaxes would be comparable, but
> that might have been not a good idea...)

Unfortunately for you, libpqxx and libpq++ are completely separate beasts
(http://gborg.postgresql.org/project/libpqxx/faq/faq.php?faq_id=91) and so
a one-to-one translation is not always possible.  The real problem is
often that libpq++-based code often doesn't use exceptions (which in turn
typically means that the code is broken anyway).

Changing this can make your program much shorter, more maintainable, and
more reliable...  But the update may involve your whole code, unless
you're willing to isolate the exceptions-enabled pieces of code in
try-catch blocks, which of course isn't quite as much fun.

The other major issue to take into account is how your program deals with
transactions.  If it doesn't, fine.  If it does, a poorly structured
program may need to be refactored to make the change possible.

These things aside, and the fact that a good deal of low-level error
handling code should become unnecessary (libpqxx does safe retries, for
instance, so you don't need to worry about them), there are no major
obstacles that I'm currently aware of.

I'll make a note to write a bit more about conversion of existing code in
the manual.  And then (sigh) find a working way to translate it into HTML.


Jeroen




view thread (2+ messages)

Message-ID: <16246.24.132.41.217.1050857348.squirrel@webmail.xs4all.nl>
Permalink:  ../16246.24.132.41.217.1050857348.squirrel@webmail.xs4all.nl/
Also on:    postgresql.org/message-id/16246.24.132.41.217.1050857348.squirrel@webmail.xs4all.nl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: jtv@xs4all.nl, michiel@minas.demon.nl
  Subject: Re: 'translate' libpq++ to libpqxx
  In-Reply-To: <16246.24.132.41.217.1050857348.squirrel@webmail.xs4all.nl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox