]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/html/src/AliDBPPRS.cxx.html
new html documentatin
[u/mrichter/AliRoot.git] / PHOS / html / src / AliDBPPRS.cxx.html
1 <!DOCTYPE HTML PUBLIC "-// IETF/DTD HTML 2.0// EN">
2 <html>
3 <!--                                             -->
4 <!-- Author: ROOT team (rootdev@hpsalo.cern.ch)  -->
5 <!--                                             -->
6 <!--   Date: Mon Mar 26 12:09:09 2001            -->
7 <!--                                             -->
8 <head>
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.">
15 </head>
16 <body BGCOLOR="#ffffff" LINK="#0000ff" VLINK="#551a8b" ALINK="#ff0000" TEXT="#000000">
17 <a name="TopOfPage"></a>
18 <pre>
19 /**************************************************************************
20  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
21  *                                                                        *
22  * Author: The ALICE Off-line Project.                                    *
23  * Contributors are mentioned in the code where appropriate.              *
24  *                                                                        *
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  **************************************************************************/
33  
34 /* $Id$ */
35  
36 <b>//_________________________________________________________________________</b>
37 <b>// DB Class for table PPRS:</b>
38 <b>//</b>
39 <b>//*-- Author: Yves Schutz (SUBATECH)</b>
40 <b>//////////////////////////////////////////////////////////////////////////////</b>
41  
42 #include &lt;stdlib.h&gt; 
43 #include &lt;iostream.h&gt; 
44  
45 <b>// --- ROOT system ---</b>
46 #include "TSQLServer.h" 
47 #include "TSQLRow.h" 
48 #include "TSQLResult.h" 
49 #include "TDatime.h" 
50  
51 <b>// --- Standard library ---</b>
52  
53 <b>// --- AliRoot header files ---  </b>
54 #include "<a href="../AliDBPPRS.h">AliDBPPRS.h</a>" 
55  
56 ClassImp(AliDBPPRS)
57 <b>//____________________________________________________________________________</b>
58 <a name="AliDBPPRS:AliDBPPRS"> </a><a href=".././AliDBPPRS.html#AliDBPPRS:AliDBPPRS">AliDBPPRS::AliDBPPRS</a>()
59 {   
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"; 
75 }   
76 <b>//____________________________________________________________________________</b>
77 <a name="AliDBPPRS:~AliDBPPRS"> </a><a href=".././AliDBPPRS.html">AliDBPPRS</a>::~<a href=".././AliDBPPRS.html">AliDBPPRS</a>()
78 {   
79   delete[] <a href=".././AliDBPPRS.html#AliDBPPRS:fFields">fFields</a> ;
80 }   
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)
83 {   
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-&gt;Query("SELECT * FROM PPRS") ; 
89   <a href="../ListOfTypes.html#Int_t">Int_t</a> count = result-&gt;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> &gt; 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> ; 
95   TSQLRow * row = 0 ; 
96   for ( i = 0 ; i &lt; end ; i++ ) {
97      <a href=".././AliDBPPRS.html#AliDBPPRS:fCurrentEntry">fCurrentEntry</a>++ ; 
98     row = result-&gt;Next() ; 
99   }   
100     <a href=".././AliDBPPRS.html#AliDBPPRS:fRUN">fRUN</a> = atoi(row-&gt;<a href="#AliDBPPRS:GetField">GetField</a>(0)) ; 
101     <a href=".././AliDBPPRS.html#AliDBPPRS:fEVENT">fEVENT</a> = atoi(row-&gt;<a href="#AliDBPPRS:GetField">GetField</a>(1)) ; 
102     <a href=".././AliDBPPRS.html#AliDBPPRS:fWORKER">fWORKER</a> = row-&gt;<a href="#AliDBPPRS:GetField">GetField</a>(2) ; 
103     <a href=".././AliDBPPRS.html#AliDBPPRS:fSTATUS">fSTATUS</a> = row-&gt;<a href="#AliDBPPRS:GetField">GetField</a>(3) ; 
104     <a href=".././AliDBPPRS.html#AliDBPPRS:fDATE">fDATE</a> = TDatime::TDatime(row-&gt;<a href="#AliDBPPRS:GetField">GetField</a>(4)) ; 
105     <a href=".././AliDBPPRS.html#AliDBPPRS:fSTORAGE">fSTORAGE</a> = row-&gt;<a href="#AliDBPPRS:GetField">GetField</a>(5) ; 
106     <a href=".././AliDBPPRS.html#AliDBPPRS:fID">fID</a> = row-&gt;<a href="#AliDBPPRS:GetField">GetField</a>(6) ; 
107     <a href=".././AliDBPPRS.html#AliDBPPRS:fPOS">fPOS</a> = atoi(row-&gt;<a href="#AliDBPPRS:GetField">GetField</a>(7)) ; 
108     <a href=".././AliDBPPRS.html#AliDBPPRS:fSIZE">fSIZE</a> = atoi(row-&gt;<a href="#AliDBPPRS:GetField">GetField</a>(8)) ; 
109     <a href=".././AliDBPPRS.html#AliDBPPRS:fFTP">fFTP</a> = row-&gt;<a href="#AliDBPPRS:GetField">GetField</a>(9) ; 
110     <a href=".././AliDBPPRS.html#AliDBPPRS:fLOG">fLOG</a> = row-&gt;<a href="#AliDBPPRS:GetField">GetField</a>(10) ; 
111     <a href=".././AliDBPPRS.html#AliDBPPRS:fCOMMENT">fCOMMENT</a> = row-&gt;<a href="#AliDBPPRS:GetField">GetField</a>(11) ; 
112 }   
113 </pre>
114
115 <!--SIGNATURE-->
116 <br>
117 <address>
118 <hr>
119 <center>
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>
121 </center>
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.
123 </address>
124 </body>
125 </html>