| 1 | //////////////////////////////////////////////////////////////////////////
|
|---|
| 2 | // //
|
|---|
| 3 | // MBasketSQL //
|
|---|
| 4 | // //
|
|---|
| 5 | // Implement TBasket for a SQL backend //
|
|---|
| 6 | // //
|
|---|
| 7 | //////////////////////////////////////////////////////////////////////////
|
|---|
| 8 |
|
|---|
| 9 | #ifndef MARS_MBasketSQL
|
|---|
| 10 | #define MARS_MBasketSQL
|
|---|
| 11 |
|
|---|
| 12 | #include "MBasketSQL.h"
|
|---|
| 13 |
|
|---|
| 14 | #include "TBasket.h"
|
|---|
| 15 | #include "TTree.h"
|
|---|
| 16 | #include "TBranch.h"
|
|---|
| 17 | #include "MBufferSQL.h"
|
|---|
| 18 |
|
|---|
| 19 | ClassImp(MBasketSQL)
|
|---|
| 20 |
|
|---|
| 21 | namespace std {} using namespace std;
|
|---|
| 22 |
|
|---|
| 23 | //_________________________________________________________________________
|
|---|
| 24 | MBasketSQL::MBasketSQL() : TBasket(), fRowPtr(0)
|
|---|
| 25 | {
|
|---|
| 26 | // Default constructor.
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 | //_________________________________________________________________________
|
|---|
| 30 | MBasketSQL::MBasketSQL(TBranch *branch, TSQLRow **sqlrow, Int_t index, TString type)
|
|---|
| 31 | {
|
|---|
| 32 | // Create a TSQLBuffer for this basket.
|
|---|
| 33 | SetName(branch->GetName());
|
|---|
| 34 | SetTitle(branch->GetName());
|
|---|
| 35 |
|
|---|
| 36 | fClassName = "MBasketSQL";
|
|---|
| 37 |
|
|---|
| 38 | fBufferSize = branch->GetBasketSize();
|
|---|
| 39 | fNevBufSize = branch->GetEntryOffsetLen();
|
|---|
| 40 | fNevBuf = 0;
|
|---|
| 41 | fEntryOffset = 0; //Must be set to 0 before calling Sizeof
|
|---|
| 42 | fDisplacement= 0; //Must be set to 0 before calling Sizeof
|
|---|
| 43 | fBuffer = 0; //Must be set to 0 before calling Sizeof
|
|---|
| 44 | fBufferRef = 0;
|
|---|
| 45 |
|
|---|
| 46 | fBufferRef = new MBufferSQL(sqlrow, index, type);
|
|---|
| 47 |
|
|---|
| 48 | fHeaderOnly = kTRUE;
|
|---|
| 49 | fLast = 0;
|
|---|
| 50 | //Streamer(*fBufferRef);
|
|---|
| 51 | fBuffer = 0;
|
|---|
| 52 | fBranch = branch;
|
|---|
| 53 | fHeaderOnly = kFALSE;
|
|---|
| 54 | branch->GetTree()->IncrementTotalBuffers(fBufferSize);
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 | //_________________________________________________________________________
|
|---|
| 58 | void MBasketSQL::PrepareBasket(Long64_t entry)
|
|---|
| 59 | {
|
|---|
| 60 | // Prepare the basket for the next entry.
|
|---|
| 61 | fBranch->GetTree()->LoadTree(entry);
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | //_________________________________________________________________________
|
|---|
| 65 | Int_t MBasketSQL::ReadBasketBytes(Long64_t , TFile *)
|
|---|
| 66 | {
|
|---|
| 67 | Error("ReadBasketBytes","This member function should not be called!");
|
|---|
| 68 | return 0;
|
|---|
| 69 | }
|
|---|
| 70 |
|
|---|
| 71 | //_________________________________________________________________________
|
|---|
| 72 | Int_t MBasketSQL::ReadBasketBuffers(Long64_t , Int_t, TFile *)
|
|---|
| 73 | {
|
|---|
| 74 | Error("ReadBasketBuffers","This member function should not be called!");
|
|---|
| 75 | return 0;
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 | //_________________________________________________________________________
|
|---|
| 79 | void MBasketSQL::Update(Int_t, Int_t)
|
|---|
| 80 | {
|
|---|
| 81 | // See TBasket::Update.
|
|---|
| 82 | fNevBuf++;
|
|---|
| 83 | }
|
|---|
| 84 |
|
|---|
| 85 | #endif
|
|---|