TSQLClassInfo.h

Go to the documentation of this file.
00001 // @(#)root/sql:$Id: TSQLClassInfo.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Sergey Linev  20/11/2005
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TSQLClassInfo
00013 #define ROOT_TSQLClassInfo
00014 
00015 
00016 /////////////////////////////////////////////////////////////////////////
00017 //                                                                     //
00018 // TSQLClassInfo keeps table information relevant for one class        //
00019 //                                                                     //
00020 /////////////////////////////////////////////////////////////////////////
00021 
00022 
00023 
00024 #ifndef ROOT_TObject
00025 #include "TObject.h"
00026 #endif
00027 
00028 #ifndef ROOT_TString
00029 #include "TString.h"
00030 #endif
00031 
00032 class TObjArray;
00033 
00034 class TSQLClassColumnInfo : public TObject {
00035 
00036 public:
00037    TSQLClassColumnInfo();
00038    TSQLClassColumnInfo(const char* name,
00039                        const char* sqlname,
00040                        const char* sqltype);
00041    virtual ~TSQLClassColumnInfo();
00042    
00043    virtual const char* GetName() const { return fName.Data(); }   
00044    const char* GetSQLName() const { return fSQLName.Data(); }   
00045    const char* GetSQLType() const { return fSQLType.Data(); }   
00046 
00047 protected:    
00048    TString   fName;
00049    TString   fSQLName;
00050    TString   fSQLType; 
00051 
00052    ClassDef(TSQLClassColumnInfo, 1); //  Keeps information about single column in class table
00053 };
00054 
00055 //_________________________________________________________________________________
00056 
00057 class TSQLClassInfo : public TObject {
00058 public:
00059    TSQLClassInfo();
00060    TSQLClassInfo(Long64_t classid,
00061                  const char* classname, 
00062                  Int_t version);
00063    virtual ~TSQLClassInfo();
00064    
00065 
00066    Long64_t GetClassId() const { return fClassId; }
00067    
00068    virtual const char* GetName() const { return fClassName.Data(); }
00069    Int_t GetClassVersion() const { return fClassVersion; }
00070    
00071    void SetClassTableName(const char* name) { fClassTable = name; }
00072    void SetRawTableName(const char* name) { fRawTable = name; }
00073    
00074    const char* GetClassTableName() const { return fClassTable.Data(); }
00075    const char* GetRawTableName() const { return fRawTable.Data(); }
00076    
00077    void SetTableStatus(TObjArray* columns = 0, Bool_t israwtable = kFALSE);
00078    void SetColumns(TObjArray* columns);
00079    void SetRawExist(Bool_t on) { fRawtableExist = on; }
00080    
00081    Bool_t IsClassTableExist() const { return GetColumns()!=0; }
00082    Bool_t IsRawTableExist() const { return fRawtableExist; }
00083    
00084    TObjArray* GetColumns() const { return fColumns; }
00085    Int_t FindColumn(const char* name, Bool_t sqlname = kFALSE);
00086    
00087 protected:
00088    
00089    TString    fClassName;            //! class name 
00090    Int_t      fClassVersion;         //! class version 
00091    Long64_t      fClassId;              //! sql class id
00092    TString    fClassTable;           //! name of table with class data
00093    TString    fRawTable;             //! name of table with raw data
00094    TObjArray* fColumns;              //! name and type of columns - array of TNamed
00095    Bool_t     fRawtableExist;        //! indicate that raw table is exist
00096    
00097    ClassDef(TSQLClassInfo, 1); //  Keeps the table information relevant for one class 
00098 };
00099 
00100 #endif

Generated on Tue Jul 5 14:28:12 2011 for ROOT_528-00b_version by  doxygen 1.5.1