00001 /////////////////////////////////////////////////////////////////////// 00002 // $Id: TDbiRowStream.cxx,v 1.1 2011/01/18 05:49:20 finch Exp $ 00003 // 00004 // TDbiRowStream 00005 // 00006 // Package: TDbi (Database Interface). 00007 00008 // Begin_Html<img src="../../pedestrians.gif" align=center> 00009 // <a href="../source_warning.html">Warning for beginners</a>.<br> 00010 // Also see <a href="../../root_crib/index.html">The ROOT Crib</a> and 00011 // <a href="../index.html">The MINOS Class User Guide</a>End_Html 00012 // 00013 // N. West 04/2001 00014 // 00015 // Concept: I/O buffer for a row of a table. 00016 // 00017 // Purpose: This forms the base class for TDbiInRowStream (input) 00018 // and TDbiWriter (input) 00019 // 00020 /////////////////////////////////////////////////////////////////////// 00021 00022 #include "TDbiTableMetaData.hxx" 00023 #include "TDbiRowStream.hxx" 00024 #include <TSK_DBI_Log.hxx> 00025 #include <MsgFormat.h> 00026 using std::endl; 00027 00028 #include "UtilString.hxx" 00029 00030 ClassImp(TDbiRowStream) 00031 00032 00033 // Definition of static data members 00034 // ********************************* 00035 00036 00037 00038 // Definition of all member functions (static or otherwise) 00039 // ******************************************************* 00040 // 00041 // - ordered: ctors, dtor, operators then in alphabetical order. 00042 00043 //..................................................................... 00044 00045 TDbiRowStream::TDbiRowStream(const TDbiTableMetaData* metaData) : 00046 fCurCol(1), 00047 fMetaData(metaData), 00048 fIsVLDTable(false) 00049 { 00050 // 00051 // 00052 // Purpose: Default constructor 00053 // 00054 // Arguments: 00055 // metaData in Meta data for table. 00056 // tableName in Table name. 00057 // 00058 // Return: n/a 00059 // 00060 // Contact: N. West 00061 // 00062 // Specification:- 00063 // ============= 00064 // 00065 // o Create RowStream. 00066 00067 00068 // Program Notes:- 00069 // ============= 00070 00071 // None. 00072 00073 00074 SK_DBI_Trace( "Creating TDbiRowStream" << " "); 00075 00076 std::string suffix(this->TableName(),this->TableName().size()-3); 00077 fIsVLDTable = suffix == "VLD"; 00078 00079 } 00080 00081 00082 //..................................................................... 00083 00084 TDbiRowStream::~TDbiRowStream() { 00085 // 00086 // 00087 // Purpose: Destructor 00088 // 00089 // Arguments: 00090 // None. 00091 // 00092 // Return: n/a 00093 // 00094 // Contact: N. West 00095 // 00096 // Specification:- 00097 // ============= 00098 // 00099 // o Destroy RowStream. 00100 00101 00102 // Program Notes:- 00103 // ============= 00104 00105 // None. 00106 00107 00108 SK_DBI_Trace( "Destroying TDbiRowStream" << " "); 00109 00110 } 00111 00112 //..................................................................... 00113 00114 const TDbiFieldType& TDbiRowStream::ColFieldType(UInt_t col) const { 00115 // 00116 // 00117 // Purpose: Return specified column type, if defined 00118 // 00119 // Arguments: None. 00120 00121 return fMetaData->ColFieldType(col); 00122 } 00123 //..................................................................... 00124 00125 string TDbiRowStream::ColName(UInt_t col) const { 00126 // 00127 // 00128 // Purpose: Return specified column name, if defined 00129 00130 return fMetaData->ColName(col); 00131 } 00132 //..................................................................... 00133 00134 const TDbiFieldType& TDbiRowStream::CurColFieldType() const { 00135 // 00136 // 00137 // Purpose: Return current column type, if defined 00138 // 00139 // Arguments: None. 00140 // 00141 // Return: Current column type, if defined. Unknown otherwise. 00142 // 00143 // Contact: N. West 00144 // 00145 // Specification:- 00146 // ============= 00147 // 00148 // o Current column name, if defined. unknown otherwise. 00149 00150 // Program Notes:- 00151 // ============= 00152 00153 // None. 00154 00155 return fMetaData->ColFieldType(fCurCol); 00156 } 00157 00158 //..................................................................... 00159 00160 string TDbiRowStream::CurColName() const { 00161 // 00162 // 00163 // Purpose: Return current column name, if defined 00164 // 00165 // Arguments: None. 00166 // 00167 // Return: Current column name, if defined. "Undefined" otherwise. 00168 // 00169 // Contact: N. West 00170 // 00171 // Specification:- 00172 // ============= 00173 // 00174 // o Current column name, if defined. "Undefined" otherwise. 00175 00176 // Program Notes:- 00177 // ============= 00178 00179 // None. 00180 00181 return fMetaData->ColName(fCurCol); 00182 } 00183 00184 //..................................................................... 00185 00186 UInt_t TDbiRowStream::NumCols() const { 00187 // 00188 // 00189 // Purpose: Return the number of columns. 00190 // 00191 // Arguments: None. 00192 // 00193 // Return: the number of columns 00194 // 00195 // Contact: N. West 00196 // 00197 // Specification:- 00198 // ============= 00199 // 00200 // o Return the number of columns. 00201 00202 // Program Notes:- 00203 // ============= 00204 00205 // None. 00206 00207 return fMetaData->NumCols(); 00208 00209 } 00210 00211 //..................................................................... 00212 00213 Bool_t TDbiRowStream::HasEpoch() const { 00214 return fMetaData->HasEpoch(); 00215 } 00216 00217 //..................................................................... 00218 00219 string TDbiRowStream::TableName() const { 00220 // 00221 // 00222 // Purpose: Return table name in upper case. 00223 // 00224 00225 return UtilString::ToUpper(fMetaData->TableName()); 00226 } 00227 00228 //..................................................................... 00229 00230 string TDbiRowStream::TableNameTc() const { 00231 // 00232 // 00233 // Purpose: Return table name in true case. 00234 00235 return fMetaData->TableName(); 00236 } 00237 /* Template for New Member Function 00238 00239 //..................................................................... 00240 00241 TDbiRowStream:: { 00242 // 00243 // 00244 // Purpose: 00245 // 00246 // Arguments: 00247 // xxxxxxxxx in yyyyyy 00248 // 00249 // Return: 00250 // 00251 // Contact: N. West 00252 // 00253 // Specification:- 00254 // ============= 00255 // 00256 // o 00257 00258 // Program Notes:- 00259 // ============= 00260 00261 // None. 00262 00263 00264 } 00265 00266 */ 00267 00268 00269 00270