本文整理汇总了C++中MONGOC_WARNING函数的典型用法代码示例。如果您正苦于以下问题:C++ MONGOC_WARNING函数的具体用法?C++ MONGOC_WARNING怎么用?C++ MONGOC_WARNING使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MONGOC_WARNING函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: test_delete
static void
test_delete (void)
{
mongoc_collection_t *collection;
mongoc_database_t *database;
mongoc_client_t *client;
bson_context_t *context;
bson_error_t error;
bool r;
bson_oid_t oid;
bson_t b;
int i;
client = mongoc_client_new(gTestUri);
ASSERT (client);
database = get_test_database (client);
ASSERT (database);
collection = get_test_collection (client, "test_delete");
ASSERT (collection);
context = bson_context_new(BSON_CONTEXT_NONE);
ASSERT (context);
for (i = 0; i < 100; i++) {
bson_init(&b);
bson_oid_init(&oid, context);
bson_append_oid(&b, "_id", 3, &oid);
bson_append_utf8(&b, "hello", 5, "world", 5);
r = mongoc_collection_insert(collection, MONGOC_INSERT_NONE, &b, NULL,
&error);
if (!r) {
MONGOC_WARNING("%s\n", error.message);
}
ASSERT (r);
bson_destroy(&b);
bson_init(&b);
bson_append_oid(&b, "_id", 3, &oid);
r = mongoc_collection_delete(collection, MONGOC_DELETE_NONE, &b, NULL,
&error);
if (!r) {
MONGOC_WARNING("%s\n", error.message);
}
ASSERT (r);
bson_destroy(&b);
}
r = mongoc_collection_drop (collection, &error);
ASSERT (r);
mongoc_collection_destroy(collection);
mongoc_database_destroy(database);
bson_context_destroy(context);
mongoc_client_destroy(client);
}
开发者ID:Convey-Compliance,项目名称:mongo-c-driver,代码行数:57,代码来源:test-mongoc-collection.c
示例2: mongoc_uncompress
bool
mongoc_uncompress (int32_t compressor_id,
const uint8_t *compressed,
size_t compressed_len,
uint8_t *uncompressed,
size_t *uncompressed_len)
{
TRACE ("Uncompressing with '%s' (%d)",
mongoc_compressor_id_to_name (compressor_id),
compressor_id);
switch (compressor_id) {
case MONGOC_COMPRESSOR_SNAPPY_ID: {
#ifdef MONGOC_ENABLE_COMPRESSION_SNAPPY
snappy_status status;
status = snappy_uncompress ((const char *) compressed,
compressed_len,
(char *) uncompressed,
uncompressed_len);
return status == SNAPPY_OK;
#else
MONGOC_WARNING ("Received snappy compressed opcode, but snappy "
"compression is not compiled in");
return false;
#endif
break;
}
case MONGOC_COMPRESSOR_ZLIB_ID: {
#ifdef MONGOC_ENABLE_COMPRESSION_ZLIB
int ok;
ok = uncompress (uncompressed,
(unsigned long *) uncompressed_len,
compressed,
compressed_len);
return ok == Z_OK;
#else
MONGOC_WARNING ("Received zlib compressed opcode, but zlib "
"compression is not compiled in");
return false;
#endif
break;
}
case MONGOC_COMPRESSOR_NOOP_ID:
memcpy (uncompressed, compressed, compressed_len);
*uncompressed_len = compressed_len;
return true;
default:
MONGOC_WARNING ("Unknown compressor ID %d", compressor_id);
}
return false;
}
开发者ID:acmorrow,项目名称:mongo-c-driver,代码行数:56,代码来源:mongoc-compression.c
示例3: _mongoc_rpc_printf
void
_mongoc_rpc_printf (mongoc_rpc_t *rpc)
{
bson_return_if_fail(rpc);
switch ((mongoc_opcode_t)rpc->header.opcode) {
case MONGOC_OPCODE_REPLY:
_mongoc_rpc_printf_reply(&rpc->reply);
break;
case MONGOC_OPCODE_MSG:
_mongoc_rpc_printf_msg(&rpc->msg);
break;
case MONGOC_OPCODE_UPDATE:
_mongoc_rpc_printf_update(&rpc->update);
break;
case MONGOC_OPCODE_INSERT:
_mongoc_rpc_printf_insert(&rpc->insert);
break;
case MONGOC_OPCODE_QUERY:
_mongoc_rpc_printf_query(&rpc->query);
break;
case MONGOC_OPCODE_GET_MORE:
_mongoc_rpc_printf_get_more(&rpc->get_more);
break;
case MONGOC_OPCODE_DELETE:
_mongoc_rpc_printf_delete(&rpc->delete);
break;
case MONGOC_OPCODE_KILL_CURSORS:
_mongoc_rpc_printf_kill_cursors(&rpc->kill_cursors);
break;
default:
MONGOC_WARNING("Unknown rpc type: 0x%08x", rpc->header.opcode);
break;
}
}
开发者ID:HeliumProject,项目名称:mongo-c-driver,代码行数:35,代码来源:mongoc-rpc.c
示例4: mongoc_bulk_operation_replace_one
void
mongoc_bulk_operation_replace_one (mongoc_bulk_operation_t *bulk,
const bson_t *selector,
const bson_t *document,
bool upsert)
{
mongoc_write_command_t command = { 0 };
size_t err_off;
bson_return_if_fail (bulk);
bson_return_if_fail (selector);
bson_return_if_fail (document);
ENTRY;
if (!bson_validate (document,
(BSON_VALIDATE_DOT_KEYS | BSON_VALIDATE_DOLLAR_KEYS),
&err_off)) {
MONGOC_WARNING ("%s(): replacement document may not contain "
"$ or . in keys. Ingoring document.",
__FUNCTION__);
EXIT;
}
_mongoc_write_command_init_update (&command, selector, document, upsert,
false, bulk->ordered);
_mongoc_array_append_val (&bulk->commands, command);
EXIT;
}
开发者ID:MiloCasagrande,项目名称:mongo-c-driver,代码行数:30,代码来源:mongoc-bulk-operation.c
示例5: mongoc_bulk_operation_update_one
void
mongoc_bulk_operation_update_one (mongoc_bulk_operation_t *bulk,
const bson_t *selector,
const bson_t *document,
bool upsert)
{
mongoc_write_command_t command = { 0 };
bson_iter_t iter;
bson_return_if_fail (bulk);
bson_return_if_fail (selector);
bson_return_if_fail (document);
ENTRY;
if (bson_iter_init (&iter, document)) {
while (bson_iter_next (&iter)) {
if (!strchr (bson_iter_key (&iter), '$')) {
MONGOC_WARNING ("%s(): update_one only works with $ operators.",
__FUNCTION__);
EXIT;
}
}
}
_mongoc_write_command_init_update (&command, selector, document, upsert,
false, bulk->ordered);
_mongoc_array_append_val (&bulk->commands, command);
EXIT;
}
开发者ID:MiloCasagrande,项目名称:mongo-c-driver,代码行数:30,代码来源:mongoc-bulk-operation.c
示例6: _mongoc_socket_sockopt_value_to_name
static const char *
_mongoc_socket_sockopt_value_to_name (int value)
{
switch (value) {
#ifdef TCP_KEEPIDLE
case TCP_KEEPIDLE:
return "TCP_KEEPIDLE";
#endif
#ifdef TCP_KEEPALIVE
case TCP_KEEPALIVE:
return "TCP_KEEPALIVE";
#endif
#ifdef TCP_KEEPINTVL
case TCP_KEEPINTVL:
return "TCP_KEEPINTVL";
#endif
#ifdef TCP_KEEPCNT
case TCP_KEEPCNT:
return "TCP_KEEPCNT";
#endif
default:
MONGOC_WARNING ("Don't know what socketopt %d is", value);
return "Unknown option name";
}
}
开发者ID:acmorrow,项目名称:mongo-c-driver,代码行数:25,代码来源:mongoc-socket.c
示例7: test_count
static void
test_count (void)
{
mongoc_collection_t *collection;
mongoc_client_t *client;
bson_error_t error;
int64_t count;
bson_t b;
client = mongoc_client_new(gTestUri);
ASSERT (client);
collection = mongoc_client_get_collection(client, "test", "test");
ASSERT (collection);
bson_init(&b);
count = mongoc_collection_count(collection, MONGOC_QUERY_NONE, &b,
0, 0, NULL, &error);
bson_destroy(&b);
if (count == -1) {
MONGOC_WARNING("%s\n", error.message);
}
ASSERT (count != -1);
mongoc_collection_destroy(collection);
mongoc_client_destroy(client);
}
开发者ID:glee314,项目名称:mongo-c-driver,代码行数:28,代码来源:test-mongoc-collection.c
示例8: mock_server_replies
void
mock_server_replies (request_t *request,
mongoc_reply_flags_t flags,
int64_t cursor_id,
int32_t starting_from,
int32_t number_returned,
const char *docs_json)
{
char *quotes_replaced;
bson_t doc;
bson_error_t error;
bool r;
assert (request);
if (docs_json) {
quotes_replaced = single_quotes_to_double (docs_json);
r = bson_init_from_json (&doc, quotes_replaced, -1, &error);
if (!r) {
MONGOC_WARNING ("%s", error.message);
return;
}
bson_free (quotes_replaced);
} else {
r = bson_init_from_json (&doc, "{}", -1, &error);
}
mock_server_reply_multi (request,
flags,
&doc,
1,
cursor_id);
bson_destroy (&doc);
}
开发者ID:Zhangli88,项目名称:mongo-c-driver,代码行数:35,代码来源:mock-server.c
示例9: mongoc_stream_new_from_unix
/**
* mongoc_stream_new_from_unix:
* @fd: A unix style file-descriptor.
*
* Create a new mongoc_stream_t for a UNIX file descriptor. This is
* expected to be a socket of some sort (such as a UNIX or TCP socket).
*
* This may be useful after having connected to a peer to provide a
* higher level API for reading and writing. It also allows for
* interoperability with external stream abstractions in higher level
* languages.
*
* Returns: A newly allocated mongoc_stream_t that should be freed with
* mongoc_stream_destroy().
*/
mongoc_stream_t *
mongoc_stream_new_from_unix (int fd)
{
mongoc_stream_unix_t *stream;
int flags;
bson_return_val_if_fail(fd != -1, NULL);
/*
* If we cannot put the file-descriptor in O_NONBLOCK mode, there isn't much
* we can do. Just fail.
*/
flags = fcntl(fd, F_GETFD);
if ((flags & O_NONBLOCK) != O_NONBLOCK) {
if (fcntl(fd, F_SETFD, flags | O_NONBLOCK) == -1) {
MONGOC_WARNING("Failed to set O_NONBLOCK on file descriptor!");
return NULL;
}
}
stream = bson_malloc0(sizeof *stream);
stream->fd = fd;
stream->stream.destroy = mongoc_stream_unix_destroy;
stream->stream.close = mongoc_stream_unix_close;
stream->stream.flush = mongoc_stream_unix_flush;
stream->stream.writev = mongoc_stream_unix_writev;
stream->stream.readv = mongoc_stream_unix_readv;
stream->stream.cork = mongoc_stream_unix_cork;
stream->stream.uncork = mongoc_stream_unix_uncork;
return (mongoc_stream_t *)stream;
}
开发者ID:waitman,项目名称:libmongoc,代码行数:47,代码来源:mongoc-stream.c
示例10: _mongoc_rpc_gather
void
_mongoc_rpc_gather (mongoc_rpc_t *rpc,
mongoc_array_t *array)
{
bson_return_if_fail(rpc);
bson_return_if_fail(array);
switch ((mongoc_opcode_t)rpc->header.opcode) {
case MONGOC_OPCODE_REPLY:
return _mongoc_rpc_gather_reply(&rpc->reply, array);
case MONGOC_OPCODE_MSG:
return _mongoc_rpc_gather_msg(&rpc->msg, array);
case MONGOC_OPCODE_UPDATE:
return _mongoc_rpc_gather_update(&rpc->update, array);
case MONGOC_OPCODE_INSERT:
return _mongoc_rpc_gather_insert(&rpc->insert, array);
case MONGOC_OPCODE_QUERY:
return _mongoc_rpc_gather_query(&rpc->query, array);
case MONGOC_OPCODE_GET_MORE:
return _mongoc_rpc_gather_get_more(&rpc->get_more, array);
case MONGOC_OPCODE_DELETE:
return _mongoc_rpc_gather_delete(&rpc->delete, array);
case MONGOC_OPCODE_KILL_CURSORS:
return _mongoc_rpc_gather_kill_cursors(&rpc->kill_cursors, array);
default:
MONGOC_WARNING("Unknown rpc type: 0x%08x", rpc->header.opcode);
break;
}
}
开发者ID:HeliumProject,项目名称:mongo-c-driver,代码行数:29,代码来源:mongoc-rpc.c
示例11: _mongoc_secure_transport_extract_subject
char *
_mongoc_secure_transport_extract_subject (const char *filename, const char *passphrase)
{
char *retval = NULL;
CFArrayRef items = NULL;
SecExternalItemType type = kSecItemTypeCertificate;
bool success = _mongoc_secure_transport_import_pem (filename, passphrase, &items, &type);
if (!success) {
MONGOC_WARNING("Can't find certificate in '%s'", filename);
return NULL;
}
if (type == kSecItemTypeAggregate) {
for (CFIndex i = 0; i < CFArrayGetCount (items); ++i) {
CFTypeID item_id = CFGetTypeID (CFArrayGetValueAtIndex (items, i));
if (item_id == SecCertificateGetTypeID()) {
retval = _mongoc_secure_transport_RFC2253_from_cert ((SecCertificateRef)CFArrayGetValueAtIndex (items, i));
break;
}
}
} else if (type == kSecItemTypeCertificate) {
retval = _mongoc_secure_transport_RFC2253_from_cert ((SecCertificateRef)items);
}
if (items) {
CFRelease (items);
}
return retval;
}
开发者ID:NikolaySt,项目名称:mongo-c-driver,代码行数:33,代码来源:mongoc-secure-transport.c
示例12: test_insert
static void
test_insert (void)
{
mongoc_database_t *database;
mongoc_collection_t *collection;
mongoc_client_t *client;
bson_context_t *context;
bson_error_t error;
bool r;
bson_oid_t oid;
unsigned i;
bson_t b;
client = mongoc_client_new(gTestUri);
ASSERT (client);
database = get_test_database (client);
ASSERT (database);
collection = get_test_collection (client, "test_insert");
ASSERT (collection);
mongoc_collection_drop(collection, &error);
context = bson_context_new(BSON_CONTEXT_NONE);
ASSERT (context);
for (i = 0; i < 10; i++) {
bson_init(&b);
bson_oid_init(&oid, context);
bson_append_oid(&b, "_id", 3, &oid);
bson_append_utf8(&b, "hello", 5, "/world", 5);
r = mongoc_collection_insert(collection, MONGOC_INSERT_NONE, &b, NULL,
&error);
if (!r) {
MONGOC_WARNING("%s\n", error.message);
}
ASSERT (r);
bson_destroy(&b);
}
bson_init (&b);
BSON_APPEND_INT32 (&b, "$hello", 1);
r = mongoc_collection_insert (collection, MONGOC_INSERT_NONE, &b, NULL,
&error);
ASSERT (!r);
ASSERT (error.domain == MONGOC_ERROR_BSON);
ASSERT (error.code == MONGOC_ERROR_BSON_INVALID);
bson_destroy (&b);
r = mongoc_collection_drop (collection, &error);
ASSERT (r);
mongoc_collection_destroy(collection);
mongoc_database_destroy(database);
bson_context_destroy(context);
mongoc_client_destroy(client);
}
开发者ID:Convey-Compliance,项目名称:mongo-c-driver,代码行数:59,代码来源:test-mongoc-collection.c
示例13: ha_node_setup
void
ha_node_setup (ha_node_t *node)
{
if (!!mkdir(node->dbpath, 0750)) {
MONGOC_WARNING("Failed to create directory \"%s\"",
node->dbpath);
abort();
}
}
开发者ID:hy,项目名称:mongo-c-driver,代码行数:9,代码来源:ha-test.c
示例14: _mongoc_write_concern_warn_frozen
static BSON_INLINE bool
_mongoc_write_concern_warn_frozen (mongoc_write_concern_t *write_concern)
{
if (write_concern->frozen) {
MONGOC_WARNING("Cannot modify a frozen write-concern.");
}
return write_concern->frozen;
}
开发者ID:Brainstormers,项目名称:ChatScript,代码行数:9,代码来源:mongoc-write-concern.c
示例15: _get_os_version
static char *
_get_os_version (void)
{
char *ret = bson_malloc (METADATA_OS_VERSION_MAX);
bool found = false;
#ifdef _WIN32
OSVERSIONINFO osvi;
ZeroMemory (&osvi, sizeof (OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
if (GetVersionEx (&osvi)) {
bson_snprintf (ret,
METADATA_OS_VERSION_MAX,
"%d.%d (%d)",
osvi.dwMajorVersion,
osvi.dwMinorVersion,
osvi.dwBuildNumber);
found = true;
} else {
MONGOC_WARNING ("Error with GetVersionEx(): %d",
GetLastError ());
}
#elif defined (_POSIX_VERSION)
struct utsname system_info;
if (uname (&system_info) >= 0) {
bson_strncpy (ret, system_info.release,
METADATA_OS_VERSION_MAX);
found = true;
} else {
MONGOC_WARNING ("Error with uname(): %d", errno);
}
#endif
if (!found) {
bson_free (ret);
ret = NULL;
}
return ret;
}
开发者ID:fionaRowan,项目名称:mongo-c-driver,代码行数:44,代码来源:mongoc-metadata.c
示例16: txn_abort
static bool
txn_abort (mongoc_client_session_t *session, bson_t *reply, bson_error_t *error)
{
bson_t cmd = BSON_INITIALIZER;
bson_t opts = BSON_INITIALIZER;
bson_error_t err_local;
bson_error_t *err_ptr = error ? error : &err_local;
bson_t reply_local = BSON_INITIALIZER;
mongoc_write_err_type_t error_type;
bool r = false;
_mongoc_bson_init_if_set (reply);
if (!mongoc_client_session_append (session, &opts, err_ptr)) {
GOTO (done);
}
if (session->txn.opts.write_concern) {
if (!mongoc_write_concern_append (session->txn.opts.write_concern,
&opts)) {
bson_set_error (err_ptr,
MONGOC_ERROR_TRANSACTION,
MONGOC_ERROR_TRANSACTION_INVALID_STATE,
"Invalid transaction write concern");
GOTO (done);
}
}
BSON_APPEND_INT32 (&cmd, "abortTransaction", 1);
/* will be reinitialized by mongoc_client_write_command_with_opts */
bson_destroy (&reply_local);
r = mongoc_client_write_command_with_opts (
session->client, "admin", &cmd, &opts, &reply_local, err_ptr);
/* Transactions Spec: "Drivers MUST retry the commitTransaction command once
* after it fails with a retryable error", same for abort */
error_type = _mongoc_write_error_get_type (r, err_ptr, &reply_local);
if (error_type == MONGOC_WRITE_ERR_RETRY) {
bson_destroy (&reply_local);
r = mongoc_client_write_command_with_opts (
session->client, "admin", &cmd, &opts, &reply_local, err_ptr);
}
if (!r) {
/* we won't return an error from abortTransaction, so warn */
MONGOC_WARNING ("Error in abortTransaction: %s", err_ptr->message);
}
done:
bson_destroy (&reply_local);
bson_destroy (&cmd);
bson_destroy (&opts);
return r;
}
开发者ID:jmikola,项目名称:mongo-c-driver,代码行数:56,代码来源:mongoc-client-session.c
示例17: mongoc_ssl_extract_subject
char *
mongoc_ssl_extract_subject (const char *filename, const char *passphrase)
{
char *retval;
if (!filename) {
MONGOC_ERROR ("No filename provided to extract subject from");
return NULL;
}
#ifdef _WIN32
if (_access (filename, 0) != 0) {
#else
if (access (filename, R_OK) != 0) {
#endif
MONGOC_ERROR ("Can't extract subject from unreadable file: '%s'",
filename);
return NULL;
}
#if defined(MONGOC_ENABLE_SSL_OPENSSL)
retval = _mongoc_openssl_extract_subject (filename, passphrase);
#elif defined(MONGOC_ENABLE_SSL_LIBRESSL)
MONGOC_WARNING (
"libtls doesn't support automatically extracting subject from "
"certificate to use with authentication");
retval = NULL;
#elif defined(MONGOC_ENABLE_SSL_SECURE_TRANSPORT)
retval = _mongoc_secure_transport_extract_subject (filename, passphrase);
#elif defined(MONGOC_ENABLE_SSL_SECURE_CHANNEL)
retval = _mongoc_secure_channel_extract_subject (filename, passphrase);
#endif
if (!retval) {
MONGOC_ERROR ("Can't extract subject from file '%s'", filename);
}
return retval;
}
void
_mongoc_ssl_opts_copy_to (const mongoc_ssl_opt_t *src, mongoc_ssl_opt_t *dst)
{
BSON_ASSERT (src);
BSON_ASSERT (dst);
dst->pem_file = bson_strdup (src->pem_file);
dst->pem_pwd = bson_strdup (src->pem_pwd);
dst->ca_file = bson_strdup (src->ca_file);
dst->ca_dir = bson_strdup (src->ca_dir);
dst->crl_file = bson_strdup (src->crl_file);
dst->weak_cert_validation = src->weak_cert_validation;
dst->allow_invalid_hostname = src->allow_invalid_hostname;
}
开发者ID:mschoenlaub,项目名称:mongo-c-driver,代码行数:54,代码来源:mongoc-ssl.c
示例18: mongoc_uri_unescape
char *
mongoc_uri_unescape (const char *escaped_string)
{
bson_unichar_t c;
bson_string_t *str;
unsigned int hex = 0;
const char *ptr;
const char *end;
size_t len;
BSON_ASSERT (escaped_string);
len = strlen(escaped_string);
/*
* Double check that this is a UTF-8 valid string. Bail out if necessary.
*/
if (!bson_utf8_validate(escaped_string, len, false)) {
MONGOC_WARNING("%s(): escaped_string contains invalid UTF-8",
BSON_FUNC);
return NULL;
}
ptr = escaped_string;
end = ptr + len;
str = bson_string_new(NULL);
for (; *ptr; ptr = bson_utf8_next_char(ptr)) {
c = bson_utf8_get_char(ptr);
switch (c) {
case '%':
if (((end - ptr) < 2) ||
!isxdigit(ptr[1]) ||
!isxdigit(ptr[2]) ||
#ifdef _MSC_VER
(1 != sscanf_s(&ptr[1], "%02x", &hex)) ||
#else
(1 != sscanf(&ptr[1], "%02x", &hex)) ||
#endif
!isprint(hex)) {
bson_string_free(str, true);
return NULL;
}
bson_string_append_c(str, hex);
ptr += 2;
break;
default:
bson_string_append_unichar(str, c);
break;
}
}
return bson_string_free(str, false);
}
开发者ID:fionaRowan,项目名称:mongo-c-driver,代码行数:54,代码来源:mongoc-uri.c
示例19: _mongoc_matcher_op_lte_match
static bool
_mongoc_matcher_op_lte_match (mongoc_matcher_op_compare_t *compare, /* IN */
bson_iter_t *iter) /* IN */
{
int code;
BSON_ASSERT (compare);
BSON_ASSERT (iter);
code = _TYPE_CODE (bson_iter_type (&compare->iter),
bson_iter_type (iter));
switch (code) {
/* Double on Left Side */
case _TYPE_CODE(BSON_TYPE_DOUBLE, BSON_TYPE_DOUBLE):
return _LTE_COMPARE (_double, _double);
case _TYPE_CODE(BSON_TYPE_DOUBLE, BSON_TYPE_BOOL):
return _LTE_COMPARE (_double, _bool);
case _TYPE_CODE(BSON_TYPE_DOUBLE, BSON_TYPE_INT32):
return _LTE_COMPARE (_double, _int32);
case _TYPE_CODE(BSON_TYPE_DOUBLE, BSON_TYPE_INT64):
return _LTE_COMPARE (_double, _int64);
/* Int32 on Left Side */
case _TYPE_CODE(BSON_TYPE_INT32, BSON_TYPE_DOUBLE):
return _LTE_COMPARE (_int32, _double);
case _TYPE_CODE(BSON_TYPE_INT32, BSON_TYPE_BOOL):
return _LTE_COMPARE (_int32, _bool);
case _TYPE_CODE(BSON_TYPE_INT32, BSON_TYPE_INT32):
return _LTE_COMPARE (_int32, _int32);
case _TYPE_CODE(BSON_TYPE_INT32, BSON_TYPE_INT64):
return _LTE_COMPARE (_int32, _int64);
/* Int64 on Left Side */
case _TYPE_CODE(BSON_TYPE_INT64, BSON_TYPE_DOUBLE):
return _LTE_COMPARE (_int64, _double);
case _TYPE_CODE(BSON_TYPE_INT64, BSON_TYPE_BOOL):
return _LTE_COMPARE (_int64, _bool);
case _TYPE_CODE(BSON_TYPE_INT64, BSON_TYPE_INT32):
return _LTE_COMPARE (_int64, _int32);
case _TYPE_CODE(BSON_TYPE_INT64, BSON_TYPE_INT64):
return _LTE_COMPARE (_int64, _int64);
default:
MONGOC_WARNING ("Implement for (Type(%d) <= Type(%d))",
bson_iter_type (&compare->iter),
bson_iter_type (iter));
break;
}
return false;
}
开发者ID:hnkien,项目名称:mongo-c-driver,代码行数:53,代码来源:mongoc-matcher-op.c
示例20: test_load
static void
test_load (mongoc_client_t *client,
unsigned iterations)
{
mongoc_collection_t *col;
mongoc_database_t *db;
bson_error_t error;
unsigned i;
bson_t b;
bson_t q;
bson_init(&b);
bson_append_int32(&b, "ping", 4, 1);
bson_init(&q);
db = mongoc_client_get_database(client, "admin");
col = mongoc_client_get_collection(client, "test", "test");
for (i = 0; i < iterations; i++) {
ping(db, &b);
fetch(col, &q);
}
if (!mongoc_collection_drop(col, &error)) {
MONGOC_WARNING("Failed to drop collection: %s", error.message);
}
mongoc_database_destroy(db);
db = mongoc_client_get_database(client, "test");
if (!mongoc_database_drop(db, &error)) {
MONGOC_WARNING("Failed to drop database: %s", error.message);
}
mongoc_database_destroy(db);
mongoc_collection_destroy(col);
bson_destroy(&b);
}
开发者ID:hy,项目名称:mongo-c-driver,代码行数:39,代码来源:test-load.c
注:本文中的MONGOC_WARNING函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论