Hi Andre,
You are right. Your fix is OK and now in CVS.
Thanks for reporting this.
Rene Brun
Andre Holzner wrote:
>
> Hi,
>
> happy new year to everybody !
>
> I'm using root 3.02/06 cvs of December 23, 2001 on Linux/i386.
>
> I run the following small macro:
>
> {
> f = new TFile("$ROOTSYS/tutorials/basic.root"); // generated by
> $ROOTSYS/tutorials/basic.C
> f->cd();
> TSQLResult *query_res = ntuple->Query("x:x:x:x");
> TSQLRow *row;
>
> while (row = query_res->Next())
> {
> cerr << row->GetField(0) << ' ' << row->GetField(3) << endl;
> delete row;
> }
> delete query_res;
> }
>
> where I get the following output:
>
> -1.10227895 1.10227895
> 1.86717796 .86717796
> -0.524181008 0.524181008
>
> i.e.the second and later columns have the first character truncated.
>
> Replacing in TTreeRow::GetField(Int_t field) the following line:
>
> if (field > 0) return fRow +fFields[field-1]+1;
>
> by
> if (field > 0) return fRow +fFields[field-1];
>
> and replacing in TTreeRow::SetRow(const Int_t *fields, const char *row)
>
> Int_t nch = fields[fColumnCount-1]-1;
> by
> Int_t nch = fields[fColumnCount-1];
>
> (the '\0' after the last field must be stored as well, otherwise
> GetField(...)
> for the last column returns an improperly terminated string)
>
> seems to solve the problem (I guess the meaning of fFields[i]
> is the sum of the lengths including the trailing '\0's of fields
> 0..i-1).
>
> best regards,
>
> Andre
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:37 MET