예제 #1
0
	bool CDatabase::closeConnection(IConnection *pConnection)
	{
	 
		TConnections::iterator it = m_Connections.find(IConnectionPtr(pConnection));
		if(it == m_Connections.end())
			return false; // TO DO Log
		m_Connections.erase(it);
		return true;
	}
예제 #2
0
	IConnectionPtr CDatabase::connect(const wchar_t* pszUser, const wchar_t* pszPassword)
	{
		if(!m_UserCryptoManager.CheckUser(pszUser, pszPassword))
		{
			return IConnectionPtr(); // TO DO Log error
		}

		if(!m_bLoad)
		{
			if(!load())
				return IConnectionPtr(); // TO DO Log error

			m_bLoad = true;
		}

		uint64 nUserID = m_UserCryptoManager.GetUserID(pszUser);
		eUserGroup userGroup = m_UserCryptoManager.GetUserGroup(pszUser);

		CConnection *pConnection = new CConnection(this, m_pSchema.get(), pszUser, nUserID, userGroup);

		m_Connections.insert(IConnectionPtr(pConnection));

		return IConnectionPtr(pConnection);
	}
예제 #3
0
파일: server.hpp 프로젝트: wo3kie/server
 // Let your server know about your connection.
 IConnectionPtr createConnection() override
 {
     return IConnectionPtr( new MyConnection( m_ioService, this, createTask() ) );
 }