poco/MongoDB/src/DeleteRequest.cpp

55 lines
1.0 KiB
C++
Raw Normal View History

2013-02-02 21:52:49 +01:00
//
// DeleteRequest.cpp
//
// Library: MongoDB
// Package: MongoDB
// Module: DeleteRequest
//
// Copyright (c) 2012, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
2013-02-02 21:52:49 +01:00
//
2013-03-17 19:34:36 +01:00
2013-02-02 21:52:49 +01:00
#include "Poco/MongoDB/DeleteRequest.h"
2013-03-17 19:34:36 +01:00
namespace Poco {
namespace MongoDB {
2013-02-02 21:52:49 +01:00
DeleteRequest::DeleteRequest(const std::string& collectionName, DeleteRequest::Flags flags):
RequestMessage(MessageHeader::OP_DELETE),
2013-02-02 21:52:49 +01:00
_flags(flags),
_fullCollectionName(collectionName),
_selector()
{
}
DeleteRequest::DeleteRequest(const std::string& collectionName, bool justOne):
RequestMessage(MessageHeader::OP_DELETE),
_flags(justOne ? DELETE_SINGLE_REMOVE : DELETE_DEFAULT),
_fullCollectionName(collectionName),
_selector()
{
}
2013-02-02 21:52:49 +01:00
DeleteRequest::~DeleteRequest()
{
}
2013-03-17 19:34:36 +01:00
2013-02-02 21:52:49 +01:00
void DeleteRequest::buildRequest(BinaryWriter& writer)
{
writer << 0; // 0 - reserved for future use
2013-02-13 19:10:57 +01:00
BSONWriter(writer).writeCString(_fullCollectionName);
2013-02-02 21:52:49 +01:00
writer << _flags;
2013-02-13 19:10:57 +01:00
_selector.write(writer);
2013-02-02 21:52:49 +01:00
}
2013-03-17 19:34:36 +01:00
} } // namespace Poco::MongoDB