RE: SQL and TTree

From: Philippe Canal <>
Date: Wed, 15 Mar 2006 17:01:02 -0600


For this purpose you can use the TTreeSQL interface.

   TSQLServer *dbserver = TSQLServer::Connect(servername,username,password);    ntuple = new TTreeSQL(dbserver, dbname, tablename);

if there is a table named 'tablename' in the database named 'dbname', this will create a TTree which has direct access to the information in the table. If the table does not exist if will create one the first time you call TTree::Fill.

You can them use all the TTree tools to look at and manipulate the data, this includes TTree::Draw and TTree::CloneTree.


-----Original Message-----
From: [] On Behalf Of Andre Lebedev
Sent: Wednesday, March 15, 2006 4:16 PM
Subject: [ROOT] SQL and TTree


Is there an easy way to convert TSQLResult into a TTree? I see that TTree can return a TSQLResult, but what about the other way around? In particular, what I would like to do is to query a Postgres DB, and store result as a TTree.

Andre. Received on Thu Mar 16 2006 - 00:03:52 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:57 MET