12 #ifndef ROOT_TPgSQLStatement
13 #define ROOT_TPgSQLStatement
18 #include <pg_config.h>
20 #define pgsql_success(x) (((x) == PGRES_EMPTY_QUERY) \
21 || ((x) == PGRES_COMMAND_OK) \
22 || ((x) == PGRES_TUPLES_OK))
30 class TPgSQLStatement :
public TSQLStatement {
38 Int_t fIterationCount;
44 Bool_t IsSetParsMode()
const {
return fWorkingMode==1; }
45 Bool_t IsResultSetMode()
const {
return fWorkingMode==2; }
47 Bool_t SetSQLParamType(Int_t npar,
int sqltype,
bool sig,
int sqlsize = 0);
49 long double ConvertToNumeric(Int_t npar);
50 const char *ConvertToString(Int_t npar);
53 void SetBuffersNumber(Int_t n);
55 void ConvertTimeToUTC(
const TString &PQvalue, Int_t& year, Int_t& month, Int_t& day, Int_t& hour, Int_t& min, Int_t& sec);
58 TPgSQLStatement(PgSQL_Stmt_t* stmt, Bool_t errout = kTRUE);
59 virtual ~TPgSQLStatement();
61 virtual void Close(Option_t * =
"");
63 virtual Int_t GetBufferLength()
const {
return 1; }
64 virtual Int_t GetNumParameters();
66 virtual Bool_t SetNull(Int_t npar);
67 virtual Bool_t SetInt(Int_t npar, Int_t value);
68 virtual Bool_t SetUInt(Int_t npar, UInt_t value);
69 virtual Bool_t SetLong(Int_t npar, Long_t value);
70 virtual Bool_t SetLong64(Int_t npar, Long64_t value);
71 virtual Bool_t SetULong64(Int_t npar, ULong64_t value);
72 virtual Bool_t SetDouble(Int_t npar, Double_t value);
73 virtual Bool_t SetString(Int_t npar,
const char* value, Int_t maxsize = 256);
74 virtual Bool_t SetBinary(Int_t npar,
void* mem, Long_t size, Long_t maxsize = 0x1000);
75 virtual Bool_t SetLargeObject(Int_t npar,
void* mem, Long_t size, Long_t maxsize = 0x1000);
76 virtual Bool_t SetDate(Int_t npar, Int_t year, Int_t month, Int_t day);
77 virtual Bool_t SetTime(Int_t npar, Int_t hour, Int_t min, Int_t sec);
78 virtual Bool_t SetDatime(Int_t npar, Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec);
79 virtual Bool_t SetTimestamp(Int_t npar, Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec, Int_t frac = 0);
80 virtual Bool_t SetTimestamp(Int_t npar,
const TTimeStamp& tm);
82 virtual Bool_t NextIteration();
84 virtual Bool_t Process();
85 virtual Int_t GetNumAffectedRows();
87 virtual Bool_t StoreResult();
88 virtual Int_t GetNumFields();
89 virtual const char *GetFieldName(Int_t nfield);
90 virtual Bool_t NextResultRow();
92 virtual Bool_t IsNull(Int_t npar);
93 virtual Int_t GetInt(Int_t npar);
94 virtual UInt_t GetUInt(Int_t npar);
95 virtual Long_t GetLong(Int_t npar);
96 virtual Long64_t GetLong64(Int_t npar);
97 virtual ULong64_t GetULong64(Int_t npar);
98 virtual Double_t GetDouble(Int_t npar);
99 virtual const char *GetString(Int_t npar);
100 virtual Bool_t GetBinary(Int_t npar,
void* &mem, Long_t& size);
101 virtual Bool_t GetLargeObject(Int_t npar,
void* &mem, Long_t& size);
102 virtual Bool_t GetDate(Int_t npar, Int_t& year, Int_t& month, Int_t& day);
103 virtual Bool_t GetTime(Int_t npar, Int_t& hour, Int_t& min, Int_t& sec);
104 virtual Bool_t GetDatime(Int_t npar, Int_t& year, Int_t& month, Int_t& day, Int_t& hour, Int_t& min, Int_t& sec);
105 virtual Bool_t GetTimestamp(Int_t npar, Int_t& year, Int_t& month, Int_t& day, Int_t& hour, Int_t& min, Int_t& sec, Int_t&);
106 virtual Bool_t GetTimestamp(Int_t npar, TTimeStamp& tm);
108 ClassDef(TPgSQLStatement, 0);