From 172092ef8fab4fee0ff2d73a6e82a81f8a4fdbee Mon Sep 17 00:00:00 2001 From: Rich Prohaska Date: Sat, 29 Dec 2007 17:59:20 +0000 Subject: [PATCH] add DbEnv::set_flags addresses #229 git-svn-id: file:///svn/tokudb@1413 c7de825b-a66e-492c-adef-691d508d4ae1 --- cxx/dbenv.cpp | 5 +++++ cxx/tests/test_env_set_flags.cpp | 14 ++++++++++++++ include/db_cxx.h | 1 + 3 files changed, 20 insertions(+) create mode 100644 cxx/tests/test_env_set_flags.cpp diff --git a/cxx/dbenv.cpp b/cxx/dbenv.cpp index 6bf9f7dfbfb..4ba97afad5e 100644 --- a/cxx/dbenv.cpp +++ b/cxx/dbenv.cpp @@ -48,6 +48,11 @@ int DbEnv::set_cachesize(u_int32_t gbytes, u_int32_t bytes, int ncache) { return maybe_throw_error(ret); } +int DbEnv::set_flags(u_int32_t flags, int onoff) { + int ret = the_env->set_flags(the_env, flags, onoff); + return maybe_throw_error(ret); +} + #if DB_VERSION_MAJOR<4 || (DB_VERSION_MAJOR==4 && DB_VERSION_MINOR<=4) int DbEnv::set_lk_max(u_int32_t flags) { int ret = the_env->set_lk_max(the_env, flags); diff --git a/cxx/tests/test_env_set_flags.cpp b/cxx/tests/test_env_set_flags.cpp new file mode 100644 index 00000000000..2e6507cf872 --- /dev/null +++ b/cxx/tests/test_env_set_flags.cpp @@ -0,0 +1,14 @@ +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) { + int r; + + DbEnv env(DB_CXX_NO_EXCEPTIONS); + r = env.set_flags(0, 0); assert(r == 0); + r = env.set_flags(0, 1); assert(r == 0); + return 0; +} diff --git a/include/db_cxx.h b/include/db_cxx.h index 918a62120b1..e6cb312a1af 100644 --- a/include/db_cxx.h +++ b/include/db_cxx.h @@ -139,6 +139,7 @@ class DbEnv { int close(u_int32_t); int open(const char *, u_int32_t, int); int set_cachesize(u_int32_t, u_int32_t, int); + int set_flags(u_int32_t, int); #if DB_VERSION_MAJOR<4 || (DB_VERSION_MAJOR==4 && DB_VERSION_MINOR<=4) // set_lk_max is only defined for versions up to 4.4 int set_lk_max(u_int32_t);