00001 #include "TDemo2_DB_Table.hxx" 00002 #include "TResultInputStream.hxx" 00003 #include "TSK_DBI_Log.hxx" 00004 00005 ClassImp(TDemo2_DB_Table) 00006 00007 00008 00009 // Instantiate associated ND::TResultSetHandle and ND::TDbiResultSetHandle classes. 00010 // ***************************************************************** 00011 00012 // The TableRow subclass' *_.cxx must request the instantiation of the 00013 // templated ND::TResultSetHandle class it as the supplied class. However 00014 // ND::TResultSetHandle inherits from the backend ND::TDbiResultSetHandle so an 00015 // instatiation of it is also required. 00016 00017 #include "TResultSetHandle.cxx" 00018 template class TResultSetHandle<TDemo2_DB_Table>; 00019 template class TDbiResultSetHandle<TDemo2_DB_Table>; 00020 00021 00022 //_____________________________________________________________________________ 00023 00024 TDemo2_DB_Table::TDemo2_DB_Table() { 00025 00026 // Default constructor 00027 00028 SK_DBI_Trace("TDemo2_DB_Table: Default ctor at:" << (void*) this); 00029 00030 } 00031 00032 00033 //_____________________________________________________________________________ 00034 00035 TDemo2_DB_Table::TDemo2_DB_Table(const TDemo2_DB_Table& from) { 00036 00037 // Copy constructor 00038 00039 SK_DBI_Trace("TDemo2_DB_Table: Copy ctor at:" << (void*) this); 00040 00041 *this = from; 00042 00043 } 00044 00045 //_____________________________________________________________________________ 00046 00047 TDemo2_DB_Table::~TDemo2_DB_Table() { 00048 00049 // Destructor 00050 00051 SK_DBI_Trace("TDemo2_DB_Table: dtor at:" << (void*) this); 00052 00053 } 00054 00055 //_____________________________________________________________________________ 00056 00057 void TDemo2_DB_Table::Fill(TResultInputStream& ris) { 00058 00059 /// This method is used to fill a row. A ResultInputStream is an object 00060 /// with operator >> methods for most basic types. 00061 /// 00062 /// Individual data items are read from it in the order in which they 00063 /// appear in the database table but notice that the first two rows (SEQNO 00064 /// and ROW_COUNTER) which are not part of the row's state, do not have to 00065 /// be skipped. 00066 /// 00067 /// Also notice how the row state can include objects even though the 00068 /// stored state can only store basic types. E_CHAN_ID is stored as a 00069 /// MySQL INT but is used to fill a TTFBChannelId. 00070 00071 00072 UInt_t id; 00073 ris >> id >> fIParm1 >> fIParm2 >> fIParm3 >> fFParm1 >> fFParm2 >> fFParm3; 00074 fChannelId = id; 00075 00076 } 00077 00078 //_____________________________________________________________________________ 00079 00080 void TDemo2_DB_Table::Print(const Option_t*) const { 00081 00082 // Programming note: The arg isn't used but is there so as to avoid compiler 00083 // warnings about hidden method TObject::Print(const Option_t*). 00084 00085 SK_DBI_Log("DEMO_DB_TABLE row for channel " << fChannelId 00086 << " integer parms: " << fIParm1 << "," << fIParm2 << "," << fIParm3 00087 << " floating point parms " << fFParm1 << "," << fFParm2 << "," << fFParm3 ); 00088 00089 } 00090