mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
add DbEnv::set_errcall closes #228
git-svn-id: file:///svn/tokudb@1441 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
14830de63e
commit
b4d45cd7a8
2 changed files with 24 additions and 2 deletions
|
@ -109,3 +109,13 @@ void DbEnv::err(int error, const char *fmt, ...) {
|
|||
void DbEnv::set_errfile(FILE *errfile) {
|
||||
the_env->set_errfile(the_env, errfile);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void DbEnv::set_errcall(void (*db_errcall_fcn)(const DbEnv *, const char *, const char *)) {
|
||||
errcall = db_errcall_fcn;
|
||||
the_env->set_errcall(the_env, toku_db_env_errcall_c);
|
||||
}
|
||||
|
|
|
@ -97,21 +97,31 @@ class Db {
|
|||
}
|
||||
|
||||
/* C++ analogues of the C functions. */
|
||||
int open(DbTxn */*txn*/, const char */*name*/, const char */*subname*/, DBTYPE, u_int32_t/*flags*/, int/*mode*/);
|
||||
int close(u_int32_t /*flags*/);
|
||||
|
||||
int cursor(DbTxn */*txn*/, Dbc **/*cursorp*/, u_int32_t /*flags*/);
|
||||
|
||||
int del(DbTxn */*txn*/, Dbt */*key*/, u_int32_t /*flags*/);
|
||||
|
||||
int get(DbTxn */*txn*/, Dbt */*key*/, Dbt */*data*/, u_int32_t /*flags*/);
|
||||
int pget(DbTxn *, Dbt *, Dbt *, Dbt *, u_int32_t);
|
||||
int open(DbTxn */*txn*/, const char */*name*/, const char */*subname*/, DBTYPE, u_int32_t/*flags*/, int/*mode*/);
|
||||
|
||||
int put(DbTxn *, Dbt *, Dbt *, u_int32_t);
|
||||
|
||||
int get_flags(u_int32_t *);
|
||||
int set_flags(u_int32_t);
|
||||
|
||||
int set_pagesize(u_int32_t);
|
||||
|
||||
int remove(const char *file, const char *database, u_int32_t flags);
|
||||
|
||||
int set_bt_compare(bt_compare_fcn_type bt_compare_fcn);
|
||||
int set_bt_compare(int (*)(Db *, const Dbt *, const Dbt *));
|
||||
|
||||
int set_dup_compare(dup_compare_fcn_type dup_compare_fcn);
|
||||
int set_dup_compare(int (*)(Db *, const Dbt *, const Dbt *));
|
||||
|
||||
int associate(DbTxn *, Db *, int (*)(Db *, const Dbt *, const Dbt *, Dbt *), u_int32_t);
|
||||
|
||||
/* the cxx callbacks must be public so they can be called by the c callback. But it's really private. */
|
||||
|
@ -152,12 +162,14 @@ class DbEnv {
|
|||
void set_errpfx(const char *errpfx);
|
||||
void err(int error, const char *fmt, ...);
|
||||
void set_errfile(FILE *errfile);
|
||||
void set_errcall(void (*)(const DbEnv *, const char *, const char *));
|
||||
|
||||
int do_no_exceptions; // This should be private!!!
|
||||
void (*errcall)(const DbEnv *, const char *, const char *);
|
||||
|
||||
private:
|
||||
DB_ENV *the_env;
|
||||
|
||||
|
||||
DbEnv(DB_ENV *, u_int32_t /*flags*/);
|
||||
int maybe_throw_error(int /*err*/) throw (DbException);
|
||||
static int maybe_throw_error(int, DbEnv*, int /*no_exceptions*/) throw (DbException);
|
||||
|
|
Loading…
Add table
Reference in a new issue