source: trunk/MagicSoft/Mars/datacenter/macros/buildsequenceentries.C@ 7239

Last change on this file since 7239 was 7239, checked in by Daniela Dorner, 19 years ago
*** empty log message ***
File size: 20.9 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Thomas Bretz, 08/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
19! Author(s): Daniela Dorner, 08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
20!
21! Copyright: MAGIC Software Development, 2000-2004
22!
23!
24\* ======================================================================== */
25
26/////////////////////////////////////////////////////////////////////////////
27//
28// buildsequenceentries.C
29// ======================
30//
31// to group the runs of one night into sequences, this marco:
32// - reads the runinformation of one night from the database
33// - group the runs into sets of following runs with the same conditions
34// - groups the runs in this sets to sequences such that each run belongs
35// to the nearest (in time) calibration run
36// - check if the runs with the same runtype have the same calibration script
37// and the same trigger tables
38//
39/////////////////////////////////////////////////////////////////////////////
40#include <iostream>
41#include <iomanip>
42#include <fstream>
43
44#include <MSQLServer.h>
45#include <TSQLRow.h>
46#include <TSQLResult.h>
47
48#include <TEnv.h>
49#include <TMath.h>
50#include <TExMap.h>
51#include <TArrayI.h>
52#include <TRegexp.h>
53#include <TSystem.h>
54
55#include <MTime.h>
56#include <MDirIter.h>
57
58using namespace std;
59
60int debug = 0;
61
62Bool_t DeleteSequence(MSQLServer &serv, TString datapath, TString sequpath, Int_t sequ, Bool_t dummy)
63{
64 TString query1(Form("DELETE FROM Calibration WHERE fSequenceFirst=%d", sequ));
65 TString query2(Form("DELETE FROM Star WHERE fSequenceFirst=%d", sequ));
66 TString query3(Form("DELETE FROM SequenceProcessStatus WHERE fSequenceFirst=%d", sequ));
67 TString query4(Form("UPDATE RunData SET fSequenceFirst=0 WHERE fSequenceFirst=%d", sequ));
68 TString query5(Form("DELETE FROM Sequences WHERE fSequenceFirst=%d AND fManuallyChangedKEY=1", sequ));
69
70 TString fname(Form("%s/%04d/sequence%08d.txt", sequpath.Data(),sequ/10000, sequ));
71 TString command(Form("rm -r %s/callisto/%04d/%08d/", datapath.Data(), sequ/10000, sequ));
72 TString command2(Form("rm -r %s/star/%04d/%08d/", datapath.Data(), sequ/10000, sequ));
73
74 if (dummy)
75 {
76 cout << "not using dummy=kTRUE the following commands would be executed: " << endl;
77 cout << "queries: " << endl;
78 cout << query1 << endl;
79 cout << query2 << endl;
80 cout << query3 << endl;
81 cout << query4 << endl;
82 cout << query5 << endl;
83 cout << "removing files:" << endl;
84 cout << "unlink " << fname << endl;
85 cout << command << endl;
86 cout << command2 << endl;
87 return kTRUE;
88 }
89
90 TSQLResult *res = serv.Query(query1);
91 if (!res)
92 return kFALSE;
93 delete res;
94
95 res = serv.Query(query2);
96 if (!res)
97 return kFALSE;
98 delete res;
99
100 res = serv.Query(query3);
101 if (!res)
102 return kFALSE;
103 delete res;
104
105 res = serv.Query(query4);
106 if (!res)
107 return kFALSE;
108 delete res;
109
110 res = serv.Query(query5);
111 if (!res)
112 return kFALSE;
113 delete res;
114
115 gSystem->Unlink(fname);
116
117 gSystem->Exec(command);
118 gSystem->Exec(command2);
119
120 return kTRUE;
121}
122
123Int_t DoCheck(TSQLResult &res)
124{
125 TArrayI data(5);
126 Int_t n = 0;
127
128 TSQLRow *row=0;
129 while ((row=res.Next()))
130 {
131 n++;
132
133 if (data[0]==0)
134 {
135 for (int i=0; i<data.GetSize(); i++)
136 data[i] = atoi((*row)[i]);
137 continue;
138 }
139
140 for (int i=1; i<data.GetSize(); i++)
141 {
142 if (data[i] != atoi((*row)[i]))
143 return i+1;
144 }
145 }
146 return n==0 ? 0 : -1;
147}
148
149Bool_t CheckRuns(MSQLServer &serv, Int_t from, Int_t to, Int_t type)
150{
151 TString query("SELECT fRunNumber, fL1TriggerTableKEY, fL2TriggerTableKEY,"
152 " fCalibrationScriptKEY, fProjectKEY FROM RunData");
153 query += Form(" WHERE fRunTypeKEY=%d AND fExcludedFDAKEY=1 AND "
154 " (fRunNumber BETWEEN %d AND %d)"
155 " ORDER BY fRunNumber", type, from, to);
156
157 TSQLResult *res = serv.Query(query);
158 if (!res)
159 return kFALSE;
160
161 Int_t rc = DoCheck(*res);
162 delete res;
163
164 switch (rc)
165 {
166 case 0: cout << "ERROR - No runs found for check!" << endl; break;
167 case 1: cout << "ERROR - fRunNumber doesn't match!" << endl; break;
168 case 2: cout << "ERROR - fL1TriggerTableKEY doesn't match!" << endl; break;
169 case 3: cout << "ERROR - fL2TriggerTableKEY doesn't match!" << endl; break;
170 case 4: cout << "ERROR - fCalibrationScriptKEY doesn't match!" << endl; break;
171 case 5: cout << "ERROR - fProjectKEY doesn't match!" << endl; break;
172 }
173
174 return rc<0;
175}
176
177Bool_t CheckSequence(MSQLServer &serv, TString datapath, TString sequpath, Int_t from, Int_t to, Bool_t dummy)
178{
179 Bool_t rc=kFALSE;
180
181 TString query("SELECT fSequenceFirst, count(*) FROM RunData ");
182 query += Form(" WHERE fExcludedFDAKEY=1 AND (fRunNumber BETWEEN %d AND %d)"
183 " GROUP BY fSequenceFirst", from, to);
184
185 TSQLResult *res = serv.Query(query);
186 if (!res)
187 return kFALSE;
188
189 Int_t count=0;
190 Int_t nor=0;
191 TArrayI sequences;
192
193 TSQLRow *row=0;
194 while ((row=res->Next()))
195 {
196 sequences.Set(count+1);
197 sequences.AddAt(atoi((*row)[0]), count);
198// cout << "sequence: " << sequences.At(count) << endl;
199 nor=atoi((*row)[1]);
200 count++;
201 }
202
203 delete res;
204
205 if (sequences.GetSize()>1)
206 {
207 for (Int_t i=0;i<sequences.GetSize();i++)
208 {
209 rc=kTRUE;
210 if (sequences.At(i)!=0)
211 {
212 cout << "deleting sequence " << sequences.At(i) << "... <" << i << ">" << endl;
213 if(!DeleteSequence(serv, datapath, sequpath, sequences.At(i), dummy))
214 rc=kFALSE;
215 }
216 }
217 return rc;
218 }
219
220 if (sequences.At(0)==0)
221 return kTRUE;
222
223
224 query="SELECT fRunNumber FROM RunData ";
225 query += Form(" WHERE fExcludedFDAKEY=1 AND (fRunNumber BETWEEN %d AND %d)"
226 " ORDER BY fRunNumber", from, to);
227
228 res = serv.Query(query);
229 if (!res)
230 return kFALSE;
231
232 TArrayI runs;
233 count=0;
234 row=0;
235 while ((row=res->Next()))
236 {
237 runs.Set(count+1);
238 runs.AddAt(atoi((*row)[0]), count);
239 count++;
240 }
241
242 delete res;
243
244
245 if (nor==runs.GetSize() && sequences.GetSize()==1)
246 {
247 query="SELECT fRunNumber FROM RunData ";
248 query += Form(" WHERE fSequenceFirst=%d ", sequences.At(0));
249
250 res = serv.Query(query);
251 if (!res)
252 return kFALSE;
253
254 TArrayI oldruns;
255 count=0;
256 row=0;
257 while ((row=res->Next()))
258 {
259 oldruns.Set(count+1);
260 oldruns.AddAt(atoi((*row)[0]), count);
261 count++;
262 }
263
264 if (runs.GetSize()!=oldruns.GetSize())
265 {
266 cout << "different sequsizes -> deleting sequence " << sequences.At(0) << endl;
267 return DeleteSequence(serv, datapath, sequpath, sequences.At(0), dummy);
268 }
269
270 for (Int_t i=0; i<runs.GetSize(); i++)
271 {
272 if (runs.At(i)==oldruns.At(i))
273 continue;
274 cout << "different runs -> deleting sequence " << sequences.At(0) << endl;
275 return DeleteSequence(serv, datapath, sequpath, sequences.At(0), dummy);
276 }
277
278 delete res;
279 }
280
281 query="SELECT fSequenceFirst FROM Sequences ";
282 query += Form(" WHERE fSequenceFirst fRunNumber BETWEEN %d AND %d "
283 " ORDER BY fSequenceFirst", from, to);
284
285 cout << query << endl;
286
287 res = serv.Query(query);
288 if (!res)
289 return kFALSE;
290
291 Int_t sequ=0;
292 while ((row=res->Next()))
293 {
294 sequ=atoi((*row)[0]);
295 cout << "deleting sequence " << sequ << endl;
296 if(!DeleteSequence(serv, datapath, sequpath, sequ, dummy))
297 rc=kFALSE;
298 }
299
300 delete res;
301
302
303 cout << "same sequence -> nothing to do..." << endl;
304 return rc;
305}
306
307Bool_t InsertSequence(MSQLServer &serv, Int_t from, Int_t to)
308{
309
310 // ========== Request number of events ==========
311 TString query("SELECT SUM(fNumEvents), "
312 " SUM(if(TIME_TO_SEC(fRunStop)-TIME_TO_SEC(fRunStart)<0,"
313 " TIME_TO_SEC(fRunStop)-TIME_TO_SEC(fRunStart)+24*60*60,"
314 " TIME_TO_SEC(fRunStop)-TIME_TO_SEC(fRunStart))), ");
315 query += " MIN(fZenithDistance), MAX(fZenithDistance), ";
316 query += " MIN(fAzimuth), MAX(fAzimuth) ";
317 query += Form(" FROM RunData WHERE fRunTypeKEY=2 AND "
318 " (fRunNumber BETWEEN %d AND %d) AND fExcludedFDAKEY=1",
319 from, to);
320
321 TSQLResult *res = serv.Query(query);
322 if (!res)
323 return kFALSE;
324
325 TSQLRow *row = res->Next();
326 if (!row || !(*row)[0])
327 {
328 cout << "ERROR - No result from query: " << query << endl;
329 return kFALSE;
330 }
331
332 TString nevts = (*row)[0];
333 TString secs = (*row)[1];
334 TString zdmin = (*row)[2];
335 TString zdmax = (*row)[3];
336 TString azmin = (*row)[4];
337 TString azmax = (*row)[5];
338
339 delete res;
340
341 // ========== Request start time of sequence ==========
342 query = Form("SELECT fRunStart FROM RunData WHERE fRunNumber=%d AND fExcludedFDAKEY=1", from);
343
344 res = serv.Query(query);
345 if (!res)
346 return kFALSE;
347
348 row = res->Next();
349 if (!row || !(*row)[0])
350 {
351 cout << "ERROR - No result from query: " << query << endl;
352 return kFALSE;
353 }
354
355 TString start((*row)[0]);
356
357 delete res;
358
359 // ========== Request data of sequence ==========
360 query = Form("SELECT fSourceKEY, fProjectKEY, "
361 " fL1TriggerTableKEY, fL1TriggerTableKEY,"
362 " fHvSettingsKEY, fDiscriminatorThresholdTableKEY,"
363 " fTriggerDelayTableKEY, fLightConditionsKEY, fTestFlagKEY"
364 " FROM RunData"
365 " WHERE fRunTypeKEY=2 AND fExcludedFDAKEY=1 AND (fRunNumber BETWEEN %d AND %d)"
366 " LIMIT 1", from, to);
367
368 res = serv.Query(query);
369 if (!res)
370 return kFALSE;
371
372 row = res->Next();
373 if (!row)
374 {
375 cout << "ERROR - No result from query: " << query << endl;
376 return kFALSE;
377 }
378
379 TString query1("INSERT Sequences SET");
380 query1+=Form(" fSequenceFirst=%d, fSequenceLast=%d,", from, to);
381 query1+=Form(" fProjectKEY=%s,", (*row)[0]);
382 query1+=Form(" fSourceKEY=%s,", (*row)[1]);
383 query1+=Form(" fNumEvents=%s,", nevts.Data());
384 query1+=Form(" fRunTime=%s,", secs.Data());
385 query1+=Form(" fRunStart=\"%s\",", start.Data());
386 query1+=Form(" fZenithDistanceMin=%s,", zdmin.Data());
387 query1+=Form(" fZenithDistanceMax=%s,", zdmax.Data());
388 query1+=Form(" fAzimuthMin=%s,", azmin.Data());
389 query1+=Form(" fAzimuthMax=%s,", azmax.Data());
390 query1+=Form(" fL1TriggerTableKEY=%s,", (*row)[2]);
391 query1+=Form(" fL2TriggerTableKEY=%s,", (*row)[3]);
392 query1+=Form(" fHvSettingsKEY=%s,", (*row)[4]);
393 query1+=Form(" fDiscriminatorThresholdTableKEY=%s,", (*row)[5]);
394 query1+=Form(" fTriggerDelayTableKEY=%s,", (*row)[6]);
395 query1+=Form(" fLightConditionsKEY=%s,", (*row)[7]);
396 query1+=Form(" fTestFlagKEY=%s, fManuallyChangedKEY=1", (*row)[8]);
397
398
399 TString query2 = Form("UPDATE RunData SET fSequenceFirst=%d WHERE"
400 " (fRunNumber BETWEEN %d AND %d) AND"
401 " (fRunTypeKEY BETWEEN 2 AND 4) AND"
402 " fSourceKEY=%d AND fHvSettingsKEY=%s AND fExcludedFDAKEY=1",
403 from, from, to, (*row)[1], (*row)[4]);
404
405 TString query3 = Form("INSERT SequenceProcessStatus SET fSequenceFirst=%d ", from);
406
407 delete res;
408
409 res = serv.Query(query1);
410 if (!res)
411 return kFALSE;
412 delete res;
413
414 res = serv.Query(query2);
415 if (!res)
416 return kFALSE;
417 delete res;
418
419 res = serv.Query(query3);
420 if (!res)
421 return kFALSE;
422 delete res;
423
424 return kTRUE;
425}
426
427Bool_t NewSequence(MSQLServer &serv, TString datapath, TString sequpath, Int_t from, Int_t to, Bool_t dummy)
428{
429 cout << "Found Sequence (" << from << ", " << to << ") ... checking runs..." << flush;
430
431 if (!CheckRuns(serv, from, to, 2))
432 {
433 cout << "Warning - Found inconsistency in data-runs (" << from << ", " << to << ")" << endl;
434 //sequence is not built, but kTRUE is returned, to allow
435 //the automatic processing of the other sequences of this day
436 return kTRUE;
437 }
438 if (!CheckRuns(serv, from, to, 3))
439 {
440 cout << "Warning - Found inconsistency in ped-runs (" << from << ", " << to << ")" << endl;
441 //sequence is not built, but kTRUE is returned, to allow
442 //the automatic processing of the other sequences of this day
443 return kTRUE;
444 }
445
446 cout << "ok." << endl;
447
448
449 cout << "checking Sequence..." << endl;
450
451 if (!CheckSequence(serv, datapath, sequpath, from, to, dummy))
452 {
453 cout << " inserting sequence not necessary" << endl;
454 return kTRUE;
455 }
456
457
458 if (dummy)
459 return kTRUE;
460
461 Bool_t rc = InsertSequence(serv, from, to);
462 if (!rc)
463 cout << "InsertSequence failed!" << endl;
464
465 return rc;
466}
467
468Bool_t Process(MSQLServer &serv, TString datapath, TString sequpath, Int_t from, Int_t to, Bool_t dummy)
469{
470
471 TString query(Form("SELECT fRunNumber, fRunTypeKEY, fRunStart, fRunStop"
472 " FROM RunData"
473 " WHERE fRunNumber BETWEEN %d AND %d AND "
474 " fExcludedFDAKEY=1 AND (fRunTypeKEY BETWEEN 2 AND 4)"
475 " ORDER BY fRunNumber", from, to));
476
477 TSQLResult *res = serv.Query(query);
478 if (!res)
479 return kFALSE;
480
481 TExMap map;
482
483 Int_t start=0;
484 Int_t stop=0;
485 Int_t last=0;
486 Int_t first=0;
487
488 MTime lasttime;
489
490 TSQLRow *row=0;
491
492 enum { UNKNOWN, PED=3, CAL=4, DATA=2 };
493 Char_t status = UNKNOWN;
494
495 Int_t nblocks = 0;
496
497 while ((row=res->Next()))
498 {
499 if (!(*row)[1])
500 continue;
501
502 if (start==0)
503 {
504 first = atoi((*row)[0]);
505 if (debug)
506 cout << "First Run: " << first << endl;
507 }
508
509 switch (atoi((*row)[1]))
510 {
511 case CAL: // ---------- CALIBRATION ----------
512 if (status!=CAL)
513 {
514 start = stop = atoi((*row)[0]);
515 if (!(*row)[2])
516 cout << "No time available... skipped." << endl;
517 else
518 {
519 MTime *tm = new MTime;
520 tm->SetSqlDateTime((*row)[2]);
521 map.Add((ULong_t)map.GetSize(), (Long_t)tm, (Long_t)nblocks);
522 }
523 }
524 status = CAL;
525 break;
526 default:
527 if (status==CAL)
528 {
529 MTime *tm = new MTime(lasttime);
530 map.Add((ULong_t)map.GetSize(), (Long_t)tm, (Long_t)nblocks);
531
532 stop = last;
533 nblocks++;
534 if (debug)
535 cout << "Cal Block #" << nblocks << " from " << start << " to " << last << endl;
536 }
537 status = UNKNOWN;
538 break;
539 }
540 last = atoi((*row)[0]);
541 lasttime.SetSqlDateTime((*row)[3]);
542 }
543 if (status==CAL)
544 {
545 stop = last;
546 nblocks++;
547 if (debug)
548 cout << "Cal Block #" << nblocks << " from " << start << " to " << stop << endl;
549 }
550
551 if (debug)
552 cout << "Last Run: " << last << endl;
553 delete res;
554
555 if (debug)
556 cout << "Found " << nblocks << " calibration blocks" << endl;
557
558 res = serv.Query(query);
559 if (!res)
560 return kFALSE;
561
562 Int_t n = -1;
563
564 Bool_t rc = kTRUE;
565
566 start = first;
567 while ((row=res->Next()))
568 {
569 if (!(*row)[1])
570 continue;
571
572 MTime tstart, tstop;
573 tstart.SetSqlDateTime((*row)[2]);
574 tstop.SetSqlDateTime((*row)[3]);
575
576 MTime min;
577 Int_t nmin = -1;
578 Double_t dmin = 1e35;
579
580 Long_t key, val;
581 TExMapIter nmap(&map);
582 while (nmap.Next(key, val))
583 {
584 MTime *t = (MTime*)key;
585
586 if (nmin==-1)
587 {
588 nmin = val;
589 min = *(MTime*)key;
590 dmin = fabs((Double_t)*t-(Double_t)tstart);
591 }
592
593 if (fabs((Double_t)*t-(Double_t)tstart) < dmin)
594 {
595 nmin = val;
596 dmin = fabs((Double_t)*t-(Double_t)tstart);
597 min = *t;
598 }
599 if (fabs((Double_t)*t-(Double_t)tstop) < dmin)
600 {
601 nmin = val;
602 dmin = fabs((Double_t)*t-(Double_t)tstop);
603 min = *t;
604 }
605 }
606
607 if (n!=nmin)
608 {
609 if (n!=-1)
610 {
611 if (!NewSequence(serv, datapath, sequpath, start, last, dummy))
612 {
613 rc = kFALSE;
614 //continue;
615 }
616 }
617 n = nmin;
618 start = atoi((*row)[0]);
619 }
620 last = atoi((*row)[0]);
621 }
622
623 delete res;
624
625 if (n!=-1 && start!=last)
626 {
627 if (!NewSequence(serv, datapath, sequpath, start, last, dummy))
628 rc = kFALSE;
629 }
630
631 if (debug)
632 cout << endl;
633
634 return rc;
635}
636
637
638
639int buildsequenceentries(TString day, TString datapath, TString sequpath, Bool_t dummy=kTRUE)
640{
641 TEnv env("sql.rc");
642
643 MSQLServer serv(env);
644 if (!serv.IsConnected())
645 {
646 cout << "ERROR - Connection to database failed." << endl;
647 return 0;
648 }
649
650 cout << "buildsequences" << endl;
651 cout << "--------------" << endl;
652 cout << endl;
653 cout << "Connected to " << serv.GetName() << endl;
654 cout << "Night of sunrise at: " << day << endl;
655 cout << endl;
656
657 day += " 13:00:00";
658 const TString cond(Form("(fRunStart>ADDDATE(\"%s\", INTERVAL -1 DAY) AND fRunStart<\"%s\")",
659 day.Data(), day.Data()));
660
661 TString query(Form("SELECT fRunNumber, fSourceKEY, fProjectKEY, fHvSettingsKEY, fLightConditionsKEY, fDiscriminatorThresholdTableKEY, fTriggerDelayTableKEY FROM RunData WHERE %s AND fExcludedFDAKEY=1 order by fRunNumber", cond.Data()));
662
663 TSQLResult *res = serv.Query(query);
664 if (!res)
665 return 0;
666
667 TString keys[6]= { "NULL", "NULL", "NULL", "NULL", "NULL", "NULL" };
668 TString stop = "NULL";
669 TString runstart = "NULL";
670 TString runstop = "NULL";
671 Int_t count = 0;
672 TExMap blocks;
673 Int_t runbegin;
674 Int_t runend;
675
676 TSQLRow *row=0;
677 while ((row=res->Next()))
678 {
679 if (count==0)
680 {
681 for (Int_t i=1 ; i<7 ; i++)
682 keys[i-1]=(*row)[i];
683 runstart=(*row)[0];
684 }
685
686 for (Int_t i=1 ; i<7 ; i++)
687 {
688 runbegin=atoi(runstart.Data());
689 runend=atoi(runstop.Data());
690 if (i==2 && runbegin>20100 && runend<45100)
691 continue;
692
693 TString value=(*row)[i];
694 TString key=keys[i-1];
695 if (!value.CompareTo(key))
696 continue;
697
698 keys[i-1]=value;
699 //hier einfuellen
700 blocks.Add((ULong_t)blocks.GetSize(), (Long_t)runbegin, (Long_t)runend);
701 runstart=(*row)[0];
702 for (Int_t i=1 ; i<7 ; i++)
703 keys[i-1]=(*row)[i];
704 break;
705 }
706 runstop=(*row)[0];
707 count++;
708 }
709
710 //und hier einfuellen (letzter wert)
711 runbegin=atoi(runstart.Data());
712 runend=atoi(runstop.Data());
713 blocks.Add((ULong_t)blocks.GetSize(), (Long_t)runbegin, (Long_t)runend);
714
715
716 Bool_t rc = kTRUE;
717
718 Long_t key, val;
719 TExMapIter nblocks(&blocks);
720 while (nblocks.Next(key, val))
721 {
722 Int_t runstart2 = (Int_t)key;
723 Int_t runstop2 = (Int_t)val;
724 cout << endl << "datablock from " << runstart2 << " to " << runstop2 << endl;
725
726 if (!Process(serv, datapath, sequpath, runstart2, runstop2, dummy))
727 rc = kFALSE;
728
729 }
730 return rc ? 1 : 0;
731}
732
733
734int buildsequenceentries(TString datapath, TString sequpath, Bool_t dummy=kTRUE)
735{
736 TEnv env("sql.rc");
737
738 MSQLServer serv(env);
739 if (!serv.IsConnected())
740 {
741 cout << "ERROR - Connection to database failed." << endl;
742 return 0;
743 }
744
745 TString query="SELECT fDate FROM SequenceBuildStatus";
746
747 TSQLResult *res = serv.Query(query);
748 if (!res)
749 return 0;
750
751 TSQLRow *row=0;
752 while ((row=res->Next()))
753 {
754 cout << "date: " << (*row)[0] << endl;
755 buildsequenceentries((*row)[0], dummy);
756 }
757
758 return 1;
759}
Note: See TracBrowser for help on using the repository browser.