📄 destroy.c
字号:
#include "catalog.h"//// Destroys a relation. It performs the following steps://// removes the catalog entry for the relation// destroys the heap file containing the tuples in the relation//// Returns:// OK on success// error code otherwise//const Status RelCatalog::destroyRel(const string & relation){ Status status; if (relation.empty() || relation == string(RELCATNAME) || relation == string(ATTRCATNAME)) return BADCATPARM; if ((status = attrCat->dropRelation(relation)) != OK) return status ; if ((status = removeInfo(relation)) != OK) return status ; db.destroyFile(relation) ; if (strcmp(relation.c_str(), "Tmp_Ubase_Result") != 0) printf(" Table %s Destroy!\n", relation.c_str()) ; return OK ; }//// Drops a relation. It performs the following steps://// removes the catalog entries for the relation//// Returns:// OK on success// error code otherwise//const Status AttrCatalog::dropRelation(const string & relation){ Status status; AttrDesc *attrs; int attrCnt, i; if (relation.empty()) return BADCATPARM; if ((status = getRelInfo( relation, attrCnt, attrs)) != OK) return status ; for (i = 0; i < attrCnt; i++) if ((status = removeInfo(relation, attrs[i].attrName)) != OK) return status ; delete [] attrs ; return OK ;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -