32#define pgsql_success(x) (((x) == PGRES_EMPTY_QUERY) \ 
   33                        || ((x) == PGRES_COMMAND_OK) \ 
   34                        || ((x) == PGRES_TUPLES_OK)) 
 
   42#include "libpq/libpq-fs.h" 
   58   fParamLengths(nullptr),
 
   59   fParamFormats(nullptr),
 
   64   if (fStmt->fRes != 
nullptr) {
 
   78      SetBuffersNumber(fNumResultCols);
 
  111#define CheckStmt(method, res)                          \ 
  115         SetError(-1,"Statement handle is 0",method);   \ 
  120#define CheckErrNo(method, force, wtf)                  \ 
  122      int stmterrno = PQresultStatus(fStmt->fRes);      \ 
  123      if ((stmterrno!=0) || force) {                        \ 
  124         const char* stmterrmsg = PQresultErrorMessage(fStmt->fRes);  \ 
  125         if (stmterrno==0) { stmterrno = -1; stmterrmsg = "PgSQL statement error"; } \ 
  126         SetError(stmterrno, stmterrmsg, method);               \ 
  131#define CheckErrResult(method, pqresult, retVal)         \ 
  133      ExecStatusType stmterrno=PQresultStatus(pqresult); \ 
  134      if (!pgsql_success(stmterrno)) {                   \ 
  135       const char* stmterrmsg = PQresultErrorMessage(fStmt->fRes);  \ 
  136       SetError(stmterrno, stmterrmsg, method);                     \ 
  142#define RollBackTransaction(method)                          \ 
  144      PGresult *resnum=PQexec(fStmt->fConn,"COMMIT");        \ 
  145      CheckErrResult("RollBackTransaction", resnum, kFALSE); \ 
  150#define CheckGetField(method, res)                      \ 
  153      if (!IsResultSetMode()) {                         \ 
  154         SetError(-1,"Cannot get statement parameters",method); \ 
  157      if ((npar<0) || (npar>=fNumBuffers)) {            \ 
  158         SetError(-1,Form("Invalid parameter number %d", npar),method); \ 
  178                                 (
const char* 
const*)
fBind,
 
  284      SetError(-1,
"Cannot call for that statement",
"NextIteration");
 
  293                               (
const char* 
const*)
fBind,
 
  371      return (
long double)0;
 
  477      delete [] (
unsigned char*) 
mem;
 
  478      mem = (
void*) 
new unsigned char[
sz];
 
  521      delete [] (
unsigned char*) 
mem;
 
  522      mem = (
void*) 
new unsigned char[
sz];
 
  564   Int_t min = 
d.GetMinute();
 
  690      SetError(-1, 
"Date before year 1970 does not supported by TTimeStamp type", 
"GetTimestamp");
 
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
 
unsigned long long ULong64_t
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
winID h TVirtualViewer3D TVirtualGLPainter p
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
 
#define CheckErrNo(method, force, res)
 
#define CheckGetField(method, res)
 
#define CheckStmt(method, res)
 
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
 
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
 
Bool_t SetDatime(Int_t npar, Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec) final
Set parameter value as date & time.
 
void ConvertTimeToUTC(const TString &PQvalue, Int_t &year, Int_t &month, Int_t &day, Int_t &hour, Int_t &min, Int_t &sec)
 
void SetBuffersNumber(Int_t n)
Allocate buffers for statement parameters/ result fields.
 
Int_t fNumResultRows
data type (OID)
 
UInt_t GetUInt(Int_t npar) final
Return field value as unsigned integer.
 
Bool_t SetTime(Int_t npar, Int_t hour, Int_t min, Int_t sec) final
Set parameter value as time.
 
long double ConvertToNumeric(Int_t npar)
Convert field to numeric value.
 
Bool_t GetTime(Int_t npar, Int_t &hour, Int_t &min, Int_t &sec) final
Return field value as time.
 
Bool_t SetLargeObject(Int_t npar, void *mem, Long_t size, Long_t maxsize=0x1000) final
Set parameter value to large object and immediately insert the large object into DB.
 
Bool_t IsResultSetMode() const
 
TPgSQLStatement(PgSQL_Stmt_t *stmt, Bool_t errout=kTRUE)
Normal constructor.
 
int * fParamLengths
number of iteration
 
Bool_t GetDate(Int_t npar, Int_t &year, Int_t &month, Int_t &day) final
Return field value as date.
 
Int_t GetInt(Int_t npar) final
Return field value as integer.
 
Int_t GetNumParameters() final
Return number of statement parameters.
 
const char * GetString(Int_t npar) final
Return field value as string.
 
Bool_t SetDate(Int_t npar, Int_t year, Int_t month, Int_t day) final
Set parameter value as date.
 
Bool_t GetLargeObject(Int_t npar, void *&mem, Long_t &size) final
Return large object whose oid is in the given field.
 
Bool_t SetInt(Int_t npar, Int_t value) final
Set parameter value as integer.
 
ULong64_t GetULong64(Int_t npar) final
Return field value as unsigned 64-bit integer.
 
Long_t GetLong(Int_t npar) final
Return field value as long integer.
 
Bool_t SetSQLParamType(Int_t npar, Bool_t isbinary=kFALSE, Int_t param_len=0, Int_t maxsize=0)
Set parameter type to be used as buffer.
 
Int_t fIterationCount
1 - setting parameters, 2 - retrieving results
 
Int_t fNumBuffers
executed statement
 
Int_t fWorkingMode
array of column names
 
Bool_t GetBinary(Int_t npar, void *&mem, Long_t &size) final
Return field value as binary array.
 
Bool_t IsSetParsMode() const
 
Bool_t IsNull(Int_t npar) final
Checks if field value is null.
 
Int_t GetNumFields() final
Return number of fields in result set.
 
Double_t GetDouble(Int_t npar) final
Return field value as double.
 
Bool_t SetDouble(Int_t npar, Double_t value) final
Set parameter value as double.
 
Bool_t NextResultRow() final
Shift cursor to nect row in result set.
 
Long64_t GetLong64(Int_t npar) final
Return field value as 64-bit integer.
 
Bool_t GetDatime(Int_t npar, Int_t &year, Int_t &month, Int_t &day, Int_t &hour, Int_t &min, Int_t &sec) final
Return field value as date & time.
 
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) final
Set parameter value as timestamp.
 
Int_t GetNumAffectedRows() final
Return number of affected rows after statement is processed.
 
Bool_t SetLong(Int_t npar, Long_t value) final
Set parameter value as long integer.
 
Bool_t StoreResult() final
Store result of statement processing to access them via GetInt(), GetDouble() and so on methods.
 
Bool_t SetUInt(Int_t npar, UInt_t value) final
Set parameter value as unsigned integer.
 
const char * GetFieldName(Int_t nfield) final
Returns field name in result set.
 
Bool_t SetNull(Int_t npar) final
Set NULL as parameter value.
 
const char * ConvertToString(Int_t npar)
Convert field value to string.
 
Bool_t SetULong64(Int_t npar, ULong64_t value) final
Set parameter value as unsigned 64-bit integer.
 
char ** fBind
number of statement parameters
 
void FreeBuffers()
Release all buffers, used by statement.
 
Bool_t SetLong64(Int_t npar, Long64_t value) final
Set parameter value as 64-bit integer.
 
virtual ~TPgSQLStatement()
Destructor.
 
Bool_t SetString(Int_t npar, const char *value, Int_t maxsize=256) final
Set parameter value as string.
 
Bool_t SetBinary(Int_t npar, void *mem, Long_t size, Long_t maxsize=0x1000) final
Set parameter value as binary data.
 
Bool_t Process() final
Process statement.
 
int * fParamFormats
length of column
 
char ** fFieldName
array of data for input
 
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 &) final
Return field value as time stamp.
 
Bool_t NextIteration() final
Increment iteration counter for statement, where parameter can be set.
 
void Close(Option_t *="") final
Close statement.
 
void SetError(Int_t code, const char *msg, const char *method=nullptr)
set new values for error fields if method specified, displays error message
 
void ClearError()
reset error fields
 
const char * Data() const
 
Ssiz_t Last(char c) const
Find last occurrence of a character c.
 
A zero length substring is legal.
 
The TTimeStamp encapsulates seconds and ns since EPOCH.
 
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
 
T1 Sign(T1 a, T2 b)
Returns a value with the magnitude of a and the sign of b.