示例#1
0
void MetaDataMap::rewriteMetaData(
		const MetaDataDescription::TranslationMap& trmap,
		const MetaDataDescription& newDescr,
		DatabaseTransactionInterface* transaction)
{
	MetaDataBlock blk;
	DatabaseAdapter_DocMetaData dbadapter( m_database, m_descr);

	for (bool more=dbadapter.loadFirst(blk); more; more=dbadapter.loadNext(blk))
	{
		std::size_t newblk_bytesize = MetaDataBlock::BlockSize * newDescr.bytesize();
		char* newblk_data = new char[ MetaDataBlock::BlockSize * newDescr.bytesize()];
		utils::ScopedArray<char> newblk_data_mem( newblk_data);

		MetaDataRecord::translateBlock(
				trmap, newDescr, newblk_data,
				*m_descr, blk.ptr(), MetaDataBlock::BlockSize);
		MetaDataBlock newblk( &newDescr, blk.blockno(), newblk_data, newblk_bytesize);
		dbadapter.store( transaction, newblk);
	}
	// Clear maps:
	clear();
}
示例#2
0
void DatabaseAdapter_DocMetaData::store( DatabaseTransactionInterface* transaction, const MetaDataBlock& blk)
{
	DatabaseKey dbkey( KeyPrefix, blk.blockno());
	transaction->write( dbkey.ptr(), dbkey.size(), blk.charptr(), blk.bytesize());
}