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 PPR:
21 //*-- Author: Yves Schutz (SUBATECH)
22 //////////////////////////////////////////////////////////////////////////////
27 // --- ROOT system ---
28 #include "TSQLServer.h"
30 #include "TSQLResult.h"
33 // --- Standard library ---
35 // --- AliRoot header files ---
39 //____________________________________________________________________________
42 fCurrentEntry = 1 ; // first valid entry (0 = labels)
44 fFields = new TString[6];
48 fFields[3] = "SIMULATION";
49 fFields[4] = "DIGITIZATION";
50 fFields[5] = "RECONSTRUCTION";
52 //____________________________________________________________________________
57 //____________________________________________________________________________
58 void AliDBPPR::GetEntry(Option_t * opt)
60 // Retrieves one single row from the table // opt = first : retrieves first entry
61 // opt = last : retrieves last entry
62 // opt = next : retrieves next to current entry
63 TSQLServer * mysql = TSQLServer::Connect("mysql://ccmysql.in2p3.fr:3306/alice", "schutz", "po2hgwy") ;
64 TSQLResult * result = mysql->Query("SELECT * FROM PPR") ;
65 Int_t count = result->GetRowCount() ;
66 if ( !strcmp(opt, "first") ) fCurrentEntry = 1 ;
67 if ( !strcmp(opt, "last") ) fCurrentEntry = count ;
68 if ( fCurrentEntry > count ) fCurrentEntry = 1 ;
70 Int_t end = fCurrentEntry ;
72 for ( i = 0 ; i < end ; i++ ) {
74 row = result->Next() ;
76 fRUN = atoi(row->GetField(0)) ;
77 fEVENT = atoi(row->GetField(1)) ;
78 fDATE = TDatime(row->GetField(2)) ;
79 fSIMULATION = row->GetField(3) ;
80 fDIGITIZATION = row->GetField(4) ;
81 fRECONSTRUCTION = row->GetField(5) ;