source: trunk/MagicSoft/Mars/datacenter/macros/insertcacofile.C@ 7352

Last change on this file since 7352 was 7112, checked in by Daniela Dorner, 20 years ago
*** empty log message ***
File size: 2.1 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, 01/2005 <mailto:dorner@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2005
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// InsertCaCoFiles.C
28// =================
29//
30/////////////////////////////////////////////////////////////////////////////
31
32#include <iostream>
33#include <iomanip>
34#include <fstream>
35
36#include <TEnv.h>
37#include <TSystem.h>
38
39#include <MSQLServer.h>
40#include <TSQLRow.h>
41#include <TSQLResult.h>
42
43using namespace std;
44
45
46int insertcacofile(TString runnumber, TString newrunnumber)
47{
48 TEnv env("sql.rc");
49
50 MSQLServer serv(env);
51 if (!serv.IsConnected())
52 {
53 cout << "ERROR - Connection to database failed." << endl;
54 return 0;
55 }
56 cout << "insertcacofile" << endl;
57 cout << "--------------" << endl;
58 cout << endl;
59 cout << "Connected to " << serv.GetName() << endl;
60 cout << endl;
61
62 Int_t newrunno=atoi(newrunnumber.Data());
63 TString query(Form("UPDATE RunProcessStatus SET fCaCoFileAvail=Now(), fCaCoFileFound=%d WHERE fRunNumber=%s ",
64 newrunno, runnumber.Data()));
65 cout << "qu: " << query << endl;
66
67 TSQLResult *res = serv.Query(query);
68 if (!res)
69 {
70 cout << "Error - update didn't work." << endl;
71 return 0;
72 }
73
74 delete res;
75 return 1;
76}
77
78
Note: See TracBrowser for help on using the repository browser.