56      Error(
"TTreeSQL",
"No TSQLServer specified");
 
   71   Fatal(
"BranchImp",
"Not implemented yet");
 
   81   Fatal(
"BranchImp",
"Not implemented yet");
 
   91   Fatal(
"Branch",
"Not implemented yet");
 
  100   Fatal(
"Branch",
"Not implemented yet");
 
  110   Fatal(
"Branch",
"Not implemented yet");
 
  120   Fatal(
"Bronc",
"Not implemented yet");
 
  130   Fatal(
"BranchOld",
"Not implemented yet");
 
  140   Fatal(
"Branch",
"Not implemented yet");
 
  148                           const char *leaflist, 
Int_t bufsize)
 
  154   for (
int i=0;i<nb;i++) {
 
  163         Fatal(
"Branch()", 
"Duplicate branch!!!");
 
  184      if (basket==0) 
return;
 
  196   for (
int i=0;i<nb;i++) {
 
  220   if (!basket) 
return kFALSE;
 
  224      Error(
"CheckBranch",
"%s has basket but no resultset yet",tb->
GetName());
 
  230   for(
int j=0;j<nl;j++) {
 
  258   if (!tables) 
return kFALSE;
 
  260   while( (row = tables->
Next()) ) {
 
  285   if(typeName == 
"Char_t"){
 
  288   else if(typeName == 
"Int_t") {
 
  291   else if(typeName == 
"Short_t") {
 
  294   else if( typeName == 
"UShort_t") {
 
  295      tn = 
"SMALLINT UNSIGNED";
 
  297   else if(typeName == 
"Float_t"){
 
  300   else if(typeName == 
"Float16_t"){
 
  303   else if(typeName == 
"Double_t"){
 
  306   else if(typeName == 
"Double32_t"){
 
  309   else if(typeName == 
"UInt_t") {
 
  312   else if( typeName == 
"Long_t") {
 
  315   else if( typeName == 
"ULong_t") {
 
  316      tn = 
"INTEGER UNSIGNED";
 
  318   else if( typeName == 
"Long64_t") {
 
  321   else if( typeName == 
"ULong64_t") {
 
  322      tn = 
"BIGINT UNSIGNED";
 
  324   else if( typeName == 
"Bool_t") {
 
  328      Error(
"ConvertTypeName",
"TypeName (%s) not found",typeName.
Data());
 
  341      Error(
"CreateBasket",
"No TSQLServer specified");
 
  359      Error(
"CreateBranch",
"No TSQLServer specified");
 
  364   alterSQL = 
"ALTER TABLE ";
 
  369   alterSQL += typeName;
 
  393   for( 
int i=0; i < rows; ++i ) {
 
  399         prec = atoi(
type(index+1,
type.First(
')')-1).Data());
 
  410      if (prevBranch.
Length()) {
 
  435         decl.
Append( leafName+siz+
"/C:" );
 
  438         decl.
Append( leafName+
"/I:" );
 
  443         decl.
Append( leafName+
"/I:" );
 
  448         decl.
Append( leafName+
"/i:" );
 
  451         decl.
Append( leafName+
"/S:" );
 
  461         decl.
Append( leafName+
"/F:" );
 
  468   if (prevBranch.
Length()) {
 
  488      Error(
"CreateTable",
"No TSQLServer specified");
 
  493   TString createSQL, alterSQL, str;
 
  510         if(i == 0 && j == 0) {
 
  512            createSQL += 
"CREATE TABLE ";
 
  517            createSQL += leafName;
 
  519            createSQL += typeName;
 
  525               Error(
"CreateTable",
"May have failed");
 
  579   for (
int i=0;i<nb;i++) {
 
  585      for(
int i=0;i<nb;i++) {
 
  588            Error(
"Fill",
"CheckBranch for %s failed",branch->
GetName());
 
  619   std::vector<Int_t> *columns = 
new std::vector<Int_t>;
 
  623   std::vector<TString> names;
 
  626   if (rs==0) { 
delete columns; 
return 0; }
 
  629   std::pair<TString,Int_t> value;
 
  631   for (
Int_t i=0;i<rows;++i) {
 
  633      names.push_back( row->
GetField(0) );
 
  638   for(
int j=0;j<nl;j++) {
 
  649      for (
Int_t i=0;i<rows;++i) {
 
  657         for (
Int_t i=0;i<rows;++i) {
 
  665         columns->push_back(col);
 
  666      } 
else Error(
"GetColumnIndice",
"Error finding column %d %s",j,str.
Data());
 
  668   if (columns->empty()) {
 
  669      delete columns; 
return 0;
 
  697         sscanf(val.
Data(), 
"%ld",&(ret) );
 
  754      if (
fRow==0 && !reset) {
 
  761   if (
fRow==0) 
return -1;
 
R__EXTERN Int_t gErrorIgnoreLevel
Implement TBasket for a SQL backend.
TSQLResult * GetResultSet()
void CreateBuffer(const char *name, TString title, std::vector< Int_t > *vc, TBranch *branch, TSQLResult **rs)
Create a TSQLBuffer for this basket.
Manages buffers for branches of a Tree.
A TTree is a list of TBranches.
virtual void ResetAddress()
Reset the address of the branch.
TObjArray * GetListOfBranches()
TBasket * GetBasket(Int_t basket)
Return pointer to basket basketnumber in this Branch.
TObjArray * GetListOfBaskets()
TObjArray * GetListOfLeaves()
virtual void SetEntries(Long64_t entries)
Set the number of entries in this branch.
Long64_t * GetBasketEntry() const
Buffer base class used for serializing objects.
The ROOT global object gROOT contains a list of all defined classes.
Collection abstract base class.
TBuffer * GetBufferRef() const
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
virtual const char * GetTypeName() const
virtual const char * GetName() const
Returns name of object.
Int_t GetEntriesFast() const
virtual void AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
TObject * UncheckedAt(Int_t i) const
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
virtual const char * GetFieldName(Int_t field)=0
virtual Int_t GetRowCount() const
virtual TSQLRow * Next()=0
virtual Int_t GetFieldCount()=0
virtual const char * GetField(Int_t field)=0
virtual TSQLResult * Query(const char *sql)=0
virtual TSQLResult * GetTables(const char *dbname, const char *wild=0)=0
virtual TSQLResult * GetColumns(const char *dbname, const char *table, const char *wild=0)=0
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
const char * Data() const
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
TString & Remove(Ssiz_t pos)
TString & Append(const char *cs)
Implement TTree for a SQL backend.
TString ConvertTypeName(const TString &typeName)
Convert from ROOT typename to SQL typename.
virtual Long64_t GetEntries() const
Get the number of rows in the database.
virtual Long64_t GetEntriesFast() const
Return the number of entries as of the last check.
Bool_t CheckTable(const TString &table) const
Check the table exist in the database.
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Load the data for the entry from the database.
virtual Int_t Fill()
Copy the information from the user object to the TTree.
void Init()
Initializeation routine.
TString CreateBranches(TSQLResult *rs)
determine leaf description string
std::vector< Int_t > * GetColumnIndice(TBranch *branch)
Return a vector of columns index corresponding to the current SQL table and the branch given as argum...
Bool_t CheckBranch(TBranch *tb)
Check if the table has a column corresponding the branch and that the resultset are properly setup.
virtual TBranch * Bronch(const char *name, const char *classname, void *addobj, Int_t bufsize=32000, Int_t splitlevel=99)
Not implemented yet.
virtual Long64_t PrepEntry(Long64_t entry)
Make sure the server and result set are setup for the requested entry.
virtual Long64_t LoadTree(Long64_t entry)
Setup the tree to the load the specified entry.
virtual Int_t Branch(TCollection *list, Int_t bufsize=32000, Int_t splitlevel=99, const char *name="")
Not implemented yet.
virtual TBranch * BranchOld(const char *name, const char *classname, void *addobj, Int_t bufsize=32000, Int_t splitlevel=1)
Not implemented yet.
virtual void CreateBranch(const TString &branchName, const TString &typeName)
Create the column(s) in the database that correspond to the branch/.
void Refresh()
Refresh contents of this Tree and its branches from the current Tree status in the database One can c...
void ResetQuery()
Reset the internal query.
TTreeSQL(TSQLServer *server, TString DB, const TString &table)
Constructor with an explicit TSQLServer.
virtual TBasket * CreateBasket(TBranch *br)
Create a TBasketSQL.
Bool_t CreateTable(const TString &table)
Create the database table corresponding to this TTree.
virtual TBranch * BranchImp(const char *branchname, const char *classname, TClass *ptrClass, void *addobj, Int_t bufsize, Int_t splitlevel)
Not implemented yet.
void CheckBasket(TBranch *tb)
Check if the basket is properly setup.
A TTree object has a header with a name and a title.
virtual Int_t Fill()
Fill all branches.
TObjArray fBranches
List of Branches.
Long64_t fEntries
Number of entries.
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
Long64_t fReadEntry
! Number of the entry being processed
virtual Int_t Branch(TCollection *list, Int_t bufsize=32000, Int_t splitlevel=99, const char *name="")
Create one branch for each element in the collection.