Commit 0ac7cfc8 authored by Rich Prohaska's avatar Rich Prohaska

add Db::set_errpfx. closes #272

git-svn-id: file:///svn/tokudb@1654 c7de825b-a66e-492c-adef-691d508d4ae1
parent 24a344be
......@@ -167,6 +167,10 @@ int Db::associate(DbTxn *txnid, Db *secondary, int (*callback)(Db *secondary, co
return the_Env->maybe_throw_error(ret);
}
void Db::set_errpfx(const char *errpfx) {
the_Env->set_errpfx(errpfx);
}
void Db::set_error_stream(std::ostream *new_error_stream) {
the_Env->set_error_stream(new_error_stream);
}
......@@ -13,13 +13,15 @@ int test_error_stream(const char *dbfile) {
r = creat(dbfile, 0777); assert(r >= 0); close(r);
DbEnv env(DB_CXX_NO_EXCEPTIONS);
env.set_errpfx("my_test_error_stream");
env.set_errpfx("my_env_error_stream");
env.set_error_stream(&std::cerr);
r = env.open(".", DB_INIT_MPOOL + DB_CREATE + DB_PRIVATE, 0777); assert(r == 0);
r = env.open(".", DB_INIT_MPOOL + DB_CREATE + DB_PRIVATE, 0777); assert(r == EINVAL);
Db db(&env, 0);
db.set_errpfx("my_db_error_stream");
db.set_error_stream(&std::cerr);
r = db.open(0, dbfile, 0, DB_BTREE, DB_CREATE, 0777); assert(r != 0);
r = db.close(0); assert(r == 0);
r = db.close(0); assert(r == EINVAL);
......
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