Loading ndb/src/ndbapi/NdbBlob.cpp +21 −6 Original line number Diff line number Diff line Loading @@ -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. Loading Loading @@ -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; Loading @@ -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) { Loading @@ -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) { Loading @@ -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) { Loading ndb/test/ndbapi/testBlobs.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ struct Opt { m_tname("TBLOB1"), m_x1name("TBLOB1X1"), m_x2name("TBLOB1X2"), m_pk1off(999000000), m_pk1off(0x12340000), m_pk2len(55), m_oneblob(false), m_blob1(false, 7, 1137, 10), Loading Loading @@ -988,6 +988,8 @@ testmain() bool ulim = skip('w') ? false : true; // pk for (int rw = llim; rw <= ulim; rw++) { if (skip('k')) continue; DBG("--- pk ops " << (! rw ? "get/set" : "read/write") << " ---"); calcTups(false); CHK(insertPk(rw) == 0); Loading Loading
ndb/src/ndbapi/NdbBlob.cpp +21 −6 Original line number Diff line number Diff line Loading @@ -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. Loading Loading @@ -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; Loading @@ -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) { Loading @@ -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) { Loading @@ -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) { Loading
ndb/test/ndbapi/testBlobs.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ struct Opt { m_tname("TBLOB1"), m_x1name("TBLOB1X1"), m_x2name("TBLOB1X2"), m_pk1off(999000000), m_pk1off(0x12340000), m_pk2len(55), m_oneblob(false), m_blob1(false, 7, 1137, 10), Loading Loading @@ -988,6 +988,8 @@ testmain() bool ulim = skip('w') ? false : true; // pk for (int rw = llim; rw <= ulim; rw++) { if (skip('k')) continue; DBG("--- pk ops " << (! rw ? "get/set" : "read/write") << " ---"); calcTups(false); CHK(insertPk(rw) == 0); Loading