[root] / trunk / io / sql / inc / TKeySQL.h Repository:
ViewVC logotype

Log of /trunk/io/sql/inc/TKeySQL.h

Parent Directory Parent Directory


Links to HEAD: (view) (download) (as text) (annotate)
Sticky Revision:

Revision 38346 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Mar 9 17:41:58 2011 UTC (3 years, 10 months ago) by pcanal
File length: 3266 byte(s)
Diff to previous 26606
From Lukasz:

The ROOT bug (<http://savannah.cern.ch/support/?119348>) is related to the fact that
TKey happily ignores the return code from TFile::ReadBuffer. The attached patch fixes 
the problem for this particular use case.

Revision 26606 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Dec 2 20:36:09 2008 UTC (6 years, 1 month ago) by pcanal
File length: 3251 byte(s)
Diff to previous 24037
Following Igor Smirnov analysis fix several memory leaks, add checks for null pointer dereference, fix or add copy constructor and assignment operator when applicable, make the copy constructor and assignment operator private when the objects are not intended to be copiable.

Revision 24037 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed May 28 06:32:07 2008 UTC (6 years, 7 months ago) by brun
File length: 3086 byte(s)
Diff to previous 24014
Instead of the optional argument in TKey::ReadObj, implement a new function
TKey::ReadObjWithBuffer(char *bufferRead)

Revision 24014 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon May 26 12:21:59 2008 UTC (6 years, 8 months ago) by brun
File length: 3046 byte(s)
Diff to previous 23122
Add optional argument bufferRead to the ReadObj functions.

Revision 23122 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Apr 10 14:56:30 2008 UTC (6 years, 9 months ago) by rdm
File length: 3028 byte(s)
Diff to previous 20882
move the following directories into "io":

castor, chrip, dcache, gfal, io, rfio, sql, xml

Revision 20882 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Nov 19 11:31:26 2007 UTC (7 years, 2 months ago) by rdm
Original Path: trunk/sql/inc/TKeySQL.h
File length: 3028 byte(s)
Diff to previous 19826
Set property svn:eol-style LF on all source and Makefiles. This should avoid
problems with Win32 line endings ending up in the repository. All MS tools
support LF eols fine.

Revision 19826 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Sep 19 19:56:11 2007 UTC (7 years, 4 months ago) by rdm
Original Path: trunk/sql/inc/TKeySQL.h
File length: 3028 byte(s)
Diff to previous 19825
imported svn:keywords Id property

Revision 19825 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Sep 19 19:49:10 2007 UTC (7 years, 4 months ago) by rdm
Original Path: trunk/sql/inc/TKeySQL.h
File length: 3077 byte(s)
Diff to previous 13977
remove :$ from tag line

Revision 13977 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Feb 1 18:57:41 2006 UTC (8 years, 11 months ago) by pcanal
Original Path: trunk/sql/inc/TKeySQL.h
File length: 3087 byte(s)
Diff to previous 13927
From Sergei Linev:
Move CreateKey from TDirectory to TFile
Here is also optimisation of SQL statements and adjustement for Oracle.
Implementation of ClassBegin()/ClassMember()/ClassEnd() methdos for TBufferSQL2 and TBufferXML.
I also implementation for ClassMemeber() method for case of "raw:data" for SQL and XML cases.

Revision 13927 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Jan 25 16:00:11 2006 UTC (9 years ago) by pcanal
Original Path: trunk/sql/inc/TKeySQL.h
File length: 3073 byte(s)
Diff to previous 13524
From Segei Linev:
Update to sql and xml following the chnage to reduce reliance
on gFile and gDirectory

Revision 13524 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Dec 7 14:59:57 2005 UTC (9 years, 1 month ago) by rdm
Original Path: trunk/sql/inc/TKeySQL.h
File length: 2989 byte(s)
Diff to previous 13317
fix cvs indentification line: net -> sql.

Revision 13317 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Nov 22 20:42:37 2005 UTC (9 years, 2 months ago) by pcanal
Original Path: trunk/sql/inc/TKeySQL.h
File length: 2987 byte(s)
Diff to previous 13312
From Sergei:
Fix white spaces, add more comment to functions, add CVS tag lines and copyright.
It should now work  for array of objects and most stl classes.
I put limitation for array size. If array with fixed size exceed limit (default 20),
array will be converted to raw data, otherwise each element of array will be presented as
single column.

Revision 13312 - (view) (download) (as text) (annotate) - [select for diffs]
Added Mon Nov 21 17:38:24 2005 UTC (9 years, 2 months ago) by pcanal
Original Path: trunk/sql/inc/TKeySQL.h
File length: 2607 byte(s)
From Sergey:

Introduce a "transparent" access to SQL data base via standard TFile interface.

The main approach that each class (but not each object) has one or two tables
with names like $(CLASSNAME)_ver$(VERSION) and $(CLASSNAME)_streamer_ver$(VERSION)
For example: TAxis_ver8 or TList_streamer_ver5
Second kind of tables appears, when some of class members can not be converted to
normalized form or when class has custom streamer.
For instance, for TH1 class two tables are required: TH1_ver4 and TH1_streamer_ver4
Most of memebers are stored in TH1_ver4 table columnwise, and only memeber:

Double_t*  fBuffer;  //[fBufferSize]

can not be represented as column while size of array is not known apriory.
Therefore, fBuffer will be written as list of values in TH1_streamer_ver4 table.

All objects, stored in the DB, will be registered in table "ObjectsTable".
In this there are following columns:
"key:id"  - key identifier to which belong object
"obj:id"  - object identifier
"Class"   - object class name
"Version" - object class version
Data in each "ObjectsTable" row uniqly identify, in which table
and which column object is stored.

In normal situation all class data should be sorted columnwise.
Up to now following member are supported:
1) Basic data types
Here is everything clear. Column SQL type will be as much as possible
close to the original type of value.
2) Fixed array of basic data types
In this case n columns like fArr[0], fArr[1] and so on will be created.
If there is multidimensional array, names will be fArr2[1][2][1] and so on
3) Parent class
In this case version of parent class is stored and
data of parent class will be stored with the same obj:id in corrspondent table.
There is a special case, when parent store nothing (this is for instance TQObject).
In that case just -1 is written to avoid any extra checks if table exist or not.
4) Object as data member.
In that case object is saved in normal way to data base and column
will contain id of this object.
5) Pointer on object
Same as before. In case if object was already stored, just its id
will be placed in the column. For NULL pointer 0 is used.
6) TString
Now column with limited width like VARCAHR(255) in MySQL is used.
Later this will be improved to support maximum possible strings
7) Anything else.
Data will be converted to raw format and saved in _streamer_ table.
Each row supplied with obj:id and row:id, where row:id indicates
data, corresponding to this particular data member, and column
will contain this raw:id

See the TSQLFile documentation for more details.

example of a session saving data to a SQL data base
=====================================================

const char* dbname = "mysql://host.domain:3306/dbname";
const char* username = "username";
const char* userpass = "userpass";

// Clean data base and create primary tables
TSQLFile* f = new TSQLFile(dbname, "recreate", username, userpass);
// Write with standard I/O functions
arr->Write("arr",TObject::kSingleKey);
h1->Write("histo");
// Close connection to DB
delete f;

example of a session read data from SQL data base
=====================================================

// Open database again in read-only mode
TSQLFile* f = new TSQLFile(dbname, "open", username, userpass);
// Show list of keys
f->ls();
// Read stored object, again standard ROOT I/O
TH1* h1 = (TH1*) f->Get("histo");
if (h1!=0) { h1->SetDirectory(0); h1->Draw(); }
TObject* obj = f->Get("arr");
if (obj!=0) obj->Print("*");
// close connection to DB
delete f;

Known problems and open questions.
1) TTree is not supported by TSQLFile. There is independent development
of TTreeSQL, which allows to store trees directly in SQL database
2) TClonesArray is not tested, will be adjusted soon.
3) TDirectory cannot work. Hopefully, will (changes in ROOT basic I/O is required)
4) Streamer infos are not written to file, therefore schema evolution
is not yet supported. All eforts are done to enable this feature in
the near future

This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.

  Diffs between and
  Type of Diff should be a

Sort log by:

Subversion Admin
ViewVC Help
Powered by ViewVC 1.0.9