Re: SQL and TTree

From: Andre Lebedev <lebedev_at_fas.harvard.edu>
Date: Wed, 15 Mar 2006 18:30:21 -0500


Hi,

That's great, except

root [2] TPgSQLServer db("pgsql://localhost/runs", "", "") root [3] nt = new TTreeSQL(&db, "runs", "runs") Error in <TPgSQLServer::GetColumns>: not implemented (class TTreeSQL*)0xaacf090
root [5] nt->Print()


*Tree    :runs      : Database read from table: 
runs                         *
*Entries :    11981 : Total =             264 bytes  File  Size 
=          0 *
*        :          : Tree compression factor =   
1.00                       *
******************************************************************************

And I can't do nt->Draw().

Cheers,
Andre.

Philippe Canal wrote:

>Hi,
>
>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.
>
>Cheers,
>Philippe.
>
>-----Original Message-----
>From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch]
>On Behalf Of Andre Lebedev
>Sent: Wednesday, March 15, 2006 4:16 PM
>To: roottalk_at_pcroot.cern.ch
>Subject: [ROOT] SQL and TTree
>
>Hello.
>
>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.
>
>Thanks,
>Andre.
>
>
>
Received on Thu Mar 16 2006 - 00:30:28 MET

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