Commit 328fc573 authored by knielsen@loke.(none)'s avatar knielsen@loke.(none)

Merge loke.(none):/home/knielsen/devel/mysql-5.1-telco-gca

into  loke.(none):/home/knielsen/devel/mysql-5.1-new-ndb
parents d850b107 815a6300
...@@ -52,8 +52,7 @@ public: ...@@ -52,8 +52,7 @@ public:
// NOTE: in 5.1 ctors and init take size in bytes // NOTE: in 5.1 ctors and init take size in bytes
/** Initialize AttributeHeader at location aHeaderPtr */ /** Initialize AttributeHeader at location aHeaderPtr */
static AttributeHeader& init(void* aHeaderPtr, Uint32 anAttributeId, static void init(Uint32* aHeaderPtr, Uint32 anAttributeId, Uint32 aByteSize);
Uint32 aByteSize);
/** Returns size of AttributeHeader (usually one or two words) */ /** Returns size of AttributeHeader (usually one or two words) */
Uint32 getHeaderSize() const; // In 32-bit words Uint32 getHeaderSize() const; // In 32-bit words
...@@ -113,10 +112,11 @@ public: ...@@ -113,10 +112,11 @@ public:
*/ */
inline inline
AttributeHeader& AttributeHeader::init(void* aHeaderPtr, Uint32 anAttributeId, void AttributeHeader::init(Uint32* aHeaderPtr, Uint32 anAttributeId,
Uint32 aByteSize) Uint32 aByteSize)
{ {
return * new (aHeaderPtr) AttributeHeader(anAttributeId, aByteSize); AttributeHeader ah(anAttributeId, aByteSize);
*aHeaderPtr = ah.m_value;
} }
inline inline
......
...@@ -1957,9 +1957,8 @@ int Dbtup::interpreterNextLab(Signal* signal, ...@@ -1957,9 +1957,8 @@ int Dbtup::interpreterNextLab(Signal* signal,
Uint32 TdataForUpdate[3]; Uint32 TdataForUpdate[3];
Uint32 Tlen; Uint32 Tlen;
AttributeHeader& ah= AttributeHeader::init(&TdataForUpdate[0], AttributeHeader ah(TattrId, TattrNoOfWords << 2);
TattrId, TdataForUpdate[0]= ah.m_value;
TattrNoOfWords << 2);
TdataForUpdate[1]= TregMemBuffer[theRegister + 2]; TdataForUpdate[1]= TregMemBuffer[theRegister + 2];
TdataForUpdate[2]= TregMemBuffer[theRegister + 3]; TdataForUpdate[2]= TregMemBuffer[theRegister + 3];
Tlen= TattrNoOfWords + 1; Tlen= TattrNoOfWords + 1;
...@@ -1975,6 +1974,7 @@ int Dbtup::interpreterNextLab(Signal* signal, ...@@ -1975,6 +1974,7 @@ int Dbtup::interpreterNextLab(Signal* signal,
// Write a NULL value into the attribute // Write a NULL value into the attribute
/* --------------------------------------------------------- */ /* --------------------------------------------------------- */
ah.setNULL(); ah.setNULL();
TdataForUpdate[0]= ah.m_value;
Tlen= 1; Tlen= 1;
} }
int TnoDataRW= updateAttributes(req_struct, int TnoDataRW= updateAttributes(req_struct,
......
...@@ -818,9 +818,7 @@ Dbtup::checkUpdateOfPrimaryKey(KeyReqStruct* req_struct, ...@@ -818,9 +818,7 @@ Dbtup::checkUpdateOfPrimaryKey(KeyReqStruct* req_struct,
Tablerec* const regTabPtr) Tablerec* const regTabPtr)
{ {
Uint32 keyReadBuffer[MAX_KEY_SIZE_IN_WORDS]; Uint32 keyReadBuffer[MAX_KEY_SIZE_IN_WORDS];
Uint32 attributeHeader;
TableDescriptor* attr_descr = req_struct->attr_descr; TableDescriptor* attr_descr = req_struct->attr_descr;
AttributeHeader* ahOut = (AttributeHeader*)&attributeHeader;
AttributeHeader ahIn(*updateBuffer); AttributeHeader ahIn(*updateBuffer);
Uint32 attributeId = ahIn.getAttributeId(); Uint32 attributeId = ahIn.getAttributeId();
Uint32 attrDescriptorIndex = attributeId << ZAD_LOG_SIZE; Uint32 attrDescriptorIndex = attributeId << ZAD_LOG_SIZE;
...@@ -843,7 +841,7 @@ Dbtup::checkUpdateOfPrimaryKey(KeyReqStruct* req_struct, ...@@ -843,7 +841,7 @@ Dbtup::checkUpdateOfPrimaryKey(KeyReqStruct* req_struct,
ReadFunction f = regTabPtr->readFunctionArray[attributeId]; ReadFunction f = regTabPtr->readFunctionArray[attributeId];
AttributeHeader::init(&attributeHeader, attributeId, 0); AttributeHeader attributeHeader(attributeId, 0);
req_struct->out_buf_index = 0; req_struct->out_buf_index = 0;
req_struct->max_read = MAX_KEY_SIZE_IN_WORDS; req_struct->max_read = MAX_KEY_SIZE_IN_WORDS;
req_struct->attr_descriptor = attrDescriptor; req_struct->attr_descriptor = attrDescriptor;
...@@ -852,12 +850,12 @@ Dbtup::checkUpdateOfPrimaryKey(KeyReqStruct* req_struct, ...@@ -852,12 +850,12 @@ Dbtup::checkUpdateOfPrimaryKey(KeyReqStruct* req_struct,
req_struct->xfrm_flag = true; req_struct->xfrm_flag = true;
ndbrequire((this->*f)(&keyReadBuffer[0], ndbrequire((this->*f)(&keyReadBuffer[0],
req_struct, req_struct,
ahOut, &attributeHeader,
attributeOffset)); attributeOffset));
req_struct->xfrm_flag = tmp; req_struct->xfrm_flag = tmp;
ndbrequire(req_struct->out_buf_index == ahOut->getDataSize()); ndbrequire(req_struct->out_buf_index == attributeHeader.getDataSize());
if (ahIn.getDataSize() != ahOut->getDataSize()) { if (ahIn.getDataSize() != attributeHeader.getDataSize()) {
jam(); jam();
return true; return true;
} }
......
...@@ -1169,9 +1169,7 @@ DbUtil::prepareOperation(Signal* signal, PreparePtr prepPtr) ...@@ -1169,9 +1169,7 @@ DbUtil::prepareOperation(Signal* signal, PreparePtr prepPtr)
/************************************************************** /**************************************************************
* Attribute found - store in mapping (AttributeId, Position) * Attribute found - store in mapping (AttributeId, Position)
**************************************************************/ **************************************************************/
AttributeHeader & attrMap = AttributeHeader attrMap(attrDesc.AttributeId, // 1. Store AttrId
AttributeHeader::init(attrMappingIt.data,
attrDesc.AttributeId, // 1. Store AttrId
0); 0);
if (attrDesc.AttributeKeyFlag) { if (attrDesc.AttributeKeyFlag) {
...@@ -1200,6 +1198,7 @@ DbUtil::prepareOperation(Signal* signal, PreparePtr prepPtr) ...@@ -1200,6 +1198,7 @@ DbUtil::prepareOperation(Signal* signal, PreparePtr prepPtr)
return; return;
} }
} }
*(attrMappingIt.data) = attrMap.m_value;
#if 0 #if 0
ndbout << "BEFORE: attrLength: " << attrLength << endl; ndbout << "BEFORE: attrLength: " << attrLength << endl;
#endif #endif
......
...@@ -408,9 +408,8 @@ NdbOperation::getValue_impl(const NdbColumnImpl* tAttrInfo, char* aValue) ...@@ -408,9 +408,8 @@ NdbOperation::getValue_impl(const NdbColumnImpl* tAttrInfo, char* aValue)
return NULL; return NULL;
}//if }//if
}//if }//if
Uint32 ah; AttributeHeader ah(tAttrInfo->m_attrId, 0);
AttributeHeader::init(&ah, tAttrInfo->m_attrId, 0); if (insertATTRINFO(ah.m_value) != -1) {
if (insertATTRINFO(ah) != -1) {
// Insert Attribute Id into ATTRINFO part. // Insert Attribute Id into ATTRINFO part.
/************************************************************************ /************************************************************************
...@@ -536,12 +535,11 @@ NdbOperation::setValue( const NdbColumnImpl* tAttrInfo, ...@@ -536,12 +535,11 @@ NdbOperation::setValue( const NdbColumnImpl* tAttrInfo,
tAttrId = tAttrInfo->m_attrId; tAttrId = tAttrInfo->m_attrId;
m_no_disk_flag &= (tAttrInfo->m_storageType == NDB_STORAGETYPE_DISK ? 0:1); m_no_disk_flag &= (tAttrInfo->m_storageType == NDB_STORAGETYPE_DISK ? 0:1);
const char *aValue = aValuePassed; const char *aValue = aValuePassed;
Uint32 ahValue;
if (aValue == NULL) { if (aValue == NULL) {
if (tAttrInfo->m_nullable) { if (tAttrInfo->m_nullable) {
AttributeHeader& ah = AttributeHeader::init(&ahValue, tAttrId, 0); AttributeHeader ah(tAttrId, 0);
ah.setNULL(); ah.setNULL();
insertATTRINFO(ahValue); insertATTRINFO(ah.m_value);
// Insert Attribute Id with the value // Insert Attribute Id with the value
// NULL into ATTRINFO part. // NULL into ATTRINFO part.
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -577,8 +575,8 @@ NdbOperation::setValue( const NdbColumnImpl* tAttrInfo, ...@@ -577,8 +575,8 @@ NdbOperation::setValue( const NdbColumnImpl* tAttrInfo,
// Excluding bits in last word // Excluding bits in last word
const Uint32 sizeInWords = sizeInBytes / 4; const Uint32 sizeInWords = sizeInBytes / 4;
(void) AttributeHeader::init(&ahValue, tAttrId, sizeInBytes); AttributeHeader ah(tAttrId, sizeInBytes);
insertATTRINFO( ahValue ); insertATTRINFO( ah.m_value );
/*********************************************************************** /***********************************************************************
* Check if the pointer of the value passed is aligned on a 4 byte boundary. * Check if the pointer of the value passed is aligned on a 4 byte boundary.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment