ROOT logo
// @(#)root/net:$Id: TSQLTableInfo.cxx 23091 2008-04-09 15:04:27Z rdm $
// Author: Sergey Linev   31/05/2006

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

////////////////////////////////////////////////////////////////////////////////
//                                                                      
// TSQLTableInfo
//
// Contains information about table and table columns.
// For MySQL additional information like engine type, 
// creation and last update time is provided
//                                                                      
////////////////////////////////////////////////////////////////////////////////



#include "TSQLTableInfo.h"

#include "TSQLColumnInfo.h"
#include "TList.h"
#include "TROOT.h"
#include "Riostream.h"

ClassImp(TSQLTableInfo)

//______________________________________________________________________________
TSQLTableInfo::TSQLTableInfo() : 
   TNamed(),
   fColumns(0),
   fEngine(),
   fCreateTime(),
   fUpdateTime()
{
   // default constructor
}

//______________________________________________________________________________
TSQLTableInfo::TSQLTableInfo(const char* tablename, 
                             TList* columns,
                             const char* comment,
                             const char* engine,
                             const char* create_time,
                             const char* update_time) : 
   TNamed(tablename, comment),
   fColumns(columns),
   fEngine(engine),
   fCreateTime(create_time),
   fUpdateTime(update_time)
{
   // normal constructor
   
}

//______________________________________________________________________________
TSQLTableInfo::~TSQLTableInfo()
{
   // destructor
   
   if (fColumns!=0) {
      fColumns->Delete();
      delete fColumns;
      fColumns = 0;
   }
}

//______________________________________________________________________________
void TSQLTableInfo::Print(Option_t*) const
{
   // Prints table and table columns info
   
   TROOT::IndentLevel();
   cout << "Table:" << GetName();
   
   if ((GetTitle()!=0) && (strlen(GetTitle())!=0))
      cout << " comm:'" << GetTitle() << "'";
   
   if (fEngine.Length()>0)
      cout << " engine:" << fEngine;

   if (fCreateTime.Length()>0)
      cout << " create:" << fCreateTime;

   if (fUpdateTime.Length()>0)
      cout << " update:" << fUpdateTime;
   
   cout << endl;
    
   TROOT::IncreaseDirLevel();
   if (fColumns!=0)
      fColumns->Print("*");
   TROOT::DecreaseDirLevel();
}

//______________________________________________________________________________
TSQLColumnInfo* TSQLTableInfo::FindColumn(const char* columnname)
{
   // Return column info object of given name
   
   if ((columnname==0) || (fColumns==0)) return 0;
   
   return dynamic_cast<TSQLColumnInfo*> (fColumns->FindObject(columnname));
   
}
 TSQLTableInfo.cxx:1
 TSQLTableInfo.cxx:2
 TSQLTableInfo.cxx:3
 TSQLTableInfo.cxx:4
 TSQLTableInfo.cxx:5
 TSQLTableInfo.cxx:6
 TSQLTableInfo.cxx:7
 TSQLTableInfo.cxx:8
 TSQLTableInfo.cxx:9
 TSQLTableInfo.cxx:10
 TSQLTableInfo.cxx:11
 TSQLTableInfo.cxx:12
 TSQLTableInfo.cxx:13
 TSQLTableInfo.cxx:14
 TSQLTableInfo.cxx:15
 TSQLTableInfo.cxx:16
 TSQLTableInfo.cxx:17
 TSQLTableInfo.cxx:18
 TSQLTableInfo.cxx:19
 TSQLTableInfo.cxx:20
 TSQLTableInfo.cxx:21
 TSQLTableInfo.cxx:22
 TSQLTableInfo.cxx:23
 TSQLTableInfo.cxx:24
 TSQLTableInfo.cxx:25
 TSQLTableInfo.cxx:26
 TSQLTableInfo.cxx:27
 TSQLTableInfo.cxx:28
 TSQLTableInfo.cxx:29
 TSQLTableInfo.cxx:30
 TSQLTableInfo.cxx:31
 TSQLTableInfo.cxx:32
 TSQLTableInfo.cxx:33
 TSQLTableInfo.cxx:34
 TSQLTableInfo.cxx:35
 TSQLTableInfo.cxx:36
 TSQLTableInfo.cxx:37
 TSQLTableInfo.cxx:38
 TSQLTableInfo.cxx:39
 TSQLTableInfo.cxx:40
 TSQLTableInfo.cxx:41
 TSQLTableInfo.cxx:42
 TSQLTableInfo.cxx:43
 TSQLTableInfo.cxx:44
 TSQLTableInfo.cxx:45
 TSQLTableInfo.cxx:46
 TSQLTableInfo.cxx:47
 TSQLTableInfo.cxx:48
 TSQLTableInfo.cxx:49
 TSQLTableInfo.cxx:50
 TSQLTableInfo.cxx:51
 TSQLTableInfo.cxx:52
 TSQLTableInfo.cxx:53
 TSQLTableInfo.cxx:54
 TSQLTableInfo.cxx:55
 TSQLTableInfo.cxx:56
 TSQLTableInfo.cxx:57
 TSQLTableInfo.cxx:58
 TSQLTableInfo.cxx:59
 TSQLTableInfo.cxx:60
 TSQLTableInfo.cxx:61
 TSQLTableInfo.cxx:62
 TSQLTableInfo.cxx:63
 TSQLTableInfo.cxx:64
 TSQLTableInfo.cxx:65
 TSQLTableInfo.cxx:66
 TSQLTableInfo.cxx:67
 TSQLTableInfo.cxx:68
 TSQLTableInfo.cxx:69
 TSQLTableInfo.cxx:70
 TSQLTableInfo.cxx:71
 TSQLTableInfo.cxx:72
 TSQLTableInfo.cxx:73
 TSQLTableInfo.cxx:74
 TSQLTableInfo.cxx:75
 TSQLTableInfo.cxx:76
 TSQLTableInfo.cxx:77
 TSQLTableInfo.cxx:78
 TSQLTableInfo.cxx:79
 TSQLTableInfo.cxx:80
 TSQLTableInfo.cxx:81
 TSQLTableInfo.cxx:82
 TSQLTableInfo.cxx:83
 TSQLTableInfo.cxx:84
 TSQLTableInfo.cxx:85
 TSQLTableInfo.cxx:86
 TSQLTableInfo.cxx:87
 TSQLTableInfo.cxx:88
 TSQLTableInfo.cxx:89
 TSQLTableInfo.cxx:90
 TSQLTableInfo.cxx:91
 TSQLTableInfo.cxx:92
 TSQLTableInfo.cxx:93
 TSQLTableInfo.cxx:94
 TSQLTableInfo.cxx:95
 TSQLTableInfo.cxx:96
 TSQLTableInfo.cxx:97
 TSQLTableInfo.cxx:98
 TSQLTableInfo.cxx:99
 TSQLTableInfo.cxx:100
 TSQLTableInfo.cxx:101
 TSQLTableInfo.cxx:102
 TSQLTableInfo.cxx:103
 TSQLTableInfo.cxx:104
 TSQLTableInfo.cxx:105
 TSQLTableInfo.cxx:106
 TSQLTableInfo.cxx:107
 TSQLTableInfo.cxx:108
 TSQLTableInfo.cxx:109
 TSQLTableInfo.cxx:110