StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Db_ReadTable.C
1 void Db_ReadTable(char* domainName, char* tableName, char* timestamp){
2 
3 // Use this macro to read the FTPC table "tableName" from the "domainName" database,
4 // Calibrations_ftpc or Geometry_ftpc, and write it out into your working directory
5 //
6 // Don't forget to
7 //
8 // setenv DB_ACCESS_MODE read
9 //
10 // For example:
11 //
12 // root4star -b -q 'Db_ReadTable.C("Calibrations_ftpc","ftpcGas","2008-05-01 00:00:00")'
13 
14  gSystem->Load("St_base"); // needed for StDbModifier
15  gSystem->Load("StChain");
16 
17  // DB-specific libs
18  gSystem->Load("libStDb_Tables");
19  gSystem->Load("StUtilities");
20  gSystem->Load("StDbLib");
22  StDbModifier* modify=new StDbModifier();
23  modify->SetDbName(domainName);
24  modify->SetDateTime(timestamp);
25  modify->SetFlavor("ofl");
26 
27  TString fname(tableName);
28  fname+=".C";
29 
30  modify->SetTableName(tableName);
31  modify->SetOutputFileName(fname.Data());
32  modify->ReadDataFromDB();
33 
34  cout<<"Wrote out "<<domainName<<" database table "<<fname.Data()<<endl;
35 
36 }
37 
static StDbManager * Instance()
strdup(..) is not ANSI
Definition: StDbManager.cc:155