From 4fef9cc7f7c02ec9d9382f7ee65d9bff2b4dc29f Mon Sep 17 00:00:00 2001 From: prabatuty Date: Sun, 5 Jun 2011 02:43:59 +0000 Subject: [PATCH] autoinc and tree index predicate fix --- src/storage/PredicateImpl.cxx | 8 +++++--- src/storage/TableImpl.cxx | 11 ++++++++--- src/storage/TupleIterator.cxx | 4 +--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/storage/PredicateImpl.cxx b/src/storage/PredicateImpl.cxx index 0aafc2e3..87e7e7fc 100644 --- a/src/storage/PredicateImpl.cxx +++ b/src/storage/PredicateImpl.cxx @@ -485,6 +485,7 @@ void PredicateImpl::evaluateForTable(bool &result, char *tuple) { rhs->evaluateForTable(rhsResult, tuple); if(rhsResult == false && OpAnd == logicalOp) {//do early return + result = false; return; } } else rhsResult = true; @@ -605,9 +606,9 @@ void PredicateImpl::evaluateForTable(bool &result, char *tuple) //printf(" val1 %d val2 %d\n", *(int*)val1, *(int*)val2); if (type != typeVarchar) result = AllDataType::compareVal(val1, val2, compOp, type,length); - else result = AllDataType::compareVal((void *) *(long *) val1, val2, + else + result = AllDataType::compareVal((void *) *(long *) val1, val2, compOp, type,length); - //if (!result && val3) AllDataType::copyVal(val3, return; } void* PredicateImpl::getValIfPointLookupOnInt(int &offset) @@ -1023,7 +1024,8 @@ void* PredicateImpl::opAndValPtrForIndexField(const char *fname, bool isUnique,C { op = compOp; if (isUnique && compOp != OpLessThan && - compOp != OpLessThanEquals) isPushedDown = true; + compOp != OpLessThanEquals && + compOp != OpNotEquals ) isPushedDown = true; if (operand) return operand; else return *(void**)operandPtr; } op = OpInvalidComparisionOp; diff --git a/src/storage/TableImpl.cxx b/src/storage/TableImpl.cxx index 360f15bd..cee2f5e3 100644 --- a/src/storage/TableImpl.cxx +++ b/src/storage/TableImpl.cxx @@ -1374,15 +1374,20 @@ DbRetVal TableImpl::copyValuesFromBindBuffer(void *tuplePtr, bool isInsert) { AllDataType::increment(colPtr, &tempAutoVal , def->type_); AllDataType::copyVal(ptrToAuto,colPtr, def->type_, - def->length_); + def->length_); colPtr = colPtr + def->length_; fldpos++; }else { - if(AllDataType::compareVal(def->bindVal_, &tempAutoVal, OpGreaterThan, - def->type_)) { + if(AllDataType::compareVal(def->bindVal_, &tempAutoVal, + OpGreaterThan, def->type_)) + { AllDataType::copyVal(ptrToAuto,def->bindVal_, def->type_, def->length_); } + AllDataType::copyVal(colPtr, def->bindVal_, def->type_, + def->length_); + colPtr = colPtr + def->length_; + fldpos++; } releaseTableMutex(); continue; diff --git a/src/storage/TupleIterator.cxx b/src/storage/TupleIterator.cxx index 4f84eb06..3faec215 100644 --- a/src/storage/TupleIterator.cxx +++ b/src/storage/TupleIterator.cxx @@ -30,9 +30,7 @@ DbRetVal TupleIterator::setPlan() if(iter.hasElement()) { FieldDef *def = iter.nextElement(); -// keyPtr = (char*)predImpl->valPtrForIndexField(def->fldName_, hIdxInfo->isUnique); - // op = predImpl->opForIndexField(def->fldName_); - keyPtr = (char*)predImpl->opAndValPtrForIndexField(def->fldName_, hIdxInfo->isUnique,op); + keyPtr = (char*)predImpl->opAndValPtrForIndexField(def->fldName_, hIdxInfo->isUnique,op); } CINDEX *iptr = (CINDEX*) hIdxInfo->indexPtr; TreeNode *fstNode=(TreeNode *)iptr->hashNodeChunk_; -- 2.11.4.GIT