TTreeSQL - how to create

Hello,

It seems that I can’t create a TTreeSQL object because the class is not visible:

root [9] TTree   [tab]
TTree
TTreeFormula
TTree::
TTreeFriendLeafIter
TTreeResult
TTreeRow

or:

root [9] TTreeSQL::Class()
Error: Function Class() is not defined in current scope  FILE:(tmpfile) LINE:1
Possible candidates are...
filename       line:size busy function type and name
*** Interpreter error recovered ***

or

root [1] TSQLServer *server = TSQLServer::Connect("pgsql://myserver/period", "user", "");
root [2] t = new TTreeSQL(server, "period", "stars");
Error: Symbol TTreeSQL is not defined in current scope  FILE:(tmpfile) LINE:1
Error: type TTreeSQL not defined FILE:(tmpfile) LINE:1
Warning: Automatic variable t is allocated FILE:(tmpfile) LINE:1
Error: Undeclared variable t FILE:(tmpfile) LINE:1
*** Interpreter error recovered ***

However the class has been compiled, bacause lib/libTree.so contains the string ‘TTreeSQL’.

Please tell me how to use that class. Kind regards,
Marek Biskup

Hi Marek,

I cannot reproduce this problem

root [0] TTree TTree TTreeCloner TTreeFormula TTree::ELockStatusBits TTree:: TTreeFriendLeafIter TTreeCloner::ECloneMethod TTreeResult TTreeRow TTreeSQL root [0] TTreeSQL::Class() (class TClass*)0x91db630

Give more details on your installation/version.
Did you run make map?

Rene

Hi Rene,

I’m using the CVS version (just downloaded and compiled). I did ‘make map’. I’m using fedora core 4 linux with gcc 4.0.0. I compiled ROOT with:

./configure --enable-pgsql --enable-mysql

Maybe something more is missing?

Marek,

I cannot reproduce the problem with your configuration.
Note that gcc4.0.0 is very buggy. Use gcc4.0.1 or 4.0.2

Rene

Hi Rene,

Somehow it works now. But I can’t run queries:

root [3] TSQLServer::Connect("pgsql://heplx49/period", "pidb_user", "") (class TSQLServer*)0xac16358 root [4] TSQLServer *s = TSQLServer::Connect("pgsql://heplx49/period", "pidb_user", "") root [5] t = new TTreeSQL(s, "period", "starstmp"); Error in TPgSQLServer : : GetColumns: not implemented root [8] t->Draw("mag_med"); Error in <TTreeFormula>: Bad numerical expression : "mag_med"

mag_med is a column in my database.
Maybe that’s because of TPgSQLServer::GetColumns?

Indeed. TTreeSQL requires a function GetColumns to know which are the columns in the table :slight_smile:

Cheers,
Philippe

Hi Marek,

as (ex-)ROOT hacker maybe you can implement this missing routine (if supported by PgSql API).

Ciao, Fons.

Hi Fons,

I can try :slight_smile:
Will it work then? :wink:

Cheers,
Marek

Yes, very likely and if not we’ll have to fix the next problem. :slight_smile:

  • -Fons