Hi Brett et al, On Wed, 24 Oct 2001 17:05:59 -0400 Brett Viren <bv@bnl.gov> wrote concerning "Re: More on Graphics abstraction (was Re: [ROOT] Qt ROOT)": > > ... - and ROOT sure could use a SQL query mechanism). > > Yes, this is the question (although I don't understand the reference > to SQL queries, maybe something in Qt?). The thing is, I'd really like to be able to do SQL queries on objects stored in a ROOT file. For example, suppose you had the classes class Foo : public TObject { private: Int_t fFoo; public: Foo(Int_t foo) fFoo(foo) {} Int_t GetFoo() const { return fFoo; } void SetFoo(Int_t foo) { fFoo = foo; } ClassDef(Foo, 1) // Foo Class }; class Bar : public TObject { private: Float_t fBar; public: Bar(Int_t bar) fBar(bar) {} Int_t GetBar() const { return fBar; } void SetBar(Int_t bar) { fBar = bar; } ClassDef(Bar, 1) // Bar Class }; And then suppose you store some objects of these classes on disk in the file foobar.root. Then later on, you'd like to be able to do TFile* file = TFile::Open("foobar.root"); TSQLResult* res = file->Query("SELECT fFoo FROM Foo WHERE fFoo > 0"); TSQLRow* row = 0; TObjArray* arr = new TObjArray; while (row = res->Next()) arr->Add(new Foo(strtol(row->GetField(0), NULL, 0))); TSQLResult* res = file->Query("SELECT Foo.fFoo, Bar.fBar FROM " "Foo, Bar WHERE fFoo > 0"); file->Query("INSERT INTO Foo (fFoo) VALUES (1000000000)"); file->Query("UPDATE Foo SET fFoo = -11 WHERE fFoo = 1000000000"); file->Query("DELETE FROM Foo WHERE fFoo = -11"); If this was possible, one could throw away MySQL and use ROOT as RDBM via rootd, and so on - that would be nice. And if rootd could do transactions, well (butchering Sex Pistols), Never mind PostGreSQL, SapDB, Objectivity, Oracle, etc. Here comes ROOT! Ok, one more thing for the TODO list :-) > > No, not at all. I really wanted to some more spicy arguments, and you > > delivered - thanks. > > Heh, my pleasure. Although, I didn't mean to be inflammatory. Oh, I meant arguments that bites! Not inflames - hmm, perhaps equally bad choice of words - well, you know what I mean (nothing bad I assure you). Yours, Christian Holm Christensen ------------------------------------------- Address: Sankt Hansgade 23, 1. th. Phone: (+45) 35 35 96 91 DK-2200 Copenhagen N Cell: (+45) 28 82 16 23 Denmark Office: (+45) 353 25 305 Email: cholm@nbi.dk Web: www.nbi.dk/~cholm
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:04 MET