StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StDbTable.cc
1 /***************************************************************************
2  *
3  * $Id: StDbTable.cc,v 1.45 2016/05/25 20:40:01 dmitry Exp $
4  *
5  * Author: R. Jeff Porter
6  ***************************************************************************
7  *
8  * Description: Class that holds data, descriptor, & db-address
9  * & performs streamer of db-data into data-memory
10  *
11  ***************************************************************************
12  *
13  * $Log: StDbTable.cc,v $
14  * Revision 1.45 2016/05/25 20:40:01 dmitry
15  * coverity - reverse_inull
16  *
17  * Revision 1.44 2015/06/23 20:21:12 dmitry
18  * char type: null-terminator assignment fixed
19  *
20  * Revision 1.43 2012/12/12 21:59:19 fisyak
21  * Add check for HAVE_CLOCK_GETTIME flag and for APPLE
22  *
23  * Revision 1.42 2009/11/10 20:24:45 fisyak
24  * Use SafeDelete
25  *
26  * Revision 1.41 2009/09/10 18:06:08 dmitry
27  * struct alignment fix, does not rely on fixed 4 byte cap anymore - runtime align calculation is now in use
28  *
29  * Revision 1.40 2007/08/20 18:21:30 deph
30  * New Version of Load Balancer
31  *
32  * Revision 1.39 2007/05/16 22:48:10 deph
33  * Replaced cerr with LOG_ERROR <<endm; for logger
34  *
35  * Revision 1.38 2005/09/07 22:03:04 deph
36  * update to correct padding issue for pacted tables
37  *
38  * Revision 1.37 2004/01/15 00:02:25 fisyak
39  * Replace ostringstream => StString, add option for alpha
40  *
41  * Revision 1.36 2003/09/16 22:44:17 porter
42  * got rid of all ostrstream objects; replaced with StString+string.
43  * modified rules.make and added file stdb_streams.h for standalone compilation
44  *
45  * Revision 1.35 2003/09/02 17:57:49 perev
46  * gcc 3.2 updates + WarnOff
47  *
48  * Revision 1.34 2003/04/11 22:47:36 porter
49  * Added a fast multi-row write model specifically needed by the daqEventTag
50  * writer. Speed increased from about 100Hz to ~3000Hz. It is only invoked if
51  * the table is marked as Non-Indexed (daqTags & scalers). For non-indexed tables
52  * which include binary stored data (we don't have any yet), the fast writer has
53  * to invoke a slower buffer so that the rates are a bit slower (~500Hz at 50 rows/insert).
54  *
55  * Revision 1.33 2003/02/12 22:12:45 porter
56  * moved warning message about null columns (checked in 2 days ago) from the
57  * depths of the mysql coding into the StDbTable code. This suppresses confusing
58  * warnings from tables that have had elements removed but their storage columns
59  * still exist in the database.
60  *
61  * Revision 1.32 2003/01/10 04:19:20 porter
62  * added feature of getting timestamp list (but no data) for a table.
63  * fixed 2 features sometimes used in online in query-by-whereclause.
64  * removed a stray 'cout' in a routine that is rarely accessed
65  *
66  * Revision 1.31 2002/01/30 15:40:48 porter
67  * changed limits on flavor tag & made defaults retrieving more readable
68  *
69  * Revision 1.30 2001/12/21 04:54:46 porter
70  * sped up table definition for emc and changed some ostrstream usage for
71  * insure tests
72  *
73  * Revision 1.29 2001/10/26 20:59:46 porter
74  * fixed new endtime flag from previous checkin. made StDataBaseI available
75  * at root-cli.
76  *
77  * Revision 1.28 2001/10/24 04:05:20 porter
78  * added long long type to I/O and got rid of obsolete dataIndex table
79  *
80  * Revision 1.27 2001/08/02 17:37:20 porter
81  * fixed problem in fetch by where-clause used in online in StDbSql.cc.
82  * also got rid of warning comparing unsigned int to int.
83  *
84  * Revision 1.26 2001/07/13 22:53:26 porter
85  * last night's schema-fix was in a switch-case ... I missed one & put it in today
86  *
87  * Revision 1.25 2001/07/13 02:28:15 porter
88  * fix problem in schema evolution for array size changes
89  *
90  * Revision 1.24 2001/04/23 19:24:32 porter
91  * fixed row limit & initial buffer contents for query by where clause
92  *
93  * Revision 1.23 2001/02/09 23:06:25 porter
94  * replaced ostrstream into a buffer with ostrstream creating the
95  * buffer. The former somehow clashed on Solaris with CC5 iostream (current .dev)
96  *
97  * Revision 1.22 2001/02/08 23:23:56 porter
98  * fixed initialization of schemaID in table & fixed some warnings when
99  * compiled with NODEBUG
100  *
101  * Revision 1.21 2001/01/22 18:38:00 porter
102  * Update of code needed in next year running. This update has little
103  * effect on the interface (only 1 method has been changed in the interface).
104  * Code also preserves backwards compatibility so that old versions of
105  * StDbLib can read new table structures.
106  * -Important features:
107  * a. more efficient low-level table structure (see StDbSql.cc)
108  * b. more flexible indexing for new systems (see StDbElememtIndex.cc)
109  * c. environment variable override KEYS for each database
110  * d. StMessage support & clock-time logging diagnostics
111  * -Cosmetic features
112  * e. hid stl behind interfaces (see new *Impl.* files) to again allow rootcint access
113  * f. removed codes that have been obsolete for awhile (e.g. db factories)
114  * & renamed some classes for clarity (e.g. tableQuery became StDataBaseI
115  * and mysqlAccessor became StDbSql)
116  *
117  * Revision 1.20 2000/08/15 22:51:52 porter
118  * Added Root2DB class from Masashi Kaneta
119  * + made code more robust against requesting data from non-existent databases
120  *
121  * Revision 1.19 2000/06/30 01:57:02 porter
122  * fixed a delete bug & small memory leak found by Akio via Insure++ ,
123  * updated SetTable() method for containing idList, corrected enumeration
124  * map to rhic domain for Conditions_rhic database
125  *
126  * Revision 1.18 2000/06/02 13:37:37 porter
127  * built up list of minor changes:
128  * - made buffer more robust for certain null inputs
129  * - fixed small leak in StDbTables & restructure call to createMemory
130  * - added dbRhic as a database domain in StDbDefs
131  * - added setUser() in StDbManager
132  * - added more diagnostic printouts in mysqlAccessor.cc
133  *
134  * Revision 1.17 2000/05/10 21:39:02 porter
135  * fixed delete[] bug in reading from table where input schema includes fields that
136  * are not in the database by checking buffer status for reads
137  *
138  * Revision 1.16 2000/04/25 18:26:03 porter
139  * added flavor & production time as settable query fields in
140  * table &/or node. Associated SQL updated in mysqlAccessor.
141  * Flavor key supports "+" as an OR symbol.
142  *
143  * Revision 1.15 2000/03/28 17:03:19 porter
144  * Several upgrades:
145  * 1. configuration by timestamp for Conditions
146  * 2. query by whereClause made more systematic
147  * 3. conflict between db-stored comments & number lists resolved
148  * 4. ensure endtime is correct for certain query falures
149  * 5. dbstl.h->handles ObjectSpace & RogueWave difference (Online vs Offline)
150  *
151  * Revision 1.14 2000/02/15 20:27:44 porter
152  * Some updates to writing to the database(s) via an ensemble (should
153  * not affect read methods & haven't in my tests.
154  * - closeAllConnections(node) & closeConnection(table) method to mgr.
155  * - 'NullEntry' version to write, with setStoreMode in table;
156  * - updated both StDbTable's & StDbTableDescriptor's copy-constructor
157  *
158  * Revision 1.13 2000/01/27 05:54:34 porter
159  * Updated for compiling on CC5 + HPUX-aCC + KCC (when flags are reset)
160  * Fixed reConnect()+transaction model mismatch
161  * added some in-code comments
162  *
163  * Revision 1.12 2000/01/19 20:20:07 porter
164  * - finished transaction model needed by online
165  * - fixed CC5 compile problem in StDbNodeInfo.cc
166  * - replace TableIter class by StDbTableIter to prevent name problems
167  *
168  * Revision 1.11 2000/01/10 20:37:54 porter
169  * expanded functionality based on planned additions or feedback from Online work.
170  * update includes:
171  * 1. basis for real transaction model with roll-back
172  * 2. limited SQL access via the manager for run-log & tagDb
173  * 3. balance obtained between enumerated & string access to databases
174  * 4. 3-levels of diagnostic output: Quiet, Normal, Verbose
175  * 5. restructured Node model for better XML support
176  *
177  * Revision 1.10 1999/12/07 21:25:25 porter
178  * some fixes for linux warnings
179  *
180  * Revision 1.9 1999/12/03 19:01:59 porter
181  * modified descriptor to accept tableDescriptor once this St_base object
182  * has been updated to have longer name lengths.
183  *
184  * Revision 1.8 1999/11/29 21:40:08 fisyak
185  * Add cast to HP
186  *
187  * Revision 1.7 1999/11/19 21:58:06 porter
188  * added method to return "malloc'd" version of table instead of new
189  * so that delete of St_Table class i done correctly
190  *
191  * $Log: StDbTable.cc,v $
192  * Revision 1.45 2016/05/25 20:40:01 dmitry
193  * coverity - reverse_inull
194  *
195  * Revision 1.44 2015/06/23 20:21:12 dmitry
196  * char type: null-terminator assignment fixed
197  *
198  * Revision 1.43 2012/12/12 21:59:19 fisyak
199  * Add check for HAVE_CLOCK_GETTIME flag and for APPLE
200  *
201  * Revision 1.42 2009/11/10 20:24:45 fisyak
202  * Use SafeDelete
203  *
204  * Revision 1.41 2009/09/10 18:06:08 dmitry
205  * struct alignment fix, does not rely on fixed 4 byte cap anymore - runtime align calculation is now in use
206  *
207  * Revision 1.40 2007/08/20 18:21:30 deph
208  * New Version of Load Balancer
209  *
210  * Revision 1.39 2007/05/16 22:48:10 deph
211  * Replaced cerr with LOG_ERROR <<endm; for logger
212  *
213  * Revision 1.38 2005/09/07 22:03:04 deph
214  * update to correct padding issue for pacted tables
215  *
216  * Revision 1.37 2004/01/15 00:02:25 fisyak
217  * Replace ostringstream => StString, add option for alpha
218  *
219  * Revision 1.36 2003/09/16 22:44:17 porter
220  * got rid of all ostrstream objects; replaced with StString+string.
221  * modified rules.make and added file stdb_streams.h for standalone compilation
222  *
223  * Revision 1.35 2003/09/02 17:57:49 perev
224  * gcc 3.2 updates + WarnOff
225  *
226  * Revision 1.34 2003/04/11 22:47:36 porter
227  * Added a fast multi-row write model specifically needed by the daqEventTag
228  * writer. Speed increased from about 100Hz to ~3000Hz. It is only invoked if
229  * the table is marked as Non-Indexed (daqTags & scalers). For non-indexed tables
230  * which include binary stored data (we don't have any yet), the fast writer has
231  * to invoke a slower buffer so that the rates are a bit slower (~500Hz at 50 rows/insert).
232  *
233  * Revision 1.33 2003/02/12 22:12:45 porter
234  * moved warning message about null columns (checked in 2 days ago) from the
235  * depths of the mysql coding into the StDbTable code. This suppresses confusing
236  * warnings from tables that have had elements removed but their storage columns
237  * still exist in the database.
238  *
239  * Revision 1.32 2003/01/10 04:19:20 porter
240  * added feature of getting timestamp list (but no data) for a table.
241  * fixed 2 features sometimes used in online in query-by-whereclause.
242  * removed a stray 'cout' in a routine that is rarely accessed
243  *
244  * Revision 1.31 2002/01/30 15:40:48 porter
245  * changed limits on flavor tag & made defaults retrieving more readable
246  *
247  * Revision 1.30 2001/12/21 04:54:46 porter
248  * sped up table definition for emc and changed some ostrstream usage for
249  * insure tests
250  *
251  * Revision 1.29 2001/10/26 20:59:46 porter
252  * fixed new endtime flag from previous checkin. made StDataBaseI available
253  * at root-cli.
254  *
255  * Revision 1.28 2001/10/24 04:05:20 porter
256  * added long long type to I/O and got rid of obsolete dataIndex table
257  *
258  * Revision 1.27 2001/08/02 17:37:20 porter
259  * fixed problem in fetch by where-clause used in online in StDbSql.cc.
260  * also got rid of warning comparing unsigned int to int.
261  *
262  * Revision 1.26 2001/07/13 22:53:26 porter
263  * last night's schema-fix was in a switch-case ... I missed one & put it in today
264  *
265  * Revision 1.25 2001/07/13 02:28:15 porter
266  * fix problem in schema evolution for array size changes
267  *
268  * Revision 1.24 2001/04/23 19:24:32 porter
269  * fixed row limit & initial buffer contents for query by where clause
270  *
271  * Revision 1.23 2001/02/09 23:06:25 porter
272  * replaced ostrstream into a buffer with ostrstream creating the
273  * buffer. The former somehow clashed on Solaris with CC5 iostream (current .dev)
274  *
275  * Revision 1.22 2001/02/08 23:23:56 porter
276  * fixed initialization of schemaID in table & fixed some warnings when
277  * compiled with NODEBUG
278  *
279  * Revision 1.21 2001/01/22 18:38:00 porter
280  * Update of code needed in next year running. This update has little
281  * effect on the interface (only 1 method has been changed in the interface).
282  * Code also preserves backwards compatibility so that old versions of
283  * StDbLib can read new table structures.
284  * -Important features:
285  * a. more efficient low-level table structure (see StDbSql.cc)
286  * b. more flexible indexing for new systems (see StDbElememtIndex.cc)
287  * c. environment variable override KEYS for each database
288  * d. StMessage support & clock-time logging diagnostics
289  * -Cosmetic features
290  * e. hid stl behind interfaces (see new *Impl.* files) to again allow rootcint access
291  * f. removed codes that have been obsolete for awhile (e.g. db factories)
292  * & renamed some classes for clarity (e.g. tableQuery became StDataBaseI
293  * and mysqlAccessor became StDbSql)
294  *
295  * Revision 1.20 2000/08/15 22:51:52 porter
296  * Added Root2DB class from Masashi Kaneta
297  * + made code more robust against requesting data from non-existent databases
298  *
299  * Revision 1.19 2000/06/30 01:57:02 porter
300  * fixed a delete bug & small memory leak found by Akio via Insure++ ,
301  * updated SetTable() method for containing idList, corrected enumeration
302  * map to rhic domain for Conditions_rhic database
303  *
304  * Revision 1.18 2000/06/02 13:37:37 porter
305  * built up list of minor changes:
306  * - made buffer more robust for certain null inputs
307  * - fixed small leak in StDbTables & restructure call to createMemory
308  * - added dbRhic as a database domain in StDbDefs
309  * - added setUser() in StDbManager
310  * - added more diagnostic printouts in mysqlAccessor.cc
311  *
312  * Revision 1.17 2000/05/10 21:39:02 porter
313  * fixed delete[] bug in reading from table where input schema includes fields that
314  * are not in the database by checking buffer status for reads
315  *
316  * Revision 1.16 2000/04/25 18:26:03 porter
317  * added flavor & production time as settable query fields in
318  * table &/or node. Associated SQL updated in mysqlAccessor.
319  * Flavor key supports "+" as an OR symbol.
320  *
321  * Revision 1.15 2000/03/28 17:03:19 porter
322  * Several upgrades:
323  * 1. configuration by timestamp for Conditions
324  * 2. query by whereClause made more systematic
325  * 3. conflict between db-stored comments & number lists resolved
326  * 4. ensure endtime is correct for certain query falures
327  * 5. dbstl.h->handles ObjectSpace & RogueWave difference (Online vs Offline)
328  *
329  * Revision 1.14 2000/02/15 20:27:44 porter
330  * Some updates to writing to the database(s) via an ensemble (should
331  * not affect read methods & haven't in my tests.
332  * - closeAllConnections(node) & closeConnection(table) method to mgr.
333  * - 'NullEntry' version to write, with setStoreMode in table;
334  * - updated both StDbTable's & StDbTableDescriptor's copy-constructor
335  *
336  * Revision 1.13 2000/01/27 05:54:34 porter
337  * Updated for compiling on CC5 + HPUX-aCC + KCC (when flags are reset)
338  * Fixed reConnect()+transaction model mismatch
339  * added some in-code comments
340  *
341  * Revision 1.12 2000/01/19 20:20:07 porter
342  * - finished transaction model needed by online
343  * - fixed CC5 compile problem in StDbNodeInfo.cc
344  * - replace TableIter class by StDbTableIter to prevent name problems
345  *
346  * Revision 1.11 2000/01/10 20:37:54 porter
347  * expanded functionality based on planned additions or feedback from Online work.
348  * update includes:
349  * 1. basis for real transaction model with roll-back
350  * 2. limited SQL access via the manager for run-log & tagDb
351  * 3. balance obtained between enumerated & string access to databases
352  * 4. 3-levels of diagnostic output: Quiet, Normal, Verbose
353  * 5. restructured Node model for better XML support
354  *
355  * Revision 1.10 1999/12/07 21:25:25 porter
356  * some fixes for linux warnings
357  *
358  * Revision 1.9 1999/12/03 19:01:59 porter
359  * modified descriptor to accept tableDescriptor once this St_base object
360  * has been updated to have longer name lengths.
361  *
362  * Revision 1.6 1999/10/19 14:30:39 porter
363  * modifications relevant to use with StDbBroker and future merging with
364  * "params" database structure + some docs + suppressing diagnostics messages
365  *
366  * Revision 1.5 1999/09/30 02:06:10 porter
367  * add StDbTime to better handle timestamps, modify SQL content (mysqlAccessor)
368  * allow multiple rows (StDbTable), & Added the comment sections at top of
369  * each header and src file
370  *
371  **************************************************************************/
372 #include "StDbTable.h"
373 #include "StDbBuffer.h"
374 #include "typeAcceptor.hh"
375 #include "StTableDescriptorI.h"
376 #include <stdlib.h>
377 #ifndef __STDB_STANDALONE__
378 #include "StMessMgr.h"
379 #else
380 #define LOG_DEBUG cout
381 #define LOG_INFO cout
382 #define LOG_WARN cout
383 #define LOG_ERROR cerr
384 #define LOG_FATAL cerr
385 #define LOG_QA cout
386 #define endm "\n"
387 #endif
388 
389 #include "StDbDefaults.hh"
390 #include "StDbManager.hh"
391 #include <string.h>
392 #include "stdb_streams.h"
393 #ifndef __APPLE__
394 #include <malloc.h>
395 #endif
396 #ifdef __ROOT__
397 ClassImp(StDbTable)
398 #endif
399 
400 #define __CLASS__ "StDbTable"
401 
403 StDbTable::StDbTable(const char* tableName): StDbNode(tableName) { init();};
404 
405 StDbTable::StDbTable(const char* tableName, int schemaID): StDbNode(tableName) { init(); mschemaID=schemaID; }
406 
407 
408 StDbTable::StDbTable(StDbTable& table): StDbNode(table) {
409 
410  init();
411  mflavor=table.getFlavor();
412  mdefaultFlavor = table.defaultFlavor();
413  mprodTime = table.getProdTime();
414 
415  mschemaID = table.getSchemaID();
416  mrows = table.GetNRows();
417  mhasDescriptor=table.hasDescriptor();
418  mdescriptor=table.getDescriptorCpy();
419 
420  mbeginTime.setDateTime(table.getBeginDateTime());
421  mbeginTime.setUnixTime(table.getBeginTime());
422  mendTime.setDateTime(table.getEndDateTime());
423  mendTime.setUnixTime(table.getEndTime());
424 
425  char* tmp = table.GetTable();
426  if(mrows==0) mrows = 1;
427  if(tmp) {
428  unsigned int size = mrows*table.getTableSize();
429  mdata = new char[size];
430  memcpy(mdata,tmp,size);
431  mhasData = true;
432  }
433 
434  setCstructName(table.printCstructName());
435  setDataTable(table.printDataTable());
436 
437 }
438 
439 void StDbTable::init() {
440  mflavor = 0;
441  mstructName = 0;
442  melementName = 0;
443  mdataTable = 0;
444  melementID = 0;
445  mhasDescriptor = false;
446  mdescriptor = 0;
447  mdata = 0;
448  mhasData = false;
449  mrowsRequested = 0;
450  mtimeVals = 0;
451  mendTime.munixTime = 0;
452  mrows = 0;
453  mrowNumber = 0;
454  mprodTime = StDbDefaults::Instance()->getProdTime();
455  setDefaultFlavor();
456  mschemaID = 0;
457 
458 }
459 
461 void StDbTable::setNodeInfo(StDbNode* node){
462 
463  mdbType=node->getDbType();
464  mdbDomain=node->getDbDomain();
465  setDbName(node->printDbName());
466  setVersion(node->printVersion());
467  setNodeType(node->printNodeType());
468  mnodeID=node->getNodeID();
469 };
470 
472 void StDbTable::setCstructName(const char* name){ mstructName=mstrDup(name); }
473 
475 char* StDbTable::getCstructName() { return mstrDup(mstructName); }
476 
478 void StDbTable::setDataTable(const char* name){ mdataTable=mstrDup(name); }
479 
481 char* StDbTable::getDataTable() { return mstrDup(mdataTable); }
482 
484 void
485 StDbTable::setDefaultFlavor(){ setFlavor(StDbDefaults::Instance()->printFlavor());
486 }
487 
489 void StDbTable::setFlavor(const char* flavor) {
490  if(!flavor) return;
491  if(mflavor) delete [] mflavor;
492  mflavor=new char[strlen(flavor)+1];
493  strcpy(mflavor,flavor);
494  mdefaultFlavor = StDbDefaults::Instance()->IsDefaultFlavor(mflavor);
495 }
496 
497 char* StDbTable::getFlavor() { return mstrDup(mflavor); }
498 
499 
501 void
502 StDbTable::addWrittenRows(int* dataID, int numRows, bool canRollBack){
503 
504  for(int i=0; i<numRows; i++) mstoredData.addWrittenRow(dataID[i]);
505  if(canRollBack)mcanRollBack=true;
506 
507 }
508 
509 int*
510 StDbTable::getWrittenRows(int& nRows){
511  return mstoredData.getDataIDs(nRows);
512 }
513 void StDbTable::commitData() { mstoredData.commit(); }
514 void StDbTable::clearStoreInfo() { mstoredData.resetStoreInfo(); }
515 
518 StDbTable::getDescriptorCpy() const { return mdescriptor->getCpy(); }
519 
521 void
522 StDbTable::setDescriptor(StTableDescriptorI* descriptor){
523 
524  if(mdescriptor) delete mdescriptor;
525  mdescriptor=descriptor;
526  mhasDescriptor=true;
527 
528  //checkDescriptor();
529 
530 };
531 
533 char* StDbTable::GetTable() { if(!mdata)createMemory(); return mdata;};
534 
536 void*
537 StDbTable::GetTableCpy() {
538 
539 if(!mdata)return (void*)GetTable();
540 
541  int len = mrows*getTableSize();
542  char* c = (char*)calloc(mrows,getTableSize());
543  memcpy(c,mdata,len);
544 
545 return (void*)c;
546 };
547 
549 void
550 StDbTable::SetTable(char* c, int nrows, int* idList) {
551 
552 if(mdata){
553  delete [] mdata;
554  mdata = 0;
555 }
556  if(!idList){
557  createMemory(nrows);
558  } else {
559  setElementID(idList,nrows); // createMemory is called here
560  }
561 int len = nrows*getTableSize();
562 memcpy(mdata,c,len);
563 mhasData=true;
564 
565 }
566 
568 void
569 StDbTable::AddRows(char* c, int nrows) {
570 
571 char* tmpData = duplicateData();
572 int len1 = mrows*getTableSize();
573 int len2 = nrows*getTableSize();
574 
575 int newRows = nrows+mrows;
576 if(mdata){
577  delete [] mdata;
578  mdata = 0;
579  }
580 
581 createMemory(newRows);
582 
583 char* ptr= &mdata[0];
584 memcpy(mdata,tmpData,len1);
585 ptr+=len1;
586 memcpy(ptr,c,len2);
587 
588 delete [] tmpData;
589 mhasData=true;
590 
591 }
592 
594 void*
595 StDbTable::getDataValue(const char* name, int rowNumber){
596 
597  void* retVal=0;
598  int saveRowNum=mrowNumber;
599  mrowNumber=rowNumber;
600  int max = mdescriptor->getNumElements();
601  char* ename=0;
602  StTypeE type;
603  unsigned int length;
604  char * ptr;
605 
606  for(int i=0;i<max;i++){
607  getElementSpecs(i,ptr,ename,length,type);
608  if ( ename ) {
609  if ( strcmp(name,ename) == 0 ) break;
610  delete [] ename;
611  ename=0;
612  }
613  }
614 
615  mrowNumber=saveRowNum;
616  if(!ename) return retVal;
617 
618  delete [] ename;
619  return (void*)ptr;
620 }
621 
623 char*
624 StDbTable::duplicateData() {
625 
626  char* dup=0;
627  int len1 = mrows*getTableSize();
628  if(len1 !=0){
629  dup=new char[len1];
630  memcpy(dup,mdata,len1);
631  }
632 return dup;
633 }
634 
636 
637 bool
638 StDbTable::createMemory(int nrows) {
639  mrows = nrows;
640  bool retVal = true;
641  if(mrows==0) {
642  if(mdata)delete [] mdata;
643  mdata=0;
644  return retVal;
645  }
646 
647 // mdescriptor->getNumElements();
648 //if (mdescriptor) {
649 //cout <<"**************CHECKIT************"<<endl;
650 //}
651  if(mdescriptor && mdescriptor->getNumElements()>0){
652  // if(mrows==0) mrows = 1;
653  //int len = mrows*mdescriptor->getTotalSizeInBytes();
654  int len;
655  if (!mdescriptor->getTrowSize()){
656  len = mrows*mdescriptor->getTotalSizeInBytes();
657  }else{
658  len = mrows*mdescriptor->getTrowSize();
659  }
660  if(len>0){
661  if(mdata)delete [] mdata;
662  mdata=new char[len];
663  memset(mdata,0,len);
664  int max = mdescriptor->getNumElements();
665  char* name;
666  StTypeE type;
667  unsigned int length;
668  char * ptr;
669  for(int i=0; i<max;i++){
670  getElementSpecs(i,ptr,name,length,type);
671  if (type==Stchar) { *ptr='\0'; }
672  delete [] name;
673  }
674  }
675  } else {
676  if(!mname){mname=mstrDup("Unknown");}
677  retVal = false;
678  }
679 
680 return retVal;
681 }
682 
684 bool
685 StDbTable::createMemory() {
686  if(mdata)return true;
687  if(mrows==0) mrows=1;
688  return createMemory(mrows);
689 }
690 
692 
693 char*
694 StDbTable::getElementName() { return mstrDup(melementName); };
695 
696 void
697 StDbTable::setElementName(const char* name) { melementName=mstrDup(name);};
698 
699 void
700 StDbTable::setElementID(int* elements, int nrows) {
701 
702  createMemory(nrows);
703  // set up & fill char* will element list
704  if(melementID) delete [] melementID;
705  if(nrows==0){
706  melementID=0;
707  return;
708  }
709  melementID = new int[nrows];
710  memcpy(melementID, elements, nrows*sizeof(int));
711 }
712 
714 void StDbTable::resizeNumRows(int nrows){
715  // if only some rows are returned, this is called to
716  // compress memory
717 
718  //unsigned int rowsize=mdescriptor->getTotalSizeInBytes();
719  unsigned int rowsize;
720  if (!mdescriptor->getTrowSize()) {
721  rowsize=mdescriptor->getTotalSizeInBytes();
722  }else{
723  rowsize=mdescriptor->getTrowSize();
724  }
725  unsigned int len = mrows*rowsize;
726  unsigned int newlen = nrows*rowsize;
727 
728  if(mdata){
729  char* oldData=new char[len];
730  memcpy(oldData,mdata,len);
731  delete [] mdata;
732  mdata = new char[newlen];
733  if(newlen<=len){
734  memcpy(mdata,oldData,newlen);
735  } else {
736  memcpy(mdata,oldData,len);
737  }
738  delete [] oldData;
739  }
740 
741  mrows=nrows;
742  return;
743 }
744 
745 
747 void
748 StDbTable::addNRows(int numRows){
749 
750  if(!mdescriptor) return;
751 
752  int newRows = numRows+mrows;
753  //unsigned int rowsize=mdescriptor->getTotalSizeInBytes();
754  unsigned int rowsize;
755  if(!mdescriptor->getTrowSize()) {
756  rowsize=mdescriptor->getTotalSizeInBytes();
757  }else{
758  rowsize=mdescriptor->getTrowSize();
759  }
760  unsigned int len = newRows*rowsize;
761  char* newData = new char[len];
762  memset(newData,0,len);
763  if(mdata)memcpy(newData,mdata,mrows*rowsize);
764  char* p1 = newData;
765  p1+=mrows*rowsize;
766  memset(p1,0,numRows*rowsize);
767  if(mdata)delete [] mdata;
768  mdata=newData;
769 
770  resizeElementID(newRows);
771 };
772 
774 void
775 StDbTable::resizeElementID(int numRows){
776 
777  int * newElements=new int[numRows];
778  if(melementID) {
779  memcpy(newElements,melementID,mrows*sizeof(int));
780  delete [] melementID;
781  }
782  melementID=newElements;
783  mrows = numRows;
784 
785 };
786 
788 void
789 StDbTable::addNElements(int* elements, int newRows){
790 
791 
792  if(!melementID) return;
793 
794  int i,j,k;
795  k=mrows-newRows;
796  if(k<0)return;
797  j=0;
798  for(i=k;i<mrows;i++){
799  melementID[i]=elements[j];
800  j++;
801  }
802 
803 }
804 
806 void
807 StDbTable::StreamAccessor(typeAcceptor* accept, bool isReading){
808 
809  int len = 1;
810  accept->pass((char*)"schemaID",mschemaID,len);
811 
812  if(isReading){
813  if(mbeginTime.mdateTime) delete [] mbeginTime.mdateTime;
814  if(mversion)delete [] mversion;
815  if(melementID)delete [] melementID;
816  } else {
817  if(!melementID){
818  melementID = new int[mrows];
819  for(int i=0;i<mrows;i++)melementID[i]=i;
820  }
821  }
822  accept->pass((char*)"beginTime",mbeginTime.mdateTime,len);
823  accept->pass((char*)"version",mversion,len);
824  accept->pass((char*)"elementID",melementID, mrows);
825 }
826 
828 void
829 StDbTable::StreamAccessor(StDbBufferI* buff, bool isReading){
830 
831  bool ClientMode;
832  if(!(ClientMode=buff->IsClientMode()))buff->SetClientMode();
833 
834  int rowID;
835  if(!melementID){
836  melementID = new int[mrows];
837  for(int i=0;i<mrows;i++)melementID[i]=i;
838  }
839 
840  if(isReading){
841  buff->ReadScalar(rowID,"elementID");
842  melementID[mrowNumber]=rowID;
843 
844  if(mrowNumber==0){
845  buff->ReadScalar(mschemaID,"schemaID");
846  if(mversion) delete [] mversion;
847  buff->ReadScalar(mversion,"version");
848  } else {
849  unsigned int bTime;// , eTime;
850  buff->ReadScalar(bTime,"beginTime");
851  if(bTime>mbeginTime.munixTime)mbeginTime.munixTime=bTime;
852  }
853 
854  } else {
855 
856  buff->WriteScalar(mschemaID,"schemaID");
857  buff->WriteScalar(mbeginTime.munixTime,"beginTime");
858  if(mversion)buff->WriteScalar(mversion,"version");
859  rowID = melementID[mrowNumber];
860  buff->WriteScalar(rowID,"elementID");
861  }
862 
863  if(!ClientMode)buff->SetStorageMode(); // reset to StorageMode
864 
865 }
866 
868 void
869 StDbTable::getElementSpecs(int elementNum, char*& c, char*& name, unsigned int& length,StTypeE& type){
870 
871  int tRow = mdescriptor->getTrowSize();
872  unsigned int tSize=mdescriptor->getTotalSizeInBytes();
873  unsigned int rowIndex;
874  if (!tRow) {
875  rowIndex = ((unsigned int)mrowNumber)*tSize;
876  }else{
877  rowIndex = ((unsigned int)mrowNumber)*tRow;
878  }
879  int i = elementNum;
880  c = &mdata[rowIndex];
881  int current = mdescriptor->getElementOffset(i);
882  c += current; // for(int k=0;k<current;k++)c++;
883  name = mdescriptor->getElementName(i);
884  length = mdescriptor->getElementLength(i);;
885  type = mdescriptor->getElementType(i);
886 
887 return;
888 }
889 
891 void
892 StDbTable::dbStreamer(StDbBufferI* buff, bool isReading){
893 
894 int max = mdescriptor->getNumElements();
895 char* name;
896 StTypeE type;
897 unsigned int length;
898 char* ptr;
899 
900  bool ClientMode;
901  if(!(ClientMode=buff->IsClientMode()))buff->SetClientMode();
902 
903  if(createMemory() && mrowNumber < mrows){
904 
905  for(int i=0; i<max; i++){
906  getElementSpecs(i,ptr,name,length,type);
907  if(isReading){
908  ReadElement(ptr,name,length,type,(StDbBuffer*)buff);
909  } else {
910  WriteElement(ptr,name,length,type,(StDbBuffer*)buff);
911  }
912  delete [] name;
913  }
914 
915  mrowNumber++;
916  if(isReading)mhasData=true;
917 
918  } else {
919  LOG_ERROR << "dbStreamer:: more rows delivered than allocated " << endm;
920  }
921  if(!ClientMode)buff->SetStorageMode(); // reset to StorageMode
922 }
923 
924 
926 void
927 StDbTable::dbStreamerWrite(StDbBufferI* buff){
928 
929 int max = mdescriptor->getNumElements();
930 char* name;
931 StTypeE type;
932 unsigned int length;
933 char* ptr;
934 
935 // bool ClientMode;
936 // if(!(ClientMode=buff->IsClientMode()))buff->SetClientMode();
937 
938 // if(createMemory() && mrowNumber < mrows){
939 
940  if(mrowNumber<mrows){
941  for(int i=0; i<max; i++){
942  getElementSpecs(i,ptr,name,length,type);
943  WriteElement(ptr,name,length,type,(StDbBuffer*)buff);
944  delete [] name;
945  }
946  mrowNumber++;
947  }
948 }
949 
951 
952 void
953 StDbTable::dbTableStreamer(StDbBufferI* buff, const char* name, bool isReading){
954 
955 int max = mdescriptor->getNumElements();
956 //int size = mdescriptor->getTotalSizeInBytes();
957 StTypeE type = mdescriptor->getElementType(0);
958 unsigned int length = (unsigned int) mrows*max;
959 
960 char* ptr;
961 
962  bool ClientMode;
963  if(!(ClientMode=buff->IsClientMode()))buff->SetClientMode();
964 
965  if(createMemory() && mrowNumber < mrows){
966 
967  ptr = &mdata[0];
968  // getElementSpecs(i,ptr,name,length,type);
969  if(isReading){
970  ReadElement(ptr,(char *) name,length,type,(StDbBuffer*)buff);
971  } else {
972  WriteElement(ptr,(char *) name,length,type,(StDbBuffer*)buff);
973  }
974  mrowNumber=mrows;
975  if(isReading) mhasData=true;
976  }
977 
978  if(!ClientMode)buff->SetStorageMode(); // reset to StorageMode
979 }
980 
981 
983 
984 void
985 StDbTable::dbStreamer(typeAcceptor* accept, bool isReading){
986 
987 int max = mdescriptor->getNumElements();
988 char* name;
989 StTypeE type;
990 unsigned int length;
991 char* ptr;
992 
993  if(createMemory() && mrowNumber < mrows){
994 
995  if(isReading){
996  for(int i=0; i<max; i++){
997  getElementSpecs(i,ptr,name,length,type);
998  PassInElement(ptr,name,length,type,accept);
999  delete [] name;
1000  }
1001  mhasData=true;
1002  } else {
1003  for(int i=0; i<max; i++){
1004  getElementSpecs(i,ptr,name,length,type);
1005  PassOutElement(ptr,name,length,type,accept);
1006  delete [] name;
1007  }
1008  }
1009 
1010  mrowNumber++;
1011  }
1012 
1013 }
1014 
1016 
1017 void
1018 StDbTable::ReadElement(char*& ptr, char* name, int len, StTypeE type, StDbBuffer* buff){
1019 
1020 char* mchar; unsigned char* muchar; short* mshort; unsigned short* mushort;
1021 int* mint; unsigned int* muint; long* mlong; unsigned long* mulong;
1022 long long* mlonglong;
1023 float* mfloat; double* mdouble;
1024 
1025  int blen; // length returned from db ### use lesser of len & blen
1026 
1027  switch (type) {
1028  case Stchar:
1029  {
1030  StString cn;
1031  cn<<name<<".text"; const char* commentName = (cn.str()).c_str();
1032  mchar = 0;
1033  if(!buff->ReadScalar(mchar,commentName))buff->ReadScalar(mchar,name);
1034  if(mchar){
1035  int len1=strlen(mchar);
1036  if(len>len1) len=len1;
1037  strncpy(ptr,mchar,len);
1038  delete [] mchar;
1039  } else {
1040  *ptr='\0';
1041  printNoDataReturned(name);
1042  }
1043  break;
1044  }
1045  case Stuchar:
1046  {
1047  if(buff->ReadArray(muchar,blen,name)){
1048  if(len>blen)len=blen;
1049  memcpy(ptr,muchar,len*sizeof(unsigned char));
1050  delete [] muchar;
1051  } else { printNoDataReturned(name); }
1052  break;
1053  }
1054  case Stshort:
1055  {
1056  if(buff->ReadArray(mshort,blen,name)){
1057  if(len>blen)len=blen;
1058  memcpy(ptr,mshort,len*sizeof(short));
1059  delete [] mshort;
1060  } else { printNoDataReturned(name); }
1061  break;
1062  }
1063  case Stushort:
1064  {
1065  if(buff->ReadArray(mushort,blen,name)){
1066  if(len>blen)len=blen;
1067  memcpy(ptr,mushort,len*sizeof(unsigned short));
1068  delete [] mushort;
1069  } else { printNoDataReturned(name); }
1070  break;
1071  }
1072  case Stint:
1073  {
1074  if(buff->ReadArray(mint,blen,name)){
1075  if(len>blen)len=blen;
1076  memcpy(ptr,mint,len*sizeof(int));
1077  delete [] mint;
1078  } else { printNoDataReturned(name); }
1079  break;
1080  }
1081  case Stuint:
1082  {
1083  if(buff->ReadArray(muint,blen,name)){
1084  if(len>blen)len=blen;
1085  memcpy(ptr,muint,len*sizeof(unsigned int));
1086  delete [] muint;
1087  } else { printNoDataReturned(name); }
1088  break;
1089  }
1090  case Stlong:
1091  {
1092  if(buff->ReadArray(mlong,blen,name)){
1093  if(len>blen)len=blen;
1094  memcpy(ptr,mlong,len*sizeof(long));
1095  delete [] mlong;
1096  } else { printNoDataReturned(name); }
1097  break;
1098  }
1099  case Stulong:
1100  {
1101  if(buff->ReadArray(mulong,blen,name)){
1102  if(len>blen)len=blen;
1103  memcpy(ptr,mulong,len*sizeof(unsigned long));
1104  delete [] mulong;
1105  } else { printNoDataReturned(name); }
1106  break;
1107  }
1108  case Stlonglong:
1109  {
1110  if(buff->ReadArray(mlonglong,blen,name)){
1111  if(len>blen)len=blen;
1112  memcpy(ptr,mlonglong,len*sizeof(long long));
1113  delete [] mlonglong;
1114  } else { printNoDataReturned(name); }
1115  break;
1116  }
1117  case Stfloat:
1118  {
1119  if(buff->ReadArray(mfloat,blen,name)){
1120  if(len>blen)len=blen;
1121  memcpy(ptr,mfloat,len*sizeof(float));
1122  delete [] mfloat;
1123  } else { printNoDataReturned(name); }
1124  break;
1125  }
1126  case Stdouble:
1127  {
1128  if(buff->ReadArray(mdouble,blen,name)){
1129  if(len>blen)len=blen;
1130  memcpy(ptr,mdouble,len*sizeof(double));
1131  delete [] mdouble;
1132  } else { printNoDataReturned(name); }
1133  break;
1134  }
1135  case Stmaxtype:
1136  printNoDataReturned(name);
1137  break;
1138  }
1139 
1140 }
1141 
1143 
1144 void
1145 StDbTable::WriteElement(char* ptr, char* name, int len, StTypeE type, StDbBuffer* buff){
1146 
1147  switch (type) {
1148  case Stchar:
1149  {
1150  char* mchar = ptr;
1151  buff->WriteScalar(mchar,name);
1152  break;
1153  }
1154  case Stuchar:
1155  {
1156  unsigned char* muchar = (unsigned char*)ptr;
1157  buff->WriteArray(muchar,len,name);
1158  break;
1159  }
1160  case Stshort:
1161  {
1162  short* mshort = (short*) ptr;
1163  buff->WriteArray(mshort ,len,name);
1164  break;
1165  }
1166  case Stushort:
1167  {
1168  unsigned short* mushort = (unsigned short*) ptr;
1169  buff->WriteArray(mushort,len,name);
1170  break;
1171  }
1172  case Stint:
1173  {
1174  int* mint = (int*)ptr;
1175  buff->WriteArray(mint,len,name);
1176  break;
1177  }
1178  case Stuint:
1179  {
1180  unsigned int* muint = (unsigned int*) ptr;
1181  buff->WriteArray(muint,len,name);
1182  break;
1183  }
1184  case Stlong:
1185  {
1186  long* mlong = (long*) ptr;
1187  //if(len==1) cout << name << " = "<< *mlong << endl;
1188  buff->WriteArray(mlong,len,name);
1189  break;
1190  }
1191  case Stulong:
1192  {
1193  unsigned long* mulong = (unsigned long*) ptr;
1194  buff->WriteArray(mulong,len,name);
1195  break;
1196  }
1197  case Stlonglong:
1198  {
1199  long long* mlonglong = (long long*) ptr;
1200  buff->WriteArray(mlonglong,len,name);
1201  break;
1202  }
1203  case Stfloat:
1204  {
1205  float* mfloat = (float*) ptr;
1206  //if(len==1) cout << name << " = "<< *mfloat << endl;
1207  buff->WriteArray(mfloat,len,name);
1208  break;
1209  }
1210  case Stdouble:
1211  {
1212  double* mdouble = (double*) ptr;
1213  buff->WriteArray(mdouble,len,name);
1214  break;
1215  }
1216  case Stmaxtype:
1217  break;
1218  }
1219 
1220 }
1221 
1223 void
1224 StDbTable::PassInElement(char* ptr, char* name, int len, StTypeE type, typeAcceptor* accept){
1225 
1226 
1227  switch (type) {
1228  case Stchar:
1229  {
1230  char* data;
1231  accept->pass(name,data,len);
1232  memcpy(ptr,data,len);
1233  delete [] data;
1234  break;
1235  }
1236  case Stuchar:
1237  {
1238  unsigned char* data;
1239  accept->pass(name,data,len);
1240  memcpy(ptr,data,len);
1241  delete [] data;
1242  break;
1243  }
1244  case Stshort:
1245  {
1246  short* data;
1247  accept->pass(name,data,len);
1248  memcpy(ptr,data,len*sizeof(short));
1249  delete [] data;
1250  break;
1251  }
1252  case Stushort:
1253  {
1254  unsigned short* data;
1255  accept->pass(name,data,len);
1256  memcpy(ptr,data,len*sizeof(short));
1257  delete [] data;
1258  break;
1259  }
1260  case Stint:
1261  {
1262  int* data;
1263  accept->pass(name,data,len);
1264  memcpy(ptr,data,len*sizeof(int));
1265  delete [] data;
1266  break;
1267  }
1268  case Stuint:
1269  {
1270  unsigned int* data;
1271  accept->pass(name,data,len);
1272  memcpy(ptr,data,len*sizeof(int));
1273  delete [] data;
1274  break;
1275  }
1276  case Stlong:
1277  {
1278  long* data;
1279  accept->pass(name,data,len);
1280  memcpy(ptr,data,len*sizeof(long));
1281  delete [] data;
1282  break;
1283  }
1284  case Stulong:
1285  {
1286  unsigned long* data;
1287  accept->pass(name,data,len);
1288  memcpy(ptr,data,len*sizeof(long));
1289  delete [] data;
1290  break;
1291  }
1292  case Stlonglong:
1293  {
1294  long long* data;
1295  accept->pass(name,data,len);
1296  memcpy(ptr,data,len*sizeof(long long));
1297  delete [] data;
1298  break;
1299  }
1300  case Stfloat:
1301  {
1302  float* data;
1303  accept->pass(name,data,len);
1304  memcpy(ptr,data,len*sizeof(float));
1305  delete [] data;
1306  break;
1307  }
1308  case Stdouble:
1309  {
1310  double* data;
1311  accept->pass(name,data,len);
1312  memcpy(ptr,data,len*sizeof(double));
1313  delete [] data;
1314  break;
1315  }
1316  case Stmaxtype:
1317  // should never get here
1318  break;
1319  }
1320 }
1321 
1323 
1324 void
1325 StDbTable::PassOutElement(char* ptr, char* name, int len, StTypeE type, typeAcceptor* accept){
1326 
1327  switch (type) {
1328  case Stchar:
1329  {
1330  accept->pass(name,ptr,len);
1331  break;
1332  }
1333  case Stuchar:
1334  {
1335  unsigned char* muchar = (unsigned char*)ptr;
1336  accept->pass(name, muchar,len);
1337  break;
1338  }
1339  case Stshort:
1340  {
1341  short* mshort = (short*)ptr;
1342  if(len==1){
1343  accept->pass(name, *mshort ,len);
1344  } else {
1345  accept->pass(name,mshort,len);
1346  }
1347  break;
1348  }
1349  case Stushort:
1350  {
1351  unsigned short* mushort = (unsigned short*)ptr;
1352  if(len==1){
1353  accept->pass(name, *mushort ,len);
1354  } else {
1355  accept->pass(name,mushort,len);
1356  }
1357  break;
1358  }
1359  case Stint:
1360  {
1361  int* mint = (int*)ptr;
1362  if(len==1){
1363  accept->pass(name, *mint ,len);
1364  } else {
1365  accept->pass(name,mint,len);
1366  }
1367  break;
1368  }
1369  case Stuint:
1370  {
1371  unsigned int* muint = (unsigned int*)ptr;
1372  if(len==1){
1373  accept->pass(name, *muint ,len);
1374  } else {
1375  accept->pass(name,muint,len);
1376  }
1377  break;
1378  }
1379  case Stlong:
1380  {
1381  long* mlong = (long*)ptr;
1382  if(len==1){
1383  accept->pass(name, *mlong ,len);
1384  } else {
1385  accept->pass(name,mlong,len);
1386  }
1387  break;
1388  }
1389  case Stulong:
1390  {
1391  unsigned long* mulong = (unsigned long*)ptr;
1392  if(len==1){
1393  accept->pass(name, *mulong ,len);
1394  } else {
1395  accept->pass(name,mulong,len);
1396  }
1397  break;
1398  }
1399  case Stlonglong:
1400  {
1401  long long* mlonglong = (long long*)ptr;
1402  if(len==1){
1403  accept->pass(name, *mlonglong ,len);
1404  } else {
1405  accept->pass(name,mlonglong,len);
1406  }
1407  break;
1408  }
1409  case Stfloat:
1410  {
1411  float* mfloat = (float*)ptr;
1412  if(len==1){
1413  accept->pass(name, *mfloat ,len);
1414  } else {
1415  accept->pass(name,mfloat,len);
1416  }
1417  break;
1418  }
1419  case Stdouble:
1420  {
1421  double* mdouble = (double*)ptr;
1422  if(len==1){
1423  accept->pass(name, *mdouble ,len);
1424  } else {
1425  accept->pass(name,mdouble,len);
1426  }
1427  break;
1428  }
1429  case Stmaxtype:
1430  // should never get here
1431  break;
1432  }
1433 }
1434 
1436 void
1437 StDbTable::checkDescriptor(){
1438 
1439 int i = mdescriptor->getNumElements();
1440 unsigned int size = mdescriptor->getTotalSizeInBytes();
1441  cout <<"Descriptor for Table = " << mname<<endl;
1442  cout <<" number of elements = "<<i<< " with size = " << size <<" TrowSize = " << mdescriptor->getTrowSize()<< endl;
1443  for(int k=0; k<i;k++){
1444  cout <<"Name = " << mdescriptor->getElementName(k);
1445  cout <<" size = " << mdescriptor->getElementSize(k);
1446  cout <<" offset = " <<mdescriptor->getElementOffset(k);
1447  cout <<" type = " <<(int)mdescriptor->getElementType(k) << endl;
1448  }
1449 }
1450 
1451 
1452 void StDbTable::printNoDataReturned(const char* elementName){
1453 
1454  StString emess;
1455  emess<<" No data return from table="<<printName()<<" column="<<elementName;
1456  StDbManager::Instance()->printInfo((emess.str()).c_str(),dbMWarn,__LINE__,__CLASS__,"ReadElement(ptr,name,len,type,buffer)");
1457 }
1458 
1459 #undef __CLASS__
1460 
1461 
1462 
1463 
1464 
1465 
1466 
1467 
1468 
1469 
1470 
1471 
StDbStoreInfo mstoredData
for rolling back stores
Definition: StDbTable.h:177
virtual void SetTable(char *data, int nrows, int *idList=0)
calloc&#39;d version of data for StRoot
Definition: StDbTable.cc:550
bool mhasDescriptor
c-struct descriptor information
Definition: StDbTable.h:180
StDbTime mbeginTime
validity interval
Definition: StDbTable.h:161
char * mdata
data &amp; num of rows
Definition: StDbTable.h:184
static StDbManager * Instance()
strdup(..) is not ANSI
Definition: StDbManager.cc:155