From d30d8e2f72c68b1d86b61a15369f495a803971fa Mon Sep 17 00:00:00 2001 From: kishoramballi Date: Sat, 31 Jan 2009 10:33:05 +0000 Subject: [PATCH] TableImpl class is added with 3 more fields bindList_, bindListArray_, numbindFlds_. CreatePlan now has the binded field list populated from FldList_; changed copyValuesToBindBuffer to copy only the binded field values. --- include/TableImpl.h | 3 +++ src/storage/TableImpl.cxx | 25 ++++++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/include/TableImpl.h b/include/TableImpl.h index f89eff3e..f0bc0c52 100644 --- a/include/TableImpl.h +++ b/include/TableImpl.h @@ -107,6 +107,9 @@ class TableImpl:public Table public: FieldList fldList_; + List bindList_; + void **bindListArray_; + int numBindFlds_; int numIndexes_; char** indexPtr_; // array of index ptrs to the catalog table for the indexes of this table. IndexInfo **idxInfo; diff --git a/src/storage/TableImpl.cxx b/src/storage/TableImpl.cxx index 486ae437..0d22ced3 100644 --- a/src/storage/TableImpl.cxx +++ b/src/storage/TableImpl.cxx @@ -252,6 +252,19 @@ DbRetVal TableImpl::createPlan() isBetween=false; isPointLook = false; useIndex_ = -1; + + FieldIterator fIter = fldList_.getIterator(); + FieldDef *def = NULL; + while ((def = fIter.nextElement())!= NULL) { + if (NULL != def->bindVal_) bindList_.append(def); + } + numBindFlds_ = bindList_.size(); + bindListArray_ = (void **) malloc(numBindFlds_ * sizeof (void *)); + void *elem = NULL; + int i = 0; + ListIterator it = bindList_.getIterator(); + while ((elem = it.nextElement()) != NULL) bindListArray_[i++] = elem; + //if there are no predicates then go for full scan //if there are no indexes then go for full scan if (NULL == pred_ || NULL == indexPtr_) @@ -849,14 +862,12 @@ void TableImpl::setNullBit(int fldpos) DbRetVal TableImpl::copyValuesToBindBuffer(void *tuplePtr) { //Iterate through the bind list and copy the value here - FieldIterator fIter = fldList_.getIterator(); char *colPtr = (char*) tuplePtr; - while (fIter.hasElement()) - { - FieldDef *def = fIter.nextElement(); - if (NULL != def->bindVal_) - AllDataType::copyVal(def->bindVal_, colPtr, def->type_, def->length_); - colPtr = colPtr + def->length_; + FieldDef *def = NULL; + for (int i = 0; i < numBindFlds_; i++) { + def = (FieldDef *) bindListArray_[i]; + colPtr = (char *) tuplePtr + def->offset_; + AllDataType::copyVal(def->bindVal_, colPtr, def->type_, def->length_); } return OK; } -- 2.11.4.GIT