#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()
{
}
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)
{
}
TSQLTableInfo::~TSQLTableInfo()
{
if (fColumns!=0) {
fColumns->Delete();
delete fColumns;
fColumns = 0;
}
}
void TSQLTableInfo::Print(Option_t*) const
{
TROOT::IndentLevel();
std::cout << "Table:" << GetName();
if ((GetTitle()!=0) && (strlen(GetTitle())!=0))
std::cout << " comm:'" << GetTitle() << "'";
if (fEngine.Length()>0)
std::cout << " engine:" << fEngine;
if (fCreateTime.Length()>0)
std::cout << " create:" << fCreateTime;
if (fUpdateTime.Length()>0)
std::cout << " update:" << fUpdateTime;
std::cout << std::endl;
TROOT::IncreaseDirLevel();
if (fColumns!=0)
fColumns->Print("*");
TROOT::DecreaseDirLevel();
}
TSQLColumnInfo* TSQLTableInfo::FindColumn(const char* columnname)
{
if ((columnname==0) || (fColumns==0)) return 0;
return dynamic_cast<TSQLColumnInfo*> (fColumns->FindObject(columnname));
}