本文整理汇总了C++中Transaction::LookupString方法的典型用法代码示例。如果您正苦于以下问题:C++ Transaction::LookupString方法的具体用法?C++ Transaction::LookupString怎么用?C++ Transaction::LookupString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transaction
的用法示例。
在下文中一共展示了Transaction::LookupString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoLookupTransaction
bool DoLookupTransaction(const char *db_name,
const char *key_name,
Buffer *buf)
{
// lookups can occur even as some backends are being finished
// (i.e. the block backend). allow this behavior, which must come
// before the Xdb backend itself is finished.
if (TransactionBackend::HasFinishedBackends()) {
Assert(!IsAnalysisRemote());
Xdb *xdb = GetDatabase(db_name, false);
if (!xdb || !xdb->Exists())
return false;
String *key = String::Make(key_name);
return XdbFindUncompressed(xdb, key, buf);
}
Transaction *t = new Transaction();
size_t data_res = t->MakeVariable(true);
TOperand *key_arg = new TOperandString(t, key_name);
t->PushAction(Backend::XdbLookup(t, db_name, key_arg, data_res));
SubmitTransaction(t);
TOperandString *data_value = t->LookupString(data_res);
if (data_value->GetDataLength() == 0) {
delete t;
return false;
}
else {
TOperandString::Uncompress(data_value, buf);
delete t;
return true;
}
}