forked from acouzens/open5gs
supports old version mongoc library such like 1.3.1
This commit is contained in:
parent
87048f7ff4
commit
36dba9ddf9
|
@ -294,7 +294,7 @@ AC_CHECK_LIB([fdcore], [fd_core_initialize], [LIBS="${LIBS} -lfdcore"])
|
|||
AC_CHECK_LIB([fdproto], [fd_libproto_init], [LIBS="${LIBS} -lfdproto"])
|
||||
AC_CHECK_LIB([gnutls], [gnutls_global_init], [LIBS="${LIBS} -lgnutls"])
|
||||
|
||||
PKG_CHECK_MODULES([MONGOC], libmongoc-1.0 >= 1.6.3)
|
||||
PKG_CHECK_MODULES([MONGOC], libmongoc-1.0 >= 1.3.1)
|
||||
LIBS="$LIBS $MONGOC_LIBS"
|
||||
#PKG_CHECK_MODULES([LIBXML2], libxml-2.0 >= 2.9.1)
|
||||
#LIBS="$LIBS $LIBXML2_LIBS"
|
||||
|
|
|
@ -238,7 +238,9 @@ status_t context_db_init(char *db_uri)
|
|||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 4
|
||||
mongoc_client_set_error_api(self.db_client, 2);
|
||||
#endif
|
||||
|
||||
uri = mongoc_client_get_uri(self.db_client);
|
||||
d_assert(uri, context_db_final(); return CORE_ERROR,
|
||||
|
|
|
@ -254,8 +254,13 @@ status_t hss_db_auth_info(
|
|||
mutex_lock(self.db_lock);
|
||||
|
||||
query = BCON_NEW("imsi", BCON_UTF8(imsi_bcd));
|
||||
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 5
|
||||
cursor = mongoc_collection_find_with_opts(
|
||||
self.subscriberCollection, query, NULL, NULL);
|
||||
#else
|
||||
cursor = mongoc_collection_find(self.subscriberCollection,
|
||||
MONGOC_QUERY_NONE, 0, 0, 0, query, NULL, NULL);
|
||||
#endif
|
||||
|
||||
if (!mongoc_cursor_next(cursor, &document))
|
||||
{
|
||||
|
@ -425,8 +430,13 @@ status_t hss_db_subscription_data(
|
|||
mutex_lock(self.db_lock);
|
||||
|
||||
query = BCON_NEW("imsi", BCON_UTF8(imsi_bcd));
|
||||
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 5
|
||||
cursor = mongoc_collection_find_with_opts(
|
||||
self.subscriberCollection, query, NULL, NULL);
|
||||
#else
|
||||
cursor = mongoc_collection_find(self.subscriberCollection,
|
||||
MONGOC_QUERY_NONE, 0, 0, 0, query, NULL, NULL);
|
||||
#endif
|
||||
|
||||
if (!mongoc_cursor_next(cursor, &document))
|
||||
{
|
||||
|
|
|
@ -256,17 +256,32 @@ status_t pcrf_db_pdn_data(
|
|||
|
||||
mutex_lock(self.db_lock);
|
||||
|
||||
query = BCON_NEW(
|
||||
"imsi", BCON_UTF8(imsi_bcd),
|
||||
"pdn.apn", BCON_UTF8(apn));
|
||||
opts = BCON_NEW(
|
||||
"projection", "{",
|
||||
"imsi", BCON_INT64(1),
|
||||
"pdn.$", BCON_INT64(1),
|
||||
"}"
|
||||
);
|
||||
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 5
|
||||
query = BCON_NEW(
|
||||
"imsi", BCON_UTF8(imsi_bcd),
|
||||
"pdn.apn", BCON_UTF8(apn));
|
||||
cursor = mongoc_collection_find_with_opts(
|
||||
self.subscriberCollection, query, opts, NULL);
|
||||
#else
|
||||
query = BCON_NEW(
|
||||
"$query", "{",
|
||||
"imsi", BCON_UTF8(imsi_bcd),
|
||||
"pdn.apn", BCON_UTF8(apn),
|
||||
"}",
|
||||
"$projection", "{",
|
||||
"imsi", BCON_INT64(1),
|
||||
"pdn.$", BCON_INT64(1),
|
||||
"}"
|
||||
);
|
||||
cursor = mongoc_collection_find(self.subscriberCollection,
|
||||
MONGOC_QUERY_NONE, 0, 0, 0, query, NULL, NULL);
|
||||
#endif
|
||||
|
||||
if (!mongoc_cursor_next(cursor, &document))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue