summaryrefslogtreecommitdiff
path: root/ndb/src/kernel/blocks/dbtup
diff options
context:
space:
mode:
authorunknown <pekka@mysql.com>2005-11-16 11:52:09 +0100
committerunknown <pekka@mysql.com>2005-11-16 11:52:09 +0100
commit563e5c8d7961c79106fcf3b83656942ece4b4cd4 (patch)
treef31a926bcc942a2bf4249bf4b48531f305810fa0 /ndb/src/kernel/blocks/dbtup
parent467deb4cb7aeb456086838cadcdf10b25b667a36 (diff)
downloadmariadb-git-563e5c8d7961c79106fcf3b83656942ece4b4cd4.tar.gz
ndb - bug#14007 4.1 [re-commit for LenZ merge]
mysql-test/r/ndb_charset.result: bug#14007 test [re-commit] mysql-test/t/ndb_charset.test: bug#14007 test [re-commit] ndb/include/kernel/AttributeDescriptor.hpp: bug#14007 4.1 need getSizeInBytes [re-commit] ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp: bug#14007 4.1 *** do not AUTOmerge to 5.0 *** [re-commit]
Diffstat (limited to 'ndb/src/kernel/blocks/dbtup')
-rw-r--r--ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp23
1 files changed, 22 insertions, 1 deletions
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());