10#include "TSQLStatement.h"
17UniSimulationFile::UniSimulationFile(
UniConnection* db_connect,
19 TString generator_name,
22 TString beam_particle,
23 TString target_particle,
31 connectionDB = db_connect;
34 str_generator_name = generator_name;
35 i_file_type = file_type;
36 str_file_path = file_path;
37 str_beam_particle = beam_particle;
38 str_target_particle = target_particle;
40 str_centrality = centrality;
41 i_event_count = event_count;
43 str_file_hash = file_hash;
44 str_file_desc = file_desc;
68 TString beam_particle,
69 TString target_particle,
78 if (connDb ==
nullptr)
83 TString sql = TString::Format(
"insert into simulation_file(generator_name, file_type, file_path, beam_particle, "
84 "target_particle, energy, centrality, event_count, file_size, file_hash, file_desc) "
85 "values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)");
86 TSQLStatement* stmt = db_server->Statement(sql);
88 stmt->NextIteration();
89 stmt->SetString(0, generator_name);
90 stmt->SetInt(1, file_type);
91 stmt->SetString(2, file_path);
92 stmt->SetString(3, beam_particle);
93 stmt->SetString(4, target_particle);
94 if (energy ==
nullptr)
97 stmt->SetDouble(5, *energy);
98 stmt->SetString(6, centrality);
99 if (event_count ==
nullptr)
102 stmt->SetInt(7, *event_count);
107 if (file_hash ==
nullptr)
110 stmt->SetString(9, *file_hash);
111 if (file_desc ==
nullptr)
114 stmt->SetString(10, *file_desc);
117 if (!stmt->Process()) {
118 cout <<
"ERROR: inserting new simulation file to the Database has been failed" << endl;
128 TSQLStatement* stmt_last =
129 db_server->Statement(
"SELECT currval(pg_get_serial_sequence('simulation_file','file_id'))");
132 if (stmt_last->Process()) {
134 stmt_last->StoreResult();
137 if (!stmt_last->NextResultRow()) {
138 cout <<
"ERROR: no last ID in DB!" << endl;
142 file_id = stmt_last->GetInt(0);
146 cout <<
"ERROR: getting last ID has been failed!" << endl;
152 tmp_file_id = file_id;
153 TString tmp_generator_name;
154 tmp_generator_name = generator_name;
156 tmp_file_type = file_type;
157 TString tmp_file_path;
158 tmp_file_path = file_path;
159 TString tmp_beam_particle;
160 tmp_beam_particle = beam_particle;
161 TString tmp_target_particle;
162 tmp_target_particle = target_particle;
164 if (energy ==
nullptr)
165 tmp_energy =
nullptr;
167 tmp_energy =
new double(*energy);
168 TString tmp_centrality;
169 tmp_centrality = centrality;
170 int* tmp_event_count;
171 if (event_count ==
nullptr)
172 tmp_event_count =
nullptr;
174 tmp_event_count =
new int(*event_count);
175 int64_t* tmp_file_size;
177 tmp_file_size =
nullptr;
180 TString* tmp_file_hash;
181 if (file_hash ==
nullptr)
182 tmp_file_hash =
nullptr;
184 tmp_file_hash =
new TString(*file_hash);
185 TString* tmp_file_desc;
186 if (file_desc ==
nullptr)
187 tmp_file_desc =
nullptr;
189 tmp_file_desc =
new TString(*file_desc);
191 return new UniSimulationFile(connDb, tmp_file_id, tmp_generator_name, tmp_file_type, tmp_file_path,
192 tmp_beam_particle, tmp_target_particle, tmp_energy, tmp_centrality, tmp_event_count,
193 tmp_file_size, tmp_file_hash, tmp_file_desc);
200 if (connDb ==
nullptr)
205 TString sql = TString::Format(
"select file_id, generator_name, file_type, file_path, beam_particle, "
206 "target_particle, energy, centrality, event_count, file_size, file_hash, file_desc "
207 "from simulation_file "
208 "where file_id = %d",
210 TSQLStatement* stmt = db_server->Statement(sql);
213 if (!stmt->Process()) {
214 cout <<
"ERROR: getting simulation file from the database has been failed" << endl;
225 if (!stmt->NextResultRow()) {
226 cout <<
"ERROR: simulation file was not found in the database" << endl;
234 tmp_file_id = stmt->GetInt(0);
235 TString tmp_generator_name;
236 tmp_generator_name = stmt->GetString(1);
238 tmp_file_type = stmt->GetInt(2);
239 TString tmp_file_path;
240 tmp_file_path = stmt->GetString(3);
241 TString tmp_beam_particle;
242 tmp_beam_particle = stmt->GetString(4);
243 TString tmp_target_particle;
244 tmp_target_particle = stmt->GetString(5);
247 tmp_energy =
nullptr;
249 tmp_energy =
new double(stmt->GetDouble(6));
250 TString tmp_centrality;
251 tmp_centrality = stmt->GetString(7);
252 int* tmp_event_count;
254 tmp_event_count =
nullptr;
256 tmp_event_count =
new int(stmt->GetInt(8));
257 int64_t* tmp_file_size;
259 tmp_file_size =
nullptr;
261 tmp_file_size =
new int64_t(stmt->GetLong64(9));
262 TString* tmp_file_hash;
263 if (stmt->IsNull(10))
264 tmp_file_hash =
nullptr;
266 tmp_file_hash =
new TString(stmt->GetString(10));
267 TString* tmp_file_desc;
268 if (stmt->IsNull(11))
269 tmp_file_desc =
nullptr;
271 tmp_file_desc =
new TString(stmt->GetString(11));
275 return new UniSimulationFile(connDb, tmp_file_id, tmp_generator_name, tmp_file_type, tmp_file_path,
276 tmp_beam_particle, tmp_target_particle, tmp_energy, tmp_centrality, tmp_event_count,
277 tmp_file_size, tmp_file_hash, tmp_file_desc);
284 if (connDb ==
nullptr)
289 TString sql = TString::Format(
"select file_id, generator_name, file_type, file_path, beam_particle, "
290 "target_particle, energy, centrality, event_count, file_size, file_hash, file_desc "
291 "from simulation_file "
292 "where lower(file_path) = lower('%s')",
294 TSQLStatement* stmt = db_server->Statement(sql);
297 if (!stmt->Process()) {
298 cout <<
"ERROR: getting simulation file from the database has been failed" << endl;
309 if (!stmt->NextResultRow()) {
310 cout <<
"ERROR: simulation file was not found in the database" << endl;
318 tmp_file_id = stmt->GetInt(0);
319 TString tmp_generator_name;
320 tmp_generator_name = stmt->GetString(1);
322 tmp_file_type = stmt->GetInt(2);
323 TString tmp_file_path;
324 tmp_file_path = stmt->GetString(3);
325 TString tmp_beam_particle;
326 tmp_beam_particle = stmt->GetString(4);
327 TString tmp_target_particle;
328 tmp_target_particle = stmt->GetString(5);
331 tmp_energy =
nullptr;
333 tmp_energy =
new double(stmt->GetDouble(6));
334 TString tmp_centrality;
335 tmp_centrality = stmt->GetString(7);
336 int* tmp_event_count;
338 tmp_event_count =
nullptr;
340 tmp_event_count =
new int(stmt->GetInt(8));
341 int64_t* tmp_file_size;
343 tmp_file_size =
nullptr;
345 tmp_file_size =
new int64_t(stmt->GetLong64(9));
346 TString* tmp_file_hash;
347 if (stmt->IsNull(10))
348 tmp_file_hash =
nullptr;
350 tmp_file_hash =
new TString(stmt->GetString(10));
351 TString* tmp_file_desc;
352 if (stmt->IsNull(11))
353 tmp_file_desc =
nullptr;
355 tmp_file_desc =
new TString(stmt->GetString(11));
359 return new UniSimulationFile(connDb, tmp_file_id, tmp_generator_name, tmp_file_type, tmp_file_path,
360 tmp_beam_particle, tmp_target_particle, tmp_energy, tmp_centrality, tmp_event_count,
361 tmp_file_size, tmp_file_hash, tmp_file_desc);
368 if (connDb ==
nullptr)
373 TString sql = TString::Format(
"select 1 "
374 "from simulation_file "
375 "where file_id = %d",
377 TSQLStatement* stmt = db_server->Statement(sql);
380 if (!stmt->Process()) {
381 cout <<
"ERROR: getting simulation file from the database has been failed" << endl;
392 if (!stmt->NextResultRow()) {
408 if (connDb ==
nullptr)
413 TString sql = TString::Format(
"select 1 "
414 "from simulation_file "
415 "where lower(file_path) = lower('%s')",
417 TSQLStatement* stmt = db_server->Statement(sql);
420 if (!stmt->Process()) {
421 cout <<
"ERROR: getting simulation file from the database has been failed" << endl;
432 if (!stmt->NextResultRow()) {
448 if (connDb ==
nullptr)
453 TString sql = TString::Format(
"delete from simulation_file "
454 "where file_id = $1");
455 TSQLStatement* stmt = db_server->Statement(sql);
457 stmt->NextIteration();
458 stmt->SetInt(0, file_id);
461 if (!stmt->Process()) {
462 cout <<
"ERROR: deleting simulation file from the dataBase has been failed" << endl;
478 if (connDb ==
nullptr)
483 TString sql = TString::Format(
"delete from simulation_file "
484 "where lower(file_path) = lower($1)");
485 TSQLStatement* stmt = db_server->Statement(sql);
487 stmt->NextIteration();
488 stmt->SetString(0, file_path);
491 if (!stmt->Process()) {
492 cout <<
"ERROR: deleting simulation file from the DataBase has been failed" << endl;
508 if (connDb ==
nullptr)
513 TString sql = TString::Format(
"select file_id, generator_name, file_type, file_path, beam_particle, "
514 "target_particle, energy, centrality, event_count, file_size, file_hash, file_desc "
515 "from simulation_file");
516 TSQLStatement* stmt = db_server->Statement(sql);
519 if (!stmt->Process()) {
520 cout <<
"ERROR: getting all 'simulation files' from the dataBase has been failed" << endl;
531 cout <<
"Table 'simulation_file':" << endl;
532 while (stmt->NextResultRow()) {
534 cout << (stmt->GetInt(0));
535 cout <<
", generator_name: ";
536 cout << (stmt->GetString(1));
537 cout <<
", file_type: ";
538 cout << (stmt->GetInt(2));
539 cout <<
", file_path: ";
540 cout << (stmt->GetString(3));
541 cout <<
", beam_particle: ";
542 cout << (stmt->GetString(4));
543 cout <<
", target_particle: ";
544 cout << (stmt->GetString(5));
545 cout <<
", energy: ";
549 cout << stmt->GetDouble(6);
550 cout <<
", centrality: ";
551 cout << (stmt->GetString(7));
552 cout <<
", event_count: ";
556 cout << stmt->GetInt(8);
557 cout <<
", file_size: ";
561 cout << stmt->GetLong64(9);
562 cout <<
", file_hash: ";
563 if (stmt->IsNull(10))
566 cout << stmt->GetString(10);
567 cout <<
", file_desc: ";
568 if (stmt->IsNull(11))
571 cout << stmt->GetString(11);
585 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
591 TString sql = TString::Format(
"update simulation_file "
592 "set generator_name = $1 "
593 "where file_id = $2");
594 TSQLStatement* stmt = db_server->Statement(sql);
596 stmt->NextIteration();
597 stmt->SetString(0, generator_name);
598 stmt->SetInt(1, i_file_id);
601 if (!stmt->Process()) {
602 cout <<
"ERROR: updating information about simulation file has been failed" << endl;
608 str_generator_name = generator_name;
617 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
623 TString sql = TString::Format(
"update simulation_file "
624 "set file_type = $1 "
625 "where file_id = $2");
626 TSQLStatement* stmt = db_server->Statement(sql);
628 stmt->NextIteration();
629 stmt->SetInt(0, file_type);
630 stmt->SetInt(1, i_file_id);
633 if (!stmt->Process()) {
634 cout <<
"ERROR: updating information about simulation file has been failed" << endl;
640 i_file_type = file_type;
649 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
655 TString sql = TString::Format(
"update simulation_file "
656 "set file_path = $1 "
657 "where file_id = $2");
658 TSQLStatement* stmt = db_server->Statement(sql);
660 stmt->NextIteration();
661 stmt->SetString(0, file_path);
662 stmt->SetInt(1, i_file_id);
665 if (!stmt->Process()) {
666 cout <<
"ERROR: updating information about simulation file has been failed" << endl;
672 str_file_path = file_path;
681 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
687 TString sql = TString::Format(
"update simulation_file "
688 "set beam_particle = $1 "
689 "where file_id = $2");
690 TSQLStatement* stmt = db_server->Statement(sql);
692 stmt->NextIteration();
693 stmt->SetString(0, beam_particle);
694 stmt->SetInt(1, i_file_id);
697 if (!stmt->Process()) {
698 cout <<
"ERROR: updating information about simulation file has been failed" << endl;
704 str_beam_particle = beam_particle;
713 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
719 TString sql = TString::Format(
"update simulation_file "
720 "set target_particle = $1 "
721 "where file_id = $2");
722 TSQLStatement* stmt = db_server->Statement(sql);
724 stmt->NextIteration();
725 stmt->SetString(0, target_particle);
726 stmt->SetInt(1, i_file_id);
729 if (!stmt->Process()) {
730 cout <<
"ERROR: updating information about simulation file has been failed" << endl;
736 str_target_particle = target_particle;
745 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
751 TString sql = TString::Format(
"update simulation_file "
753 "where file_id = $2");
754 TSQLStatement* stmt = db_server->Statement(sql);
756 stmt->NextIteration();
757 if (energy ==
nullptr)
760 stmt->SetDouble(0, *energy);
761 stmt->SetInt(1, i_file_id);
764 if (!stmt->Process()) {
765 cout <<
"ERROR: updating information about simulation file has been failed" << endl;
773 if (energy ==
nullptr)
776 d_energy =
new double(*energy);
785 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
791 TString sql = TString::Format(
"update simulation_file "
792 "set centrality = $1 "
793 "where file_id = $2");
794 TSQLStatement* stmt = db_server->Statement(sql);
796 stmt->NextIteration();
797 stmt->SetString(0, centrality);
798 stmt->SetInt(1, i_file_id);
801 if (!stmt->Process()) {
802 cout <<
"ERROR: updating information about simulation file has been failed" << endl;
808 str_centrality = centrality;
817 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
823 TString sql = TString::Format(
"update simulation_file "
824 "set event_count = $1 "
825 "where file_id = $2");
826 TSQLStatement* stmt = db_server->Statement(sql);
828 stmt->NextIteration();
829 if (event_count ==
nullptr)
832 stmt->SetInt(0, *event_count);
833 stmt->SetInt(1, i_file_id);
836 if (!stmt->Process()) {
837 cout <<
"ERROR: updating information about simulation file has been failed" << endl;
844 delete i_event_count;
845 if (event_count ==
nullptr)
846 i_event_count =
nullptr;
848 i_event_count =
new int(*event_count);
857 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
863 TString sql = TString::Format(
"update simulation_file "
864 "set file_size = $1 "
865 "where file_id = $2");
866 TSQLStatement* stmt = db_server->Statement(sql);
868 stmt->NextIteration();
873 stmt->SetInt(1, i_file_id);
876 if (!stmt->Process()) {
877 cout <<
"ERROR: updating information about simulation file has been failed" << endl;
884 delete i64_file_size;
886 i64_file_size =
nullptr;
897 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
903 TString sql = TString::Format(
"update simulation_file "
904 "set file_hash = $1 "
905 "where file_id = $2");
906 TSQLStatement* stmt = db_server->Statement(sql);
908 stmt->NextIteration();
909 if (file_hash ==
nullptr)
912 stmt->SetString(0, *file_hash);
913 stmt->SetInt(1, i_file_id);
916 if (!stmt->Process()) {
917 cout <<
"ERROR: updating information about simulation file has been failed" << endl;
924 delete str_file_hash;
925 if (file_hash ==
nullptr)
926 str_file_hash =
nullptr;
928 str_file_hash =
new TString(*file_hash);
937 cout <<
"CRITICAL ERROR: Connection object is null" << endl;
943 TString sql = TString::Format(
"update simulation_file "
944 "set file_desc = $1 "
945 "where file_id = $2");
946 TSQLStatement* stmt = db_server->Statement(sql);
948 stmt->NextIteration();
949 if (file_desc ==
nullptr)
952 stmt->SetString(0, *file_desc);
953 stmt->SetInt(1, i_file_id);
956 if (!stmt->Process()) {
957 cout <<
"ERROR: updating information about simulation file has been failed" << endl;
964 delete str_file_desc;
965 if (file_desc ==
nullptr)
966 str_file_desc =
nullptr;
968 str_file_desc =
new TString(*file_desc);
977 cout <<
"Table 'simulation_file'";
978 cout <<
". file_id: " << i_file_id <<
". generator_name: " << str_generator_name <<
". file_type: " << i_file_type
979 <<
". file_path: " << str_file_path <<
". beam_particle: " << str_beam_particle
980 <<
". target_particle: " << str_target_particle
981 <<
". energy: " << (d_energy ==
nullptr ?
"nullptr" : TString::Format(
"%f", *d_energy))
982 <<
". centrality: " << str_centrality
983 <<
". event_count: " << (i_event_count ==
nullptr ?
"nullptr" : TString::Format(
"%d", *i_event_count))
984 <<
". file_size: " << (i64_file_size ==
nullptr ?
"nullptr" : TString::Format(
"%ld", *i64_file_size))
985 <<
". file_hash: " << (str_file_hash ==
nullptr ?
"nullptr" : *str_file_hash)
986 <<
". file_desc: " << (str_file_desc ==
nullptr ?
"nullptr" : *str_file_desc) << endl;
994 TObjArray* arrayResult =
nullptr;
997 if (connDb ==
nullptr) {
998 cout <<
"ERROR: connection to the Unified Condition Database was failed" << endl;
1004 TString sql = TString::Format(
"select file_id, generator_name, file_type, file_path, beam_particle, "
1005 "target_particle, energy, centrality, event_count, file_size, file_hash, file_desc "
1006 "from simulation_file");
1007 TSQLStatement* stmt = db_server->Statement(sql);
1011 if (!stmt->Process()) {
1012 cout <<
"ERROR: getting record from the database has been failed" << endl;
1021 stmt->StoreResult();
1024 arrayResult =
new TObjArray();
1025 arrayResult->SetOwner(kTRUE);
1026 while (stmt->NextResultRow()) {
1028 if (connRun ==
nullptr) {
1030 <<
"ERROR: the connection to the Unified Condition Database for the selected simulation file was failed"
1037 tmp_file_id = stmt->GetInt(0);
1038 TString tmp_generator_name;
1039 tmp_generator_name = stmt->GetString(1);
1041 tmp_file_type = stmt->GetInt(2);
1042 TString tmp_file_path;
1043 tmp_file_path = stmt->GetString(3);
1044 TString tmp_beam_particle;
1045 tmp_beam_particle = stmt->GetString(4);
1046 TString tmp_target_particle;
1047 tmp_target_particle = stmt->GetString(5);
1049 if (stmt->IsNull(6))
1050 tmp_energy =
nullptr;
1052 tmp_energy =
new double(stmt->GetDouble(6));
1053 TString tmp_centrality;
1054 tmp_centrality = stmt->GetString(7);
1055 int* tmp_event_count;
1056 if (stmt->IsNull(8))
1057 tmp_event_count =
nullptr;
1059 tmp_event_count =
new int(stmt->GetInt(8));
1060 int64_t* tmp_file_size;
1061 if (stmt->IsNull(9))
1062 tmp_file_size =
nullptr;
1064 tmp_file_size =
new int64_t(stmt->GetLong64(9));
1065 TString* tmp_file_hash;
1066 if (stmt->IsNull(10))
1067 tmp_file_hash =
nullptr;
1069 tmp_file_hash =
new TString(stmt->GetString(10));
1070 TString* tmp_file_desc;
1071 if (stmt->IsNull(11))
1072 tmp_file_desc =
nullptr;
1074 tmp_file_desc =
new TString(stmt->GetString(11));
1076 arrayResult->Add((TObject*)
new UniSimulationFile(connDb, tmp_file_id, tmp_generator_name, tmp_file_type,
1077 tmp_file_path, tmp_beam_particle, tmp_target_particle,
1078 tmp_energy, tmp_centrality, tmp_event_count, tmp_file_size,
1079 tmp_file_hash, tmp_file_desc));
1089 TObjArray* arrayResult =
nullptr;
1090 search_conditions.SetOwner(kTRUE);
1093 if (connDb ==
nullptr) {
1094 cout <<
"ERROR: connection to the Unified Condition Database was failed" << endl;
1100 TString sql = TString::Format(
"select file_id, generator_name, file_type, file_path, beam_particle, "
1101 "target_particle, energy, centrality, event_count, file_size, file_hash, file_desc "
1102 "from simulation_file");
1104 TString strCondition;
1105 bool isFirst =
true;
1106 TIter next(&search_conditions);
1113 strCondition +=
"lower(file_path) ";
1116 strCondition +=
"lower(generator_name) ";
1119 strCondition +=
"lower(beam_particle) ";
1122 strCondition +=
"lower(target_particle) ";
1125 strCondition +=
"energy ";
1128 strCondition +=
"lower(centrality) ";
1131 strCondition +=
"event_count ";
1134 strCondition +=
"lower(file_desc) ";
1137 strCondition +=
"file_size ";
1140 cout <<
"ERROR: the column in the search condition was not defined, the condition is skipped" << endl;
1146 strCondition +=
"< ";
1149 strCondition +=
"<= ";
1152 strCondition +=
"= ";
1155 strCondition +=
"<> ";
1158 strCondition +=
"> ";
1161 strCondition +=
">= ";
1164 strCondition +=
"like ";
1167 strCondition +=
"is null ";
1170 strCondition +=
"is not null ";
1173 cout <<
"ERROR: the comparison operator in the search condition was not defined, the condition is "
1186 strCondition += Form(
"%d", curCondition->
GetIntValue());
1189 strCondition += Form(
"%u", curCondition->
GetUIntValue());
1195 strCondition += Form(
"lower('%s')", curCondition->
GetStringValue().Data());
1198 strCondition += Form(
"'%s'", curCondition->
GetDatimeValue().AsSQLString());
1201 cout <<
"ERROR: the value type in the search condition was not found, the condition is skipped" << endl;
1211 sql += strCondition;
1213 sql +=
" order by generator_name";
1215 TSQLStatement* stmt = db_server->Statement(sql);
1219 if (!stmt->Process()) {
1220 cout <<
"ERROR: getting simulation files from the Unified Condition Database has been failed" << endl;
1228 stmt->StoreResult();
1231 arrayResult =
new TObjArray();
1232 arrayResult->SetOwner(kTRUE);
1233 while (stmt->NextResultRow()) {
1235 if (connRun ==
nullptr) {
1237 <<
"ERROR: the connection to the Unified Condition Database for the selected simulation file was failed"
1243 tmp_file_id = stmt->GetInt(0);
1244 TString tmp_generator_name;
1245 tmp_generator_name = stmt->GetString(1);
1247 tmp_file_type = stmt->GetInt(2);
1248 TString tmp_file_path;
1249 tmp_file_path = stmt->GetString(3);
1250 TString tmp_beam_particle;
1251 tmp_beam_particle = stmt->GetString(4);
1252 TString tmp_target_particle;
1253 tmp_target_particle = stmt->GetString(5);
1255 if (stmt->IsNull(6))
1256 tmp_energy =
nullptr;
1258 tmp_energy =
new double(stmt->GetDouble(6));
1259 TString tmp_centrality;
1260 tmp_centrality = stmt->GetString(7);
1261 int* tmp_event_count;
1262 if (stmt->IsNull(8))
1263 tmp_event_count =
nullptr;
1265 tmp_event_count =
new int(stmt->GetInt(8));
1266 int64_t* tmp_file_size;
1267 if (stmt->IsNull(9))
1268 tmp_file_size =
nullptr;
1270 tmp_file_size =
new int64_t(stmt->GetLong64(9));
1271 TString* tmp_file_hash;
1272 if (stmt->IsNull(10))
1273 tmp_file_hash =
nullptr;
1275 tmp_file_hash =
new TString(stmt->GetString(10));
1276 TString* tmp_file_desc;
1277 if (stmt->IsNull(11))
1278 tmp_file_desc =
nullptr;
1280 tmp_file_desc =
new TString(stmt->GetString(11));
1282 arrayResult->Add((TObject*)
new UniSimulationFile(connDb, tmp_file_id, tmp_generator_name, tmp_file_type,
1283 tmp_file_path, tmp_beam_particle, tmp_target_particle,
1284 tmp_energy, tmp_centrality, tmp_event_count, tmp_file_size,
1285 tmp_file_hash, tmp_file_desc));
1295 TObjArray search_conditions;
1296 search_conditions.Add((TObject*)&search_condition);
1298 return Search(search_conditions);
static UniConnection * Open()
TSQLServer * GetSQLServer()
enumConditions GetCondition()
@ conditionGreaterOrEqual
unsigned int GetUIntValue()
static int DeleteSimulationFile(int file_id)
delete simulation file from the database
int SetEnergy(double *energy)
set energy of the current simulation file
void Print()
print information about current simulation file
int SetEventCount(int *event_count)
set event count of the current simulation file
int SetFileHash(TString *file_hash)
set file hash of the current simulation file
int SetCentrality(TString centrality)
set centrality of the current simulation file
virtual ~UniSimulationFile()
static UniSimulationFile * GetSimulationFile(int file_id)
get simulation file from the database
int SetFileType(int file_type)
set file type of the current simulation file
static int PrintAll()
print all simulation files
int SetFileDesc(TString *file_desc)
set file desc of the current simulation file
static TObjArray * GetSimulationFiles()
get array of all UniSimulationFile-s from the database
int SetBeamParticle(TString beam_particle)
set beam particle of the current simulation file
static int CheckSimulationFileExists(int file_id)
check simulation file exists in the database: 1- true, 0 - false, <0 - database operation error
int SetGeneratorName(TString generator_name)
set generator name of the current simulation file
int SetFilePath(TString file_path)
set file path of the current simulation file
int SetTargetParticle(TString target_particle)
set target particle of the current simulation file
static TObjArray * Search(UniSearchCondition &search_condition)
get simulation files corresponding to the specified single condition and set owner for search_conditi...
static UniSimulationFile * CreateSimulationFile(TString generator_name, int file_type, TString file_path, TString beam_particle, TString target_particle, double *energy, TString centrality, int *event_count, int64_t *file_size, TString *file_hash, TString *file_desc)
add new simulation file to the database
int SetFileSize(int64_t *file_size)
set file size of the current simulation file