Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TSQL.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TSQL.h
1 // $Id: TSQL.h,v 1.1.1.1 2004/02/18 20:58:02 dave Exp $
2 
3 #ifndef RDBC_TSQL_h
4 #define RDBC_TSQL_h
5 
6 // base class for TSQL
7 //
8 
9 #ifndef ROOT_TQObject
10 #include <TQObject.h>
11 #endif
12 #ifndef ROOT_TRefCnt
13 #include <TRefCnt.h>
14 #endif
15 #ifndef RDBC_TSQLTypes_h
16 #include <RDBC/TSQLTypes.h>
17 #endif
18 
19 
21 class TSQLException: public TObject, public TRefCnt
22 {
23 private:
24  TString fReason; // description of this message
25  TString fSqlState; // SQLLSTATE value
26  Int_t fErrorCode; // error code of this exception
27 
28 public:
29  TSQLException(const TString& reason ="",
30  const TString& sqlState ="",
31  Int_t vendorCode =0)
32  :TObject(), fReason(reason),
33  fSqlState(sqlState),fErrorCode(vendorCode) {}
34 
35  virtual ~TSQLException() {}
36  Int_t GetErrorCode() const { return fErrorCode; }
37  const TString& GetSQLState() const { return fSqlState;}
38  const TString& GetMessage() const { return fReason; }
39 
40  // TObject methods
41  virtual const char* GetName() const { return fReason.Data(); }
42  virtual void Print(Option_t *option="") const;
43  virtual void ls(Option_t *option="") const { Print(option); }
44 
45 ClassDef(TSQLException,0)// An exception that provides information on a database access error.
46 };
47 
48 
50 class TSQL:public TQObject
51 {
52 protected:
53  TList* fWarnings; // a list of warnings
54  void* fImp; // "hidden" implementation part
55 
56 public:
57  TSQL(void* imp=0);
58  virtual ~TSQL();
59 
60  virtual void Throw( TSQLException* e ); // *SIGNAL*
61 
62  TList* GetWarnings() const { return fWarnings; }
63  void ClearWarnings();
64  virtual Bool_t IsValid() const { return fImp!=0; }
65 
66  static Bool_t SetHandler(const TString& handler);
67  static Bool_t UnsetHandler(const TString& handler="");
68 
69 ClassDef(TSQL,0)// base class, provides exception handling
70 };
71 
72 #endif // RDBC_TSQL_h