自动创建表
static std::string m_SqlTable = "create table if not exists log_counter_%d(
`Id` int(11) NOT NULL AUTO_INCREMENT,
`ServerId` int(11) DEFAULT NULL,
`nType` int(11) NOT NULL DEFAULT '0' COMMENT '日志类型',
`nTime` varchar(255) DEFAULT '' COMMENT '插入时间',
`nPlayerGUID` bigint(20) DEFAULT NULL COMMENT '玩家guid',
`nParam1` int(11) DEFAULT '0',
`nParam2` int(11) DEFAULT '0',
`nParam3` int(11) DEFAULT '0',
`nParam4` int(11) DEFAULT '0',
`nParam5` int(11) DEFAULT '0',
`sParam1` varchar(255) DEFAULT NULL,
`sParam2` varchar(255) DEFAULT NULL,
`sParam3` varchar(255) DEFAULT NULL,
`sContent` text COMMENT '内容 json格式(扩展字段)',
PRIMARY KEY (`Id`)
);";
void Init()
{
char buf[1024] = "";
sprintf(buf, m_SqlTable.c_str(), nServerId);
#ifdef WIN32
char name[2048] = {0};
Extralib::Text::ConvertToUtf8(buf, name);
AddDbMsg(name);
#else
AddDbMsg(buf);
#endif
}
Error=2013, Reason=Lost connection to MySQL server during query
https://www.cnblogs.com/zhuiluoyu/p/5953962.html