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:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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); }
|
||||
|
||||
Reference in New Issue
Block a user