| 1 | #ifndef MARS_MRawRunInsertSql
|
|---|
| 2 | #define MARS_MRawRunInsertSql
|
|---|
| 3 |
|
|---|
| 4 | #ifndef MARS_MTask
|
|---|
| 5 | #include "MTask.h"
|
|---|
| 6 | #endif
|
|---|
| 7 |
|
|---|
| 8 | class MSQLServer;
|
|---|
| 9 |
|
|---|
| 10 | class MRawRunHeader;
|
|---|
| 11 |
|
|---|
| 12 | class MSqlInsertRun : public MTask
|
|---|
| 13 | {
|
|---|
| 14 | private:
|
|---|
| 15 | MSQLServer *fSqlServer;
|
|---|
| 16 |
|
|---|
| 17 | Bool_t fIsUpdate;
|
|---|
| 18 |
|
|---|
| 19 | Int_t GetIndex(MRawRunHeader *h);
|
|---|
| 20 | Int_t GetKey(const char *table, const char *where);
|
|---|
| 21 | TString GetKeyStr(const char *table, const char *where, Bool_t &rc);
|
|---|
| 22 | TString GetEntry(const char *table, const char *col, const char *where);
|
|---|
| 23 |
|
|---|
| 24 | Bool_t IsRunExisting(MRawRunHeader *h, Bool_t &ok);
|
|---|
| 25 | Bool_t IsFileExisting(MRawRunHeader *h, Bool_t &ok);
|
|---|
| 26 |
|
|---|
| 27 | TString MagicNumber(MRawRunHeader *h, Bool_t &ok);
|
|---|
| 28 | TString RunType(MRawRunHeader *h, Bool_t &ok);
|
|---|
| 29 | TString Source(MRawRunHeader *h, Bool_t &ok);
|
|---|
| 30 | TString Project(MRawRunHeader *h, Bool_t &ok);
|
|---|
| 31 | TString RawFilePath(const char *path, Bool_t &ok);
|
|---|
| 32 |
|
|---|
| 33 | Bool_t InsertRun(MRawRunHeader *h, Bool_t update);
|
|---|
| 34 | Bool_t InsertFile(MRawRunHeader *h, MParList *pList, Bool_t update);
|
|---|
| 35 |
|
|---|
| 36 | Int_t PreProcess(MParList *pList);
|
|---|
| 37 | Int_t PostProcess();
|
|---|
| 38 |
|
|---|
| 39 | Bool_t PrintError(const char *txt, const char *q) const;
|
|---|
| 40 |
|
|---|
| 41 | public:
|
|---|
| 42 | MSqlInsertRun(const char *db, const char *user, const char *pw);
|
|---|
| 43 | MSqlInsertRun(const char *url);
|
|---|
| 44 | ~MSqlInsertRun();
|
|---|
| 45 |
|
|---|
| 46 | void SetUpdate(Bool_t u=kTRUE) { fIsUpdate=u; }
|
|---|
| 47 |
|
|---|
| 48 | ClassDef(MSqlInsertRun, 0) // Task to insert run into database
|
|---|
| 49 | };
|
|---|
| 50 |
|
|---|
| 51 | #endif
|
|---|