当前位置: 首页>>代码示例>>C++>>正文


C++ DBIterator::destroy方法代码示例

本文整理汇总了C++中DBIterator::destroy方法的典型用法代码示例。如果您正苦于以下问题:C++ DBIterator::destroy方法的具体用法?C++ DBIterator::destroy怎么用?C++ DBIterator::destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBIterator的用法示例。


在下文中一共展示了DBIterator::destroy方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: script_save_mapreg

/// Saves permanent variables to savefile
static void script_save_mapreg(void)
{
	FILE *fp;
	int lock;
	DBIterator* iter;
	void* data;
	DBKey key;

	fp = lock_fopen(mapreg_txt,&lock);
	if( fp == NULL )
	{
		ShowError("script_save_mapreg: Unable to lock-open file [%s]!\n", mapreg_txt);
		return;
	}

	iter = mapreg_db->iterator(mapreg_db);
	for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) )
	{
		int num = (key.i & 0x00ffffff);
		int i   = (key.i & 0xff000000) >> 24;
		const char* name = get_str(num);

		if( name[1] == '@' )
			continue;

		if( i == 0 )
			fprintf(fp, "%s\t%d\n", name, (int)data);
		else
			fprintf(fp, "%s,%d\t%d\n", name, i, (int)data);
	}
	iter->destroy(iter);

	iter = mapregstr_db->iterator(mapregstr_db);
	for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) )
	{
		int num = (key.i & 0x00ffffff);
		int i   = (key.i & 0xff000000) >> 24;
		const char* name = get_str(num);

		if( name[1] == '@' )
			continue;

		if( i == 0 )
			fprintf(fp, "%s\t%s\n", name, (char *)data);
		else
			fprintf(fp, "%s,%d\t%s\n", name, i, (char *)data);
	}
	iter->destroy(iter);

	lock_fclose(fp,mapreg_txt,&lock);

	mapreg_dirty = false;
}
开发者ID:Drakkus,项目名称:eamod,代码行数:54,代码来源:mapreg_txt.c

示例2: party_send_xy_timer

int party_send_xy_timer(int tid, unsigned int tick, int id, intptr data)
{
	struct party_data* p;

	DBIterator* iter = party_db->iterator(party_db);
	// for each existing party,
	for( p = (struct party_data*)iter->first(iter,NULL); iter->exists(iter); p = (struct party_data*)iter->next(iter,NULL) )
	{
		int i;
		// for each member of this party,
		for( i = 0; i < MAX_PARTY; i++ )
		{
			//struct map_session_data* sd = p->data[i].sd;
			struct map_session_data* sd = map_charid2sd(p->party.member[i].char_id); //temporary crashfix
			if( !sd ) continue;

			if( p->data[i].x != sd->bl.x || p->data[i].y != sd->bl.y )
			{// perform position update
				clif_party_xy(sd);
				p->data[i].x = sd->bl.x;
				p->data[i].y = sd->bl.y;
			}
			if (battle_config.party_hp_mode && p->data[i].hp != sd->battle_status.hp)
			{// perform hp update
				clif_party_hp(sd);
				p->data[i].hp = sd->battle_status.hp;
			}
		}
	}
	iter->destroy(iter);

	return 0;
}
开发者ID:PiratGameInfo,项目名称:Eathena,代码行数:33,代码来源:party.c

示例3: party_booking_search

void party_booking_search(struct map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount)
{
	struct party_booking_ad_info *pb_ad;
	int i, count=0;
	unsigned long index_list[10];
	bool more_result = false;
	DBIterator* iter = party_booking_db->iterator(party_booking_db);
	
	memset(index_list, 0, sizeof(index_list));
	
	for( pb_ad = (struct party_booking_ad_info*)iter->first(iter,NULL);	iter->exists(iter);	pb_ad = (struct party_booking_ad_info*)iter->next(iter,NULL) )
	{
		if (pb_ad->index < lastindex || (pb_ad->p_detail.level < level || pb_ad->p_detail.level-15 > level))
			continue;
		if (count >= 10){
			more_result = true;
			break;
		}
		if (mapid == 0 && job == -1)
			index_list[count] = pb_ad->index;
		else if (mapid == 0) {
			for(i=0; i<6; i++)
				if (pb_ad->p_detail.job[i] == job && job != -1)
					index_list[count] = pb_ad->index;
		} else if (job == -1){
			if (pb_ad->p_detail.mapid == mapid)
				index_list[count] = pb_ad->index;
		}
		count++;
	}
	iter->destroy(iter);
	clif_PartyBookingSearchAck(sd->fd, index_list, count, more_result);
}
开发者ID:Chocolate31,项目名称:eamod,代码行数:33,代码来源:party.c

示例4: inter_guild_save

// ギルドデ??のセ?ブ
int inter_guild_save()
{
	FILE *fp;
	int lock;
	DBIterator* iter;
	struct guild* g;
	struct guild_castle* gc;

	// save guild data
	if ((fp = lock_fopen(guild_txt, &lock)) == NULL) {
		ShowError("int_guild: can't write [%s] !!! data is lost !!!\n", guild_txt);
		return 1;
	}

	iter = guild_db->iterator(guild_db);
	for( g = (struct guild*)iter->first(iter,NULL); iter->exists(iter); g = (struct guild*)iter->next(iter,NULL) )
	{
		char line[16384];
		inter_guild_tostr(line, g);
		fprintf(fp, "%s\n", line);
	}
	iter->destroy(iter);

//	fprintf(fp, "%d\t%%newid%%\n", guild_newid);
	lock_fclose(fp, guild_txt, &lock);

	// save castle data
	if ((fp = lock_fopen(castle_txt,&lock)) == NULL) {
		ShowError("int_guild: can't write [%s] !!! data is lost !!!\n", castle_txt);
		return 1;
	}

	iter = castle_db->iterator(castle_db);
	for( gc = (struct guild_castle*)iter->first(iter,NULL); iter->exists(iter); gc = (struct guild_castle*)iter->next(iter,NULL) )
	{
		char line[16384];
		inter_guildcastle_tostr(line, gc);
		fprintf(fp, "%s\n", line);
	}
	iter->destroy(iter);

	lock_fclose(fp, castle_txt, &lock);

	return 0;
}
开发者ID:KimKyung-wook,项目名称:ilathena-project,代码行数:46,代码来源:int_guild.c

示例5: script_save_mapreg

/// Saves permanent variables to database
static void script_save_mapreg(void)
{
	DBIterator* iter;
	void* data;
	DBKey key;

	iter = mapreg_db->iterator(mapreg_db);
	for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) )
	{
		int num = (key.i & 0x00ffffff);
		int i   = (key.i & 0xff000000) >> 24;
		const char* name = get_str(num);

		if( name[1] == '@' )
			continue;

		if( SQL_ERROR == Sql_Query(mmysql_handle, "UPDATE `%s` SET `value`='%d' WHERE `varname`='%s' AND `index`='%d'", mapreg_table, (int)data, name, i) )
			Sql_ShowDebug(mmysql_handle);
	}
	iter->destroy(iter);

	iter = mapregstr_db->iterator(mapregstr_db);
	for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) )
	{
		int num = (key.i & 0x00ffffff);
		int i   = (key.i & 0xff000000) >> 24;
		const char* name = get_str(num);
		char tmp_str2[2*255+1];

		if( name[1] == '@' )
			continue;

		Sql_EscapeStringLen(mmysql_handle, tmp_str2, (char*)data, safestrnlen((char*)data, 255));
		if( SQL_ERROR == Sql_Query(mmysql_handle, "UPDATE `%s` SET `value`='%s' WHERE `varname`='%s' AND `index`='%d'", mapreg_table, tmp_str2, name, i) )
			Sql_ShowDebug(mmysql_handle);
	}
	iter->destroy(iter);

	mapreg_dirty = false;
}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:41,代码来源:mapreg_sql.c

示例6:

/// lookup: map index -> castle*
struct guild_castle* guild_mapindex2gc(short mapindex)
{
	struct guild_castle* gc;

	DBIterator* iter = castle_db->iterator(castle_db);
	for( gc = (struct guild_castle*)iter->first(iter,NULL); iter->exists(iter); gc = (struct guild_castle*)iter->next(iter,NULL) )
	{
		if( gc->mapindex == mapindex )
			break;
	}
	iter->destroy(iter);

	return gc;
}
开发者ID:casioza,项目名称:server000,代码行数:15,代码来源:guild.c

示例7: guild_searchname

/// lookup: guild name -> guild*
struct guild* guild_searchname(char* str)
{
	struct guild* g;

	DBIterator* iter = guild_db->iterator(guild_db);
	for( g = (struct guild*)iter->first(iter,NULL); iter->exists(iter); g = (struct guild*)iter->next(iter,NULL) )
	{
		if( strcmpi(g->name, str) == 0 )
			break;
	}
	iter->destroy(iter);

	return g;
}
开发者ID:casioza,项目名称:server000,代码行数:15,代码来源:guild.c

示例8: party_searchname

/// Party data lookup using party name.
struct party_data* party_searchname(const char* str)
{
	struct party_data* p;

	DBIterator* iter = party_db->iterator(party_db);
	for( p = (struct party_data*)iter->first(iter,NULL); iter->exists(iter); p = (struct party_data*)iter->next(iter,NULL) )
	{
		if( strncmpi(p->party.name,str,NAME_LENGTH) == 0 )
			break;
	}
	iter->destroy(iter);

	return p;
}
开发者ID:PiratGameInfo,项目名称:Eathena,代码行数:15,代码来源:party.c

示例9: auction_count

static int auction_count(int char_id, bool buy)
{
	int i = 0;
	struct auction_data *auction;
	DBIterator* iter;
	DBKey key;

	iter = auction_db_->iterator(auction_db_);
	for( auction = (struct auction_data*)iter->first(iter,&key); iter->exists(iter); auction = (struct auction_data*)iter->next(iter,&key) )
	{
		if( (buy && auction->buyer_id == char_id) || (!buy && auction->seller_id == char_id) )
			i++;
	}
	iter->destroy(iter);

	return i;
}
开发者ID:DiscoverCZY,项目名称:15-3athena,代码行数:17,代码来源:int_auction.c

示例10: mapif_parse_Auction_requestlist

static void mapif_parse_Auction_requestlist(int fd)
{
	char searchtext[NAME_LENGTH];
	int char_id = RFIFOL(fd,4), len = sizeof(struct auction_data);
	int price = RFIFOL(fd,10);
	short type = RFIFOW(fd,8), page = max(1,RFIFOW(fd,14));
	unsigned char buf[5 * sizeof(struct auction_data)];
	DBIterator* iter;
	DBKey key;
	struct auction_data *auction;
	short i = 0, j = 0, pages = 1;

	memcpy(searchtext, RFIFOP(fd,16), NAME_LENGTH);

	iter = auction_db_->iterator(auction_db_);
	for( auction = (struct auction_data*)iter->first(iter,&key); iter->exists(iter); auction = (struct auction_data*)iter->next(iter,&key) )
	{
		if( (type == 0 && auction->type != IT_ARMOR && auction->type != IT_PETARMOR) || 
			(type == 1 && auction->type != IT_WEAPON) ||
			(type == 2 && auction->type != IT_CARD) ||
			(type == 3 && auction->type != IT_ETC) ||
			(type == 4 && !strstr(auction->item_name, searchtext)) ||
			(type == 5 && auction->price > price) ||
			(type == 6 && auction->seller_id != char_id) ||
			(type == 7 && auction->buyer_id != char_id) )
			continue;

		i++;
		if( i > 5 )
		{ // Counting Pages of Total Results (5 Results per Page)
			pages++;
			i = 1; // First Result of This Page
		}

		if( page != pages )
			continue; // This is not the requested Page

		memcpy(WBUFP(buf, j * len), auction, len);
		j++; // Found Results
	}
	iter->destroy(iter);

	mapif_Auction_sendlist(fd, char_id, j, pages, buf);
}
开发者ID:DiscoverCZY,项目名称:15-3athena,代码行数:44,代码来源:int_auction.c

示例11: channel_list

void channel_list(struct map_session_data *sd)
{ // Display a list of all channels
	char output[256];
	struct channel_data *cd;
	DBIterator* iter;
	DBKey key;

	iter = channel_db->iterator(channel_db);
	for( cd = (struct channel_data *)iter->first(iter,&key); iter->exists(iter); cd = (struct channel_data *)iter->next(iter,&key) )
	{
		if( cd->users < 1 && cd->type == CHN_USER )
			continue;

		sprintf(output, msg_txt(812), cd->name, cd->users, !cd->pass[0] ? msg_txt(813) : msg_txt(814));
		clif_displaymessage(sd->fd, output);
	}
	iter->destroy(iter);
	return;
}
开发者ID:Chocolate31,项目名称:eamod,代码行数:19,代码来源:channel.c

示例12: mapif_guild_castle_alldataload

int mapif_guild_castle_alldataload(int fd)
{
	DBIterator* iter;
	struct guild_castle* gc;
	int len = 4;

	WFIFOHEAD(fd, 4 + MAX_GUILDCASTLE*sizeof(struct guild_castle));
	WFIFOW(fd,0) = 0x3842;
	iter = castle_db->iterator(castle_db);
	for( gc = (struct guild_castle*)iter->first(iter,NULL); iter->exists(iter); gc = (struct guild_castle*)iter->next(iter,NULL) )
	{
		memcpy(WFIFOP(fd,len), gc, sizeof(struct guild_castle));
		len += sizeof(struct guild_castle);
	}
	iter->destroy(iter);
	WFIFOW(fd,2) = len;
	WFIFOSET(fd, len);

	return 0;
}
开发者ID:KimKyung-wook,项目名称:ilathena-project,代码行数:20,代码来源:int_guild.c

示例13: read_config


//.........这里部分代码省略.........
				commands = group_settings->commands = config_setting_add(group_settings->root, "commands", CONFIG_TYPE_GROUP);
			count = config_setting_length(commands);

			for (i = 0; i < count; ++i) {
				config_setting_t *command = config_setting_get_elem(commands, i);
				const char *name = config_setting_name(command);
				if (!atcommand_exists(name)) {
					ShowConfigWarning(command, "pc_groups:read_config: non-existent command name '%s', removing...", name);
					config_setting_remove(commands, name);
					--i;
					--count;
				}
			}

			// Make sure there is "permissions" group
			if (permissions == NULL)
				permissions = group_settings->permissions = config_setting_add(group_settings->root, "permissions", CONFIG_TYPE_GROUP);
			count = config_setting_length(permissions);

			for(i = 0; i < count; ++i) {
				config_setting_t *permission = config_setting_get_elem(permissions, i);
				const char *name = config_setting_name(permission);
				int j;

				ARR_FIND(0, ARRAYLENGTH(permission_name), j, strcmp(permission_name[j].name, name) == 0);
				if (j == ARRAYLENGTH(permission_name)) {
					ShowConfigWarning(permission, "pc_groups:read_config: non-existent permission name '%s', removing...", name);
					config_setting_remove(permissions, name);
					--i;
					--count;
				}
			}
		}
		iter->destroy(iter);

		// Apply inheritance
		i = 0; // counter for processed groups
		while (i < group_count) {
			iter = pc_group_db->iterator(pc_group_db);
			for (group_settings = (GroupSettings*)iter->first(iter, NULL);
			     iter->exists(iter);
			     group_settings = (GroupSettings*)iter->next(iter, NULL)) {
				config_setting_t *inherit = NULL,
				                 *commands = group_settings->commands,
					             *permissions = group_settings->permissions;
				int j, inherit_count = 0, done = 0;
				
				if (group_settings->inheritance_done) // group already processed
					continue; 

				if ((inherit = group_settings->inherit) == NULL ||
				    (inherit_count = config_setting_length(inherit)) <= 0) { // this group does not inherit from others
					++i;
					group_settings->inheritance_done = true;
					continue;
				}
				
				for (j = 0; j < inherit_count; ++j) {
					GroupSettings *inherited_group = NULL;
					const char *groupname = config_setting_get_string_elem(inherit, j);

					if (groupname == NULL) {
						ShowConfigWarning(inherit, "pc_groups:read_config: \"inherit\" array member #%d is not a name, removing...", j);
						config_setting_remove_elem(inherit,j);
						continue;
					}
开发者ID:greenboxal,项目名称:Cronus-Emulator,代码行数:67,代码来源:pc_groups.c


注:本文中的DBIterator::destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。