Commit c040f957 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 844ba8cf
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
#include <stdarg.h> #include <stdarg.h>
DbEnv::DbEnv (u_int32_t flags) 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); int ret = db_env_create(&the_env, flags & ~DB_CXX_NO_EXCEPTIONS);
assert(ret==0); // should do an error. assert(ret==0); // should do an error.
...@@ -110,6 +111,11 @@ void DbEnv::set_errfile(FILE *errfile) { ...@@ -110,6 +111,11 @@ void DbEnv::set_errfile(FILE *errfile) {
the_env->set_errfile(the_env, 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) { 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 *dbenv = (DbEnv *) dbenv_c->api1_internal;
dbenv->errcall(dbenv, errpfx, msg); dbenv->errcall(dbenv, errpfx, msg);
......
...@@ -159,6 +159,7 @@ class DbEnv { ...@@ -159,6 +159,7 @@ class DbEnv {
void err(int error, const char *fmt, ...); void err(int error, const char *fmt, ...);
void set_errfile(FILE *errfile); void set_errfile(FILE *errfile);
void set_errcall(void (*)(const DbEnv *, const char *, const char *)); void set_errcall(void (*)(const DbEnv *, const char *, const char *));
int get_flags(u_int32_t *flagsp);
// locking // locking
#if DB_VERSION_MAJOR<4 || (DB_VERSION_MAJOR==4 && DB_VERSION_MINOR<=4) #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