Re: libpq++ - Mailing list pgsql-interfaces

From Bruce Momjian
Subject Re: libpq++
Date
Msg-id 200103072223.RAA04626@candle.pha.pa.us
Whole thread Raw
In response to Re: libpq++  ("J. T. Vermeulen" <jtv@cistron-office.nl>)
List pgsql-interfaces
> On Wed, 07 Mar 2001, Bruce Momjian wrote:
>
> > > Would that be OK?
> >
> > Also, would you review this?
> >
> >     ftp://candle.pha.pa.us/pub/postgresql/libpq++.mbox
> >
> > and merge any valuable changes into your copy of the code.  Much of it
> > is already in there.
>
> Will do.  Can I take it there have been no other changes between 7.0.3 and 7.2
> as far as libpq++ is concerned, so I can continue to work with the version I
> have?

I don't think much has been done with 7.1 libpq++.  I would download the
snapshot and do a diff against 7.0.3 to be sure.

Attached are the changes I see since 7.0.0.  They are very minor.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: libpq++.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/libpq++.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -c -r1.9 -r1.10
*** libpq++.h    2000/04/22 22:39:15    1.9
--- libpq++.h    2001/01/24 19:43:32    1.10
***************
*** 13,22 ****
   *     in the build environment the individual include files are not
   *   yet installed in a subdirectory.
   *
!  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
   * Portions Copyright (c) 1994, Regents of the University of California
   *
!  * $Id: libpq++.h,v 1.9 2000/04/22 22:39:15 tgl Exp $
   *
   *-------------------------------------------------------------------------
   */
--- 13,22 ----
   *     in the build environment the individual include files are not
   *   yet installed in a subdirectory.
   *
!  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
   * Portions Copyright (c) 1994, Regents of the University of California
   *
!  * $Id: libpq++.h,v 1.10 2001/01/24 19:43:32 momjian Exp $
   *
   *-------------------------------------------------------------------------
   */
Index: pgconnection.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgconnection.cc,v
retrieving revision 1.9
retrieving revision 1.10
diff -c -r1.9 -r1.10
*** pgconnection.cc    2000/04/22 22:39:15    1.9
--- pgconnection.cc    2000/07/27 19:44:01    1.10
***************
*** 10,16 ****
   * Copyright (c) 1994, Regents of the University of California
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgconnection.cc,v 1.9 2000/04/22 22:39:15
tglExp $ 
   *
   *-------------------------------------------------------------------------
   */
--- 10,16 ----
   * Copyright (c) 1994, Regents of the University of California
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgconnection.cc,v 1.10 2000/07/27 19:44:01
momjianExp $ 
   *
   *-------------------------------------------------------------------------
   */
***************
*** 46,61 ****
    // Close the connection only if needed
    // This feature will most probably be used by the derived classes that
    // need not close the connection after they are destructed.
!   if ( pgCloseConnection ) {
         if(pgResult) PQclear(pgResult);
         if(pgConn) PQfinish(pgConn);
    }
  }

  // PgConnection::connect
  // establish a connection to a backend
  ConnStatusType PgConnection::Connect(const char* conninfo)
  {
    // Connect to the database
    pgConn = PQconnectdb(conninfo);

--- 46,77 ----
    // Close the connection only if needed
    // This feature will most probably be used by the derived classes that
    // need not close the connection after they are destructed.
!   CloseConnection();
! }
!
!
! // PgConnection::CloseConnection()
! // close down the connection if there is one
! void PgConnection::CloseConnection()
! {
!   // if the connection is open, close it first
!   if ( pgCloseConnection ) {
         if(pgResult) PQclear(pgResult);
+        pgResult=NULL;
         if(pgConn) PQfinish(pgConn);
+        pgConn=NULL;
+        pgCloseConnection=0;
    }
  }

+
  // PgConnection::connect
  // establish a connection to a backend
  ConnStatusType PgConnection::Connect(const char* conninfo)
  {
+   // if the connection is open, close it first
+   CloseConnection();
+
    // Connect to the database
    pgConn = PQconnectdb(conninfo);

Index: pgconnection.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgconnection.h,v
retrieving revision 1.7
retrieving revision 1.10
diff -c -r1.7 -r1.10
*** pgconnection.h    2000/04/22 22:39:15    1.7
--- pgconnection.h    2001/02/10 02:31:30    1.10
***************
*** 10,19 ****
   *   NOTES
   *      Currently under construction.
   *
!  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
   * Portions Copyright (c) 1994, Regents of the University of California
   *
!  * $Id: pgconnection.h,v 1.7 2000/04/22 22:39:15 tgl Exp $
   *
   *-------------------------------------------------------------------------
   */
--- 10,19 ----
   *   NOTES
   *      Currently under construction.
   *
!  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
   * Portions Copyright (c) 1994, Regents of the University of California
   *
!  * $Id: pgconnection.h,v 1.10 2001/02/10 02:31:30 tgl Exp $
   *
   *-------------------------------------------------------------------------
   */
***************
*** 38,44 ****
  #endif

  extern "C" {
! #include "postgres.h"
  #include "libpq-fe.h"
  }

--- 38,44 ----
  #endif

  extern "C" {
! #include "postgres_fe.h"
  #include "libpq-fe.h"
  }

***************
*** 81,86 ****
--- 81,87 ----

  protected:
     ConnStatusType Connect(const char* conninfo);
+    void CloseConnection();
     string IntToString(int);
     // Default constructor is only available to subclasses
     PgConnection();
Index: pgcursordb.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgcursordb.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -c -r1.5 -r1.6
*** pgcursordb.h    2000/04/22 22:39:15    1.5
--- pgcursordb.h    2001/01/24 19:43:32    1.6
***************
*** 10,20 ****
   *   NOTES
   *      Currently under construction.
   *
!  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
   * Portions Copyright (c) 1994, Regents of the University of California
   *
   *
!  *  $Id: pgcursordb.h,v 1.5 2000/04/22 22:39:15 tgl Exp $
   *
   *-------------------------------------------------------------------------
   */
--- 10,20 ----
   *   NOTES
   *      Currently under construction.
   *
!  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
   * Portions Copyright (c) 1994, Regents of the University of California
   *
   *
!  *  $Id: pgcursordb.h,v 1.6 2001/01/24 19:43:32 momjian Exp $
   *
   *-------------------------------------------------------------------------
   */
Index: pgdatabase.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgdatabase.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -c -r1.8 -r1.9
*** pgdatabase.h    2000/04/22 22:39:15    1.8
--- pgdatabase.h    2001/01/24 19:43:32    1.9
***************
*** 10,20 ****
   *   NOTES
   *      Currently under construction.
   *
!  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
   * Portions Copyright (c) 1994, Regents of the University of California
   *
   *
!  *  $Id: pgdatabase.h,v 1.8 2000/04/22 22:39:15 tgl Exp $
   *
   *-------------------------------------------------------------------------
   */
--- 10,20 ----
   *   NOTES
   *      Currently under construction.
   *
!  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
   * Portions Copyright (c) 1994, Regents of the University of California
   *
   *
!  *  $Id: pgdatabase.h,v 1.9 2001/01/24 19:43:32 momjian Exp $
   *
   *-------------------------------------------------------------------------
   */
Index: pglobject.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pglobject.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -c -r1.5 -r1.6
*** pglobject.h    2000/04/22 22:39:15    1.5
--- pglobject.h    2001/01/24 19:43:32    1.6
***************
*** 7,17 ****
   *      declaration of the PGlobj class.
   *   PGlobj encapsulates a large object interface to Postgres backend
   *
!  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
   * Portions Copyright (c) 1994, Regents of the University of California
   *
   *
!  *  $Id: pglobject.h,v 1.5 2000/04/22 22:39:15 tgl Exp $
   *
   *-------------------------------------------------------------------------
   */
--- 7,17 ----
   *      declaration of the PGlobj class.
   *   PGlobj encapsulates a large object interface to Postgres backend
   *
!  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
   * Portions Copyright (c) 1994, Regents of the University of California
   *
   *
!  *  $Id: pglobject.h,v 1.6 2001/01/24 19:43:32 momjian Exp $
   *
   *-------------------------------------------------------------------------
   */
Index: pgtransdb.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgtransdb.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -c -r1.5 -r1.6
*** pgtransdb.h    2000/04/22 22:39:15    1.5
--- pgtransdb.h    2001/01/24 19:43:32    1.6
***************
*** 10,20 ****
   *   NOTES
   *      Currently under construction.
   *
!  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
   * Portions Copyright (c) 1994, Regents of the University of California
   *
   *
!  *  $Id: pgtransdb.h,v 1.5 2000/04/22 22:39:15 tgl Exp $
   *
   *-------------------------------------------------------------------------
   */
--- 10,20 ----
   *   NOTES
   *      Currently under construction.
   *
!  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
   * Portions Copyright (c) 1994, Regents of the University of California
   *
   *
!  *  $Id: pgtransdb.h,v 1.6 2001/01/24 19:43:32 momjian Exp $
   *
   *-------------------------------------------------------------------------
   */
Index: examples/Makefile
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/Makefile,v
retrieving revision 1.10
retrieving revision 1.12
diff -c -r1.10 -r1.12
*** examples/Makefile    2000/03/02 02:00:59    1.10
--- examples/Makefile    2000/06/17 00:10:20    1.12
***************
*** 15,33 ****
  #CXXFLAGS= $(CFLAGS) -Wno-error -Wno-unused -Wl,-Bdynamic
  CXXFLAGS= $(CFLAGS)

! INCLUDE_OPT= -I$(HEADERDIR)

- CXXFLAGS+= $(INCLUDE_OPT)
-
  LDFLAGS+= -L$(LIBPQDIR) -lpq++
-
- #
- # And where libpq goes, so goes the authentication stuff...
- #
- ifdef KRBVERS
- LDFLAGS+= $(KRBLIBS)
- CXXFLAGS+= $(KRBFLAGS)
- endif

  PROGS=    testlibpq0 testlibpq1 testlibpq2 testlibpq3 \
      testlibpq4 testlibpq5 testlibpq6 testlo
--- 15,23 ----
  #CXXFLAGS= $(CFLAGS) -Wno-error -Wno-unused -Wl,-Bdynamic
  CXXFLAGS= $(CFLAGS)

! CXXFLAGS+= -I$(HEADERDIR)

  LDFLAGS+= -L$(LIBPQDIR) -lpq++

  PROGS=    testlibpq0 testlibpq1 testlibpq2 testlibpq3 \
      testlibpq4 testlibpq5 testlibpq6 testlo
Index: examples/testlibpq0.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq0.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -c -r1.5 -r1.6
*** examples/testlibpq0.cc    1999/12/03 18:28:32    1.5
--- examples/testlibpq0.cc    2000/05/29 21:25:04    1.6
***************
*** 9,21 ****
   *
   *
   * IDENTIFICATION
!  *    $Header: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq0.cc,v 1.5 1999/12/03
18:28:32momjian Exp $ 
   *
   *-------------------------------------------------------------------------
   */

  #include <iostream.h>
! #include <libpq++.h>

  int main()
  {
--- 9,21 ----
   *
   *
   * IDENTIFICATION
!  *    $Header: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq0.cc,v 1.6 2000/05/29
21:25:04momjian Exp $ 
   *
   *-------------------------------------------------------------------------
   */

  #include <iostream.h>
! #include "libpq++.h"

  int main()
  {
Index: examples/testlibpq1.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq1.cc,v
retrieving revision 1.7
retrieving revision 1.8
diff -c -r1.7 -r1.8
*** examples/testlibpq1.cc    2000/04/25 21:00:29    1.7
--- examples/testlibpq1.cc    2000/05/29 21:25:04    1.8
***************
*** 8,14 ****

  #include <iostream.h>
  #include <iomanip.h>
! #include <libpq++.h>

  int main()
  {
--- 8,14 ----

  #include <iostream.h>
  #include <iomanip.h>
! #include "libpq++.h"

  int main()
  {
Index: examples/testlibpq2.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq2.cc,v
retrieving revision 1.8
retrieving revision 1.9
diff -c -r1.8 -r1.9
*** examples/testlibpq2.cc    2000/04/25 21:00:29    1.8
--- examples/testlibpq2.cc    2000/05/29 21:25:04    1.9
***************
*** 8,14 ****

  #include <iostream.h>
  #include <iomanip.h>
! #include <libpq++.h>

  int main()
  {
--- 8,14 ----

  #include <iostream.h>
  #include <iomanip.h>
! #include "libpq++.h"

  int main()
  {
Index: examples/testlibpq3.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq3.cc,v
retrieving revision 1.8
retrieving revision 1.9
diff -c -r1.8 -r1.9
*** examples/testlibpq3.cc    2000/04/25 21:00:29    1.8
--- examples/testlibpq3.cc    2000/05/29 21:25:04    1.9
***************
*** 9,15 ****

  #include <iostream.h>
  #include <iomanip.h>
! #include <libpq++.h>

  int main()
  {
--- 9,15 ----

  #include <iostream.h>
  #include <iomanip.h>
! #include "libpq++.h"

  int main()
  {
Index: examples/testlibpq4.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq4.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -c -r1.6 -r1.7
*** examples/testlibpq4.cc    2000/04/25 21:00:29    1.6
--- examples/testlibpq4.cc    2000/05/29 21:25:04    1.7
***************
*** 19,25 ****
   *
   */
  #include <iostream.h>
! #include <libpq++.h>
  #include <stdlib.h>

  main()
--- 19,25 ----
   *
   */
  #include <iostream.h>
! #include "libpq++.h"
  #include <stdlib.h>

  main()
Index: examples/testlibpq5.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq5.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -c -r1.6 -r1.7
*** examples/testlibpq5.cc    2000/04/25 21:00:29    1.6
--- examples/testlibpq5.cc    2000/05/29 21:25:04    1.7
***************
*** 27,33 ****
   *
   */
  #include <iostream.h>
! #include <libpq++.h>
  #include <stdlib.h>
  extern "C" {
  #include "postgres.h"        // for Postgres types
--- 27,33 ----
   *
   */
  #include <iostream.h>
! #include "libpq++.h"
  #include <stdlib.h>
  extern "C" {
  #include "postgres.h"        // for Postgres types
Index: examples/testlibpq6.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq6.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -c -r1.5 -r1.6
*** examples/testlibpq6.cc    2000/04/25 21:00:29    1.5
--- examples/testlibpq6.cc    2000/05/29 21:25:04    1.6
***************
*** 5,11 ****
   *
   */
  #include <iostream.h>
! #include <libpq++.h>
  #include <stdlib.h>

  main()
--- 5,11 ----
   *
   */
  #include <iostream.h>
! #include "libpq++.h"
  #include <stdlib.h>

  main()
Index: examples/testlo.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlo.cc,v
retrieving revision 1.7
retrieving revision 1.8
diff -c -r1.7 -r1.8
*** examples/testlo.cc    2000/04/25 21:00:29    1.7
--- examples/testlo.cc    2000/05/29 21:25:04    1.8
***************
*** 7,18 ****
   *
   *
   * IDENTIFICATION
!  *    $Header: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlo.cc,v 1.7 2000/04/25 21:00:29
momjianExp $ 
   *
   *-------------------------------------------------------------------------
   */
  #include <iostream.h>
! #include <libpq++.h>
  #include <stdlib.h>

  int main(int argc, char **argv)
--- 7,18 ----
   *
   *
   * IDENTIFICATION
!  *    $Header: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlo.cc,v 1.8 2000/05/29 21:25:04
momjianExp $ 
   *
   *-------------------------------------------------------------------------
   */
  #include <iostream.h>
! #include "libpq++.h"
  #include <stdlib.h>

  int main(int argc, char **argv)

pgsql-interfaces by date:

Previous
From: "J. T. Vermeulen"
Date:
Subject: Re: libpq++
Next
From: Tom Lane
Date:
Subject: Re: libpq++