Re: [INTERFACES] New user questions re libpq++ - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: [INTERFACES] New user questions re libpq++
Date
Msg-id 26838.908754945@sss.pgh.pa.us
Whole thread Raw
In response to New user questions re libpq++  (Phil Romig <promig@acm.org>)
Responses Re: [INTERFACES] New user questions re libpq++
List pgsql-interfaces
Phil Romig <promig@acm.org> writes:
> I would appreciate some clarification regarding the C++ interface for
> postgres.  I am using postgres-6.3.2.

> a) The man page does not seem to match the code at all.  Is there a
> newer man page (I noticed a request for documentation in the archives
> but did not find a response).

Wouldn't surprise me --- libpq++ doesn't seem to have anyone taking
responsibility for it, so the documentation is probably suffering from
software rot.  Reading the code is probably the best bet (although
if you cared to update the docs as you read, that would be much
appreciated...).  There isn't *that* much to libpq++, it's just a rather
thin object-style wrapper for libpq.  So you should definitely read the
libpq docs first to make sense of the code.

> b) Do I have the most up to date version of the pq++ library.

You have the latest official release.  There are some bug fixes in
the current pre-6.4 beta releases, so you might care to try running
a beta copy instead.

> c) The header file c.h for libpq (which are included by libpq++) is
> interacting with the version of the GNU standard stream library which I
> have (gnu 2.8.x and egcs 1.0.2). The problem seems to be the prototype
> for the function char* form(...). Both stream.h and c.h prototype a
> function of with the same name and arguments.  Is this a known problem,
> and is there a fix?

As of the 6.4 beta releases, libpq has been cleaned up so that including
libpq-fe.h doesn't import quite as much cruft; in particular c.h is not
included anymore.  I think that that might fix your problem?  I haven't
really tried to use libpq++ personally so can't be sure.  If you try it
please report back.

> In the combined wisdom of the group should I (1) forget libpq++ and
> simply use libpq (2) use libpg++ or (3) take the trouble to install and
> learn ODBC?

(1) libpq++ is kind of an orphan right now, so you may (will) find rough
spots that need to be sanded off.  If you are willing to fix problems
you come across then the Postgres group would gladly take back the
changes.  If you don't want to get involved then it's hard to recommend
using libpq++.

(1a) Using libpq directly from C++ code is a very viable alternative.
I have several large apps that do it.  (Well, actually, I use a couple
of homegrown C++ classes as wrappers on PGconn and PGresult, just to
have a more C++-like syntax for the function calls, but basically it's
libpq's API.)

(2) libpg++ ?  I'm afraid I'm not sure what that is.  Some outside
interface to PGSQL maybe, or just a typo?  If it's some code I haven't
heard about, I'd be interested to know more.

(3) Haven't used ODBC so can't comment on this option.

            regards, tom lane

pgsql-interfaces by date:

Previous
From: Phil Romig
Date:
Subject: New user questions re libpq++
Next
From: "Peter Garner"
Date:
Subject: subscribe