HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
harpodbmkclass.cxx
Go to the documentation of this file.
1 //
2 // Demo code, make root class from harpo database table
3 //
4 
5 #include "HarpoDB.h"
6 #include "TString.h"
7 #include <iostream>
8 #include <stdlib.h>
9 #include <unistd.h>
10 
11 
12 int main(int argc, char **argv)
13 {
14  HarpoDB *db;
15  TString table;
16  TString clname;
17 
18  if (argc >= 2) {
19  table = argv[1];
20  } else {
21  std::cout << " usage: " << argv[0] << " table [class_name]" << std::endl;
22  return 1;
23  }
24  if ( argc == 3 )
25  clname = argv[2];
26  else
27  clname = "";
28  db = new HarpoDB;
29  db->Open();
30 
31  HarpoDBTable *t1 = new HarpoDBTable();
32  if (db->GetTable(table,t1)) {
33  // t1->list();
34  t1->MakeClass(clname);
35  } else {
36  std::cout << " Bad table " << table << std::endl;
37  std::cout << "List of existing tables" << std::endl;
38  db->list();
39  }
40  delete t1;
41  db->Close();
42  delete db;
43  return 0;
44 }
45 
46 
47 
void list()
Definition: HarpoDB.cxx:65
Bool_t Open(const TString *DbUrl=NULL)
Definition: HarpoDB.cxx:77
Bool_t GetTable(const TString name, HarpoDBTable *table)
Definition: HarpoDB.h:122
Harpo Database access class. The class query MySQL database. Deal with (single !) Harpo Database and ...
Definition: HarpoDB.h:112
int main(int argc, char **argv)
Bool_t Close()
Definition: HarpoDB.cxx:111
void MakeClass(TString cname, TString option="")
Definition: HarpoDB.cxx:569