42{
44
45 const char *dbname = gEnv->GetValue("o2root.dbname" , "dbname");
46 const char *user = gEnv->GetValue("o2root.username" , "username");
47 const char *password = gEnv->GetValue("o2root.password" , "password");
48 const char *rdb = gEnv->GetValue("o2root.rdb" , "");
49 const char *
outdir = gEnv->GetValue(
"o2root.outdir" ,
"./");
51
52 bool do_volume = false;
53 bool do_processoperation = false;
54 bool do_parentprocessoperation = false;
55 bool do_scanback = false;
56 bool do_brickinfo = false;
57 ULong64_t id_volume = 0LL;
58 ULong64_t processoperation = 0LL;
59 ULong64_t parentprocessoperation = 0LL;
60 int major=0;
61 int minor=0;
62
63 Long_t id_brick=0;
64 Int_t path =0;
65
66 for(int i=1; i<argc; i++ ) {
67 char *key = argv[i];
68
69 if (!strncmp(key,"-v=",3))
70 {
71 if(strlen(key)>3) sscanf(key+3,"%lld",&id_volume);
72 do_volume=true;
73 }
74 else if(!strncmp(key,"-p=",3))
75 {
76 if(strlen(key)>3) sscanf(key+3,"%lld",&processoperation);
77 do_processoperation=true;
78 }
79 else if(!strncmp(key,"-P=",3))
80 {
81 if(strlen(key)>3) sscanf(key+3,"%lld",&parentprocessoperation);
82 do_parentprocessoperation=true;
83 }
84 else if(!strncmp(key,"-o=",3))
85 {
86 if(strlen(key)>3)
outdir=key+3;
87 }
88 else if(!strncmp(key,"-ma=",4))
89 {
90 if(strlen(key)>4) major=atoi(key+4);
91 }
92 else if(!strncmp(key,"-mi=",4))
93 {
94 if(strlen(key)>4) minor=atoi(key+4);
95 }
96 else if(!strncmp(key,"-rdb=",5))
97 {
98 if(strlen(key)>5) rdb=key+5;
99 }
100 else if(!strncmp(key,"-brick=",7))
101 {
102 if(strlen(key)>7) id_brick=atol(key+7);
103 }
104 else if(!strncmp(key,"-sb=",4))
105 {
106 if(strlen(key)>4) path=atol(key+4);
107 do_scanback=true;
108 }
109 else if(!strncmp(key,"-info",5))
110 {
111 do_brickinfo=true;
112 }
113 }
114
115 if(!(do_volume||do_scanback||do_processoperation||do_parentprocessoperation||do_brickinfo)) {
print_help_message();
return 0; }
116
118 if(!
db) {
Log(1,
"o2root",
"ERROR: the database connection is failed!");
return 0; }
120 if(do_volume) {
121 printf("\n----------------------------------------------------------------------------\n");
122 printf("Read volume: \t\t\t%lld \nfrom the database: \t\t%s%s \nand save into directory: \t%s \nwith versions: \t\t\t%d.%d\n",
123 id_volume, dbname, rdb,
outdir, major,minor);
124 printf("----------------------------------------------------------------------------\n\n");
125 db->ConvertMicrotracksVolumeToEdb(id_volume,
outdir, major, minor);
126 }
127 if(do_processoperation) {
128 printf("\n----------------------------------------------------------------------------\n");
129 printf("Read processoperation: \t\t\t%lld \nfrom the database: \t\t%s%s \nand save into directory: \t%s \nwith versions: \t\t\t%d.%d\n",
130 processoperation, dbname, rdb,
outdir, major,minor);
131 printf("----------------------------------------------------------------------------\n\n");
132 db->ConvertMicrotracksProcessToEdb(processoperation,
outdir, major, minor);
133 }
134 if(do_parentprocessoperation) {
135 printf("\n----------------------------------------------------------------------------\n");
136 printf("Read parentprocessoperation: \t\t\t%lld \nfrom the database: \t\t%s%s \nand save into directory: \t%s \nwith versions: \t\t\t%d.%d\n",
137 parentprocessoperation, dbname, rdb,
outdir, major,minor);
138 printf("----------------------------------------------------------------------------\n\n");
139 db->ConvertMicrotracksParentProcessToEdb(parentprocessoperation,
outdir, major, minor);
140 }
141 if(do_scanback) {
142 printf("\n----------------------------------------------------------------------------\n");
143 printf("Read scanback path: \t\t%d of brick %ld \nfrom the database: \t\t%s%s \nand save into directory: \t%s \nwith versions: \t\t\t%d.%d\n",
144 path, id_brick, dbname, rdb,
outdir, major,minor);
145 printf("----------------------------------------------------------------------------\n\n");
146 db->ConvertScanbackPathToEdb(id_brick, path,
outdir, major, minor);
147 }
148 if(do_brickinfo) {
149 printf("\n---------------------------------------------------------------------------------------------\n");
150 printf("Print info for brick: \t%ld from the database: \t\t%s%s\n",
151 id_brick, dbname, rdb);
152 printf("---------------------------------------------------------------------------------------------\n");
153 db->PrintBrickInfoFull(id_brick,0);
154 }
156 return 1;
157}
bool Log(int level, const char *location, const char *fmt,...)
Definition: EdbLog.cxx:75
Definition: TOracleServerE2.h:13
const char * outdir
Definition: emrec.cpp:37
gEDBDEBUGLEVEL
Definition: energy.C:7
TOracleServerE * db
Definition: test_oracle.C:8
void print_help_message()
Definition: o2root.cpp:12