diff options
author | unknown <tomas@poseidon.ndb.mysql.com> | 2004-12-17 10:55:00 +0100 |
---|---|---|
committer | unknown <tomas@poseidon.ndb.mysql.com> | 2004-12-17 10:55:00 +0100 |
commit | b3dd00299928ecf27d830359ac6ece8901ed016f (patch) | |
tree | 23de246e58fdcbde728d5c0884eeeb064d39baf8 /ndb | |
parent | 21162110fd89c1f63cf1d8c34fd9ca7a86a556b3 (diff) | |
download | mariadb-git-b3dd00299928ecf27d830359ac6ece8901ed016f.tar.gz |
enabled setting version for ndb
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/src/common/util/version.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/ndb/src/common/util/version.c b/ndb/src/common/util/version.c index 8e4f6efe745..75537c6ed3a 100644 --- a/ndb/src/common/util/version.c +++ b/ndb/src/common/util/version.c @@ -17,6 +17,8 @@ #include <ndb_global.h> #include <ndb_version.h> #include <version.h> +#include <NdbEnv.h> +#include <NdbOut.hpp> Uint32 getMajor(Uint32 version) { return (version >> 16) & 0xFF; @@ -67,6 +69,24 @@ struct NdbUpGradeCompatible { /*#define TEST_VERSION*/ +#define HAVE_NDB_SETVERSION +#ifdef HAVE_NDB_SETVERSION +Uint32 ndbOwnVersionTesting = 0; +void +ndbSetOwnVersion() { + char buf[256]; + if (NdbEnv_GetEnv("NDB_SETVERSION", buf, sizeof(buf))) { + Uint32 _v1,_v2,_v3; + if (sscanf(buf, "%u.%u.%u", &_v1, &_v2, &_v3) == 3) { + ndbOwnVersionTesting = MAKE_VERSION(_v1,_v2,_v3); + ndbout_c("Testing: Version set to 0x%x", ndbOwnVersionTesting); + } + } +} +#else +void ndbSetOwnVersion() {} +#endif + #ifndef TEST_VERSION struct NdbUpGradeCompatible ndbCompatibleTable_full[] = { { MAKE_VERSION(4,1,9), MAKE_VERSION(4,1,8), UG_Exact }, @@ -79,8 +99,6 @@ struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = { { 0, 0, UG_Null } }; -void ndbSetOwnVersion() {} - #else /* testing purposes */ struct NdbUpGradeCompatible ndbCompatibleTable_full[] = { @@ -101,19 +119,6 @@ struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = { }; -Uint32 ndbOwnVersionTesting = 0; -void -ndbSetOwnVersion() { - char buf[256]; - if (NdbEnv_GetEnv("NDB_SETVERSION", buf, sizeof(buf))) { - Uint32 _v1,_v2,_v3; - if (sscanf(buf, "%u.%u.%u", &_v1, &_v2, &_v3) == 3) { - ndbOwnVersionTesting = MAKE_VERSION(_v1,_v2,_v3); - ndbout_c("Testing: Version set to 0x%x", ndbOwnVersionTesting); - } - } -} - #endif void ndbPrintVersion() @@ -127,13 +132,13 @@ void ndbPrintVersion() Uint32 ndbGetOwnVersion() { -#ifndef TEST_VERSION - return NDB_VERSION_D; -#else /* testing purposes */ +#ifdef HAVE_NDB_SETVERSION if (ndbOwnVersionTesting == 0) return NDB_VERSION_D; else return ndbOwnVersionTesting; +#else + return NDB_VERSION_D; #endif } |