12 #ifndef ROOT_TODBCStatement
13 #define ROOT_TODBCStatement
19 typedef void * SQLHSTMT;
20 typedef UShort_t SQLUSMALLINT;
21 typedef UInt_t SQLUINTEGER;
22 typedef Short_t SQLSMALLINT;
23 typedef Short_t SQLRETURN;
31 class TODBCStatement :
public TSQLStatement {
35 struct ODBCBufferRec_t;
37 struct ODBCBufferRec_t {
51 Int_t fBufferPreferredSize;
52 ODBCBufferRec_t *fBuffer;
56 SQLUSMALLINT *fStatusBuffer;
58 SQLUINTEGER fNumParsProcessed;
59 SQLUINTEGER fNumRowsFetched;
60 ULong64_t fLastResultRow;
62 void *GetParAddr(Int_t npar, Int_t roottype = 0, Int_t length = 0);
63 long double ConvertToNumeric(Int_t npar);
64 const char *ConvertToString(Int_t npar);
66 Bool_t BindColumn(Int_t ncol, SQLSMALLINT sqltype, SQLUINTEGER size);
67 Bool_t BindParam(Int_t n, Int_t type, Int_t size = 1024);
69 Bool_t ExtractErrors(SQLRETURN retcode,
const char* method);
71 void SetNumBuffers(Int_t isize, Int_t ilen);
74 Bool_t IsParSettMode()
const {
return fWorkingMode==1; }
75 Bool_t IsResultSet()
const {
return fWorkingMode==2; }
78 TODBCStatement(SQLHSTMT stmt, Int_t rowarrsize, Bool_t errout = kTRUE);
79 virtual ~TODBCStatement();
81 virtual void Close(Option_t * =
"");
83 virtual Int_t GetBufferLength()
const {
return fBufferLength; }
84 virtual Int_t GetNumParameters();
86 virtual Bool_t SetNull(Int_t npar);
87 virtual Bool_t SetInt(Int_t npar, Int_t value);
88 virtual Bool_t SetUInt(Int_t npar, UInt_t value);
89 virtual Bool_t SetLong(Int_t npar, Long_t value);
90 virtual Bool_t SetLong64(Int_t npar, Long64_t value);
91 virtual Bool_t SetULong64(Int_t npar, ULong64_t value);
92 virtual Bool_t SetDouble(Int_t npar, Double_t value);
93 virtual Bool_t SetString(Int_t npar,
const char* value, Int_t maxsize = 256);
94 virtual Bool_t SetBinary(Int_t npar,
void* mem, Long_t size, Long_t maxsize = 0x1000);
95 virtual Bool_t SetDate(Int_t npar, Int_t year, Int_t month, Int_t day);
96 virtual Bool_t SetTime(Int_t npar, Int_t hour, Int_t min, Int_t sec);
97 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);
98 using TSQLStatement::SetTimestamp;
99 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);
101 virtual Bool_t NextIteration();
103 virtual Bool_t Process();
104 virtual Int_t GetNumAffectedRows();
106 virtual Bool_t StoreResult();
107 virtual Int_t GetNumFields();
108 virtual const char *GetFieldName(Int_t nfield);
109 virtual Bool_t NextResultRow();
111 virtual Bool_t IsNull(Int_t);
112 virtual Int_t GetInt(Int_t npar);
113 virtual UInt_t GetUInt(Int_t npar);
114 virtual Long_t GetLong(Int_t npar);
115 virtual Long64_t GetLong64(Int_t npar);
116 virtual ULong64_t GetULong64(Int_t npar);
117 virtual Double_t GetDouble(Int_t npar);
118 virtual const char *GetString(Int_t npar);
119 virtual Bool_t GetBinary(Int_t npar,
void* &mem, Long_t& size);
120 virtual Bool_t GetDate(Int_t npar, Int_t& year, Int_t& month, Int_t& day);
121 virtual Bool_t GetTime(Int_t npar, Int_t& hour, Int_t& min, Int_t& sec);
122 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);
123 using TSQLStatement::GetTimestamp;
124 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&);
126 ClassDef(TODBCStatement, 0);