00001 //---------------------------------------------------------------------------// 00002 //bb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nu// 00003 // // 00004 // MAJORANA Simulation // 00005 // // 00006 // This code implementation is the intellectual property of the // 00007 // MAJORANA Collaboration. It is based on Geant4, an intellectual // 00008 // property of the RD44 GEANT4 collaboration. // 00009 // // 00010 // ********************* // 00011 // // 00012 // Neither the authors of this software system, nor their employing // 00013 // institutes, nor the agencies providing financial support for this // 00014 // work make any representation or warranty, express or implied, // 00015 // regarding this software system or assume any liability for its use. // 00016 // By copying, distributing or modifying the Program (or any work based // 00017 // on on the Program) you indicate your acceptance of this statement, // 00018 // and all its terms. // 00019 // // 00020 //bb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nu// 00021 //---------------------------------------------------------------------------// 00032 // Begin description of class here 00039 // End class description 00040 // 00045 // 00046 // --------------------------------------------------------------------------// 00056 // --------------------------------------------------------------------------// 00057 00058 #ifndef _MJDatabaseCONNECTION_HH 00059 #define _MJDatabaseCONNECTION_HH 00060 00061 //---------------------------------------------------------------------------// 00062 #include "libpq-fe.h" 00063 #include <string> 00064 #include <iostream> 00065 00066 using namespace std; 00067 00068 //---------------------------------------------------------------------------// 00069 00070 class MJDatabaseConnection 00071 { 00072 public: 00073 00074 //default constructor 00075 MJDatabaseConnection(); 00076 00077 //copy constructor 00078 MJDatabaseConnection(const MJDatabaseConnection &); 00079 00080 //destructor 00081 ~MJDatabaseConnection(); 00082 00083 //public interface 00084 00085 PGresult* qResult(string); 00086 PGresult* query(string); 00087 void qDone(PGresult*); 00088 bool connect(); 00089 PGconn* GetConnection(){ return fconn;} 00090 00091 static string getPGVersion(){ return PG_VERSION;} 00092 //protected members 00093 protected: 00094 00095 00096 //private members 00097 private: 00098 00099 void getConnectionInfo(); 00100 00101 static string PG_VERSION; //version of postgress 00102 PGconn *fconn; 00103 PGresult *fres; 00104 const char *fconninfo; 00105 00106 }; 00107 #endif