source: tags/Mars-V0.9.3/datacenter/macros/checkstardone.C

Last change on this file was 7112, checked in by Daniela Dorner, 20 years ago
*** empty log message ***
File size: 2.4 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): Daniela Dorner, 05/2005 <mailto:dorner@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2005
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// checkstardone.C
28// ===============
29//
30/////////////////////////////////////////////////////////////////////////////
31
32#include <iostream>
33#include <iomanip>
34#include <fstream>
35
36#include <TEnv.h>
37
38#include <MSQLServer.h>
39#include <TSQLRow.h>
40#include <TSQLResult.h>
41
42using namespace std;
43
44
45TString GetStatus(MSQLServer &serv, TEnv &rc, TString primary, TString table, TString column)
46{
47 TString query(Form("SELECT %s FROM %s WHERE %s=%s",
48 column.Data(), table.Data(),
49 rc.GetValue(table+".Primary", ""),
50 primary.Data()));
51
52 cout << "Query: " << query << endl;
53
54 TSQLResult *res = serv.Query(query);
55 if (!res)
56 {
57 cout << "Error - no run to check" << endl;
58 return "";
59 }
60
61 TSQLRow *row=0;
62 while ((row = res->Next()))
63 return (*row)[0];
64
65 return "";
66}
67
68int checkstardone(TString datasetno)
69{
70 TEnv env("sql.rc");
71
72 MSQLServer serv(env);
73 if (!serv.IsConnected())
74 {
75 cout << "ERROR - Connection to database failed." << endl;
76 return 0;
77 }
78 cout << "checkstardone" << endl;
79 cout << "-------------" << endl;
80 cout << endl;
81 cout << "Connected to " << serv.GetName() << endl;
82 cout << endl;
83
84 TEnv rc("steps.rc");
85
86 if (GetStatus(serv, rc, datasetno, "SequenceProcessStatus", "fStar")=="")
87 return 0;
88
89 return 1;
90}
91
Note: See TracBrowser for help on using the repository browser.