summaryrefslogtreecommitdiff
path: root/src/mongo/db/ops/parsed_delete.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/ops/parsed_delete.cpp
parent2ce8b867f1571d92370e5df1e5d10390167c485e (diff)
downloadmongo-d674d15ee5cb573567d0683041c8049c8ee8cb21.tar.gz
SERVER-16889 CanonicalQuery::canonicalize() return SW<unique_ptr<CQ>>
Diffstat (limited to 'src/mongo/db/ops/parsed_delete.cpp')
-rw-r--r--src/mongo/db/ops/parsed_delete.cpp38
1 files changed, 18 insertions, 20 deletions
diff --git a/src/mongo/db/ops/parsed_delete.cpp b/src/mongo/db/ops/parsed_delete.cpp
index 46a2a33752d..ddb24fa2faf 100644
--- a/src/mongo/db/ops/parsed_delete.cpp
+++ b/src/mongo/db/ops/parsed_delete.cpp
@@ -69,7 +69,6 @@ Status ParsedDelete::parseRequest() {
Status ParsedDelete::parseQueryToCQ() {
dassert(!_canonicalQuery.get());
- CanonicalQuery* cqRaw;
const WhereCallbackReal whereCallback(_txn, _request->getNamespaceString().db());
// Limit should only used for the findAndModify command when a sort is specified. If a sort
@@ -83,25 +82,24 @@ Status ParsedDelete::parseQueryToCQ() {
// The projection needs to be applied after the delete operation, so we specify an empty
// BSONObj as the projection during canonicalization.
const BSONObj emptyObj;
- Status status = CanonicalQuery::canonicalize(_request->getNamespaceString().ns(),
- _request->getQuery(),
- _request->getSort(),
- emptyObj, // projection
- 0, // skip
- limit,
- emptyObj, // hint
- emptyObj, // min
- emptyObj, // max
- false, // snapshot
- _request->isExplain(),
- &cqRaw,
- whereCallback);
-
- if (status.isOK()) {
- _canonicalQuery.reset(cqRaw);
+ auto statusWithCQ = CanonicalQuery::canonicalize(_request->getNamespaceString().ns(),
+ _request->getQuery(),
+ _request->getSort(),
+ emptyObj, // projection
+ 0, // skip
+ limit,
+ emptyObj, // hint
+ emptyObj, // min
+ emptyObj, // max
+ false, // snapshot
+ _request->isExplain(),
+ whereCallback);
+
+ if (statusWithCQ.isOK()) {
+ _canonicalQuery = std::move(statusWithCQ.getValue());
}
- return status;
+ return statusWithCQ.getStatus();
}
const DeleteRequest* ParsedDelete::getRequest() const {
@@ -123,9 +121,9 @@ bool ParsedDelete::hasParsedQuery() const {
return _canonicalQuery.get() != NULL;
}
-CanonicalQuery* ParsedDelete::releaseParsedQuery() {
+std::unique_ptr<CanonicalQuery> ParsedDelete::releaseParsedQuery() {
invariant(_canonicalQuery.get() != NULL);
- return _canonicalQuery.release();
+ return std::move(_canonicalQuery);
}
} // namespace mongo