ATLAS Offline Software
GenericDbTable.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <cstdlib>
7 #include <climits>
8 #include <cfloat>
9 #include <algorithm> //count_if
10 
11 #define NULLINT -INT_MAX
12 #define NULLFLOAT -FLT_MAX
13 #define NULLDOUBLE -DBL_MAX
14 // DRQ: This is temporary hack while I think of a better way of doing this
15 #if defined __APPLE__
16 #define NULLLONG -__LONG_LONG_MAX__
17 #else
18 #define NULLLONG -LONG_LONG_MAX
19 #endif
20 #define atoi64(x) atoll(x)
21 
22 
23 using std::cerr;
24 using std::endl;
25 using std::string;
26 using std::vector;
27 
28 GenericDbTable::GenericDbTable(unsigned n_columns, int n_rows):m_numRows(n_rows)
29 {
30 
31  m_numRows=0;
32  m_isInitialized = false;
33  unsigned i;
34 
35  for (i=0;i<n_columns; i++)
36  m_conddbtable.push_back(new CondDBColumn);
37 
38  for (i = 0; i<m_conddbtable.size(); i++ )
39  {
40  m_conddbtable[i]->initialized = false;
41  m_conddbtable[i]->type = kNull;
42  }
43 
44  if (n_rows)
45  {
46  resize(n_rows);
47  // status = vector<CondDBStatus>(n_rows,untouched);
48  }
49 }
50 
51 
52 
54 {
55  for (unsigned i=0; i< m_conddbtable.size(); i++)
56  {
57  delete m_conddbtable[i];
58  }
59 }
60 
61 void GenericDbTable::Initialize(unsigned n_columns, int n_rows)
62 {
63  unsigned i;
64 
65  if (m_conddbtable.size() > 0 || m_isInitialized == true)
66  return;
67 
68  for (i=0;i<n_columns; i++)
69  m_conddbtable.push_back(new CondDBColumn);
70 
71  for (i = 0; i<m_conddbtable.size(); i++ )
72  {
73  m_conddbtable[i]->initialized = false;
74  m_conddbtable[i]->type = kNull;
75  }
76 
77  if (n_rows)
78  {
79  resize(n_rows);
80 // status = vector<CondDBStatus>(n_rows,untouched);
81  }
82 }
83 
84 
86 {
87  if (!m_isInitialized)
88  return CDB_NOT_INITIALIZED;
89 
90  for (unsigned i = 0; i < m_conddbtable.size(); i++)
91  {
92  names.push_back(m_conddbtable[i]->name);
93  }
94 
95  return 0;
96 }
97 
98 int GenericDbTable::getTypes(vector<dataTypes> &types) const
99 {
100  if (!m_isInitialized)
101  return CDB_NOT_INITIALIZED;
102 
103  for (unsigned i = 0; i < m_conddbtable.size(); i++)
104  {
105  types.push_back(m_conddbtable[i]->type);
106  }
107  return 0;
108 }
109 
110 
111 int GenericDbTable::getRowID(std::string &pID) const
112 {
113  std::vector<std::string> names;
114  unsigned int ncolumn = 0;
115 
116  if (getNames(names) != CDB_NOT_INITIALIZED) { //success
117  ncolumn = std::count_if(names.begin(),names.end(), [](const auto & s){return s != "Id";} );
118 
119  // if the table does not have id's
120  if (ncolumn == names.size())
121  return -1;
122 
123  CondDBColumnString *dcolumn = static_cast<CondDBColumnString*>(m_conddbtable[ncolumn]);
124 
125  for (unsigned int i = 0; i < dcolumn->column.size(); i++) {
126  if (dcolumn->column[i] == pID) {
127  return i;
128  }
129  }
130  }
131  // if the execution is here it means that the id doesn't exist in the column
132  return -1;
133 
134 }
135 
136 // when the argument is a string there must be done a spetial treatment
137 int GenericDbTable::getNull(unsigned n_column, string &null) const
138 {
139  if (!m_isInitialized)
140  return CDB_NOT_INITIALIZED;
141 
142  if (m_conddbtable.size() > n_column)
143  {
144  switch (m_conddbtable[n_column]->type)
145  {
146  case kString:
147  {
148  CondDBColumnString *tmpColumn = static_cast<CondDBColumnString*>(m_conddbtable[n_column]);
149  return __getNull(null, tmpColumn);
150  }
151  case kArrayString:
152  {
154  CondDBColumnArrayString *tmpColumn = static_cast<CondDBColumnArrayString*>(m_conddbtable[n_column]);
155  __getNull(tmp, tmpColumn);
156  null = tmp[0];
157  return CDB_SUCCESS;
158  }
159  case kFloat:
160  {
161  float tmp;
162  CondDBColumnFloat *tmpColumn = static_cast<CondDBColumnFloat*>(m_conddbtable[n_column]);
163  __getNull(tmp, tmpColumn);
164  null = ToString<float>(tmp);
165  return CDB_SUCCESS;
166  }
167  case kArrayFloat:
168  {
170  CondDBColumnArrayFloat *tmpColumn = static_cast<CondDBColumnArrayFloat*>(m_conddbtable[n_column]);
171  __getNull(tmp, tmpColumn);
172  null = ToString<float>(tmp[0]);
173  return CDB_SUCCESS;
174  }
175  case kInt:
176  {
177  long int tmp;
178  CondDBColumnInt *tmpColumn = static_cast<CondDBColumnInt*>(m_conddbtable[n_column]);
179  __getNull(tmp, tmpColumn);
180  null = ToString<float>(tmp);
181  return CDB_SUCCESS;
182  }
183  case kArrayInt:
184  {
185  vector<long int> tmp;
186  CondDBColumnArrayInt *tmpColumn = static_cast<CondDBColumnArrayInt*>(m_conddbtable[n_column]);
187  __getNull(tmp, tmpColumn);
188  null = ToString(tmp[0]);
189  return CDB_SUCCESS;
190  }
191  case kDouble:
192  {
193  double tmp;
194  CondDBColumnDouble *tmpColumn = static_cast<CondDBColumnDouble*>(m_conddbtable[n_column]);
195  __getNull(tmp, tmpColumn);
196  null = ToString(tmp);
197  return CDB_SUCCESS;
198  }
199  case kArrayDouble:
200  {
202  CondDBColumnArrayDouble *tmpColumn = static_cast<CondDBColumnArrayDouble*>(m_conddbtable[n_column]);
203  __getNull(tmp, tmpColumn);
204  null = ToString(tmp[0]);
205  return CDB_SUCCESS;
206  }
207  case kLongLong:
208  {
209  int64 tmp;
210  CondDBColumnLong *tmpColumn = static_cast<CondDBColumnLong*>(m_conddbtable[n_column]);
211  __getNull(tmp, tmpColumn);
212  null = ToString(tmp);
213  return CDB_SUCCESS;
214  }
215  case kArrayLongLong:
216  {
217  vector<int64> tmp;
218  CondDBColumnArrayLong *tmpColumn = static_cast<CondDBColumnArrayLong*>(m_conddbtable[n_column]);
219  __getNull(tmp, tmpColumn);
220  null = ToString(tmp[0]);
221  return CDB_SUCCESS;
222  }
223  case kBool:
224  case kArrayBool:
225  {
226  null=ToString(-1);
227  return CDB_SUCCESS;
228  }
229  default:
230  return CDB_TYPE_ERROR;
231  }
232  }
233  else
234  return CDB_RANGE_ERROR;
235 }
236 
237 int GenericDbTable::getNull(unsigned n_column, float &null) const
238 {
239  if (!m_isInitialized)
240  return CDB_NOT_INITIALIZED;
241 
242  if (m_conddbtable.size() > n_column)
243  if (m_conddbtable[n_column]->type == kFloat)
244  {
245  CondDBColumnFloat *tmpColumn = static_cast<CondDBColumnFloat*>(m_conddbtable[n_column]);
246  return __getNull(null, tmpColumn);
247  }
248  else if ( m_conddbtable[n_column]->type == kArrayFloat)
249  {
251  CondDBColumnArrayFloat *tmpColumn = static_cast<CondDBColumnArrayFloat*>(m_conddbtable[n_column]);
252  __getNull(tmp, tmpColumn);
253  null=tmp[0];
254  return CDB_SUCCESS;
255  }
256  else
257  return CDB_TYPE_ERROR;
258  else
259  return CDB_RANGE_ERROR;
260 }
261 
262 int GenericDbTable::getNull(unsigned n_column, long int &null) const
263 {
264  if (!m_isInitialized)
265  return CDB_NOT_INITIALIZED;
266 
267  if (m_conddbtable.size() > n_column)
268  if (m_conddbtable[n_column]->type == kInt)
269  {
270  CondDBColumnInt *tmpColumn = static_cast<CondDBColumnInt*>(m_conddbtable[n_column]);
271  return __getNull(null, tmpColumn);
272  }
273  else if (m_conddbtable[n_column]->type == kArrayInt)
274  {
275  vector<long int> tmp;
276  CondDBColumnArrayInt *tmpColumn = static_cast<CondDBColumnArrayInt*>(m_conddbtable[n_column]);
277  __getNull(tmp, tmpColumn);
278  return CDB_SUCCESS;
279  }
280  else
281  return CDB_TYPE_ERROR;
282  else
283  return CDB_RANGE_ERROR;
284 }
285 
286 int GenericDbTable::getNull(unsigned n_column, double &null) const
287 {
288  if (!m_isInitialized)
289  return CDB_NOT_INITIALIZED;
290 
291  if (m_conddbtable.size() > n_column)
292  if (m_conddbtable[n_column]->type == kDouble)
293  {
294  CondDBColumnDouble *tmpColumn = static_cast<CondDBColumnDouble*>(m_conddbtable[n_column]);
295  return __getNull(null, tmpColumn);
296  }
297  else if (m_conddbtable[n_column]->type == kArrayDouble)
298  {
300  CondDBColumnArrayDouble *tmpColumn = static_cast<CondDBColumnArrayDouble*>(m_conddbtable[n_column]);
301  __getNull(tmp, tmpColumn);
302  null = tmp[0];
303  return CDB_SUCCESS;
304  }
305  else
306  return CDB_TYPE_ERROR;
307  else
308  return CDB_RANGE_ERROR;
309 }
310 
311 int GenericDbTable::getNull(unsigned n_column, int64 &null) const
312 {
313  if (!m_isInitialized)
314  return CDB_NOT_INITIALIZED;
315 
316  if (m_conddbtable.size() > n_column)
317  if (m_conddbtable[n_column]->type == kLongLong)
318  {
319  CondDBColumnLong *tmpColumn = static_cast<CondDBColumnLong*>(m_conddbtable[n_column]);
320  return __getNull(null, tmpColumn);
321  }
322  else if ( m_conddbtable[n_column]->type == kArrayLongLong)
323  {
324  vector<int64> tmp;
325  CondDBColumnArrayLong *tmpColumn = static_cast<CondDBColumnArrayLong*>(m_conddbtable[n_column]);
326  __getNull(tmp, tmpColumn);
327  null = tmp[0];
328  return CDB_SUCCESS;
329  }
330  else
331  return CDB_TYPE_ERROR;
332  else
333  return CDB_RANGE_ERROR;
334 }
335 
336 
337 int GenericDbTable::setName(unsigned n_column, const string& name)
338 {
339  if (m_conddbtable.size() > n_column)
340  if (m_conddbtable[n_column]->name.size() == 0)
341  {
342  m_conddbtable[n_column]->name = name;
343  if (m_conddbtable[n_column]->type != kNull)
344  {
345  m_conddbtable[n_column]->initialized = true;
347  }
348  }
349  else
350  return CDB_TYPE_ERROR;
351  else
352  return CDB_RANGE_ERROR;
353  return CDB_SUCCESS;
354 }
355 
356 int GenericDbTable::setType(unsigned n_column, dataTypes type)
357 {
358  if (m_conddbtable.size() > n_column)
359  if (m_conddbtable[n_column]->type == kNull)
360  {
361  m_conddbtable[n_column]->type = type;
362 
363  switch (type)
364  {
365  case kBool:
366  {
367  CondDBColumnBool * tmpColumn = new CondDBColumnBool;
368  tmpColumn->type = m_conddbtable[n_column]->type;
369  tmpColumn->column.push_back(-1);
370  if ((m_conddbtable[n_column]->name.size()))
371  tmpColumn->name = m_conddbtable[n_column]->name;
372 
373  delete(m_conddbtable[n_column]);
374  m_conddbtable[n_column] = tmpColumn;
375  break;
376  }
377  case kInt:
378  {
379  CondDBColumnInt * tmpColumn = new CondDBColumnInt;
380  tmpColumn->type = m_conddbtable[n_column]->type;
381  tmpColumn->column.push_back(NULLINT);
382  if ((m_conddbtable[n_column]->name.size()))
383  tmpColumn->name = m_conddbtable[n_column]->name;
384  delete(m_conddbtable[n_column]);
385  m_conddbtable[n_column] = tmpColumn;
386  break;
387  }
388  case kLongLong:
389  {
390  CondDBColumnLong * tmpColumn = new CondDBColumnLong;
391  tmpColumn->type = m_conddbtable[n_column]->type;
392  tmpColumn->column.push_back(NULLLONG);
393  if ((m_conddbtable[n_column]->name.size()))
394  tmpColumn->name = m_conddbtable[n_column]->name;
395  delete(m_conddbtable[n_column]);
396  m_conddbtable[n_column] = tmpColumn;
397  break;
398  }
399 
400  case kFloat:
401  {
402  CondDBColumnFloat * tmpColumn = new CondDBColumnFloat;
403  tmpColumn->type = m_conddbtable[n_column]->type;
404  tmpColumn->column.push_back(NULLFLOAT);
405  if ((m_conddbtable[n_column]->name.size()))
406  tmpColumn->name = m_conddbtable[n_column]->name;
407  delete(m_conddbtable[n_column]);
408  m_conddbtable[n_column] = tmpColumn;
409  break;
410  }
411  case kString:
412  {
413  CondDBColumnString * tmpColumn = new CondDBColumnString;
414  tmpColumn->type = m_conddbtable[n_column]->type;
415  tmpColumn->column.push_back("NULL");
416  if ((m_conddbtable[n_column]->name.size()))
417  tmpColumn->name = m_conddbtable[n_column]->name;
418 
419  delete(m_conddbtable[n_column]);
420  m_conddbtable[n_column] = tmpColumn;
421  break;
422  }
423  case kDouble:
424  {
425  CondDBColumnDouble * tmpColumn = new CondDBColumnDouble;
426  tmpColumn->type = m_conddbtable[n_column]->type;
427  tmpColumn->column.push_back(NULLDOUBLE);
428  if ((m_conddbtable[n_column]->name.size()))
429  tmpColumn->name = m_conddbtable[n_column]->name;
430 
431  delete(m_conddbtable[n_column]);
432  m_conddbtable[n_column] = tmpColumn;
433  break;
434  }
435  case kArrayInt:
436  {
437  CondDBColumnArrayInt * tmpColumn = new CondDBColumnArrayInt;
438  tmpColumn->type = m_conddbtable[n_column]->type;
439  tmpColumn->column.push_back({NULLINT});
440  if ((m_conddbtable[n_column]->name.size()))
441  tmpColumn->name = m_conddbtable[n_column]->name;
442  delete(m_conddbtable[n_column]);
443  m_conddbtable[n_column] = tmpColumn;
444  break;
445  }
446  case kArrayLongLong:
447  {
449  tmpColumn->type = m_conddbtable[n_column]->type;
450  tmpColumn->column.push_back({NULLLONG});
451  if ((m_conddbtable[n_column]->name.size()))
452  tmpColumn->name = m_conddbtable[n_column]->name;
453  delete(m_conddbtable[n_column]);
454  m_conddbtable[n_column] = tmpColumn;
455  break;
456  }
457  case kArrayBool:
458  {
460  tmpColumn->type = m_conddbtable[n_column]->type;
461  tmpColumn->column.push_back({-1});
462  if ((m_conddbtable[n_column]->name.size()))
463  tmpColumn->name = m_conddbtable[n_column]->name;
464  delete(m_conddbtable[n_column]);
465  m_conddbtable[n_column] = tmpColumn;
466  break;
467  }
468  case kArrayFloat:
469  {
471  tmpColumn->type = m_conddbtable[n_column]->type;
472  tmpColumn->column.push_back({NULLFLOAT});
473  if ((m_conddbtable[n_column]->name.size()))
474  tmpColumn->name = m_conddbtable[n_column]->name;
475  delete(m_conddbtable[n_column]);
476  m_conddbtable[n_column] = tmpColumn;
477  break;
478  }
479  case kArrayString:
480  {
482  tmpColumn->type = m_conddbtable[n_column]->type;
484  tmp.push_back("NULL");
485  tmpColumn->column.push_back({"NULL"});
486  if ((m_conddbtable[n_column]->name.size()))
487  tmpColumn->name = m_conddbtable[n_column]->name;
488  delete(m_conddbtable[n_column]);
489  m_conddbtable[n_column] = tmpColumn;
490  break;
491  }
492  case kArrayDouble:
493  {
495  tmpColumn->type = m_conddbtable[n_column]->type;
496  tmpColumn->column.push_back({NULLDOUBLE});
497  if ((m_conddbtable[n_column]->name.size()))
498  tmpColumn->name = m_conddbtable[n_column]->name;
499  delete(m_conddbtable[n_column]);
500  m_conddbtable[n_column] = tmpColumn;
501  break;
502  }
503  default : break;
504  }
505 
506  if (m_conddbtable[n_column]->name.size() != 0)
507  {
508  m_conddbtable[n_column]->initialized = true;
510  }
511  }
512  else
513  return CDB_TYPE_ERROR;
514  else
515  return CDB_RANGE_ERROR;
516  return CDB_SUCCESS;
517 
518 }
519 
520 int GenericDbTable::setNull(unsigned n_column, const string &null)
521 {
522  if (!m_isInitialized)
523  return CDB_NOT_INITIALIZED;
524 
525  if (m_conddbtable.size() > n_column)
526  switch (m_conddbtable[n_column]->type)
527  {
528  case kString:
529  {
530  static_cast<CondDBColumnString*>(m_conddbtable[n_column])->column[0] = null;
531  return CDB_SUCCESS;
532  }
533  case kArrayString:
534  {
535  static_cast<CondDBColumnArrayString*>(m_conddbtable[n_column])->column[0] = vector<string> (1,null);
536  return CDB_SUCCESS;
537  }
538  case kFloat:
539  {
540  static_cast<CondDBColumnFloat*>(m_conddbtable[n_column])->column[0] = atof(null.c_str());
541  return CDB_SUCCESS;
542  }
543  case kArrayFloat:
544  {
545  static_cast<CondDBColumnArrayFloat*>(m_conddbtable[n_column])->column[0] = vector<float> (1,atof(null.c_str()));
546  return CDB_SUCCESS;
547  }
548  case kInt:
549  {
550  static_cast<CondDBColumnInt*>(m_conddbtable[n_column])->column[0] = atol(null.c_str());
551  return CDB_SUCCESS;
552  }
553  case kArrayInt:
554  {
555  static_cast<CondDBColumnArrayInt*>(m_conddbtable[n_column])->column[0] = vector<long int> (1,atol(null.c_str()));
556  return CDB_SUCCESS;
557  }
558  case kBool:
559  case kArrayBool:
560  {
561  return CDB_SUCCESS;
562  }
563  case kLongLong:
564  {
565  static_cast<CondDBColumnString*>(m_conddbtable[n_column])->column[0] = atoi64(null.c_str());
566  return CDB_SUCCESS;
567  }
568  case kArrayLongLong:
569  {
570  static_cast<CondDBColumnArrayLong*>(m_conddbtable[n_column])->column[0] = vector<int64> (1,atoi64(null.c_str()));
571  return CDB_SUCCESS;
572  }
573  case kDouble:
574  {
575  static_cast<CondDBColumnDouble*>(m_conddbtable[n_column])->column[0] = atof(null.c_str());
576  return CDB_SUCCESS;
577  }
578  case kArrayDouble:
579  {
580  static_cast<CondDBColumnArrayDouble*>(m_conddbtable[n_column])->column[0] = vector<double> (1,atof(null.c_str()));
581  return CDB_SUCCESS;
582  }
583  default:
584  return CDB_TYPE_ERROR;
585  }
586  else
587  return CDB_RANGE_ERROR;
588 }
589 
590 int GenericDbTable::setNull(unsigned n_column, const long int &null)
591 {
592  if (!m_isInitialized)
593  return CDB_NOT_INITIALIZED;
594 
595  if (m_conddbtable.size() > n_column)
596  if (m_conddbtable[n_column]->type == kInt)
597  {
598  static_cast<CondDBColumnInt*>(m_conddbtable[n_column])->column[0] = null;
599  return CDB_SUCCESS;
600  }
601  else if (m_conddbtable[n_column]->type == kArrayInt)
602  {
603  static_cast<CondDBColumnArrayInt*>(m_conddbtable[n_column])->column[0] = vector<long int> (1,null);
604  return CDB_SUCCESS;
605  }
606  else
607  return CDB_TYPE_ERROR;
608  else
609  return CDB_RANGE_ERROR;
610 }
611 
612 int GenericDbTable::setNull(unsigned n_column, const int64 &null)
613 {
614  if (!m_isInitialized)
615  return CDB_NOT_INITIALIZED;
616 
617  if (m_conddbtable.size() > n_column)
618  if (m_conddbtable[n_column]->type == kLongLong )
619  {
620  static_cast<CondDBColumnLong*>(m_conddbtable[n_column])->column[0] = null;
621  return CDB_SUCCESS;
622  }
623  else if (m_conddbtable[n_column]->type == kArrayLongLong)
624  {
625  static_cast<CondDBColumnArrayLong*>(m_conddbtable[n_column])->column[0] = vector<int64> (1,null);
626  return CDB_SUCCESS;
627  }
628  else
629  return CDB_TYPE_ERROR;
630  else
631  return CDB_RANGE_ERROR;
632 }
633 
634 int GenericDbTable::setNull(unsigned n_column, const float &null)
635 {
636  if (!m_isInitialized)
637  return CDB_NOT_INITIALIZED;
638 
639  if (m_conddbtable.size() > n_column)
640  if (m_conddbtable[n_column]->type == kFloat )
641  {
642  static_cast<CondDBColumnFloat*>(m_conddbtable[n_column])->column[0] = null;
643  return CDB_SUCCESS;
644  }
645  else if (m_conddbtable[n_column]->type == kArrayFloat)
646  {
647  static_cast<CondDBColumnArrayFloat*>(m_conddbtable[n_column])->column[0] = vector<float> (1,null);
648  return CDB_SUCCESS;
649  }
650  else
651  return CDB_TYPE_ERROR;
652  else
653  return CDB_RANGE_ERROR;
654 }
655 
656 int GenericDbTable::setNull(unsigned n_column, const double &null)
657 {
658  if (!m_isInitialized)
659  return CDB_NOT_INITIALIZED;
660 
661  if (m_conddbtable.size() > n_column)
662  if (m_conddbtable[n_column]->type == kDouble || m_conddbtable[n_column]->type == kArrayDouble)
663  {
664  static_cast<CondDBColumnDouble*>(m_conddbtable[n_column])->column[0] = null;
665  return CDB_SUCCESS;
666  }
667  else if (m_conddbtable[n_column]->type == kArrayDouble)
668  {
669  static_cast<CondDBColumnArrayDouble*>(m_conddbtable[n_column])->column[0] = vector<double> (1, null);
670  return CDB_SUCCESS;
671  }
672  else
673  return CDB_TYPE_ERROR;
674  else
675  return CDB_RANGE_ERROR;
676 }
677 
678 
679 // getCell - getting the value of a cell.
680 
681 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, long int &ndata) const
682 {
683  CondDBColumnInt *tmpColumn = static_cast<CondDBColumnInt*>(m_conddbtable[n_column]);
684  return __getCell(n_column, n_row, ndata, kInt, tmpColumn);
685 }
686 
687 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, short int &ndata) const
688 {
689  CondDBColumnBool *tmpColumn = static_cast<CondDBColumnBool*>(m_conddbtable[n_column]);
690  return __getCell(n_column, n_row, ndata, kBool, tmpColumn);
691 }
692 
693 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, int64 &ndata) const
694 {
695  CondDBColumnLong *tmpColumn = static_cast<CondDBColumnLong*>(m_conddbtable[n_column]);
696  return __getCell(n_column, n_row, ndata, kLongLong, tmpColumn);
697 }
698 
699 
700 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, float &ndata) const
701 {
702  CondDBColumnFloat *tmpColumn = static_cast<CondDBColumnFloat*>(m_conddbtable[n_column]);
703  return __getCell(n_column, n_row, ndata, kFloat, tmpColumn);
704 }
705 
706 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, string &ndata) const
707 {
708 
709  int status;
710 
711  if (!m_isInitialized)
712  return CDB_NOT_INITIALIZED;
713 
714  if ((m_numRows > n_row) && (m_conddbtable.size() > n_column))
715  {
716  if (m_conddbtable[n_column]->type == kString) {
717  CondDBColumnString *tmpColumn = static_cast<CondDBColumnString*>(m_conddbtable[n_column]);
718  return __getCell(n_column, n_row, ndata, kString, tmpColumn);
719  }
720  else {
721  switch(m_conddbtable[n_column]->type)
722  {
723  case kInt:
724  {
725  long int aux;
726  CondDBColumnInt *tmpColumn = static_cast<CondDBColumnInt*>(m_conddbtable[n_column]);
727  status = __getCell(n_column, n_row, aux , kInt, tmpColumn);
728  if (status == CDB_SUCCESS)
729  ndata = ToString(aux);
730  break;
731  }
732  case kBool:
733  {
734  short int aux;
735  CondDBColumnBool *tmpColumn = static_cast<CondDBColumnBool*>(m_conddbtable[n_column]);
736  status = __getCell(n_column, n_row, aux, kBool, tmpColumn);
737  if (status == CDB_SUCCESS)
738  ndata = ToString(aux);
739  break;
740  }
741 
742  case kLongLong:
743  {
744  long long aux;
745  CondDBColumnLong *tmpColumn = static_cast<CondDBColumnLong*>(m_conddbtable[n_column]);
746  status = __getCell(n_column,n_row, aux, kLongLong, tmpColumn);
747  if (status == CDB_SUCCESS)
748  ndata = ToString(aux);
749  break;
750  }
751  case kFloat:
752  {
753  float aux;
754 
755  CondDBColumnFloat *tmpColumn = static_cast<CondDBColumnFloat*>(m_conddbtable[n_column]);
756  status = __getCell(n_column,n_row, aux, kFloat, tmpColumn);
757  if (status == CDB_SUCCESS)
758  ndata = ToString(aux);
759  break;
760  }
761  case kDouble:
762  {
763  double aux;
764  CondDBColumnDouble *tmpColumn = static_cast<CondDBColumnDouble*>(m_conddbtable[n_column]);
765  status = __getCell(n_column,n_row,aux,kDouble, tmpColumn);
766  if (status == CDB_SUCCESS)
767  ndata = ToString(aux);
768  break;
769  }
770  //if the column is of the type array of *type* one should use the method with vector of strings
771  default:
772  return CDB_STRTOARRAY_ERROR;
773  }
774  }
775  }
776  else
777  return CDB_RANGE_ERROR;
778 
779  return status;
780 
781 }
782 
783 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, double &ndata) const
784 {
785  CondDBColumnDouble *tmpColumn = static_cast<CondDBColumnDouble*>(m_conddbtable[n_column]);
786  return __getCell(n_column, n_row, ndata, kDouble, tmpColumn);
787 }
788 
789 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, vector<long int> &ndata) const
790 {
791  CondDBColumnArrayInt *tmpColumn = static_cast<CondDBColumnArrayInt*>(m_conddbtable[n_column]);
792  return __getCell(n_column, n_row, ndata, kArrayInt, tmpColumn);
793 }
794 
795 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, vector<short int> &ndata) const
796 {
797  CondDBColumnArrayBool *tmpColumn = static_cast<CondDBColumnArrayBool*>(m_conddbtable[n_column]);
798  return __getCell(n_column, n_row, ndata, kArrayBool, tmpColumn);
799 }
800 
801 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, vector<int64> &ndata) const
802 {
803  CondDBColumnArrayLong *tmpColumn = static_cast<CondDBColumnArrayLong*>(m_conddbtable[n_column]);
804  return __getCell(n_column, n_row, ndata, kArrayLongLong, tmpColumn);
805 }
806 
807 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, vector<float> &ndata) const
808 {
809  CondDBColumnArrayFloat *tmpColumn = static_cast<CondDBColumnArrayFloat*>(m_conddbtable[n_column]);
810  return __getCell(n_column, n_row, ndata, kArrayFloat, tmpColumn);
811 }
812 
813 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, vector<string> &ndata) const
814 {
815  CondDBColumnArrayString *tmpColumn = static_cast<CondDBColumnArrayString*>(m_conddbtable[n_column]);
816  return __getCell(n_column, n_row, ndata, kArrayString, tmpColumn);
817 }
818 
819 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, vector<double> &ndata) const
820 {
821  CondDBColumnArrayDouble *tmpColumn = static_cast<CondDBColumnArrayDouble*>(m_conddbtable[n_column]);
822  return __getCell(n_column, n_row, ndata, kArrayDouble, tmpColumn);
823 }
824 
826 // New access methods
828 
829 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, short int &data) const
830 {
831  return __getCellByName(colName,n_row,data);
832 }
833 
834 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, long int &data) const
835 {
836 return __getCellByName<long int>(colName, n_row, data);
837 }
838 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, int64 &data) const
839 {
840  return __getCellByName<int64>(colName, n_row, data);
841 }
842 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, float &data) const
843 {
844  return __getCellByName<float>(colName,n_row,data);
845 }
846 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, double &data) const
847 {
848  return __getCellByName<double>(colName, n_row, data);
849 }
850 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, std::string &data) const
851 {
852  return __getCellByName<std::string>(colName, n_row, data);
853 }
854 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, std::vector<short int> &data) const
855 {
856  return __getCellByName< std::vector<short int> >(colName, n_row, data);
857 }
858 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, std::vector<long int> &data) const
859 {
860  return __getCellByName<std::vector<long int> >(colName, n_row, data);
861 }
862 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, std::vector<int64> &data) const
863 {
864  return __getCellByName<std::vector<int64> >(colName, n_row, data);
865 }
866 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, std::vector<float> &data) const
867 {
868  return __getCellByName<std::vector<float> >(colName, n_row, data);
869 }
870 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, std::vector<double> &data) const
871 {
872  return __getCellByName<std::vector<double> >(colName, n_row, data);
873 }
874 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, std::vector<string> &data) const
875 {
876  return __getCellByName<std::vector<string> >(colName, n_row, data);
877 }
878 
880 // data insertion members
882 
883 // public members
884 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const long int ndata)
885 {
886  CondDBColumnInt *tmpColumn = static_cast<CondDBColumnInt*>(m_conddbtable[n_column]);
887  return __setCell(n_column, n_row, ndata, kInt, tmpColumn);
888 }
889 
890 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const short int ndata)
891 {
892  CondDBColumnBool *tmpColumn = static_cast<CondDBColumnBool*>(m_conddbtable[n_column]);
893  return __setCell(n_column, n_row, ndata, kBool, tmpColumn);
894 }
895 
896 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const int64 ndata)
897 {
898  CondDBColumnLong *tmpColumn = static_cast<CondDBColumnLong*>(m_conddbtable[n_column]);
899  return __setCell(n_column, n_row, ndata, kLongLong, tmpColumn);
900 }
901 
902 int GenericDbTable::setCell(unsigned n_column, unsigned n_row,const float ndata)
903 {
904  CondDBColumnFloat *tmpColumn = static_cast<CondDBColumnFloat*>(m_conddbtable[n_column]);
905  return __setCell(n_column, n_row, ndata, kFloat, tmpColumn);
906 }
907 
908 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const std::string& ndata)
909 {
910 
911  if (!m_isInitialized)
912  return CDB_NOT_INITIALIZED;
913 
914  if ((m_numRows > n_row) && (m_conddbtable.size() > n_column))
915  {
916  if (m_conddbtable[n_column]->type == kString)
917  {
918  CondDBColumnString *tmpColumn = static_cast<CondDBColumnString*>(m_conddbtable[n_column]);
919  __setCell(n_column, n_row, ndata, kString, tmpColumn);
920  }
921  else
922  {
923  switch(m_conddbtable[n_column]->type)
924  {
925  case kInt:
926  {
927  if (ndata=="NULL")
928  {
929  CondDBColumnInt *tmpColumn = static_cast<CondDBColumnInt*>(m_conddbtable[n_column]);
930  __setCell(n_column, n_row, tmpColumn->column[0], kInt, tmpColumn);
931  }
932  else
933  {
934  CondDBColumnInt *tmpColumn = static_cast<CondDBColumnInt*>(m_conddbtable[n_column]);
935  __setCell(n_column, n_row, atol(ndata.c_str()), kInt, tmpColumn);
936  }
937  break;
938  }
939  case kBool:
940  {
941  if (ndata=="NULL")
942  {
943  CondDBColumnBool *tmpColumn = static_cast<CondDBColumnBool*>(m_conddbtable[n_column]);
944  __setCell(n_column,n_row, tmpColumn->column[0], kBool, tmpColumn);
945 
946  }
947  else
948  {
949  CondDBColumnBool *tmpColumn = static_cast<CondDBColumnBool*>(m_conddbtable[n_column]);
950  __setCell(n_column, n_row, atoi(ndata.c_str()), kBool, tmpColumn);
951  }
952  break;
953  }
954  case kLongLong:
955  {
956  if (ndata=="NULL")
957  {
958  CondDBColumnLong *tmpColumn = static_cast<CondDBColumnLong*>(m_conddbtable[n_column]);
959  __setCell(n_column,n_row, tmpColumn->column[0], kLongLong, tmpColumn);
960  }
961  else
962  {
963  CondDBColumnLong *tmpColumn = static_cast<CondDBColumnLong*>(m_conddbtable[n_column]);
964  __setCell(n_column,n_row, atoi64(ndata.c_str()), kLongLong, tmpColumn);
965  }
966  break;
967  }
968  case kFloat:
969  {
970  if (ndata=="NULL")
971  {
972  CondDBColumnFloat *tmpColumn = static_cast<CondDBColumnFloat*>(m_conddbtable[n_column]);
973  __setCell(n_column,n_row, tmpColumn->column[0], kFloat, tmpColumn);
974  }
975  else
976  {
977  CondDBColumnFloat *tmpColumn = static_cast<CondDBColumnFloat*>(m_conddbtable[n_column]);
978  __setCell(n_column,n_row, strtod(ndata.c_str(), (char **)NULL), kFloat, tmpColumn);
979  }
980  break;
981  }
982  case kDouble:
983  {
984  if (ndata=="NULL")
985  {
986  CondDBColumnDouble *tmpColumn = static_cast<CondDBColumnDouble*>(m_conddbtable[n_column]);
987  __setCell(n_column,n_row, tmpColumn->column[0],kDouble, tmpColumn);
988  }
989  else
990  {
991  CondDBColumnDouble *tmpColumn = static_cast<CondDBColumnDouble*>(m_conddbtable[n_column]);
992  __setCell(n_column,n_row,strtod(ndata.c_str(), (char **)NULL),kDouble, tmpColumn);
993  }
994  break;
995  }
996  //if the column is of the type array of *type* one should use the method with vector of strings
997  default:
998  return CDB_STRTOARRAY_ERROR;
999  }
1000  }
1001  }
1002  else
1003  return CDB_RANGE_ERROR;
1004  return CDB_SUCCESS;
1005 }
1006 
1007 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const double ndata)
1008 {
1009  CondDBColumnDouble *tmpColumn = static_cast<CondDBColumnDouble*>(m_conddbtable[n_column]);
1010  return __setCell(n_column, n_row, ndata, kDouble, tmpColumn);
1011 }
1012 
1013 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const vector<short int> &ndata)
1014 {
1015  CondDBColumnArrayBool *tmpColumn = static_cast<CondDBColumnArrayBool*>(m_conddbtable[n_column]);
1016  return __setCell(n_column, n_row, ndata, kArrayBool, tmpColumn);
1017 }
1018 
1019 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const vector<long int> &ndata)
1020 {
1021  CondDBColumnArrayInt *tmpColumn = static_cast<CondDBColumnArrayInt*>(m_conddbtable[n_column]);
1022  return __setCell(n_column, n_row, ndata, kArrayInt, tmpColumn);
1023 }
1024 
1025 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const vector<int64> &ndata)
1026 {
1027  CondDBColumnArrayLong *tmpColumn = static_cast<CondDBColumnArrayLong*>(m_conddbtable[n_column]);
1028  return __setCell(n_column, n_row, ndata, kArrayLongLong, tmpColumn);
1029 }
1030 
1031 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const vector<float> &ndata)
1032 {
1033  CondDBColumnArrayFloat *tmpColumn = static_cast<CondDBColumnArrayFloat*>(m_conddbtable[n_column]);
1034  return __setCell(n_column, n_row, ndata, kArrayFloat, tmpColumn);
1035 }
1036 
1037 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const vector<double> &ndata)
1038 {
1039  CondDBColumnArrayDouble *tmpColumn = static_cast<CondDBColumnArrayDouble*>(m_conddbtable[n_column]);
1040  return __setCell(n_column, n_row, ndata, kArrayDouble, tmpColumn);
1041 }
1042 
1043 
1044 // nbarros: necessario refazer!!!
1045 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const vector<string> &ndata)
1046 {
1047 
1048  if (!m_isInitialized)
1049  return CDB_NOT_INITIALIZED;
1050 
1051  if ((m_numRows > n_row) && (m_conddbtable.size() > n_column))
1052  {
1053  if (m_conddbtable[n_column]->type == kArrayString)
1054  {
1055  CondDBColumnArrayString *tmpColumn = static_cast<CondDBColumnArrayString*>(m_conddbtable[n_column]);
1056  return __setCell(n_column, n_row, ndata, kArrayString, tmpColumn);
1057 // static_cast<CondDBColumnArrayString*>(m_conddbtable[n_column])->column[n_row+1] = ndata;
1058  }
1059  else
1060  {
1061  switch(m_conddbtable[n_column]->type)
1062  {
1063  case kArrayInt:
1064  {
1065  vector<long int> tmp;
1066  for (unsigned i=0; i<ndata.size(); i++)
1067  {
1068  if (ndata[i]=="NULL")
1069  {
1070  long int null;
1071  getNull(n_column, null);
1072  tmp.push_back(null);
1073  }
1074  else
1075  tmp.push_back(atol(ndata[i].c_str()));
1076  }
1077  CondDBColumnArrayInt *tmpColumn = static_cast<CondDBColumnArrayInt*>(m_conddbtable[n_column]);
1078  return __setCell(n_column, n_row, tmp, kArrayInt, tmpColumn);
1079  break;
1080  }
1081  case kArrayBool:
1082  {
1083  vector<short int> tmp;
1084  for (unsigned i=0; i<ndata.size(); i++)
1085  {
1086  if (ndata[i]=="NULL")
1087  {
1088  tmp.push_back(-1);
1089  }
1090  else
1091  tmp.push_back(atoi(ndata[i].c_str()));
1092  }
1093  CondDBColumnArrayBool *tmpColumn = static_cast<CondDBColumnArrayBool*>(m_conddbtable[n_column]);
1094  return __setCell(n_column, n_row, tmp, kArrayBool, tmpColumn);
1095  break;
1096  }
1097  case kArrayLongLong:
1098  {
1099  vector<int64> tmp;
1100  for (unsigned i=0; i<ndata.size(); i++)
1101  {
1102  if (ndata[i]=="NULL")
1103  {
1104  int64 null;
1105  getNull(n_column, null);
1106  tmp.push_back(null);
1107  }
1108  else
1109 
1110  tmp.push_back(atoi64(ndata[i].c_str()));
1111  }
1112  CondDBColumnArrayLong *tmpColumn = static_cast<CondDBColumnArrayLong*>(m_conddbtable[n_column]);
1113  return __setCell(n_column, n_row, tmp, kArrayLongLong, tmpColumn);
1114  break;
1115  }
1116  case kArrayFloat:
1117  {
1119  for (unsigned i=0; i<ndata.size(); i++)
1120  {
1121  if (ndata[i]=="NULL")
1122  {
1123  float null;
1124  getNull(n_column, null);
1125  tmp.push_back(null);
1126  }
1127  else
1128  tmp.push_back(atof(ndata[i].c_str()));
1129  }
1130  CondDBColumnArrayFloat *tmpColumn = static_cast<CondDBColumnArrayFloat*>(m_conddbtable[n_column]);
1131  return __setCell(n_column, n_row, tmp, kArrayFloat, tmpColumn);
1132  break;
1133  }
1134  case kArrayDouble:
1135  {
1137  for (unsigned i=0; i<ndata.size(); i++)
1138  {
1139  if (ndata[i]=="NULL")
1140  {
1141  double null;
1142  getNull(n_column, null);
1143  tmp.push_back(null);
1144  }
1145  else
1146  tmp.push_back(strtod(ndata[i].c_str(), (char**)NULL));
1147  }
1148  CondDBColumnArrayDouble *tmpColumn = static_cast<CondDBColumnArrayDouble*>(m_conddbtable[n_column]);
1149  return __setCell(n_column, n_row, tmp, kArrayDouble, tmpColumn);
1150  break;
1151  }
1152  //if the column is of the type array of *type* one should use the method with vector of strings
1153  default:
1154  return CDB_STRTOARRAY_ERROR;
1155  }
1156  }
1157  }
1158  else
1159  return CDB_RANGE_ERROR;
1160  return CDB_SUCCESS;
1161 }
1162 
1164 // setData members - append data to columns.
1165 //
1166 // Return the number of elements of the vector passed that have been appended to the column
1167 // or an error code.
1169 
1170 
1171 // data type specific members (public)
1172 int GenericDbTable::setColumndata(unsigned n_column,const vector<long int> &data)
1173 {
1174  CondDBColumnInt *tmpColumn = static_cast<CondDBColumnInt*>(m_conddbtable[n_column]);
1175  return __setColumnData(n_column, data, kInt, tmpColumn);
1176 }
1177 
1178 int GenericDbTable::setColumndata(unsigned n_column, const vector<int64> &data)
1179 {
1180  CondDBColumnLong *tmpColumn = static_cast<CondDBColumnLong*>(m_conddbtable[n_column]);
1181  return __setColumnData(n_column, data, kLongLong, tmpColumn);
1182 }
1183 
1184 int GenericDbTable::setColumndata(unsigned n_column, const vector<short int> &data)
1185 {
1186  CondDBColumnBool *tmpColumn = static_cast<CondDBColumnBool*>(m_conddbtable[n_column]);
1187  return __setColumnData(n_column, data, kBool, tmpColumn);
1188 }
1189 
1190 int GenericDbTable::setColumndata(unsigned n_column, const vector<float> &data)
1191 {
1192  CondDBColumnFloat *tmpColumn = static_cast<CondDBColumnFloat*>(m_conddbtable[n_column]);
1193  return __setColumnData(n_column, data, kFloat, tmpColumn);
1194 }
1195 
1196 int GenericDbTable::setColumndata(unsigned n_column, const vector<string> &data)
1197 {
1198 
1199  if (!m_isInitialized)
1200  return CDB_NOT_INITIALIZED;
1201 
1202  unsigned index = 0;
1203  if (n_column < m_conddbtable.size())
1204  {
1205  if (m_conddbtable[n_column]->type == kString)
1206  {
1207  CondDBColumnString* tmpColumn = static_cast<CondDBColumnString*>(m_conddbtable[n_column]);
1208  while((tmpColumn->column.size() < m_numRows+1) && (index < data.size()))
1209  {
1210  tmpColumn->column.push_back(data[index]);
1211  index++;
1212  }
1213  return index;
1214  }
1215  else
1216  {
1217 // If the data type is not string we can convert the string to the corresponding type
1218  switch(m_conddbtable[n_column]->type)
1219  {
1220 //if the column data type is some kind of array it will be assumed that all values belong to a single cell thus returning 1(cell)
1221  case kArrayInt:
1222  {
1223  vector<long int> tmp;
1224  for (unsigned i=0; i<data.size(); i++)
1225  {
1226  if (data[i]=="NULL")
1227  {
1228  long int null;
1229  getNull(n_column, null);
1230  tmp.push_back(null);
1231  }
1232  else
1233  tmp.push_back(atol(data[i].c_str()));
1234  }
1235  index= setColumndata(n_column, tmp);
1236  break;
1237  }
1238  case kArrayBool:
1239  {
1240  vector<short int> tmp;
1241  for (unsigned i=0; i<data.size(); i++)
1242  {
1243  if (data[i]=="NULL")
1244  {
1245  short int null = -1;
1246  tmp.push_back(null);
1247  }
1248  else
1249  tmp.push_back(atoi(data[i].c_str()));
1250  }
1251  index = setColumndata(n_column, tmp);
1252  break;
1253  }
1254  case kArrayLongLong:
1255  {
1256  vector<int64> tmp;
1257  for (unsigned i=0; i<data.size(); i++)
1258  {
1259  if (data[i]=="NULL")
1260  {
1261  int64 null;
1262  getNull(n_column, null);
1263  tmp.push_back(null);
1264  }
1265  else
1266  tmp.push_back(atoi64(data[i].c_str()));
1267  }
1268  index = setColumndata(n_column, tmp);
1269  break;
1270  }
1271  case kArrayFloat:
1272  {
1274  for (unsigned i=0; i<data.size(); i++)
1275  {
1276  if (data[i]=="NULL")
1277  {
1278  float null;
1279  getNull(n_column, null);
1280  tmp.push_back(null);
1281  }
1282  else
1283  tmp.push_back(atof(data[i].c_str()));
1284  }
1285  index = setColumndata(n_column, tmp);
1286  break;
1287  }
1288  case kArrayDouble:
1289  {
1291  for (unsigned i=0; i<data.size(); i++)
1292  {
1293  if (data[i]=="NULL")
1294  {
1295  double null;
1296  getNull(n_column, null);
1297  tmp.push_back(null);
1298  }
1299  else
1300  tmp.push_back(strtod(data[i].c_str(), (char**)NULL));
1301  }
1302  index = setColumndata(n_column, tmp);
1303  break;
1304  }
1305 //If the column data type is not any array it will be inserted a value in each row!
1306  case kInt:
1307  {
1308  vector<long int> tmp;
1309  for (unsigned i=0; i<data.size(); i++)
1310  {
1311  if (data[i]=="NULL")
1312  {
1313  long int null;
1314  getNull(n_column, null);
1315  tmp.push_back(null);
1316  }
1317  else
1318  tmp.push_back(atol(data[i].c_str()));
1319  }
1320  index = setColumndata(n_column, tmp);
1321  break;
1322  }
1323  case kBool:
1324  {
1325  vector<short int> tmp;
1326  for (unsigned i=0; i<data.size(); i++)
1327  {
1328  if (data[i]=="NULL")
1329  {
1330  // for bool the null value is -1 (not editable by user)
1331  short int null = -1;
1332  tmp.push_back(null);
1333  }
1334  else
1335  tmp.push_back(atoi(data[i].c_str()));
1336  }
1337  index = setColumndata(n_column, tmp);
1338  break;
1339  }
1340  case kLongLong:
1341  {
1342  vector<int64> tmp;
1343  for (unsigned i=0; i<data.size(); i++)
1344  {
1345  if (data[i]=="NULL")
1346  {
1347  int64 null;
1348  getNull(n_column, null);
1349  tmp.push_back(null);
1350  }
1351  else
1352  tmp.push_back(atoi64(data[i].c_str()));
1353  }
1354  index = setColumndata(n_column, tmp);
1355  break;
1356  }
1357  case kFloat:
1358  {
1360  for (unsigned i=0; i<data.size(); i++)
1361  {
1362  if (data[i]=="NULL")
1363  {
1364  float null;
1365  getNull(n_column, null);
1366  tmp.push_back(null);
1367  }
1368  else
1369  tmp.push_back(atof(data[i].c_str()));
1370  }
1371  index = setColumndata(n_column, tmp);
1372  break;
1373  }
1374  case kDouble:
1375  {
1377  for (unsigned i=0; i<data.size(); i++)
1378  {
1379  if (data[i]=="NULL")
1380  {
1381  double null;
1382  getNull(n_column, null);
1383  tmp.push_back(null);
1384  }
1385  else
1386  tmp.push_back(strtod(data[i].c_str(), (char**)NULL));
1387  }
1388  index = setColumndata(n_column, tmp);
1389  break;
1390  }
1391  default:
1392  return CDB_STRTOARRAY_ERROR;
1393  }
1394 
1395  return index;
1396  }
1397  }
1398  else
1399  return CDB_RANGE_ERROR;
1400 }
1401 
1402 int GenericDbTable::setColumndata(unsigned n_column, const vector<double> &data)
1403 {
1404  CondDBColumnDouble *tmpColumn = static_cast<CondDBColumnDouble*>(m_conddbtable[n_column]);
1405  return __setColumnData(n_column, data, kDouble, tmpColumn);
1406 }
1407 
1408 int GenericDbTable::setColumndata(unsigned n_column, const vector<vector<long int> > &data)
1409 {
1410  CondDBColumnArrayInt *tmpColumn = static_cast<CondDBColumnArrayInt*>(m_conddbtable[n_column]);
1411  return __setColumnData(n_column, data, kArrayInt, tmpColumn);
1412 }
1413 
1414 int GenericDbTable::setColumndata(unsigned n_column, const vector<vector<int64> > &data)
1415 {
1416  CondDBColumnArrayLong *tmpColumn = static_cast<CondDBColumnArrayLong*>(m_conddbtable[n_column]);
1417  return __setColumnData(n_column, data, kArrayLongLong, tmpColumn);
1418 }
1419 
1420 int GenericDbTable::setColumndata(unsigned n_column, const vector<vector<short int> > &data)
1421 {
1422  CondDBColumnArrayBool *tmpColumn = static_cast<CondDBColumnArrayBool*>(m_conddbtable[n_column]);
1423  return __setColumnData(n_column, data, kArrayBool, tmpColumn);
1424 }
1425 
1426 int GenericDbTable::setColumndata(unsigned n_column, const vector<vector<float> > &data)
1427 {
1428  CondDBColumnArrayFloat *tmpColumn = static_cast<CondDBColumnArrayFloat*>(m_conddbtable[n_column]);
1429  return __setColumnData(n_column, data, kArrayFloat, tmpColumn);
1430 }
1431 
1432 int GenericDbTable::setColumndata(unsigned n_column, const vector<vector<double> > &data)
1433 {
1434  CondDBColumnArrayDouble *tmpColumn = static_cast<CondDBColumnArrayDouble*>(m_conddbtable[n_column]);
1435  return __setColumnData(n_column, data, kArrayDouble, tmpColumn);
1436 }
1437 
1438 int GenericDbTable::setColumndata(unsigned n_column, const vector<vector<string> > &data)
1439 {
1440  if (!m_isInitialized)
1441  return CDB_NOT_INITIALIZED;
1442 
1443  unsigned index = 0;
1444  if (n_column < m_conddbtable.size())
1445  {
1446  if (m_conddbtable[n_column]->type == kArrayString)
1447  {
1448  CondDBColumnArrayString* tmpColumn = static_cast<CondDBColumnArrayString*>(m_conddbtable[n_column]);
1449  while((tmpColumn->column.size() < m_numRows+1) && (index < data.size()))
1450  {
1451  tmpColumn->column.push_back(data[index]);
1452  index++;
1453  }
1454  return index;
1455  }
1456  else
1457  {
1458 // If the data type is not string we can convert the string to the corresponding type
1459  switch(m_conddbtable[n_column]->type)
1460  {
1461 //if the column data type is an array of any type each inner vector refers to a vector on a cell
1462  case kArrayInt:
1463  {
1464  vector<vector<long int> > aux;
1465  for (unsigned j=0; j<data.size(); j++)
1466  {
1467  vector<long int> tmp;
1468  for (unsigned i=0; i<data[j].size(); i++)
1469  {
1470  if (data[j][i]=="NULL")
1471  {
1472  long int null;
1473  getNull(n_column, null);
1474  tmp.push_back(null);
1475  }
1476  else
1477  tmp.push_back(atol(data[j][i].c_str()));
1478  }
1479  aux.push_back(std::move(tmp));
1480  }
1481  index = setColumndata(n_column, aux);
1482  break;
1483  }
1484  case kArrayLongLong:
1485  {
1486  vector<vector<int64> > aux;
1487  for (unsigned j=0; j<data.size(); j++)
1488  {
1489  vector<int64> tmp;
1490  for (unsigned i=0; i<data[j].size(); i++)
1491  {
1492  if (data[j][i]=="NULL")
1493  {
1494  int64 null;
1495  getNull(n_column, null);
1496  tmp.push_back(null);
1497  }
1498  else
1499  tmp.push_back(atoi64(data[j][i].c_str()));
1500  }
1501  aux.push_back(std::move(tmp));
1502  }
1503  index = setColumndata(n_column, aux);
1504  break;
1505  }
1506  case kArrayBool:
1507  {
1508  vector<vector<short int> > aux;
1509  for (unsigned j=0; j<data.size(); j++)
1510  {
1511  vector<short int> tmp;
1512  for (unsigned i=0; i<data[j].size(); i++)
1513  {
1514  if (data[j][i]=="NULL")
1515  {
1516  tmp.push_back(-1);
1517  }
1518  else
1519  tmp.push_back(atoi(data[j][i].c_str()));
1520  }
1521  aux.push_back(std::move(tmp));
1522  }
1523  index = setColumndata(n_column, aux);
1524  break;
1525  }
1526  case kArrayFloat:
1527  {
1528  vector<vector<float> > aux;
1529  for (unsigned j=0; j<data.size(); j++)
1530  {
1532  for (unsigned i=0; i<data[j].size(); i++)
1533  {
1534  if (data[j][i]=="NULL")
1535  {
1536  float null;
1537  getNull(n_column, null);
1538  tmp.push_back(null);
1539  }
1540  else
1541  tmp.push_back(atof(data[j][i].c_str()));
1542  }
1543  aux.push_back(std::move(tmp));
1544  }
1545  index = setColumndata(n_column, aux);
1546  break;
1547  }
1548  case kArrayDouble:
1549  {
1550  vector<vector<double> > aux;
1551  for (unsigned j=0; j<data.size(); j++)
1552  {
1554  for (unsigned i=0; i<data[j].size(); i++)
1555  {
1556  if (data[j][i]=="NULL")
1557  {
1558  double null;
1559  getNull(n_column, null);
1560  tmp.push_back(null);
1561  }
1562  else
1563  tmp.push_back(strtod(data[j][i].c_str(), (char**)NULL));
1564  }
1565  aux.push_back(std::move(tmp));
1566  }
1567  index = setColumndata(n_column, aux);
1568  break;
1569  }
1570  default:
1571  return CDB_STRTOARRAY_ERROR;
1572  }
1573  return index;
1574  }
1575  }
1576  else
1577  return CDB_RANGE_ERROR;
1578 
1579 }
1580 
1582 // resize() - realocates space for table.
1583 //
1584 // The number of rows is the number of new rows to allocate
1586 
1587 void GenericDbTable::resize(int num_rows)
1588 {
1589  m_numRows += num_rows;
1590 }
1591 
1593 // getRow() - return a vector of strings with the values of a row
1594 //
1595 // it returns an error code *TO BE IMPLEMENTED*
1597 int GenericDbTable::getRow(unsigned n_row, vector<string> &values) const
1598 {
1599  if (n_row < m_numRows)
1600  {
1601  for (unsigned i =0; i<m_conddbtable.size(); i++)
1602  {
1603  switch(m_conddbtable[i]->type)
1604  {
1605  case kInt:
1606  {
1607  long int tmp;
1608  getCell(i,n_row, tmp);
1609  values.push_back(ToString<long int>(tmp));
1610  break;
1611  }
1612  case kBool:
1613  {
1614  short int tmp;
1615  getCell(i,n_row, tmp);
1616  values.push_back(ToString<short int>(tmp));
1617  break;
1618  }
1619  case kLongLong:
1620  {
1621  int64 tmp;
1622  getCell(i,n_row, tmp);
1623  values.push_back(ToString<int64>(tmp));
1624  break;
1625  }
1626  case kFloat:
1627  {
1628  float tmp;
1629  getCell(i,n_row, tmp);
1630  values.push_back(ToString<float>(tmp));
1631  break;
1632 
1633  }
1634  case kString:
1635  {
1636  string tmp;
1637  getCell(i,n_row, tmp);
1638  values.push_back(ToString<string>(tmp));
1639  break;
1640 
1641  }
1642  case kDouble:
1643  {
1644  double tmp;
1645  getCell(i,n_row, tmp);
1646  values.push_back(ToString<double>(tmp));
1647  break;
1648 
1649  }
1650  case kArrayInt:
1651  {
1652  vector<long int> tmp;
1653  getCell(i,n_row, tmp);
1654  int size = tmp.size();
1655  values.push_back(ToString<int>(size));
1656  while(size)
1657  {
1658  values.push_back(ToString<long int>(tmp[size-1]));
1659  size--;
1660  }
1661  break;
1662 
1663  }
1664  case kArrayBool:
1665  {
1666  vector<short int> tmp;
1667  getCell(i,n_row, tmp);
1668  int size = tmp.size();
1669  values.push_back(ToString<int>(size));
1670  while(size)
1671  {
1672  values.push_back(ToString<short int>(tmp[size-1]));
1673  size--;
1674  }
1675  break;
1676 
1677  }
1678  case kArrayLongLong:
1679  {
1680  vector<int64> tmp;
1681  getCell(i,n_row, tmp);
1682  int size = tmp.size();
1683  values.push_back(ToString<int>(size));
1684  while(size)
1685  {
1686  values.push_back(ToString<int64>(tmp[size-1]));
1687  size--;
1688  }
1689  break;
1690 
1691  }
1692  case kArrayFloat:
1693  {
1695  getCell(i,n_row, tmp);
1696  int size = tmp.size();
1697  values.push_back(ToString<int>(size));
1698  while(size)
1699  {
1700  values.push_back(ToString<float>(tmp[size-1]));
1701  size--;
1702  }
1703  break;
1704 
1705  }
1706  case kArrayString:
1707  {
1709  getCell(i,n_row, tmp);
1710  int size = tmp.size();
1711  values.push_back(ToString<int>(size));
1712  while(size)
1713  {
1714  values.push_back(tmp[size-1]);
1715  size--;
1716  }
1717  break;
1718  }
1719  case kArrayDouble:
1720  {
1722  getCell(i,n_row, tmp);
1723  int size = tmp.size();
1724  values.push_back(ToString<int>(size));
1725  while(size)
1726  {
1727  values.push_back(ToString<double>(tmp[size-1]));
1728  size--;
1729  }
1730  break;
1731  }
1732  default: return CDB_TYPE_ERROR;
1733  }
1734  }
1735 
1736  }
1737  else
1738  return CDB_RANGE_ERROR;
1739 // sucess!
1740  return CDB_SUCCESS;
1741 }
1742 
1743 // verifies if all columns are intialized
1745 {
1746  bool aux = true;
1747 
1748  for (unsigned i=0; i< m_conddbtable.size(); i++)
1749  {
1750  if (!(m_conddbtable[i]->initialized))
1751  {
1752  aux = false;
1753  break;
1754  }
1755  }
1756 
1757  if (aux)
1758  m_isInitialized = true;
1759 }
1760 
1761 template <typename T, typename COLUMN>
1762  int GenericDbTable::__getCell(unsigned n_column, unsigned n_row, T &ndata, dataTypes type, COLUMN *tmpColumn) const
1763 {
1764 
1765  if (!m_isInitialized)
1766  return CDB_NOT_INITIALIZED;
1767 
1768  if ((m_numRows > n_row) && (m_conddbtable.size() > n_column))
1769  {
1770  if (m_conddbtable[n_column]->type == type)
1771  {
1772  if (tmpColumn->column.size() <= n_row)
1773  ndata = tmpColumn->column.back();
1774  else
1775  ndata = tmpColumn->column[n_row+1];
1776  }
1777 
1778  else
1779  return CDB_TYPE_ERROR;
1780  }
1781  else
1782  return CDB_RANGE_ERROR;
1783 
1784  return CDB_SUCCESS;
1785 }
1786 
1787 template <typename T, typename COLUMN>
1788  int GenericDbTable::__setCell(unsigned n_column, unsigned n_row, const T &ndata, dataTypes type, COLUMN *tmpColumn)
1789  {
1790  if (!m_isInitialized)
1791  return CDB_NOT_INITIALIZED;
1792 
1793  if ((m_numRows > n_row) && (m_conddbtable.size() > n_column))
1794  {
1795  if (m_conddbtable[n_column]->type == type)
1796  {
1797  // static_cast<COLUMN*>(m_conddbtable[n_column])->column[n_row+1] = ndata;
1798  if (tmpColumn->column.size() == (n_row+1))
1799  tmpColumn->column.push_back(ndata);
1800  else
1801  if (tmpColumn->column.size() < (n_row+1))
1802  {
1803  T tmp = tmpColumn->column.back();
1804 
1805  while((n_row)-tmpColumn->column.size())
1806  {
1807  tmpColumn->column.push_back(tmp);
1808  }
1809  tmpColumn->column.push_back(ndata);
1810  }
1811  else
1812  // if the cell already has a value
1813  tmpColumn->column[n_row+1] = ndata;
1814 
1815  return CDB_SUCCESS;
1816  }
1817  else
1818  return CDB_TYPE_ERROR;
1819  }
1820  else
1821  return CDB_RANGE_ERROR;
1822  }
1823 
1824 template <typename T, typename COLUMN>
1825 int GenericDbTable::__setColumnData(unsigned n_column, T &data, dataTypes type, COLUMN *tmpColumn)
1826 {
1827  if (!m_isInitialized)
1828  return CDB_NOT_INITIALIZED;
1829 
1830  unsigned index = 0;
1831  if (n_column < m_conddbtable.size())
1832  {
1833  if (m_conddbtable[n_column]->type == type)
1834  {
1835  while((tmpColumn->column.size() < m_numRows+1) && (index < data.size()))
1836  {
1837  tmpColumn->column.push_back(data[index]);
1838  index++;
1839  }
1840  return index;
1841 
1842  }
1843  else
1844  return CDB_TYPE_ERROR;
1845  }
1846  else
1847  return CDB_RANGE_ERROR;
1848 }
1849 
1850 template <typename T>
1851 int GenericDbTable::__getCellByName(const std::string& colName, unsigned int n_row, T &data) const
1852 {
1853  for (unsigned int i=0; i< m_conddbtable.size(); i++) {
1854  if (m_conddbtable[i]->name == colName)
1855  {
1856  return getCell(i,n_row,data);
1857  }
1858  }
1859  //if there's no column with this name return error
1860  return CDB_RANGE_ERROR;
1861 }
1862 
GenericDbTable::CondDBColumn
Definition of the columns.
Definition: GenericDbTable.h:663
GenericDbTable::CondDBColumn::type
dataTypes type
Definition: GenericDbTable.h:667
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
GenericDbTable::CondDBColumnArrayString::column
std::vector< std::vector< std::string > > column
Definition: GenericDbTable.h:724
GenericDbTable::__getCell
int __getCell(unsigned n_column, unsigned n_row, T &ndata, dataTypes type, COLUMN *tmpColumn) const
Templated method that get's the data from a specified cell This is the method that does the real work...
Definition: GenericDbTable.cxx:1762
NULLLONG
#define NULLLONG
Definition: GenericDbTable.cxx:18
GenericDbTable::~GenericDbTable
~GenericDbTable()
Object destructor.
Definition: GenericDbTable.cxx:53
GenericDbTable::CondDBColumnFloat
Definition: GenericDbTable.h:688
GenericDbTable::CondDBColumnArrayFloat
Definition: GenericDbTable.h:718
GenericDbTable::CondDBColumnArrayBool
Definition: GenericDbTable.h:703
GenericDbTable::__setCell
int __setCell(unsigned n_column, unsigned n_row, const T &ndata, dataTypes type, COLUMN *tmpColumn)
Templated method that set's the data in a specified cell This is the method that does the real work.
Definition: GenericDbTable.cxx:1788
GenericDbTable::CondDBColumnLong::column
std::vector< int64 > column
Definition: GenericDbTable.h:678
GenericDbTable::__getCellByName
int __getCellByName(const std::string &colName, unsigned int n_row, T &data) const
Templated method that get's column data using the column name This method get's the desired column nu...
Definition: GenericDbTable.cxx:1851
GenericDbTable::kArrayBool
@ kArrayBool
Definition: GenericDbTable.h:32
index
Definition: index.py:1
GenericDbTable::CondDBColumnBool
Definition: GenericDbTable.h:672
GenericDbTable::CondDBColumnArrayDouble::column
std::vector< std::vector< double > > column
Definition: GenericDbTable.h:729
GenericDbTable::CondDBColumnBool::column
std::vector< short int > column
Definition: GenericDbTable.h:673
GenericDbTable::__getNull
int __getNull(T &data, COLUMN *tmpColumn) const
Templated method for handling the null values.
Definition: GenericDbTable.h:595
int64
long long int64
Definition: GenericDbTable.h:17
NULLINT
#define NULLINT
Definition: GenericDbTable.cxx:11
GenericDbTable::CondDBColumnFloat::column
std::vector< float > column
Definition: GenericDbTable.h:689
DeMoUpdate.column
dictionary column
Definition: DeMoUpdate.py:1110
atoi64
#define atoi64(x)
Definition: GenericDbTable.cxx:20
GenericDbTable::ToString
std::string ToString(const TYPE &t) const
Auxiliary function to convert any value to string.
Definition: GenericDbTable.h:651
GenericDbTable::kLongLong
@ kLongLong
Definition: GenericDbTable.h:31
GenericDbTable::CondDBColumnString::column
std::vector< std::string > column
Definition: GenericDbTable.h:694
GenericDbTable::CondDBColumnArrayDouble
Definition: GenericDbTable.h:728
GenericDbTable::setNull
int setNull(unsigned n_column, const float &null)
Set Null value for column.
Definition: GenericDbTable.cxx:634
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
NULLFLOAT
#define NULLFLOAT
Definition: GenericDbTable.cxx:12
GenericDbTable::kArrayInt
@ kArrayInt
Definition: GenericDbTable.h:34
GenericDbTable::m_conddbtable
std::vector< CondDBColumn * > m_conddbtable
Definition: GenericDbTable.h:734
GenericDbTable::getNames
int getNames(std::vector< std::string > &names) const
This method gets a vector containing the names of all columns in the table.
Definition: GenericDbTable.cxx:85
GenericDbTable::CondDBColumnInt::column
std::vector< long int > column
Definition: GenericDbTable.h:684
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:808
GenericDbTable::Initialize
void Initialize(unsigned n_columns, int n_rows=0)
This method initializes a table created by the default constructor If the table had the number of col...
Definition: GenericDbTable.cxx:61
GenericDbTable::kArrayLongLong
@ kArrayLongLong
Definition: GenericDbTable.h:37
GenericDbTable::kArrayFloat
@ kArrayFloat
Definition: GenericDbTable.h:33
GenericDbTable::setName
int setName(unsigned n_column, const std::string &name)
This method defines the name for a specified column.
Definition: GenericDbTable.cxx:337
GenericDbTable::resize
void resize(int num_rows)
Reserves more rows on the table.
Definition: GenericDbTable.cxx:1587
GenericDbTable::m_numRows
unsigned m_numRows
Definition: GenericDbTable.h:735
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
NULLDOUBLE
#define NULLDOUBLE
Definition: GenericDbTable.cxx:13
GenericDbTable::getRow
int getRow(unsigned rowNumber, std::vector< std::string > &values) const
This method returns a vector of strings with allelements in a row In case the cell has an array the f...
Definition: GenericDbTable.cxx:1597
GenericDbTable::CondDBColumnArrayLong::column
std::vector< std::vector< int64 > > column
Definition: GenericDbTable.h:709
lumiFormat.i
int i
Definition: lumiFormat.py:85
GenericDbTable::CondDBColumnArrayFloat::column
std::vector< std::vector< float > > column
Definition: GenericDbTable.h:719
vector< string >
python.subdetectors.mmg.names
names
Definition: mmg.py:8
GenericDbTable::setType
int setType(unsigned n_column, dataTypes type)
This method defines the data type for a specified column.
Definition: GenericDbTable.cxx:356
GenericDbTable::getRowID
int getRowID(std::string &pID) const
This method returns, for a given ID, the row number.
Definition: GenericDbTable.cxx:111
GenericDbTable::CDB_SUCCESS
@ CDB_SUCCESS
Definition: GenericDbTable.h:45
GenericDbTable::kString
@ kString
Definition: GenericDbTable.h:29
GenericDbTable::__setColumnData
int __setColumnData(unsigned n_column, T &data, dataTypes type, COLUMN *tmpColumn)
Templated method that set's portions of data in a specified column This method is deprecated and henc...
Definition: GenericDbTable.cxx:1825
GenericDbTable::getTypes
int getTypes(std::vector< dataTypes > &types) const
This method gets a vector containing the data types of all columns in the table.
Definition: GenericDbTable.cxx:98
GenericDbTable::kArrayDouble
@ kArrayDouble
Definition: GenericDbTable.h:36
GenericDbTable::setCell
int setCell(unsigned n_column, unsigned n_row, const short int ndata)
set data methods
Definition: GenericDbTable.cxx:890
GenericDbTable::m_isInitialized
bool m_isInitialized
Definition: GenericDbTable.h:733
GenericDbTable::CondDBColumnLong
Definition: GenericDbTable.h:677
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
GenericDbTable::CondDBColumnDouble::column
std::vector< double > column
Definition: GenericDbTable.h:699
CxxUtils::atof
double atof(std::string_view str)
Converts a string into a double / float.
Definition: Control/CxxUtils/Root/StringUtils.cxx:91
GenericDbTable::CondDBColumnArrayLong
Definition: GenericDbTable.h:708
GenericDbTable::CondDBColumn::name
std::string name
Definition: GenericDbTable.h:666
GenericDbTable::kFloat
@ kFloat
Definition: GenericDbTable.h:28
GenericDbTable::getCell
int getCell(unsigned n_column, unsigned n_row, short int &ndata) const
This method gets a value from a cell in a column of long ints (int in MySQL)
Definition: GenericDbTable.cxx:687
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
GenericDbTable.h
GenericDbTable::kInt
@ kInt
Definition: GenericDbTable.h:27
GenericDbTable::CondDBColumnString
Definition: GenericDbTable.h:693
GenericDbTable::CDB_RANGE_ERROR
@ CDB_RANGE_ERROR
Definition: GenericDbTable.h:43
GenericDbTable::CDB_TYPE_ERROR
@ CDB_TYPE_ERROR
Definition: GenericDbTable.h:44
GenericDbTable::dataTypes
dataTypes
Definition: GenericDbTable.h:25
GenericDbTable::kDouble
@ kDouble
Definition: GenericDbTable.h:30
DeMoScan.index
string index
Definition: DeMoScan.py:362
python.CaloAddPedShiftConfig.default
default
Definition: CaloAddPedShiftConfig.py:43
GenericDbTable::verifyInitialization
void verifyInitialization()
Verifies if all columns are initialized.
Definition: GenericDbTable.cxx:1744
GenericDbTable::getNull
int getNull(unsigned n_column, float &null) const
Get Null value for column.
Definition: GenericDbTable.cxx:237
GenericDbTable::CondDBColumnArrayBool::column
std::vector< std::vector< short int > > column
Definition: GenericDbTable.h:704
GenericDbTable::CDB_NOT_INITIALIZED
@ CDB_NOT_INITIALIZED
Definition: GenericDbTable.h:42
GenericDbTable::setColumndata
int setColumndata(unsigned n_column, const std::vector< short int > &data)
The following methods allow to insert in the columns a group of values.
Definition: GenericDbTable.cxx:1184
GenericDbTable::CondDBColumnInt
Definition: GenericDbTable.h:683
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:147
GenericDbTable::kArrayString
@ kArrayString
Definition: GenericDbTable.h:35
GenericDbTable::GenericDbTable
GenericDbTable()
Default constructor.
Definition: GenericDbTable.h:55
CxxUtils::atoi
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Definition: Control/CxxUtils/Root/StringUtils.cxx:85
merge.status
status
Definition: merge.py:16
GenericDbTable::kBool
@ kBool
Definition: GenericDbTable.h:26
GenericDbTable::kNull
@ kNull
Definition: GenericDbTable.h:25
GenericDbTable::CondDBColumnArrayInt
Definition: GenericDbTable.h:713
GenericDbTable::CDB_STRTOARRAY_ERROR
@ CDB_STRTOARRAY_ERROR
Definition: GenericDbTable.h:47
GenericDbTable::CondDBColumnArrayString
Definition: GenericDbTable.h:723
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
GenericDbTable::CondDBColumnArrayInt::column
std::vector< std::vector< long int > > column
Definition: GenericDbTable.h:714
GenericDbTable::CondDBColumnDouble
Definition: GenericDbTable.h:698