Merge joreland@bk-internal.mysql.com:/home/bk/mysql-4.1-ndb

into mysql.com:/home/jonas/src/mysql-4.1-ndb


ndb/src/kernel/blocks/dbtc/DbtcMain.cpp:
  Auto merged
ndb/src/ndbapi/ndberror.c:
  Auto merged
This commit is contained in:
unknown 2004-08-13 17:11:52 +02:00
commit c9c7834164
10 changed files with 180 additions and 59 deletions

View file

@ -6255,16 +6255,6 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr)
jam();
found = true;
const Uint32 a = aRec->attributeDescriptor;
bool isNullable = AttributeDescriptor::getNullable(a);
// We do not allow more than one NULLable attribute for hash index
if (isNullable &&
indexPtr.p->isHashIndex() &&
(opPtr.p->m_attrList.sz > 1)) {
jam();
opPtr.p->m_errorCode = CreateIndxRef::AttributeNullable;
opPtr.p->m_errorLine = __LINE__;
return;
}
if (indexPtr.p->isHashIndex()) {
const Uint32 s1 = AttributeDescriptor::getSize(a);
const Uint32 s2 = AttributeDescriptor::getArraySize(a);

View file

@ -139,6 +139,7 @@
#define ZNOT_FOUND 626
#define ZALREADYEXIST 630
#define ZINCONSISTENTHASHINDEX 892
#define ZNOTUNIQUE 893
#endif
class Dbtc: public SimulatedBlock {

View file

@ -4927,7 +4927,9 @@ void Dbtc::execLQHKEYREF(Signal* signal)
// The operation executed an index trigger
const Uint32 opType = regTcPtr->operation;
if (!(opType == ZDELETE && errCode == ZNOT_FOUND)) {
if (errCode == ZALREADYEXIST)
errCode = terrorCode = ZNOTUNIQUE;
else if (!(opType == ZDELETE && errCode == ZNOT_FOUND)) {
jam();
/**
* "Normal path"
@ -12176,34 +12178,33 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
// Calculate key length and renumber attribute id:s
AttributeBuffer::DataBufferPool & pool = c_theAttributeBufferPool;
LocalDataBuffer<11> afterValues(pool, firedTriggerData->afterValues);
bool skipNull = false;
for(bool moreKeyAttrs = afterValues.first(iter); moreKeyAttrs; attrId++) {
jam();
AttributeHeader* attrHeader = (AttributeHeader *) iter.data;
// Filter out NULL valued attributes
if (attrHeader->isNULL()) {
skipNull = true;
break;
}
attrHeader->setAttributeId(attrId);
keyLength += attrHeader->getDataSize();
hops = attrHeader->getHeaderSize() + attrHeader->getDataSize();
moreKeyAttrs = afterValues.next(iter, hops);
}
// Filter out single NULL attributes
if (attrId == 1) {
if (skipNull) {
jam();
afterValues.first(iter);
AttributeHeader* attrHeader = (AttributeHeader *) iter.data;
if (attrHeader->isNULL() && !afterValues.next(iter)) {
opRecord->triggerExecutionCount--;
if (opRecord->triggerExecutionCount == 0) {
/*
We have completed current trigger execution
Continue triggering operation
*/
jam();
opRecord->triggerExecutionCount--;
if (opRecord->triggerExecutionCount == 0) {
/*
We have completed current trigger execution
Continue triggering operation
*/
jam();
continueTriggeringOp(signal, opRecord);
}//if
return;
continueTriggeringOp(signal, opRecord);
}//if
return;
}//if
// Calculate total length of primary key to be stored in index table
@ -12531,36 +12532,36 @@ void Dbtc::deleteFromIndexTable(Signal* signal,
// Calculate key length and renumber attribute id:s
AttributeBuffer::DataBufferPool & pool = c_theAttributeBufferPool;
LocalDataBuffer<11> beforeValues(pool, firedTriggerData->beforeValues);
bool skipNull = false;
for(bool moreKeyAttrs = beforeValues.first(iter);
(moreKeyAttrs);
attrId++) {
jam();
AttributeHeader* attrHeader = (AttributeHeader *) iter.data;
// Filter out NULL valued attributes
if (attrHeader->isNULL()) {
skipNull = true;
break;
}
attrHeader->setAttributeId(attrId);
keyLength += attrHeader->getDataSize();
hops = attrHeader->getHeaderSize() + attrHeader->getDataSize();
moreKeyAttrs = beforeValues.next(iter, hops);
}
// Filter out single NULL attributes
if (attrId == 1) {
if (skipNull) {
jam();
beforeValues.first(iter);
AttributeHeader* attrHeader = (AttributeHeader *) iter.data;
if (attrHeader->isNULL() && !beforeValues.next(iter)) {
jam();
opRecord->triggerExecutionCount--;
if (opRecord->triggerExecutionCount == 0) {
/*
opRecord->triggerExecutionCount--;
if (opRecord->triggerExecutionCount == 0) {
/*
We have completed current trigger execution
Continue triggering operation
*/
jam();
continueTriggeringOp(signal, opRecord);
}//if
return;
*/
jam();
continueTriggeringOp(signal, opRecord);
}//if
return;
}//if
TcKeyReq::setKeyLength(tcKeyRequestInfo, keyLength);

View file

@ -814,8 +814,8 @@ void Trix::executeInsertTransaction(Signal* signal,
for(Uint32 i = 0; i < headerPtr.sz; i++) {
AttributeHeader* keyAttrHead = (AttributeHeader *) headerBuffer + i;
// Filter out single NULL attributes
if (keyAttrHead->isNULL() && (i == (Uint32)0) && (headerPtr.sz == (Uint32)2))
// Filter out NULL attributes
if (keyAttrHead->isNULL())
return;
if (i < subRec->noOfIndexColumns)

View file

@ -1851,13 +1851,6 @@ NdbDictInterface::createIndex(Ndb & ndb,
m_error.code = 4245;
return -1;
}
if (it == DictTabInfo::UniqueHashIndex &&
(col->m_nullable) && (attributeList.sz > 1)) {
// We only support one NULL attribute
m_error.code = 4246;
return -1;
}
attributeList.id[i] = col->m_attrId;
}
if (it == DictTabInfo::UniqueHashIndex) {

View file

@ -404,7 +404,6 @@ ErrorBundle ErrorCodes[] = {
{ 4243, AE, "Index not found" },
{ 4244, AE, "Index or table with given name already exists" },
{ 4245, AE, "Index attribute must be defined as stored, i.e. the StorageAttributeType must be defined as NormalStorageAttribute"},
{ 4246, AE, "Combined index attributes are not allowed to be NULL attributes" },
{ 4247, AE, "Illegal index/trigger create/drop/alter request" },
{ 4248, AE, "Trigger/index name invalid" },
{ 4249, AE, "Invalid table" },