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

Add db_version

git-svn-id: file:///svn/tokudb@453 c7de825b-a66e-492c-adef-691d508d4ae1
parent 5a6ad716
......@@ -22,7 +22,7 @@ install: $(LIBNAME)
clean:
rm -rf *.$(LIBEXT) *.o
ydb.o: ../include/db.h ../newbrt/cachetable.h ../newbrt/brt.h
DBBINS = ydb.o ../newbrt/brt.o ../newbrt/brt-serialize.o ../newbrt/cachetable.o ../newbrt/hashtable.o ../newbrt/header-io.o ../newbrt/key.o ../newbrt/memory.o ../newbrt/pma.o ../newbrt/ybt.o ../newbrt/primes.o ../newbrt/log.o
DBBINS = ydb.o ../newbrt/brt.o ../newbrt/brt-serialize.o ../newbrt/cachetable.o ../newbrt/hashtable.o ../newbrt/header-io.o ../newbrt/key.o ../newbrt/memory.o ../newbrt/pma.o ../newbrt/ybt.o ../newbrt/primes.o ../newbrt/log.o ../newbrt/mempool.o
$(LIBNAME): $(DBBINS)
cc $(CPPFLAGS) $(DBBINS) $(SHARED) -o $@ $(CFLAGS)
libdb.a(ydb.o): ydb.o
......@@ -10,11 +10,13 @@ check_log1: ./test_log1
valgrind --quiet ./test_log1
check_db_close_no_open: ./test_db_close_no_open
valgrind --quiet ./test_db_close_no_open
check_db_version: ./test_db_version
valgrind --quiet ./test_db_version
.PHONY: check_log0 make_libs
make_libs:
cd ..;make
check: make_libs check_log0 check_log1 check_db_close_no_open
check: make_libs check_log0 check_log1 check_db_close_no_open check_db_version
test_log1.bdb: test_log1.c
cc -Wall -Werror -O2 -g test_log1.c -o $@ -ldb -DDBVERSION=\"bdb\"
......
#include <db.h>
#include <assert.h>
int main (int argc, char *argv[]) {
const char *v;
int major, minor, patch;
v = db_version(0, 0, 0);
assert(v!=0);
v = db_version(&major, &minor, &patch);
assert(major==DB_VERSION_MAJOR);
assert(minor==DB_VERSION_MINOR);
assert(patch==DB_VERSION_PATCH);
return 0;
}
......@@ -521,3 +521,10 @@ char *db_strerror (int error) {
goto unknown;
}
}
const char *db_version (int *major, int *minor, int *patch) {
if (major) *major=DB_VERSION_MAJOR;
if (minor) *minor=DB_VERSION_MINOR;
if (patch) *patch=DB_VERSION_PATCH;
return DB_VERSION_STRING;
}
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