X-Original-To: pgsql-interfaces@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 071E2475CA9 for ; Sun, 20 Apr 2003 12:49:05 -0400 (EDT) Received: from mxzilla2.xs4all.nl (mxzilla2.xs4all.nl [194.109.6.50]) by postgresql.org (Postfix) with ESMTP id B929747580B for ; Sun, 20 Apr 2003 12:49:03 -0400 (EDT) Received: from webmail4.xs4all.nl (webmail4.xs4all.nl [194.109.127.38]) by mxzilla2.xs4all.nl (8.12.3/8.12.3) with ESMTP id h3KGn8lQ073651; Sun, 20 Apr 2003 18:49:08 +0200 (CEST) Received: (from nobody@localhost) by webmail4.xs4all.nl (8.11.6/8.11.1) id h3KGn8607181; Sun, 20 Apr 2003 18:49:08 +0200 (CEST) (envelope-from jtv@xs4all.nl) X-Authentication-Warning: webmail4.xs4all.nl: nobody set sender to jtv@xs4all.nl using -f Received: from 24.132.41.217 (SquirrelMail authenticated user jtv) by webmail.xs4all.nl with HTTP; Sun, 20 Apr 2003 18:49:08 +0200 (CEST) Message-ID: <16246.24.132.41.217.1050857348.squirrel@webmail.xs4all.nl> 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> Date: Sun, 20 Apr 2003 18:49:08 +0200 (CEST) Subject: Re: 'translate' libpq++ to libpqxx From: jtv@xs4all.nl To: "Michiel Lange" Cc: pgsql-interfaces@postgresql.org X-Mailer: SquirrelMail (version 1.3.2 [CVS-DEVEL]) MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 X-Spam-Status: No, hits=-25.6 required=5.0 tests=BAYES_10,IN_REP_TO,NO_REAL_NAME,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,X_AUTH_WARNING autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/139 X-Sequence-Number: 4078 > 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