⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ubase.c

📁 linux 下用c++ 开发的一个小型数据库系统
💻 C
字号:
#include <stdio.h>#include <unistd.h>#include "catalog.h"#include "query.h"DB db;Error error;BufMgr *bufMgr;RelCatalog *relCat;AttrCatalog *attrCat;JoinType JoinMethod;int main(int argc, char **argv){  if (argc < 2) {    cerr << "Usage: " << argv[0] << " dbname" << endl;    return 1;  }  if (chdir(argv[1]) < 0) {    perror("chdir");    exit(1);  }  JoinMethod = NLJoin;  // default join method  if (argc == 3) // alternative join method specified  {       if (strcmp (argv[2],"SM") == 0) JoinMethod = SMJoin;       else if (strcmp (argv[2],"HJ") == 0) JoinMethod = HashJoin;  }  // create buffer manager    bufMgr = new BufMgr(100);    // open relation and attribute catalogs  Status status;  relCat = new RelCatalog(status);  if (status == OK)    attrCat = new AttrCatalog(status);  if (status != OK) {    error.print(status);    exit(1);  }  cout << "Welcome to Ubase" << endl;  cout << "    Using ";  if (JoinMethod == NLJoin) {cout << "Nested Loops Join Method" << endl;}  else   if (JoinMethod == HashJoin) {cout << "Hash Join Method" << endl;}  else {cout << "Sort Merge Join Method" << endl;}  extern void parse();  parse();  return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -