From d674d15ee5cb573567d0683041c8049c8ee8cb21 Mon Sep 17 00:00:00 2001 From: Qingyang Chen Date: Tue, 16 Jun 2015 16:16:12 -0400 Subject: SERVER-16889 CanonicalQuery::canonicalize() return SW> --- src/mongo/db/dbhelpers.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/mongo/db/dbhelpers.cpp') 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 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 exec(rawExec); PlanExecutor::ExecState state; -- cgit v1.2.1