diff options
author | unknown <tomas@whalegate.ndb.mysql.com> | 2007-05-09 14:31:22 +0200 |
---|---|---|
committer | unknown <tomas@whalegate.ndb.mysql.com> | 2007-05-09 14:31:22 +0200 |
commit | 7ef22d8d22ee46ca69026563dbdc9bcccf5e7524 (patch) | |
tree | 91d74d029d2759c92052d3ffcf7039c1322a9e6e /ndb | |
parent | 643cb9b8f30c8028403d5b38d6c6f65cf902e5a1 (diff) | |
download | mariadb-git-7ef22d8d22ee46ca69026563dbdc9bcccf5e7524.tar.gz |
Bug #28287 Sign problem in test "ndb_restore_print"
- corrected previous patch
- some platforms do strange things with char... use Int8 to be sure of signedness
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/include/ndbapi/NdbRecAttr.hpp | 32 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbRecAttr.cpp | 6 |
2 files changed, 33 insertions, 5 deletions
diff --git a/ndb/include/ndbapi/NdbRecAttr.hpp b/ndb/include/ndbapi/NdbRecAttr.hpp index 92cd5706a8d..9679d3995d3 100644 --- a/ndb/include/ndbapi/NdbRecAttr.hpp +++ b/ndb/include/ndbapi/NdbRecAttr.hpp @@ -164,7 +164,14 @@ public: * * @return Char value. */ - Int8 char_value() const; + char char_value() const; + + /** + * Get value stored in NdbRecAttr object. + * + * @return Int8 value. + */ + Int8 int8_value() const; /** * Get value stored in NdbRecAttr object. @@ -204,6 +211,13 @@ public: /** * Get value stored in NdbRecAttr object. * + * @return Uint8 value. + */ + Uint8 u_8_value() const; + + /** + * Get value stored in NdbRecAttr object. + * * @return Float value. */ float float_value() const; @@ -340,9 +354,16 @@ NdbRecAttr::short_value() const } inline -Int8 +char NdbRecAttr::char_value() const { + return *(char*)theRef; +} + +inline +Int8 +NdbRecAttr::int8_value() const +{ return *(Int8*)theRef; } @@ -368,6 +389,13 @@ NdbRecAttr::u_char_value() const } inline +Uint8 +NdbRecAttr::u_8_value() const +{ + return *(Uint8*)theRef; +} + +inline void NdbRecAttr::release() { diff --git a/ndb/src/ndbapi/NdbRecAttr.cpp b/ndb/src/ndbapi/NdbRecAttr.cpp index 996c0256baa..8de163d1c22 100644 --- a/ndb/src/ndbapi/NdbRecAttr.cpp +++ b/ndb/src/ndbapi/NdbRecAttr.cpp @@ -272,7 +272,7 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r, out << r.u_short_value(); break; case NdbDictionary::Column::Tinyunsigned: - out << (unsigned) r.u_char_value(); + out << (unsigned) r.u_8_value(); break; case NdbDictionary::Column::Bigint: out << r.int64_value(); @@ -287,7 +287,7 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r, out << r.short_value(); break; case NdbDictionary::Column::Tinyint: - out << (int) r.char_value(); + out << (int) r.int8_value(); break; case NdbDictionary::Column::Binary: if (!f.hex_format) @@ -413,7 +413,7 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r, break; case NdbDictionary::Column::Year: { - uint year = 1900 + r.u_char_value(); + uint year = 1900 + r.u_8_value(); char buf[40]; sprintf(buf, "%04d", year); out << buf; |