Example #1
0
const Status RelCatalog::destroyRel(const string & relation)
{
  Status status;

  if (relation.empty() || 
      relation == string(RELCATNAME) || 
      relation == string(ATTRCATNAME))
    return BADCATPARM;

  // delete attrcat entries

  if ((status = attrCat->dropRelation(relation)) != OK)
    return status;

  // delete entry from relcat

  if ((status = removeInfo(relation)) != OK)
    return status;

  // destroy file
  if ((status = destroyHeapFile(relation)) != OK)
    return status;

  return OK;
}
Example #2
0
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;
}
Example #3
0
const Status RelCatalog::destroyRel(const string & relation)
{
  Status status;

  if (relation.empty() || 
      relation == string(RELCATNAME) || 
      relation == string(ATTRCATNAME))
    return BADCATPARM;

  //destroys the heap file containing the tuples in the relation
  status = destroyHeapFile(relation);
  if (status != OK) return status;

  //get relation name(also file name) from catalog(relcat)
  RelDesc record;

  status = getInfo(relation,record);
  if (status == FILEEOF) return RELNOTFOUND;
  if ((status != OK) && (status != FILEEOF)) return status;

  //remove the catalog entry of the relation from attrcat
  status = attrCat->dropRelation(relation);
  if (status != OK) return status;

  //remove the catalog entry of the relation from relcat
  status = removeInfo(relation);
  if (status != OK) return status;
  if(relation!="Tmp_Ubase_Result")
  {
    cout << endl;
    cout << "relation " << relation << " dropped successfully!" << endl;
  }

  return OK;
}
Example #4
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;
}
Example #5
0
const Status RelCatalog::destroyRel(const string & relation)
{
  Status status;
  
  if (relation.empty() ||
      relation == string(RELCATNAME) ||
      relation == string(ATTRCATNAME))
    return BADCATPARM;
  
  status = attrCat->dropRelation(relation);
  if (status!=OK) {
    return status;
  }
  
  status = removeInfo(relation);
  if (status!=OK) {
    return status;
  }
  
  // destroy file
  status = destroyHeapFile(relation);
  if (status!=OK) {
    return status;
  }
  
  return OK;
}
Example #6
0
//---------------------------------------
const bool CGameServerLists::Remove(const EGameServerLists list, const uint32 favouriteId)
{
	//CryLog("[UI] CGameServerLists::Remove %u", favouriteId);

	SServerInfo removeInfo(NULL, favouriteId);
	m_list[list].remove(removeInfo);

	m_bHasChanges = true;

	return true;
}
Example #7
0
const Status RelCatalog::destroyRel(const string & relation)
{
  Status status;

  if (relation.empty() || 
      relation == string(RELCATNAME) || 
      relation == string(ATTRCATNAME))
    return BADCATPARM;

	// Remove coresppnding entry from 'attrCnt' table
	if((status = attrCat->dropRelation(relation)) != OK) return status;
	// Remove coresppnding entry from 'relcat' table
	if((status = removeInfo(relation)) != OK) return status;
	
		// Destroy the 'relation' file
	status = destroyHeapFile(relation);
	return status;
}
Example #8
0
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;
}
Example #9
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;
}
void MediaIndexer::removeInfo(const MediaItem &mediaItem)
{
    QList<MediaItem> mediaList;
    mediaList << mediaItem;
    removeInfo(mediaList);
}
Example #11
0
int getInfo(int id)
{
	DB_ENV *dbenv = radacct_dbenv;
	DB *dbp = radacct_dbp;
	DB_TXN *tid = NULL;
	DBT key, data;
	db_recno_t recno;
	int info = 0;
	char buf[REC_SIZE];
	int ret;
	clock_t t1, t2;
	clock_t t3, t4;
	struct tms buf1, buf2;
	struct tms buf3, buf4;

	memset(&key, 0, sizeof(DBT));
	memset(&data, 0, sizeof(DBT));

	key.data = &recno;
	key.size = key.ulen = sizeof(recno);
	key.flags = DB_DBT_USERMEM;

	data.data = buf;
	data.ulen = sizeof(buf);
	data.flags = DB_DBT_USERMEM;

	if((ret = dbenv->txn_begin(dbenv, NULL, &tid, 0)) != 0)
	{
		printf("getInfo: transaction failed: %s\n", db_strerror(ret));
		return 0;
	}
	t1 = times(&buf1);
	ret = dbp->get(dbp, tid, &key, &data, DB_CONSUME);
	t2 = times(&buf2);
	get_total_time[id] += (t2 - t1);
	get_time_buf[id].tms_utime += (buf2.tms_utime - buf1.tms_utime);
	get_time_buf[id].tms_stime += (buf2.tms_stime - buf1.tms_stime);
	get_time_buf[id].tms_cutime += (buf2.tms_cutime - buf1.tms_cutime);
	get_time_buf[id].tms_cstime += (buf2.tms_cstime - buf1.tms_cstime);
	switch(ret)
	{

		case DB_LOCK_DEADLOCK:
			printf("getInfo: deadlock: %s\n", db_strerror(ret));
			break;

		case 0:
			t3 = times(&buf3);	
			removeInfo(tid);
			t4 = times(&buf4);
			remove_total_time[id] = (t4 - t3);
			remove_time_buf[id].tms_utime += (buf4.tms_utime - buf3.tms_utime);
			remove_time_buf[id].tms_stime += (buf4.tms_stime - buf3.tms_stime);
			remove_time_buf[id].tms_cutime += (buf4.tms_cutime - buf3.tms_cutime);
			remove_time_buf[id].tms_cstime += (buf4.tms_cstime - buf3.tms_cstime);
			break;

		default:
			printf("getInfo: oops: %d\n", ret);
			break;
	}

	return info;
}