Changeset 6935 for trunk/MagicSoft/Mars/datacenter/macros
- Timestamp:
- 04/13/05 09:29:47 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/macros/fillcalib.C
r6933 r6935 63 63 #include <TFile.h> 64 64 #include <TSQLResult.h> 65 #include <TSQLRow.h> 65 66 66 67 #include "MSQLServer.h" … … 70 71 71 72 using namespace std; 73 74 // -------------------------------------------------------------------------- 75 // 76 // Checks whether an entry is already existing 77 // 78 Bool_t ExistStr(MSQLServer &serv, const char *column, const char *table, Int_t test) 79 { 80 TString query(Form("SELECT %s FROM %s WHERE %s='%d'", column, table, column, test)); 81 TSQLResult *res = serv.Query(query); 82 if (!res) 83 return kFALSE; 84 85 TSQLRow *row; 86 87 Bool_t rc = kFALSE; 88 while ((row=res->Next())) 89 { 90 if ((*row)[0]) 91 { 92 rc = kTRUE; 93 break; 94 } 95 } 96 97 delete res; 98 99 return rc; 100 } 101 72 102 73 103 int Process(MSQLServer &serv, TString fname, Bool_t dummy) … … 125 155 cout << " Max.Cluster: (i/o) " << Form("%3d", (int)clumax) << endl; // Max Cluster 126 156 157 TString query; 158 if (!ExistStr(serv, "fSequenceFirst", "MyMagic.Calibration", seq)) 159 { 160 161 query = Form("INSERT MyMagic.Calibration SET" 162 " fSequenceFirst=%d," 163 " fUnsuitableInner=%d, " 164 " fUnsuitableOuter=%d, " 165 " fUnreliableInner=%d, " 166 " fUnreliableOuter=%d, " 167 " fIsolatedInner=%d, " 168 " fIsolatedOuter=%d, " 169 " fIsolatedMaxCluster=%d", 170 seq, (int)unsin, (int)unsout, (int)unrin, 171 (int)unrout, (int)isoin, (int)isoout, (int)clumax); 172 } 173 else 174 { 175 query = Form("UPDATE MyMagic.Calibration SET" 176 " fUnsuitableInner=%d, " 177 " fUnsuitableOuter=%d, " 178 " fUnreliableInner=%d, " 179 " fUnreliableOuter=%d, " 180 " fIsolatedInner=%d, " 181 " fIsolatedOuter=%d, " 182 " fIsolatedMaxCluster=%d" 183 " WHERE fSequenceFirst=%d,", 184 (int)unsin, (int)unsout, (int)unrin,(int)unrout, 185 (int)isoin, (int)isoout, (int)clumax, seq); 186 } 187 127 188 if (dummy) 128 189 return 0; 129 130 TString query = Form("INSERT MyMagic.Calibration SET"131 " fSequenceFirst=%d,"132 " fUnsuitableInner=%d, "133 " fUnsuitableOuter=%d, "134 " fUnreliableInner=%d, "135 " fUnreliableOuter=%d, "136 " fIsolatedInner=%d, "137 " fIsolatedOuter=%d, "138 " fIsolatedMaxCluster=%d",139 seq, (int)unsin, (int)unsout, (int)unrin,140 (int)unrout, (int)isoin, (int)isoout, (int)clumax);141 142 190 143 191 TSQLResult *res = serv.Query(query); … … 147 195 return 0; 148 196 } 197 delete res; 149 198 150 199 return 1;
Note:
See TracChangeset
for help on using the changeset viewer.