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


C++ ConfigStorage::getNextSession方法代码示例

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


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

示例1: checkAliveAndFlags

bool TraceSvcJrd::checkAliveAndFlags(ULONG sesId, int& flags)
{
	ConfigStorage* storage = TraceManager::getStorage();

	bool alive = (m_chg_number == storage->getChangeNumber());
	if (!alive)
	{
		// look if our session still alive
		StorageGuard guard(storage);

		TraceSession readSession(*getDefaultMemoryPool());
		storage->restart();
		while (storage->getNextSession(readSession))
		{
			if (readSession.ses_id == sesId)
			{
				alive = true;
				flags = readSession.ses_flags;
				break;
			}
		}

		m_chg_number = storage->getChangeNumber();
	}

	return alive;
}
开发者ID:glaubitz,项目名称:firebird,代码行数:27,代码来源:TraceService.cpp

示例2: stopSession

void TraceSvcJrd::stopSession(ULONG id)
{
	m_svc.started();

	ConfigStorage* storage = TraceManager::getStorage();
	StorageGuard guard(storage);

	storage->restart();

	TraceSession session(*getDefaultMemoryPool());
	while (storage->getNextSession(session))
	{
		if (id != session.ses_id)
			continue;

		if (m_admin || m_user == session.ses_user)
		{
			storage->removeSession(id);
			m_svc.printf(false, "Trace session ID %ld stopped\n", id);
		}
		else
			m_svc.printf(false, "No permissions to stop other user trace session\n");

		return;
	}

	m_svc.printf(false, "Trace session ID %d not found\n", id);
}
开发者ID:glaubitz,项目名称:firebird,代码行数:28,代码来源:TraceService.cpp

示例3: changeFlags

bool TraceSvcJrd::changeFlags(ULONG id, int setFlags, int clearFlags)
{
	ConfigStorage* storage = TraceManager::getStorage();
	StorageGuard guard(storage);

	storage->restart();

	TraceSession session(*getDefaultMemoryPool());
	while (storage->getNextSession(session))
	{
		if (id != session.ses_id)
			continue;

		if (m_admin || m_user == session.ses_user)
		{
			const int saveFlags = session.ses_flags;

			session.ses_flags |= setFlags;
			session.ses_flags &= ~clearFlags;

			if (saveFlags != session.ses_flags) {
				storage->updateSession(session);
			}

			return true;
		}

		m_svc.printf(false, "No permissions to change other user trace session\n");
		return false;
	}

	m_svc.printf(false, "Trace session ID %d not found\n", id);
	return false;
}
开发者ID:glaubitz,项目名称:firebird,代码行数:34,代码来源:TraceService.cpp

示例4: listSessions

void TraceSvcJrd::listSessions()
{
	m_svc.started();

	ConfigStorage* storage = TraceManager::getStorage();
	StorageGuard guard(storage);

	storage->restart();

	TraceSession session(*getDefaultMemoryPool());
	while (storage->getNextSession(session))
	{
		if (m_admin || m_user == session.ses_user)
		{
			m_svc.printf(false, "\nSession ID: %d\n", session.ses_id);
			if (!session.ses_name.empty()) {
				m_svc.printf(false, "  name:  %s\n", session.ses_name.c_str());
			}
			m_svc.printf(false, "  user:  %s\n", session.ses_user.c_str());

			struct tm* t = localtime(&session.ses_start);
			m_svc.printf(false, "  date:  %04d-%02d-%02d %02d:%02d:%02d\n",
					t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
					t->tm_hour, t->tm_min, t->tm_sec);

			string flags;
			if (session.ses_flags & trs_active) {
				flags = "active";
			}
			else {
				flags = "suspend";
			}
			if (session.ses_flags & trs_admin) {
				flags += ", admin";
			}
			if (session.ses_flags & trs_system) {
				flags += ", system";
			}
			if (session.ses_logfile.empty()) {
				flags += ", audit";
			}
			else {
				flags += ", trace";
			}
			if (session.ses_flags & trs_log_full) {
				flags += ", log full";
			}
			m_svc.printf(false, "  flags: %s\n", flags.c_str());
		}
	}
}
开发者ID:glaubitz,项目名称:firebird,代码行数:51,代码来源:TraceService.cpp

示例5: update_sessions

void TraceManager::update_sessions()
{
	SortedArray<ULONG> liveSessions(*getDefaultMemoryPool());

	{	// scope
		ConfigStorage* storage = getStorage();

		StorageGuard guard(storage);
		storage->restart();

		TraceSession session(*getDefaultMemoryPool());
		while (storage->getNextSession(session))
		{
			if ((session.ses_flags & trs_active) && !(session.ses_flags & trs_log_full))
			{
				update_session(session);
				liveSessions.add(session.ses_id);
			}
		}

		changeNumber = storage->getChangeNumber();
	}

	// remove sessions not present in storage
	FB_SIZE_T i = 0;
	while (i < trace_sessions.getCount())
	{
		FB_SIZE_T pos;
		if (liveSessions.find(trace_sessions[i].ses_id, pos)) {
			i++;
		}
		else
		{
			trace_sessions[i].plugin->release();
			trace_sessions.remove(i);
		}
	}

	// nothing to trace, clear needs
	if (trace_sessions.getCount() == 0)
	{
		trace_needs = 0;
	}
}
开发者ID:Alexpux,项目名称:firebird,代码行数:44,代码来源:TraceManager.cpp


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