本文整理汇总了C++中Name::setDbtFromThis_PrimaryValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Name::setDbtFromThis_PrimaryValue方法的具体用法?C++ Name::setDbtFromThis_PrimaryValue怎么用?C++ Name::setDbtFromThis_PrimaryValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Name
的用法示例。
在下文中一共展示了Name::setDbtFromThis_PrimaryValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defineName
// mutex is locked if present and necessary
int DictionaryDatabase::defineName(OperationContext &context,
const Name &name, NameID &id)
{
// Primary { id -> name\0uri\0 }
// Secondary { name:uri -> id }
id.reset();
name.setDbtFromThis_PrimaryValue(context.data());
int err = primary_->appendPrimary(context, id, context.data(), /*no flags*/0);
if (err == 0) {
/*Cache after insert. This prevents the cache from returning bad answers
* on a transaction abort, and speeds up access to newly inserted element
* and attribute names that are needed for indexing after an insert.
*/
cache_.insert(id.raw(), context.data());
id.setDbtFromThis(context.key());
name.setDbtFromThis_SecondaryKey(context.data());
Transaction *txn = getTxn(context);
err = secondary_->put(txn, &context.data(), &context.key(), /*no flags*/0);
if (err == 0) {
/* Add to the transaction's string cache, that way if an abort occurs
* the values can be removed from the cache.
*/
if (txn) {
DictionaryStringCache *dsc = txn->getStringCache(this, true);
dsc->insert(&context.data(), id.raw());
}
if(Log::isLogEnabled(Log::C_DICTIONARY, Log::L_INFO)) {
ostringstream oss;
oss << "Define new name " << id << " -> " << name;
Log::log(environment_, Log::C_DICTIONARY, Log::L_INFO,
name_.c_str(),
oss.str().c_str());
}
}
}
return err;
}