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 //////////////////////////////////////////////////////////////////////////////
27 // --- ROOT system ---
28 #include "TSQLServer.h"
30 #include "TSQLResult.h"
33 // --- Standard library ---
35 // --- AliRoot header files ---
36 #include "AliDBPPRS.h"
39 //____________________________________________________________________________
40 AliDBPPRS::AliDBPPRS()
42 fCurrentEntry = 1 ; // first valid entry (0 = labels)
44 fFields = new TString[12];
47 fFields[2] = "WORKER";
48 fFields[3] = "STATUS";
50 fFields[5] = "STORAGE";
56 fFields[11] = "COMMENT";
58 //____________________________________________________________________________
59 AliDBPPRS::~AliDBPPRS()
63 //____________________________________________________________________________
64 void AliDBPPRS::GetEntry(Option_t * opt)
66 // Retrieves one single row from the table // opt = first : retrieves first entry
67 // opt = last : retrieves last entry
68 // opt = next : retrieves next to current entry
69 TSQLServer * mysql = TSQLServer::Connect("mysql://ccmysql.in2p3.fr:3306/alice", "schutz", "po2hgwy") ;
70 TSQLResult * result = mysql->Query("SELECT * FROM PPRS") ;
71 Int_t count = result->GetRowCount() ;
72 if ( !strcmp(opt, "first") ) fCurrentEntry = 1 ;
73 if ( !strcmp(opt, "last") ) fCurrentEntry = count ;
74 if ( fCurrentEntry > count ) fCurrentEntry = 1 ;
76 Int_t end = fCurrentEntry ;
78 for ( i = 0 ; i < end ; i++ ) {
80 row = result->Next() ;
82 fRUN = atoi(row->GetField(0)) ;
83 fEVENT = atoi(row->GetField(1)) ;
84 fWORKER = row->GetField(2) ;
85 fSTATUS = row->GetField(3) ;
86 fDATE = TDatime::TDatime(row->GetField(4)) ;
87 fSTORAGE = row->GetField(5) ;
88 fID = row->GetField(6) ;
89 fPOS = atoi(row->GetField(7)) ;
90 fSIZE = atoi(row->GetField(8)) ;
91 fFTP = row->GetField(9) ;
92 fLOG = row->GetField(10) ;
93 fCOMMENT = row->GetField(11) ;