1 | // |
---|---|
2 | // DeleteRequest.cpp |
3 | // |
4 | // Library: MongoDB |
5 | // Package: MongoDB |
6 | // Module: DeleteRequest |
7 | // |
8 | // Copyright (c) 2012, Applied Informatics Software Engineering GmbH. |
9 | // and Contributors. |
10 | // |
11 | // SPDX-License-Identifier: BSL-1.0 |
12 | // |
13 | |
14 | |
15 | #include "Poco/MongoDB/DeleteRequest.h" |
16 | |
17 | |
18 | namespace Poco { |
19 | namespace MongoDB { |
20 | |
21 | |
22 | DeleteRequest::DeleteRequest(const std::string& collectionName, DeleteRequest::Flags flags): |
23 | RequestMessage(MessageHeader::OP_DELETE), |
24 | _flags(flags), |
25 | _fullCollectionName(collectionName), |
26 | _selector() |
27 | { |
28 | } |
29 | |
30 | |
31 | DeleteRequest::DeleteRequest(const std::string& collectionName, bool justOne): |
32 | RequestMessage(MessageHeader::OP_DELETE), |
33 | _flags(justOne ? DELETE_SINGLE_REMOVE : DELETE_DEFAULT), |
34 | _fullCollectionName(collectionName), |
35 | _selector() |
36 | { |
37 | } |
38 | |
39 | |
40 | DeleteRequest::~DeleteRequest() |
41 | { |
42 | } |
43 | |
44 | |
45 | void DeleteRequest::buildRequest(BinaryWriter& writer) |
46 | { |
47 | writer << 0; // 0 - reserved for future use |
48 | BSONWriter(writer).writeCString(_fullCollectionName); |
49 | writer << _flags; |
50 | _selector.write(writer); |
51 | } |
52 | |
53 | |
54 | } } // namespace Poco::MongoDB |
55 |