예제 #1
0
파일: destroy.C 프로젝트: Phildo/Minirel
const Status AttrCatalog::dropRelation(const string & relation)
{
  Status status;
  AttrDesc *attrs;
  int attrCnt, i;

  if (relation.empty())
    return BADCATPARM;

  // get attribute information

  if ((status = getRelInfo(relation, attrCnt, attrs)) != OK)
    return status;

  // remove entries from catalog

  for(i = 0; i < attrCnt; i++) {
    if ((status = removeInfo(relation, attrs[i].attrName)) != OK)
      return status;
  }

  free(attrs);

  return OK;
}
예제 #2
0
//
// 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;
  
  if (relation.empty()) {
    return BADCATPARM;
  }
  
  // find attribute info
  int attrCnt;
  status = getRelInfo(relation, attrCnt, attrs);
  if (status!=OK) {
    return status;
  }
  
  // delete entries from catalog
  for (int i = 0; i < attrCnt; i++) {
    status = removeInfo(relation, attrs[i].attrName);
    if (status!=OK) {
      return status;
    }
  }
  
  free(attrs);
  
  return OK;
}
예제 #3
0
파일: destroy.C 프로젝트: zning1994/Ubase
const Status AttrCatalog::dropRelation(const string & relation)
{
  Status status;
  AttrDesc *attrs;
  int attrCnt;

  if (relation.empty())
    return BADCATPARM;

  //get attributes infomation of the relation
  status = getRelInfo(relation,attrCnt,attrs);
  if (status != OK) return status;

  //removes the catalog entries in attrcat of the relation
  for (int i=0; i < attrCnt; i++)
  {
    status = removeInfo(relation,attrs[i].attrName);
    if (status != OK) return status;
  }
  delete [] attrs;
  return OK;
}
예제 #4
0
const Status AttrCatalog::dropRelation(const string & relation)
{
	Status status;
	AttrDesc *attrs;
	int attrCnt, i;

	if (relation.empty()) return BADCATPARM;
	status = getRelInfo(relation,attrCnt,attrs);
	if(status !=OK)
	{
		return status;
	}
	for(i=0;i<attrCnt;i++)
	{
		status = removeInfo(relation,string(attrs->attrName));
		if(status !=OK)
		{
			return status;
		}
	}
	delete[] attrs;
	return OK;
}