File indexing completed on 2025-01-18 10:12:25
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TSQLObjectData
0013 #define ROOT_TSQLObjectData
0014
0015 #include "TObject.h"
0016
0017 #include "TString.h"
0018
0019 class TObjArray;
0020 class TList;
0021 class TSQLClassInfo;
0022 class TSQLResult;
0023 class TSQLRow;
0024 class TSQLStatement;
0025
0026 class TSQLObjectInfo : public TObject {
0027
0028 public:
0029 TSQLObjectInfo();
0030 TSQLObjectInfo(Long64_t objid, const char *classname, Version_t version);
0031 ~TSQLObjectInfo() override;
0032
0033 Long64_t GetObjId() const { return fObjId; }
0034 const char *GetObjClassName() const { return fClassName.Data(); }
0035 Version_t GetObjVersion() const { return fVersion; }
0036
0037 protected:
0038 Long64_t fObjId;
0039 TString fClassName;
0040 Version_t fVersion;
0041
0042 ClassDefOverride(TSQLObjectInfo, 1)
0043 };
0044
0045
0046
0047 class TSQLObjectData : public TObject {
0048
0049 public:
0050 TSQLObjectData();
0051
0052 TSQLObjectData(TSQLClassInfo *sqlinfo, Long64_t objid, TSQLResult *classdata, TSQLRow *classrow,
0053 TSQLResult *blobdata, TSQLStatement *blobstmt);
0054
0055 ~TSQLObjectData() override;
0056
0057 Long64_t GetObjId() const { return fObjId; }
0058 TSQLClassInfo *GetInfo() const { return fInfo; }
0059
0060 Bool_t LocateColumn(const char *colname, Bool_t isblob = kFALSE);
0061 Bool_t IsBlobData() const { return fCurrentBlob || (fUnpack != nullptr); }
0062 void ShiftToNextValue();
0063
0064 void AddUnpack(const char *tname, const char *value);
0065 void AddUnpackInt(const char *tname, Int_t value);
0066
0067 const char *GetValue() const { return fLocatedValue; }
0068 const char *GetLocatedField() const { return fLocatedField; }
0069 const char *GetBlobPrefixName() const { return fBlobPrefixName; }
0070 const char *GetBlobTypeName() const { return fBlobTypeName; }
0071
0072 Bool_t VerifyDataType(const char *tname, Bool_t errormsg = kTRUE);
0073 Bool_t PrepareForRawData();
0074
0075 protected:
0076 Bool_t ExtractBlobValues();
0077 Bool_t ShiftBlobRow();
0078
0079 Int_t GetNumClassFields();
0080 const char *GetClassFieldName(Int_t n);
0081
0082 TSQLClassInfo *fInfo;
0083 Long64_t fObjId;
0084 Bool_t fOwner;
0085 TSQLResult *fClassData;
0086 TSQLResult *fBlobData;
0087 TSQLStatement *fBlobStmt;
0088 Int_t fLocatedColumn;
0089 TSQLRow *fClassRow;
0090 TSQLRow *fBlobRow;
0091 const char *fLocatedField;
0092 const char *fLocatedValue;
0093 Bool_t fCurrentBlob;
0094 const char *fBlobPrefixName;
0095 const char *fBlobTypeName;
0096 TObjArray *fUnpack;
0097
0098 ClassDefOverride(TSQLObjectData, 1)
0099 };
0100
0101
0102
0103
0104
0105
0106
0107
0108 class TSQLObjectDataPool : public TObject {
0109
0110 public:
0111 TSQLObjectDataPool();
0112 TSQLObjectDataPool(TSQLClassInfo *info, TSQLResult *data);
0113 ~TSQLObjectDataPool() override;
0114
0115 TSQLClassInfo *GetSqlInfo() const { return fInfo; }
0116 TSQLResult *GetClassData() const { return fClassData; }
0117 TSQLRow *GetObjectRow(Long64_t objid);
0118
0119 protected:
0120 TSQLClassInfo *fInfo;
0121 TSQLResult *fClassData;
0122 Bool_t fIsMoreRows;
0123 TList *fRowsPool;
0124
0125 ClassDefOverride(TSQLObjectDataPool, 1)
0126 };
0127
0128 #endif