Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

StDataBaseI.hh

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * 00003 * $Id: StDataBaseI.hh,v 1.3 2003/01/10 04:19:19 porter Exp $ 00004 * 00005 * Author: R. Jeff Porter 00006 *************************************************************************** 00007 * 00008 * Description: Abstract class for Star specific SQL queries 00009 * 00010 *************************************************************************** 00011 * 00012 * $Log: StDataBaseI.hh,v $ 00013 * Revision 1.3 2003/01/10 04:19:19 porter 00014 * added feature of getting timestamp list (but no data) for a table. 00015 * fixed 2 features sometimes used in online in query-by-whereclause. 00016 * removed a stray 'cout' in a routine that is rarely accessed 00017 * 00018 * Revision 1.2 2001/10/26 20:59:46 porter 00019 * fixed new endtime flag from previous checkin. made StDataBaseI available 00020 * at root-cli. 00021 * 00022 * Revision 1.1 2001/01/22 18:37:50 porter 00023 * Update of code needed in next year running. This update has little 00024 * effect on the interface (only 1 method has been changed in the interface). 00025 * Code also preserves backwards compatibility so that old versions of 00026 * StDbLib can read new table structures. 00027 * -Important features: 00028 * a. more efficient low-level table structure (see StDbSql.cc) 00029 * b. more flexible indexing for new systems (see StDbElememtIndex.cc) 00030 * c. environment variable override KEYS for each database 00031 * d. StMessage support & clock-time logging diagnostics 00032 * -Cosmetic features 00033 * e. hid stl behind interfaces (see new *Impl.* files) to again allow rootcint access 00034 * f. removed codes that have been obsolete for awhile (e.g. db factories) 00035 * & renamed some classes for clarity (e.g. tableQuery became StDataBaseI 00036 * and mysqlAccessor became StDbSql) 00037 * 00038 * 00039 **************************************************************************/ 00040 #ifndef STDATABASEI_HH 00041 #define STDATABASEI_HH 00042 00043 class StDbNode; 00044 class StDbTable; 00045 class StDbConfigNode; 00046 class StDbElementIndex; 00047 00048 #include "StDbDefs.hh" 00049 00050 #ifdef __ROOT__ 00051 #include "TROOT.h" 00052 #endif 00053 00054 class StDataBaseI { 00055 00056 protected: 00057 // enumerated database specification 00058 StDbType mdbType; 00059 StDbDomain mdbDomain; 00060 00061 // 00062 // dbName = "typeName_domainName" or "typeName" if domainName=Star 00063 // typeName => mapped from dbType 00064 // domainName => mapped from dbDomain 00065 // 00066 00067 char* mdbName; 00068 char* mtypeName; 00069 char* mdomainName; 00070 00071 StDbStoreType mdbStore; // for future evolution of changes in internal 00072 // storage structure & different SQL 00073 public: 00074 00075 StDataBaseI(); 00076 StDataBaseI(StDbType type, StDbDomain domain); 00077 StDataBaseI(const char* typeName, const char* domainName); 00078 00079 virtual ~StDataBaseI(); 00080 00081 virtual void setDataBase(StDbType type, StDbDomain domain); 00082 virtual void setDataBase(const char* typeName, const char* domainName); 00083 virtual void setDataBase(const char* dbName); 00084 00085 virtual void setDbType(StDbType type); 00086 virtual void setDbDomain(StDbDomain domain); 00087 virtual StDbType getDbType() const ; 00088 virtual StDbDomain getDbDomain() const ; 00089 00090 virtual void setDbName(const char* dbName); 00091 virtual void setTypeName(const char* typeName); 00092 virtual void setDomainName(const char* domainName); 00093 virtual char* getDbName() const ; 00094 virtual char* getTypeName() const ; 00095 virtual char* getDomainName() const ; 00096 virtual char* printDbName(); 00097 virtual char* printTypeName(); 00098 virtual char* printDomainName(); 00099 virtual bool checkDbName(const char* name); 00100 virtual bool checkDbType(const char* type); 00101 virtual bool checkDbDomain(const char* domain); 00102 00103 virtual StDbStoreType getDbStoreType() const; 00104 virtual void setDbStoreType(StDbStoreType type); 00105 00106 // DB-Implementation Specific methods 00107 virtual void use() = 0; 00108 virtual void close() = 0; 00109 virtual int QueryDb(StDbConfigNode* node) = 0; 00110 virtual int QueryDb(StDbNode* node) = 0; 00111 virtual int QueryDb(StDbTable* table, unsigned int reqTime) = 0; 00112 virtual int QueryDb(StDbTable* table, const char* whereClause) = 0; 00113 virtual unsigned int* QueryDbTimes(StDbTable* table, 00114 const char* whereClause, int opt=0) = 0; 00115 virtual int QueryDbFunction(StDbTable* table, 00116 const char* whereClause, char* funcName) = 0; 00117 virtual int QueryDescriptor(StDbTable* table) = 0; 00118 virtual int WriteDb(StDbTable* table, unsigned int storeTime) = 0; 00119 virtual int WriteDb(StDbConfigNode* node, int parentID, int& configID) = 0; 00120 00121 virtual int storeConfigNode(StDbConfigNode* node) = 0; 00122 virtual int storeTableNode(StDbTable* table) = 0; 00123 virtual bool insertNodeRelation(int configID, int parent, int child) = 0; 00124 virtual bool rollBack(StDbNode* node) = 0; 00125 virtual bool rollBack(StDbTable* table) = 0; 00126 00127 virtual unsigned int getUnixTime(const char* time) = 0; 00128 virtual char* getDateTime(unsigned int time) = 0; 00129 virtual int* selectElements(const char* elementName, 00130 StDbElementIndex* inval, 00131 int& numElements) = 0; 00132 #ifdef __ROOT__ 00133 ClassDef(StDataBaseI,0) 00134 #endif 00135 00136 }; 00137 00138 inline void StDataBaseI::setDbType(StDbType type) {mdbType = type; }; 00139 inline void StDataBaseI::setDbDomain(StDbDomain domain) {mdbDomain = domain; } 00140 inline StDbType StDataBaseI::getDbType() const { return mdbType; }; 00141 inline StDbDomain StDataBaseI::getDbDomain() const { return mdbDomain; }; 00142 inline StDbStoreType StDataBaseI::getDbStoreType() const {return mdbStore;}; 00143 inline void StDataBaseI::setDbStoreType(StDbStoreType type) {mdbStore=type; }; 00144 00145 #endif

Generated on Thu Aug 24 14:45:25 2006 for Doxygen by doxygen 1.3.7