您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ BCON_NEW函数代码示例

51自学网 2021-06-01 19:49:15
  C++
这篇教程C++ BCON_NEW函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中BCON_NEW函数的典型用法代码示例。如果您正苦于以下问题:C++ BCON_NEW函数的具体用法?C++ BCON_NEW怎么用?C++ BCON_NEW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了BCON_NEW函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: test_date_time

static voidtest_date_time (void){   int64_t out;   bson_t *bcon = BCON_NEW ("foo", BCON_DATE_TIME (10000));   BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_DATE_TIME (out)));   BSON_ASSERT (out == 10000);   bson_destroy (bcon);}
开发者ID:ShaneHarvey,项目名称:libbson,代码行数:13,


示例2: bulk5_success

static voidbulk5_success (mongoc_collection_t *collection){   mongoc_bulk_operation_t *bulk;   bson_error_t error;   bson_t *doc;   bson_t reply;   char *str;   bool ret;   bulk = mongoc_collection_create_bulk_operation (collection, true, NULL);   /* Allow this document to bypass document validation.    * NOTE: When authentication is enabled, the authenticated user must have    * either the "dbadmin" or "restore" roles to bypass document validation */   mongoc_bulk_operation_set_bypass_document_validation (bulk, true);   /* Two inserts */   doc = BCON_NEW ("_id", BCON_INT32 (31));   mongoc_bulk_operation_insert (bulk, doc);   bson_destroy (doc);   doc = BCON_NEW ("_id", BCON_INT32 (32));   mongoc_bulk_operation_insert (bulk, doc);   bson_destroy (doc);   ret = mongoc_bulk_operation_execute (bulk, &reply, &error);   str = bson_as_json (&reply, NULL);   printf ("%s/n", str);   bson_free (str);   if (!ret) {      printf ("Error: %s/n", error.message);   }   bson_destroy (&reply);   mongoc_bulk_operation_destroy (bulk);}
开发者ID:3rf,项目名称:mongo-c-driver,代码行数:39,


示例3: test_bool

static voidtest_bool (void){   bool b;   bson_t *bcon = BCON_NEW ("foo", BCON_BOOL (true));   BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_BOOL (b)));   BSON_ASSERT (b == true);   bson_destroy (bcon);}
开发者ID:ShaneHarvey,项目名称:libbson,代码行数:13,


示例4: test_code

static voidtest_code (void){   const char *val;   bson_t *bcon = BCON_NEW ("foo", BCON_CODE ("var a = {};"));   BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_CODE (val)));   BSON_ASSERT (strcmp (val, "var a = {};") == 0);   bson_destroy (bcon);}
开发者ID:ShaneHarvey,项目名称:libbson,代码行数:13,


示例5: test_int64

static voidtest_int64 (void){   int64_t i64;   bson_t *bcon = BCON_NEW ("foo", BCON_INT64 (10));   assert (BCON_EXTRACT (bcon, "foo", BCONE_INT64 (i64)));   assert (i64 == 10);   bson_destroy (bcon);}
开发者ID:3rduncle,项目名称:libbson,代码行数:13,


示例6: test_double

static voidtest_double (void){   double val;   bson_t *bcon = BCON_NEW ("foo", BCON_DOUBLE (1.1));   BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_DOUBLE (val)));   BSON_ASSERT (val == 1.1);   bson_destroy (bcon);}
开发者ID:ShaneHarvey,项目名称:libbson,代码行数:13,


示例7: test_utf8

static voidtest_utf8 (void){   const char *val;   bson_t *bcon = BCON_NEW ("hello", "world");   assert (BCON_EXTRACT (bcon, "hello", BCONE_UTF8 (val)));   assert (strcmp (val, "world") == 0);   bson_destroy (bcon);}
开发者ID:3rduncle,项目名称:libbson,代码行数:13,


示例8: test_int32

static voidtest_int32 (void){   int32_t i32;   bson_t *bcon = BCON_NEW ("foo", BCON_INT32 (10));   assert (BCON_EXTRACT (bcon, "foo", BCONE_INT32 (i32)));   assert (i32 == 10);   bson_destroy (bcon);}
开发者ID:3rduncle,项目名称:libbson,代码行数:13,


示例9: bulk6

static voidbulk6 (mongoc_collection_t *collection){   mongoc_write_concern_t *wc;   mongoc_bulk_operation_t *bulk;   bson_error_t error;   bson_t *doc;   bson_t *selector;   bson_t reply;   char *str;   bool ret;   wc = mongoc_write_concern_new ();   mongoc_write_concern_set_w (wc, 0);   bulk = mongoc_collection_create_bulk_operation (collection, true, wc);   doc = BCON_NEW ("_id", BCON_INT32 (10));   mongoc_bulk_operation_insert (bulk, doc);   bson_destroy (doc);   selector = BCON_NEW ("_id", BCON_INT32 (11));   mongoc_bulk_operation_remove_one (bulk, selector);   bson_destroy (selector);   ret = mongoc_bulk_operation_execute (bulk, &reply, &error);   str = bson_as_json (&reply, NULL);   printf ("%s/n", str);   bson_free (str);   if (!ret) {      printf ("Error: %s/n", error.message);   }   bson_destroy (&reply);   mongoc_bulk_operation_destroy (bulk);   mongoc_write_concern_destroy (wc);}
开发者ID:mschoenlaub,项目名称:mongo-c-driver,代码行数:39,


示例10: test_symbol

static voidtest_symbol (void){   const char *val;   bson_t *bcon = BCON_NEW ("foo", BCON_SYMBOL ("symbol"));   BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_SYMBOL (val)));   BSON_ASSERT (strcmp (val, "symbol") == 0);   bson_destroy (bcon);}
开发者ID:ShaneHarvey,项目名称:libbson,代码行数:13,


示例11: test_bool

static voidtest_bool (void){   bson_bool_t b;   bson_t *bcon = BCON_NEW ("foo", BCON_BOOL (TRUE));   assert (BCON_EXTRACT (bcon, "foo", BCONE_BOOL (b)));   assert (b == TRUE);   bson_destroy (bcon);}
开发者ID:jonrangel,项目名称:libbson,代码行数:13,


示例12: test_invalid_write_concern

static voidtest_invalid_write_concern (void){   mongoc_write_command_t command;   mongoc_write_result_t result;   mongoc_collection_t *collection;   mongoc_client_t *client;   mongoc_write_concern_t *write_concern;   bson_t **docs;   bson_t reply = BSON_INITIALIZER;   bson_error_t error;   bool r;   client = test_framework_client_new (NULL);   assert(client);   collection = get_test_collection(client, "test_invalid_write_concern");   assert(collection);   write_concern = mongoc_write_concern_new();   assert(write_concern);   mongoc_write_concern_set_w(write_concern, 0);   mongoc_write_concern_set_journal(write_concern, true);   assert(!_mongoc_write_concern_is_valid(write_concern));   docs = bson_malloc(sizeof(bson_t*));   docs[0] = BCON_NEW("_id", BCON_INT32(0));   _mongoc_write_command_init_insert(&command, (const bson_t * const *)docs, 1, true, true);   _mongoc_write_result_init (&result);   _mongoc_write_command_execute (&command, client, 0, collection->db,                                  collection->collection, write_concern, 0,                                  &result);   r = _mongoc_write_result_complete (&result, &reply, &error);   assert(!r);   assert(error.domain = MONGOC_ERROR_COMMAND);   assert(error.code = MONGOC_ERROR_COMMAND_INVALID_ARG);   _mongoc_write_command_destroy (&command);   _mongoc_write_result_destroy (&result);   bson_destroy(docs[0]);   bson_free(docs);   mongoc_collection_destroy(collection);   mongoc_client_destroy(client);   mongoc_write_concern_destroy(write_concern);}
开发者ID:NaughtyCode,项目名称:mongo-c-driver,代码行数:51,


示例13: test_mongoc_matcher_eq_int64

static voidtest_mongoc_matcher_eq_int64 (void){   bson_t *spec;   bson_t *doc;   bson_error_t error;   mongoc_matcher_t *matcher;   bool r;   spec = BCON_NEW ("hello", BCON_INT64 (1234));   matcher = mongoc_matcher_new (spec, &error);   BSON_ASSERT (matcher);   r = mongoc_matcher_match (matcher, spec);   BSON_ASSERT (r);   bson_destroy (spec);   mongoc_matcher_destroy (matcher);   spec = BCON_NEW ("hello", BCON_INT64 (1234));   doc = BCON_NEW ("hello", BCON_INT64 (1234));   matcher = mongoc_matcher_new (spec, &error);   BSON_ASSERT (matcher);   r = mongoc_matcher_match (matcher, doc);   BSON_ASSERT (r);   bson_destroy (spec);   bson_destroy (doc);   mongoc_matcher_destroy (matcher);   spec = BCON_NEW ("hello", BCON_INT64 (1234));   doc = BCON_NEW ("hello", BCON_INT32 (4321));   matcher = mongoc_matcher_new (spec, &error);   BSON_ASSERT (matcher);   r = mongoc_matcher_match (matcher, doc);   BSON_ASSERT (!r);   bson_destroy (spec);   bson_destroy (doc);   mongoc_matcher_destroy (matcher);}
开发者ID:u2yg,项目名称:mongo-c-driver,代码行数:37,


示例14: test_mongoc_matcher_eq_utf8

static voidtest_mongoc_matcher_eq_utf8 (void){   bson_t *doc;   bson_t *spec;   bson_error_t error;   mongoc_matcher_t *matcher;   bool r;   spec = BCON_NEW("hello", "world");   matcher = mongoc_matcher_new (spec, &error);   BSON_ASSERT (matcher);   r = mongoc_matcher_match (matcher, spec);   BSON_ASSERT (r);   bson_destroy (spec);   mongoc_matcher_destroy (matcher);   spec = BCON_NEW ("hello", "world");   doc = BCON_NEW ("hello", BCON_NULL);   matcher = mongoc_matcher_new (spec, &error);   BSON_ASSERT (matcher);   r = mongoc_matcher_match (matcher, doc);   BSON_ASSERT (!r);   bson_destroy (spec);   bson_destroy (doc);   mongoc_matcher_destroy (matcher);   spec = BCON_NEW ("hello", "world");   doc = BCON_NEW ("hello", BCON_UNDEFINED);   matcher = mongoc_matcher_new (spec, &error);   BSON_ASSERT (matcher);   r = mongoc_matcher_match (matcher, doc);   BSON_ASSERT (!r);   bson_destroy (spec);   bson_destroy (doc);   mongoc_matcher_destroy (matcher);}
开发者ID:u2yg,项目名称:mongo-c-driver,代码行数:37,


示例15: main

intmain (int argc, const char **argv){   bson_t *b;   char *j;   b = BCON_NEW ("hello", BCON_UTF8 ("bson!"));   j = bson_as_canonical_extended_json (b, NULL);   printf ("%s/n", j);   bson_free (j);   bson_destroy (b);   return 0;}
开发者ID:acmorrow,项目名称:mongo-c-driver,代码行数:15,


示例16: test_inline_array

static voidtest_inline_array (void){   int32_t a, b;   bson_t *bcon = BCON_NEW ("foo", "[", BCON_INT32 (1), BCON_INT32 (2), "]");   assert (      BCON_EXTRACT (bcon, "foo", "[", BCONE_INT32 (a), BCONE_INT32 (b), "]"));   assert (a == 1);   assert (b == 2);   bson_destroy (bcon);}
开发者ID:rcsanchez97,项目名称:libbson,代码行数:15,


示例17: test_regex

static voidtest_regex (void){   const char *regex;   const char *flags;   bson_t *bcon = BCON_NEW ("foo", BCON_REGEX ("^foo|bar$", "i"));   assert (BCON_EXTRACT (bcon, "foo", BCONE_REGEX (regex, flags)));   assert (strcmp (regex, "^foo|bar$") == 0);   assert (strcmp (flags, "i") == 0);   bson_destroy (bcon);}
开发者ID:Cabriter,项目名称:abelkhan,代码行数:15,


示例18: test_timestamp

static voidtest_timestamp (void){   int32_t timestamp;   int32_t increment;   bson_t *bcon = BCON_NEW ("foo", BCON_TIMESTAMP (100, 1000));   assert (BCON_EXTRACT (bcon, "foo", BCONE_TIMESTAMP (timestamp, increment)));   assert (timestamp == 100);   assert (increment == 1000);   bson_destroy (bcon);}
开发者ID:Cabriter,项目名称:abelkhan,代码行数:15,


示例19: bulk5_fail

static voidbulk5_fail (mongoc_collection_t *collection){   mongoc_bulk_operation_t *bulk;   bson_error_t error;   bson_t *doc;   bson_t reply;   char *str;   bool ret;   bulk = mongoc_collection_create_bulk_operation (collection, true, NULL);   /* Two inserts */   doc = BCON_NEW ("_id", BCON_INT32 (31));   mongoc_bulk_operation_insert (bulk, doc);   bson_destroy (doc);   doc = BCON_NEW ("_id", BCON_INT32 (32));   mongoc_bulk_operation_insert (bulk, doc);   bson_destroy (doc);   /* The above documents do not comply to the schema validation rules    * we created previously, so this will result in an error */   ret = mongoc_bulk_operation_execute (bulk, &reply, &error);   str = bson_as_json (&reply, NULL);   printf ("%s/n", str);   bson_free (str);   if (!ret) {      printf ("Error: %s/n", error.message);   }   bson_destroy (&reply);   mongoc_bulk_operation_destroy (bulk);}
开发者ID:3rf,项目名称:mongo-c-driver,代码行数:36,


示例20: test_inline_doc

static voidtest_inline_doc (void){   int32_t a, b;   bson_t *bcon =      BCON_NEW ("foo", "{", "b", BCON_INT32 (2), "a", BCON_INT32 (1), "}");   BSON_ASSERT (BCON_EXTRACT (      bcon, "foo", "{", "a", BCONE_INT32 (a), "b", BCONE_INT32 (b), "}"));   BSON_ASSERT (a == 1);   BSON_ASSERT (b == 2);   bson_destroy (bcon);}
开发者ID:ShaneHarvey,项目名称:libbson,代码行数:16,


示例21: R_mongo_collection_create_index

SEXP R_mongo_collection_create_index(SEXP ptr_col, SEXP ptr_bson) {  mongoc_collection_t *col = r2col(ptr_col);  bson_t *keys = r2bson(ptr_bson);  const char * collection_name = mongoc_collection_get_name(col);  char * index_name = mongoc_collection_keys_to_index_string (keys);  bson_error_t err;  //From: https://s3.amazonaws.com/mciuploads/mongo-c-driver/docs/latest/create-indexes.html  bson_t * command = BCON_NEW ("createIndexes", BCON_UTF8 (collection_name), "indexes",    "[", "{", "key", BCON_DOCUMENT (keys), "name", BCON_UTF8 (index_name), "}", "]");  if(!mongoc_collection_write_command_with_opts(col, command, NULL, NULL, &err))    stop(err.message);  return Rf_ScalarLogical(1);}
开发者ID:cran,项目名称:mongolite,代码行数:16,


示例22: test_bcon_new

static voidtest_bcon_new (void){   bson_t expected;   bson_t * bcon;   bson_init (&expected);   bson_append_utf8 (&expected, "hello", -1, "world", -1);   bcon = BCON_NEW("hello", "world");   bson_eq_bson (bcon, &expected);   bson_destroy (bcon);   bson_destroy (&expected);}
开发者ID:Cabriter,项目名称:abelkhan,代码行数:16,


示例23: test_oid

static voidtest_oid (void){   bson_oid_t oid;   const bson_oid_t *ooid;   bson_oid_init (&oid, NULL);   bson_t *bcon = BCON_NEW ("foo", BCON_OID (&oid));   assert (BCON_EXTRACT (bcon, "foo", BCONE_OID (ooid)));   assert (bson_oid_equal (&oid, ooid));   bson_destroy (bcon);}
开发者ID:jonrangel,项目名称:libbson,代码行数:16,


示例24: fam_flags

void fam_flags(mongoc_collection_t *collection){   mongoc_find_and_modify_opts_t *opts;   bson_t reply;   bson_error_t error;   bson_t query = BSON_INITIALIZER;   bson_t *update;   bool success;   /* Find Zlatan Ibrahimovic, the striker */   BSON_APPEND_UTF8 (&query, "firstname", "Zlatan");   BSON_APPEND_UTF8 (&query, "lastname", "Ibrahimovic");   BSON_APPEND_UTF8 (&query, "profession", "Football player");   BSON_APPEND_INT32 (&query, "age", 34);   BSON_APPEND_INT32 (&query, "goals", (16+35+23+57+16+14+28+84)+(1+6+62));   /* Add his football position */   update = BCON_NEW ("$set", "{",      "position", BCON_UTF8 ("striker"),   "}");   opts = mongoc_find_and_modify_opts_new ();   mongoc_find_and_modify_opts_set_update (opts, update);   /* Create the document if it didn't exist, and return the updated document */   mongoc_find_and_modify_opts_set_flags (opts, MONGOC_FIND_AND_MODIFY_UPSERT|MONGOC_FIND_AND_MODIFY_RETURN_NEW);   success = mongoc_collection_find_and_modify_with_opts (collection, &query, opts, &reply, &error);   if (success) {      char *str;      str = bson_as_json (&reply, NULL);      printf ("%s/n", str);      bson_free (str);   } else {      fprintf(stderr, "Got error: /"%s/" on line %d/n", error.message, __LINE__);   }   bson_destroy (&reply);   bson_destroy (update);   bson_destroy (&query);   mongoc_find_and_modify_opts_destroy (opts);}
开发者ID:AbhimanyuAryan,项目名称:treefrog-framework,代码行数:46,


示例25: test_decimal128

static voidtest_decimal128 (void){   bson_decimal128_t val;   bson_decimal128_t dec;   bson_t *bcon;   bson_decimal128_from_string("12", &dec);   bcon = BCON_NEW ("foo", BCON_DECIMAL128 (&dec));   assert (BCON_EXTRACT (bcon, "foo", BCONE_DECIMAL128 (val)));   assert (val.low == 0xCULL);   assert (val.high == 0x3040000000000000ULL);   bson_destroy (bcon);}
开发者ID:Cabriter,项目名称:abelkhan,代码行数:17,


示例26: test_mongoc_matcher_in_basic

static voidtest_mongoc_matcher_in_basic (void){   mongoc_matcher_t *matcher;   bson_error_t error;   bool r;   bson_t *spec;   bson_t doc = BSON_INITIALIZER;   spec = BCON_NEW ("key", "{",                       "$in", "[",                          BCON_INT32 (1),                          BCON_INT32 (2),                          BCON_INT32 (3),                       "]",                    "}");   matcher = mongoc_matcher_new (spec, &error);   r = mongoc_matcher_match (matcher, &doc);   ASSERT (!r);   bson_reinit (&doc);   bson_append_int32 (&doc, "key", 3, 1);   r = mongoc_matcher_match (matcher, &doc);   ASSERT (r);   bson_reinit (&doc);   bson_append_int32 (&doc, "key", 3, 2);   r = mongoc_matcher_match (matcher, &doc);   ASSERT (r);   bson_reinit (&doc);   bson_append_int32 (&doc, "key", 3, 3);   r = mongoc_matcher_match (matcher, &doc);   ASSERT (r);   bson_reinit (&doc);   bson_append_int32 (&doc, "key", 3, 4);   r = mongoc_matcher_match (matcher, &doc);   ASSERT (!r);   bson_destroy (&doc);   bson_destroy (spec);   mongoc_matcher_destroy (matcher);}
开发者ID:u2yg,项目名称:mongo-c-driver,代码行数:45,



注:本文中的BCON_NEW函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ BCOPY函数代码示例
C++ BCON_INT32函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。