Logo ROOT   6.16/01
Reference Guide
TSQLObjectData.h
Go to the documentation of this file.
1// @(#)root/sql:$Id$
2// Author: Sergey Linev 20/11/2005
3
4/*************************************************************************
5 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TSQLObjectData
13#define ROOT_TSQLObjectData
14
15#include "TObject.h"
16
17#include "TString.h"
18
19class TObjArray;
20class TList;
21class TSQLClassInfo;
22class TSQLResult;
23class TSQLRow;
24class TSQLStatement;
25
26class TSQLObjectInfo : public TObject {
27
28public:
30 TSQLObjectInfo(Long64_t objid, const char *classname, Version_t version);
31 virtual ~TSQLObjectInfo();
32
33 Long64_t GetObjId() const { return fObjId; }
34 const char *GetObjClassName() const { return fClassName.Data(); }
35 Version_t GetObjVersion() const { return fVersion; }
36
37protected:
41
42 ClassDef(TSQLObjectInfo, 1) // Info (classname, version) about object in database
43};
44
45//=======================================================================
46
47class TSQLObjectData : public TObject {
48
49public:
51
52 TSQLObjectData(TSQLClassInfo *sqlinfo, Long64_t objid, TSQLResult *classdata, TSQLRow *classrow,
53 TSQLResult *blobdata, TSQLStatement *blobstmt);
54
55 virtual ~TSQLObjectData();
56
57 Long64_t GetObjId() const { return fObjId; }
58 TSQLClassInfo *GetInfo() const { return fInfo; }
59
60 Bool_t LocateColumn(const char *colname, Bool_t isblob = kFALSE);
61 Bool_t IsBlobData() const { return fCurrentBlob || (fUnpack != 0); }
62 void ShiftToNextValue();
63
64 void AddUnpack(const char *tname, const char *value);
65 void AddUnpackInt(const char *tname, Int_t value);
66
67 const char *GetValue() const { return fLocatedValue; }
68 const char *GetLocatedField() const { return fLocatedField; }
69 const char *GetBlobPrefixName() const { return fBlobPrefixName; }
70 const char *GetBlobTypeName() const { return fBlobTypeName; }
71
72 Bool_t VerifyDataType(const char *tname, Bool_t errormsg = kTRUE);
74
75protected:
78
80 const char *GetClassFieldName(Int_t n);
81
91 const char *fLocatedField; //!
92 const char *fLocatedValue; //!
94 const char *fBlobPrefixName; ///<! name prefix in current blob row
95 const char *fBlobTypeName; ///<! name type (without prefix) in current blob row
97
98 ClassDef(TSQLObjectData, 1) // Keeps the data requested from the SQL server for an object.
99};
100
101// ======================================================================
102/**
103\class TSQLObjectDataPool
104\ingroup IO
105XML object keeper class
106*/
107
109
110public:
113 virtual ~TSQLObjectDataPool();
114
115 TSQLClassInfo *GetSqlInfo() const { return fInfo; }
116 TSQLResult *GetClassData() const { return fClassData; }
118
119protected:
120 TSQLClassInfo *fInfo; ///<! classinfo, for which pool is created
121 TSQLResult *fClassData; ///<! results with request to selected table
122 Bool_t fIsMoreRows; ///<! indicates if class data has not yet read rows
123 TList *fRowsPool; ///<! pool of extrcted, but didnot used rows
124
125 ClassDef(TSQLObjectDataPool, 1) // XML object keeper class
126};
127
128#endif
int Int_t
Definition: RtypesCore.h:41
short Version_t
Definition: RtypesCore.h:61
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
long long Long64_t
Definition: RtypesCore.h:69
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassDef(name, id)
Definition: Rtypes.h:324
A doubly linked list.
Definition: TList.h:44
An array of TObjects.
Definition: TObjArray.h:37
Mother of all ROOT objects.
Definition: TObject.h:37
Contains information about tables specific to one class and version.
Definition: TSQLClassInfo.h:42
XML object keeper class.
TSQLRow * GetObjectRow(Long64_t objid)
Returns single sql row with object data for that class.
virtual ~TSQLObjectDataPool()
Destructor of TSQLObjectDataPool class Deletes not used rows and class data table.
TSQLResult * fClassData
! results with request to selected table
TList * fRowsPool
! pool of extrcted, but didnot used rows
TSQLResult * GetClassData() const
TSQLClassInfo * GetSqlInfo() const
Bool_t fIsMoreRows
! indicates if class data has not yet read rows
TSQLClassInfo * fInfo
! classinfo, for which pool is created
TSQLObjectData is used in TBufferSQL2 class in reading procedure.
Bool_t LocateColumn(const char *colname, Bool_t isblob=kFALSE)
locate column of that name in results
const char * GetLocatedField() const
TSQLStatement * fBlobStmt
TSQLObjectData()
default contrsuctor
Long64_t GetObjId() const
const char * fBlobPrefixName
! name prefix in current blob row
Bool_t ExtractBlobValues()
extract from curent blob row value and names identifiers
void ShiftToNextValue()
shift to next column or next row in blob data
Bool_t IsBlobData() const
virtual ~TSQLObjectData()
destructor of TSQLObjectData object
const char * GetClassFieldName(Int_t n)
get name of class table column
const char * fLocatedValue
TSQLRow * fClassRow
const char * GetValue() const
TSQLClassInfo * GetInfo() const
Bool_t ShiftBlobRow()
shift cursor to next blob value
void AddUnpack(const char *tname, const char *value)
add emulated data this used to place version or TObject raw data, read from normal tables
const char * GetBlobPrefixName() const
Int_t GetNumClassFields()
return number of columns in class table result
TSQLRow * fBlobRow
const char * GetBlobTypeName() const
Bool_t PrepareForRawData()
prepare to read data from raw table
TObjArray * fUnpack
Bool_t VerifyDataType(const char *tname, Bool_t errormsg=kTRUE)
checks if data type corresponds to that stored in raw table
TSQLResult * fClassData
const char * fBlobTypeName
! name type (without prefix) in current blob row
void AddUnpackInt(const char *tname, Int_t value)
emulate integer value in raw data
const char * fLocatedField
TSQLClassInfo * fInfo
TSQLResult * fBlobData
Info (classname, version) about object in database.
Version_t GetObjVersion() const
const char * GetObjClassName() const
Long64_t GetObjId() const
Version_t fVersion
TString fClassName
virtual ~TSQLObjectInfo()
Basic string class.
Definition: TString.h:131
const char * Data() const
Definition: TString.h:364
const Int_t n
Definition: legend1.C:16