Commit f87b4e5d authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Make db_create work a little more under c++. Addresses #197.

git-svn-id: file:///svn/tokudb@1196 c7de825b-a66e-492c-adef-691d508d4ae1
parent ad106f27
CPPFLAGS = -I../include CPPFLAGS = -I../include
CXXFLAGS = -Wall -g
CC = c++ CC = c++
LDFLAGS = -lz LDFLAGS = -lz
SRCS = $(wildcard *.cpp)
OBJS = $(patsubst %.cpp, %.o, $(SRCS))
default: $(OBJS)
$(OBJS): db_cxx.h
test1: test1.o dbt.o db.o dbenv.o ../lib/libdb.a test1: test1.o dbt.o db.o dbenv.o ../lib/libdb.a
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
#include <errno.h> #include <errno.h>
#include "db_cxx.h" #include "db_cxx.h"
Db::Db(DbEnv *env, u_int32_t flags) { Db::Db(DbEnv *env, u_int32_t flags)
: the_Env(env)
{
the_db = 0; the_db = 0;
the_Env = env;
if (the_Env == 0) { if (the_Env == 0) {
is_private_env = 1; is_private_env = 1;
} }
......
...@@ -69,6 +69,7 @@ class DbEnv { ...@@ -69,6 +69,7 @@ class DbEnv {
DbEnv(u_int32_t flags); DbEnv(u_int32_t flags);
DB_ENV *get_DB_ENV(void) { DB_ENV *get_DB_ENV(void) {
if (this==0) return 0;
return the_env; return the_env;
} }
...@@ -86,6 +87,7 @@ class DbTxn { ...@@ -86,6 +87,7 @@ class DbTxn {
public: public:
DB_TXN *get_DB_TXN() DB_TXN *get_DB_TXN()
{ {
if (this==0) return 0;
return the_txn; return the_txn;
} }
private: private:
......
SRCS = $(wildcard *.cpp) SRCS = $(wildcard *.cpp)
TARGETS = $(patsubst %.cpp,%,$(SRCS)) TARGETS = $(patsubst %.cpp,%,$(SRCS))
DBCXX = ../dbt.o ../db.o ../dbenv.o ../dbt.o DBCXX = ../dbt.o ../db.o ../dbenv.o
CPPFLAGS = -I../ -I../../include CPPFLAGS = -I../ -I../../include
CXXFLAGS = -Wall -g CXXFLAGS = -Wall -g
LDFLAGS = -L../lib -ldb LDFLAGS = -L../lib -ldb
$(TARGETS): $(DBCXX) $(TARGETS): $(DBCXX)
$(DBCXX):
cd ..;make
all: $(TARGETS) all: $(TARGETS)
clean: clean:
......
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