Commit f2178597 authored by Yoni Fogel's avatar Yoni Fogel

Added c++ wrappers for get_flags

Also added errcall initializer
Addresses #240

git-svn-id: file:///svn/tokudb@1500 c7de825b-a66e-492c-adef-691d508d4ae1
parent a4f67b66
......@@ -3,7 +3,8 @@
#include <stdarg.h>
DbEnv::DbEnv (u_int32_t flags)
: do_no_exceptions((flags&DB_CXX_NO_EXCEPTIONS)!=0)
: do_no_exceptions((flags&DB_CXX_NO_EXCEPTIONS)!=0),
errcall(NULL)
{
int ret = db_env_create(&the_env, flags & ~DB_CXX_NO_EXCEPTIONS);
assert(ret==0); // should do an error.
......@@ -110,6 +111,11 @@ void DbEnv::set_errfile(FILE *errfile) {
the_env->set_errfile(the_env, errfile);
}
int DbEnv::get_flags(u_int32_t *flagsp) {
int ret = the_env->get_flags(the_env, flagsp);
return maybe_throw_error(ret);
}
extern "C" void toku_db_env_errcall_c(DB_ENV *dbenv_c, const char *errpfx, const char *msg) {
DbEnv *dbenv = (DbEnv *) dbenv_c->api1_internal;
dbenv->errcall(dbenv, errpfx, msg);
......
......@@ -159,6 +159,7 @@ class DbEnv {
void err(int error, const char *fmt, ...);
void set_errfile(FILE *errfile);
void set_errcall(void (*)(const DbEnv *, const char *, const char *));
int get_flags(u_int32_t *flagsp);
// locking
#if DB_VERSION_MAJOR<4 || (DB_VERSION_MAJOR==4 && DB_VERSION_MINOR<=4)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment