From c8232e91a7c269f4f41d342adc2c1d28dbc7243c Mon Sep 17 00:00:00 2001 From: Rich Prohaska Date: Thu, 27 Dec 2007 22:10:59 +0000 Subject: [PATCH] some progess on Db::associate. addresses #226 git-svn-id: file:///svn/tokudb@1395 c7de825b-a66e-492c-adef-691d508d4ae1 --- cxx/db.cpp | 7 +++++++ include/db_cxx.h | 1 + 2 files changed, 8 insertions(+) diff --git a/cxx/db.cpp b/cxx/db.cpp index 53a1b9219ca..19a5e675ac6 100644 --- a/cxx/db.cpp +++ b/cxx/db.cpp @@ -104,3 +104,10 @@ int Db::set_bt_compare(bt_compare_fcn_type bt_compare_fcn) { int ret = the_db->set_bt_compare(the_db, bt_compare_fcn); return the_Env->maybe_throw_error(ret); } + +// open question: how to handle the callback type conversions? + +int Db::associate(DbTxn *txnid, Db *secondary, int (*callback)(Db *secondary, const Dbt *key, const Dbt *data, Dbt *result), u_int32_t flags) { + int ret = the_db->associate(the_db, txnid->get_DB_TXN(), secondary->get_DB(), 0, flags); + return the_Env->maybe_throw_error(ret); +} diff --git a/include/db_cxx.h b/include/db_cxx.h index 7daaafa3b84..25156ba9f26 100644 --- a/include/db_cxx.h +++ b/include/db_cxx.h @@ -107,6 +107,7 @@ class Db { 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 associate(DbTxn *, Db *, int (*)(Db *, const Dbt *, const Dbt *, Dbt *), u_int32_t); private: DB *the_db;