Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TSQLStatement.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/net:$Id$
0002 // Author: Sergey Linev   6/02/2006
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TSQLStatement
0013 #define ROOT_TSQLStatement
0014 
0015 #include "TObject.h"
0016 #include "TString.h"
0017 #include "TDatime.h"
0018 #include "TTimeStamp.h"
0019 #include <vector>
0020 
0021 class TSQLStatement : public TObject {
0022 
0023 protected:
0024    TSQLStatement(Bool_t errout = kTRUE) { fErrorOut = errout; }
0025 
0026    Int_t     fErrorCode{0};      // error code of last operation
0027    TString   fErrorMsg;          // error message of last operation
0028    Bool_t    fErrorOut{kFALSE};  // enable error output
0029 
0030    void                ClearError();
0031    void                SetError(Int_t code, const char* msg, const char *method = nullptr);
0032 
0033 public:
0034    virtual ~TSQLStatement() = default;
0035 
0036    virtual Int_t       GetBufferLength() const = 0;
0037    virtual Int_t       GetNumParameters() = 0;
0038 
0039    virtual Bool_t      NextIteration() = 0;
0040 
0041    virtual void        Close(Option_t * = "") {}
0042 
0043    virtual Bool_t      SetNull(Int_t) { return kFALSE; }
0044    virtual Bool_t      SetInt(Int_t, Int_t) { return kFALSE; }
0045    virtual Bool_t      SetUInt(Int_t, UInt_t) { return kFALSE; }
0046    virtual Bool_t      SetLong(Int_t, Long_t) { return kFALSE; }
0047    virtual Bool_t      SetLong64(Int_t, Long64_t) { return kFALSE; }
0048    virtual Bool_t      SetULong64(Int_t, ULong64_t) { return kFALSE; }
0049    virtual Bool_t      SetDouble(Int_t, Double_t) { return kFALSE; }
0050    virtual Bool_t      SetString(Int_t, const char*, Int_t = 256) { return kFALSE; }
0051    virtual Bool_t      SetDate(Int_t, Int_t, Int_t, Int_t) { return kFALSE; }
0052            Bool_t      SetDate(Int_t, const TDatime&);
0053    virtual Bool_t      SetTime(Int_t, Int_t, Int_t, Int_t) { return kFALSE; }
0054            Bool_t      SetTime(Int_t, const TDatime&);
0055    virtual Bool_t      SetDatime(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Int_t) { return kFALSE; }
0056            Bool_t      SetDatime(Int_t, const TDatime&);
0057    virtual Bool_t      SetTimestamp(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Int_t = 0);
0058    virtual Bool_t      SetTimestamp(Int_t, const TTimeStamp&);
0059            Bool_t      SetTimestamp(Int_t, const TDatime&);
0060    virtual void        SetTimeFormating(const char*) {}
0061    virtual Bool_t      SetBinary(Int_t, void*, Long_t, Long_t = 0x1000) { return kFALSE; }
0062    virtual Bool_t      SetLargeObject(Int_t col, void* mem, Long_t size, Long_t maxsize = 0x1000) { return SetBinary(col, mem, size, maxsize); }
0063 
0064    virtual Bool_t      SetVInt(Int_t, const std::vector<Int_t>, const char*, const char*) { return kFALSE; }
0065    virtual Bool_t      SetVUInt(Int_t, const std::vector<UInt_t>, const char*, const char*) { return kFALSE; }
0066    virtual Bool_t      SetVLong(Int_t, const std::vector<Long_t>, const char*, const char*) { return kFALSE; }
0067    virtual Bool_t      SetVLong64(Int_t, const std::vector<Long64_t>, const char*, const char*) { return kFALSE; }
0068    virtual Bool_t      SetVULong64(Int_t, const std::vector<ULong64_t>, const char*, const char*) { return kFALSE; }
0069    virtual Bool_t      SetVDouble(Int_t, const std::vector<Double_t>, const char*, const char*) { return kFALSE; }
0070 
0071    virtual Bool_t      Process() = 0;
0072    virtual Int_t       GetNumAffectedRows() { return 0; }
0073 
0074    virtual Bool_t      StoreResult() = 0;
0075    virtual Int_t       GetNumFields() = 0;
0076    virtual const char *GetFieldName(Int_t) = 0;
0077    virtual Bool_t      SetMaxFieldSize(Int_t, Long_t) { return kFALSE; }
0078    virtual Bool_t      NextResultRow() = 0;
0079 
0080    virtual Bool_t      IsNull(Int_t) { return kTRUE; }
0081    virtual Int_t       GetInt(Int_t) { return 0; }
0082    virtual UInt_t      GetUInt(Int_t) { return 0; }
0083    virtual Long_t      GetLong(Int_t) { return 0; }
0084    virtual Long64_t    GetLong64(Int_t) { return 0; }
0085    virtual ULong64_t   GetULong64(Int_t) { return 0; }
0086    virtual Double_t    GetDouble(Int_t) { return 0.; }
0087    virtual const char *GetString(Int_t) { return nullptr; }
0088    virtual Bool_t      GetBinary(Int_t, void* &, Long_t&) { return kFALSE; }
0089    virtual Bool_t      GetLargeObject(Int_t col, void* &mem, Long_t& size) { return GetBinary(col, mem, size); }
0090 
0091    virtual Bool_t      GetDate(Int_t, Int_t&, Int_t&, Int_t&) { return kFALSE; }
0092    virtual Bool_t      GetTime(Int_t, Int_t&, Int_t&, Int_t&) { return kFALSE; }
0093    virtual Bool_t      GetDatime(Int_t, Int_t&, Int_t&, Int_t&, Int_t&, Int_t&, Int_t&) { return kFALSE; }
0094            TDatime     GetDatime(Int_t);
0095            Int_t       GetYear(Int_t);
0096            Int_t       GetMonth(Int_t);
0097            Int_t       GetDay(Int_t);
0098            Int_t       GetHour(Int_t);
0099            Int_t       GetMinute(Int_t);
0100            Int_t       GetSecond(Int_t);
0101            Int_t       GetSecondsFraction(Int_t);
0102    virtual Bool_t      GetTimestamp(Int_t, Int_t&, Int_t&, Int_t&, Int_t&, Int_t&, Int_t&, Int_t&);
0103    virtual Bool_t      GetTimestamp(Int_t, TTimeStamp&);
0104            TDatime     GetTimestamp(Int_t);
0105    virtual Bool_t      GetVInt(Int_t, std::vector<Int_t>&) { return kFALSE; }
0106    virtual Bool_t      GetVUInt(Int_t, std::vector<UInt_t>&) { return kFALSE; }
0107    virtual Bool_t      GetVLong(Int_t, std::vector<Long_t>&) { return kFALSE; }
0108    virtual Bool_t      GetVLong64(Int_t, std::vector<Long64_t>&) { return kFALSE; }
0109    virtual Bool_t      GetVULong64(Int_t, std::vector<ULong64_t>&) { return kFALSE; }
0110    virtual Bool_t      GetVDouble(Int_t, std::vector<Double_t>&) { return kFALSE; }
0111 
0112    virtual Bool_t      IsError() const { return GetErrorCode()!=0; }
0113    virtual Int_t       GetErrorCode() const;
0114    virtual const char* GetErrorMsg() const;
0115    virtual void        EnableErrorOutput(Bool_t on = kTRUE) { fErrorOut = on; }
0116 
0117    ClassDefOverride(TSQLStatement, 0) //SQL statement
0118 };
0119 
0120 #endif