// @(#)root/sql:$Id$
// Author: Sergey Linev  20/11/2005

/*************************************************************************
 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TSQLClassInfo
#define ROOT_TSQLClassInfo


/////////////////////////////////////////////////////////////////////////
//                                                                     //
// TSQLClassInfo keeps table information relevant for one class        //
//                                                                     //
/////////////////////////////////////////////////////////////////////////



#ifndef ROOT_TObject
#include "TObject.h"
#endif

#ifndef ROOT_TString
#include "TString.h"
#endif

class TObjArray;

class TSQLClassColumnInfo : public TObject {

public:
   TSQLClassColumnInfo();
   TSQLClassColumnInfo(const char* name,
                       const char* sqlname,
                       const char* sqltype);
   virtual ~TSQLClassColumnInfo();

   virtual const char* GetName() const { return fName.Data(); }
   const char* GetSQLName() const { return fSQLName.Data(); }
   const char* GetSQLType() const { return fSQLType.Data(); }

protected:
   TString   fName;
   TString   fSQLName;
   TString   fSQLType;

   ClassDef(TSQLClassColumnInfo, 1); //  Keeps information about single column in class table
};

//_________________________________________________________________________________

class TSQLClassInfo : public TObject {
public:
   TSQLClassInfo();
   TSQLClassInfo(Long64_t classid,
                 const char* classname,
                 Int_t version);
   virtual ~TSQLClassInfo();


   Long64_t GetClassId() const { return fClassId; }

   virtual const char* GetName() const { return fClassName.Data(); }
   Int_t GetClassVersion() const { return fClassVersion; }

   void SetClassTableName(const char* name) { fClassTable = name; }
   void SetRawTableName(const char* name) { fRawTable = name; }

   const char* GetClassTableName() const { return fClassTable.Data(); }
   const char* GetRawTableName() const { return fRawTable.Data(); }

   void SetTableStatus(TObjArray* columns = 0, Bool_t israwtable = kFALSE);
   void SetColumns(TObjArray* columns);
   void SetRawExist(Bool_t on) { fRawtableExist = on; }

   Bool_t IsClassTableExist() const { return GetColumns()!=0; }
   Bool_t IsRawTableExist() const { return fRawtableExist; }

   TObjArray* GetColumns() const { return fColumns; }
   Int_t FindColumn(const char* name, Bool_t sqlname = kFALSE);

protected:

   TString    fClassName;            //! class name
   Int_t      fClassVersion;         //! class version
   Long64_t      fClassId;              //! sql class id
   TString    fClassTable;           //! name of table with class data
   TString    fRawTable;             //! name of table with raw data
   TObjArray* fColumns;              //! name and type of columns - array of TNamed
   Bool_t     fRawtableExist;        //! indicate that raw table is exist

   ClassDef(TSQLClassInfo, 1); //  Keeps the table information relevant for one class
};

#endif
 TSQLClassInfo.h:1
 TSQLClassInfo.h:2
 TSQLClassInfo.h:3
 TSQLClassInfo.h:4
 TSQLClassInfo.h:5
 TSQLClassInfo.h:6
 TSQLClassInfo.h:7
 TSQLClassInfo.h:8
 TSQLClassInfo.h:9
 TSQLClassInfo.h:10
 TSQLClassInfo.h:11
 TSQLClassInfo.h:12
 TSQLClassInfo.h:13
 TSQLClassInfo.h:14
 TSQLClassInfo.h:15
 TSQLClassInfo.h:16
 TSQLClassInfo.h:17
 TSQLClassInfo.h:18
 TSQLClassInfo.h:19
 TSQLClassInfo.h:20
 TSQLClassInfo.h:21
 TSQLClassInfo.h:22
 TSQLClassInfo.h:23
 TSQLClassInfo.h:24
 TSQLClassInfo.h:25
 TSQLClassInfo.h:26
 TSQLClassInfo.h:27
 TSQLClassInfo.h:28
 TSQLClassInfo.h:29
 TSQLClassInfo.h:30
 TSQLClassInfo.h:31
 TSQLClassInfo.h:32
 TSQLClassInfo.h:33
 TSQLClassInfo.h:34
 TSQLClassInfo.h:35
 TSQLClassInfo.h:36
 TSQLClassInfo.h:37
 TSQLClassInfo.h:38
 TSQLClassInfo.h:39
 TSQLClassInfo.h:40
 TSQLClassInfo.h:41
 TSQLClassInfo.h:42
 TSQLClassInfo.h:43
 TSQLClassInfo.h:44
 TSQLClassInfo.h:45
 TSQLClassInfo.h:46
 TSQLClassInfo.h:47
 TSQLClassInfo.h:48
 TSQLClassInfo.h:49
 TSQLClassInfo.h:50
 TSQLClassInfo.h:51
 TSQLClassInfo.h:52
 TSQLClassInfo.h:53
 TSQLClassInfo.h:54
 TSQLClassInfo.h:55
 TSQLClassInfo.h:56
 TSQLClassInfo.h:57
 TSQLClassInfo.h:58
 TSQLClassInfo.h:59
 TSQLClassInfo.h:60
 TSQLClassInfo.h:61
 TSQLClassInfo.h:62
 TSQLClassInfo.h:63
 TSQLClassInfo.h:64
 TSQLClassInfo.h:65
 TSQLClassInfo.h:66
 TSQLClassInfo.h:67
 TSQLClassInfo.h:68
 TSQLClassInfo.h:69
 TSQLClassInfo.h:70
 TSQLClassInfo.h:71
 TSQLClassInfo.h:72
 TSQLClassInfo.h:73
 TSQLClassInfo.h:74
 TSQLClassInfo.h:75
 TSQLClassInfo.h:76
 TSQLClassInfo.h:77
 TSQLClassInfo.h:78
 TSQLClassInfo.h:79
 TSQLClassInfo.h:80
 TSQLClassInfo.h:81
 TSQLClassInfo.h:82
 TSQLClassInfo.h:83
 TSQLClassInfo.h:84
 TSQLClassInfo.h:85
 TSQLClassInfo.h:86
 TSQLClassInfo.h:87
 TSQLClassInfo.h:88
 TSQLClassInfo.h:89
 TSQLClassInfo.h:90
 TSQLClassInfo.h:91
 TSQLClassInfo.h:92
 TSQLClassInfo.h:93
 TSQLClassInfo.h:94
 TSQLClassInfo.h:95
 TSQLClassInfo.h:96
 TSQLClassInfo.h:97
 TSQLClassInfo.h:98
 TSQLClassInfo.h:99
 TSQLClassInfo.h:100