]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliDBPPRS.cxx
Code commit for Ramona, fix of warnings, add of AddTask macros and exchange of comments
[u/mrichter/AliRoot.git] / PHOS / AliDBPPRS.cxx
CommitLineData
ba230b91 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/* $Id$ */
17
18//_________________________________________________________________________
19// DB Class for table PPRS:
20//
21//*-- Author: Yves Schutz (SUBATECH)
22//////////////////////////////////////////////////////////////////////////////
23
24#include <stdlib.h>
ba230b91 25
26// --- ROOT system ---
27#include "TSQLServer.h"
28#include "TSQLRow.h"
29#include "TSQLResult.h"
30#include "TDatime.h"
31
32// --- Standard library ---
33
34// --- AliRoot header files ---
35#include "AliDBPPRS.h"
36
37ClassImp(AliDBPPRS)
38//____________________________________________________________________________
39AliDBPPRS::AliDBPPRS()
40{
41 fCurrentEntry = 1 ; // first valid entry (0 = labels)
42 fNfields = 12 ;
43 fFields = new TString[12];
44 fFields[0] = "RUN";
45 fFields[1] = "EVENT";
46 fFields[2] = "WORKER";
47 fFields[3] = "STATUS";
48 fFields[4] = "DATE";
49 fFields[5] = "STORAGE";
50 fFields[6] = "ID";
51 fFields[7] = "POS";
52 fFields[8] = "SIZE";
53 fFields[9] = "FTP";
54 fFields[10] = "LOG";
55 fFields[11] = "COMMENT";
56}
57//____________________________________________________________________________
58AliDBPPRS::~AliDBPPRS()
59{
60 delete[] fFields ;
61}
62//____________________________________________________________________________
63void AliDBPPRS::GetEntry(Option_t * opt)
64{
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 ;
74 Int_t i;
75 Int_t end = fCurrentEntry ;
76 TSQLRow * row = 0 ;
77 for ( i = 0 ; i < end ; i++ ) {
78 fCurrentEntry++ ;
79 row = result->Next() ;
80 }
81 fRUN = atoi(row->GetField(0)) ;
82 fEVENT = atoi(row->GetField(1)) ;
83 fWORKER = row->GetField(2) ;
84 fSTATUS = row->GetField(3) ;
7bac2111 85 fDATE = TDatime(row->GetField(4)) ;
ba230b91 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) ;
93}