ServerList ServerRepository::select(const string& where)
{
	soci::rowset<row> rs = 	dataBase.prepare << "SELECT  server.server_id as Server_server_id, server.sys_userid as Server_sys_userid, server.sys_groupid as Server_sys_groupid, server.sys_perm_user as Server_sys_perm_user, server.sys_perm_group as Server_sys_perm_group, server.sys_perm_other as Server_sys_perm_other, server.server_name as Server_server_name, server.mail_server as Server_mail_server, server.web_server as Server_web_server, server.dns_server as Server_dns_server, server.file_server as Server_file_server, server.db_server as Server_db_server, server.vserver_server as Server_vserver_server, server.proxy_server as Server_proxy_server, server.firewall_server as Server_firewall_server, server.config as Server_config, server.updated as Server_updated, server.mirror_server_id as Server_mirror_server_id, server.dbversion as Server_dbversion, server.active as Server_active "
	" FROM server" 
	<< (where.size()?" WHERE "+where:"");
	ServerList serverList;
	for(row& r: rs)
	{
		ServerPtr server(new Server);
		type_conversion<Server>::from_base(r, i_ok, *server);
		serverList.push_back(server);
	}
	return serverList;
}
Exemple #2
0
void SpanningTreeProtocolInterface::GetServerList(ServerList& sl)
{
	for (server_hash::iterator i = Utils->serverlist.begin(); i != Utils->serverlist.end(); i++)
	{
		ServerInfo ps;
		ps.servername = i->second->GetName();
		TreeServer* s = i->second->GetParent();
		ps.parentname = s ? s->GetName() : "";
		ps.usercount = i->second->UserCount;
		ps.opercount = i->second->OperCount;
		ps.gecos = i->second->GetDesc();
		ps.latencyms = i->second->rtt;
		sl.push_back(ps);
	}
}