Commit 7ef22d8d authored by unknown's avatar unknown

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

parent 643cb9b8
...@@ -164,7 +164,14 @@ public: ...@@ -164,7 +164,14 @@ public:
* *
* @return Char value. * @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. * Get value stored in NdbRecAttr object.
...@@ -201,6 +208,13 @@ public: ...@@ -201,6 +208,13 @@ public:
*/ */
Uint8 u_char_value() const; Uint8 u_char_value() const;
/**
* Get value stored in NdbRecAttr object.
*
* @return Uint8 value.
*/
Uint8 u_8_value() const;
/** /**
* Get value stored in NdbRecAttr object. * Get value stored in NdbRecAttr object.
* *
...@@ -340,8 +354,15 @@ NdbRecAttr::short_value() const ...@@ -340,8 +354,15 @@ NdbRecAttr::short_value() const
} }
inline inline
Int8 char
NdbRecAttr::char_value() const NdbRecAttr::char_value() const
{
return *(char*)theRef;
}
inline
Int8
NdbRecAttr::int8_value() const
{ {
return *(Int8*)theRef; return *(Int8*)theRef;
} }
...@@ -367,6 +388,13 @@ NdbRecAttr::u_char_value() const ...@@ -367,6 +388,13 @@ NdbRecAttr::u_char_value() const
return *(Uint8*)theRef; return *(Uint8*)theRef;
} }
inline
Uint8
NdbRecAttr::u_8_value() const
{
return *(Uint8*)theRef;
}
inline inline
void void
NdbRecAttr::release() NdbRecAttr::release()
......
...@@ -272,7 +272,7 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r, ...@@ -272,7 +272,7 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r,
out << r.u_short_value(); out << r.u_short_value();
break; break;
case NdbDictionary::Column::Tinyunsigned: case NdbDictionary::Column::Tinyunsigned:
out << (unsigned) r.u_char_value(); out << (unsigned) r.u_8_value();
break; break;
case NdbDictionary::Column::Bigint: case NdbDictionary::Column::Bigint:
out << r.int64_value(); out << r.int64_value();
...@@ -287,7 +287,7 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r, ...@@ -287,7 +287,7 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r,
out << r.short_value(); out << r.short_value();
break; break;
case NdbDictionary::Column::Tinyint: case NdbDictionary::Column::Tinyint:
out << (int) r.char_value(); out << (int) r.int8_value();
break; break;
case NdbDictionary::Column::Binary: case NdbDictionary::Column::Binary:
if (!f.hex_format) if (!f.hex_format)
...@@ -413,7 +413,7 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r, ...@@ -413,7 +413,7 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r,
break; break;
case NdbDictionary::Column::Year: case NdbDictionary::Column::Year:
{ {
uint year = 1900 + r.u_char_value(); uint year = 1900 + r.u_8_value();
char buf[40]; char buf[40];
sprintf(buf, "%04d", year); sprintf(buf, "%04d", year);
out << buf; out << buf;
......
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