diff options
author | pekka@mysql.com <> | 2005-11-16 11:52:09 +0100 |
---|---|---|
committer | pekka@mysql.com <> | 2005-11-16 11:52:09 +0100 |
commit | a8ce4d27ce2b5711b59bd931de68ca3f9b907362 (patch) | |
tree | f31a926bcc942a2bf4249bf4b48531f305810fa0 /ndb | |
parent | edd094b194eb81054c6190a8d084f6fb294bf28d (diff) | |
download | mariadb-git-a8ce4d27ce2b5711b59bd931de68ca3f9b907362.tar.gz |
ndb - bug#14007 4.1 [re-commit for LenZ merge]
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/include/kernel/AttributeDescriptor.hpp | 9 | ||||
-rw-r--r-- | ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp | 23 |
2 files changed, 31 insertions, 1 deletions
diff --git a/ndb/include/kernel/AttributeDescriptor.hpp b/ndb/include/kernel/AttributeDescriptor.hpp index 071d45e2607..9d7de21d904 100644 --- a/ndb/include/kernel/AttributeDescriptor.hpp +++ b/ndb/include/kernel/AttributeDescriptor.hpp @@ -36,6 +36,7 @@ private: static Uint32 getType(const Uint32 &); static Uint32 getSize(const Uint32 &); + static Uint32 getSizeInBytes(const Uint32 &); static Uint32 getSizeInWords(const Uint32 &); static Uint32 getArrayType(const Uint32 &); static Uint32 getArraySize(const Uint32 &); @@ -79,6 +80,7 @@ private: #define AD_SIZE_SHIFT (4) #define AD_SIZE_MASK (7) +#define AD_SIZE_IN_BYTES_SHIFT (3) #define AD_SIZE_IN_WORDS_OFFSET (31) #define AD_SIZE_IN_WORDS_SHIFT (5) @@ -187,6 +189,13 @@ AttributeDescriptor::getSize(const Uint32 & desc){ inline Uint32 +AttributeDescriptor::getSizeInBytes(const Uint32 & desc){ + return (getArraySize(desc) << getSize(desc)) + >> AD_SIZE_IN_BYTES_SHIFT; +} + +inline +Uint32 AttributeDescriptor::getSizeInWords(const Uint32 & desc){ return ((getArraySize(desc) << getSize(desc)) + AD_SIZE_IN_WORDS_OFFSET) diff --git a/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp b/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp index cbb165c3eb1..7b642f90a17 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp @@ -700,6 +700,27 @@ Dbtup::checkUpdateOfPrimaryKey(Uint32* updateBuffer, Tablerec* const regTabPtr) Uint32 attrDescriptorIndex = regTabPtr->tabDescriptor + (attributeId << ZAD_LOG_SIZE); Uint32 attrDescriptor = tableDescriptor[attrDescriptorIndex].tabDescr; Uint32 attributeOffset = tableDescriptor[attrDescriptorIndex + 1].tabDescr; + + Uint32 xfrmBuffer[1 + MAX_KEY_SIZE_IN_WORDS * 1]; // strxfrm_multiply == 1 + Uint32 charsetFlag = AttributeOffset::getCharsetFlag(attributeOffset); + if (charsetFlag) { + Uint32 csPos = AttributeOffset::getCharsetPos(attributeOffset); + CHARSET_INFO* cs = regTabPtr->charsetArray[csPos]; + Uint32 sizeInBytes = AttributeDescriptor::getSizeInBytes(attrDescriptor); + Uint32 sizeInWords = AttributeDescriptor::getSizeInWords(attrDescriptor); + const uchar* srcPtr = (uchar*)&updateBuffer[1]; + uchar* dstPtr = (uchar*)&xfrmBuffer[1]; + Uint32 n = + (*cs->coll->strnxfrm)(cs, dstPtr, sizeInBytes, srcPtr, sizeInBytes); + // pad with blanks (unlikely) and zeroes to match NDB API behaviour + while (n < sizeInBytes) + dstPtr[n++] = 0x20; + while (n < 4 * sizeInWords) + dstPtr[n++] = 0; + xfrmBuffer[0] = ahIn.m_value; + updateBuffer = xfrmBuffer; + } + ReadFunction f = regTabPtr->readFunctionArray[attributeId]; AttributeHeader::init(&attributeHeader, attributeId, 0); @@ -707,7 +728,7 @@ Dbtup::checkUpdateOfPrimaryKey(Uint32* updateBuffer, Tablerec* const regTabPtr) tMaxRead = MAX_KEY_SIZE_IN_WORDS; bool tmp = tXfrmFlag; - tXfrmFlag = false; + tXfrmFlag = true; ndbrequire((this->*f)(&keyReadBuffer[0], ahOut, attrDescriptor, attributeOffset)); tXfrmFlag = tmp; ndbrequire(tOutBufIndex == ahOut->getDataSize()); |