00001 /*************************************************************************** 00002 * 00003 * $Id: StDbStoreInfo.hh,v 1.1 2001/01/22 18:38:00 porter Exp $ 00004 * 00005 * Author: R. Jeff Porter 00006 *************************************************************************** 00007 * 00008 * Description: Simple integer array implementation of the database 00009 * dataID fields. These are held during writes so that a 00010 * many-row table or a multi-table write can be rolled back 00011 * completely on failure at some point in the writing 00012 * 00013 *************************************************************************** 00014 * 00015 * $Log: StDbStoreInfo.hh,v $ 00016 * Revision 1.1 2001/01/22 18:38:00 porter 00017 * Update of code needed in next year running. This update has little 00018 * effect on the interface (only 1 method has been changed in the interface). 00019 * Code also preserves backwards compatibility so that old versions of 00020 * StDbLib can read new table structures. 00021 * -Important features: 00022 * a. more efficient low-level table structure (see StDbSql.cc) 00023 * b. more flexible indexing for new systems (see StDbElememtIndex.cc) 00024 * c. environment variable override KEYS for each database 00025 * d. StMessage support & clock-time logging diagnostics 00026 * -Cosmetic features 00027 * e. hid stl behind interfaces (see new *Impl.* files) to again allow rootcint access 00028 * f. removed codes that have been obsolete for awhile (e.g. db factories) 00029 * & renamed some classes for clarity (e.g. tableQuery became StDataBaseI 00030 * and mysqlAccessor became StDbSql) 00031 * 00032 * 00033 **************************************************************************/ 00034 #ifndef STDBSTOREINFO_HH 00035 #define STDBSTOREINFO_HH 00036 00037 class StDbStoreInfo { 00038 00039 protected: 00040 00041 int * mdataIDs; 00042 int mnumRows; 00043 int mMaxRows; 00044 // canRollBack logic:: true during writes, false after writes or with reads 00045 bool mcanRollBack; 00046 00047 void reSizeInternalStore(); 00048 00049 public: 00050 00051 StDbStoreInfo(); 00052 ~StDbStoreInfo(); 00053 00054 int* getDataIDs(int& numRows); 00055 void addWrittenRow(int dataID); 00056 00057 void commit(); 00058 bool canRollBack(); 00059 bool hasData(); 00060 00061 // delete information 00062 void resetStoreInfo(); 00063 00064 }; 00065 00066 inline void StDbStoreInfo::commit(){ mcanRollBack=false; } 00067 inline bool StDbStoreInfo::canRollBack(){ return mcanRollBack; } 00068 inline bool StDbStoreInfo::hasData() { return (bool) mnumRows; }; 00069 #endif 00070 00071