|
//____________________________________________________________________ // // See BrDbPass // //____________________________________________________________________ // // $Id: BrDbInputFile.cxx,v 1.1 2001/10/08 11:00:18 cholm Exp $ // $Author: cholm $ // $Date: 2001/10/08 11:00:18 $ // $Copyright: (C) 2001 BRAHMS Collaboration <brahmlib@rhic.bnl.gov> // #ifndef BRAT_BrDbInputFile #include "BrDbInputFile.h" #endif #ifndef __CSTDLIB__ #include <cstdlib> #endif //____________________________________________________________________ ClassImp(BrDbInputFile); // Pass Input File Class for BRAHMS database //____________________________________________________________________ const Char_t* BrDbInputFile::kTableName = "InputFiles"; // Input file DB access //____________________________________________________________________ BrDbInputFile::BrDbInputFile(const Char_t* name, Int_t runno, Int_t passId) { SetFileName(name); fRunNo = runno; fPassId = passId; } //____________________________________________________________________ BrDbInputFile* BrDbInputFile::SingleInstance(TSQLRow* row) { // Returns an instance of a BrDbInputFile. User needs to store this // object immediately. if (!row) return 0; BrDbInputFile* passFile = new BrDbInputFile(row->GetField(1), strtol(row->GetField(2),NULL,0), strtol(row->GetField(3),NULL,0)); passFile->SetDBID(strtol(row->GetField(0),NULL,0)); return passFile; } //____________________________________________________________________ TObjArray* BrDbInputFile::MultipleInstance(TSQLResult* res) { // Returns an (1D) array of BrDbInputFiles matching Query that // made the TSQLResult. User need to store this immediately. Int_t count = (res) ? res->GetRowCount() : 0; TObjArray* table = new TObjArray(count); for (Int_t i = 0; i < count; i++) table->Add(BrDbInputFile::SingleInstance(res->Next())); return table; } //____________________________________________________________________ BrDbQuery* BrDbInputFile::Create(void) { return BrDbQuery::Create(BrDbInputFile::kTableName, "FileName VARCHAR(64) NOT NULL, RunNo INT NOT NULL, PassId INT NOT NULL"); } //____________________________________________________________________ BrDbQuery* BrDbInputFile::Insert(void) { return BrDbQuery::Insert(BrDbInputFile::kTableName, Form("%d, '%s', %d, %d", GetDBID(), fFileName, fRunNo,fPassId)); } //____________________________________________________________________ void BrDbInputFile::SetFileName(const Char_t* name) { // Set the pass name if (strlen(name) > 64) { strncpy(fFileName, name, 63); fFileName[63] = '0'; } else strcpy(fFileName, name); } //____________________________________________________________________ // // EOF // |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|