|
// // Class BrDBTable // // ABC for all tables in the BRAHMS databases // // $Id: BrDbTable.cxx,v 1.1.1.1 2001/06/21 14:55:16 hagel Exp $ // $Author: hagel $ // $Date: 2001/06/21 14:55:16 $ // $Copyright: Brahms collaboration #include <BrDbTable.h> ClassImp(BrDbTable); //____________________________________________________________________ BrDbTable::BrDbTable(void) : TObject(), fDBID(-1) {} //____________________________________________________________________ Int_t BrDbTable::GetDBID(void) { return fDBID; } //____________________________________________________________________ void BrDbTable::SetDBID(Int_t id) { fDBID = id; } // // This method definition isn't valid. It's left here for future // refernce. It's a rather slick method I think. It uses ROOT's // Run-Time-Type-Identification (RTTI) system to create the SQL table // for the class in question. In an (almost) obvious way, this could // be extended to apply to queries of all sorts! // // const Char_t* // BrDbTable::CreateTableSQL(void) // { // // Create a table in the database, based on the members of the class // // BrDbTable. Only fundamental members and C character arrays are // // actually stored in the table. Specifically, the class should have // // a interger member for relations. // // Throws a BrException on error. // // // TClass* cls = this->Class(); // // TIter* itr = new TIter(cls->GetListOfDataMembers()); // if (!itr) // throw new BrWarning("CreateTable", // "Couldn't list of members of class %s", // cls->GetName()); // // TString sql("CREATE TABLE "); // sql += fDBName; // sql += "."; // sql += cls->GetName(); // sql += " ( id INT UNIQUE NOT NULL "; // // TDataMember* mem; // // while((mem = (TDataMember*) itr->Next())) { // // TString name(mem->GetName()); // if (name == "fgIsA") // continue; // // Int_t dimen = mem->GetArrayDim(); // if ( dimen > 1 ) // continue; // // Int_t props = mem->Property(); // if ( ! props & kIsFundamental || // props & kIsPointer || // props & kIsStatic ) // continue; // // TDataType* dtype = mem->GetDataType(); // Int_t itype = dtype->GetType(); // TString stype(""); // // if ( itype == kChar_t || itype == kUChar_t) { // if (dimen == 1) { // Int_t maxindex = mem->GetMaxIndex(0); // Char_t dim[10]; // sprintf(dim, "(%d)", maxindex); // stype = "VARCHAR"; // stype += dim; // } // else // stype = "CHAR"; // } else { // if (dimen > 0) // continue; // switch (itype) { // case kShort_t: stype = "INT" ; break; // case kUShort_t: stype = "INT" ; break; // case kInt_t: stype = "INT" ; break; // case kUInt_t: stype = "INT" ; break; // case kLong_t: stype = "INT" ; break; // case kULong_t: stype = "INT" ; break; // case kFloat_t: stype = "FLOAT" ; break; // case kDouble_t: stype = "DOUBLE" ; break; // default: continue; // } // } // // if (name[0] == 'f') // name.Remove(0,1); // sql += ", " + name + " " + stype; // } // // sql += " )"; // // return sql.Data(); // } // // $Log: BrDbTable.cxx,v $ // Revision 1.1.1.1 2001/06/21 14:55:16 hagel // Initial revision of brat2 // // Revision 1.4 2001/06/05 18:41:27 cholm // Removed BrDbInc.h an all references to it // // Revision 1.3 2000/05/10 15:56:13 nbi // Added the classes BrRunsDb, BrGeometriesDb, changed some code, bug // corrections , and so on. It's almost there ;-) // // |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|