Commit 4a1ff1e7 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Make db_dump work. Addresses #197.

git-svn-id: file:///svn/tokudb@1204 c7de825b-a66e-492c-adef-691d508d4ae1
parent 8ba5e8f8
...@@ -54,3 +54,8 @@ int Db::put(DbTxn *txn, Dbt *key, Dbt *data, u_int32_t flags) { ...@@ -54,3 +54,8 @@ int Db::put(DbTxn *txn, Dbt *key, Dbt *data, u_int32_t flags) {
return ret; return ret;
} }
int Db::cursor(DbTxn *txn, Dbc **cursorp, u_int32_t flags) {
int ret = the_db->cursor(the_db, txn->get_DB_TXN(), (DBC**)cursorp, flags);
return ret;
}
...@@ -9,6 +9,7 @@ class Dbc; ...@@ -9,6 +9,7 @@ class Dbc;
// DBT and Dbt objects are the same pointers. So watch out if you use Dbt to make other classes (e.g., with subclassing). // DBT and Dbt objects are the same pointers. So watch out if you use Dbt to make other classes (e.g., with subclassing).
class Dbt : private DBT class Dbt : private DBT
{ {
friend class Dbc;
public: public:
void * get_data(void) const { return data; } void * get_data(void) const { return data; }
...@@ -17,6 +18,9 @@ class Dbt : private DBT ...@@ -17,6 +18,9 @@ class Dbt : private DBT
u_int32_t get_size(void) const { return size; } u_int32_t get_size(void) const { return size; }
void set_size(u_int32_t p) { size = p; } void set_size(u_int32_t p) { size = p; }
u_int32_t get_flags() const { return flags; }
void set_flags(u_int32_t f) { flags = f; }
DBT *get_DBT(void) { return (DBT*)this; } DBT *get_DBT(void) { return (DBT*)this; }
Dbt(void */*data*/, u_int32_t /*size*/); Dbt(void */*data*/, u_int32_t /*size*/);
...@@ -94,3 +98,11 @@ class DbTxn { ...@@ -94,3 +98,11 @@ class DbTxn {
DB_TXN *the_txn; DB_TXN *the_txn;
}; };
class Dbc : protected DBC
{
public:
int close(void);
int get(Dbt*, Dbt *, u_int32_t);
};
SRCS = $(wildcard *.cpp) SRCS = $(wildcard *.cpp)
TARGETS = $(patsubst %.cpp,%,$(SRCS)) TARGETS = $(patsubst %.cpp,%,$(SRCS))
DBCXX = ../dbt.o ../db.o ../dbenv.o DBCXX = ../dbt.o ../db.o ../dbenv.o ../dbc.o
CPPFLAGS = -I../ -I../../include CPPFLAGS = -I../ -I../../include
CXXFLAGS = -Wall -g CXXFLAGS = -Wall -g
LDLIBS = ../../lib/libdb.a -lz LDLIBS = ../../lib/libdb.a -lz
all: $(TARGETS)
$(TARGETS): $(DBCXX) $(TARGETS): $(DBCXX)
$(DBCXX): $(DBCXX):
cd ..;make cd ..;make
all: $(TARGETS)
clean: clean:
rm -rf $(TARGETS) rm -rf $(TARGETS)
#include <stdlib.h>
#include <assert.h> #include <assert.h>
#include <db_cxx.h> #include <db_cxx.h>
......
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