116 #ifndef STAR_StDbBroker
117 #define STAR_StDbBroker
120 #include "dbNodeArray.h"
121 #include "dbConfig.h"
130 #include "St_tableDescriptor.h"
146 enum EColumnType {kNAN, kFloat, kInt, kLong, kShort, kDouble, kUInt
147 ,kULong, kUShort, kUChar, kChar };
153 char fColumnName[32];
154 unsigned int fIndexArray[3];
155 unsigned int fOffset;
157 unsigned int fTypeSize;
158 unsigned int fDimensions;
166 Char_t * m_structName = 0;
167 Char_t * m_tableName = 0;
168 UInt_t m_sizeOfStruct = 0;
169 UInt_t m_nElements = 0;
174 Int_t m_BeginDate = 0;
175 Int_t m_BeginTime = 0;
179 UInt_t m_beginTimeStamp = 0;
180 UInt_t m_endTimeStamp = 0;
181 UInt_t m_requestTimeStamp = 0;
183 Int_t m_runNumber = 0;
185 char* m_tableVersion = 0;
186 char* m_database = 0;
187 char* m_ParentType = 0;
194 unsigned int m_prodTime = 0;
195 std::map<std::pair<char*,char*>,
unsigned int> m_prodTimeOverride;
200 Bool_t m_isZombie =
false;
202 void makeDateTime(
const char* dateTime, Int_t & iDate, Int_t & iTime);
212 void SetTableFlavor(
const char* flavor,
int tabID,
int parID);
213 void * Use(
int tabID,
int parID);
216 char **GetComments(
St_Table *parentTable);
222 Int_t WriteToDb(
void* pArray,
int tabID);
228 Int_t WriteToDb(
void* pArray,
const char* fullPath,
int* idList=0);
230 StDbTable* findTable(
const char* databaseName);
232 UInt_t GetNRows() {
return m_nRows; }
233 Int_t GetBeginDate() {
return m_BeginDate; }
234 Int_t GetBeginTime() {
return m_BeginTime; }
235 const char *GetFlavor();
236 Int_t GetEndDate() {
return m_EndDate; }
237 Int_t GetEndTime() {
return m_EndTime; }
238 UInt_t GetRequestTimeStamp() {
return m_requestTimeStamp; }
239 UInt_t GetBeginTimeStamp() {
return m_beginTimeStamp; }
240 UInt_t GetEndTimeStamp() {
return m_endTimeStamp; }
241 UInt_t GetProdTime() {
return m_prodTime;}
242 Bool_t IsZombie() {
return m_isZombie; }
247 void loadOldDescriptor(){};
248 static const Char_t * GetTypeName( EColumnType type) {
251 case kFloat:
return "float";
252 case kInt:
return "int";
253 case kLong:
return "long";
254 case kShort:
return "short";
255 case kDouble:
return "double";
256 case kChar:
return "char";
258 case kUInt:
return "int";
259 case kULong:
return "long";
260 case kUShort:
return "short";
261 case kUChar:
return "char";
263 case kNAN:
return "";
268 void SetDateTime(Int_t date,Int_t time);
269 void SetRunNumber(Int_t runNumber) {m_runNumber=runNumber;};
270 void SetDictionary(UInt_t nElements, Descriptor *D)
271 {m_nElements=nElements; mdescriptor = D;}
272 void SetDictionary(Descriptor *D)
273 {
if (D) { mdescriptor = D;m_nElements=D->NumberOfColumns();}}
274 void SetTableName(
const Char_t *table_name)
275 {
if(m_tableName)
delete [] m_tableName;
276 m_tableName=
new char[strlen(table_name)+1];
277 strcpy(m_tableName,table_name);};
278 void SetStructName(
const Char_t *struct_name)
279 {
if(m_structName)
delete [] m_structName;
280 m_structName=
new char[strlen(struct_name)+1];
281 strcpy(m_structName,struct_name);};
282 void SetVersionName(
const char *version)
283 {
if(m_tableVersion)
delete [] m_tableVersion;
284 m_tableVersion=
new char[strlen(version)+1];
285 strcpy(m_tableVersion,version);}
286 void SetDataBaseName(
const char *dbName)
287 {
if(m_database)
delete [] m_database;
288 m_database=
new char[strlen(dbName)+1];
289 strcpy(m_database,dbName);}
291 void SetStructSize(UInt_t size) {m_sizeOfStruct=size; };
292 void SetNRows(UInt_t nRows) {m_nRows = nRows; }
293 void SetBeginDate(Int_t BeginDate) {m_BeginDate = BeginDate;}
294 void SetBeginTime(Int_t BeginTime) {m_BeginTime = BeginTime;}
295 void SetEndDate(Int_t EndDate) {m_EndDate = EndDate; }
296 void SetEndTime(Int_t EndTime) {m_EndTime = EndTime; }
297 void SetRequestTimeStamp(UInt_t utime) {m_requestTimeStamp = utime; }
298 void SetBeginTimeStamp(UInt_t utime) {m_beginTimeStamp = utime; }
299 void SetEndTimeStamp(UInt_t utime) {m_endTimeStamp = utime; }
300 void SetProdTime(UInt_t ptime);
301 void AddProdTimeOverride(UInt_t ptime,
char*
dbType = 0,
char*
dbDomain = 0);
302 void SetFlavor(
const char* flavor);
303 void SetZombie(Bool_t zombie) { m_isZombie=
true; }
305 void addBlacklistedDomain(
const char* domainName);
307 static int DbInit(
const char *);
308 void setVerbose(
int isVerbose) { m_isVerbose = isVerbose; }
309 void printStatistics();
310 void CloseAllConnections();
314 dbConfig_st* InitConfig(
const char* configName,
int& numRows,
char* versionName=0);
331 extern "C" void *DbUse(
unsigned int*,
339 extern "C" void *DbRead(
unsigned int*,
349 extern "C" int DbInit(
const char *);