Below is the list of changes that have just been committed into a local
5.1 repository of pekka. When pekka does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
storage/ndb/src/ndbapi/ndberror.c
1.45 05/06/14 18:22:01 pekka@stripped +1 -1
parse length bytes in ndb api
storage/ndb/src/ndbapi/NdbScanOperation.cpp
1.61 05/06/14 18:22:01 pekka@stripped +6 -2
parse length bytes in ndb api
storage/ndb/src/ndbapi/NdbOperationSearch.cpp
1.25 05/06/14 18:22:01 pekka@stripped +5 -1
parse length bytes in ndb api
storage/ndb/src/ndbapi/NdbOperationDefine.cpp
1.27 05/06/14 18:22:01 pekka@stripped +4 -23
parse length bytes in ndb api
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
1.41 05/06/14 18:22:00 pekka@stripped +22 -0
parse length bytes in ndb api
ChangeSet
1.1909 05/06/14 18:07:27 pekka@stripped +5 -0
ndb - wl#1751 parse length bytes in ndb api
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: pekka
# Host: tuna.ndb.mysql.com
# Root: /orca/space/pekka/ndb/version/my51-vs
--- 1.40/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp 2005-06-13 15:24:52 +02:00
+++ 1.41/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp 2005-06-14 18:22:00 +02:00
@@ -98,6 +98,9 @@
NdbDictionary::Column * m_facade;
static NdbDictionary::Column * create_psuedo(const char *);
+
+ // Get total length in bytes, used by NdbOperation
+ bool get_var_length(const void* value, Uint32& len) const;
};
class NdbTableImpl : public NdbDictionary::Table, public NdbDictObjectImpl {
@@ -588,6 +591,25 @@
NdbColumnImpl::getBlobType() const {
return (m_type == NdbDictionary::Column::Blob ||
m_type == NdbDictionary::Column::Text);
+}
+
+inline
+bool
+NdbColumnImpl::get_var_length(const void* value, Uint32& len) const
+{
+ Uint32 max_len = m_attrSize * m_arraySize;
+ switch (m_arrayType) {
+ case NDB_ARRAYTYPE_SHORT_VAR:
+ len = 1 + *((Uint8*)value);
+ break;
+ case NDB_ARRAYTYPE_MEDIUM_VAR:
+ len = 2 + uint2korr(value);
+ break;
+ default:
+ len = max_len;
+ return true;
+ }
+ return (len <= max_len);
}
inline
--- 1.26/storage/ndb/src/ndbapi/NdbOperationDefine.cpp 2005-06-14 10:41:57 +02:00
+++ 1.27/storage/ndb/src/ndbapi/NdbOperationDefine.cpp 2005-06-14 18:22:01 +02:00
@@ -487,6 +487,7 @@
}//if
}//if
+ // Insert Attribute Id into ATTRINFO part.
tAttrId = tAttrInfo->m_attrId;
const char *aValue = aValuePassed;
Uint32 ahValue;
@@ -507,23 +508,10 @@
}//if
}//if
- // Insert Attribute Id into ATTRINFO part.
- const Uint32 tArrayType= tAttrInfo->m_arrayType;
- const Uint32 tAttrSize = tAttrInfo->m_attrSize;
- const Uint32 tArraySize = tAttrInfo->m_arraySize;
-
Uint32 len;
- const Uint32 max = tAttrSize * tArraySize;
- switch(tArrayType){
- case NDB_ARRAYTYPE_SHORT_VAR:
- len = * ((Uint8*)aValue) + 1;
- break;
- case NDB_ARRAYTYPE_MEDIUM_VAR:
- len = uint2korr(aValue) + 2;
- break;
- default:
- len = max;
- break;
+ if (! tAttrInfo->get_var_length(aValue, len)) {
+ setErrorCodeAbort(4209);
+ DBUG_RETURN(-1);
}
const Uint32 sizeInBytes = len;
@@ -541,13 +529,6 @@
}//if
}//if
- if ((tArrayType == NDB_ARRAYTYPE_FIXED && sizeInBytes != max) ||
- (tArrayType && sizeInBytes > max))
- {
- setErrorCodeAbort(4209);
- DBUG_RETURN(-1);
- }//if
-
// Including bits in last word
const Uint32 totalSizeInWords = (sizeInBytes + 3)/4;
// Excluding bits in last word
--- 1.24/storage/ndb/src/ndbapi/NdbOperationSearch.cpp 2005-06-14 10:41:57 +02:00
+++ 1.25/storage/ndb/src/ndbapi/NdbOperationSearch.cpp 2005-06-14 18:22:01 +02:00
@@ -125,7 +125,11 @@
theTupleKeyDefined[i][2] = true;
OperationType tOpType = theOperationType;
- Uint32 sizeInBytes = tAttrInfo->m_attrSize * tAttrInfo->m_arraySize;
+ Uint32 sizeInBytes;
+ if (! tAttrInfo->get_var_length(aValue, sizeInBytes)) {
+ setErrorCodeAbort(4209);
+ DBUG_RETURN(-1);
+ }
{
/************************************************************************
--- 1.60/storage/ndb/src/ndbapi/NdbScanOperation.cpp 2005-06-14 10:41:57 +02:00
+++ 1.61/storage/ndb/src/ndbapi/NdbScanOperation.cpp 2005-06-14 18:22:01 +02:00
@@ -1093,10 +1093,14 @@
// insert bound type
Uint32 currLen = theTotalNrOfKeyWordInSignal;
Uint32 remaining = KeyInfo::DataLength - currLen;
- Uint32 sizeInBytes = tAttrInfo->m_attrSize * tAttrInfo->m_arraySize;
bool tDistrKey = tAttrInfo->m_distributionKey;
- Uint32 len = aValue != NULL ? sizeInBytes : 0;
+ Uint32 len = 0;
+ if (aValue != NULL)
+ if (! tAttrInfo->get_var_length(aValue, len)) {
+ setErrorCodeAbort(4209);
+ return -1;
+ }
// insert attribute header
Uint32 tIndexAttrId = tAttrInfo->m_attrId;
--- 1.44/storage/ndb/src/ndbapi/ndberror.c 2005-05-24 17:31:00 +02:00
+++ 1.45/storage/ndb/src/ndbapi/ndberror.c 2005-06-14 18:22:01 +02:00
@@ -480,7 +480,7 @@
{ 4206, AE, "Not allowed to equal key attribute twice" },
{ 4207, AE, "Key size is limited to 4092 bytes" },
{ 4208, AE, "Trying to read a non-stored attribute" },
- { 4209, AE, "Length parameter in equal/setValue is incorrect" },
+ { 4209, AE, "Length of variable size attribute in equal/setValue/setBound is too large
(if this happens from MySQL, it is a bug)" },
{ 4210, AE, "Ndb sent more info than the length he specified" },
{ 4211, AE, "Inconsistency in list of NdbRecAttr-objects" },
{ 4212, AE, "Ndb reports NULL value on Not NULL attribute" },
| Thread |
|---|
| • bk commit into 5.1 tree (pekka:1.1909) | pekka | 14 Jun |