CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RelationalDeleter.cc
Go to the documentation of this file.
1 #include "RelationalDeleter.h"
2 #include "RelationalOperation.h"
3 #include "RelationalBuffer.h"
4 #include "MappingElement.h"
5 #include "ContainerSchema.h"
6 // externals
7 #include "CoralBase/Attribute.h"
8 
10  m_mappings(),
11  m_operations(){
12  m_mappings.push_back( &dataMapping );
13 }
14 
15 ora::RelationalDeleter::RelationalDeleter( const std::vector<MappingElement>& mappingList ):
16  m_mappings(),
17  m_operations(){
18  for( std::vector<MappingElement>::const_iterator iMe = mappingList.begin();
19  iMe != mappingList.end(); ++iMe ){
20  m_mappings.push_back( &(*iMe) );
21  }
22 }
23 
25  clear();
26 }
27 
29  m_operations.clear();
30 }
31 
33  m_operations.clear();
34  for( std::vector<const MappingElement*>::iterator iMe = m_mappings.begin();
35  iMe != m_mappings.end(); iMe++ ){
36  std::vector<std::pair<std::string,std::string> > tableHierarchy = (*iMe)->tableHierarchy();
37  size_t sz = tableHierarchy.size();
38  for( size_t i=1; i<sz+1; i++ ){
39  DeleteOperation& delOperation = buffer.newDelete( tableHierarchy[sz-i].first, i==sz );
40  delOperation.addWhereId( tableHierarchy[sz-i].second );
41  m_operations.push_back(&delOperation);
42  }
43  }
44 }
45 
46 void ora::RelationalDeleter::erase( int itemId ){
47  for( std::vector<DeleteOperation*>::const_iterator iDel = m_operations.begin();
48  iDel != m_operations.end(); ++iDel ){
49  coral::AttributeList& whereData = (*iDel)->whereData();
50  whereData.begin()->data<int>() = itemId;
51  }
52 }
53 
int addWhereId(const std::string &columnName)
int i
Definition: DBlmapReader.cc:9
virtual ~RelationalDeleter()
Destructor.
std::vector< const MappingElement * > m_mappings
U second(std::pair< T, U > const &p)
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
Definition: matutil.cc:168
bool first
Definition: L1TdeRCT.cc:94
void build(RelationalBuffer &buffer)
RelationalDeleter(MappingElement &dataMapping)
DeleteOperation & newDelete(const std::string &tableName, bool addToResult=false)