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
00088 TDBResult (const TDBResult&);
00089 TDBResult& operator=(const TDBResult&);
00090
00096 TDBResult (PGresult* result);
00097
00098
00099 TString *myErrorMessage;
00100
00101
00102 TString *myValue;
00103
00104
00105 PGresult* myResult;
00106
00107
00108 int myTuples;
00109
00110
00111 int myFields;
00112 };
00113
00114 #endif // _T_DB_RESULT_HH