Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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 "TBasketSQL.h"
16#include "TBranch.h"
17#include "TFile.h"
18#include "TTreeSQL.h"
19#include "TBufferSQL.h"
20
21#include <vector>
22
23
24/** \class TBasketSQL
25\ingroup tree
26
27Implement TBasket for a SQL backend.
28*/
29
30////////////////////////////////////////////////////////////////////////////////
31/// Default constructor.
32
34{
35}
36
37////////////////////////////////////////////////////////////////////////////////
38/// Regular constructor.
39
40TBasketSQL::TBasketSQL(const char *name, const char *title, TBranch *branch,
41 TSQLResult ** rs, TString *insert_query,
42 std::vector<Int_t> *vc, TSQLRow **r) :
44{
46 SetTitle(title);
47 fClassName = "TBasketSQL";
48 fBufferSize = branch->GetBasketSize();
50 fNevBuf = 0;
51 fEntryOffset = nullptr; //Must be set to 0 before calling Sizeof
52 fDisplacement= nullptr; //Must be set to 0 before calling Sizeof
53 fBuffer = nullptr; //Must be set to 0 before calling Sizeof
54 fInsertQuery = insert_query;
55
56 if (vc==nullptr) {
57 fBufferRef = nullptr;
58 } else {
60 }
61 fHeaderOnly = true;
62 fLast = 0; // Must initialize before calling Streamer()
63 //Streamer(*fBufferRef);
64 fBuffer = nullptr;
65 fBranch = branch;
66 fHeaderOnly = false;
68
69}
70
71////////////////////////////////////////////////////////////////////////////////
72/// Destructor
73
77
78////////////////////////////////////////////////////////////////////////////////
79/// Create a TSQLBuffer for this basket.
80
81void TBasketSQL::CreateBuffer(const char *name, TString title,
82 std::vector<Int_t> *vc,
83 TBranch *branch, TSQLResult ** rs)
84{
85 fResultPtr = rs;
87 SetTitle(title);
88 fClassName = "TBasketSQL";
89 fBufferSize = branch->GetBasketSize();
91 fNevBuf = 0;
92 fEntryOffset = nullptr; //Must be set to 0 before calling Sizeof
93 fDisplacement= nullptr; //Must be set to 0 before calling Sizeof
94 fBuffer = nullptr; //Must be set to 0 before calling Sizeof
95
96 if(vc==nullptr) {
97 fBufferRef = nullptr;
98 Error("CreateBuffer","Need a vector of columns\n");
99 } else {
101 }
102 fHeaderOnly = true;
103 fLast = 0;
104 //Streamer(*fBufferRef);
105 fBuffer = nullptr;
106 fBranch = branch;
107 fHeaderOnly = false;
109}
110
111////////////////////////////////////////////////////////////////////////////////
112/// Prepare the basket for the next entry.
113
115{
116 ((TBufferSQL*)fBufferRef)->ResetOffset();
117 ((TTreeSQL*)fBranch->GetTree())->PrepEntry(entry);
118 fBufferRef->Reset();
119}
120
121////////////////////////////////////////////////////////////////////////////////
122/// See TBasket::ReadBasketBytes. This is not implemented in TBasketSQL.
123
125{
126 Error("ReadBasketBytes","This member function should not be called!");
127 return 0;
128}
129
130////////////////////////////////////////////////////////////////////////////////
131/// See TBasket::ReadBasketBuffers. This is not implemented in TBasketSQL.
132
134{
135 Error("ReadBasketBuffers","This member function should not be called!");
136 return 0;
137}
138
139////////////////////////////////////////////////////////////////////////////////
140/// See TBasket::Update.
141
143{
144 ((TBufferSQL*)fBufferRef)->ResetOffset();
145 fNevBuf++;
146}
147
148#endif
ROOT::R::TRInterface & r
Definition Object.C:4
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
char name[80]
Definition TGX11.cxx:148
void CreateBuffer(const char *name, TString title, std::vector< Int_t > *vc, TBranch *branch, TSQLResult **rs)
Create a TSQLBuffer for this basket.
TSQLResult ** fResultPtr
!
Definition TBasketSQL.h:38
virtual Int_t ReadBasketBuffers(Long64_t pos, Int_t len, TFile *file)
See TBasket::ReadBasketBuffers. This is not implemented in TBasketSQL.
TBasketSQL()
Default constructor.
TSQLRow ** fRowPtr
!
Definition TBasketSQL.h:39
~TBasketSQL() override
Destructor.
virtual Int_t ReadBasketBytes(Long64_t pos, TFile *file)
See TBasket::ReadBasketBytes. This is not implemented in TBasketSQL.
void PrepareBasket(Long64_t entry) override
Prepare the basket for the next entry.
void Update(Int_t offset, Int_t skipped) override
See TBasket::Update.
TString * fInsertQuery
!
Definition TBasketSQL.h:40
Int_t * fEntryOffset
[fNevBuf] Offset of entries in fBuffer(TKey); generated at runtime.
Definition TBasket.h:71
bool fHeaderOnly
True when only the basket header must be read/written.
Definition TBasket.h:66
TBranch * fBranch
Pointer to the basket support branch.
Definition TBasket.h:73
friend class TBranch
Definition TBasket.h:35
Int_t fBufferSize
fBuffer length in bytes
Definition TBasket.h:62
TBasket(const TBasket &)
TBasket objects are not copiable.
Int_t fNevBufSize
Length in Int_t of fEntryOffset OR fixed length of each entry if fEntryOffset is null!
Definition TBasket.h:63
Int_t fNevBuf
Number of entries in basket.
Definition TBasket.h:64
Int_t fLast
Pointer to last used byte in basket.
Definition TBasket.h:65
Int_t * fDisplacement
![fNevBuf] Displacement of entries in fBuffer(TKey)
Definition TBasket.h:70
TTree * GetTree() const
Definition TBranch.h:261
virtual Int_t GetBasketSize() const
Definition TBranch.h:226
Int_t GetEntryOffsetLen() const
Definition TBranch.h:236
Implement TBuffer for a SQL backend.
Definition TBufferSQL.h:30
@ kWrite
Definition TBuffer.h:73
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
Definition TFile.h:130
TBuffer * fBufferRef
Pointer to the TBuffer object.
Definition TKey.h:52
char * fBuffer
Object buffer.
Definition TKey.h:51
TString fClassName
Object Class name.
Definition TKey.h:49
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:173
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:149
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1098
Basic string class.
Definition TString.h:138
A TTree object is a list of TBranch.
Definition TTreeSQL.h:42
virtual void IncrementTotalBuffers(Int_t nbytes)
Definition TTree.h:633