1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //_________________________________________________________________________
19 // DB Class for table PPRS:
21 //*-- Author: Yves Schutz (SUBATECH)
22 //////////////////////////////////////////////////////////////////////////////
26 // --- ROOT system ---
27 #include "TSQLServer.h"
29 #include "TSQLResult.h"
32 // --- Standard library ---
34 // --- AliRoot header files ---
35 #include "AliDBPPRS.h"
38 //____________________________________________________________________________
39 AliDBPPRS::AliDBPPRS()
41 fCurrentEntry = 1 ; // first valid entry (0 = labels)
43 fFields = new TString[12];
46 fFields[2] = "WORKER";
47 fFields[3] = "STATUS";
49 fFields[5] = "STORAGE";
55 fFields[11] = "COMMENT";
57 //____________________________________________________________________________
58 AliDBPPRS::~AliDBPPRS()
62 //____________________________________________________________________________
63 void AliDBPPRS::GetEntry(Option_t * opt)
65 // Retrieves one single row from the table // opt = first : retrieves first entry
66 // opt = last : retrieves last entry
67 // opt = next : retrieves next to current entry
68 TSQLServer * mysql = TSQLServer::Connect("mysql://ccmysql.in2p3.fr:3306/alice", "schutz", "po2hgwy") ;
69 TSQLResult * result = mysql->Query("SELECT * FROM PPRS") ;
70 Int_t count = result->GetRowCount() ;
71 if ( !strcmp(opt, "first") ) fCurrentEntry = 1 ;
72 if ( !strcmp(opt, "last") ) fCurrentEntry = count ;
73 if ( fCurrentEntry > count ) fCurrentEntry = 1 ;
75 Int_t end = fCurrentEntry ;
77 for ( i = 0 ; i < end ; i++ ) {
79 row = result->Next() ;
81 fRUN = atoi(row->GetField(0)) ;
82 fEVENT = atoi(row->GetField(1)) ;
83 fWORKER = row->GetField(2) ;
84 fSTATUS = row->GetField(3) ;
85 fDATE = TDatime(row->GetField(4)) ;
86 fSTORAGE = row->GetField(5) ;
87 fID = row->GetField(6) ;
88 fPOS = atoi(row->GetField(7)) ;
89 fSIZE = atoi(row->GetField(8)) ;
90 fFTP = row->GetField(9) ;
91 fLOG = row->GetField(10) ;
92 fCOMMENT = row->GetField(11) ;