1
0
mirror of https://github.com/stefanocasazza/ULib.git synced 2025-10-26 19:57:22 +08:00

some fix + UMongoDBClient find extension

This commit is contained in:
stefanocasazza
2016-05-16 15:40:17 +02:00
parent be68eeb09c
commit 4c2a92c11b
39 changed files with 596 additions and 551 deletions

View File

@@ -129,9 +129,7 @@ public:
{
U_TRACE_NO_PARAM(0, "UClient_Base::reset()")
# ifdef DEBUG
uri.clear(); // NB: to avoid DEAD OF SOURCE STRING WITH CHILD ALIVE... (uri can be a substr of url)
# endif
url.clear();
}

View File

@@ -101,9 +101,9 @@ public:
{
U_TRACE_NO_PARAM(0, "UHttpClient_Base::isPasswordAuthentication()")
bool result = (user && password);
if (user && password) U_RETURN(true);
U_RETURN(result);
U_RETURN(false);
}
void setRequestPasswordAuthentication(const UString& _user, const UString& _password)

View File

@@ -82,7 +82,7 @@ public:
BSON_APPEND_INT32(query, "_id", value);
bool result = find(query);
bool result = find(query, 0);
U_SYSCALL_VOID(bson_destroy, "%p", query);
@@ -102,7 +102,7 @@ public:
bson_t* query = (bson_t*) U_SYSCALL_NO_PARAM(bson_new);
bool result = find(query);
bool result = find(query, 0);
U_SYSCALL_VOID(bson_destroy, "%p", query);
@@ -122,6 +122,8 @@ public:
bool findOne(const char* json, uint32_t len);
bool find(bson_t* query, bson_t* projection);
bool update(bson_t* query, bson_t* update);
bool findAndModify(bson_t* query, bson_t* update);
@@ -143,8 +145,6 @@ protected:
mongoc_client_t* client;
mongoc_cursor_t* cursor;
mongoc_collection_t* collection;
bool find(bson_t* query);
#endif
private:

View File

@@ -125,9 +125,13 @@ public:
{
U_TRACE_NO_PARAM(0, "UIPAllow::isEmpty()")
bool result = (device.empty() || host.empty());
if (device.empty() ||
host.empty())
{
U_RETURN(true);
}
U_RETURN(result);
U_RETURN(false);
}
static bool getNetworkInterface(UVector<UIPAllow*>& vipallow);
@@ -292,11 +296,14 @@ public:
{
U_TRACE(0, "UIPAddress::operator==(%p)", &cOtherAddr)
bool result = (iAddressType == cOtherAddr.iAddressType) &&
(iAddressLength == cOtherAddr.iAddressLength) &&
(memcmp(pcAddress.p, cOtherAddr.pcAddress.p, iAddressLength) == 0);
if (iAddressType == cOtherAddr.iAddressType &&
iAddressLength == cOtherAddr.iAddressLength &&
(memcmp(pcAddress.p, cOtherAddr.pcAddress.p, iAddressLength) == 0))
{
U_RETURN(true);
}
U_RETURN(result);
U_RETURN(false);
}
bool operator!=(const UIPAddress& cOtherAddr) const { return !operator==(cOtherAddr); }