mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
Add db_version
git-svn-id: file:///svn/tokudb@453 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
5a6ad716e0
commit
e8539c2945
4 changed files with 25 additions and 2 deletions
|
@ -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\"
|
||||
|
|
14
src/tests/test_db_version.c
Normal file
14
src/tests/test_db_version.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
#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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue