ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TBasketSQL.cxx
Go to the documentation of this file.
1 // @(#)root/tree:$Id$
2 // Author: Philippe Canal and al. 08/2004
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef TBASKETSQL_CXX
13 #define TBASKETSQL_CXX
14 
15 #include "TBasket.h"
16 #include "TBuffer.h"
17 #include "TTree.h"
18 #include "TBranch.h"
19 #include "TFile.h"
20 #include "TMath.h"
21 #include "TBasketSQL.h"
22 #include <Riostream.h>
23 #include <vector>
24 #include "TTreeSQL.h"
25 #include "TBufferSQL.h"
26 
28 
29 namespace std {} using namespace std;
30 
31 /** \class TBasketSQL
32 Implement TBasket for a SQL backend.
33 */
34 
35 ////////////////////////////////////////////////////////////////////////////////
36 /// Default constructor.
37 
38 TBasketSQL::TBasketSQL() : TBasket(), fResultPtr(0), fRowPtr(0), fInsertQuery(0)
39 {
40 }
41 
42 ////////////////////////////////////////////////////////////////////////////////
43 /// Regular constructor.
44 
45 TBasketSQL::TBasketSQL(const char *name, const char *title, TBranch *branch,
46  TSQLResult ** rs, TString *insert_query,
47  std::vector<Int_t> *vc, TSQLRow **r) :
48  fResultPtr(rs),fRowPtr(r)
49 {
50  SetName(name);
51  SetTitle(title);
52  fClassName = "TBasketSQL";
53  fBufferSize = branch->GetBasketSize();
54  fNevBufSize = branch->GetEntryOffsetLen();
55  fNevBuf = 0;
56  fEntryOffset = 0; //Must be set to 0 before calling Sizeof
57  fDisplacement= 0; //Must be set to 0 before calling Sizeof
58  fBuffer = 0; //Must be set to 0 before calling Sizeof
59  fInsertQuery = insert_query;
60 
61  if (vc==0) {
62  fBufferRef = 0;
63  } else {
65  }
67  fLast = 0; // Must initialize before calling Streamer()
68  //Streamer(*fBufferRef);
69  fBuffer = 0;
70  fBranch = branch;
73 
74 }
75 
76 ////////////////////////////////////////////////////////////////////////////////
77 /// Destructor
78 
80 {
81 }
82 
83 ////////////////////////////////////////////////////////////////////////////////
84 /// Create a TSQLBuffer for this basket.
85 
87  std::vector<Int_t> *vc,
88  TBranch *branch, TSQLResult ** rs)
89 {
90  fResultPtr = rs;
91  SetName(name);
92  SetTitle(title);
93  fClassName = "TBasketSQL";
94  fBufferSize = branch->GetBasketSize();
95  fNevBufSize = branch->GetEntryOffsetLen();
96  fNevBuf = 0;
97  fEntryOffset = 0; //Must be set to 0 before calling Sizeof
98  fDisplacement= 0; //Must be set to 0 before calling Sizeof
99  fBuffer = 0; //Must be set to 0 before calling Sizeof
100 
101  if(vc==0) {
102  fBufferRef = 0;
103  Error("CreateBuffer","Need a vector of columns\n");
104  } else {
106  }
107  fHeaderOnly = kTRUE;
108  fLast = 0;
109  //Streamer(*fBufferRef);
110  fBuffer = 0;
111  fBranch = branch;
114 }
115 
116 ////////////////////////////////////////////////////////////////////////////////
117 /// Prepare the basket for the next entry.
118 
120 {
121  ((TBufferSQL*)fBufferRef)->ResetOffset();
122  ((TTreeSQL*)fBranch->GetTree())->PrepEntry(entry);
123  fBufferRef->Reset();
124 }
125 
126 ////////////////////////////////////////////////////////////////////////////////
127 /// See TBasket::ReadBasketBytes. This is not implemented in TBasketSQL.
128 
130 {
131  Error("ReadBasketBytes","This member function should not be called!");
132  return 0;
133 }
134 
135 ////////////////////////////////////////////////////////////////////////////////
136 /// See TBasket::ReadBasketBuffers. This is not implemented in TBasketSQL.
137 
139 {
140  Error("ReadBasketBuffers","This member function should not be called!");
141  return 0;
142 }
143 
144 ////////////////////////////////////////////////////////////////////////////////
145 /// See TBasket::Reset
146 
148 {
149  TBasket::Reset();
150 }
151 ////////////////////////////////////////////////////////////////////////////////
152 /// See TBasket::Update.
153 
155 {
156  ((TBufferSQL*)fBufferRef)->ResetOffset();
157  fNevBuf++;
158 }
159 
160 #endif
Bool_t fHeaderOnly
Definition: TBasket.h:56
TBasketSQL()
Default constructor.
Definition: TBasketSQL.cxx:38
long long Long64_t
Definition: RtypesCore.h:69
Int_t * fDisplacement
Definition: TBasket.h:57
virtual void Reset()
See TBasket::Reset.
Definition: TBasketSQL.cxx:147
virtual void IncrementTotalBuffers(Int_t nbytes)
Definition: TTree.h:464
Implement TBuffer for a SQL backend.
Definition: TBufferSQL.h:34
Int_t fBufferSize
Definition: TBasket.h:52
Int_t * fEntryOffset
[fNevBuf] Displacement of entries in fBuffer(TKey)
Definition: TBasket.h:58
virtual void SetName(const char *name)
Change (i.e.
Definition: TNamed.cxx:128
~TBasketSQL()
Destructor.
Definition: TBasketSQL.cxx:79
TBranch * fBranch
Definition: TBasket.h:59
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: Rtypes.h:92
TSQLRow ** fRowPtr
Definition: TBasketSQL.h:39
Implement TTree for a SQL backend.
Definition: TTreeSQL.h:43
Int_t fNevBuf
Definition: TBasket.h:54
char * fBuffer
Object buffer.
Definition: TKey.h:50
TSQLResult ** fResultPtr
Definition: TBasketSQL.h:38
void CreateBuffer(const char *name, TString title, std::vector< Int_t > *vc, TBranch *branch, TSQLResult **rs)
Create a TSQLBuffer for this basket.
Definition: TBasketSQL.cxx:86
virtual void Reset()=0
virtual void Reset()
Reset the basket to the starting state.
Definition: TBasket.cxx:661
TString fClassName
Object Class name.
Definition: TKey.h:48
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:918
void PrepareBasket(Long64_t entry)
Prepare the basket for the next entry.
Definition: TBasketSQL.cxx:119
ROOT::R::TRInterface & r
Definition: Object.C:4
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
Manages buffers for branches of a Tree.
Definition: TBasket.h:38
void Update(Int_t offset, Int_t skipped)
See TBasket::Update.
Definition: TBasketSQL.cxx:154
Long64_t entry
TTree * GetTree() const
Definition: TBranch.h:183
TBuffer * fBufferRef
Pointer to the TBuffer object.
Definition: TKey.h:51
Int_t fNevBufSize
Definition: TBasket.h:53
virtual Int_t GetBasketSize() const
Definition: TBranch.h:151
Implement TBasket for a SQL backend.
Definition: TBasketSQL.h:30
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual Int_t ReadBasketBytes(Long64_t pos, TFile *file)
See TBasket::ReadBasketBytes. This is not implemented in TBasketSQL.
Definition: TBasketSQL.cxx:129
ClassImp(TBasketSQL) namespace std
Definition: TBasketSQL.cxx:27
Int_t fLast
Definition: TBasket.h:55
Int_t GetEntryOffsetLen() const
Definition: TBranch.h:160
A TTree is a list of TBranches.
Definition: TBranch.h:58
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
Definition: TNamed.cxx:152
virtual Int_t ReadBasketBuffers(Long64_t pos, Int_t len, TFile *file)
See TBasket::ReadBasketBuffers. This is not implemented in TBasketSQL.
Definition: TBasketSQL.cxx:138
TString * fInsertQuery
Definition: TBasketSQL.h:40