Changeset 7254 for trunk/MagicSoft/Mars/datacenter/macros
- Timestamp:
- 08/02/05 18:20:19 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/macros/buildsequenceentries.C
r7249 r7254 177 177 Bool_t CheckSequence(MSQLServer &serv, TString datapath, TString sequpath, Int_t from, Int_t to, Bool_t dummy) 178 178 { 179 Int_t rc=0; //rc=0 means sequence is still the same -> insert not neccessary 179 Int_t rc=0; 180 //rc=0 means sequence not found -> insert 180 181 //rc=1 means deleting sequence(s) worked -> insert 182 //rc=2 means sequence is still the same -> insert not neccessary 181 183 //if deleting sequence doesn't work -> return -1 182 184 183 185 184 186 //getting # of sequence (in sequDB) between from and to 185 TString query(Form("SELECT fSequenceFirst FROM Sequences WHERE fSequenceFirst BETWEEN %d and %d", from, to)); 187 TString query("SELECT fSequenceFirst FROM Sequences WHERE fSequenceFirst "); 188 query += Form("BETWEEN %d and %d OR fSequenceLast BETWEEN %d and %d", 189 from, to, from, to); 186 190 187 191 TSQLResult *res = serv.Query(query); … … 331 335 } 332 336 } 337 rc=2; 333 338 break; 334 339 … … 351 356 Bool_t InsertSequence(MSQLServer &serv, Int_t from, Int_t to) 352 357 { 358 359 cout << "Inserting sequence " << from << " ... " << endl; 353 360 354 361 // ========== Request number of events ========== … … 423 430 TString query1("INSERT Sequences SET"); 424 431 query1+=Form(" fSequenceFirst=%d, fSequenceLast=%d,", from, to); 425 query1+=Form(" f ProjectKEY=%s,", (*row)[0]);426 query1+=Form(" f SourceKEY=%s,", (*row)[1]);432 query1+=Form(" fSourceKEY=%s,", (*row)[0]); 433 query1+=Form(" fProjectKEY=%s,", (*row)[1]); 427 434 query1+=Form(" fNumEvents=%s,", nevts.Data()); 428 435 query1+=Form(" fRunTime=%s,", secs.Data()); … … 451 458 delete res; 452 459 460 453 461 res = serv.Query(query1); 454 462 if (!res) 455 return kFALSE; 463 { 464 cout << "ERROR - Could not insert Sequence into Sequences." << endl; 465 return kFALSE; 466 } 456 467 delete res; 457 468 458 469 res = serv.Query(query2); 459 470 if (!res) 460 return kFALSE; 471 { 472 cout << "ERROR - Could not update RunData." << endl; 473 return kFALSE; 474 } 461 475 delete res; 462 476 463 477 res = serv.Query(query3); 464 478 if (!res) 465 return kFALSE; 479 { 480 cout << "ERROR - Could not insert Sequence into SequenceProcessStatus." << endl; 481 return kFALSE; 482 } 466 483 delete res; 467 484 … … 497 514 { 498 515 case 0: 499 cout << " inserting sequence not necessary" << endl; 500 return kTRUE; 516 cout << " sequence not found -> inserting " << from << flush ; 517 if (dummy) 518 { 519 cout << " <dummy> " << endl; 520 return kTRUE; 521 } 522 cout << endl; 523 return InsertSequence(serv, from, to); 501 524 502 525 case 1: … … 508 531 } 509 532 cout << endl; 510 rc = InsertSequence(serv, from, to); 511 if (!rc) 512 cout << "InsertSequence failed!" << endl; 513 break; 533 return InsertSequence(serv, from, to); 534 535 case 2: 536 cout << " sequence is already existing -> inserting not necessary" << endl; 537 return kTRUE; 514 538 515 539 case -1: 516 540 cout << " deleting went wrong " << endl; 517 r c=kFALSE;541 return kFALSE; 518 542 } 519 543
Note:
See TracChangeset
for help on using the changeset viewer.