1 <!DOCTYPE HTML PUBLIC "-// IETF/DTD HTML 2.0// EN">
4 <!-- Author: ROOT team (rootdev@hpsalo.cern.ch) -->
6 <!-- Date: Mon Mar 26 12:09:09 2001 -->
9 <title>AliDBPPRS - source file</title>
10 <link rev=made href="mailto:rootdev@root.cern.ch">
11 <meta name="rating" content="General">
12 <meta name="objecttype" content="Manual">
13 <meta name="keywords" content="software development, oo, object oriented, unix, x11, windows, c++, html, rene brun, fons rademakers">
14 <meta name="description" content="ROOT - An Object Oriented Framework For Large Scale Data Analysis.">
16 <body BGCOLOR="#ffffff" LINK="#0000ff" VLINK="#551a8b" ALINK="#ff0000" TEXT="#000000">
17 <a name="TopOfPage"></a>
19 /**************************************************************************
20 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
22 * Author: The ALICE Off-line Project. *
23 * Contributors are mentioned in the code where appropriate. *
25 * Permission to use, copy, modify and distribute this software and its *
26 * documentation strictly for non-commercial purposes is hereby granted *
27 * without fee, provided that the above copyright notice appears in all *
28 * copies and that both the copyright notice and this permission notice *
29 * appear in the supporting documentation. The authors make no claims *
30 * about the suitability of this software for any purpose. It is *
31 * provided "as is" without express or implied warranty. *
32 **************************************************************************/
36 <b>//_________________________________________________________________________</b>
37 <b>// DB Class for table PPRS:</b>
39 <b>//*-- Author: Yves Schutz (SUBATECH)</b>
40 <b>//////////////////////////////////////////////////////////////////////////////</b>
42 #include <stdlib.h>
43 #include <iostream.h>
45 <b>// --- ROOT system ---</b>
46 #include "TSQLServer.h"
48 #include "TSQLResult.h"
51 <b>// --- Standard library ---</b>
53 <b>// --- AliRoot header files --- </b>
54 #include "<a href="../AliDBPPRS.h">AliDBPPRS.h</a>"
57 <b>//____________________________________________________________________________</b>
58 <a name="AliDBPPRS:AliDBPPRS"> </a><a href=".././AliDBPPRS.html#AliDBPPRS:AliDBPPRS">AliDBPPRS::AliDBPPRS</a>()
60 <a href=".././AliDBPPRS.html#AliDBPPRS:fCurrentEntry">fCurrentEntry</a> = 1 ; // first valid entry (0 = labels)
61 <a href=".././AliDBPPRS.html#AliDBPPRS:fNfields">fNfields</a> = 12 ;
62 <a href=".././AliDBPPRS.html#AliDBPPRS:fFields">fFields</a> = new TString[12];
63 <a href=".././AliDBPPRS.html#AliDBPPRS:fFields">fFields</a>[0] = "RUN";
64 <a href=".././AliDBPPRS.html#AliDBPPRS:fFields">fFields</a>[1] = "EVENT";
65 <a href=".././AliDBPPRS.html#AliDBPPRS:fFields">fFields</a>[2] = "WORKER";
66 <a href=".././AliDBPPRS.html#AliDBPPRS:fFields">fFields</a>[3] = "STATUS";
67 <a href=".././AliDBPPRS.html#AliDBPPRS:fFields">fFields</a>[4] = "DATE";
68 <a href=".././AliDBPPRS.html#AliDBPPRS:fFields">fFields</a>[5] = "STORAGE";
69 <a href=".././AliDBPPRS.html#AliDBPPRS:fFields">fFields</a>[6] = "ID";
70 <a href=".././AliDBPPRS.html#AliDBPPRS:fFields">fFields</a>[7] = "POS";
71 <a href=".././AliDBPPRS.html#AliDBPPRS:fFields">fFields</a>[8] = "SIZE";
72 <a href=".././AliDBPPRS.html#AliDBPPRS:fFields">fFields</a>[9] = "FTP";
73 <a href=".././AliDBPPRS.html#AliDBPPRS:fFields">fFields</a>[10] = "LOG";
74 <a href=".././AliDBPPRS.html#AliDBPPRS:fFields">fFields</a>[11] = "COMMENT";
76 <b>//____________________________________________________________________________</b>
77 <a name="AliDBPPRS:~AliDBPPRS"> </a><a href=".././AliDBPPRS.html">AliDBPPRS</a>::~<a href=".././AliDBPPRS.html">AliDBPPRS</a>()
79 delete[] <a href=".././AliDBPPRS.html#AliDBPPRS:fFields">fFields</a> ;
81 <b>//____________________________________________________________________________</b>
82 <a name="AliDBPPRS:GetEntry"> </a><a href="../ListOfTypes.html#void">void</a> <a href=".././AliDBPPRS.html#AliDBPPRS:GetEntry">AliDBPPRS::GetEntry</a>(<a href="../ListOfTypes.html#Option_t">Option_t</a> * opt)
84 <b> // Retrieves one single row from the table // opt = first : retrieves first entry </b>
85 <b> // opt = last : retrieves last entry </b>
86 <b> // opt = next : retrieves next to current entry </b>
87 TSQLServer * mysql = TSQLServer::Connect("mysql://ccmysql.in2p3.fr:3306/alice", "schutz", "po2hgwy") ;
88 TSQLResult * result = mysql->Query("SELECT * FROM PPRS") ;
89 <a href="../ListOfTypes.html#Int_t">Int_t</a> count = result->GetRowCount() ;
90 if ( !strcmp(opt, "first") ) <a href=".././AliDBPPRS.html#AliDBPPRS:fCurrentEntry">fCurrentEntry</a> = 1 ;
91 if ( !strcmp(opt, "last") ) <a href=".././AliDBPPRS.html#AliDBPPRS:fCurrentEntry">fCurrentEntry</a> = count ;
92 if ( <a href=".././AliDBPPRS.html#AliDBPPRS:fCurrentEntry">fCurrentEntry</a> > count ) <a href=".././AliDBPPRS.html#AliDBPPRS:fCurrentEntry">fCurrentEntry</a> = 1 ;
93 <a href="../ListOfTypes.html#Int_t">Int_t</a> i;
94 <a href="../ListOfTypes.html#Int_t">Int_t</a> end = <a href=".././AliDBPPRS.html#AliDBPPRS:fCurrentEntry">fCurrentEntry</a> ;
96 for ( i = 0 ; i < end ; i++ ) {
97 <a href=".././AliDBPPRS.html#AliDBPPRS:fCurrentEntry">fCurrentEntry</a>++ ;
98 row = result->Next() ;
100 <a href=".././AliDBPPRS.html#AliDBPPRS:fRUN">fRUN</a> = atoi(row-><a href="#AliDBPPRS:GetField">GetField</a>(0)) ;
101 <a href=".././AliDBPPRS.html#AliDBPPRS:fEVENT">fEVENT</a> = atoi(row-><a href="#AliDBPPRS:GetField">GetField</a>(1)) ;
102 <a href=".././AliDBPPRS.html#AliDBPPRS:fWORKER">fWORKER</a> = row-><a href="#AliDBPPRS:GetField">GetField</a>(2) ;
103 <a href=".././AliDBPPRS.html#AliDBPPRS:fSTATUS">fSTATUS</a> = row-><a href="#AliDBPPRS:GetField">GetField</a>(3) ;
104 <a href=".././AliDBPPRS.html#AliDBPPRS:fDATE">fDATE</a> = TDatime::TDatime(row-><a href="#AliDBPPRS:GetField">GetField</a>(4)) ;
105 <a href=".././AliDBPPRS.html#AliDBPPRS:fSTORAGE">fSTORAGE</a> = row-><a href="#AliDBPPRS:GetField">GetField</a>(5) ;
106 <a href=".././AliDBPPRS.html#AliDBPPRS:fID">fID</a> = row-><a href="#AliDBPPRS:GetField">GetField</a>(6) ;
107 <a href=".././AliDBPPRS.html#AliDBPPRS:fPOS">fPOS</a> = atoi(row-><a href="#AliDBPPRS:GetField">GetField</a>(7)) ;
108 <a href=".././AliDBPPRS.html#AliDBPPRS:fSIZE">fSIZE</a> = atoi(row-><a href="#AliDBPPRS:GetField">GetField</a>(8)) ;
109 <a href=".././AliDBPPRS.html#AliDBPPRS:fFTP">fFTP</a> = row-><a href="#AliDBPPRS:GetField">GetField</a>(9) ;
110 <a href=".././AliDBPPRS.html#AliDBPPRS:fLOG">fLOG</a> = row-><a href="#AliDBPPRS:GetField">GetField</a>(10) ;
111 <a href=".././AliDBPPRS.html#AliDBPPRS:fCOMMENT">fCOMMENT</a> = row-><a href="#AliDBPPRS:GetField">GetField</a>(11) ;
120 <a href="http://root.cern.ch/root/Welcome.html">ROOT page</a> - <a href="../ClassIndex.html">Class index</a> - <a href="#TopOfPage">Top of the page</a><br>
122 <hr>This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to <a href="mailto:rootdev@root.cern.ch">ROOT support</a>, or contact <a href="mailto:rootdev@root.cern.ch">the developers</a> with any questions or problems regarding ROOT.