If on one is has outstanding libpq++ patches, I will run libpq++ through
my new tools src/tools/pgindent/pgcppindent.  It uses astyle.  I can
also wait for 7.3 beta and run it then.

---------------------------------------------------------------------------

Neil Conway wrote:
> On Wed, 12 Jun 2002 20:29:21 +0200
> "Jeroen T. Vermeulen" <[EMAIL PROTECTED]> wrote:
> > I think libpqxx, the alternative to libpq++, is just about ready for
> > prime time.
> 
> Great -- I like libpqxx a lot, and I'd like to see it in 7.3. We should
> also probably keep libpq++ around for backward compatibility, but I
> suppose we can stop distributing it eventually.
> 
> > That means integrating it with the main source tree, I
> > suppose, but I have no idea where to start--particularly because libpqxx
> > has its own configure setup.
> 
> I took a brief look at libpqxx's configure setup and ISTM that you won't
> need to do a lot of work to integrate it into the PostgreSQL build system.
> Users won't need to specify '--with-postgres' anymore, and the rest of the
> configure options look pretty standard (gnu-ld, pic, etc.)
> 
> Is there a reason for keeping '--enable-postgres-dialect', when libpqxx
> is distributed with PostgreSQL?
> 
> Otherwise, if you put the code into src/interfaces/libpqxx and modify
> the PostgreSQL build system to be aware of it (as well as removing
> libpqxx's autoconf stuff), it shouldn't be too difficult.
> 
> Cheers,
> 
> Neil
> 
> -- 
> Neil Conway <[EMAIL PROTECTED]>
> PGP Key ID: DB3C29FC
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://archives.postgresql.org
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  [EMAIL PROTECTED]               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: pgconnection.cc
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/libpq++/pgconnection.cc,v
retrieving revision 1.14
diff -c -r1.14 pgconnection.cc
*** pgconnection.cc     15 Jun 2002 18:49:29 -0000      1.14
--- pgconnection.cc     15 Jun 2002 19:05:11 -0000
***************
*** 1,19 ****
  /*-------------------------------------------------------------------------
!  *
!  *   FILE
!  *    pgconnection.cc
!  *
!  *   DESCRIPTION
!  *      implementation of the PgConnection class.
!  *   PgConnection encapsulates a frontend to backend connection
!  *
!  * Copyright (c) 1994, Regents of the University of California
!  *
!  * IDENTIFICATION
!  *      $Header: /cvsroot/pgsql/src/interfaces/libpq++/pgconnection.cc,v 1.14 
2002/06/15 18:49:29 momjian Exp $
!  *
!  *-------------------------------------------------------------------------
!  */
  
  #include "pgconnection.h"
  
--- 1,19 ----
  /*-------------------------------------------------------------------------
! *
! *     FILE
! *     pgconnection.cc
! *
! *     DESCRIPTION
! *        implementation of the PgConnection class.
! *     PgConnection encapsulates a frontend to backend connection
! *
! * Copyright (c) 1994, Regents of the University of California
! *
! * IDENTIFICATION
! *       $Header: /cvsroot/pgsql/src/interfaces/libpq++/pgconnection.cc,v 1.14 
2002/06/15 18:49:29 momjian Exp $
! *
! *-------------------------------------------------------------------------
! */
  
  #include "pgconnection.h"
  
***************
*** 28,71 ****
  // ****************************************************************
  // default constructor -- initialize everything
  PgConnection::PgConnection()
!       : pgConn(NULL), pgResult(NULL), pgCloseConnection(false)
  {}
  
  
  // constructor -- checks environment variable for database name
  // Now uses PQconnectdb
  PgConnection::PgConnection(const char* conninfo)
!       : pgConn(NULL), pgResult(NULL), pgCloseConnection(true)
  {
!   // Connect to the database
!   Connect(conninfo);
  }
  
  
  // destructor - closes down the connection and cleanup
  PgConnection::~PgConnection()
  {
!   // 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 = false;
!   }
  }
  
  
--- 28,73 ----
  // ****************************************************************
  // default constructor -- initialize everything
  PgConnection::PgConnection()
!               : pgConn(NULL), pgResult(NULL), pgCloseConnection(false)
  {}
  
  
  // constructor -- checks environment variable for database name
  // Now uses PQconnectdb
+ 
  PgConnection::PgConnection(const char* conninfo)
!               : pgConn(NULL), pgResult(NULL), pgCloseConnection(true)
  {
!       // Connect to the database
!       Connect(conninfo);
  }
  
  
  // destructor - closes down the connection and cleanup
  PgConnection::~PgConnection()
  {
!       // 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 = false;
!       }
  }
  
  
***************
*** 73,112 ****
  // 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);
  
!   // Now we have a connection we must close (even if it's bad!)
!   pgCloseConnection = true;
!   
!   // Status will return either CONNECTION_OK or CONNECTION_BAD
!   return Status();
  }
  
  // PgConnection::status -- return connection or result status
  ConnStatusType PgConnection::Status() const
  {
!   return PQstatus(pgConn);
  }
  
  // PgConnection::exec  -- send a query to the backend
  ExecStatusType PgConnection::Exec(const char* query)
  {
!   // Clear the result stucture if needed
!   if (pgResult)
!     PQclear(pgResult); 
! 
!   // Execute the given query
!   pgResult = PQexec(pgConn, query);
!   
!   // Return the status
!   if (pgResult)
!       return PQresultStatus(pgResult);
!   else 
!       return PGRES_FATAL_ERROR;
  }
  
  // Return true if the Postgres command was executed OK
--- 75,114 ----
  // 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);
  
!       // Now we have a connection we must close (even if it's bad!)
!       pgCloseConnection = true;
  
!       // Status will return either CONNECTION_OK or CONNECTION_BAD
!       return Status();
  }
  
  // PgConnection::status -- return connection or result status
  ConnStatusType PgConnection::Status() const
  {
!       return PQstatus(pgConn);
  }
  
  // PgConnection::exec  -- send a query to the backend
  ExecStatusType PgConnection::Exec(const char* query)
  {
!       // Clear the result stucture if needed
!       if (pgResult)
!               PQclear(pgResult);
! 
!       // Execute the given query
!       pgResult = PQexec(pgConn, query);
! 
!       // Return the status
!       if (pgResult)
!               return PQresultStatus(pgResult);
!       else
!               return PGRES_FATAL_ERROR;
  }
  
  // Return true if the Postgres command was executed OK
***************
*** 125,158 ****
  // PgConnection::notifies() -- returns a notification from a list of unhandled 
notifications
  PGnotify* PgConnection::Notifies()
  {
!   return PQnotifies(pgConn);
  }
  
  // From Integer To String Conversion Function
  string PgConnection::IntToString(int n)
  {
!   char buffer [4*sizeof(n) + 2];
!   sprintf(buffer, "%d", n);
!   return buffer;
  }
  
  bool PgConnection::ConnectionBad() const
! { 
!   return Status() == CONNECTION_BAD; 
  }
  
  const char* PgConnection::ErrorMessage() const
! { 
!   return (const char *)PQerrorMessage(pgConn); 
  }
!   
  const char* PgConnection::DBName() const
! { 
!   return (const char *)PQdb(pgConn); 
  }
  
  PQnoticeProcessor PgConnection::SetNoticeProcessor(PQnoticeProcessor proc, void *arg)
  {
!   return PQsetNoticeProcessor(pgConn, proc, arg);
  }
  
--- 127,160 ----
  // PgConnection::notifies() -- returns a notification from a list of unhandled 
notifications
  PGnotify* PgConnection::Notifies()
  {
!       return PQnotifies(pgConn);
  }
  
  // From Integer To String Conversion Function
  string PgConnection::IntToString(int n)
  {
!       char buffer [4*sizeof(n) + 2];
!       sprintf(buffer, "%d", n);
!       return buffer;
  }
  
  bool PgConnection::ConnectionBad() const
! {
!       return Status() == CONNECTION_BAD;
  }
  
  const char* PgConnection::ErrorMessage() const
! {
!       return (const char *)PQerrorMessage(pgConn);
  }
! 
  const char* PgConnection::DBName() const
! {
!       return (const char *)PQdb(pgConn);
  }
  
  PQnoticeProcessor PgConnection::SetNoticeProcessor(PQnoticeProcessor proc, void *arg)
  {
!       return PQsetNoticeProcessor(pgConn, proc, arg);
  }
  

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to