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 //////////////////////////////////////////////////////////////////////////////
26 // --- ROOT system ---
27 #include "TSQLServer.h"
29 #include "TSQLResult.h"
32 // --- Standard library ---
34 // --- AliRoot header files ---
38 //____________________________________________________________________________
41 fCurrentEntry = 1 ; // first valid entry (0 = labels)
43 fFields = new TString[6];
47 fFields[3] = "SIMULATION";
48 fFields[4] = "DIGITIZATION";
49 fFields[5] = "RECONSTRUCTION";
51 //____________________________________________________________________________
56 //____________________________________________________________________________
57 void AliDBPPR::GetEntry(Option_t * opt)
59 // Retrieves one single row from the table // opt = first : retrieves first entry
60 // opt = last : retrieves last entry
61 // opt = next : retrieves next to current entry
62 TSQLServer * mysql = TSQLServer::Connect("mysql://ccmysql.in2p3.fr:3306/alice", "schutz", "po2hgwy") ;
63 TSQLResult * result = mysql->Query("SELECT * FROM PPR") ;
64 Int_t count = result->GetRowCount() ;
65 if ( !strcmp(opt, "first") ) fCurrentEntry = 1 ;
66 if ( !strcmp(opt, "last") ) fCurrentEntry = count ;
67 if ( fCurrentEntry > count ) fCurrentEntry = 1 ;
69 Int_t end = fCurrentEntry ;
71 for ( i = 0 ; i < end ; i++ ) {
73 row = result->Next() ;
75 fRUN = atoi(row->GetField(0)) ;
76 fEVENT = atoi(row->GetField(1)) ;
77 fDATE = TDatime(row->GetField(2)) ;
78 fSIMULATION = row->GetField(3) ;
79 fDIGITIZATION = row->GetField(4) ;
80 fRECONSTRUCTION = row->GetField(5) ;