Main Page   Class Hierarchy   Compound List   File List   Compound Members  

TDBResult.hh

00001 #ifndef _T_DB_RESULT_HH
00002 #define _T_DB_RESULT_HH
00003 
00004 #include <libpq-fe.h>
00005 #include "TString.hh"
00006 
00016 class TDBResult
00017 {
00018 public:
00019   
00023   ~TDBResult ();
00024   
00030   inline bool IsValid () { return myResult; }
00031   
00037   TString& ErrorMessage ();
00038   
00044   inline int Tuples () { return myTuples; }
00045   
00051   inline int Fields () { return myFields; }
00052   
00058   inline bool IsNull (int tuple, int field)
00059   {
00060     return PQgetisnull (myResult, tuple, field);
00061   }
00062   
00070   TString& Value (int tuple, int field);
00071   
00081   TString* Value2 (int tuple, int field);
00082   
00083 private:
00084   
00085   friend class TDBConnection;
00086   
00087   /* FIXME: No copying for now! */
00088   TDBResult (const TDBResult&);
00089   TDBResult& operator=(const TDBResult&);
00090   
00096   TDBResult (PGresult* result);
00097   
00098   /* Error message. */
00099   TString *myErrorMessage;
00100   
00101   /* Result from Value() */
00102   TString *myValue;
00103   
00104   /* PostgreSQL result */
00105   PGresult* myResult;
00106   
00107   /* Number of tuples in result. */
00108   int myTuples;
00109   
00110   /* Number of fields in result. */
00111   int myFields;
00112 };
00113 
00114 #endif // _T_DB_RESULT_HH

Generated on Sat Feb 15 18:37:16 2003 for Tools by doxygen1.3-rc2