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


C++ ConnMap类代码示例

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


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

示例1: ClearQueue

	void ClearQueue()
	{
		for (ConnMap::iterator iter = connections.begin(); iter != connections.end(); iter++)
		{
			iter->second->ClearResults();
		}
	}
开发者ID:thepaul,项目名称:inspircd-deb,代码行数:7,代码来源:m_sqlite3.cpp

示例2: ClearAllConnections

	void ClearAllConnections()
	{
		for(ConnMap::iterator i = connections.begin(); i != connections.end(); i++)
		{
			i->second->cull();
			delete i->second;
		}
		connections.clear();
	}
开发者ID:AliSharifi,项目名称:inspircd,代码行数:9,代码来源:m_pgsql.cpp

示例3: ClearAllConnections

	void ClearAllConnections()
	{
		ConnMap::iterator i;
		while ((i = connections.begin()) != connections.end())
		{
			connections.erase(i);
			delete i->second;
		}
	}
开发者ID:thepaul,项目名称:inspircd-deb,代码行数:9,代码来源:m_pgsql.cpp

示例4: HasHost

	bool HasHost(const SQLhost &host)
	{
		for (ConnMap::iterator iter = connections.begin(); iter != connections.end(); iter++)
		{
			if (host == iter->second->GetConfHost())
				return true;
		}
		return false;
	}
开发者ID:thepaul,项目名称:inspircd-deb,代码行数:9,代码来源:m_pgsql.cpp

示例5: ClearConns

	void ClearConns()
	{
		for(ConnMap::iterator i = conns.begin(); i != conns.end(); i++)
		{
			SQLConn* conn = i->second;
			ServerInstance->Modules->DelService(*conn);
			delete conn;
		}
		conns.clear();
	}
开发者ID:bandicot,项目名称:inspircd,代码行数:10,代码来源:m_sqlite3.cpp

示例6: OnUnloadModule

	virtual void OnUnloadModule(Module* mod, const std::string&	name)
	{
		/* When a module unloads we have to check all the pending queries for all our connections
		 * and set the Module* specifying where the query came from to NULL. If the query has already
		 * been dispatched then when it is processed it will be dropped if the pointer is NULL.
		 *
		 * If the queries we find are not already being executed then we can simply remove them immediately.
		 */
		for(ConnMap::iterator iter = connections.begin(); iter != connections.end(); iter++)
		{
			iter->second->OnUnloadModule(mod);
		}
	}
开发者ID:thepaul,项目名称:inspircd-deb,代码行数:13,代码来源:m_pgsql.cpp

示例7: ReconnectConn

	void ReconnectConn(SQLConn* conn)
	{
		for (ConnMap::iterator iter = connections.begin(); iter != connections.end(); iter++)
		{
			if (conn == iter->second)
			{
				delete iter->second;
				connections.erase(iter);
				break;
			}
		}
		retimer = new ReconnectTimer(ServerInstance, this);
		ServerInstance->Timers->AddTimer(retimer);
	}
开发者ID:thepaul,项目名称:inspircd-deb,代码行数:14,代码来源:m_pgsql.cpp

示例8: ClearOldConnections

	void ClearOldConnections()
	{
		ConnMap::iterator iter,safei;
		for (iter = connections.begin(); iter != connections.end(); iter++)
		{
			if (!HostInConf(iter->second->GetConfHost()))
			{
				delete iter->second;
				safei = iter;
				--iter;
				connections.erase(safei);
			}
		}
	}
开发者ID:thepaul,项目名称:inspircd-deb,代码行数:14,代码来源:m_pgsql.cpp

示例9: ReadConf

	void ReadConf()
	{
		ConnMap conns;
		ConfigTagList tags = ServerInstance->Config->ConfTags("database");
		for(ConfigIter i = tags.first; i != tags.second; i++)
		{
			if (i->second->getString("module", "pgsql") != "pgsql")
				continue;
			std::string id = i->second->getString("id");
			ConnMap::iterator curr = connections.find(id);
			if (curr == connections.end())
			{
				SQLConn* conn = new SQLConn(this, i->second);
				conns.insert(std::make_pair(id, conn));
				ServerInstance->Modules->AddService(*conn);
			}
			else
			{
				conns.insert(*curr);
				connections.erase(curr);
			}
		}
		ClearAllConnections();
		conns.swap(connections);
	}
开发者ID:AliSharifi,项目名称:inspircd,代码行数:25,代码来源:m_pgsql.cpp

示例10: OnRequest

	virtual const char* OnRequest(Request* request)
	{
		if(strcmp(SQLREQID, request->GetId()) == 0)
		{
			SQLrequest* req = (SQLrequest*)request;
			ConnMap::iterator iter;
			if((iter = connections.find(req->dbid)) != connections.end())
			{
				req->id = NewID();
				req->error = iter->second->Query(*req);
				return SQLSUCCESS;
			}
			else
			{
				req->error.Id(SQL_BAD_DBID);
				return NULL;
			}
		}
		return NULL;
	}
开发者ID:thepaul,项目名称:inspircd-deb,代码行数:20,代码来源:m_sqlite3.cpp

示例11: OnRequest

	virtual const char* OnRequest(Request* request)
	{
		if(strcmp(SQLREQID, request->GetId()) == 0)
		{
			SQLrequest* req = (SQLrequest*)request;
			ConnMap::iterator iter;
			if((iter = connections.find(req->dbid)) != connections.end())
			{
				/* Execute query */
				req->id = NewID();
				req->error = iter->second->Query(*req);

				return (req->error.Id() == SQL_NO_ERROR) ? sqlsuccess : NULL;
			}
			else
			{
				req->error.Id(SQL_BAD_DBID);
				return NULL;
			}
		}
		return NULL;
	}
开发者ID:thepaul,项目名称:inspircd-deb,代码行数:22,代码来源:m_pgsql.cpp

示例12: ReadConf

	void ReadConf()
	{
		ClearConns();
		ConfigTagList tags = ServerInstance->Config->ConfTags("database");
		for(ConfigIter i = tags.first; i != tags.second; i++)
		{
			if (i->second->getString("module", "sqlite") != "sqlite")
				continue;
			SQLConn* conn = new SQLConn(this, i->second);
			conns.insert(std::make_pair(i->second->getString("id"), conn));
			ServerInstance->Modules->AddService(*conn);
		}
	}
开发者ID:bandicot,项目名称:inspircd,代码行数:13,代码来源:m_sqlite3.cpp

示例13: AddConn

	void AddConn(const SQLhost& hi)
	{
		if (HasHost(hi))
		{
			ServerInstance->Logs->Log("m_pgsql",DEFAULT, "WARNING: A pgsql connection with id: %s already exists. Aborting connection attempt.", hi.id.c_str());
			return;
		}

		SQLConn* newconn;

		newconn = new SQLConn(ServerInstance, this, hi);

		connections.insert(std::make_pair(hi.id, newconn));
	}
开发者ID:thepaul,项目名称:inspircd-deb,代码行数:14,代码来源:m_pgsql.cpp


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