mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-poco.git
synced 2025-10-29 17:52:44 +00:00
Remove trailing whitespace (#3668)
This commit is contained in:
@@ -30,7 +30,7 @@ class MongoDB_API BSONWriter
|
||||
/// Class for writing BSON using a Poco::BinaryWriter.
|
||||
{
|
||||
public:
|
||||
BSONWriter(const Poco::BinaryWriter& writer):
|
||||
BSONWriter(const Poco::BinaryWriter& writer):
|
||||
_writer(writer)
|
||||
/// Creates the BSONWriter.
|
||||
{
|
||||
|
||||
@@ -42,13 +42,13 @@ public:
|
||||
|
||||
virtual ~Database();
|
||||
/// Destroys the Database.
|
||||
|
||||
|
||||
bool authenticate(Connection& connection, const std::string& username, const std::string& password, const std::string& method = AUTH_SCRAM_SHA1);
|
||||
/// Authenticates against the database using the given connection,
|
||||
/// username and password, as well as authentication method.
|
||||
///
|
||||
/// "MONGODB-CR" (default prior to MongoDB 3.0) and
|
||||
/// "SCRAM-SHA-1" (default starting in 3.0) are the only supported
|
||||
/// "MONGODB-CR" (default prior to MongoDB 3.0) and
|
||||
/// "SCRAM-SHA-1" (default starting in 3.0) are the only supported
|
||||
/// authentication methods.
|
||||
///
|
||||
/// Returns true if authentication was successful, otherwise false.
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
/// invalid credentials.
|
||||
|
||||
Int64 count(Connection& connection, const std::string& collectionName) const;
|
||||
/// Sends a count request for the given collection to MongoDB.
|
||||
/// Sends a count request for the given collection to MongoDB.
|
||||
///
|
||||
/// If the command fails, -1 is returned.
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
/// Creates a QueryRequest for a command.
|
||||
|
||||
Poco::SharedPtr<Poco::MongoDB::QueryRequest> createCountRequest(const std::string& collectionName) const;
|
||||
/// Creates a QueryRequest to count the given collection.
|
||||
/// Creates a QueryRequest to count the given collection.
|
||||
/// The collectionname must not contain the database name.
|
||||
|
||||
Poco::SharedPtr<Poco::MongoDB::DeleteRequest> createDeleteRequest(const std::string& collectionName) const;
|
||||
@@ -77,11 +77,11 @@ public:
|
||||
/// The collectionname must not contain the database name.
|
||||
|
||||
Poco::SharedPtr<Poco::MongoDB::QueryRequest> createQueryRequest(const std::string& collectionName) const;
|
||||
/// Creates a QueryRequest.
|
||||
/// Creates a QueryRequest.
|
||||
/// The collectionname must not contain the database name.
|
||||
|
||||
Poco::SharedPtr<Poco::MongoDB::UpdateRequest> createUpdateRequest(const std::string& collectionName) const;
|
||||
/// Creates an UpdateRequest.
|
||||
/// Creates an UpdateRequest.
|
||||
/// The collectionname must not contain the database name.
|
||||
|
||||
Poco::MongoDB::Document::Ptr ensureIndex(Connection& connection,
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
|
||||
static const std::string AUTH_MONGODB_CR;
|
||||
/// Default authentication mechanism prior to MongoDB 3.0.
|
||||
|
||||
|
||||
static const std::string AUTH_SCRAM_SHA1;
|
||||
/// Default authentication mechanism for MongoDB 3.0.
|
||||
|
||||
|
||||
@@ -45,20 +45,20 @@ public:
|
||||
};
|
||||
|
||||
DeleteRequest(const std::string& collectionName, Flags flags = DELETE_DEFAULT);
|
||||
/// Creates a DeleteRequest for the given collection using the given flags.
|
||||
/// Creates a DeleteRequest for the given collection using the given flags.
|
||||
///
|
||||
/// The full collection name is the concatenation of the database
|
||||
/// name with the collection name, using a "." for the concatenation. For example,
|
||||
/// for the database "foo" and the collection "bar", the full collection name is
|
||||
/// The full collection name is the concatenation of the database
|
||||
/// name with the collection name, using a "." for the concatenation. For example,
|
||||
/// for the database "foo" and the collection "bar", the full collection name is
|
||||
/// "foo.bar".
|
||||
|
||||
DeleteRequest(const std::string& collectionName, bool justOne);
|
||||
/// Creates a DeleteRequest for the given collection.
|
||||
///
|
||||
///
|
||||
/// The full collection name is the concatenation of the database
|
||||
/// name with the collection name, using a "." for the concatenation. For example,
|
||||
/// for the database "foo" and the collection "bar", the full collection name is
|
||||
/// "foo.bar".
|
||||
/// "foo.bar".
|
||||
///
|
||||
/// If justOne is true, only the first matching document will
|
||||
/// be removed (the same as using flag DELETE_SINGLE_REMOVE).
|
||||
|
||||
@@ -27,16 +27,16 @@ namespace MongoDB {
|
||||
|
||||
|
||||
class MongoDB_API GetMoreRequest: public RequestMessage
|
||||
/// A GetMoreRequest is used to query the database for more documents in a collection
|
||||
/// A GetMoreRequest is used to query the database for more documents in a collection
|
||||
/// after a query request is send (OP_GETMORE).
|
||||
{
|
||||
public:
|
||||
GetMoreRequest(const std::string& collectionName, Int64 cursorID);
|
||||
/// Creates a GetMoreRequest for the give collection and cursor.
|
||||
/// Creates a GetMoreRequest for the give collection and cursor.
|
||||
///
|
||||
/// The full collection name is the concatenation of the database
|
||||
/// name with the collection name, using a "." for the concatenation. For example,
|
||||
/// for the database "foo" and the collection "bar", the full collection name is
|
||||
/// The full collection name is the concatenation of the database
|
||||
/// name with the collection name, using a "." for the concatenation. For example,
|
||||
/// for the database "foo" and the collection "bar", the full collection name is
|
||||
/// "foo.bar". The cursorID has been returned by the response on the query request.
|
||||
/// By default the numberToReturn is set to 100.
|
||||
|
||||
|
||||
@@ -36,21 +36,21 @@ public:
|
||||
{
|
||||
INSERT_DEFAULT = 0,
|
||||
/// If specified, perform a normal insert operation.
|
||||
|
||||
|
||||
INSERT_CONTINUE_ON_ERROR = 1
|
||||
/// If set, the database will not stop processing a bulk insert if one
|
||||
/// fails (e.g. due to duplicate IDs). This makes bulk insert behave similarly
|
||||
/// to a series of single inserts, except lastError will be set if any insert
|
||||
/// fails, not just the last one. If multiple errors occur, only the most
|
||||
/// If set, the database will not stop processing a bulk insert if one
|
||||
/// fails (e.g. due to duplicate IDs). This makes bulk insert behave similarly
|
||||
/// to a series of single inserts, except lastError will be set if any insert
|
||||
/// fails, not just the last one. If multiple errors occur, only the most
|
||||
/// recent will be reported.
|
||||
};
|
||||
|
||||
InsertRequest(const std::string& collectionName, Flags flags = INSERT_DEFAULT);
|
||||
/// Creates an InsertRequest.
|
||||
///
|
||||
/// The full collection name is the concatenation of the database
|
||||
/// name with the collection name, using a "." for the concatenation. For example,
|
||||
/// for the database "foo" and the collection "bar", the full collection name is
|
||||
/// The full collection name is the concatenation of the database
|
||||
/// name with the collection name, using a "." for the concatenation. For example,
|
||||
/// for the database "foo" and the collection "bar", the full collection name is
|
||||
/// "foo.bar".
|
||||
|
||||
virtual ~InsertRequest();
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace MongoDB {
|
||||
|
||||
class MongoDB_API KillCursorsRequest: public RequestMessage
|
||||
/// Class for creating an OP_KILL_CURSORS client request. This
|
||||
/// request is used to kill cursors, which are still open,
|
||||
/// request is used to kill cursors, which are still open,
|
||||
/// returned by query requests.
|
||||
{
|
||||
public:
|
||||
@@ -37,10 +37,10 @@ public:
|
||||
|
||||
virtual ~KillCursorsRequest();
|
||||
/// Destroys the KillCursorsRequest.
|
||||
|
||||
|
||||
std::vector<Int64>& cursors();
|
||||
/// The internal list of cursors.
|
||||
|
||||
|
||||
protected:
|
||||
void buildRequest(BinaryWriter& writer);
|
||||
std::vector<Int64> _cursors;
|
||||
@@ -53,7 +53,7 @@ protected:
|
||||
inline std::vector<Int64>& KillCursorsRequest::cursors()
|
||||
{
|
||||
return _cursors;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::MongoDB
|
||||
|
||||
@@ -36,7 +36,7 @@ class MongoDB_API Message
|
||||
public:
|
||||
explicit Message(MessageHeader::OpCode opcode);
|
||||
/// Creates a Message using the given OpCode.
|
||||
|
||||
|
||||
virtual ~Message();
|
||||
/// Destructor
|
||||
|
||||
|
||||
@@ -34,51 +34,51 @@ class MongoDB_API QueryRequest: public RequestMessage
|
||||
public:
|
||||
enum Flags
|
||||
{
|
||||
QUERY_DEFAULT = 0,
|
||||
QUERY_DEFAULT = 0,
|
||||
/// Do not set any flags.
|
||||
|
||||
QUERY_TAILABLE_CURSOR = 2,
|
||||
/// Tailable means cursor is not closed when the last data is retrieved.
|
||||
/// Rather, the cursor marks the final object’s position.
|
||||
/// You can resume using the cursor later, from where it was located,
|
||||
/// if more data were received. Like any "latent cursor", the cursor may
|
||||
/// become invalid at some point (CursorNotFound) – for example if the final
|
||||
|
||||
QUERY_TAILABLE_CURSOR = 2,
|
||||
/// Tailable means cursor is not closed when the last data is retrieved.
|
||||
/// Rather, the cursor marks the final object’s position.
|
||||
/// You can resume using the cursor later, from where it was located,
|
||||
/// if more data were received. Like any "latent cursor", the cursor may
|
||||
/// become invalid at some point (CursorNotFound) – for example if the final
|
||||
/// object it references were deleted.
|
||||
|
||||
QUERY_SLAVE_OK = 4,
|
||||
/// Allow query of replica slave. Normally these return an error except
|
||||
|
||||
QUERY_SLAVE_OK = 4,
|
||||
/// Allow query of replica slave. Normally these return an error except
|
||||
/// for namespace "local".
|
||||
|
||||
|
||||
// QUERY_OPLOG_REPLAY = 8 (internal replication use only - drivers should not implement)
|
||||
|
||||
|
||||
QUERY_NO_CURSOR_TIMEOUT = 16,
|
||||
/// The server normally times out idle cursors after an inactivity period
|
||||
/// The server normally times out idle cursors after an inactivity period
|
||||
/// (10 minutes) to prevent excess memory use. Set this option to prevent that.
|
||||
|
||||
|
||||
QUERY_AWAIT_DATA = 32,
|
||||
/// Use with QUERY_TAILABLECURSOR. If we are at the end of the data, block for
|
||||
/// a while rather than returning no data. After a timeout period, we do
|
||||
/// Use with QUERY_TAILABLECURSOR. If we are at the end of the data, block for
|
||||
/// a while rather than returning no data. After a timeout period, we do
|
||||
/// return as normal.
|
||||
|
||||
QUERY_EXHAUST = 64,
|
||||
/// Stream the data down full blast in multiple "more" packages, on the
|
||||
/// assumption that the client will fully read all data queried.
|
||||
/// Faster when you are pulling a lot of data and know you want to pull
|
||||
/// it all down.
|
||||
/// Note: the client is not allowed to not read all the data unless it
|
||||
/// Stream the data down full blast in multiple "more" packages, on the
|
||||
/// assumption that the client will fully read all data queried.
|
||||
/// Faster when you are pulling a lot of data and know you want to pull
|
||||
/// it all down.
|
||||
/// Note: the client is not allowed to not read all the data unless it
|
||||
/// closes the connection.
|
||||
|
||||
QUERY_PARTIAL = 128
|
||||
/// Get partial results from a mongos if some shards are down
|
||||
/// Get partial results from a mongos if some shards are down
|
||||
/// (instead of throwing an error).
|
||||
};
|
||||
|
||||
QueryRequest(const std::string& collectionName, Flags flags = QUERY_DEFAULT);
|
||||
/// Creates a QueryRequest.
|
||||
///
|
||||
/// The full collection name is the concatenation of the database
|
||||
/// name with the collection name, using a "." for the concatenation. For example,
|
||||
/// for the database "foo" and the collection "bar", the full collection name is
|
||||
/// The full collection name is the concatenation of the database
|
||||
/// name with the collection name, using a "." for the concatenation. For example,
|
||||
/// for the database "foo" and the collection "bar", the full collection name is
|
||||
/// "foo.bar".
|
||||
|
||||
virtual ~QueryRequest();
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace MongoDB {
|
||||
|
||||
class UpdateRequest: public RequestMessage
|
||||
/// This request is used to update a document in a database
|
||||
/// using the OP_UPDATE client request.
|
||||
/// using the OP_UPDATE client request.
|
||||
{
|
||||
public:
|
||||
enum Flags
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
UPDATE_DEFAULT = 0,
|
||||
/// If set, the database will insert the supplied object into the
|
||||
/// collection if no matching document is found.
|
||||
|
||||
|
||||
UPDATE_UPSERT = 1,
|
||||
/// If set, the database will update all matching objects in the collection.
|
||||
/// Otherwise only updates first matching doc.
|
||||
@@ -50,9 +50,9 @@ public:
|
||||
UpdateRequest(const std::string& collectionName, Flags flags = UPDATE_DEFAULT);
|
||||
/// Creates the UpdateRequest.
|
||||
///
|
||||
/// The full collection name is the concatenation of the database
|
||||
/// name with the collection name, using a "." for the concatenation. For example,
|
||||
/// for the database "foo" and the collection "bar", the full collection name is
|
||||
/// The full collection name is the concatenation of the database
|
||||
/// name with the collection name, using a "." for the concatenation. For example,
|
||||
/// for the database "foo" and the collection "bar", the full collection name is
|
||||
/// "foo.bar".
|
||||
|
||||
virtual ~UpdateRequest();
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Poco {
|
||||
namespace MongoDB {
|
||||
|
||||
|
||||
Array::Array():
|
||||
Array::Array():
|
||||
Document()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace
|
||||
std::map<std::string, std::string> parseKeyValueList(const std::string& str)
|
||||
{
|
||||
std::map<std::string, std::string> kvm;
|
||||
std::string::const_iterator it = str.begin();
|
||||
std::string::const_iterator it = str.begin();
|
||||
std::string::const_iterator end = str.end();
|
||||
while (it != end)
|
||||
{
|
||||
@@ -66,7 +66,7 @@ namespace
|
||||
Poco::StreamCopier::copyToString(decoder, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
std::string encodeBase64(const std::string& data)
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
@@ -133,8 +133,8 @@ bool Database::authenticate(Connection& connection, const std::string& username,
|
||||
{
|
||||
if (username.empty()) throw Poco::InvalidArgumentException("empty username");
|
||||
if (password.empty()) throw Poco::InvalidArgumentException("empty password");
|
||||
|
||||
if (method == AUTH_MONGODB_CR)
|
||||
|
||||
if (method == AUTH_MONGODB_CR)
|
||||
return authCR(connection, username, password);
|
||||
else if (method == AUTH_SCRAM_SHA1)
|
||||
return authSCRAM(connection, username, password);
|
||||
@@ -167,13 +167,13 @@ bool Database::authCR(Connection& connection, const std::string& username, const
|
||||
md5.update(username);
|
||||
md5.update(credsDigest);
|
||||
std::string key = digestToHexString(md5);
|
||||
|
||||
|
||||
pCommand = createCommand();
|
||||
pCommand->selector()
|
||||
.add<Poco::Int32>("authenticate", 1)
|
||||
.add<std::string>("user", username)
|
||||
.add<std::string>("nonce", nonce)
|
||||
.add<std::string>("key", key);
|
||||
.add<std::string>("key", key);
|
||||
|
||||
connection.sendRequest(*pCommand, response);
|
||||
if (response.documents().size() > 0)
|
||||
@@ -189,20 +189,20 @@ bool Database::authSCRAM(Connection& connection, const std::string& username, co
|
||||
{
|
||||
std::string clientNonce(createNonce());
|
||||
std::string clientFirstMsg = Poco::format("n=%s,r=%s", username, clientNonce);
|
||||
|
||||
|
||||
Poco::SharedPtr<QueryRequest> pCommand = createCommand();
|
||||
pCommand->selector()
|
||||
.add<Poco::Int32>("saslStart", 1)
|
||||
.add<std::string>("mechanism", AUTH_SCRAM_SHA1)
|
||||
.add<Binary::Ptr>("payload", new Binary(Poco::format("n,,%s", clientFirstMsg)))
|
||||
.add<bool>("authAuthorize", true);
|
||||
|
||||
.add<bool>("authAuthorize", true);
|
||||
|
||||
ResponseMessage response;
|
||||
connection.sendRequest(*pCommand, response);
|
||||
|
||||
|
||||
Int32 conversationId = 0;
|
||||
std::string serverFirstMsg;
|
||||
|
||||
|
||||
if (response.documents().size() > 0)
|
||||
{
|
||||
Document::Ptr pDoc = response.documents()[0];
|
||||
@@ -215,7 +215,7 @@ bool Database::authSCRAM(Connection& connection, const std::string& username, co
|
||||
else return false;
|
||||
}
|
||||
else throw Poco::ProtocolException("empty response for saslStart");
|
||||
|
||||
|
||||
std::map<std::string, std::string> kvm = parseKeyValueList(serverFirstMsg);
|
||||
const std::string serverNonce = kvm["r"];
|
||||
const std::string salt = decodeBase64(kvm["s"]);
|
||||
@@ -223,40 +223,40 @@ bool Database::authSCRAM(Connection& connection, const std::string& username, co
|
||||
const Poco::UInt32 dkLen = 20;
|
||||
|
||||
std::string hashedPassword = hashCredentials(username, password);
|
||||
|
||||
|
||||
Poco::PBKDF2Engine<Poco::HMACEngine<Poco::SHA1Engine> > pbkdf2(salt, iterations, dkLen);
|
||||
pbkdf2.update(hashedPassword);
|
||||
std::string saltedPassword = digestToBinaryString(pbkdf2);
|
||||
|
||||
|
||||
std::string clientFinalNoProof = Poco::format("c=biws,r=%s", serverNonce);
|
||||
std::string authMessage = Poco::format("%s,%s,%s", clientFirstMsg, serverFirstMsg, clientFinalNoProof);
|
||||
|
||||
|
||||
Poco::HMACEngine<Poco::SHA1Engine> hmacKey(saltedPassword);
|
||||
hmacKey.update(std::string("Client Key"));
|
||||
std::string clientKey = digestToBinaryString(hmacKey);
|
||||
|
||||
|
||||
Poco::SHA1Engine sha1;
|
||||
sha1.update(clientKey);
|
||||
std::string storedKey = digestToBinaryString(sha1);
|
||||
|
||||
|
||||
Poco::HMACEngine<Poco::SHA1Engine> hmacSig(storedKey);
|
||||
hmacSig.update(authMessage);
|
||||
std::string clientSignature = digestToBinaryString(hmacSig);
|
||||
|
||||
|
||||
std::string clientProof(clientKey);
|
||||
for (std::size_t i = 0; i < clientProof.size(); i++)
|
||||
{
|
||||
clientProof[i] ^= clientSignature[i];
|
||||
}
|
||||
|
||||
|
||||
std::string clientFinal = Poco::format("%s,p=%s", clientFinalNoProof, encodeBase64(clientProof));
|
||||
|
||||
|
||||
pCommand = createCommand();
|
||||
pCommand->selector()
|
||||
.add<Poco::Int32>("saslContinue", 1)
|
||||
.add<Poco::Int32>("conversationId", conversationId)
|
||||
.add<Binary::Ptr>("payload", new Binary(clientFinal));
|
||||
|
||||
|
||||
std::string serverSecondMsg;
|
||||
connection.sendRequest(*pCommand, response);
|
||||
if (response.documents().size() > 0)
|
||||
@@ -274,17 +274,17 @@ bool Database::authSCRAM(Connection& connection, const std::string& username, co
|
||||
Poco::HMACEngine<Poco::SHA1Engine> hmacSKey(saltedPassword);
|
||||
hmacSKey.update(std::string("Server Key"));
|
||||
std::string serverKey = digestToBinaryString(hmacSKey);
|
||||
|
||||
|
||||
Poco::HMACEngine<Poco::SHA1Engine> hmacSSig(serverKey);
|
||||
hmacSSig.update(authMessage);
|
||||
std::string serverSignature = digestToBase64(hmacSSig);
|
||||
|
||||
|
||||
kvm = parseKeyValueList(serverSecondMsg);
|
||||
std::string serverSignatureReceived = kvm["v"];
|
||||
|
||||
if (serverSignature != serverSignatureReceived)
|
||||
|
||||
if (serverSignature != serverSignatureReceived)
|
||||
throw Poco::ProtocolException("server signature verification failed");
|
||||
|
||||
|
||||
pCommand = createCommand();
|
||||
pCommand->selector()
|
||||
.add<Poco::Int32>("saslContinue", 1)
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace MongoDB {
|
||||
|
||||
|
||||
DeleteRequest::DeleteRequest(const std::string& collectionName, DeleteRequest::Flags flags):
|
||||
RequestMessage(MessageHeader::OP_DELETE),
|
||||
_flags(flags),
|
||||
RequestMessage(MessageHeader::OP_DELETE),
|
||||
_flags(flags),
|
||||
_fullCollectionName(collectionName),
|
||||
_selector()
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ Element::Element(const std::string& name) : _name(name)
|
||||
}
|
||||
|
||||
|
||||
Element::~Element()
|
||||
Element::~Element()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace MongoDB {
|
||||
|
||||
|
||||
GetMoreRequest::GetMoreRequest(const std::string& collectionName, Int64 cursorID):
|
||||
RequestMessage(MessageHeader::OP_GET_MORE),
|
||||
RequestMessage(MessageHeader::OP_GET_MORE),
|
||||
_fullCollectionName(collectionName),
|
||||
_numberToReturn(100),
|
||||
_cursorID(cursorID)
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace MongoDB {
|
||||
|
||||
|
||||
InsertRequest::InsertRequest(const std::string& collectionName, Flags flags):
|
||||
RequestMessage(MessageHeader::OP_INSERT),
|
||||
RequestMessage(MessageHeader::OP_INSERT),
|
||||
_flags(flags),
|
||||
_fullCollectionName(collectionName)
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ void KillCursorsRequest::buildRequest(BinaryWriter& writer)
|
||||
for (std::vector<Int64>::iterator it = _cursors.begin(); it != _cursors.end(); ++it)
|
||||
{
|
||||
writer << *it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Poco {
|
||||
namespace MongoDB {
|
||||
|
||||
|
||||
Message::Message(MessageHeader::OpCode opcode):
|
||||
Message::Message(MessageHeader::OpCode opcode):
|
||||
_header(opcode)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -20,10 +20,10 @@ namespace Poco {
|
||||
namespace MongoDB {
|
||||
|
||||
|
||||
MessageHeader::MessageHeader(OpCode opCode):
|
||||
_messageLength(0),
|
||||
_requestID(0),
|
||||
_responseTo(0),
|
||||
MessageHeader::MessageHeader(OpCode opCode):
|
||||
_messageLength(0),
|
||||
_requestID(0),
|
||||
_responseTo(0),
|
||||
_opCode(opCode)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ ObjectId::ObjectId(const std::string& id)
|
||||
poco_assert_dbg(id.size() == 24);
|
||||
|
||||
const char* p = id.c_str();
|
||||
for (std::size_t i = 0; i < 12; ++i)
|
||||
for (std::size_t i = 0; i < 12; ++i)
|
||||
{
|
||||
_id[i] = fromHex(p);
|
||||
p += 2;
|
||||
|
||||
@@ -20,10 +20,10 @@ namespace MongoDB {
|
||||
|
||||
|
||||
QueryRequest::QueryRequest(const std::string& collectionName, QueryRequest::Flags flags):
|
||||
RequestMessage(MessageHeader::OP_QUERY),
|
||||
_flags(flags),
|
||||
RequestMessage(MessageHeader::OP_QUERY),
|
||||
_flags(flags),
|
||||
_fullCollectionName(collectionName),
|
||||
_numberToSkip(0),
|
||||
_numberToSkip(0),
|
||||
_numberToReturn(100),
|
||||
_selector(),
|
||||
_returnFieldSelector()
|
||||
|
||||
@@ -25,8 +25,8 @@ RegularExpression::RegularExpression()
|
||||
}
|
||||
|
||||
|
||||
RegularExpression::RegularExpression(const std::string& pattern, const std::string& options):
|
||||
_pattern(pattern),
|
||||
RegularExpression::RegularExpression(const std::string& pattern, const std::string& options):
|
||||
_pattern(pattern),
|
||||
_options(options)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Poco {
|
||||
namespace MongoDB {
|
||||
|
||||
|
||||
ReplicaSet::ReplicaSet(const std::vector<Net::SocketAddress> &addresses):
|
||||
ReplicaSet::ReplicaSet(const std::vector<Net::SocketAddress> &addresses):
|
||||
_addresses(addresses)
|
||||
{
|
||||
}
|
||||
@@ -81,8 +81,8 @@ Connection::Ptr ReplicaSet::isMaster(const Net::SocketAddress& address)
|
||||
{
|
||||
conn = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@ namespace MongoDB {
|
||||
|
||||
|
||||
ResponseMessage::ResponseMessage():
|
||||
Message(MessageHeader::OP_REPLY),
|
||||
_responseFlags(0),
|
||||
_cursorID(0),
|
||||
_startingFrom(0),
|
||||
Message(MessageHeader::OP_REPLY),
|
||||
_responseFlags(0),
|
||||
_cursorID(0),
|
||||
_startingFrom(0),
|
||||
_numberReturned(0)
|
||||
{
|
||||
}
|
||||
@@ -60,7 +60,7 @@ void ResponseMessage::read(std::istream& istr)
|
||||
clear();
|
||||
|
||||
BinaryReader reader(istr, BinaryReader::LITTLE_ENDIAN_BYTE_ORDER);
|
||||
|
||||
|
||||
_header.read(reader);
|
||||
|
||||
reader >> _responseFlags;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace MongoDB {
|
||||
|
||||
|
||||
UpdateRequest::UpdateRequest(const std::string& collectionName, UpdateRequest::Flags flags):
|
||||
RequestMessage(MessageHeader::OP_UPDATE),
|
||||
RequestMessage(MessageHeader::OP_UPDATE),
|
||||
_flags(flags),
|
||||
_fullCollectionName(collectionName),
|
||||
_selector(),
|
||||
|
||||
@@ -24,7 +24,7 @@ int _tmain(int argc, wchar_t* argv[])
|
||||
std::wcstombs(buffer, argv[i], sizeof(buffer));
|
||||
args.push_back(std::string(buffer));
|
||||
}
|
||||
CppUnit::TestRunner runner;
|
||||
CppUnit::TestRunner runner;
|
||||
runner.addTest("MongoDBTestSuite", MongoDBTestSuite::suite());
|
||||
return runner.run(args) ? 0 : 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user