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

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

51自学网 2021-06-03 09:59:30
  C++
这篇教程C++ wiredtiger_strerror函数代码示例写得很实用,希望能帮到您。

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

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

示例1: wt_id2entry_delete

int wt_id2entry_delete(	Operation *op,	WT_SESSION *session,	Entry *e ){	int rc;	WT_CURSOR *cursor = NULL;	rc = session->open_cursor(session, WT_TABLE_ID2ENTRY, NULL,							  NULL, &cursor);	if ( rc ) {		Debug( LDAP_DEBUG_ANY,			   LDAP_XSTRING(wt_id2entry_delete)			   ": open_cursor failed: %s (%d)/n",			   wiredtiger_strerror(rc), rc, 0 );		goto done;	}	cursor->set_key(cursor, e->e_id);	rc = cursor->remove(cursor);	if ( rc ) {		Debug( LDAP_DEBUG_ANY,			   LDAP_XSTRING(wt_id2entry_delete)			   ": remove failed: %s (%d)/n",			   wiredtiger_strerror(rc), rc, 0 );		goto done;	}done:	if(cursor){		cursor->close(cursor);	}	return rc;}
开发者ID:Distrotech,项目名称:openldap,代码行数:32,


示例2: main

intmain(int argc, char *argv[]){	WT_CONNECTION *conn;	int ret;	(void)argc;					/* Unused variable */	/*	 * This code deliberately doesn't use the standard test_util macros,	 * we don't want to link against that code to smoke-test a build.	 */	(void)system("rm -rf WT_HOME && mkdir WT_HOME");	/* Open a connection to the database, creating it if necessary. */	if ((ret = wiredtiger_open("WT_HOME", NULL, "create", &conn)) != 0) {		fprintf(stderr,		    "%s: wiredtiger_open: %s/n",		    argv[0], wiredtiger_strerror(ret));		return (EXIT_FAILURE);	}	/* Close the connection to the database. */	if ((ret = conn->close(conn, NULL)) != 0) {		fprintf(stderr,		    "%s: WT_CONNECTION.close: %s/n",		    argv[0], wiredtiger_strerror(ret));		return (EXIT_FAILURE);	}	return (EXIT_SUCCESS);}
开发者ID:DINKIN,项目名称:mongo,代码行数:32,


示例3: lprintf

/* * Log printf - output a log message. */intlprintf(CONFIG *cfg, int err, uint32_t level, const char *fmt, ...){	va_list ap;	if (err == 0 && level <= cfg->verbose) {		va_start(ap, fmt);		vfprintf(cfg->logf, fmt, ap);		va_end(ap);		fprintf(cfg->logf, "/n");		if (level < cfg->verbose) {			va_start(ap, fmt);			vprintf(fmt, ap);			va_end(ap);			printf("/n");		}	}	if (err == 0)		return (0);	/* We are dealing with an error. */	va_start(ap, fmt);	vfprintf(stderr, fmt, ap);	va_end(ap);	fprintf(stderr, " Error: %s/n", wiredtiger_strerror(err));	if (cfg->logf != NULL) {		va_start(ap, fmt);		vfprintf(cfg->logf, fmt, ap);		va_end(ap);		fprintf(cfg->logf, " Error: %s/n", wiredtiger_strerror(err));	}	return (0);}
开发者ID:umerazad,项目名称:wiredtiger,代码行数:38,


示例4: main

int main(void){	int ret;	WT_CONNECTION *conn;	WT_SESSION *session;	/*! [processes] */	/* Open a connection to the database, creating it if necessary. */	if ((ret =	    wiredtiger_open(home, NULL, "create,multiprocess", &conn)) != 0)		fprintf(stderr, "Error connecting to %s: %s/n",		    home, wiredtiger_strerror(ret));	/* Open a session for the current thread's work. */	if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0)		fprintf(stderr, "Error opening a session on %s: %s/n",		    home, wiredtiger_strerror(ret));	/* XXX Do some work... */	/* Note: closing the connection implicitly closes open session(s). */	if ((ret = conn->close(conn, NULL)) != 0)		fprintf(stderr, "Error connecting to %s: %s/n",		    home, wiredtiger_strerror(ret));	/*! [processes] */	return (ret);}
开发者ID:qixin,项目名称:wiredtiger,代码行数:28,


示例5: util_backup

intutil_backup(WT_SESSION *session, int argc, char *argv[]){	WT_CURSOR *cursor;	WT_DECL_RET;	int ch;	char *config;	const char *directory, *name;	config = NULL;	while ((ch = util_getopt(argc, argv, "t:")) != EOF)		switch (ch) {		case 't':			if (append_target(util_optarg, &config))				return (1);			break;		case '?':		default:			return (usage());		}	argc -= util_optind;	argv += util_optind;	if (argc != 1) {		(void)usage();		goto err;	}	directory = *argv;	if ((ret = session->open_cursor(	    session, "backup:", NULL, config, &cursor)) != 0) {		fprintf(stderr, "%s: cursor open(backup:) failed: %s/n",		    progname, wiredtiger_strerror(ret));		goto err;	}	/* Copy the files. */	while (	    (ret = cursor->next(cursor)) == 0 &&	    (ret = cursor->get_key(cursor, &name)) == 0)		if ((ret = copy(name, directory)) != 0)			goto err;	if (ret == WT_NOTFOUND)		ret = 0;	if (ret != 0) {		fprintf(stderr, "%s: cursor next(backup:) failed: %s/n",		    progname, wiredtiger_strerror(ret));		goto err;	}err:	if (config != NULL)		free(config);	if (cbuf != NULL)		free(cbuf);	return (ret);}
开发者ID:zhliu03,项目名称:wiredtiger,代码行数:58,


示例6: main

intmain(void){	WT_CONNECTION *conn;	WT_SESSION *session;	int i, j, k, ret;	/*	 * Create a clean test directory for this run of the test program if the	 * environment variable isn't already set (as is done by make check).	 */	if (getenv("WIREDTIGER_HOME") == NULL) {		home = "WT_HOME";		ret = system("rm -rf WT_HOME && mkdir WT_HOME");	} else		home = NULL;	/* Open a connection to the database, creating it if necessary. */	if ((ret = wiredtiger_open(home, NULL, "create", &conn)) != 0) {		fprintf(stderr, "Error connecting to %s: %s/n",		    home == NULL ? "." : home, wiredtiger_strerror(ret));		return (EXIT_FAILURE);	}	/* Open a session for the current thread's work. */	if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0) {		fprintf(stderr, "Error opening a session on %s: %s/n",		    home == NULL ? "." : home, wiredtiger_strerror(ret));		return (EXIT_FAILURE);	}	{	/*! [packing] */	size_t size;	char buf[50];	ret = wiredtiger_struct_size(session, &size, "iii", 42, 1000, -9);	if (size > sizeof(buf)) {		/* Allocate a bigger buffer. */	}	ret = wiredtiger_struct_pack(session, buf, size, "iii", 42, 1000, -9);	ret = wiredtiger_struct_unpack(session, buf, size, "iii", &i, &j, &k);	/*! [packing] */	}	/* Note: closing the connection implicitly closes open session(s). */	if ((ret = conn->close(conn, NULL)) != 0) {		fprintf(stderr, "Error closing %s: %s/n",		    home == NULL ? "." : home, wiredtiger_strerror(ret));		return (EXIT_FAILURE);	}	return (EXIT_SUCCESS);}
开发者ID:AshishSanju,项目名称:mongo,代码行数:56,


示例7: main

int main(void){	WT_CONNECTION *conn;	WT_CURSOR *cursor;	WT_SESSION *session;	int ret;	/* Open a connection to the database, creating it if necessary. */	if ((ret = wiredtiger_open(home, NULL, "create", &conn)) != 0)		fprintf(stderr, "Error connecting to %s: %s/n",		    home, wiredtiger_strerror(ret));	/* Open a session for the current thread's work. */	if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0)		fprintf(stderr, "Error opening a session on %s: %s/n",		    home, wiredtiger_strerror(ret));	ret = session->create(session, "table:world",	    "key_format=r,value_format=5sii,"	    "columns=(id,country,population,area)");	/*! [open cursor #1] */	ret = session->open_cursor(session, "table:world", NULL, NULL, &cursor);	/*! [open cursor #1] */	/*! [open cursor #2] */	ret = session->open_cursor(session,	    "table:world(country,population)", NULL, NULL, &cursor);	/*! [open cursor #2] */	/*! [open cursor #3] */	ret = session->open_cursor(session, "statistics:", NULL, NULL, &cursor);	/*! [open cursor #3] */	/* Create a simple string table to illustrate basic operations. */	ret = session->create(session, "table:map",	    "key_format=S,value_format=S");	ret = session->open_cursor(session, "table:map", NULL, NULL, &cursor);	ret = cursor_insert(cursor);	ret = cursor_reset(cursor);	ret = cursor_forward_scan(cursor);	ret = cursor_reset(cursor);	ret = cursor_reverse_scan(cursor);	ret = cursor_update(cursor);	ret = cursor_remove(cursor);	ret = cursor->close(cursor);	/* Note: closing the connection implicitly closes open session(s). */	if ((ret = conn->close(conn, NULL)) != 0)		fprintf(stderr, "Error connecting to %s: %s/n",		    home, wiredtiger_strerror(ret));	return (ret);}
开发者ID:zhliu03,项目名称:wiredtiger,代码行数:54,


示例8: log_print_err

/* * log_print_err -- *	Report an error and return the error. */intlog_print_err(const char *m, int e, int fatal){	if (fatal) {		g.running = 0;		g.status = e;	}	fprintf(stderr, "%s: %s: %s/n", g.progname, m, wiredtiger_strerror(e));	if (g.logfp != NULL)		fprintf(g.logfp, "%s: %s: %s/n",		    g.progname, m, wiredtiger_strerror(e));	return (e);}
开发者ID:Arikes,项目名称:mongo,代码行数:17,


示例9: main

/*! [thread main] */intmain(void){	WT_SESSION *session;	WT_CURSOR *cursor;	pthread_t threads[NUM_THREADS];	int i, ret;	if ((ret = wiredtiger_open(home, NULL,	    "create", &conn)) != 0)		fprintf(stderr, "Error connecting to %s: %s/n",		    home, wiredtiger_strerror(ret));	/* Note: further error checking omitted for clarity. */	ret = conn->open_session(conn, NULL, NULL, &session);	ret = session->create(session, "table:access",	    "key_format=S,value_format=S");	ret = session->open_cursor(session, "table:access", NULL,	    "overwrite", &cursor);	cursor->set_key(cursor, "key1");	cursor->set_value(cursor, "value1");	ret = cursor->insert(cursor);	ret = session->close(session, NULL);	for (i = 0; i < NUM_THREADS; i++)		ret = pthread_create(&threads[i], NULL, scan_thread, NULL);	for (i = 0; i < NUM_THREADS; i++)		ret = pthread_join(threads[i], NULL);	ret = conn->close(conn, NULL);	return (ret);}
开发者ID:zhliu03,项目名称:wiredtiger,代码行数:35,


示例10: die

/* * die -- *	Report an error and quit, dumping the configuration. */voiddie(int e, const char *fmt, ...){	va_list ap;	/* Single-thread error handling. */	(void)pthread_rwlock_wrlock(&g.death_lock);	/* Try and turn off tracking so it doesn't obscure the error message. */	if (g.track) {		g.track = 0;		fprintf(stderr, "/n");	}	if (fmt != NULL) {				/* Death message. */		fprintf(stderr, "%s: ", g.progname);		va_start(ap, fmt);		vfprintf(stderr, fmt, ap);		va_end(ap);		if (e != 0)			fprintf(stderr, ": %s", wiredtiger_strerror(e));		fprintf(stderr, "/n");	}	/* Flush/close any logging information. */	fclose_and_clear(&g.logfp);	fclose_and_clear(&g.randfp);	/* Display the configuration that failed. */	if (g.run_cnt)		config_print(1);	exit(EXIT_FAILURE);}
开发者ID:Zhangwusheng,项目名称:wiredtiger,代码行数:37,


示例11: fail

static voidfail(int ret) {	fprintf(stderr,	    "%s: %d (%s)/n",	    "wt2336_fileop_basic", ret, wiredtiger_strerror(ret));	exit(ret);}
开发者ID:ksuarz,项目名称:mongo,代码行数:7,


示例12: __handler_failure

/* * __handler_failure -- *	Report the failure of an application-configured event handler. */static void__handler_failure(WT_SESSION_IMPL *session,    int error, const char *which, int error_handler_failed){	WT_EVENT_HANDLER *handler;	WT_SESSION *wt_session;	/*	 * !!!	 * SECURITY:	 * Buffer placed at the end of the stack in case snprintf overflows.	 */	char s[256];	(void)snprintf(s, sizeof(s),	    "application %s event handler failed: %s",	    which, wiredtiger_strerror(error));	/*	 * Use the error handler to report the failure, unless it was the error	 * handler that failed.  If it was the error handler that failed, or a	 * call to the error handler fails, use the default error handler.	 */	wt_session = (WT_SESSION *)session;	handler = session->event_handler;	if (!error_handler_failed &&	    handler->handle_error != __handle_error_default &&	    handler->handle_error(handler, wt_session, error, s) == 0)		return;	(void)__handle_error_default(NULL, wt_session, error, s);}
开发者ID:RedSunCMX,项目名称:wiredtiger,代码行数:36,


示例13: ERROR_LOG

 WiredTigerEngine::ContextHolder& WiredTigerEngine::GetContextHolder() {     ContextHolder& holder = m_context.GetValue();     if (NULL == holder.session)     {         int ret = 0;         if ((ret = m_db->open_session(m_db, NULL, NULL, &holder.session)) != 0)         {             ERROR_LOG("Error opening a session on %s: %s", m_cfg.path.c_str(), wiredtiger_strerror(ret));         }         else         {             if (m_cfg.init_table_options.empty())             {                 m_cfg.init_table_options =                         "key_format=u,value_format=u,prefix_compression=true,collator=ardb_comparator";             }             else             {                 if (m_cfg.init_table_options.find("collator=ardb_comparator") == std::string::npos)                 {                     m_cfg.init_table_options.append(",collator=ardb_comparator");                 }             }             ret = holder.session->create(holder.session, ARDB_TABLE, m_cfg.init_table_options.c_str());             CHECK_WT_RETURN(ret);         }         holder.engine = this;     }     return holder; }
开发者ID:Abioy,项目名称:ardb,代码行数:31,


示例14: wt_tool_entry_open

intwt_tool_entry_open( BackendDB *be, int mode ){    struct wt_info *wi = (struct wt_info *) be->be_private;	WT_CONNECTION *conn = wi->wi_conn;	int rc;	wc = wt_ctx_init(wi);    if( !wc ){		Debug( LDAP_DEBUG_ANY,			   LDAP_XSTRING(wt_tool_entry_open)			   ": wt_ctx_get failed: %s (%d)/n",			   0, 0, 0 );		return -1;    }	rc = wc->session->open_cursor(wc->session, WT_TABLE_ID2ENTRY"(entry)"								  ,NULL, NULL, &reader);	if ( rc ) {		Debug( LDAP_DEBUG_ANY,			   LDAP_XSTRING(wt_tool_entry_open)			   ": cursor open failed: %s (%d)/n",			   wiredtiger_strerror(rc), rc, 0 );		return -1;	}	return 0;}
开发者ID:Distrotech,项目名称:openldap,代码行数:28,


示例15: wt_ctx_init

wt_ctx *wt_ctx_init(struct wt_info *wi){	int rc;	wt_ctx *wc;	wc = ch_malloc( sizeof( wt_ctx ) );	if( !wc ) {		Debug( LDAP_DEBUG_ANY,			   LDAP_XSTRING(wt_ctx_init)			   ": cannot allocate memory/n",			   0, 0, 0 );		return NULL;	}	memset(wc, 0, sizeof(wt_ctx));	if(!wc->session){		rc = wi->wi_conn->open_session(wi->wi_conn, NULL, NULL, &wc->session);		if( rc ) {			Debug( LDAP_DEBUG_ANY,				   LDAP_XSTRING(wt_ctx_session)				   ": open_session error %s(%d)/n",				   wiredtiger_strerror(rc), rc, 0 );			return NULL;		}	}	return wc;}
开发者ID:cptaffe,项目名称:openldap,代码行数:29,


示例16: die

/* * die -- *	Report an error and quit. */voiddie(int e, const char *fmt, ...){	va_list ap;	if (fmt != NULL) {				/* Death message. */		fprintf(stderr, "%s: ", g.progname);		va_start(ap, fmt);		vfprintf(stderr, fmt, ap);		va_end(ap);		if (e != 0)			fprintf(stderr, ": %s", wiredtiger_strerror(e));		fprintf(stderr, "/n");	}	/* Flush/close any logging information. */	if (g.logfp != NULL)		(void)fclose(g.logfp);	if (g.rand_log != NULL)		(void)fclose(g.rand_log);	/* Display the configuration that failed. */	config_print(1);	exit(EXIT_FAILURE);}
开发者ID:RolfAndreassen,项目名称:wiredtiger,代码行数:30,


示例17: wt_id2entry_put

static int wt_id2entry_put(	Operation *op,	WT_SESSION *session,	Entry *e,	const char *config ){	struct berval bv;	WT_CURSOR *cursor = NULL;	WT_ITEM item;	int rc;	rc = entry_encode( e, &bv );	if(rc != LDAP_SUCCESS){		return -1;	}	item.size = bv.bv_len;	item.data = bv.bv_val;	rc = session->open_cursor(session, WT_TABLE_ID2ENTRY, NULL,							  config, &cursor);	if ( rc ) {		Debug( LDAP_DEBUG_ANY,			   LDAP_XSTRING(wt_id2entry_put)			   ": open_cursor failed: %s (%d)/n",			   wiredtiger_strerror(rc), rc, 0 );		goto done;	}	cursor->set_key(cursor, e->e_id);	cursor->set_value(cursor, e->e_ndn, &item);	rc = cursor->insert(cursor);	if ( rc ) {		Debug( LDAP_DEBUG_ANY,			   LDAP_XSTRING(wt_id2entry_put)			   ": insert failed: %s (%d)/n",			   wiredtiger_strerror(rc), rc, 0 );		goto done;	}done:	ch_free( bv.bv_val );	if(cursor){		cursor->close(cursor);	}	return rc;}
开发者ID:Distrotech,项目名称:openldap,代码行数:45,


示例18: wt_id2entry

int wt_id2entry( BackendDB *be,				 WT_SESSION *session,				 ID id,				 Entry **ep ){	int rc;	WT_CURSOR *cursor = NULL;	WT_ITEM item;	EntryHeader eh;	int eoff;	Entry *e = NULL;	rc = session->open_cursor(session, WT_TABLE_ID2ENTRY"(entry)", NULL,							  NULL, &cursor);	if ( rc ) {		Debug( LDAP_DEBUG_ANY,			   LDAP_XSTRING(wt_id2entry)			   ": open_cursor failed: %s (%d)/n",			   wiredtiger_strerror(rc), rc, 0 );		goto done;	}	cursor->set_key(cursor, id);	rc = cursor->search(cursor);	if ( rc ) {		goto done;	}	cursor->get_value(cursor, &item);	rc = wt_entry_header( &item,  &eh );	eoff = eh.data - (char *)item.data;	eh.bv.bv_len = eh.nvals * sizeof( struct berval ) + item.size;	eh.bv.bv_val = ch_malloc( eh.bv.bv_len );	memset(eh.bv.bv_val, 0xff, eh.bv.bv_len);	eh.data = eh.bv.bv_val + eh.nvals * sizeof( struct berval );	memcpy(eh.data, item.data, item.size);	eh.data += eoff;	rc = entry_decode( &eh, &e );	if ( rc ) {		Debug( LDAP_DEBUG_ANY,			   LDAP_XSTRING(wt_id2entry)			   ": entry decode error: %s (%d)/n",			   rc, 0, 0 );		goto done;	}	e->e_id = id;	*ep = e;done:	if(cursor){		cursor->close(cursor);	}	return rc;}
开发者ID:Distrotech,项目名称:openldap,代码行数:53,


示例19: create_wiredtiger_cursor

 static WT_CURSOR* create_wiredtiger_cursor(WT_SESSION* session) {     WT_CURSOR* cursor = NULL;     int ret = session->open_cursor(session,     ARDB_TABLE, NULL, "raw", &cursor);     if (0 != ret)     {         ERROR_LOG("Error create cursor for reason: %s", wiredtiger_strerror(ret));         return NULL;     }     return cursor; }
开发者ID:Abioy,项目名称:ardb,代码行数:12,


示例20: lprintf

/* * Log printf - output a log message. */voidlprintf(const WTPERF *wtperf, int err, uint32_t level, const char *fmt, ...){	CONFIG_OPTS *opts;	va_list ap;	opts = wtperf->opts;	if (err == 0 && level <= opts->verbose) {		va_start(ap, fmt);		vfprintf(wtperf->logf, fmt, ap);		va_end(ap);		fprintf(wtperf->logf, "/n");		if (level < opts->verbose) {			va_start(ap, fmt);			vprintf(fmt, ap);			va_end(ap);			printf("/n");		}	}	if (err == 0)		return;	/* We are dealing with an error. */	va_start(ap, fmt);	vfprintf(stderr, fmt, ap);	va_end(ap);	fprintf(stderr, " Error: %s/n", wiredtiger_strerror(err));	if (wtperf->logf != NULL) {		va_start(ap, fmt);		vfprintf(wtperf->logf, fmt, ap);		va_end(ap);		fprintf(wtperf->logf, " Error: %s/n", wiredtiger_strerror(err));	}	/* Never attempt to continue if we got a panic from WiredTiger. */	if (err == WT_PANIC)		abort();}
开发者ID:DINKIN,项目名称:mongo,代码行数:43,


示例21: main

intmain(void){	int ret;	WT_CONNECTION *conn;	WT_SESSION *session;	/*	 * Create a clean test directory for this run of the test program if the	 * environment variable isn't already set (as is done by make check).	 */	if (getenv("WIREDTIGER_HOME") == NULL) {		home = "WT_HOME";		ret = system("rm -rf WT_HOME && mkdir WT_HOME");	} else		home = NULL;	/* Open a connection to the database, creating it if necessary. */	if ((ret = wiredtiger_open(home, NULL, "create", &conn)) != 0)		fprintf(stderr, "Error connecting to %s: %s/n",		    home == NULL ? "." : home, wiredtiger_strerror(ret));	/*! [add collator nocase] */	ret = conn->add_collator(conn, "nocase", &nocasecoll, NULL);	/*! [add collator nocase] */	/*! [add collator prefix10] */	ret = conn->add_collator(conn, "prefix10", &pcoll10.iface, NULL);	/* Open a session for the current thread's work. */	if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0)		fprintf(stderr, "Error opening a session on %s: %s/n",		    home == NULL ? "." : home, wiredtiger_strerror(ret));	/* Do some work... */	ret = conn->close(conn, NULL);	/*! [add collator prefix10] */	return (ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE);}
开发者ID:AshishSanju,项目名称:mongo,代码行数:40,


示例22: GetContextHolder

    int WiredTigerEngine::Put(const Slice& key, const Slice& value, const Options& options)    {        ContextHolder& holder = GetContextHolder();        WT_SESSION* session = holder.session;        if (NULL == session)        {            return -1;        }//        if (holder.trasc_ref > 0)//        {//            PutOperation* op = new PutOperation;//            op->key.assign((const char*) key.data(), key.size());//            op->value.assign((const char*) value.data(), value.size());//            m_write_queue.Push(op);//            holder.readonly_transc = false;//            return 0;//        }        int ret = 0;        WT_CURSOR *cursor = holder.batch == NULL ? create_wiredtiger_cursor(session) : holder.batch;        if (NULL == cursor)        {            return -1;        }        WT_ITEM key_item, value_item;        key_item.data = key.data();        key_item.size = key.size();        value_item.data = value.data();        value_item.size = value.size();        cursor->set_key(cursor, &key_item);        cursor->set_value(cursor, &value_item);        ret = cursor->insert(cursor);        if (0 != ret)        {            ERROR_LOG("Error write data for reason: %s", wiredtiger_strerror(ret));            ret = -1;        }        if (holder.batch == NULL)        {            ret = cursor->close(cursor);            CHECK_WT_RETURN(ret);        }        else        {            holder.IncBatchWriteCount();            if (holder.batch_write_count >= m_cfg.batch_commit_watermark)            {                holder.RestartBatchWrite();            }        }        return ret;    }
开发者ID:Abioy,项目名称:ardb,代码行数:51,


示例23: wt_ctx_index_cursor

WT_CURSOR *wt_ctx_index_cursor(wt_ctx *wc, struct berval *name, int create){	WT_CURSOR *cursor = NULL;	WT_SESSION *session = wc->session;	char tablename[1024];	int rc;	snprintf(tablename, sizeof(tablename), "table:%s", name->bv_val);	rc = session->open_cursor(session, tablename, NULL,							  "overwrite=false", &cursor);	if (rc == ENOENT && create) {		rc = session->create(session,							 tablename,							 "key_format=uQ,"							 "value_format=x,"							 "columns=(key, id, none)");		if( rc ) {			Debug( LDAP_DEBUG_ANY,				   LDAP_XSTRING(indexer) ": table /"%s/": "				   "cannot create idnex table: %s (%d)/n",				   tablename, wiredtiger_strerror(rc), rc);			return NULL;		}		rc = session->open_cursor(session, tablename, NULL,								  "overwrite=false", &cursor);	}	if ( rc ) {		Debug( LDAP_DEBUG_ANY,			   LDAP_XSTRING(wt_id2entry_put)			   ": open cursor failed: %s (%d)/n",			   wiredtiger_strerror(rc), rc, 0 );		return NULL;	}	return cursor;}
开发者ID:cptaffe,项目名称:openldap,代码行数:38,


示例24: die

/* * die -- *	Report an error and quit. */voiddie(int e, const char *fmt, ...){	va_list ap;	fprintf(stderr, "%s: ", progname);	va_start(ap, fmt);	vfprintf(stderr, fmt, ap);	va_end(ap);	if (e != 0)		fprintf(stderr, ": %s", wiredtiger_strerror(e));	fprintf(stderr, "/n");	exit(EXIT_FAILURE);}
开发者ID:flyaway921,项目名称:wiredtiger,代码行数:18,


示例25: async_callback

static intasync_callback(WT_ASYNC_CALLBACK *cb,    WT_ASYNC_OP *op, int wiredtiger_error, uint32_t flags){	ASYNC_KEYS *asynckey = (ASYNC_KEYS *)cb;	WT_ASYNC_OPTYPE type;	WT_ITEM k, v;	const char *key, *value;	uint64_t id;	int ret;	(void)flags;				/* Unused */	ret = 0;	/*! [async get type] */	/* Retrieve the operation's WT_ASYNC_OPTYPE type. */	type = op->get_type(op);	/*! [async get type] */	/*! [async get identifier] */	/* Retrieve the operation's 64-bit identifier. */	id = op->get_id(op);	/*! [async get identifier] */	/* Check for a WiredTiger error. */	if (wiredtiger_error != 0) {		fprintf(stderr,		    "ID %" PRIu64 " error %d: %s/n",		    id, wiredtiger_error,		    wiredtiger_strerror(wiredtiger_error));		global_error = wiredtiger_error;		return (1);	}	/* If doing a search, retrieve the key/value pair. */	if (type == WT_AOP_SEARCH) {		/*! [async get the operation's string key] */		ret = op->get_key(op, &k);		key = k.data;		/*! [async get the operation's string key] */		/*! [async get the operation's string value] */		ret = op->get_value(op, &v);		value = v.data;		/*! [async get the operation's string value] */		ATOMIC_ADD(asynckey->num_keys, 1);		printf("Id %" PRIu64 " got record: %s : %s/n", id, key, value);	}	return (ret);}
开发者ID:EaseTech,项目名称:wiredtiger,代码行数:50,


示例26: wt_tool_entry_next

IDwt_tool_entry_next( BackendDB *be ){	int rc;	ID id;	rc = reader->next(reader);	switch( rc ){	case 0:		break;	case WT_NOTFOUND:		return NOID;	default:		Debug( LDAP_DEBUG_ANY,			   LDAP_XSTRING(wt_tool_entry_next)			   ": next failed: %s (%d)/n",			   wiredtiger_strerror(rc), rc, 0 );		return NOID;	}	rc = reader->get_key(reader, &id);	if( rc ){		Debug( LDAP_DEBUG_ANY,			   LDAP_XSTRING(wt_tool_entry_next)			   ": get_key failed: %s (%d)/n",			   wiredtiger_strerror(rc), rc, 0 );	}	rc = reader->get_value(reader, &item);	if( rc ){		Debug( LDAP_DEBUG_ANY,			   LDAP_XSTRING(wt_tool_entry_next)			   ": get_value failed: %s (%d)/n",			   wiredtiger_strerror(rc), rc, 0 );	}	return id;}
开发者ID:Distrotech,项目名称:openldap,代码行数:37,


示例27: lprintf

/* * Log printf - output a log message. */voidlprintf(const CONFIG *cfg, int err, uint32_t level, const char *fmt, ...){	va_list ap;	if (err == 0 && level <= cfg->verbose) {		va_start(ap, fmt);		vfprintf(cfg->logf, fmt, ap);		va_end(ap);		fprintf(cfg->logf, "/n");		if (level < cfg->verbose) {			va_start(ap, fmt);			vprintf(fmt, ap);			va_end(ap);			printf("/n");		}	}	if (err == 0)		return;	/* We are dealing with an error. */	va_start(ap, fmt);	vfprintf(stderr, fmt, ap);	va_end(ap);	fprintf(stderr, " Error: %s/n", wiredtiger_strerror(err));	if (cfg->logf != NULL) {		va_start(ap, fmt);		vfprintf(cfg->logf, fmt, ap);		va_end(ap);		fprintf(cfg->logf, " Error: %s/n", wiredtiger_strerror(err));	}	/* Never attempt to continue if we got a panic from WiredTiger. */	if (err == WT_PANIC)		exit(1);}
开发者ID:RolfAndreassen,项目名称:wiredtiger,代码行数:40,


示例28: main

int main(void){	/*! [access example connection] */	WT_CONNECTION *conn;	WT_CURSOR *cursor;	WT_SESSION *session;	const char *key, *value;	int ret;	if ((ret = wiredtiger_open(home, NULL, "create", &conn)) != 0 ||	    (ret = conn->open_session(conn, NULL, NULL, &session)) != 0) {		fprintf(stderr, "Error connecting to %s: %s/n",		    home, wiredtiger_strerror(ret));		return (ret);	}	/*! [access example connection] */	/*! [access example table create] */	ret = session->create(session,	    "table:access", "key_format=S,value_format=S");	/*! [access example table create] */	/*! [access example cursor open] */	ret = session->open_cursor(session,	    "table:access", NULL, NULL, &cursor);	/*! [access example cursor open] */	/*! [access example cursor insert] */	cursor->set_key(cursor, "key1");	/* Insert a record. */	cursor->set_value(cursor, "value1");	ret = cursor->insert(cursor);	/*! [access example cursor insert] */	/*! [access example cursor list] */	ret = cursor->reset(cursor);	        /* Restart the scan. */	while ((ret = cursor->next(cursor)) == 0) {		ret = cursor->get_key(cursor, &key);		ret = cursor->get_value(cursor, &value);		printf("Got record: %s : %s/n", key, value);	}	/*! [access example cursor list] */	/*! [access example close] */	ret = conn->close(conn, NULL);	/*! [access example close] */	return (ret);}
开发者ID:EaseTech,项目名称:wiredtiger,代码行数:49,


示例29: main

int main(void){	WT_CONNECTION *conn;	WT_SESSION *session;	char buf[50];	size_t size;	int i, j, k, ret;	/* Open a connection to the database, creating it if necessary. */	if ((ret = wiredtiger_open(home, NULL, "create", &conn)) != 0)		fprintf(stderr, "Error connecting to %s: %s/n",		    home, wiredtiger_strerror(ret));	/* Open a session for the current thread's work. */	if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0)		fprintf(stderr, "Error opening a session on %s: %s/n",		    home, wiredtiger_strerror(ret));	/*! [packing] */	ret = wiredtiger_struct_size(session, &size, "iii", 42, 1000, -9);	if (size > sizeof(buf)) {		/* Allocate a bigger buffer. */	}	ret = wiredtiger_struct_pack(session, buf, size, "iii", 42, 1000, -9);	ret = wiredtiger_struct_unpack(session, buf, size, "iii", &i, &j, &k);	/*! [packing] */	/* Note: closing the connection implicitly closes open session(s). */	if ((ret = conn->close(conn, NULL)) != 0)		fprintf(stderr, "Error connecting to %s: %s/n",		    home, wiredtiger_strerror(ret));	return (ret);}
开发者ID:EaseTech,项目名称:wiredtiger,代码行数:36,


示例30: setup_copy

static intsetup_copy(WT_CONNECTION **wt_connp, WT_SESSION **sessionp){	int ret;	if ((ret = wiredtiger_open(home2, NULL, CONN_CONFIG, wt_connp)) != 0) {		fprintf(stderr, "Error connecting to %s: %s/n",		    home1, wiredtiger_strerror(ret));		return (ret);	}	ret = (*wt_connp)->open_session(*wt_connp, NULL, NULL, sessionp);	ret = (*sessionp)->create(*sessionp, uri,	    "key_format=S,value_format=S");	return (ret);}
开发者ID:XinzeChi,项目名称:wiredtiger,代码行数:16,



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


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