亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ctrl_center.cpp

?? 實現一個精簡型單用戶SQL引擎(DBMS)MiniSQL
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
        min = tree.MoveToNextKey(min);
      IncludeMin = 1; IncludeMax =1;  // include the max&min key when updating
      UpdateRec(tree,RecInfo,IncludeMin,min,IncludeMax,max);              
      break;
    }
    case BE :  // '>='
    {
      max = tree.GetEnd();
      ZBTree_Node node;
      node.ReadNodeFromFile(max.ptr);
      // compare with the biggest key
      if( node.Compare(node.k[node.ItemOnNode-1],ConditionInfo.min) < 0)
      throw 1027;  // Error 1027: No Reocrd
      tree.Search(ConditionInfo.min,&min);
      if( min.offset == node.MaxItem )  // can't find and reach the end of a node
        min = tree.MoveToNextKey(min);
      IncludeMin = 1; IncludeMax =1;    // include the max&min key when updating
      UpdateRec(tree,RecInfo,IncludeMin,min,IncludeMax,max);              
      break;
    }
    case L  :  // '<'
    {
      min = tree.GetStart();
      ZBTree_Node node;
      node.ReadNodeFromFile(min.ptr);
      // compare with the smallest key
      if( node.Compare(node.k[0],ConditionInfo.max) >= 0)
        throw 1027;  // Error 1027: No Reocrd
      tree.Search(ConditionInfo.max,&max);
         
     /* Key_Location end;
      end = tree.GetEnd();*/
      ZBTree_Node EndNode;
      EndNode.ReadNodeFromFile(max.ptr);
      // exceed the biggest key in tree
      if( max.offset == EndNode.MaxItem ) 
      {
        IncludeMax = 1;
        max.offset = EndNode.ItemOnNode - 1;
      }
      else 
        IncludeMax = 0;

      IncludeMin = 1;  // include the min key when updating
      UpdateRec(tree,RecInfo,IncludeMin,min,IncludeMax,max);      
      break;
    }
    case LE :  // '<='
    {
      min = tree.GetStart();
      ZBTree_Node node;
      node.ReadNodeFromFile(min.ptr);
      // max < k[0]
      if( node.Compare(node.k[0],ConditionInfo.max) > 0)
        throw 1027;// no record

      if( tree.Search(ConditionInfo.max,&max) )  // the max key is existed
        IncludeMax = 1;
      else 
      {
        ZBTree_Node EndNode;
        EndNode.ReadNodeFromFile(max.ptr);
        // exceed the biggest key in tree
        if( max.offset == EndNode.MaxItem ) 
        {
          IncludeMax = 1;
          max.offset = EndNode.ItemOnNode - 1;
        }
       
        else 
          IncludeMax = 0;
      }
      IncludeMin = 1;  // include the min key when updating
      UpdateRec(tree,RecInfo,IncludeMin,min,IncludeMax,max); 
      break;
    }
    case E  :  // '='
    {
      if( !tree.Search(ConditionInfo.min,&min) )
        throw 1026;  // Error 1026: the Key name isn't existed    
      max = min;
      IncludeMin = 1;  IncludeMax = 1;
      UpdateRec(tree,RecInfo,IncludeMin,min,IncludeMax,max);
      break;
    }
    case NE :  // '!='
    {
      Key_Location temp;
      if( !tree.Search(ConditionInfo.min,&temp) ) // the key isn't existed
      {
        min = tree.GetStart();
        max = tree.GetEnd();
        IncludeMin = 1;
        IncludeMax = 1;
        // update all record;
        UpdateRec(tree,RecInfo,IncludeMin,min,IncludeMax,max);
        break;
      }
      else  // the key is existed
      {
        min = tree.GetStart();
        max = tree.GetEnd();
        IncludeMin = 1;
        IncludeMax = 1;
                       
        // the key is in the middle of the tree
        IncludeMin = 1;
        IncludeMax = 0;
        UpdateRec(tree,RecInfo,IncludeMin,min,IncludeMax,temp);
        IncludeMin = 0;
        IncludeMax = 1;
        UpdateRec(tree,RecInfo,IncludeMin,temp,IncludeMax,max);
        break;
      }
    }
    case BETWEEN:  // between ... and ...
    {                                        //  **************************************    
      Key_Location temp;                     //  6 conditions
      temp = tree.GetStart();                //    * * | |
      ZBTree_Node StartNode;                 //    | | * *    | -- the boundary of tree
      StartNode.ReadNodeFromFile(temp.ptr);  //    * | | *    * -- the value in SQL
                                             //    * | * |
      temp = tree.GetEnd();                  //    | * | * 
      ZBTree_Node EndNode;                   //    | * * |
      EndNode.ReadNodeFromFile(temp.ptr);    //  **************************************

      // compare with the start key  * * | |
      if( StartNode.Compare(StartNode.k[0],ConditionInfo.max) > 0)
        throw 1027;  // Error 1027: No Reocrd            
              
      // compare with the end key    | | * *
      if( EndNode.Compare(EndNode.k[EndNode.ItemOnNode - 1],ConditionInfo.min) < 0)
        throw 1027;  // Error 1027: No Reocrd

      // * | | *
      if( StartNode.Compare(StartNode.k[0],ConditionInfo.min) >= 0 &&
          EndNode.Compare(EndNode.k[EndNode.ItemOnNode - 1],ConditionInfo.max) <= 0)
      {
        // print all record
        min = tree.GetStart();
        max = tree.GetEnd();
        IncludeMin = 1;
        IncludeMax = 1;
        UpdateRec(tree,RecInfo,IncludeMin,min,IncludeMax,max);
        break;
      }
      // * | * |  similiar as LE
      if( StartNode.Compare(StartNode.k[0],ConditionInfo.min) >= 0 &&
          EndNode.Compare(EndNode.k[EndNode.ItemOnNode - 1],ConditionInfo.max) > 0)
      {
        min = tree.GetStart();
        ZBTree_Node node;
        node.ReadNodeFromFile(min.ptr);
        if( tree.Search(ConditionInfo.max,&max) )  // the max key is existed
          IncludeMax = 1;
        else
        {
          Key_Location end;
          end = tree.GetEnd();
          // exceed the biggest key in tree
          if( max.offset == node.MaxItem && max.ptr == end.ptr )  
          {
            IncludeMax = 1;
            max.offset = node.ItemOnNode - 1;
          }
          else if( max.offset == node.MaxItem )  // exceed the biggest key in node
          {
            max = tree.MoveToNextKey(max);       // move to the next key
            IncludeMax = 0;
          }
          else 
            IncludeMax = 0;
        }
        IncludeMin = 1;  // include the max key when updating
        UpdateRec(tree,RecInfo,IncludeMin,min,IncludeMax,max); 
        break;
      }
      // | * | *  similiar as BE
      if( StartNode.Compare(StartNode.k[0],ConditionInfo.min) < 0 &&
          EndNode.Compare(EndNode.k[EndNode.ItemOnNode - 1],ConditionInfo.max) <= 0)
      {
        max = tree.GetEnd();
        ZBTree_Node node;
        node.ReadNodeFromFile(max.ptr);
        tree.Search(ConditionInfo.min,&min);
        if( min.offset == node.MaxItem )  // can't find and reach the end of a node
          min = tree.MoveToNextKey(min);  // move to the next Key
        IncludeMin = 1; IncludeMax =1;    // include the max&min key when updating
        UpdateRec(tree,RecInfo,IncludeMin,min,IncludeMax,max); 
          break;
       }

      // | * * | 
      if( StartNode.Compare(StartNode.k[0],ConditionInfo.min) < 0 &&
          EndNode.Compare(EndNode.k[EndNode.ItemOnNode - 1],ConditionInfo.max) > 0)
      {
        Key_Location temp;
        temp = tree.GetEnd();
        ZBTree_Node node;
        node.ReadNodeFromFile(temp.ptr);
        tree.Search(ConditionInfo.min,&min);
        if( min.offset == node.MaxItem )  // can't find and reach the end of a node
          min = tree.MoveToNextKey(min);  // move to the next key
        IncludeMin = 1;   // include the min key when printing

        if( tree.Search(ConditionInfo.max,&max) )  // the max key is existed
          IncludeMax = 1;
        else 
        {
          if( max.offset == node.MaxItem )  // exceed the biggest key in node
          {
            max = tree.MoveToNextKey(max);
            IncludeMax = 0;
          }
          else 
            IncludeMax = 0;
        }
        // update the record
        UpdateRec(tree,RecInfo,IncludeMin,min,IncludeMax,max); 
        break;     
      }
    }
  }     

}
void Delete(TB_Delete_Info & DeleteInfo)
{
  Condition_Info ConditionInfo;
  Key_Location KeyLoca;
  Rec_Info RecInfo;
  HCatalog catalog;
  Record   rec;
  ZBTree tree;
  // check the validity of DeleteInfo
  catalog.Delete(DeleteInfo,ConditionInfo);
  if( !tree.Search(ConditionInfo.min,&KeyLoca) )
    throw 1026;  // Error 1026: the Key name isn't existed
  _F_FileAddr ptr;
  tree.Delete(ConditionInfo.min,ptr);  // Delete the key and return the record address
  rec.Delete(ptr);  // Delete the Record
}

// IncludeMin == 0 --------  exclude min
// IncludeMin == 1 --------  include min
// IncludeMax == 0 --------  exclude max
// IncludeMax == 1 --------  include max
void Print(ZBTree & tree,Select_Rec_Info & SelectRecInfo,
           bool IncludeMin,Key_Location min,bool IncludeMax,Key_Location max)
{
  Record rec;
  Key_Location temp;
  // ****************
  if( (min == max) && ((0==IncludeMin) || (0==IncludeMax)) )
    return;
  
  if( IncludeMin == 0 ) // doesn't include min
    min = tree.MoveToNextKey(min);
  // print the the record
  if(IncludeMax == 0 )  // doesn't include max
  {
    temp = min;
    _F_FileAddr ptr;
    if(temp == max )
      throw 1027;  // no record
    while( temp != max )
    {
      ptr = tree.GetCurRecAddr(temp);
      rec.Print(ptr,SelectRecInfo);     // print the record
      temp = tree.MoveToNextKey(temp);  // move to next
    }
  }
  else  // include max
  {
    temp = min;
    _F_FileAddr ptr;
    do
    {
      ptr = tree.GetCurRecAddr(temp);
      rec.Print(ptr,SelectRecInfo);     // print the record
      if(temp == max)
        break;
      temp = tree.MoveToNextKey(temp);  // move to next
    }while(1);
  }
}

void Ctrl_DropTB()
{
  char address[256];
  strcpy(address,CurLocation);
  strcat(address,CurRelationName);
  strcat(address,".dbf");
  _M_File table1 = Buffer[address];
  table1.Close();  // close the file whose path is 'address'

  strcpy(address,CurLocation);
  strcat(address,CurRelationName);
  DelTB(address);  // delete the file
}

void Ctrl_DropDB()
{
  Buffer.End();   // close the buffer,write all page from memory to file
  char address[256];
  strcpy(address,CurLocation);
  DelDB(address); // delete datebase 
  Buffer.Start(); // initialize a new buffer
}


// IncludeMin == 0 --------  exclude min
// IncludeMin == 1 --------  include min
// IncludeMax == 0 --------  exclude max
// IncludeMax == 1 --------  include max
void UpdateRec(ZBTree & tree,Rec_Info & RecInfo,
           bool IncludeMin,Key_Location min,bool IncludeMax,Key_Location max)
{
  Record rec;
  Key_Location temp;
  // ****************
  if( (min == max) && ((0==IncludeMin) || (0==IncludeMax)) )
    return;
  
  if( IncludeMin == 0 ) // doesn't include min
    min = tree.MoveToNextKey(min);
  // print the the record
  if(IncludeMax == 0 )  // doesn't include max
  {
    temp = min;
    _F_FileAddr ptr;
    if(temp == max )
      throw 1027;  // no record
    while( temp != max )
    {
      ptr = tree.GetCurRecAddr(temp);
      rec.Update(ptr,RecInfo);          // update the record
      temp = tree.MoveToNextKey(temp);  // move to next
    }
  }
  else  // include max
  {
    temp = min;
    _F_FileAddr ptr;
    do
    {
      ptr = tree.GetCurRecAddr(temp);
      rec.Update(ptr,RecInfo);          // update the record
      if(temp == max)
        break;
      temp = tree.MoveToNextKey(temp);  // move to next
    }while(1);
  }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲午夜久久久久久久久电影网| 国产在线国偷精品产拍免费yy| 成人免费高清在线| 欧美日韩精品一区视频| 亚洲男人的天堂一区二区| 大胆亚洲人体视频| 日本一区二区三区dvd视频在线 | 欧美日韩在线直播| 国产精品乱人伦| 丁香一区二区三区| 中文字幕国产一区| 99在线热播精品免费| 亚洲另类春色国产| 91在线国内视频| 一区二区三区高清| 国产精品无人区| 欧美日韩日本视频| 美女一区二区视频| 国产蜜臀97一区二区三区| 91麻豆福利精品推荐| 亚瑟在线精品视频| 精品日韩成人av| 不卡一区中文字幕| 青青青伊人色综合久久| 欧美一区二区视频在线观看| 精品在线一区二区| 五月天激情综合| 一区在线观看视频| 久久精品人人爽人人爽| 欧美日本韩国一区| 色婷婷av一区二区三区之一色屋| 日韩二区在线观看| 亚洲在线观看免费| 国产日韩精品一区二区三区在线| 欧美日韩一卡二卡三卡| 懂色av一区二区在线播放| 久久老女人爱爱| 久久er精品视频| 在线观看欧美日本| 日本不卡一二三区黄网| 久久综合九色综合欧美98| 日本网站在线观看一区二区三区| 精品久久久久香蕉网| 成人网在线免费视频| 爽好多水快深点欧美视频| 色94色欧美sute亚洲13| 国产成人在线看| 国产亚洲美州欧州综合国| 91看片淫黄大片一级在线观看| 亚洲午夜电影网| 亚洲国产精品99久久久久久久久| 国产亚洲综合色| 91精品国产91久久久久久一区二区| 日韩电影在线看| 亚洲精品videosex极品| 欧美喷潮久久久xxxxx| 91片黄在线观看| 午夜精品在线看| 色综合久久综合| 久久超碰97人人做人人爱| 91国产精品成人| 成人精品免费看| 亚洲国产精品一区二区www| 中文字幕不卡一区| 国产午夜精品久久久久久久 | 国产jizzjizz一区二区| 日韩精品每日更新| 亚洲天堂免费看| 欧美日韩一区在线观看| 99国产精品久久久| 国产伦精品一区二区三区免费迷| 亚洲综合色网站| 成人欧美一区二区三区小说| 26uuu国产电影一区二区| 91精品久久久久久久99蜜桃| 欧美体内she精视频| 国产盗摄一区二区三区| 色综合久久综合| 欧美成va人片在线观看| 欧美日韩一区三区四区| 精品一区二区三区在线观看国产| 黄色小说综合网站| 国产精品每日更新在线播放网址| 久久 天天综合| a美女胸又www黄视频久久| 欧美最猛性xxxxx直播| 欧美日韩国产精品自在自线| 欧美三级在线播放| 日韩女同互慰一区二区| 日韩女优电影在线观看| 国产欧美日产一区| 亚洲精品高清视频在线观看| 日韩精品一级中文字幕精品视频免费观看| 久久精品国产秦先生| 不卡电影一区二区三区| 欧美视频精品在线| 中文一区二区在线观看| 国产精品免费视频网站| 精品在线一区二区三区| 精品三级在线看| 日韩伦理电影网| 国产精品家庭影院| 亚洲一区二区三区小说| 韩日精品视频一区| 欧美大胆人体bbbb| 一区二区三区在线免费播放| 国产在线精品国自产拍免费| 欧美日韩一区二区三区不卡| 1024国产精品| 成人av在线观| 色狠狠av一区二区三区| 国产精品成人网| 视频一区在线播放| 色偷偷成人一区二区三区91| 精品卡一卡二卡三卡四在线| 日韩中文欧美在线| 99精品久久99久久久久| 国产精品另类一区| 一区二区三区成人在线视频| 成人免费看的视频| 亚洲日本va午夜在线影院| 国产综合一区二区| 国产丝袜欧美中文另类| 美女尤物国产一区| 99久精品国产| 亚洲激情图片小说视频| 成人污污视频在线观看| 日本不卡中文字幕| 91色.com| 天天综合天天综合色| 欧美精品久久一区二区三区| 麻豆精品在线视频| 日韩欧美一级片| 国产乱色国产精品免费视频| 国产亚洲精品中文字幕| 色婷婷综合视频在线观看| 一区二区在线免费| www国产精品av| 91影院在线免费观看| 日本不卡一区二区| 国产高清精品久久久久| 亚洲激情欧美激情| 555夜色666亚洲国产免| 成人av在线网站| 麻豆国产91在线播放| 一区二区三区成人在线视频| 国产日韩三级在线| 欧美视频在线播放| 欧美日本一道本在线视频| 青青草国产成人av片免费| 日韩中文字幕91| 国产裸体歌舞团一区二区| 懂色av中文一区二区三区| 亚洲综合色网站| 欧美韩日一区二区三区| 日韩亚洲欧美高清| 欧美三级日本三级少妇99| www.成人在线| 成人一区二区三区视频在线观看 | 国产福利精品导航| 久久影院午夜片一区| 欧美videossexotv100| 三级在线观看一区二区| 亚洲国产美国国产综合一区二区| 亚洲男同性恋视频| 性久久久久久久久| 日韩激情一二三区| 国产精品嫩草久久久久| 一级特黄大欧美久久久| 中文字幕不卡在线观看| 国产欧美精品一区aⅴ影院| 精品sm在线观看| 久久综合精品国产一区二区三区| 欧美成人精品福利| 国产欧美日本一区视频| 亚洲色图色小说| 五月综合激情日本mⅴ| 欧美一区二区女人| 久久综合色之久久综合| 亚洲三级在线免费| 成人一区二区三区中文字幕| 成人天堂资源www在线| 天天色综合成人网| 免费观看日韩电影| 国产一区二区三区不卡在线观看 | 亚洲视频狠狠干| 国产一区二区成人久久免费影院 | 日韩欧美一二三| 久久国内精品自在自线400部| 欧美成人午夜电影| 成人免费毛片app| 一区二区三区在线观看国产| 欧美猛男超大videosgay| 久久不见久久见免费视频1| 秋霞成人午夜伦在线观看| 日本韩国欧美一区二区三区| 国产精品美女视频| 成人99免费视频| 亚洲欧美日韩系列| 欧美性猛片xxxx免费看久爱|