00001 #include "ArrayCommonImpl.h" 00002 #include "MappingElement.h" 00003 #include "RelationalBuffer.h" 00004 #include "RelationalOperation.h" 00005 // externals 00006 #include "CoralBase/Attribute.h" 00007 00008 void ora::deleteArrayElements( MappingElement& mapping, 00009 int oid, 00010 int fromIndex, 00011 RelationalBuffer& buffer ){ 00012 for ( MappingElement::iterator iMe = mapping.begin(); 00013 iMe != mapping.end(); ++iMe ) { 00014 MappingElement::ElementType elementType = iMe->second.elementType(); 00015 // add the InlineCArray (or change the algorithm... 00016 if ( elementType == MappingElement::Object || 00017 elementType == MappingElement::Array || 00018 elementType == MappingElement::OraArray || 00019 elementType == MappingElement::CArray ) { 00020 deleteArrayElements( iMe->second, oid, fromIndex, buffer ); 00021 } 00022 } 00023 if ( mapping.elementType() == MappingElement::Object) return; 00024 00025 std::string oidColumn = mapping.columnNames()[ 0 ]; 00026 std::string indexColumn = mapping.columnNames()[ 1 ]; 00027 DeleteOperation& deleteOperation = buffer.newDelete( mapping.tableName() ); 00028 deleteOperation.addWhereId( oidColumn ); 00029 deleteOperation.addWhereId( indexColumn, Ge ); 00030 coral::AttributeList::iterator condDataIter = deleteOperation.whereData().begin(); 00031 condDataIter->data<int>() = oid; 00032 ++condDataIter; 00033 condDataIter->data<int>() = fromIndex; 00034 } 00035 00036