00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "TSQLClassInfo.h"
00023
00024 #include "TObjArray.h"
00025
00026
00027 ClassImp(TSQLClassColumnInfo)
00028
00029
00030 TSQLClassColumnInfo::TSQLClassColumnInfo() :
00031 TObject(),
00032 fName(),
00033 fSQLName(),
00034 fSQLType()
00035 {
00036
00037 }
00038
00039
00040 TSQLClassColumnInfo::TSQLClassColumnInfo(const char* name,
00041 const char* sqlname,
00042 const char* sqltype) :
00043 TObject(),
00044 fName(name),
00045 fSQLName(sqlname),
00046 fSQLType(sqltype)
00047 {
00048
00049 }
00050
00051
00052 TSQLClassColumnInfo::~TSQLClassColumnInfo()
00053 {
00054
00055 }
00056
00057
00058 ClassImp(TSQLClassInfo)
00059
00060
00061 TSQLClassInfo::TSQLClassInfo() :
00062 TObject(),
00063 fClassName(),
00064 fClassVersion(0),
00065 fClassId(0),
00066 fClassTable(),
00067 fRawTable(),
00068 fColumns(0),
00069 fRawtableExist(kFALSE)
00070 {
00071
00072 }
00073
00074
00075 TSQLClassInfo::TSQLClassInfo(Long64_t classid,
00076 const char* classname,
00077 Int_t version) :
00078 TObject(),
00079 fClassName(classname),
00080 fClassVersion(version),
00081 fClassId(classid),
00082 fClassTable(),
00083 fRawTable(),
00084 fColumns(0),
00085 fRawtableExist(kFALSE)
00086 {
00087
00088
00089 fClassTable.Form("%s_ver%d", classname, version);
00090 fRawTable.Form("%s_raw%d", classname, version);
00091 }
00092
00093
00094 TSQLClassInfo::~TSQLClassInfo()
00095 {
00096
00097
00098 if (fColumns!=0) {
00099 fColumns->Delete();
00100 delete fColumns;
00101 }
00102 }
00103
00104
00105 void TSQLClassInfo::SetColumns(TObjArray* columns)
00106 {
00107
00108
00109 if (fColumns!=0) {
00110 fColumns->Delete();
00111 delete fColumns;
00112 }
00113 fColumns = columns;
00114 }
00115
00116
00117 void TSQLClassInfo::SetTableStatus(TObjArray* columns, Bool_t israwtable)
00118 {
00119
00120
00121 SetColumns(columns);
00122 fRawtableExist = israwtable;
00123 }
00124
00125
00126 Int_t TSQLClassInfo::FindColumn(const char* name, Bool_t sqlname)
00127 {
00128
00129
00130
00131
00132
00133 if ((name==0) || (fColumns==0)) return -1;
00134
00135 TIter next(fColumns);
00136
00137 TSQLClassColumnInfo* col = 0;
00138
00139 Int_t indx = 0;
00140
00141 while ((col = (TSQLClassColumnInfo*) next()) != 0) {
00142 const char* colname = sqlname ? col->GetSQLName() : col->GetName();
00143 if (strcmp(colname, name)==0) return indx;
00144 indx++;
00145 }
00146
00147 return -1;
00148 }