StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StDbStoreInfo.hh
1 /***************************************************************************
2  *
3  * $Id: StDbStoreInfo.hh,v 1.1 2001/01/22 18:38:00 porter Exp $
4  *
5  * Author: R. Jeff Porter
6  ***************************************************************************
7  *
8  * Description: Simple integer array implementation of the database
9  * dataID fields. These are held during writes so that a
10  * many-row table or a multi-table write can be rolled back
11  * completely on failure at some point in the writing
12  *
13  ***************************************************************************
14  *
15  * $Log: StDbStoreInfo.hh,v $
16  * Revision 1.1 2001/01/22 18:38:00 porter
17  * Update of code needed in next year running. This update has little
18  * effect on the interface (only 1 method has been changed in the interface).
19  * Code also preserves backwards compatibility so that old versions of
20  * StDbLib can read new table structures.
21  * -Important features:
22  * a. more efficient low-level table structure (see StDbSql.cc)
23  * b. more flexible indexing for new systems (see StDbElememtIndex.cc)
24  * c. environment variable override KEYS for each database
25  * d. StMessage support & clock-time logging diagnostics
26  * -Cosmetic features
27  * e. hid stl behind interfaces (see new *Impl.* files) to again allow rootcint access
28  * f. removed codes that have been obsolete for awhile (e.g. db factories)
29  * & renamed some classes for clarity (e.g. tableQuery became StDataBaseI
30  * and mysqlAccessor became StDbSql)
31  *
32  *
33  **************************************************************************/
34 #ifndef STDBSTOREINFO_HH
35 #define STDBSTOREINFO_HH
36 
38 
39 protected:
40 
41  int * mdataIDs;
42  int mnumRows;
43  int mMaxRows;
44  // canRollBack logic:: true during writes, false after writes or with reads
45  bool mcanRollBack;
46 
47  void reSizeInternalStore();
48 
49 public:
50 
51  StDbStoreInfo();
52  ~StDbStoreInfo();
53 
54  int* getDataIDs(int& numRows);
55  void addWrittenRow(int dataID);
56 
57  void commit();
58  bool canRollBack();
59  bool hasData();
60 
61  // delete information
62  void resetStoreInfo();
63 
64 };
65 
66 inline void StDbStoreInfo::commit(){ mcanRollBack=false; }
67 inline bool StDbStoreInfo::canRollBack(){ return mcanRollBack; }
68 inline bool StDbStoreInfo::hasData() { return (bool) mnumRows; };
69 #endif
70 
71