summaryrefslogtreecommitdiff
path: root/ndb/src/ndbapi
diff options
context:
space:
mode:
authorunknown <pekka@mysql.com>2004-06-14 15:21:00 +0200
committerunknown <pekka@mysql.com>2004-06-14 15:21:00 +0200
commit9b55fbf337ad2dc37c79e72480d601fe0365ae2d (patch)
tree02d4fa78e7a6b90df24e11d604cb455dd92f61aa /ndb/src/ndbapi
parent2526a4781b88d06de493d31e464d56b89d68ac59 (diff)
downloadmariadb-git-9b55fbf337ad2dc37c79e72480d601fe0365ae2d.tar.gz
testBlobs.cpp, NdbBlob.cpp:
small blob fix ndb/src/ndbapi/NdbBlob.cpp: small blob fix ndb/test/ndbapi/testBlobs.cpp: small blob fix
Diffstat (limited to 'ndb/src/ndbapi')
-rw-r--r--ndb/src/ndbapi/NdbBlob.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/ndb/src/ndbapi/NdbBlob.cpp b/ndb/src/ndbapi/NdbBlob.cpp
index 39d8c6a0e37..8e067f770e8 100644
--- a/ndb/src/ndbapi/NdbBlob.cpp
+++ b/ndb/src/ndbapi/NdbBlob.cpp
@@ -35,6 +35,17 @@
#define DBG(x)
#endif
+static char*
+ndb_blob_debug(const Uint32* data, unsigned size)
+{
+ static char buf[128 + 1]; // MT irrelevant
+ buf[0] = 0;
+ for (unsigned i = 0; i < size && i < 128 / 4; i++) {
+ sprintf(buf + strlen(buf), "%*s%08x", i != 0, "", data[i]);
+ }
+ return buf;
+}
+
/*
* Reading index table directly (as a table) is faster but there are
* bugs or limitations. Keep the code but make possible to choose.
@@ -296,7 +307,7 @@ NdbBlob::getTableKeyValue(NdbOperation* anOp)
}
// odd bytes receive no data and must be zeroed
while (len % 4 != 0) {
- char* p = (char*)data + len++;
+ char* p = (char*)&data[pos] + len++;
*p = 0;
}
pos += len / 4;
@@ -311,8 +322,9 @@ NdbBlob::setTableKeyValue(NdbOperation* anOp)
{
const Uint32* data = (const Uint32*)theKeyBuf.data;
unsigned pos = 0;
- DBG("setTableKeyValue key0=" << data[0]);
- for (unsigned i = 0; i < theTable->m_columns.size(); i++) {
+ const unsigned size = theTable->m_columns.size();
+ DBG("setTableKeyValue key=" << ndb_blob_debug(data, size));
+ for (unsigned i = 0; i < size; i++) {
NdbColumnImpl* c = theTable->m_columns[i];
assert(c != NULL);
if (c->m_pk) {
@@ -333,8 +345,9 @@ NdbBlob::setAccessKeyValue(NdbOperation* anOp)
{
const Uint32* data = (const Uint32*)theAccessKeyBuf.data;
unsigned pos = 0;
- DBG("setAccessKeyValue key0=" << data[0]);
- for (unsigned i = 0; i < theAccessTable->m_columns.size(); i++) {
+ const unsigned size = theAccessTable->m_columns.size();
+ DBG("setAccessKeyValue key=" << ndb_blob_debug(data, size));
+ for (unsigned i = 0; i < size; i++) {
NdbColumnImpl* c = theAccessTable->m_columns[i];
assert(c != NULL);
if (c->m_pk) {
@@ -353,7 +366,9 @@ NdbBlob::setAccessKeyValue(NdbOperation* anOp)
int
NdbBlob::setPartKeyValue(NdbOperation* anOp, Uint32 part)
{
- DBG("setPartKeyValue dist=" << getDistKey(part) << " part=" << part << " key0=" << *(Uint32*)theKeyBuf.data);
+ Uint32* data = (Uint32*)theKeyBuf.data;
+ unsigned size = theTable->m_sizeOfKeysInWords;
+ DBG("setPartKeyValue dist=" << getDistKey(part) << " part=" << part << " key=" << ndb_blob_debug(data, size));
if (anOp->equal((Uint32)0, getDistKey(part)) == -1 ||
anOp->equal((Uint32)1, part) == -1 ||
anOp->equal((Uint32)2, theKeyBuf.data) == -1) {