1959716 DMLThreadTest fails to read records sometimes
[csql.git] / src / server / TableImpl.cxx
blob6d0b629a61cb927fecae4d68cde3b1c08e3a45bf
1 /***************************************************************************
2 * Copyright (C) 2007 by www.databasecache.com *
3 * Contact: praba_tuty@databasecache.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 ***************************************************************************/
16 #include<Index.h>
17 #include<CatalogTables.h>
18 #include<Lock.h>
19 #include<Debug.h>
20 #include<Table.h>
21 #include<TableImpl.h>
22 #include<Predicate.h>
23 #include<PredicateImpl.h>
24 #include<Index.h>
25 #include<Config.h>
27 DbRetVal TableImpl::bindFld(const char *name, void *val)
29 //set it in the field list
30 DbRetVal rv = fldList_.updateBindVal(name, val);
31 if (OK != rv) {
32 printError(ErrNotExists, "Field %s does not exist", name);
33 return rv;
35 return OK;
38 bool TableImpl::isFldNull(const char *name){
39 int colpos = fldList_.getFieldPosition(name);
40 if (-1 == colpos)
42 printError(ErrNotExists, "Field %s does not exist", name);
43 return false;
46 return isFldNull(colpos);
49 bool TableImpl::isFldNull(int colpos)
51 if (!curTuple_) return false;
52 if (colpos <1 || colpos > numFlds_) return false;
53 char *nullOffset = (char*)curTuple_ - 4;
54 if (isIntUsedForNULL) {
55 int nullVal = *(int*)((char*)curTuple_ + (length_ - 4));
56 if (BITSET(nullVal, colpos)) return true;
58 else {
59 char *nullOffset = (char*)curTuple_ - os::align(numFlds_);
60 if (nullOffset[colpos-1]) return true;
62 return false;
64 void TableImpl::markFldNull(char const* name)
66 int colpos = fldList_.getFieldPosition(name);
67 if (-1 == colpos)
69 printError(ErrNotExists, "Field %s does not exist", name);
70 return;
72 markFldNull(colpos);
75 void TableImpl::markFldNull(int fldpos)
77 if (fldpos <1 || fldpos > numFlds_) return;
78 if (isIntUsedForNULL) {
79 if (!BITSET(iNotNullInfo, fldpos)) SETBIT(iNullInfo, fldpos);
81 else
82 if (!BITSET(iNotNullInfo, fldpos)) cNullInfo[fldpos-1] = 1;
83 return;
86 void TableImpl::clearFldNull(const char *name)
88 int colpos = fldList_.getFieldPosition(name);
89 if (-1 == colpos)
91 printError(ErrNotExists, "Field %s does not exist", name);
92 return;
95 clearFldNull(colpos);
98 void TableImpl::clearFldNull(int colpos)
100 if (colpos <1 || colpos > numFlds_) return;
101 if (isIntUsedForNULL) {
102 CLEARBIT(iNullInfo, colpos);
104 else
105 cNullInfo[colpos-1] = 0;
106 return;
110 DbRetVal TableImpl::execute()
112 if (NULL != iter)
114 printError(ErrAlready,"Scan already open:Close and re execute");
115 return ErrAlready;
117 //table ptr is set in predicate because it needs to access the
118 //type and length to evaluate
119 if( NULL != pred_)
121 PredicateImpl *pred = (PredicateImpl*) pred_;
122 pred->setTable(this);
124 DbRetVal ret = OK;
126 ret = createPlan();
127 if (OK != ret)
129 printError(ErrSysInternal,"Unable to create the plan");
130 return ErrSysInternal;
132 if (useIndex_ >= 0)
133 iter = new TupleIterator(pred_, scanType_, idxInfo[useIndex_], chunkPtr_, sysDB_->procSlot);
134 else if (scanType_ == fullTableScan)
135 iter = new TupleIterator(pred_, scanType_, NULL, chunkPtr_, sysDB_->procSlot);
136 else
138 printError(ErrSysFatal,"Unable to create tuple iterator");//should never happen
139 return ErrSysFatal;
141 ret = iter->open();
142 if (OK != ret)
144 printError(ErrSysInternal,"Unable to open the iterator");
145 return ErrSysInternal;
147 return OK;
151 DbRetVal TableImpl::createPlan()
153 if (isPlanCreated) {
154 //will do early return here. plan is generated only when setPredicate is called.
155 if (scanType_ == unknownScan) return ErrSysFatal; //this should never happen
156 else return OK;
158 useIndex_ = -1;
159 //if there are no predicates then go for full scan
160 //if there are no indexes then go for full scan
161 if (NULL == pred_ || NULL == indexPtr_)
163 scanType_ = fullTableScan;
164 isPlanCreated = true;
165 return OK;
167 if (NULL != indexPtr_)
169 PredicateImpl *pred = (PredicateImpl*)pred_;
170 printDebug(DM_Predicate, "predicate does not involve NOT , OR operator");
171 if (!pred->isNotOrInvolved())
173 printDebug(DM_Predicate, "predicate does not involve NOT , OR operator");
174 for (int i =0; i < numIndexes_; i++)
176 char *fName = ((SingleFieldHashIndexInfo*)idxInfo[i])->fldName;
177 if (pred->pointLookupInvolved(fName))
179 printDebug(DM_Predicate, "point lookup involved for field %s",fName);
180 scanType_ = hashIndexScan;
181 useIndex_ = i;
182 isPlanCreated = true;
183 return OK;
188 scanType_ = fullTableScan;
189 isPlanCreated = true;
190 return OK;
193 void* TableImpl::fetch()
195 fetchNoBind();
196 if (NULL == curTuple_) return curTuple_;
197 copyValuesToBindBuffer(curTuple_);
198 return curTuple_;
200 void* TableImpl::fetch(DbRetVal &rv)
202 fetchNoBind(rv);
203 if (NULL == curTuple_) return curTuple_;
204 copyValuesToBindBuffer(curTuple_);
205 return curTuple_;
208 void* TableImpl::fetchNoBind()
210 if (NULL == iter)
212 printError(ErrNotOpen,"Scan not open or Scan is closed\n");
213 return NULL;
215 curTuple_ = iter->next();
216 if (NULL == curTuple_)
218 return NULL;
220 DbRetVal lockRet = OK;
221 if ((*trans)->isoLevel_ == READ_REPEATABLE) {
222 lockRet = lMgr_->getSharedLock(curTuple_, trans);
223 if (OK != lockRet)
225 printError(lockRet, "Unable to get the lock for the tuple %x", curTuple_);
226 curTuple_ = NULL;
227 return NULL;
231 else if ((*trans)->isoLevel_ == READ_COMMITTED)
233 //if iso level is read committed, operation duration lock is sufficent
234 //so release it here itself.
235 int tries = 5;
236 struct timeval timeout;
237 timeout.tv_sec = Conf::config.getMutexSecs();
238 timeout.tv_usec = Conf::config.getMutexUSecs();
240 bool status = false;
241 while(true) {
242 lockRet = lMgr_->isExclusiveLocked( curTuple_, trans, status);
243 if (OK != lockRet)
245 printError(lockRet, "Unable to get the lock for the tuple %x", curTuple_);
246 curTuple_ = NULL;
247 return NULL;
249 if (!status) break;
250 tries--;
251 if (tries == 0) break;
252 os::select(0, 0, 0, 0, &timeout);
255 if (tries == 0)
257 printError(lockRet, "Unable to get the lock for the tuple %x", curTuple_);
258 curTuple_ = NULL;
259 return NULL;
262 return curTuple_;
265 void* TableImpl::fetchNoBind(DbRetVal &rv)
267 rv = OK;
268 if (NULL == iter)
270 printError(ErrNotOpen,"Scan not open or Scan is closed\n");
271 rv = ErrNotOpen;
272 return NULL;
274 curTuple_ = iter->next();
275 if (NULL == curTuple_)
277 return NULL;
279 DbRetVal lockRet = OK;
280 if ((*trans)->isoLevel_ == READ_REPEATABLE) {
281 lockRet = lMgr_->getSharedLock(curTuple_, trans);
282 if (OK != lockRet)
284 printError(lockRet, "Unable to get the lock for the tuple %x", curTuple_);
285 curTuple_ = NULL;
286 rv = ErrLockTimeOut;
287 return NULL;
291 else if ((*trans)->isoLevel_ == READ_COMMITTED)
293 //if iso level is read committed, operation duration lock is sufficent
294 //so release it here itself.
295 int tries = 5;
296 struct timeval timeout;
297 timeout.tv_sec = Conf::config.getMutexSecs();
298 timeout.tv_usec = Conf::config.getMutexUSecs();
300 bool status = false;
301 while(true) {
302 lockRet = lMgr_->isExclusiveLocked( curTuple_, trans, status);
303 if (OK != lockRet)
305 printError(lockRet, "Unable to get the lock for the tuple %x", curTuple_);
306 curTuple_ = NULL;
307 rv = ErrLockTimeOut;
308 return NULL;
310 if (!status) break;
311 tries--;
312 if (tries == 0) break;
313 os::select(0, 0, 0, 0, &timeout);
316 if (tries == 0)
318 printError(lockRet, "Unable to get the lock for the tuple %x", curTuple_);
319 curTuple_ = NULL;
320 rv = ErrLockTimeOut;
321 return NULL;
324 return curTuple_;
327 DbRetVal TableImpl::insertTuple()
329 DbRetVal ret =OK;
330 void *tptr = ((Chunk*)chunkPtr_)->allocate(db_, &ret);
331 if (NULL == tptr)
333 printError(ret, "Unable to allocate record from chunk");
334 return ret;
337 ret = lMgr_->getExclusiveLock(tptr, trans);
338 if (OK != ret)
340 ((Chunk*)chunkPtr_)->free(db_, tptr);
341 printError(ret, "Could not get lock for the insert tuple %x", tptr);
342 return ErrLockTimeOut;
346 ret = copyValuesFromBindBuffer(tptr);
347 if (ret != OK)
349 printError(ret, "Unable to copy values from bind buffer");
350 (*trans)->removeFromHasList(db_, tptr);
351 lMgr_->releaseLock(tptr);
352 ((Chunk*)chunkPtr_)->free(db_, tptr);
353 return ret;
356 int addSize = 0;
357 if (numFlds_ < 31)
359 addSize = 4;
360 *(int*)((char*)(tptr) + (length_-addSize)) = iNullInfo;
362 else
364 addSize = os::align(numFlds_);
365 os::memcpy(((char*)(tptr) + (length_-addSize)), cNullInfo, addSize);
368 //int tupleSize = length_ + addSize;
369 if (NULL != indexPtr_)
371 int i;
372 //it has index
373 for (i = 0; i < numIndexes_ ; i++)
375 ret = insertIndexNode(*trans, indexPtr_[i], idxInfo[i], tptr);
376 if (ret != OK) { printError(ret, "Error in inserting to index"); break;}
378 if (i != numIndexes_ )
380 for (int j = 0; j < i ; j++) {
381 printError(ErrWarning, "Deleting index node");
382 deleteIndexNode(*trans, indexPtr_[j], idxInfo[j], tptr);
384 lMgr_->releaseLock(tptr);
385 (*trans)->removeFromHasList(db_, tptr);
386 ((Chunk*)chunkPtr_)->free(db_, tptr);
387 printError(ret, "Unable to insert index node for tuple %x", tptr);
388 return ret;
391 if (undoFlag)
392 ret = (*trans)->appendUndoLog(sysDB_, InsertOperation, tptr, length_);
393 return ret;
396 DbRetVal TableImpl::deleteTuple()
398 if (NULL == curTuple_)
400 printError(ErrNotOpen, "Scan not open: No Current tuple");
401 return ErrNotOpen;
403 DbRetVal ret = lMgr_->getExclusiveLock(curTuple_, trans);
404 if (OK != ret)
406 printError(ret, "Could not get lock for the delete tuple %x", curTuple_);
407 return ErrLockTimeOut;
410 if (NULL != indexPtr_)
412 int i;
413 //it has index
414 for (i = 0; i < numIndexes_ ; i++)
416 ret = deleteIndexNode(*trans, indexPtr_[i], idxInfo[i], curTuple_);
417 if (ret != OK) break;
419 if (i != numIndexes_ )
421 for (int j = 0; j < i ; j++)
422 insertIndexNode(*trans, indexPtr_[j], idxInfo[j], curTuple_);
423 lMgr_->releaseLock(curTuple_);
424 (*trans)->removeFromHasList(db_, curTuple_);
425 printError(ret, "Unable to insert index node for tuple %x", curTuple_);
426 return ret;
429 ((Chunk*)chunkPtr_)->free(db_, curTuple_);
430 if (undoFlag)
431 ret = (*trans)->appendUndoLog(sysDB_, DeleteOperation, curTuple_, length_);
432 return ret;
435 int TableImpl::deleteWhere()
437 int tuplesDeleted = 0;
438 DbRetVal rv = OK;
439 rv = execute();
440 if (rv !=OK) return (int) rv;
441 while(true){
442 fetchNoBind( rv);
443 if (rv != OK) { tuplesDeleted = (int)rv; break; }
444 if (NULL == curTuple_) break;
445 rv = deleteTuple();
446 if (rv != OK) {
447 printError(rv, "Error: Could only delete %d tuples", tuplesDeleted);
448 close();
449 return (int) rv;
451 tuplesDeleted++;
453 close();
454 return tuplesDeleted;
457 int TableImpl::truncate()
459 //take exclusive lock on the table
460 //get the chunk ptr of the table
461 //traverse the tablechunks and free all the pages except the first one
462 //get the chunk ptr of all its indexes
463 //traverse the indexchunks and free all the pages except the first one
464 //release table lock
466 //TEMPORARY FIX
467 DbRetVal rv = OK;
468 Predicate* tmpPred = pred_;
469 pred_ = NULL;
470 isPlanCreated = false;
471 int tuplesDeleted = deleteWhere();
472 isPlanCreated = false;
473 pred_ = tmpPred;
474 return tuplesDeleted;
477 DbRetVal TableImpl::updateTuple()
479 if (NULL == curTuple_)
481 printError(ErrNotOpen, "Scan not open: No Current tuple");
482 return ErrNotOpen;
484 DbRetVal ret = lMgr_->getExclusiveLock(curTuple_, trans);
485 if (OK != ret)
487 printError(ret, "Could not get lock for the update tuple %x", curTuple_);
488 return ErrLockTimeOut;
490 if (NULL != indexPtr_)
492 //it has index
493 //TODO::If it fails while updating index node, we have to undo all the updates
494 //on other indexes on the table.Currently it will leave the database in an
495 //inconsistent state.
496 for (int i = 0; i < numIndexes_ ; i++)
498 ret = updateIndexNode(*trans, indexPtr_[i], idxInfo[i], curTuple_);
499 if (ret != OK)
501 lMgr_->releaseLock(curTuple_);
502 (*trans)->removeFromHasList(db_, curTuple_);
503 printError(ret, "Unable to update index node for tuple %x", curTuple_);
504 return ret;
508 if (undoFlag)
509 ret = (*trans)->appendUndoLog(sysDB_, UpdateOperation, curTuple_, length_);
510 if (ret != OK) return ret;
511 int addSize = 0;
512 if (numFlds_ < 31)
514 addSize = 4;
515 *(int*)((char*)(curTuple_) + (length_-addSize)) |= iNullInfo;
517 else
519 addSize = os::align(numFlds_);
520 //TODO::Do not do blind memcpy. It should OR each and every char
521 //os::memcpy(((char*)(curTuple_) + (length_-addSize)), cNullInfo, addSize);
525 DbRetVal rv = copyValuesFromBindBuffer(curTuple_, false);
526 if (rv != OK) {
527 lMgr_->releaseLock(curTuple_);
528 (*trans)->removeFromHasList(db_, curTuple_);
529 return rv;
531 return OK;
534 void TableImpl::printInfo()
536 printf(" <TableName> %s </TableName>\n", tblName_);
537 printf(" <TupleCount> %d </TupleCount>\n", numTuples());
538 printf(" <PagesUsed> %d </PagesUsed>\n", pagesUsed());
539 printf(" <SpaceUsed> %d </SpaceUsed>\n", spaceUsed());
540 printf(" <Indexes> %d <Indexes>\n", numIndexes_);
541 printf(" <TupleLength> %d </TupleLength>\n", length_);
542 printf(" <Fields> %d </Fields>\n", numFlds_);
543 printf(" <Indexes>\n");
544 for (int i =0; i<numIndexes_; i++)
545 printf("<IndexName> %s </IndexName>\n", CatalogTableINDEX::getName(indexPtr_[i]));
546 printf(" </Indexes>\n");
550 DbRetVal TableImpl::copyValuesFromBindBuffer(void *tuplePtr, bool isInsert)
552 //Iterate through the bind list and copy the value here
553 FieldIterator fIter = fldList_.getIterator();
554 char *colPtr = (char*) tuplePtr;
555 int fldpos=1;
556 while (fIter.hasElement())
558 FieldDef def = fIter.nextElement();
559 if (def.isNull_ && !def.isDefault_ && NULL == def.bindVal_ && isInsert)
561 printError(ErrNullViolation, "NOT NULL constraint violation for field %s\n", def.fldName_);
562 return ErrNullViolation;
564 if (def.isDefault_ && NULL == def.bindVal_ && isInsert)
566 void *dest = AllDataType::alloc(def.type_, def.length_);
567 AllDataType::convert(typeString, def.defaultValueBuf_, def.type_, dest);
568 AllDataType::copyVal(colPtr, dest, def.type_, def.length_);
569 colPtr = colPtr + os::align(AllDataType::size(def.type_, def.length_));
570 fldpos++;
571 free (dest);
572 continue;
574 switch(def.type_)
576 case typeString:
577 if (NULL != def.bindVal_)
579 strcpy((char*)colPtr, (char*)def.bindVal_);
580 *(((char*)colPtr) + (def.length_-1)) = '\0';
582 else if (!def.isNull_ && isInsert) setNullBit(fldpos);
583 colPtr = colPtr + os::align(def.length_);
584 break;
585 case typeBinary:
586 if (NULL != def.bindVal_ )
587 os::memcpy((char*)colPtr, (char*)def.bindVal_, def.length_);
588 else if (!def.isNull_ && isInsert) setNullBit(fldpos);
589 colPtr = colPtr + os::align(def.length_);
590 break;
591 default:
592 if (NULL != def.bindVal_)
593 AllDataType::copyVal(colPtr, def.bindVal_, def.type_);
594 else { if (!def.isNull_ && isInsert) setNullBit(fldpos); }
595 colPtr = colPtr + os::align(AllDataType::size(def.type_));
596 break;
598 fldpos++;
600 return OK;
602 void TableImpl::setNullBit(int fldpos)
604 if (isIntUsedForNULL)
605 SETBIT(iNullInfo, fldpos);
606 else
607 cNullInfo[fldpos-1] = 1;
609 DbRetVal TableImpl::copyValuesToBindBuffer(void *tuplePtr)
611 //Iterate through the bind list and copy the value here
612 FieldIterator fIter = fldList_.getIterator();
613 char *colPtr = (char*) tuplePtr;
614 while (fIter.hasElement())
616 FieldDef def = fIter.nextElement();
617 switch(def.type_)
619 case typeString:
620 if (NULL != def.bindVal_)
621 strcpy((char*)def.bindVal_, (char*)colPtr);
622 colPtr = colPtr + os::align(def.length_);
623 break;
624 case typeBinary:
625 if (NULL != def.bindVal_)
626 os::memcpy((char*)def.bindVal_, (char*)colPtr, def.length_);
627 colPtr = colPtr + os::align(def.length_);
628 break;
629 default:
630 if (NULL != def.bindVal_)
631 AllDataType::copyVal(def.bindVal_, colPtr, def.type_);
632 colPtr = colPtr + os::align(AllDataType::size(def.type_));
633 break;
636 return OK;
639 //-1 index not supported
640 DbRetVal TableImpl::insertIndexNode(Transaction *tr, void *indexPtr, IndexInfo *info, void *tuple)
642 INDEX *iptr = (INDEX*)indexPtr;
643 DbRetVal ret = OK;
644 printDebug(DM_Table, "Inside insertIndexNode type %d", iptr->indexType_);
645 Index* idx = Index::getIndex(iptr->indexType_);
646 ret = idx->insert(this, tr, indexPtr, info, tuple,undoFlag);
647 return ret;
650 DbRetVal TableImpl::deleteIndexNode(Transaction *tr, void *indexPtr, IndexInfo *info, void *tuple)
652 INDEX *iptr = (INDEX*)indexPtr;
653 DbRetVal ret = OK;
654 Index* idx = Index::getIndex(iptr->indexType_);
655 ret = idx->remove(this, tr, indexPtr, info, tuple, undoFlag);
656 return ret;
658 void TableImpl::printSQLIndexString()
660 CatalogTableINDEXFIELD cIndexField(sysDB_);
661 char fName[IDENTIFIER_LENGTH];
662 char *fldName = fName;
663 DataType type;
664 for (int i = 0; i < numIndexes_ ; i++)
666 INDEX *iptr = (INDEX*) indexPtr_[i];
667 cIndexField.getFieldNameAndType((void*)iptr, fldName, type);
668 printf("CREATE INDEX %s on %s ( %s ) ", iptr->indName_, getName(), fldName);
669 if (((SingleFieldHashIndexInfo*) idxInfo[i])->isUnique) printf(" UNIQUE;\n"); else printf(";\n");
674 DbRetVal TableImpl::updateIndexNode(Transaction *tr, void *indexPtr, IndexInfo *info, void *tuple)
676 INDEX *iptr = (INDEX*)indexPtr;
677 DbRetVal ret = OK;
678 Index* idx = Index::getIndex(iptr->indexType_);
679 //TODO::currently it updates irrespective of whether the key changed or not
680 //because of this commenting the whole index update code. relook at it and uncomment
682 //ret = idx->update(this, tr, indexPtr, info, tuple, undoFlag);
684 return ret;
688 void TableImpl::setTableInfo(char *name, int tblid, size_t length,
689 int numFld, int numIdx, void *chunk)
691 strcpy(tblName_, name);
692 tblID_ = tblid;
693 length_ = length;
694 numFlds_ = numFld;
695 numIndexes_ = numIdx;
696 chunkPtr_ = chunk;
699 long TableImpl::spaceUsed()
701 Chunk *chk = (Chunk*)chunkPtr_;
702 long totSize = chk->getTotalDataNodes() * chk->getSize();
703 totSize = totSize + (chk->totalPages() * sizeof (PageInfo));
704 return totSize;
707 int TableImpl::pagesUsed()
709 Chunk *chk = (Chunk*)chunkPtr_;
710 return chk->totalPages();
713 long TableImpl::numTuples()
715 return ((Chunk*)chunkPtr_)->getTotalDataNodes();
718 List TableImpl::getFieldNameList()
720 List fldNameList;
721 FieldIterator fIter = fldList_.getIterator();
722 while (fIter.hasElement())
724 FieldDef def = fIter.nextElement();
725 Identifier *elem = new Identifier();
726 strcpy(elem->name, def.fldName_);
727 fldNameList.append(elem);
729 return fldNameList;
731 DbRetVal TableImpl::close()
733 if (NULL == iter)
735 printError(ErrNotOpen,"Scan not open");
736 return ErrNotOpen;
738 iter->close();
739 delete iter;
740 iter = NULL;
741 return OK;
743 DbRetVal TableImpl::lock(bool shared)
746 DbRetVal ret = OK;
748 if (shared)
749 ret = lMgr_->getSharedLock(chunkPtr_, NULL);
750 else
751 ret = lMgr_->getExclusiveLock(chunkPtr_, NULL);
752 if (OK != ret)
754 printError(ret, "Could not exclusive lock on the table %x", chunkPtr_);
755 }else {
756 //do not append for S to X upgrade
757 if (!ProcessManager::hasLockList.exists(chunkPtr_))
758 ProcessManager::hasLockList.append(chunkPtr_);
761 return ret;
763 DbRetVal TableImpl::unlock()
766 if (!ProcessManager::hasLockList.exists(chunkPtr_)) return OK;
767 DbRetVal ret = lMgr_->releaseLock(chunkPtr_);
768 if (OK != ret)
770 printError(ret, "Could not release exclusive lock on the table %x", chunkPtr_);
771 }else
773 ProcessManager::hasLockList.remove(chunkPtr_);
776 return OK;
779 TableImpl::~TableImpl()
781 if (NULL != iter ) { delete iter; iter = NULL; }
782 if (NULL != indexPtr_) { delete[] indexPtr_; indexPtr_ = NULL; }
783 if (NULL != idxInfo)
785 for (int i = 0; i < numIndexes_; i++) delete idxInfo[i];
786 delete[] idxInfo;
787 idxInfo = NULL;
789 if (numFlds_ > 31 && cNullInfo != NULL) { free(cNullInfo); cNullInfo = NULL; }
791 fldList_.removeAll();