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

📄 help.c

📁 linux 下用c++ 开发的一个小型数据库系统
💻 C
字号:
#include <sys/types.h>#include <functional>#include <string.h>#include <stdio.h>using namespace std;#include "error.h"#include "utility.h"#include "catalog.h"// define if debug output wanted//// Retrieves and prints information from the catalogs about the for the// user. If no relation is given (relation is NULL), then it lists all// the relations in the database, along with the width in bytes of the// relation, the number of attributes in the relation, and the number of// attributes that are indexed.  If a relation is given, then it lists// all of the attributes of the relation, as well as its type, length,// and offset, whether it's indexed or not, and its index number.//// Returns:// 	OK on success// 	error code otherwise//const Status RelCatalog::help(const string & relation){  Status status;  RelDesc rd;  AttrDesc *attrs;  int attrCnt;     if (relation.empty())    return UT_Print(RELCATNAME);   if ((status = relCat->getInfo( relation, rd)) != OK) return status ;  if ((status = attrCat->getRelInfo( relation, attrCnt, attrs)) != OK) return status ;  int i ;  cout<<"\n" ;  printf("%-*s", 25, "RelName") ;  printf("%-*s", 25, "AttrName") ;  printf("%-*s", 11, "Offset") ;  printf("%-*s", 10, "Type") ;  printf("%-*s", 9, "Length") ;    printf("\n") ;   for(i = 0; i < 80; i++)    cout<<"-" ;    printf("\n") ;  for (i = 0; i < attrCnt; i++){    printf("%-*s", 25, attrs[i].relName) ;    printf("%-*s", 25, attrs[i].attrName) ;    printf("%-*d", 11, attrs[i].attrOffset) ;    switch(attrs[i].attrType){      case STRING :         printf("%-*s", 10, "STRING") ;         break ;      case INTEGER :         printf("%-*s", 10, "INTEGER") ;         break ;      case FLOAT :         printf("%-*s", 10, "REAL") ;         break ;    }    printf("%-*d\n", 9, attrs[i].attrLen) ;  }    printf("\n\n  %d  record (s)  selected!\n", attrCnt) ;  delete [] attrs ;  return OK ;  }

⌨️ 快捷键说明

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