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
This commit is contained in:
parent
aaeca5bda8
commit
9b1157537b
@ -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:
|
|||||||
*/
|
*/
|
||||||
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
|
|||||||
}
|
}
|
||||||
|
|
||||||
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
|
|||||||
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,
|
|||||||
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,
|
|||||||
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,
|
|||||||
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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user