2013-02-02 21:52:49 +01:00
|
|
|
//
|
|
|
|
// DeleteRequest.cpp
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
//
|
|
|
|
// Library: MongoDB
|
|
|
|
// Package: MongoDB
|
|
|
|
// Module: DeleteRequest
|
|
|
|
//
|
|
|
|
// Implementation of the DeleteRequest class.
|
|
|
|
//
|
|
|
|
// Copyright (c) 2012, Applied Informatics Software Engineering GmbH.
|
|
|
|
// and Contributors.
|
|
|
|
//
|
2014-05-04 21:02:42 +02:00
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
2013-02-02 21:52:49 +01:00
|
|
|
//
|
|
|
|
|
2013-03-17 13:34:36 -05:00
|
|
|
|
2013-02-02 21:52:49 +01:00
|
|
|
#include "Poco/MongoDB/DeleteRequest.h"
|
|
|
|
|
2013-03-17 13:34:36 -05:00
|
|
|
|
|
|
|
namespace Poco {
|
|
|
|
namespace MongoDB {
|
2013-02-02 21:52:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
DeleteRequest::DeleteRequest(const std::string& collectionName, DeleteRequest::Flags flags)
|
|
|
|
: RequestMessage(MessageHeader::Delete),
|
|
|
|
_flags(flags),
|
|
|
|
_fullCollectionName(collectionName),
|
|
|
|
_selector()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-02-15 22:32:24 +01:00
|
|
|
|
|
|
|
DeleteRequest::DeleteRequest(const std::string& collectionName, bool justOne)
|
|
|
|
: RequestMessage(MessageHeader::Delete),
|
|
|
|
_flags(justOne ? DELETE_SINGLE_REMOVE : DELETE_NONE),
|
|
|
|
_fullCollectionName(collectionName),
|
|
|
|
_selector()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-02-02 21:52:49 +01:00
|
|
|
DeleteRequest::~DeleteRequest()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-03-17 13:34:36 -05: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 13:34:36 -05:00
|
|
|
} } // namespace Poco::MongoDB
|