summaryrefslogtreecommitdiff
path: root/src/mongo/db/dbhelpers.cpp
diff options
context:
space:
mode:
authorQingyang Chen <qingyang.chen@10gen.com>2015-06-16 16:16:12 -0400
committerQingyang Chen <qingyang.chen@10gen.com>2015-06-23 13:47:27 -0400
commitd674d15ee5cb573567d0683041c8049c8ee8cb21 (patch)
tree6d7eaccc12f35f05cd6a725a40cc3be650303e48 /src/mongo/db/dbhelpers.cpp
parent2ce8b867f1571d92370e5df1e5d10390167c485e (diff)
downloadmongo-d674d15ee5cb573567d0683041c8049c8ee8cb21.tar.gz
SERVER-16889 CanonicalQuery::canonicalize() return SW<unique_ptr<CQ>>
Diffstat (limited to 'src/mongo/db/dbhelpers.cpp')
-rw-r--r--src/mongo/db/dbhelpers.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp
index e5e198d7ff0..0517552c7c2 100644
--- a/src/mongo/db/dbhelpers.cpp
+++ b/src/mongo/db/dbhelpers.cpp
@@ -129,18 +129,19 @@ RecordId Helpers::findOne(OperationContext* txn,
if (!collection)
return RecordId();
- CanonicalQuery* cq;
const WhereCallbackReal whereCallback(txn, collection->ns().db());
- massert(17244,
- "Could not canonicalize " + query.toString(),
- CanonicalQuery::canonicalize(collection->ns(), query, &cq, whereCallback).isOK());
+ auto statusWithCQ = CanonicalQuery::canonicalize(collection->ns(), query, whereCallback);
+ massert(17244, "Could not canonicalize " + query.toString(), statusWithCQ.isOK());
+ unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
PlanExecutor* rawExec;
size_t options = requireIndex ? QueryPlannerParams::NO_TABLE_SCAN : QueryPlannerParams::DEFAULT;
- massert(17245,
- "Could not get executor for query " + query.toString(),
- getExecutor(txn, collection, cq, PlanExecutor::YIELD_MANUAL, &rawExec, options).isOK());
+ massert(
+ 17245,
+ "Could not get executor for query " + query.toString(),
+ getExecutor(txn, collection, cq.release(), PlanExecutor::YIELD_MANUAL, &rawExec, options)
+ .isOK());
unique_ptr<PlanExecutor> exec(rawExec);
PlanExecutor::ExecState state;