Log of /trunk/io/sql/inc/TSQLFile.h
Parent Directory
Revision
34444 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Jul 16 02:17:39 2010 UTC (4 years, 6 months ago) by
pcanal
File length: 13026 byte(s)
Diff to
previous 23122
Avoid doing seeks on the physical file reprensation when it is not absolutely necessary
(i.e. it is not need if we are going to pick the data from our cache).
Introduce a SetOffset to change fOffset (i.e. the logical position in the file) without doing a lseek.
Introduce ReadBuffer(char * buf, Long64_t pos, Int_t len) to avoid the lseek when the data is in the cache.
See <http://savannah.cern.ch/bugs/?69845>
Revision
22419 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Mar 3 00:25:01 2008 UTC (6 years, 10 months ago) by
rdm
Original Path:
trunk/sql/inc/TSQLFile.h
File length: 12951 byte(s)
Diff to
previous 20882
From Andrew Savchenko:
ROOT can not be compiled with gcc-4.3.
Some ROOT source files doesn't contain required #include directives,
for example, they use strlen(), but #include <string.h> is missed or
malloc() is used and #include <stdlib.h> is missed.
Earlier versions of gcc allowed some headers to be included implicitly,
but issued a warning (-Wimplicit-function-declaration). Newer one,
gcc-4.3 denies such silly behaviour: all required headers must be explicitly
included.
Attached patch fixes this. Also it fixes another issue, which disallows
ROOT to compile under gcc-4.3: C functions don't belong to namespace std,
so expressions like std::memcpy() are no longer valid and plain memcpy()
should be used instead.
Revision
15572 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Jun 27 14:36:28 2006 UTC (8 years, 6 months ago) by
brun
Original Path:
trunk/sql/inc/TSQLFile.h
File length: 12975 byte(s)
Diff to
previous 15512
-Rename class TFilePrefetch -> TFileCacheRead
-Rename class TTreeFilePrefetch -> TTreeCache
-Add new class TFileCacheWrite that implements automatic caching
when writing network files. This class replaces the previous class TCache.
-old TCache class deleted.
-TFileCacheRead can read buffers from the wite cache in TFileCacheWrite.
-As a result TFile::UseCache is obsolete. The function is kept for
backward compatibility.
-Remove references to TCache from TXMLFile, TSQLFile, TwebFile, TNetFile
-remove pointer TFile::fCache
-Add pointers TFile::fCacheRead and TFile::fCacheWrite
-Remove members fMaxCacheSize and fPageSize from TChain
NOTE that it is recommended to
rm -f base/src/*.d base/src/*.o
rm -f net/src/*.d net/src/*.o
rm -f tree/src/*.d tree/src/*.o
Revision
15512 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Jun 22 08:21:23 2006 UTC (8 years, 7 months ago) by
brun
Original Path:
trunk/sql/inc/TSQLFile.h
File length: 12995 byte(s)
Diff to
previous 15125
From Sergey Linev:
1. Implementation of TDirectory I/O for TSQLFile and TXMLFile
2. In TSQLFile identifier length is now controled.
Important for Oracle, where table or column name cannot be more than 32 symbols.
3. Adding usage of TSQLStatement class where possible.
4. Small performance improvment.
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/TSQLFile.h
File length: 11993 byte(s)
Diff to
previous 13524
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
13383 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Nov 28 23:22:31 2005 UTC (9 years, 1 month ago) by
pcanal
Original Path:
trunk/sql/inc/TSQLFile.h
File length: 11302 byte(s)
Diff to
previous 13349
From Sergei Linev:
I made following modification:
1. Usage of table indexes. By default, they created only for basic tables: KeysTable and ObjectsTable.
It is possible to configure TSQLFile to create indexes also for other type of tables or disable indexes at all.
2. Use of transaction. Now by default this option on and protect storage of object data to datatables.
For some types of MySQL tables transaction are not supported, therefore I include in configurations
possibility to setup type of table which should be used.
3. Configurations. For all kind of configuration I create small table.
Configurations can be changed only when TSQLFile is created with option "CREATE" or "RECREATE".
In that case configurations can be changed until first write operation.
4. Locking. I did not use "native" database locking mechnism while they are very different in MySQL and Oracle and
may differ also in other SQL database. I put in Configuration table one flag, which says if database is already
opened for writing by other TSQLFile instance and prevent other TSQLFile to have write access.
For emergency cases one can use "BREAKLOCK" option in TSQLFile constructor to ignore that locking.
This is not real locking and any other user with normal sql queries can disturb tables data, but I do not see
now other solution, which may work for different databases. May be you know better solutions?
Revision
13349 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Nov 24 16:57:23 2005 UTC (9 years, 2 months ago) by
pcanal
Original Path:
trunk/sql/inc/TSQLFile.h
File length: 9667 byte(s)
Diff to
previous 13317
From Sergei Linev:
I introduce new function TSQLFile::MakeSelectQuery.
It produces SQL query, which can be used outside ROOT to get all objects data (including data from parent classes)
with single SELECT statement. As result, one table with all data is produced.
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/TSQLFile.h
File length: 9469 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/TSQLFile.h
File length: 8912 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.