aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/MongoDB/src/QueryRequest.cpp
blob: 7044335ba303d9244593b53791d6381ec596290c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// QueryRequest.cpp
//
// Library: MongoDB
// Package: MongoDB
// Module:  QueryRequest
//
// Copyright (c) 2012, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier:	BSL-1.0
//


#include "Poco/MongoDB/QueryRequest.h"


namespace Poco {
namespace MongoDB {


QueryRequest::QueryRequest(const std::string& collectionName, QueryRequest::Flags flags):
	RequestMessage(MessageHeader::OP_QUERY), 
	_flags(flags), 
	_fullCollectionName(collectionName),
	_numberToSkip(0), 
	_numberToReturn(100),
	_selector(),
	_returnFieldSelector()
{
}


QueryRequest::~QueryRequest()
{
}


void QueryRequest::buildRequest(BinaryWriter& writer)
{
	writer << _flags;
	BSONWriter(writer).writeCString(_fullCollectionName);
	writer << _numberToSkip;
	writer << _numberToReturn;
	_selector.write(writer);

	if (!_returnFieldSelector.empty())
	{
		_returnFieldSelector.write(writer);
	}
}


} } // namespace Poco::MongoDB