diff options
author | unknown <tomas@poseidon.mysql.com> | 2007-03-08 00:26:23 +0700 |
---|---|---|
committer | unknown <tomas@poseidon.mysql.com> | 2007-03-08 00:26:23 +0700 |
commit | 6928f535325fe81d6bda70b5320b91c56d2e2064 (patch) | |
tree | ce5b5dcf634a48b98d08f4263d1b4c3254278ef0 /ndb | |
parent | 6975a71edd82c35925ed4390129a9aea60db16d0 (diff) | |
download | mariadb-git-6928f535325fe81d6bda70b5320b91c56d2e2064.tar.gz |
ndb - Bit formatting for printout wrong
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/src/ndbapi/NdbRecAttr.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/ndb/src/ndbapi/NdbRecAttr.cpp b/ndb/src/ndbapi/NdbRecAttr.cpp index 4f4d18a1015..2577151e256 100644 --- a/ndb/src/ndbapi/NdbRecAttr.cpp +++ b/ndb/src/ndbapi/NdbRecAttr.cpp @@ -235,17 +235,26 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r, out << r.u_64_value(); break; case NdbDictionary::Column::Bit: - for (j = (length-1)/32 + 1; j > 0; j--) - if (*((Uint32*)r.aRef() + j - 1)) - break; - if (j == 0) + out << f.hex_prefix << "0x"; + if (length < 33) { - out << "0x0"; - break; + out.print("%X", r.u_32_value()); + } + else if (length < 65) + { + out.print("%llX", r.u_64_value()); + } + else + { + const unsigned char *buf = (unsigned char *)r.aRef(); + int k = 4*((length+31)/32); + while (k > 0 && (*(buf + --k) == 0)); + do + { + out.print("%X", (Uint32)*(buf + k--)); + } + while (k >= 0); } - out << f.hex_prefix << "0x"; - for (; j > 0; j--) - out.print("%X", *((Uint32*)r.aRef() + j - 1)); break; case NdbDictionary::Column::Unsigned: if (length > 1) |