00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TTreeSQL
00013 #define ROOT_TTreeSQL
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef ROOT_TTree
00034 #include "TTree.h"
00035 #endif
00036
00037 #include <vector>
00038
00039 class TSQLServer;
00040 class TSQLRow;
00041 class TBasketSQL;
00042
00043 class TTreeSQL : public TTree {
00044
00045 protected:
00046 Int_t fCurrentEntry;
00047 TString fDB;
00048 TString fInsertQuery;
00049 TString fQuery;
00050 TString fTable;
00051 TSQLResult *fResult;
00052 TSQLRow *fRow;
00053 TSQLServer *fServer;
00054 Bool_t fBranchChecked;
00055
00056 void CheckBasket(TBranch * tb);
00057 Bool_t CheckBranch(TBranch * tb);
00058 Bool_t CheckTable(const TString &table) const;
00059 TString CreateBranches(TSQLResult * rs);
00060 std::vector<Int_t> *GetColumnIndice(TBranch *branch);
00061 void Init();
00062 void ResetQuery();
00063 TString ConvertTypeName(const TString& typeName );
00064 virtual void CreateBranch(const TString& branchName,const TString &typeName);
00065 Bool_t CreateTable(const TString& table);
00066 virtual TBasket *CreateBasket(TBranch * br);
00067
00068 virtual TBranch *BranchImp(const char *branchname, const char *classname, TClass *ptrClass, void *addobj, Int_t bufsize, Int_t splitlevel);
00069 virtual TBranch *BranchImp(const char *branchname, TClass *ptrClass, void *addobj, Int_t bufsize, Int_t splitlevel);
00070
00071 public:
00072 TTreeSQL(TSQLServer * server, TString DB, const TString& table);
00073
00074 virtual Int_t Branch(TCollection *list, Int_t bufsize=32000, Int_t splitlevel=99, const char *name="");
00075 virtual Int_t Branch(TList *list, Int_t bufsize=32000, Int_t splitlevel=99);
00076 virtual Int_t Branch(const char *folder, Int_t bufsize=32000, Int_t splitlevel=99);
00077 virtual TBranch *Bronch(const char *name, const char *classname, void *addobj, Int_t bufsize=32000, Int_t splitlevel=99);
00078 virtual TBranch *BranchOld(const char *name, const char *classname, void *addobj, Int_t bufsize=32000, Int_t splitlevel=1);
00079 #if !defined(__CINT__)
00080 virtual TBranch *Branch(const char *name, const char *classname, void *addobj, Int_t bufsize=32000, Int_t splitlevel=99);
00081 #endif
00082
00083 virtual TBranch *Branch(const char *name, void *address, const char *leaflist, Int_t bufsize);
00084
00085 virtual Int_t Fill();
00086 virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0);
00087 virtual Long64_t GetEntries() const;
00088 virtual Long64_t GetEntries(const char *sel) { return TTree::GetEntries(sel); }
00089 virtual Long64_t GetEntriesFast()const;
00090 TString GetTableName(){ return fTable; }
00091 virtual Long64_t LoadTree(Long64_t entry);
00092 virtual Long64_t PrepEntry(Long64_t entry);
00093 void Refresh();
00094
00095 ClassDef(TTreeSQL,1);
00096 };
00097
00098
00099 #endif