本文整理汇总了C++中Frame::GetPinCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Frame::GetPinCount方法的具体用法?C++ Frame::GetPinCount怎么用?C++ Frame::GetPinCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Frame
的用法示例。
在下文中一共展示了Frame::GetPinCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FreePage
//--------------------------------------------------------------------
// BufMgr::FreePage
//
// Input : pid - page id of a particular page
// Output : None
// Purpose : Free the memory allocated for the page with
// page id = pid
// Condition: Either the page is already in the buffer and is pinned
// no more than once, or the page is not in the buffer.
// PostCond : The page is unpinned, and the frame where it resides in
// the buffer pool is freed. Also the page is deallocated
// from the database.
// Return : OK if operation is successful. FAIL otherwise.
// Note : You can call MINIBASE_DB->DeallocatePage(pid) to
// deallocate a page.
//--------------------------------------------------------------------
Status BufMgr::FreePage(PageID pid)
{
//std::cout << "Free PageID " << pid << std::endl;
////std::cout << "Free page: " << pid << std::endl;
Frame* targetFrame;
int frameIndex = FindFrame(pid);
if (frameIndex != INVALID_FRAME) {
targetFrame = &frames[frameIndex];
if (targetFrame->GetPinCount() > 1) return FAIL;
UnpinPage(pid, true);
FlushPage(pid);
}
return MINIBASE_DB->DeallocatePage(pid);
}