]> granicus.if.org Git - postgresql/blobdiff - src/interfaces/libpq++/pgconnection.h
Here's a version of my suggested diffs transplanted to 7.1 beta 5. I'm
[postgresql] / src / interfaces / libpq++ / pgconnection.h
index 4310dac61db3b823ab951a82c01359e28093b5ee..76cb6ec3670ad45d5723465f0a8da3cedd490abb 100644 (file)
@@ -13,7 +13,7 @@
  * 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 $
+ * $Id: pgconnection.h,v 1.11 2001/05/09 17:29:10 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -43,7 +43,9 @@ extern "C" {
 }
 
 #ifdef HAVE_NAMESPACE_STD
-using namespace std;
+#define PGSTD std::
+#else
+#define PGSTD
 #endif
 
 
@@ -57,21 +59,21 @@ using namespace std;
 // derived from this class to obtain the connection interface.
 class PgConnection {
 protected:
-  PGconn* pgConn;                              // Connection Structure
+  PGconn* pgConn;                      // Connection Structure
   PGresult* pgResult;                  // Current Query Result
-  int pgCloseConnection; // TRUE if connection should be closed by destructor
+  bool pgCloseConnection; // true if connection should be closed by destructor
   
 public:
-   PgConnection(const char* conninfo);         // use reasonable & environment defaults
+   explicit PgConnection(const char* conninfo); // use reasonable & environment defaults
    virtual ~PgConnection();                    // close connection and clean up
    
    // Connection status and error messages
-   ConnStatusType Status();
-   int ConnectionBad();
-   const char* ErrorMessage();
+   ConnStatusType Status() const;
+   bool ConnectionBad() const;
+   const char* ErrorMessage() const;
   
    // returns the database name of the connection
-   const char* DBName();
+   const char* DBName() const;
 
    // Query Execution interface
    ExecStatusType Exec(const char* query);  // send a query to the backend
@@ -82,7 +84,7 @@ public:
 protected:
    ConnStatusType Connect(const char* conninfo);
    void CloseConnection();
-   string IntToString(int);
+   static PGSTD string IntToString(int);
    // Default constructor is only available to subclasses
    PgConnection();
 
@@ -93,4 +95,10 @@ private:
    PgConnection& operator= (const PgConnection&);
 };
 
+
+#ifdef HAVE_NAMESPACE_STD
+#undef PGSTD
+#endif
+
+
 #endif // PGCONNECTION_H