本文整理汇总了C++中Statement::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ Statement::empty方法的具体用法?C++ Statement::empty怎么用?C++ Statement::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statement
的用法示例。
在下文中一共展示了Statement::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle
void UserStatSaveTask::handle() {
StatMap stmap;
StatManagerI::instance().popStatMap(stmap);
if (stmap.empty()) {
return;
}
Statement sql;
string
head =
"insert into user_stat (userid,login_count,send_msg_count,rev_msg_count,online_buddy_count) values";
int count = 0;
for (StatMap::iterator it = stmap.begin(); it != stmap.end(); ++it) {
count++;
if (count == 1) {
sql.clear();
sql << head;
}
int onlineBuddy = 0;
try {
onlineBuddy = OnlineCenterAdapter::instance().getBuddyCount(
it->first);
} catch (Ice::Exception & e) {
MCE_WARN("UserStatSaveTask::handle --> get OnlineBuddyCount err :"
<< e);
}
if (count > 1) {
sql << ",";
}
sql << "(" << it->first << "," << it->second->loginCount << ","
<< it->second->msgCount << "," << it->second->revMsgCount
<< "," << onlineBuddy << ")";
if (count == 5000) {
try {
QueryRunner("im_stat", CDbWServer).schedule(sql);
} catch (...) {
MCE_WARN("UserStatSaveTask::handle --> do sql err");
}
sql.clear();
count = 0;
}
}
if (!sql.empty()) {
try {
QueryRunner("im_stat", CDbWServer).schedule(sql);
} catch (...) {
MCE_WARN("UserStatSaveTask::handle --> do sql err2");
}
}
}