Commit eeec709d authored by unknown's avatar unknown

Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb

into mysql.com:/home/jonas/src/mysql-5.0-ndb

parents 70a4cf9d d42ff5df
...@@ -15,17 +15,6 @@ ...@@ -15,17 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/************************************************************************************************
Name: NdbRecAttr.C
Include:
Link:
Author: UABRONM Mikael Ronstrm UAB/B/SD
Date: 971206
Version: 0.1
Description: Interface between TIS and NDB
Documentation:
Adjust: 971206 UABRONM First version
************************************************************************************************/
#include <ndb_global.h> #include <ndb_global.h>
#include <NdbOut.hpp> #include <NdbOut.hpp>
#include <NdbRecAttr.hpp> #include <NdbRecAttr.hpp>
...@@ -148,6 +137,39 @@ NdbRecAttr::receive_data(const Uint32 * data, Uint32 sz){ ...@@ -148,6 +137,39 @@ NdbRecAttr::receive_data(const Uint32 * data, Uint32 sz){
return false; return false;
} }
static void
ndbrecattr_print_string(NdbOut& out, const char *type,
const char *ref, unsigned sz)
{
int i, len, printable= 1;
// trailing zeroes are not printed
for (i=sz-1; i >= 0; i--)
if (ref[i] == 0) sz--;
else break;
if (sz == 0) return; // empty
for (len=0; len < (int)sz && ref[i] != 0; len++)
if (printable && !isprint((int)ref[i]))
printable= 0;
if (printable)
out.print("%.*s", len, ref);
else
{
out.print("0x");
for (i=0; i < len; i++)
out.print("%02X", (int)ref[i]);
}
if (len != (int)sz)
{
out.print("[");
for (i= len+1; ref[i] != 0; i++)
out.print("%u]",len-i);
assert((int)sz > i);
ndbrecattr_print_string(out,type,ref+i,sz-i);
}
}
NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r) NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
{ {
if (r.isNULL()) if (r.isNULL())
...@@ -193,17 +215,19 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r) ...@@ -193,17 +215,19 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
case NdbDictionary::Column::Tinyint: case NdbDictionary::Column::Tinyint:
out << (int) r.char_value(); out << (int) r.char_value();
break; break;
case NdbDictionary::Column::Binary:
ndbrecattr_print_string(out,"Binary",r.aRef(),r.arraySize());
j = r.arraySize();
break;
case NdbDictionary::Column::Char: case NdbDictionary::Column::Char:
out.print("%.*s", r.arraySize(), r.aRef()); ndbrecattr_print_string(out,"Char",r.aRef(),r.arraySize());
j = r.arraySize(); j = r.arraySize();
break; break;
case NdbDictionary::Column::Varchar: case NdbDictionary::Column::Varchar:
{ ndbrecattr_print_string(out,"Varchar", r.aRef()+ 2,
short len = ntohs(r.u_short_value()); ntohs(r.u_short_value()));
out.print("%.*s", len, r.aRef()+2);
}
j = r.arraySize(); j = r.arraySize();
break; break;
case NdbDictionary::Column::Float: case NdbDictionary::Column::Float:
out << r.float_value(); out << r.float_value();
break; break;
......
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