本文整理汇总了C++中PlanCache::getAllEntries方法的典型用法代码示例。如果您正苦于以下问题:C++ PlanCache::getAllEntries方法的具体用法?C++ PlanCache::getAllEntries怎么用?C++ PlanCache::getAllEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlanCache
的用法示例。
在下文中一共展示了PlanCache::getAllEntries方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: list
// static
Status PlanCacheListQueryShapes::list(const PlanCache& planCache, BSONObjBuilder* bob) {
invariant(bob);
// Fetch all cached solutions from plan cache.
vector<PlanCacheEntry*> solutions = planCache.getAllEntries();
BSONArrayBuilder arrayBuilder(bob->subarrayStart("shapes"));
for (vector<PlanCacheEntry*>::const_iterator i = solutions.begin(); i != solutions.end(); i++) {
PlanCacheEntry* entry = *i;
invariant(entry);
BSONObjBuilder shapeBuilder(arrayBuilder.subobjStart());
shapeBuilder.append("query", entry->query);
shapeBuilder.append("sort", entry->sort);
shapeBuilder.append("projection", entry->projection);
shapeBuilder.doneFast();
// Release resources for cached solution after extracting query shape.
delete entry;
}
arrayBuilder.doneFast();
return Status::OK();
}
示例2: list
// static
Status PlanCacheListQueryShapes::list(const PlanCache& planCache, BSONObjBuilder* bob) {
invariant(bob);
// Fetch all cached solutions from plan cache.
auto entries = planCache.getAllEntries();
BSONArrayBuilder arrayBuilder(bob->subarrayStart("shapes"));
for (auto&& entry : entries) {
invariant(entry);
BSONObjBuilder shapeBuilder(arrayBuilder.subobjStart());
shapeBuilder.append("query", entry->query);
shapeBuilder.append("sort", entry->sort);
shapeBuilder.append("projection", entry->projection);
if (!entry->collation.isEmpty()) {
shapeBuilder.append("collation", entry->collation);
}
shapeBuilder.append("queryHash", unsignedIntToFixedLengthHex(entry->queryHash));
shapeBuilder.doneFast();
}
arrayBuilder.doneFast();
return Status::OK();
}