本文整理汇总了C++中Database::GetVariable方法的典型用法代码示例。如果您正苦于以下问题:C++ Database::GetVariable方法的具体用法?C++ Database::GetVariable怎么用?C++ Database::GetVariable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Database
的用法示例。
在下文中一共展示了Database::GetVariable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
RegisterExecutablePlatform(ExePlatformUCS);
set_exception_handler();
// Check every minute for unused channels we can delete
//
Timer ChannelListProcessTimer(60000);
Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect
_log(UCS__INIT, "Starting EQEmu Universal Chat Server.");
if (!ucsconfig::LoadConfig()) {
_log(UCS__INIT, "Loading server configuration failed.");
return 1;
}
Config = ucsconfig::get();
if(!load_log_settings(Config->LogSettingsFile.c_str()))
_log(UCS__INIT, "Warning: Unable to read %s", Config->LogSettingsFile.c_str());
else
_log(UCS__INIT, "Log settings loaded from %s", Config->LogSettingsFile.c_str());
WorldShortName = Config->ShortName;
_log(UCS__INIT, "Connecting to MySQL...");
if (!database.Connect(
Config->DatabaseHost.c_str(),
Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(),
Config->DatabaseDB.c_str(),
Config->DatabasePort)) {
_log(WORLD__INIT_ERR, "Cannot continue without a database connection.");
return 1;
}
char tmp[64];
if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) {
_log(WORLD__INIT, "Loading rule set '%s'", tmp);
if(!RuleManager::Instance()->LoadRules(&database, tmp)) {
_log(UCS__ERROR, "Failed to load ruleset '%s', falling back to defaults.", tmp);
}
} else {
if(!RuleManager::Instance()->LoadRules(&database, "default")) {
_log(UCS__INIT, "No rule set configured, using default rules");
} else {
_log(UCS__INIT, "Loaded default rule set 'default'", tmp);
}
}
database.ExpireMail();
if(Config->ChatPort != Config->MailPort)
{
_log(UCS__ERROR, "MailPort and CharPort must be the same in eqemu_config.xml for UCS.");
exit(1);
}
CL = new Clientlist(Config->ChatPort);
ChannelList = new ChatChannelList();
database.LoadChatChannels();
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
_log(UCS__ERROR, "Could not set signal handler");
return 1;
}
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
_log(UCS__ERROR, "Could not set signal handler");
return 1;
}
worldserver = new WorldServer;
worldserver->Connect();
while(RunLoops) {
Timer::SetCurrentTime();
CL->Process();
if(ChannelListProcessTimer.Check())
ChannelList->Process();
if (InterserverTimer.Check()) {
if (worldserver->TryReconnect() && (!worldserver->Connected()))
worldserver->AsyncConnect();
}
worldserver->Process();
timeout_manager.CheckTimeouts();
Sleep(100);
//.........这里部分代码省略.........