int DirPage::deleteRecords(Where *where, int* attrType, int numOfAttr){ if(DEcount == 0){ lg2("@DirPage_"<<pageid<<" : No Records to delete."); return 0; } DataPage* datapage; long noOfRecs = 0; long dataPid; long maxTFS; DirEntry *de; // dirEntries; for(vector<DirEntry*>::size_type i = 0; i<dirEntries.size() ; i++){ //create DataPage for every entry and try retreiving records. de = dirEntries[i]; dataPid = de->getPageID(); datapage = new DataPage(dataPid); noOfRecs += datapage->deleteRecords(where,attrType,numOfAttr); maxTFS = datapage->getTotalFreeSize(); de->setTFS(maxTFS); if(maxSpaceAvailable < maxTFS) maxSpaceAvailable = maxTFS; de->writeDE(p,i); writeToPage(); delete datapage; } return noOfRecs; }
long DirPage::updateRecords(Where *where, Modify *modify, RecordSet* rs){ if(DEcount == 0){ lg2("@DirPage_"<<pageid<<" : No Records to update."); return 0; } DataPage* datapage; long noOfRecs = 0; long dataPid; long maxTFS; DirEntry *de; // dirEntries; for(vector<DirEntry*>::size_type i = modify->getStartDirEntry(); i<dirEntries.size() ; i++){ //create DataPage for every entry and try retreiving records. de = dirEntries[i]; dataPid = de->getPageID(); datapage = new DataPage(dataPid); noOfRecs += datapage->updateRecords(where,modify,rs); maxTFS = datapage->getTotalFreeSize(); de->setTFS(maxTFS); if(maxSpaceAvailable < maxTFS) maxSpaceAvailable = maxTFS; de->writeDE(p,i); if(modify->isThereMore()){ writeToPage(); modify->setStartDirEntry(i); delete datapage; return noOfRecs; } delete datapage; } writeToPage(); return noOfRecs; }