summaryrefslogtreecommitdiff
path: root/ndb/src/ndbapi/NdbScanOperation.cpp
diff options
context:
space:
mode:
authorunknown <joreland@mysql.com>2004-11-02 16:15:35 +0100
committerunknown <joreland@mysql.com>2004-11-02 16:15:35 +0100
commitaa141a8664b0ab4a9d2a24eedefb682550052f19 (patch)
treea3e724070df7b31b82a06092b57b73c43bd5ee73 /ndb/src/ndbapi/NdbScanOperation.cpp
parent9b55605460e52c700e46f517e7eead54c366394c (diff)
downloadmariadb-git-aa141a8664b0ab4a9d2a24eedefb682550052f19.tar.gz
correct distr key handling
ndb/src/ndbapi/NdbDictionary.cpp: print if something is distribution key ndb/src/ndbapi/NdbIndexOperation.cpp: Init theNoOfTupKeyLeft ndb/src/ndbapi/NdbScanOperation.cpp: Charsets
Diffstat (limited to 'ndb/src/ndbapi/NdbScanOperation.cpp')
-rw-r--r--ndb/src/ndbapi/NdbScanOperation.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp
index 3296aadae7c..b2e7d6b425c 100644
--- a/ndb/src/ndbapi/NdbScanOperation.cpp
+++ b/ndb/src/ndbapi/NdbScanOperation.cpp
@@ -1028,6 +1028,12 @@ NdbIndexScanOperation::setBound(const NdbColumnImpl* tAttrInfo,
Uint32 remaining = KeyInfo::DataLength - currLen;
Uint32 sizeInBytes = tAttrInfo->m_attrSize * tAttrInfo->m_arraySize;
bool tDistrKey = tAttrInfo->m_distributionKey;
+
+ len = aValue != NULL ? sizeInBytes : 0;
+ if (len != sizeInBytes && (len != 0)) {
+ setErrorCodeAbort(4209);
+ return -1;
+ }
// normalize char bound
CHARSET_INFO* cs = tAttrInfo->m_cs;
@@ -1035,26 +1041,23 @@ NdbIndexScanOperation::setBound(const NdbColumnImpl* tAttrInfo,
if (cs != NULL && aValue != NULL) {
// current limitation: strxfrm does not increase length
assert(cs->strxfrm_multiply == 1);
+ ((Uint32*)xfrmData)[len >> 2] = 0;
unsigned n =
(*cs->coll->strnxfrm)(cs,
(uchar*)xfrmData, sizeof(xfrmData),
- (const uchar*)aValue, sizeInBytes);
-
- ((Uint32*)xfrmData)[sizeInBytes >> 2] = 0;
+ (const uchar*)aValue, len);
- while (n < sizeInBytes)
+ while (n < len)
((uchar*)xfrmData)[n++] = 0x20;
- if(sizeInBytes & 3)
- sizeInBytes += (4 - sizeInBytes & 3);
-
+ if(len & 3)
+ {
+ len += (4 - (len & 3));
+ }
+
aValue = (char*)xfrmData;
}
- len = aValue != NULL ? sizeInBytes : 0;
- if (len != sizeInBytes && (len != 0)) {
- setErrorCodeAbort(4209);
- return -1;
- }
+
// insert attribute header
Uint32 tIndexAttrId = tAttrInfo->m_attrId;
Uint32 sizeInWords = (len + 3) / 4;
@@ -1062,7 +1065,9 @@ NdbIndexScanOperation::setBound(const NdbColumnImpl* tAttrInfo,
const Uint32 ahValue = ah.m_value;
const Uint32 align = (UintPtr(aValue) & 7);
- const bool aligned = (type == BoundEQ) ? (align & 3) == 0 : (align == 0);
+ const bool aligned = (tDistrKey && type == BoundEQ) ?
+ (align == 0) : (align & 3) == 0;
+
const bool nobytes = (len & 0x3) == 0;
const Uint32 totalLen = 2 + sizeInWords;
Uint32 tupKeyLen = theTupKeyLen;
@@ -1077,8 +1082,9 @@ NdbIndexScanOperation::setBound(const NdbColumnImpl* tAttrInfo,
Uint32 *tempData = (Uint32*)xfrmData;
tempData[0] = type;
tempData[1] = ahValue;
- tempData[sizeInBytes >> 2] = 0;
+ tempData[2 + (len >> 2)] = 0;
memcpy(tempData+2, aValue, len);
+
insertBOUNDS(tempData, 2+sizeInWords);
} else {
Uint32 buf[2] = { type, ahValue };